web-retail-admin/src/views/configManage/walletConfig/xfpz.vue

601 lines
15 KiB
Vue
Raw Normal View History

2025-03-23 10:03:12 +08:00
<!--
* @Descripttion:
* @version:
* @Author: kBank
* @Date: 2022-10-24 15:45:01
-->
<template>
<div class="page">
<topBar
v-if="topList.length > 0"
:topList="topList"
:moren="moren"
></topBar>
<div class="main">
<div class="maintop">
<div class="mainbtn">
<el-button size="mini" @click="openDig" class="thebtn1">{{
2025-05-26 10:41:35 +08:00
'添加'
2025-03-23 10:03:12 +08:00
}}</el-button>
2025-05-26 10:41:35 +08:00
<el-button size="mini" class="thebtn2"> {{ '导出' }}</el-button>
2025-03-23 10:03:12 +08:00
</div>
</div>
<div class="maintable">
<el-table
:data="tableData"
height="760px"
v-loading="loading"
style="width: 100%"
:header-cell-style="{ background: '#EEEEEE' }"
:row-class-name="tableRowClassName"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55"> </el-table-column>
<el-table-column
align="center"
prop="specialAreaName"
2025-05-26 10:41:35 +08:00
:label="'所属专区'"
2025-03-23 10:03:12 +08:00
>
</el-table-column>
<el-table-column
align="center"
prop="sort"
2025-05-26 10:41:35 +08:00
:label="'扣款顺序/比例(%)'"
2025-03-23 10:03:12 +08:00
>
<template slot-scope="scope">
<span
v-for="(item, index) in scope.row.detailsList"
:key="index"
style="margin-right: 10px"
>
{{ item.accountName }}/{{ item.deductRatio }}
</span>
</template>
</el-table-column>
<el-table-column
align="center"
prop="effectiveDate"
2025-05-26 10:41:35 +08:00
:label="'生效日期'"
2025-03-23 10:03:12 +08:00
>
</el-table-column>
<el-table-column
align="center"
prop="creationTime"
2025-05-26 10:41:35 +08:00
:label="'创建日期'"
2025-03-23 10:03:12 +08:00
>
</el-table-column>
<el-table-column
align="center"
prop="time"
2025-05-26 10:41:35 +08:00
:label="'操作'"
2025-03-23 10:03:12 +08:00
fixed="right"
>
<template slot-scope="scope">
<el-button
@click="toFixed(scope.row.pkId)"
class="button-s"
type="text"
size="small"
style="color: rgb(105, 98, 246)"
>
2025-05-26 10:41:35 +08:00
{{ '修改' }}
2025-03-23 10:03:12 +08:00
</el-button>
<el-button
@click="handleDelete(scope.row.pkId)"
type="text"
class="button-s"
size="small"
style="color: #c73030"
>
2025-05-26 10:41:35 +08:00
{{ '删除' }}
2025-03-23 10:03:12 +08:00
</el-button>
</template>
</el-table-column>
</el-table>
</div>
</div>
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getDataList"
/>
<el-dialog
:title="dialogTitle"
:close-on-click-modal="false"
:visible.sync="dialogVisible"
width="55%"
center
:before-close="handleClose"
>
<el-form ref="form" :rules="rules" :model="form" label-width="auto">
<el-row>
<el-col :span="14">
2025-05-26 10:41:35 +08:00
<el-form-item :label="'所属专区'" prop="specialArea">
2025-03-23 10:03:12 +08:00
<el-select clearable v-model="form.specialArea">
<el-option
v-for="item in areaList"
:key="item.value"
:label="item.label"
:value="item.value"
></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row v-for="(item, index) in form.detailsList" :key="index">
<el-col :span="7">
<el-form-item
label="扣款顺序"
:prop="`detailsList.${index}.pkAccount`"
:rules="rules.pkAccount"
>
<el-select clearable v-model="item.pkAccount">
<el-option
v-for="item in bdAccountList"
:key="item.pkId"
:label="item.accountName"
:value="item.pkId"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="7">
<el-form-item
label="扣款比例(%)"
:prop="`detailsList.${index}.deductRatio`"
:rules="rules.deductRatio"
>
<!-- <el-input
clearable
v-model="item.deductRatio"
placeholder="请输入扣款比例"
></el-input> -->
<el-input-number
:disabled="item.deductMaxRatio != 0"
v-model="item.deductRatio"
:max="100"
:min="0"
:controls="false"
/>
</el-form-item>
</el-col>
<el-col :span="7">
<el-form-item
label="扣款最大比例(%)"
:prop="`detailsList.${index}.deductMaxRatio`"
:rules="rules.deductMaxRatio"
>
<el-input-number
:disabled="item.deductRatio != 0"
v-model="item.deductMaxRatio"
:max="100"
:min="0"
:controls="false"
/>
</el-form-item>
</el-col>
<el-col :span="3">
<div class="middle">
<div
@click="delKou(index)"
class="del"
v-if="form.detailsList.length > 1"
>
2025-05-26 10:41:35 +08:00
{{ '删除' }}
2025-03-23 10:03:12 +08:00
</div>
<div v-if="form.detailsList.length == index + 1" @click="addKou">
<i class="el-icon-circle-plus"></i>
</div>
</div>
</el-col>
</el-row>
<el-row>
<el-col :span="14">
2025-05-26 10:41:35 +08:00
<el-form-item :label="'生效日期'" prop="effectiveDate">
2025-03-23 10:03:12 +08:00
<el-date-picker
v-model="form.effectiveDate"
type="datetime"
value-format="yyyy-MM-dd HH:mm:ss"
2025-05-26 10:41:35 +08:00
:placeholder="'请选择'"
2025-03-23 10:03:12 +08:00
>
</el-date-picker>
</el-form-item>
</el-col>
</el-row>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button class="cancels" @click="handleClose">{{
2025-05-26 10:41:35 +08:00
'取消'
2025-03-23 10:03:12 +08:00
}}</el-button>
<el-button
class="submit"
style="margin-left: 40px"
@click="onSubmit('form')"
2025-05-26 10:41:35 +08:00
>{{ '确认' }}</el-button
2025-03-23 10:03:12 +08:00
>
</span>
</el-dialog>
</div>
</template>
<script>
import topBar from "@/components/topBar";
import * as api from "@/api/configManage.js";
import { areaCurrencySave, areaCurrencyUpdate } from "@/api/configManage.js";
import { userCountryList } from "@/api/user";
import { getToken } from "@/utils/auth";
export default {
name: "Bzpz",
components: {
topBar,
},
filters: {
isAgree(val) {
if (!val) {
2025-06-08 15:32:44 +08:00
return '允许';
2025-03-23 10:03:12 +08:00
} else {
2025-06-08 15:32:44 +08:00
return '禁止';
2025-03-23 10:03:12 +08:00
}
},
},
data() {
return {
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 50,
},
total: 0,
showImg: true, //默认展示
noneUploadImg: false, //
openImg: false,
openImgUrl: "",
uploadImgUrl: process.env.VUE_APP_BASE_API + "/system/upload",
headers: {
Authorization: getToken(),
},
dialogVisible: false,
tableData: [],
loading: false,
countryList: [],
agreeList: [
{
2025-06-08 15:32:44 +08:00
text: '允许',
2025-03-23 10:03:12 +08:00
val: 0,
},
{
2025-06-08 15:32:44 +08:00
text: '禁止',
2025-03-23 10:03:12 +08:00
val: 1,
},
],
moren: "xfpz",
topList: [
{
2025-06-08 15:32:44 +08:00
name: '币种配置',
2025-03-23 10:03:12 +08:00
path: "bzpz",
},
{
name: "消费配置",
path: "xfpz",
},
{
name: "转账配置",
path: "zzpz",
},
{
2025-06-08 15:32:44 +08:00
name: '提现配置',
2025-03-23 10:03:12 +08:00
path: "txpz",
},
{
name: "提现个税",
path: "txgs",
},
{
name: "提现手续费",
path: "txsxf",
},
{
2025-06-08 15:32:44 +08:00
name: '特殊消费',
2025-03-23 10:03:12 +08:00
path: "specialMoney",
},
{
name: this.$t("会员消费配置"),
path: "consumption",
},
],
form: {
specialArea: "",
detailsList: [
{
pkAccount: "",
deductRatio: "",
deductMaxRatio: 0,
},
],
},
rules: {
deductRatio: [
{ required: true, message: "请输入扣款比例", trigger: "blur" },
],
deductMaxRatio: [
{ required: true, message: "请输入扣款最大比例", trigger: "blur" },
],
specialArea: [
{ required: true, message: "请选择所属专区", trigger: "change" },
],
pkAccount: [
{ required: true, message: "请选择扣款顺序", trigger: "change" },
],
effectiveDate: [
2025-06-08 15:32:44 +08:00
{ required: true, message: '请选择生效时间', trigger: "change" },
2025-03-23 10:03:12 +08:00
],
},
areaList: [],
bdAccountList: [],
addOrEdit: true,
dialogTitle: "",
};
},
mounted() {
// 获取国家userCountryList
this.getCountry();
// 获取列表
this.getDataList();
// 获取专区
this.getArea();
// 账户列表
this.getpkBdAccountList();
},
methods: {
// 删除扣款
delKou(index) {
this.form.detailsList.splice(index, 1);
},
// 添加扣款
addKou() {
this.form.detailsList.push({
pkAccount: "",
deductRatio: "",
deductMaxRatio: 0,
});
},
// 点击修改
toFixed(id) {
2025-06-08 15:32:44 +08:00
this.dialogTitle = '修改';
2025-03-23 10:03:12 +08:00
this.addOrEdit = false;
this.dialogVisible = true;
api.getAreaCurrency(id).then((res) => {
res.data.detailsList.forEach((item) => {
if (item.deductMaxRatio == undefined) {
item.deductMaxRatio = 0;
}
});
this.form = res.data;
});
},
// 账户列表
getpkBdAccountList() {
api.pkBdAccountList().then((res) => {
this.bdAccountList = res.rows;
});
},
// 获取专区
getArea() {
api.specialAreaConsume().then((res) => {
this.areaList = res.data;
});
},
resetData() {
this.form = {
specialArea: "",
detailsList: [
{
pkAccount: "",
deductRatio: "",
deductMaxRatio: 0,
},
],
};
},
onSubmit(formName) {
this.form.detailsList.forEach((item, index) => {
item.deductSort = index + 1;
});
this.$refs[formName].validate((valid) => {
if (valid) {
let url = "";
if (this.addOrEdit == true) {
url = areaCurrencySave;
} else {
url = areaCurrencyUpdate;
}
url(this.form).then((res) => {
if (res.code == 200) {
this.$message({
message: res.msg,
type: "success",
});
this.dialogVisible = false;
// 充值数据
// this.$refs[formName].resetFields()
this.resetData();
// 获取列表
this.getDataList();
}
});
} else {
return false;
}
});
},
handleClose() {
this.dialogVisible = false;
this.resetData();
},
openDig() {
2025-06-08 15:32:44 +08:00
this.dialogTitle = '添加';
2025-03-23 10:03:12 +08:00
this.dialogVisible = true;
this.addOrEdit = true;
this.$nextTick(() => {
this.$refs["form"].clearValidate();
});
},
getCountry() {
userCountryList().then((res) => {
this.countryList = res.data;
});
},
getDataList() {
this.loading = true;
api.areaCurrencyList().then((res) => {
res.rows.forEach((item) => {
this.areaList.forEach((child) => {
if (item.specialArea == child.value) {
item.specialAreaName = child.label;
}
});
});
this.tableData = res.rows;
this.total = res.total;
this.loading = false;
});
},
handleSelectionChange(val) {
this.multipleSelection = val;
},
// 删除
handleDelete(id) {
api.delAreaCurrency(id).then((res) => {
// 获取列表
this.getDataList();
});
},
tableRowClassName({ row, rowIndex }) {
if (rowIndex % 2 == 1) {
return "warning-row";
} else if (rowIndex % 2 == 0) {
return "success-row";
}
return "";
},
},
};
</script>
<style scoped lang="scss">
::v-deep .el-select {
width: 100%;
}
.submit {
width: 209px;
height: 48px;
background: #c8161d;
border-radius: 5px;
color: #fff;
font-size: 18px;
border-color: #c8161d;
margin-left: 20px;
}
.cancels {
width: 209px;
height: 48px;
background: #cccccc;
border-radius: 5px;
color: #fff;
font-size: 18px;
border-color: #ccc;
}
::v-deep .el-table .warning-row {
background: #f9f9f9;
}
::v-deep .el-table .success-row {
background: #ffffff;
}
::v-deep .el-table thead {
color: #000000;
}
::v-deep .el-select {
width: 100%;
}
.uploadIcon ::v-deep .el-upload--picture-card {
display: none !important;
/* 上传按钮隐藏 */
}
.button-s {
padding: 0 3px;
}
.page {
padding: 20px;
background: #f9f9f9;
font-size: 14px;
.main {
background: #f9f9f9;
//border-radius: 8px;
//box-shadow: 0px 2px 20px 0px rgba(238, 238, 238, 0.5);
.maintop {
display: flex;
// padding: 10px 0;
justify-content: space-between;
align-items: center;
.mainbtn {
.thebtn1 {
color: #ffffff;
background: #3181e5;
}
.thebtn2 {
color: #ffffff;
background: #ffad41;
}
}
.maintitle {
font-size: 10px;
font-family: MicrosoftYaHei;
color: #999999;
}
}
}
.tem {
display: flex;
align-items: center;
justify-content: center;
img {
width: 28px;
height: 20px;
margin-right: 3px;
}
}
.isRed {
color: #ed1d25;
}
.isGreen {
color: #1ab62b;
}
.bgImg {
width: 48px;
height: 48px;
}
.middle {
line-height: 40px;
margin-left: 20px;
white-space: nowrap;
display: flex;
}
}
.del {
margin-right: 10px;
cursor: pointer;
}
::v-deep .el-date-editor.el-input {
width: 100%;
}
::v-deep .el-input-number {
width: auto !important;
}
</style>