Merge branch 'dev-new' into dev-new-rabbitmq

This commit is contained in:
Guoqs
2025-01-03 09:45:08 +08:00
4 changed files with 76 additions and 46 deletions

View File

@@ -3,7 +3,7 @@ import request from '@/utils/request'
// 根据站点id 查询站点分成配置 // 根据站点id 查询站点分成配置
export function getSplitConfigList(stationId) { export function getSplitConfigList(stationId) {
return request({ return request({
url: '/station/splitconfig/list' + stationId, url: '/station/splitconfig/list/' + stationId,
method: 'get' method: 'get'
}) })
} }

View File

@@ -220,8 +220,8 @@
<order-report ref="orderReport"></order-report> <order-report ref="orderReport"></order-report>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="分润配置" name="Config"> <el-tab-pane label="分润配置" name="Config">
<Config ref="orderReport"></Config> <Config :stationId="stationId" :merchantId="merchantId"></Config>
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>
@@ -281,7 +281,7 @@ export default {
stationOrderList, stationOrderList,
stationWhiteList, stationWhiteList,
OrderReport, OrderReport,
Config Config,
}, },
data() { data() {
return { return {
@@ -306,6 +306,7 @@ export default {
parkingDisableFlag: true, parkingDisableFlag: true,
exchange: [], exchange: [],
firstList: [], //第一次复选框的默认值 firstList: [], //第一次复选框的默认值
merchantId: this.$route.params.merchantId, //运营商id
}; };
}, },
created() { created() {

View File

@@ -395,6 +395,7 @@ export default {
params: { params: {
id: scope.row.id, id: scope.row.id,
stationName: scope.row.stationName, stationName: scope.row.stationName,
merchantId: scope.row.merchantId,
} }
}); });
}, },

View File

