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