fix: fallback pay country options

This commit is contained in:
zhx 2026-06-24 12:26:54 +08:00
parent 66c3451b8d
commit ac269eb996

View File

@ -167,7 +167,7 @@
<script>
import { regionConfigTable } from '@/api/sys'
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 EditForm from './edit-form'
@ -266,19 +266,42 @@ export default {
loadOpenCountry(regionId) {
const that = this
that.loadingCountry = true
const request = regionId ? listPayOpenCountryByRegionId(regionId) : listPayOpenCountry()
const request = regionId ? listPayOpenCountryByRegionId(regionId) : that.loadAllOpenCountry()
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 = {}
const countryList = that.normalizeList(res.body)
if (countryList.length > 0 || !regionId) {
that.loadingCountry = false
that.applyCountryList(countryList)
return
}
that.loadAllOpenCountry().then(fallbackRes => {
that.loadingCountry = false
that.applyCountryList(that.normalizeList(fallbackRes.body))
}).catch(er => {
that.loadingCountry = false
console.error(er)
})
}).catch(er => {
that.loadingCountry = false
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() {
const that = this
that.loading = true