From 27eede0b221a7dd48b4c98935988d24a91bde6dc Mon Sep 17 00:00:00 2001 From: zhx Date: Wed, 24 Jun 2026 10:50:22 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=95=86=E5=93=81?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E5=9B=BD=E5=AE=B6=E5=B1=95=E7=A4=BA=E5=92=8C?= =?UTF-8?q?=E7=BC=96=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/lang/messages/pages/en.js | 1 + src/lang/messages/pages/zh.js | 1 + .../pay/application/commodity/edit-form.vue | 32 ++++-- .../cnf/pay/application/commodity/index.vue | 99 +++++++++++++++---- 4 files changed, 106 insertions(+), 27 deletions(-) diff --git a/src/lang/messages/pages/en.js b/src/lang/messages/pages/en.js index c394a64..2cc07fe 100644 --- a/src/lang/messages/pages/en.js +++ b/src/lang/messages/pages/en.js @@ -6376,6 +6376,7 @@ export default { table: { createdAt: 'Created At', goldAmount: 'Gold Amount', + country: 'Country', rewardAmount: 'Reward Amount', priceUsd: 'Price (USD)', shelf: 'Enable / Disable', diff --git a/src/lang/messages/pages/zh.js b/src/lang/messages/pages/zh.js index 5405be1..daf6e4d 100644 --- a/src/lang/messages/pages/zh.js +++ b/src/lang/messages/pages/zh.js @@ -6373,6 +6373,7 @@ export default { table: { createdAt: '创建时间', goldAmount: '金币数', + country: '国家', rewardAmount: '奖励数', priceUsd: '价格$', shelf: '上/下架', diff --git a/src/views/cnf/pay/application/commodity/edit-form.vue b/src/views/cnf/pay/application/commodity/edit-form.vue index e11d1be..1aa3730 100644 --- a/src/views/cnf/pay/application/commodity/edit-form.vue +++ b/src/views/cnf/pay/application/commodity/edit-form.vue @@ -11,7 +11,7 @@ >
- + {{ isUpdate ? $t('pages.payApplication.dialog.editProduct') : $t('pages.payApplication.dialog.createProduct') }}
@@ -19,7 +19,7 @@
- {{ row.country.countryName }} + {{ rowCountry.countryName || '-' }}
@@ -56,14 +56,14 @@ -
{{ $t('pages.payApplication.form.salePrice') }}: {{ computedAmount }} {{ row.country.currency }}
+
{{ $t('pages.payApplication.form.salePrice') }}: {{ computedAmount }} {{ rowCountry.currency }}
{{ $t('pages.payApplication.form.salePrice') }}: {{ amountUsd }} USD
- {{ $t('pages.payApplication.form.minLimit') }}: {{ aItem.countryChannelDetails.computedMinLimit }} {{ row.country.currency }}{{ $t('pages.payApplication.word.separator') }} - {{ $t('pages.payApplication.form.maxLimit') }}: {{ aItem.countryChannelDetails.computedMaxLimit }} {{ row.country.currency }}{{ $t('pages.payApplication.word.separator') }} - {{ $t('pages.payApplication.form.dailyLimit') }}: {{ aItem.countryChannelDetails.computedDailyLimit }} {{ row.country.currency }} + {{ $t('pages.payApplication.form.minLimit') }}: {{ aItem.countryChannelDetails.computedMinLimit }} {{ rowCountry.currency }}{{ $t('pages.payApplication.word.separator') }} + {{ $t('pages.payApplication.form.maxLimit') }}: {{ aItem.countryChannelDetails.computedMaxLimit }} {{ rowCountry.currency }}{{ $t('pages.payApplication.word.separator') }} + {{ $t('pages.payApplication.form.dailyLimit') }}: {{ aItem.countryChannelDetails.computedDailyLimit }} {{ rowCountry.currency }}
{{ $t('pages.payApplication.form.minLimit') }}: {{ aItem.countryChannelDetails.factoryMinLimit }} USD{{ $t('pages.payApplication.word.separator') }} @@ -96,7 +96,7 @@ export default { row: { type: Object, require: false, - default: () => {} + default: () => ({}) } }, data() { @@ -119,6 +119,17 @@ export default { } }, computed: { + selectAppInfo() { + return (this.row && this.row.selectApp) || {} + }, + rowCountry() { + const country = (this.row && this.row.country) || {} + return { + icon: country.icon || country.nationalFlag || '', + currency: country.currency || '', + countryName: country.countryName || country.aliasName || country.enName || '' + } + }, isUpdate() { return this.row && this.row.id }, @@ -177,6 +188,13 @@ export default { }, loadSupportAmountChannels() { const that = this + if (!that.row.payCountryId || !validPositiveNumberPointTwo(that.form.amountUsd)) { + that.associateLoading = false + that.supportAmounts = [] + that.computedAmount = '' + that.amountUsd = '' + return + } that.associateLoading = true listCountrytSupportAmountChannels(that.row.payCountryId, that.form.amountUsd) .then(res => { diff --git a/src/views/cnf/pay/application/commodity/index.vue b/src/views/cnf/pay/application/commodity/index.vue index aaebc99..beb62d5 100644 --- a/src/views/cnf/pay/application/commodity/index.vue +++ b/src/views/cnf/pay/application/commodity/index.vue @@ -38,12 +38,12 @@ > - - {{ item.country.aliasName || item.country.enName }} + + {{ getCountryName(item) }} + + + @@ -212,11 +220,11 @@ export default { this.renderData() }, changeApplication(val) { - this.selectApp = this.appInfo.appList.filter(item => item.id === val)[0] + this.selectedApp = this.appInfo.appList.filter(item => item.id === val)[0] || {} this.renderData() }, changeCountry(val) { - this.selectedCountry = this.countryList.filter(item => item.id === val)[0] + this.selectedCountry = this.getCountryByPayCountryId(val) || {} this.renderData() }, loadOpenCountry() { @@ -224,9 +232,9 @@ export default { that.loadingCountry = true listPayOpenCountry().then(res => { that.loadingCountry = false - that.countryList = res.body || [] - this.selectedCountry = that.countryList[0] || {} - that.listQuery.payCountryId = this.selectedCountry.id + that.countryList = that.normalizeList(res.body) + that.selectedCountry = that.countryList[0] || {} + that.listQuery.payCountryId = that.getPayCountryId(that.selectedCountry) that.renderData() }).catch(er => { that.loadingCountry = false @@ -241,10 +249,15 @@ export default { that.listQuery.cursor = 1 } pagePayCommodity(that.listQuery).then(res => { - const { body } = res + const body = res.body || {} that.total = body.total || 0 - that.list = body.records + that.list = body.records || [] that.listLoading = false + }).catch(er => { + that.list = [] + that.total = 0 + that.listLoading = false + console.error(er) }) }, handleSearch() { @@ -261,27 +274,73 @@ export default { 'payCountryId': this.listQuery.payCountryId, 'amountUsd': '', 'selectApp': this.selectedApp, - 'country': this.getEditFromCountry() + 'country': this.getEditFromCountry({ payCountryId: this.listQuery.payCountryId }) } this.appCommodityEditFormVisible = true }, clickEditCommodity(row) { const that = this - that.appCommodityEditFormVisible = true that.selectedEditFrom = Object.assign({}, row) that.selectedEditFrom.selectApp = this.selectedApp - that.selectedEditFrom.country = that.getEditFromCountry() + that.selectedEditFrom.country = that.getEditFromCountry(row) + that.appCommodityEditFormVisible = true }, editFromSuccess() { this.appCommodityEditFormVisible = false this.renderData() }, - getEditFromCountry() { + normalizeList(body) { + if (Array.isArray(body)) { + return body + } + if (body && Array.isArray(body.records)) { + return body.records + } + return [] + }, + getPayCountryId(item) { + return item ? (item.id || item.payCountryId || '') : '' + }, + getCountryBase(item) { + return (item && (item.country || item.payCountry || item.countryInfo || item.sysCountryCode)) || {} + }, + getCountryName(item) { + if (!item) { + return '' + } + const country = this.getCountryBase(item) + return country.aliasName || country.countryName || country.enName || item.payCountryName || item.countryName || item.aliasName || item.enName || '' + }, + getCountryIcon(item) { + if (!item) { + return '' + } + const country = this.getCountryBase(item) + return country.nationalFlag || country.icon || item.nationalFlag || item.countryNationalFlag || item.payCountryNationalFlag || item.icon || '' + }, + getCountryByPayCountryId(payCountryId) { + if (!payCountryId) { + return null + } + return this.countryList.find(item => String(this.getPayCountryId(item)) === String(payCountryId)) + }, + getCommodityCountrySource(row) { + const payCountryId = row && row.payCountryId ? row.payCountryId : this.listQuery.payCountryId + return this.getCountryByPayCountryId(payCountryId) || row || this.selectedCountry || {} + }, + getCommodityCountryName(row) { + return this.getCountryName(row) || this.getCountryName(this.getCommodityCountrySource(row)) || '-' + }, + getCommodityCountryIcon(row) { + return this.getCountryIcon(row) || this.getCountryIcon(this.getCommodityCountrySource(row)) + }, + getEditFromCountry(row) { + const countrySource = this.getCommodityCountrySource(row) return { - 'icon': this.selectedCountry.country.nationalFlag, - 'currency': this.selectedCountry.currency, - 'exchangeRate': this.selectedCountry.usdExchangeRate, - 'countryName': this.selectedCountry.country.aliasName || this.selectedCountry.country.enName + 'icon': this.getCountryIcon(row) || this.getCountryIcon(countrySource), + 'currency': (row && row.currency) || countrySource.currency || '', + 'exchangeRate': (row && (row.usdExchangeRate || row.exchangeRate)) || countrySource.usdExchangeRate || '', + 'countryName': this.getCountryName(row) || this.getCountryName(countrySource) } } }