fix: load pay countries by region
This commit is contained in:
parent
bfb938717c
commit
66c3451b8d
@ -167,7 +167,7 @@
|
||||
<script>
|
||||
import { regionConfigTable } from '@/api/sys'
|
||||
import { productTypeConfs } from '@/constant/type'
|
||||
import { pagePayCommodity, listPayOpenCountry, switchShelfCommodity, syncPayOpenCountryExchangeRate } from '@/api/sys-pay'
|
||||
import { pagePayCommodity, listPayOpenCountry, listPayOpenCountryByRegionId, switchShelfCommodity, syncPayOpenCountryExchangeRate } from '@/api/sys-pay'
|
||||
import Pagination from '@/components/Pagination'
|
||||
import EditForm from './edit-form'
|
||||
|
||||
@ -234,7 +234,6 @@ export default {
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.loadOpenCountry()
|
||||
this.listRegion()
|
||||
},
|
||||
methods: {
|
||||
@ -255,18 +254,26 @@ export default {
|
||||
},
|
||||
changeApplication(val) {
|
||||
this.selectedApp = this.appInfo.appList.filter(item => item.id === val)[0]
|
||||
this.countryList = []
|
||||
this.selectedCountry = {}
|
||||
this.listQuery.payCountryId = ''
|
||||
this.listRegion()
|
||||
},
|
||||
changeCountry(val) {
|
||||
this.selectedCountry = this.getCountryByPayCountryId(val) || {}
|
||||
this.renderData()
|
||||
},
|
||||
loadOpenCountry() {
|
||||
loadOpenCountry(regionId) {
|
||||
const that = this
|
||||
that.loadingCountry = true
|
||||
listPayOpenCountry().then(res => {
|
||||
const request = regionId ? listPayOpenCountryByRegionId(regionId) : listPayOpenCountry()
|
||||
request.then(res => {
|
||||
that.loadingCountry = false
|
||||
that.countryList = that.normalizeList(res.body)
|
||||
if (that.listQuery.payCountryId && !that.getCountryByPayCountryId(that.listQuery.payCountryId)) {
|
||||
that.listQuery.payCountryId = ''
|
||||
that.selectedCountry = {}
|
||||
}
|
||||
}).catch(er => {
|
||||
that.loadingCountry = false
|
||||
console.error(er)
|
||||
@ -278,14 +285,19 @@ export default {
|
||||
regionConfigTable({ 'sysOrigin': that.selectedApp.appCode }).then(res => {
|
||||
that.regions = res.body || []
|
||||
that.selectedRegion = that.regions[0]
|
||||
that.listQuery.regionId = that.selectedRegion.id
|
||||
that.listQuery.regionId = that.selectedRegion ? that.selectedRegion.id : ''
|
||||
that.loading = false
|
||||
that.loadOpenCountry(that.listQuery.regionId)
|
||||
}).catch(er => {
|
||||
that.loading = false
|
||||
that.loadOpenCountry()
|
||||
})
|
||||
},
|
||||
changeRegion(val) {
|
||||
this.selectedRegion = this.regions.filter(item => item.id === val)[0]
|
||||
this.listQuery.payCountryId = ''
|
||||
this.selectedCountry = {}
|
||||
this.loadOpenCountry(val)
|
||||
},
|
||||
renderData(isClean) {
|
||||
const that = this
|
||||
@ -310,7 +322,7 @@ export default {
|
||||
const count = res.body || 0
|
||||
this.$opsMessage.success(`已同步 ${count} 个国家汇率`)
|
||||
this.syncRateLoading = false
|
||||
this.loadOpenCountry()
|
||||
this.loadOpenCountry(this.listQuery.regionId)
|
||||
}).catch(er => {
|
||||
this.syncRateLoading = false
|
||||
console.error(er)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user