fix: fallback pay country options
This commit is contained in:
parent
66c3451b8d
commit
ac269eb996
@ -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, listPayOpenCountryByRegionId, switchShelfCommodity, syncPayOpenCountryExchangeRate } from '@/api/sys-pay'
|
import { pagePayCommodity, pagePayOpenCounty, 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'
|
||||||
|
|
||||||
@ -266,19 +266,42 @@ export default {
|
|||||||
loadOpenCountry(regionId) {
|
loadOpenCountry(regionId) {
|
||||||
const that = this
|
const that = this
|
||||||
that.loadingCountry = true
|
that.loadingCountry = true
|
||||||
const request = regionId ? listPayOpenCountryByRegionId(regionId) : listPayOpenCountry()
|
const request = regionId ? listPayOpenCountryByRegionId(regionId) : that.loadAllOpenCountry()
|
||||||
request.then(res => {
|
request.then(res => {
|
||||||
that.loadingCountry = false
|
const countryList = that.normalizeList(res.body)
|
||||||
that.countryList = that.normalizeList(res.body)
|
if (countryList.length > 0 || !regionId) {
|
||||||
if (that.listQuery.payCountryId && !that.getCountryByPayCountryId(that.listQuery.payCountryId)) {
|
that.loadingCountry = false
|
||||||
that.listQuery.payCountryId = ''
|
that.applyCountryList(countryList)
|
||||||
that.selectedCountry = {}
|
return
|
||||||
}
|
}
|
||||||
|
that.loadAllOpenCountry().then(fallbackRes => {
|
||||||
|
that.loadingCountry = false
|
||||||
|
that.applyCountryList(that.normalizeList(fallbackRes.body))
|
||||||
|
}).catch(er => {
|
||||||
|
that.loadingCountry = false
|
||||||
|
console.error(er)
|
||||||
|
})
|
||||||
}).catch(er => {
|
}).catch(er => {
|
||||||
that.loadingCountry = false
|
|
||||||
console.error(er)
|
console.error(er)
|
||||||
|
that.loadAllOpenCountry().then(fallbackRes => {
|
||||||
|
that.loadingCountry = false
|
||||||
|
that.applyCountryList(that.normalizeList(fallbackRes.body))
|
||||||
|
}).catch(fallbackErr => {
|
||||||
|
that.loadingCountry = false
|
||||||
|
console.error(fallbackErr)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
loadAllOpenCountry() {
|
||||||
|
return pagePayOpenCounty({ cursor: 1, limit: 500 })
|
||||||
|
},
|
||||||
|
applyCountryList(countryList) {
|
||||||
|
this.countryList = countryList
|
||||||
|
if (this.listQuery.payCountryId && !this.getCountryByPayCountryId(this.listQuery.payCountryId)) {
|
||||||
|
this.listQuery.payCountryId = ''
|
||||||
|
this.selectedCountry = {}
|
||||||
|
}
|
||||||
|
},
|
||||||
listRegion() {
|
listRegion() {
|
||||||
const that = this
|
const that = this
|
||||||
that.loading = true
|
that.loading = true
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user