@@ -14,28 +14,29 @@
</el-col> </el-col>
</el-row> </el-row>
<el-table :data="carList" stripe style="width: 100%; margin-top: 20px"> <el-table :data="carList" stripe style="width: 100%; margin-top: 20px">
<el-table-column label="分润人" align="center" prop="aaa" /> <el-table-column label="分润人" align="center" prop="splitName" />
<el-table-column label="电费比例(%" align="center" prop="bbb"> <el-table-column label="电费比例(%" align="center" prop="electricitySplitRatio">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input <el-input
style="width: 200px" style="width: 200px"
v-model="scope.row.bbb" v-model="scope.row.electricitySplitRatio"
placeholder="请输入手机号码" placeholder="请输入电费比例"
/> />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="服务费比例(%" align="center" prop="ccc"> <el-table-column label="服务费比例(%" align="center" prop="serviceSplitRatio">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input <el-input
style="width: 200px" style="width: 200px"
v-model="scope.row.ccc" v-model="scope.row.serviceSplitRatio"
placeholder="请输入手机号码" placeholder="请输入服务费比例"
/> />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="汇付会员id" align="center" prop="adapayMemberId" />
<el-table-column label="是否承担手续费" align="center" width="200"> <el-table-column label="是否承担手续费" align="center" width="200">
<template slot-scope="scope"> <template slot-scope="scope">
<el-switch v-model="scope.row.state"></el-switch> <el-switch v-model="scope.row.feeFlag"></el-switch>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center"> <el-table-column label="操作" align="center">
@@ -44,7 +45,7 @@
size="mini" size="mini"
type="text" type="text"
icon="el-icon-delete" icon="el-icon-delete"
@click="deleteUpdate(scope.row)" @click="deleteUpdate(scope.row.id)"
>删除</el-button >删除</el-button
> >
</template> </template>
@@ -64,7 +65,7 @@
<el-form ref="form" :model="form" label-width="100px"> <el-form ref="form" :model="form" label-width="100px">
<el-form-item label="选择运营商"> <el-form-item label="选择运营商">
<el-select <el-select
v-model="createMerchantVip.targetMerchantId" v-model="createMerchantVip.adapayMemberId"
clearable clearable
filterable filterable
placeholder="请选择运营商" placeholder="请选择运营商"
@@ -90,7 +91,18 @@
<script> <script>
import { getMerchantListByAuth } from "@/api/member/info"; import { getMerchantListByAuth } from "@/api/member/info";
import { getSplitConfigList, addSplitConfig } from "@/api/pile/splitConfig.js";
export default { export default {
props: {
stationId: {
type: String,
required: true,
},
merchantId: {
type: String,
required: true,
},
},
data() { data() {
return { return {
// 是否显示弹出层 // 是否显示弹出层
@@ -100,30 +112,12 @@ export default {
// 表单参数 // 表单参数
form: {}, form: {},
createMerchantVip: {}, createMerchantVip: {},
carList: [ carList: [],
{
aaa: "运营商A",
bbb: "20",
ccc: "20",
state: false,
},
{
aaa: "运营商B",
bbb: "60",
ccc: "40",
state: true,
},
{
aaa: "运营商C",
bbb: "30",
ccc: "40",
state: true,
},
],
}; };
}, },
created() { created() {
this.getMerchantList(); this.getMerchantList();
this.getList();
}, },
methods: { methods: {
/** 新增按钮操作 */ /** 新增按钮操作 */
@@ -141,42 +135,76 @@ export default {
// 获取运营商列表 // 获取运营商列表
getMerchantList() { getMerchantList() {
getMerchantListByAuth().then((response) => { getMerchantListByAuth().then((response) => {
console.log("response", response); console.log("获取运营商列表", response);
this.merchantList = response.obj; this.merchantList = response.obj;
}); });
}, },
/** 提交按钮 */ /** 确认按钮 */
submitForm() { submitForm() {
this.$refs["form"].validate((valid) => { console.log("汇付会员id", this.createMerchantVip);
this.$modal.msgSuccess("新增成功"); const selectedMerchant = this.merchantList.find(
this.open = false; (merchant) => merchant.merchantId === this.createMerchantVip.adapayMemberId
// this.getList(); );
}); const newDetail = {
splitName: selectedMerchant.merchantName,
adapayMemberId: selectedMerchant.adapayMemberId,
electricitySplitRatio: 0,
serviceSplitRatio: 0,
feeFlag: false,
};
this.carList.push(newDetail);
this.open = false;
console.log(this.carList);
}, },
// 保存 // 保存
getSave() { getSave() {
let totalBbbA = 0; let totalBbbA = 0;
this.carList.forEach((car) => { this.carList.forEach((car) => {
totalBbbA += Number(car.bbb); totalBbbA += Number(car.electricitySplitRatio);
}); });
// 检查总和是否等于100 // 检查总和是否等于100
if (totalBbbA != 100) return this.$modal.msgError("电费分成比例相加必须等于100%"); if (totalBbbA != 100) return this.$modal.msgError("电费分成比例相加必须等于100%");
let totalBbbB = 0; let totalBbbB = 0;
this.carList.forEach((car) => { this.carList.forEach((car) => {
totalBbbB += Number(car.ccc); totalBbbB += Number(car.serviceSplitRatio);
}); });
// 检查总和是否等于100 // 检查总和是否等于100
if (totalBbbB != 100) return this.$modal.msgError("服务费分成比例相加必须等于100%"); if (totalBbbB != 100) return this.$modal.msgError("服务费分成比例相加必须等于100%");
let trueCount = 0; let trueCount = 0;
this.carList.forEach((car) => { this.carList.forEach((car) => {
if (car.state) trueCount++; if (car.feeFlag) trueCount++;
}); });
// 检查是否只有一个人承担手续费 // 检查是否只有一个人承担手续费
if (trueCount != 1) return this.$modal.msgError("手续费只能有一个人承担"); if (trueCount != 1) return this.$modal.msgError("手续费有且只能有1位承担");
this.$modal.msgSuccess("修改成功"); const parameter = {
merchantId: this.merchantId,
stationId: this.stationId,
splitUserDetailList: this.carList,
};
console.log("参数", parameter);
addSplitConfig(parameter)
.then((response) => {
console.log("response", response);
this.$modal.msgSuccess("保存成功");
this.getList();
})
.catch((error) => {
console.error("保存失败", error);
});
}, },
//删除 //删除
deleteUpdate() {}, deleteUpdate() {},
// 根据站点id 查询站点分成配置
getList() {
getSplitConfigList(this.stationId)
.then((response) => {
console.log("根据站点id 查询站点分成配置", response);
this.carList = response.rows;
})
.catch((error) => {
console.error("查询站点分成配置时出错", error);
});
},
}, },
}; };
</script> </script>