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> <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,18 +266,41 @@ 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 => {
const countryList = that.normalizeList(res.body)
if (countryList.length > 0 || !regionId) {
that.loadingCountry = false that.loadingCountry = false
that.countryList = that.normalizeList(res.body) that.applyCountryList(countryList)
if (that.listQuery.payCountryId && !that.getCountryByPayCountryId(that.listQuery.payCountryId)) { return
that.listQuery.payCountryId = ''
that.selectedCountry = {}
} }
that.loadAllOpenCountry().then(fallbackRes => {
that.loadingCountry = false
that.applyCountryList(that.normalizeList(fallbackRes.body))
}).catch(er => { }).catch(er => {
that.loadingCountry = false that.loadingCountry = false
console.error(er) console.error(er)
}) })
}).catch(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