feat: add atyou pay commodity country config

This commit is contained in:
zhx 2026-06-24 11:56:47 +08:00
parent 27eede0b22
commit bfb938717c
5 changed files with 199 additions and 10 deletions

View File

@ -1,4 +1,6 @@
ENV = 'development'
NODE_ENV = production
ENV = 'production'
VUE_APP_BASE_API = '/console'
@ -16,4 +18,3 @@ VUE_APP_H5_BASE_URL = 'https://h5.azizichat.com'
# start mock
VUE_APP_START_MOCK = false

View File

@ -8,7 +8,7 @@
"dev": "vue-cli-service serve",
"build:dev": "vue-cli-service build --mode development",
"build:prod": "vue-cli-service build",
"build:atu-prod": "vue-cli-service build --mode prod-atyou",
"build:atu-prod": "vue-demi-switch 2 && vue-cli-service build --mode prod-atyou",
"build:stage": "vue-cli-service build --mode staging",
"preview": "node build/index.js --preview",
"lint": "eslint --ext .js,.vue src",

View File

@ -204,6 +204,14 @@ export function updatePayOpenCountryExchangeRate(id, rate) {
})
}
// 开通支付国家-同步全部国家汇率
export function syncPayOpenCountryExchangeRate() {
return request({
url: '/sys-pay-open-country/sync-exchange-rate',
method: 'post'
})
}
// 开通支付国家-修改国家货币
export function updatePayOpenCountryCurrent(id, currency) {
return request({

View File

@ -20,11 +20,24 @@
<el-form-item v-if="row.selectApp.appCode === 'ASWAT'" :label="$t('pages.payApplication.form.region')">
<div class="flex-l">{{ regionName }}</div>
</el-form-item>
<!-- <el-form-item label="售卖国家">
<el-form-item v-if="!isUpdate" label="支持国家" prop="payCountryIds">
<el-select v-model="form.payCountryIds" multiple filterable collapse-tags style="width:100%" placeholder="请选择支持国家">
<el-option
v-for="item in countryList"
:key="getPayCountryId(item)"
:label="getCountryName(item)"
:value="getPayCountryId(item)"
>
<span v-if="getCountryIcon(item)" style="float: left;"> <img :src="getCountryIcon(item)" width="30"></span>
<span style="float: left;margin-left:10px">{{ getCountryName(item) }}</span>
</el-option>
</el-select>
</el-form-item>
<el-form-item v-else :label="$t('pages.payApplication.form.saleCountry')">
<div class="flex-l">
<img v-if="row.country.icon" :src="row.country.icon" width="40"> {{ row.country.countryName }}
<img v-if="rowCountry.icon" :src="rowCountry.icon" width="40"> {{ rowCountry.countryName || '-' }}
</div>
</el-form-item> -->
</el-form-item>
<el-form-item :label="$t('pages.payApplication.form.status')" prop="shelf">
<el-select
v-model="form.shelf"
@ -114,6 +127,11 @@ export default {
type: Object,
require: false,
default: () => {}
},
countryList: {
type: Array,
require: false,
default: () => []
}
},
data() {
@ -129,8 +147,9 @@ export default {
awardContent: '',
amountUsd: '',
type: '',
payCountryIds: [],
regionId: '',
shelf: ''
shelf: true
},
regionName: '',
activeNames: '',
@ -145,6 +164,14 @@ export default {
isUpdate() {
return this.row && this.row.id
},
rowCountry() {
const country = (this.row && this.row.country) || {}
return {
icon: country.icon || country.nationalFlag || '',
currency: country.currency || '',
countryName: country.countryName || country.aliasName || country.enName || ''
}
},
shelfStatusOptions() {
return this.shelfStatus.map(item => ({
...item,
@ -157,6 +184,7 @@ export default {
]
return {
applicationId: commonRules,
payCountryIds: commonRules,
content: commonRules,
awardContent: commonRules,
type: commonRules,
@ -181,6 +209,18 @@ export default {
return
}
this.form = deepClone(newVal)
if (!this.form.payCountryIds || this.form.payCountryIds.length === 0) {
this.$set(this.form, 'payCountryIds', this.form.payCountryId ? [this.form.payCountryId] : [])
}
if (!this.form.awardContent && this.form.awardContent !== 0) {
this.$set(this.form, 'awardContent', '0')
}
if (this.form.shelf === '' || this.form.shelf === undefined || this.form.shelf === null) {
this.$set(this.form, 'shelf', true)
}
if (!this.form.type) {
this.$set(this.form, 'type', 'GOLD')
}
this.regionName = newVal.regionName
this.loadSupportAmountChannels()
},
@ -196,6 +236,26 @@ export default {
handleClose() {
this.$emit('close')
},
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 || ''
},
changeAmount(val) {
if (!val || !validPositiveNumberPointTwo(val)) {
this.supportAmounts = []

View File

@ -27,6 +27,25 @@
<span style="float: left;margin-left:10px">{{ item.appName }}</span>
</el-option>
</el-select>
<el-select
v-model="listQuery.payCountryId"
v-loading="loadingCountry"
:placeholder="$t('pages.payApplication.placeholder.country')"
style="width: 200px"
class="filter-item"
clearable
@change="changeCountry"
>
<el-option
v-for="item in countryList"
:key="getPayCountryId(item)"
:label="getCountryName(item)"
:value="getPayCountryId(item)"
>
<span v-if="getCountryIcon(item)" style="float: left;"> <img :src="getCountryIcon(item)" width="30"></span>
<span style="float: left;margin-left:10px">{{ getCountryName(item) }}</span>
</el-option>
</el-select>
<el-select
v-if="selectedApp.appCode === 'ASWAT'"
v-model="listQuery.regionId"
@ -71,6 +90,15 @@
>
{{ $t('pages.payApplication.action.search') }}
</el-button>
<el-button
class="filter-item"
type="warning"
icon="el-icon-refresh"
:loading="syncRateLoading"
@click="syncExchangeRate"
>
同步全球汇率
</el-button>
<el-button
class="filter-item"
type="primary"
@ -91,6 +119,14 @@
>
<el-table-column label="ID" prop="id" align="center" />
<el-table-column :label="$t('pages.payApplication.table.region')" prop="regionName" align="center" />
<el-table-column :label="$t('pages.payApplication.table.country')" align="center" width="180">
<template slot-scope="scope">
<span v-if="getCommodityCountryIcon(scope.row)" style="display:inline-block;margin-right:6px;vertical-align:middle;">
<img :src="getCommodityCountryIcon(scope.row)" width="28">
</span>
<span>{{ getCommodityCountryName(scope.row) }}</span>
</template>
</el-table-column>
<el-table-column :label="$t('pages.payApplication.table.goldAmount')" prop="content" align="center" />
<el-table-column :label="$t('pages.payApplication.table.rewardAmount')" prop="awardContent" align="center" />
<el-table-column :label="$t('pages.payApplication.table.priceUsd')" prop="amountUsd" align="center" />
@ -122,6 +158,7 @@
<edit-form
v-if="appCommodityEditFormVisible"
:row="selectedEditFrom"
:country-list="countryList"
@close="appCommodityEditFormVisible=false"
@success="editFromSuccess"
/>
@ -130,7 +167,7 @@
<script>
import { regionConfigTable } from '@/api/sys'
import { productTypeConfs } from '@/constant/type'
import { pagePayCommodity, switchShelfCommodity } from '@/api/sys-pay'
import { pagePayCommodity, listPayOpenCountry, switchShelfCommodity, syncPayOpenCountryExchangeRate } from '@/api/sys-pay'
import Pagination from '@/components/Pagination'
import EditForm from './edit-form'
@ -157,6 +194,7 @@ export default {
selectedApp: {},
selectedRegion: '',
regions: [],
syncRateLoading: false,
list: [],
total: 0,
listQuery: {
@ -164,12 +202,14 @@ export default {
limit: 30,
id: '',
applicationId: '',
payCountryId: '',
shelf: true,
type: 'GOLD',
regionId: ''
},
listLoading: false,
countryList: [],
loadingCountry: false,
loading: false
}
},
@ -194,6 +234,7 @@ export default {
}
},
created() {
this.loadOpenCountry()
this.listRegion()
},
methods: {
@ -217,9 +258,20 @@ export default {
this.listRegion()
},
changeCountry(val) {
this.selectedCountry = this.countryList.filter(item => item.id === val)[0]
this.selectedCountry = this.getCountryByPayCountryId(val) || {}
this.renderData()
},
loadOpenCountry() {
const that = this
that.loadingCountry = true
listPayOpenCountry().then(res => {
that.loadingCountry = false
that.countryList = that.normalizeList(res.body)
}).catch(er => {
that.loadingCountry = false
console.error(er)
})
},
listRegion() {
const that = this
that.loading = true
@ -252,6 +304,18 @@ export default {
handleSearch() {
this.renderData(true)
},
syncExchangeRate() {
this.syncRateLoading = true
syncPayOpenCountryExchangeRate().then(res => {
const count = res.body || 0
this.$opsMessage.success(`已同步 ${count} 个国家汇率`)
this.syncRateLoading = false
this.loadOpenCountry()
}).catch(er => {
this.syncRateLoading = false
console.error(er)
})
},
handleClose() {
//
this.$refs.form.clearValidate()
@ -261,7 +325,8 @@ export default {
this.selectedEditFrom = {
'applicationId': this.listQuery.applicationId,
'amountUsd': '',
'selectApp': this.selectedApp
'selectApp': this.selectedApp,
'payCountryIds': this.listQuery.payCountryId ? [this.listQuery.payCountryId] : []
}
if (this.selectedApp.appCode === 'ASWAT') {
this.selectedEditFrom.regionId = this.selectedRegion.id
@ -274,6 +339,7 @@ export default {
that.appCommodityEditFormVisible = true
that.selectedEditFrom = Object.assign({}, row)
that.selectedEditFrom.selectApp = this.selectedApp
that.selectedEditFrom.country = that.getEditFromCountry(row)
if (this.selectedApp.appCode === 'ASWAT') {
this.selectedEditFrom.regionId = this.selectedRegion.id
this.selectedEditFrom.regionName = this.selectedRegion.regionName
@ -282,6 +348,60 @@ export default {
editFromSuccess() {
this.appCommodityEditFormVisible = false
this.renderData()
},
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.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)
}
}
}
}