feat: add atyou pay commodity country config
This commit is contained in:
parent
27eede0b22
commit
bfb938717c
@ -1,4 +1,6 @@
|
|||||||
ENV = 'development'
|
NODE_ENV = production
|
||||||
|
|
||||||
|
ENV = 'production'
|
||||||
|
|
||||||
VUE_APP_BASE_API = '/console'
|
VUE_APP_BASE_API = '/console'
|
||||||
|
|
||||||
@ -16,4 +18,3 @@ VUE_APP_H5_BASE_URL = 'https://h5.azizichat.com'
|
|||||||
|
|
||||||
# start mock
|
# start mock
|
||||||
VUE_APP_START_MOCK = false
|
VUE_APP_START_MOCK = false
|
||||||
|
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
"dev": "vue-cli-service serve",
|
"dev": "vue-cli-service serve",
|
||||||
"build:dev": "vue-cli-service build --mode development",
|
"build:dev": "vue-cli-service build --mode development",
|
||||||
"build:prod": "vue-cli-service build",
|
"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",
|
"build:stage": "vue-cli-service build --mode staging",
|
||||||
"preview": "node build/index.js --preview",
|
"preview": "node build/index.js --preview",
|
||||||
"lint": "eslint --ext .js,.vue src",
|
"lint": "eslint --ext .js,.vue src",
|
||||||
|
|||||||
@ -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) {
|
export function updatePayOpenCountryCurrent(id, currency) {
|
||||||
return request({
|
return request({
|
||||||
|
|||||||
@ -20,11 +20,24 @@
|
|||||||
<el-form-item v-if="row.selectApp.appCode === 'ASWAT'" :label="$t('pages.payApplication.form.region')">
|
<el-form-item v-if="row.selectApp.appCode === 'ASWAT'" :label="$t('pages.payApplication.form.region')">
|
||||||
<div class="flex-l">{{ regionName }}</div>
|
<div class="flex-l">{{ regionName }}</div>
|
||||||
</el-form-item>
|
</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">
|
<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>
|
</div>
|
||||||
</el-form-item> -->
|
</el-form-item>
|
||||||
<el-form-item :label="$t('pages.payApplication.form.status')" prop="shelf">
|
<el-form-item :label="$t('pages.payApplication.form.status')" prop="shelf">
|
||||||
<el-select
|
<el-select
|
||||||
v-model="form.shelf"
|
v-model="form.shelf"
|
||||||
@ -114,6 +127,11 @@ export default {
|
|||||||
type: Object,
|
type: Object,
|
||||||
require: false,
|
require: false,
|
||||||
default: () => {}
|
default: () => {}
|
||||||
|
},
|
||||||
|
countryList: {
|
||||||
|
type: Array,
|
||||||
|
require: false,
|
||||||
|
default: () => []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
@ -129,8 +147,9 @@ export default {
|
|||||||
awardContent: '',
|
awardContent: '',
|
||||||
amountUsd: '',
|
amountUsd: '',
|
||||||
type: '',
|
type: '',
|
||||||
|
payCountryIds: [],
|
||||||
regionId: '',
|
regionId: '',
|
||||||
shelf: ''
|
shelf: true
|
||||||
},
|
},
|
||||||
regionName: '',
|
regionName: '',
|
||||||
activeNames: '',
|
activeNames: '',
|
||||||
@ -145,6 +164,14 @@ export default {
|
|||||||
isUpdate() {
|
isUpdate() {
|
||||||
return this.row && this.row.id
|
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() {
|
shelfStatusOptions() {
|
||||||
return this.shelfStatus.map(item => ({
|
return this.shelfStatus.map(item => ({
|
||||||
...item,
|
...item,
|
||||||
@ -157,6 +184,7 @@ export default {
|
|||||||
]
|
]
|
||||||
return {
|
return {
|
||||||
applicationId: commonRules,
|
applicationId: commonRules,
|
||||||
|
payCountryIds: commonRules,
|
||||||
content: commonRules,
|
content: commonRules,
|
||||||
awardContent: commonRules,
|
awardContent: commonRules,
|
||||||
type: commonRules,
|
type: commonRules,
|
||||||
@ -181,6 +209,18 @@ export default {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.form = deepClone(newVal)
|
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.regionName = newVal.regionName
|
||||||
this.loadSupportAmountChannels()
|
this.loadSupportAmountChannels()
|
||||||
},
|
},
|
||||||
@ -196,6 +236,26 @@ export default {
|
|||||||
handleClose() {
|
handleClose() {
|
||||||
this.$emit('close')
|
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) {
|
changeAmount(val) {
|
||||||
if (!val || !validPositiveNumberPointTwo(val)) {
|
if (!val || !validPositiveNumberPointTwo(val)) {
|
||||||
this.supportAmounts = []
|
this.supportAmounts = []
|
||||||
|
|||||||
@ -27,6 +27,25 @@
|
|||||||
<span style="float: left;margin-left:10px">{{ item.appName }}</span>
|
<span style="float: left;margin-left:10px">{{ item.appName }}</span>
|
||||||
</el-option>
|
</el-option>
|
||||||
</el-select>
|
</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
|
<el-select
|
||||||
v-if="selectedApp.appCode === 'ASWAT'"
|
v-if="selectedApp.appCode === 'ASWAT'"
|
||||||
v-model="listQuery.regionId"
|
v-model="listQuery.regionId"
|
||||||
@ -71,6 +90,15 @@
|
|||||||
>
|
>
|
||||||
{{ $t('pages.payApplication.action.search') }}
|
{{ $t('pages.payApplication.action.search') }}
|
||||||
</el-button>
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
class="filter-item"
|
||||||
|
type="warning"
|
||||||
|
icon="el-icon-refresh"
|
||||||
|
:loading="syncRateLoading"
|
||||||
|
@click="syncExchangeRate"
|
||||||
|
>
|
||||||
|
同步全球汇率
|
||||||
|
</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
class="filter-item"
|
class="filter-item"
|
||||||
type="primary"
|
type="primary"
|
||||||
@ -91,6 +119,14 @@
|
|||||||
>
|
>
|
||||||
<el-table-column label="ID" prop="id" align="center" />
|
<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.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.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.rewardAmount')" prop="awardContent" align="center" />
|
||||||
<el-table-column :label="$t('pages.payApplication.table.priceUsd')" prop="amountUsd" align="center" />
|
<el-table-column :label="$t('pages.payApplication.table.priceUsd')" prop="amountUsd" align="center" />
|
||||||
@ -122,6 +158,7 @@
|
|||||||
<edit-form
|
<edit-form
|
||||||
v-if="appCommodityEditFormVisible"
|
v-if="appCommodityEditFormVisible"
|
||||||
:row="selectedEditFrom"
|
:row="selectedEditFrom"
|
||||||
|
:country-list="countryList"
|
||||||
@close="appCommodityEditFormVisible=false"
|
@close="appCommodityEditFormVisible=false"
|
||||||
@success="editFromSuccess"
|
@success="editFromSuccess"
|
||||||
/>
|
/>
|
||||||
@ -130,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, switchShelfCommodity } from '@/api/sys-pay'
|
import { pagePayCommodity, listPayOpenCountry, 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'
|
||||||
|
|
||||||
@ -157,6 +194,7 @@ export default {
|
|||||||
selectedApp: {},
|
selectedApp: {},
|
||||||
selectedRegion: '',
|
selectedRegion: '',
|
||||||
regions: [],
|
regions: [],
|
||||||
|
syncRateLoading: false,
|
||||||
list: [],
|
list: [],
|
||||||
total: 0,
|
total: 0,
|
||||||
listQuery: {
|
listQuery: {
|
||||||
@ -164,12 +202,14 @@ export default {
|
|||||||
limit: 30,
|
limit: 30,
|
||||||
id: '',
|
id: '',
|
||||||
applicationId: '',
|
applicationId: '',
|
||||||
|
payCountryId: '',
|
||||||
shelf: true,
|
shelf: true,
|
||||||
type: 'GOLD',
|
type: 'GOLD',
|
||||||
regionId: ''
|
regionId: ''
|
||||||
},
|
},
|
||||||
listLoading: false,
|
listLoading: false,
|
||||||
countryList: [],
|
countryList: [],
|
||||||
|
loadingCountry: false,
|
||||||
loading: false
|
loading: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -194,6 +234,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
this.loadOpenCountry()
|
||||||
this.listRegion()
|
this.listRegion()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@ -217,9 +258,20 @@ export default {
|
|||||||
this.listRegion()
|
this.listRegion()
|
||||||
},
|
},
|
||||||
changeCountry(val) {
|
changeCountry(val) {
|
||||||
this.selectedCountry = this.countryList.filter(item => item.id === val)[0]
|
this.selectedCountry = this.getCountryByPayCountryId(val) || {}
|
||||||
this.renderData()
|
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() {
|
listRegion() {
|
||||||
const that = this
|
const that = this
|
||||||
that.loading = true
|
that.loading = true
|
||||||
@ -252,6 +304,18 @@ export default {
|
|||||||
handleSearch() {
|
handleSearch() {
|
||||||
this.renderData(true)
|
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() {
|
handleClose() {
|
||||||
// 去除校验
|
// 去除校验
|
||||||
this.$refs.form.clearValidate()
|
this.$refs.form.clearValidate()
|
||||||
@ -261,7 +325,8 @@ export default {
|
|||||||
this.selectedEditFrom = {
|
this.selectedEditFrom = {
|
||||||
'applicationId': this.listQuery.applicationId,
|
'applicationId': this.listQuery.applicationId,
|
||||||
'amountUsd': '',
|
'amountUsd': '',
|
||||||
'selectApp': this.selectedApp
|
'selectApp': this.selectedApp,
|
||||||
|
'payCountryIds': this.listQuery.payCountryId ? [this.listQuery.payCountryId] : []
|
||||||
}
|
}
|
||||||
if (this.selectedApp.appCode === 'ASWAT') {
|
if (this.selectedApp.appCode === 'ASWAT') {
|
||||||
this.selectedEditFrom.regionId = this.selectedRegion.id
|
this.selectedEditFrom.regionId = this.selectedRegion.id
|
||||||
@ -274,6 +339,7 @@ export default {
|
|||||||
that.appCommodityEditFormVisible = true
|
that.appCommodityEditFormVisible = true
|
||||||
that.selectedEditFrom = Object.assign({}, row)
|
that.selectedEditFrom = Object.assign({}, row)
|
||||||
that.selectedEditFrom.selectApp = this.selectedApp
|
that.selectedEditFrom.selectApp = this.selectedApp
|
||||||
|
that.selectedEditFrom.country = that.getEditFromCountry(row)
|
||||||
if (this.selectedApp.appCode === 'ASWAT') {
|
if (this.selectedApp.appCode === 'ASWAT') {
|
||||||
this.selectedEditFrom.regionId = this.selectedRegion.id
|
this.selectedEditFrom.regionId = this.selectedRegion.id
|
||||||
this.selectedEditFrom.regionName = this.selectedRegion.regionName
|
this.selectedEditFrom.regionName = this.selectedRegion.regionName
|
||||||
@ -282,6 +348,60 @@ export default {
|
|||||||
editFromSuccess() {
|
editFromSuccess() {
|
||||||
this.appCommodityEditFormVisible = false
|
this.appCommodityEditFormVisible = false
|
||||||
this.renderData()
|
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)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user