feat(开通国家支付页面-->关联渠道组件): 添加渠道后执行更新数据的操作,以获取国家列表的项id

This commit is contained in:
hzj 2026-01-22 19:15:33 +08:00
parent 77d48af4f6
commit 17392fab0a
2 changed files with 391 additions and 227 deletions

View File

@ -9,7 +9,9 @@
top="20px"
>
<div class="form-edit">
<!-- 头部国家信息 -->
<div v-loading="loading" class="operation-but">
<!-- 国家基本信息 -->
<div class="flex-r">
<el-image
style="width: 30px; height: 18px;margin: 0px 5px;"
@ -20,9 +22,10 @@
<i class="el-icon-picture-outline" />
</div>
</el-image>
{{ row.country.aliasName }}
国家货币: {{ row.currency }}
{{ row.country.aliasName }} 国家货币: {{ row.currency }}
美元汇率: {{ row.usdExchangeRate }}
<!-- 添加渠道 按钮 -->
<div style="margin-left: 20px;">
<transfer-channel
:selected-channels="channelCodes"
@ -33,58 +36,159 @@
</div>
</div>
</div>
<!-- 渠道列表 -->
<el-form ref="form" label-position="top">
<el-collapse v-if="list && list.length > 0" v-model="activeNames">
<el-collapse-item v-for="(item,index) in list" :key="index" :name="item.channelCode">
<!-- 渠道列表项 -->
<el-collapse-item
v-for="(item, index) in list"
:key="index"
:name="item.channelCode"
>
<!-- 标题插槽 -->
<template slot="title">
<div class="flex-l" style="width: 100%;">
<img class="channel-icon" :src="item.channel.channelIcon" alt="icon" width="30" height="30">
<div style="width: 100%;" class="channel-name nowrap-ellipsis">{{ item.channel.channelName }}</div>
<img
class="channel-icon"
:src="item.channel.channelIcon"
alt="icon"
width="30"
height="30"
/>
<div
style="width: 100%;"
class="channel-name nowrap-ellipsis"
>
{{ item.channel.channelName }}
</div>
<!-- <div>
<el-button type="text" style="color: #F56C6C;" @click.stop="clickDeleteChannel"><i class="el-icon-delete" />删除</el-button>
</div> -->
</div>
</template>
<div v-for="(aItem,aIndex) in item.countryChannels" :key="aIndex" class="channel-item">
<!-- 详细信息 -->
<div
v-for="(aItem, aIndex) in item.countryChannels"
:key="aIndex"
class="channel-item"
>
<!-- 支付方式 -->
<el-col :md="4">
<div class="flex-l input-content">
<img class="channel-icon" :src="aItem.payFactory.factoryIcon" alt="icon" width="30" height="30">
<div class="channel-name nowrap-ellipsis">{{ aItem.payFactory.factoryName }}</div>
<img
class="channel-icon"
:src="aItem.payFactory.factoryIcon"
alt="icon"
width="30"
height="30"
/>
<div class="channel-name nowrap-ellipsis">
{{ aItem.payFactory.factoryName }}
</div>
</div>
</el-col>
<!-- 设置项 -->
<el-col :md="20">
<!-- 最小额度 -->
<el-col :md="8" class="channel-item-form">
<el-form-item label="最小额度">
<el-input v-model.trim="aItem.countryChannelDetails.factoryMinLimit" :disabled="aItem.disabled" placeholder="最小限额" class="input-with-select" maxlength="10" @change="()=> changeFactoryVal(aItem, 'factoryMinLimit')">
<template slot="append">USD</template>
</el-input>
</el-form-item>
</el-col>
<el-col :md="8" class="channel-item-form">
<el-form-item label="最大额度">
<el-input v-model.trim="aItem.countryChannelDetails.factoryMaxLimit" :disabled="aItem.disabled" placeholder="最小限额" class="input-with-select" maxlength="10" @change="()=> changeFactoryVal(aItem, 'factoryMaxLimit')">
<template slot="append">USD</template>
</el-input>
</el-form-item>
</el-col>
<el-col :md="8" class="channel-item-form">
<el-form-item label="每日限额">
<el-input v-model.trim="aItem.countryChannelDetails.factoryDailyLimit" :disabled="aItem.disabled" placeholder="每日限额" class="input-with-select" maxlength="10" @change="()=> changeFactoryVal(aItem, 'factoryDailyLimit')">
<template slot="append">USD</template>
<el-input
v-model.trim="
aItem.countryChannelDetails.factoryMinLimit
"
:disabled="aItem.disabled"
placeholder="最小限额"
class="input-with-select"
maxlength="10"
@change="
() => changeFactoryVal(aItem, 'factoryMinLimit')
"
>
<template slot="append"
>USD</template
>
</el-input>
</el-form-item>
</el-col>
<!-- 最大额度 -->
<el-col :md="8" class="channel-item-form">
<el-form-item label="最大额度">
<el-input
v-model.trim="
aItem.countryChannelDetails.factoryMaxLimit
"
:disabled="aItem.disabled"
placeholder="最小限额"
class="input-with-select"
maxlength="10"
@change="
() => changeFactoryVal(aItem, 'factoryMaxLimit')
"
>
<template slot="append"
>USD</template
>
</el-input>
</el-form-item>
</el-col>
<!-- 每日额度 -->
<el-col :md="8" class="channel-item-form">
<el-form-item label="每日限额">
<el-input
v-model.trim="
aItem.countryChannelDetails.factoryDailyLimit
"
:disabled="aItem.disabled"
placeholder="每日限额"
class="input-with-select"
maxlength="10"
@change="
() => changeFactoryVal(aItem, 'factoryDailyLimit')
"
>
<template slot="append"
>USD</template
>
</el-input>
</el-form-item>
</el-col>
<!-- 渠道CODE -->
<el-col :md="8" class="channel-item-form">
<el-form-item label="第三方渠道CODE">
<el-input v-model="aItem.countryChannelDetails.factoryChannel" :disabled="aItem.disabled" placeholder="请输入第三方厂商渠道CODE" @change="(val)=>changeFactoryVal(aItem, 'factoryChannel')" />
<el-input
v-model="aItem.countryChannelDetails.factoryChannel"
:disabled="aItem.disabled"
placeholder="请输入第三方厂商渠道CODE"
@change="
val => changeFactoryVal(aItem, 'factoryChannel')
"
/>
</el-form-item>
</el-col>
<!-- 货币小数点 -->
<el-col :md="8" class="channel-item-form">
<el-form-item label="货币小数点(暂时没用)">
<el-input v-model="aItem.countryChannelDetails.factoryCurrencyPoint" :disabled="aItem.disabled" placeholder="货币小数点,默认2位" @change="(val)=>changeFactoryVal(aItem, 'factoryCurrencyPoint')" />
<el-input
v-model="
aItem.countryChannelDetails.factoryCurrencyPoint
"
:disabled="aItem.disabled"
placeholder="货币小数点,默认2位"
@change="
val => changeFactoryVal(aItem, 'factoryCurrencyPoint')
"
/>
</el-form-item>
</el-col>
<!-- 是否启动 -->
<el-col :md="8" class="channel-item-form">
<el-form-item label="是否启动">
<el-switch
@ -98,18 +202,21 @@
</el-col>
</el-col>
</div>
</el-collapse-item>
</el-collapse>
</el-form>
</div>
</el-dialog>
</div>
</template>
<script>
import { listPayCountryChannel, addBatchCountyAssociateChannel, delBatchPayCountryChannel, addOrUpdateCountyChannelDetails } from '@/api/sys-pay'
import TransferChannel from './../comp/transfer-channel'
import {
listPayCountryChannel,
addBatchCountyAssociateChannel,
delBatchPayCountryChannel,
addOrUpdateCountyChannelDetails
} from "@/api/sys-pay";
import TransferChannel from "./../comp/transfer-channel";
export default {
components: { TransferChannel },
props: {
@ -121,118 +228,128 @@ export default {
},
data() {
return {
activeNames: 'PAER_MAX',
activeNames: "PAER_MAX",
loading: false,
list: [],
channelCodes: [],
payCountryId: ''
}
},
computed: {
payCountryId: ""
};
},
computed: {},
watch: {
row: {
handler(newVal) {
if (!newVal) {
return
return;
}
this.payCountryId = newVal.id
this.renderData()
this.payCountryId = newVal.id;
this.renderData();
},
immediate: true
}
},
methods: {
changeFactoryVal(item, field) {
console.log('item', item)
if (field === 'factoryMinLimit' ||
field === 'factoryMaxLimit' ||
field === 'factoryDailyLimit') {
const regx = /^\d{1,8}(\.\d{0,2})?$/
console.log("item", item);
if (
field === "factoryMinLimit" ||
field === "factoryMaxLimit" ||
field === "factoryDailyLimit"
) {
const regx = /^\d{1,8}(\.\d{0,2})?$/;
if (!regx.test(item.countryChannelDetails[field])) {
this.$opsMessage.fail('输入支持范围0 ~ 99999999最多2位小数')
return
this.$opsMessage.fail("输入支持范围0 ~ 99999999最多2位小数");
return;
}
}
if (field === 'factoryCurrencyPoint') {
if (field === "factoryCurrencyPoint") {
if (item.factoryCurrencyPoint < 0 || item.factoryCurrencyPoint > 6) {
this.$opsMessage.fail('货币小数点范围0 ~ 6')
return
this.$opsMessage.fail("货币小数点范围0 ~ 6");
return;
}
}
item.disabled = !item.countryChannelDetails.id
item.loading = true
addOrUpdateCountyChannelDetails(item.countryChannelDetails).then(res => {
item.loading = false
item.disabled = false
item.countryChannelDetails.id = res.body.id
}).catch(er => {
item.disabled = false
item.loading = false
console.error(er)
})
item.disabled = !item.countryChannelDetails.id;
item.loading = true;
addOrUpdateCountyChannelDetails(item.countryChannelDetails)
.then(res => {
item.loading = false;
item.disabled = false;
item.countryChannelDetails.id = res.body.id;
this.renderData();
})
.catch(er => {
item.disabled = false;
item.loading = false;
console.error(er);
});
},
hideTransferChannel(isChange) {
if (isChange) {
this.renderData()
this.renderData();
}
},
handleChange(value, direction, movedKeys) {
const that = this
if (direction === 'right') {
const that = this;
if (direction === "right") {
addBatchCountyAssociateChannel({
payCountryId: that.payCountryId,
channelCodes: movedKeys
}).then(res => {
that.$opsMessage.success()
}).catch(er => {
console.error(er)
})
return
.then(res => {
that.$opsMessage.success();
})
.catch(er => {
console.error(er);
});
return;
}
delBatchPayCountryChannel({
payCountryId: that.payCountryId,
channelCodes: movedKeys
}).then(res => {
that.$opsMessage.success()
}).catch(er => {
console.error(er)
})
.then(res => {
that.$opsMessage.success();
})
.catch(er => {
console.error(er);
});
},
renderData() {
this.loadListPayCountryChannel(this.payCountryId)
this.loadListPayCountryChannel(this.payCountryId);
},
loadListPayCountryChannel(payCountryId) {
const that = this
that.loading = true
listPayCountryChannel(payCountryId).then(res => {
that.loading = false
const list = res.body || []
list.forEach(item => {
item.countryChannels.forEach(cItem => {
cItem.loading = false
cItem.disabled = false
})
const that = this;
that.loading = true;
listPayCountryChannel(payCountryId)
.then(res => {
that.loading = false;
const list = res.body || [];
list.forEach(item => {
item.countryChannels.forEach(cItem => {
cItem.loading = false;
cItem.disabled = false;
});
});
that.list = list;
that.channelCodes = list.map(item => item.associated.channelCode);
})
that.list = list
that.channelCodes = list.map(item => item.associated.channelCode)
}).catch(er => {
that.loading = false
console.error(er)
})
.catch(er => {
that.loading = false;
console.error(er);
});
},
handleClose() {
this.$emit('close')
this.$emit("close");
}
}
}
};
</script>
<style lang="scss">
.associated-channels {
.el-switch__label {
color: #333333;
}
.associated-channels {
.el-switch__label {
color: #333333;
}
}
</style>
<style scoped lang="scss">
.associated-channels {
@ -240,45 +357,43 @@ export default {
max-height: 70vh;
overflow: auto;
.operation-but {
text-align: right;
padding: 0px 20px;
position: absolute;
width: 100%;
top: 45px;
left: 0px;
right: 0px;
z-index: 999;
text-align: right;
padding: 0px 20px;
position: absolute;
width: 100%;
top: 45px;
left: 0px;
right: 0px;
z-index: 999;
}
.channel-name {
padding: 0px 5px;
}
.channel-icon {
border-radius: 50%;
border-radius: 50%;
}
.col {
padding: 0px 10px;
padding: 0px 10px;
}
.margin-top-10 {
margin-top: 10px;
margin-top: 10px;
}
.channel-item + .channel-item {
margin-top: 10px;
}
.channel-item {
background-color: #828f98;
padding: 10px;
border-radius: 5px;
overflow: hidden;
.channel-item-form {
padding: 0px 5px;
}
background-color: #828f98;
padding: 10px;
border-radius: 5px;
overflow: hidden;
.channel-item-form {
padding: 0px 5px;
}
}
}
.input-content {
margin-top: 5px;
color: #333333;
}
.input-content {
margin-top: 5px;
color: #333333;
}
}
</style>

View File

@ -1,7 +1,8 @@
<template>
<div class="app-container">
<!-- 搜索条件 -->
<div class="filter-container">
<!-- 上下架 -->
<el-select
v-model="listQuery.shelf"
style="width: 120px"
@ -9,12 +10,14 @@
@change="handleSearch"
>
<el-option
v-for="(item, index ) in shelfStatus"
v-for="(item, index) in shelfStatus"
:key="index"
:label="item.name"
:value="item.value"
/>
</el-select>
<!-- 添加 按钮 -->
<el-button
class="filter-item"
type="primary"
@ -23,6 +26,8 @@
>
添加
</el-button>
<!-- 刷新 按钮 -->
<el-button
class="filter-item"
type="primary"
@ -33,6 +38,7 @@
</el-button>
</div>
<!-- 表单 -->
<el-table
v-loading="listLoading"
:data="list"
@ -40,6 +46,7 @@
fit
highlight-current-row
>
<!-- 国家信息 -->
<el-table-column width="200" label="国家信息" align="center">
<template slot-scope="scope">
<el-image
@ -53,7 +60,16 @@
</el-image>
</template>
</el-table-column>
<el-table-column width="200" label="国家名称" prop="country.aliasName" align="center" />
<!-- 国家名称 -->
<el-table-column
width="200"
label="国家名称"
prop="country.aliasName"
align="center"
/>
<!-- 国家货币 -->
<el-table-column label="国家货币" prop="currency" align="center">
<template slot-scope="scope">
<el-button type="text" @click="clickInputCurrency(scope.row)">
@ -62,7 +78,13 @@
</el-button>
</template>
</el-table-column>
<el-table-column label="美元概率(?=$)" prop="usdExchangeRate" align="center">
<!-- 汇率 -->
<el-table-column
label="美元概率(?=$)"
prop="usdExchangeRate"
align="center"
>
<template slot-scope="scope">
<el-button type="text" @click="clickUpdateRate(scope.row)">
<span v-if="!scope.row.usdExchangeRate">点击入汇率</span>
@ -70,6 +92,8 @@
</el-button>
</template>
</el-table-column>
<!-- 展示权重 -->
<el-table-column label="展示权重" prop="sort" align="center">
<template slot-scope="scope">
<el-button type="text" @click="clickInputUpdateSort(scope.row)">
@ -78,6 +102,8 @@
</el-button>
</template>
</el-table-column>
<!-- 上下架 -->
<el-table-column label="上/下架" align="center">
<template slot-scope="scope">
<el-switch
@ -88,14 +114,20 @@
/>
</template>
</el-table-column>
<!-- 操作 -->
<el-table-column fixed="right" label="操作" align="center" width="100">
<!-- 关联渠道 -->
<template slot-scope="scope">
<el-button type="text" @click="clickAssociateChannel(scope.row)">关联渠道</el-button>
<el-button type="text" @click="clickAssociateChannel(scope.row)"
>关联渠道</el-button
>
<!-- <el-button type="text" @click="clickAssociateChannelDetails(scope.row)">详情</el-button> -->
</template>
</el-table-column>
</el-table>
<!-- 分页 组件 -->
<pagination
v-show="total > 0"
:total="total"
@ -104,171 +136,188 @@
@pagination="renderData"
/>
<!-- 关联渠道组件 -->
<associated-channels
v-if="formAssociatedChannelVisible"
:row="selectedRow"
@close="formAssociatedChannelVisible=false;selectedRow={}"
/>
<country-select
v-if="countrySelectVisible"
@close="countrySelectClose"
@close="
formAssociatedChannelVisible = false;
selectedRow = {};
"
/>
<country-select v-if="countrySelectVisible" @close="countrySelectClose" />
</div>
</template>
<script>
import { pagePayOpenCounty, updatePayOpenCountyShelf, updatePayOpenCountryExchangeRate, updatePayOpenCountryCurrent, updatePayOpenCountrySort } from '@/api/sys-pay'
import Pagination from '@/components/Pagination'
import AssociatedChannels from './associated-channels'
import CountrySelect from './country-select'
import {
pagePayOpenCounty,
updatePayOpenCountyShelf,
updatePayOpenCountryExchangeRate,
updatePayOpenCountryCurrent,
updatePayOpenCountrySort
} from "@/api/sys-pay";
import Pagination from "@/components/Pagination";
import AssociatedChannels from "./associated-channels";
import CountrySelect from "./country-select";
export default {
name: 'CountryCodeInfo',
name: "CountryCodeInfo",
components: { Pagination, AssociatedChannels, CountrySelect },
data() {
return {
shelfStatus: [
{ value: true, name: '上架' },
{ value: false, name: '下架' }
{ value: true, name: "上架" },
{ value: false, name: "下架" }
],
countrySelectVisible: false,
formAssociatedChannelVisible: false,
selectedRow: {},
//
formVisible: false,
textOptTitle: '',
textOptTitle: "",
list: [],
total: 0,
listQuery: {
cursor: 1,
limit: 30,
shelf: true,
countryId: '',
id: ''
countryId: "",
id: ""
},
listLoading: true,
uploadLoading: false
}
};
},
created() {
this.renderData()
this.renderData();
},
methods: {
renderData(isClean) {
const that = this
that.listLoading = true
const that = this;
that.listLoading = true;
if (isClean === true) {
that.list = []
that.listQuery.cursor = 1
that.list = [];
that.listQuery.cursor = 1;
}
pagePayOpenCounty(that.listQuery).then(res => {
const { body } = res
that.total = body.total || 0
that.list = body.records
that.listLoading = false
})
const { body } = res;
that.total = body.total || 0;
that.list = body.records;
that.listLoading = false;
});
},
handleSearch() {
this.renderData(true)
this.renderData(true);
},
createCountry() {
this.countrySelectVisible = true
this.countrySelectVisible = true;
},
countrySelectClose() {
this.countrySelectVisible = false
this.renderData()
this.countrySelectVisible = false;
this.renderData();
},
//
handleClose() {
//
this.$refs.form.clearValidate()
this.formVisible = false
this.$refs.form.clearValidate();
this.formVisible = false;
},
clickInputUpdateSort(row) {
const that = this
that.$prompt('请输入新的权重数', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
inputPattern: /^\d{1,5}$/,
inputErrorMessage: '范围0~99999小数最多两位',
closeOnClickModal: false
}).then(({ value }) => {
updatePayOpenCountrySort(row.id, value).then(res => {
that.$opsMessage.success()
that.renderData()
}).catch(er => {
console.error(er)
that.$opsMessage.fail()
const that = this;
that
.$prompt("请输入新的权重数", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
inputPattern: /^\d{1,5}$/,
inputErrorMessage: "范围0~99999小数最多两位",
closeOnClickModal: false
})
}).catch(() => {
})
.then(({ value }) => {
updatePayOpenCountrySort(row.id, value)
.then(res => {
that.$opsMessage.success();
that.renderData();
})
.catch(er => {
console.error(er);
that.$opsMessage.fail();
});
})
.catch(() => {});
},
clickInputCurrency(row) {
const that = this
that.$prompt('请输入新的国家货币Code', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
closeOnClickModal: false
}).then(({ value }) => {
updatePayOpenCountryCurrent(row.id, value).then(res => {
that.$opsMessage.success()
that.renderData()
}).catch(er => {
console.error(er)
that.$opsMessage.fail()
const that = this;
that
.$prompt("请输入新的国家货币Code", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
closeOnClickModal: false
})
}).catch(() => {
})
.then(({ value }) => {
updatePayOpenCountryCurrent(row.id, value)
.then(res => {
that.$opsMessage.success();
that.renderData();
})
.catch(er => {
console.error(er);
that.$opsMessage.fail();
});
})
.catch(() => {});
},
clickUpdateRate(row) {
const that = this
that.$prompt('请输入新的美元汇率', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
inputPattern: /^\d{1,5}(\.\d{0,8})?$/,
inputErrorMessage: '范围0~99999小数最多八位',
closeOnClickModal: false
}).then(({ value }) => {
updatePayOpenCountryExchangeRate(row.id, value).then(res => {
that.$opsMessage.success()
that.renderData()
}).catch(er => {
console.error(er)
that.$opsMessage.fail()
const that = this;
that
.$prompt("请输入新的美元汇率", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
inputPattern: /^\d{1,5}(\.\d{0,8})?$/,
inputErrorMessage: "范围0~99999小数最多八位",
closeOnClickModal: false
})
}).catch(() => {
})
.then(({ value }) => {
updatePayOpenCountryExchangeRate(row.id, value)
.then(res => {
that.$opsMessage.success();
that.renderData();
})
.catch(er => {
console.error(er);
that.$opsMessage.fail();
});
})
.catch(() => {});
},
clickAssociateChannel(row) {
const that = this
that.selectedRow = row
that.formAssociatedChannelVisible = true
},
clickAssociateChannelDetails() {
const that = this;
that.selectedRow = row;
that.formAssociatedChannelVisible = true;
},
clickAssociateChannelDetails() {},
handleSwitchChange(row) {
updatePayOpenCountyShelf(row.id, row.shelf)
.then((res) => {})
.then(res => {})
.catch(er => {
row.shelf = !row.shelf
})
row.shelf = !row.shelf;
});
}
}
};
</script>
<style scoped lang="scss">
.bottom {
color: #666;
font-size: 14px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
line-height: 25px;
.line {
display: flex;
> div {
width: 100%;
}
}
}
</script>
<style scoped lang="scss">
.bottom {
color: #666;
font-size: 14px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
line-height: 25px;
.line {
display: flex;
>div {
width: 100%;
}
}
}
</style>