From 194b2723bc6c13fc519308fd6884c9889bda054d Mon Sep 17 00:00:00 2001 From: "BOOL\\25024" Date: Thu, 2 Jan 2025 17:04:02 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=88=86=E6=B6=A6=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jsowell-ui/src/api/pile/splitConfig.js | 2 +- jsowell-ui/src/views/pile/station/detail.vue | 7 +- jsowell-ui/src/views/pile/station/index.vue | 1 + .../src/views/pile/station/splitConfig.vue | 132 ++++++++++++------ 4 files changed, 96 insertions(+), 46 deletions(-) diff --git a/jsowell-ui/src/api/pile/splitConfig.js b/jsowell-ui/src/api/pile/splitConfig.js index 7b6371f6d..3f0e7dd3f 100644 --- a/jsowell-ui/src/api/pile/splitConfig.js +++ b/jsowell-ui/src/api/pile/splitConfig.js @@ -3,7 +3,7 @@ import request from '@/utils/request' // 根据站点id 查询站点分成配置 export function getSplitConfigList(stationId) { return request({ - url: '/station/splitconfig/list' + stationId, + url: '/station/splitconfig/list/' + stationId, method: 'get' }) } diff --git a/jsowell-ui/src/views/pile/station/detail.vue b/jsowell-ui/src/views/pile/station/detail.vue index 412bae4ae..956d72bc8 100644 --- a/jsowell-ui/src/views/pile/station/detail.vue +++ b/jsowell-ui/src/views/pile/station/detail.vue @@ -220,8 +220,8 @@ - - + + @@ -281,7 +281,7 @@ export default { stationOrderList, stationWhiteList, OrderReport, - Config + Config, }, data() { return { @@ -306,6 +306,7 @@ export default { parkingDisableFlag: true, exchange: [], firstList: [], //第一次复选框的默认值 + merchantId: this.$route.params.merchantId, //运营商id }; }, created() { diff --git a/jsowell-ui/src/views/pile/station/index.vue b/jsowell-ui/src/views/pile/station/index.vue index ec230c9f4..6e866c3f6 100644 --- a/jsowell-ui/src/views/pile/station/index.vue +++ b/jsowell-ui/src/views/pile/station/index.vue @@ -395,6 +395,7 @@ export default { params: { id: scope.row.id, stationName: scope.row.stationName, + merchantId: scope.row.merchantId, } }); }, diff --git a/jsowell-ui/src/views/pile/station/splitConfig.vue b/jsowell-ui/src/views/pile/station/splitConfig.vue index c0e13a08a..d44f291ac 100644 --- a/jsowell-ui/src/views/pile/station/splitConfig.vue +++ b/jsowell-ui/src/views/pile/station/splitConfig.vue @@ -14,28 +14,29 @@ - - + + - + + @@ -44,7 +45,7 @@ size="mini" type="text" icon="el-icon-delete" - @click="deleteUpdate(scope.row)" + @click="deleteUpdate(scope.row.id)" >删除 @@ -64,7 +65,7 @@ import { getMerchantListByAuth } from "@/api/member/info"; +import { getSplitConfigList, addSplitConfig } from "@/api/pile/splitConfig.js"; export default { + props: { + stationId: { + type: String, + required: true, + }, + merchantId: { + type: String, + required: true, + }, + }, data() { return { // 是否显示弹出层 @@ -100,30 +112,32 @@ export default { // 表单参数 form: {}, createMerchantVip: {}, - 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, - }, - ], + carList: [], + // aaa: { + // merchantId: "18", + // stationId: "1", + // splitUserDetailList: [ + // { + // adapayMemberId: "AM29102732", + // electricitySplitRatio: 0, + // feeFlag: Y, + // serviceSplitRatio: 0, + // splitName: "举视新能源", + // }, + // { + // adapayMemberId: "ACM69424215", + // electricitySplitRatio: 0, + // feeFlag: N, + // serviceSplitRatio: 0, + // splitName: "景泰昌运汽车运输有限公司", + // }, + // ], + // }, }; }, created() { this.getMerchantList(); + this.getList(); }, methods: { /** 新增按钮操作 */ @@ -141,42 +155,76 @@ export default { // 获取运营商列表 getMerchantList() { getMerchantListByAuth().then((response) => { - console.log("response", response); + console.log("获取运营商列表", response); this.merchantList = response.obj; }); }, - /** 提交按钮 */ + /** 确认按钮 */ submitForm() { - this.$refs["form"].validate((valid) => { - this.$modal.msgSuccess("新增成功"); - this.open = false; - // this.getList(); - }); + console.log("汇付会员id", this.createMerchantVip); + const selectedMerchant = this.merchantList.find( + (merchant) => merchant.merchantId === this.createMerchantVip.adapayMemberId + ); + 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() { let totalBbbA = 0; this.carList.forEach((car) => { - totalBbbA += Number(car.bbb); + totalBbbA += Number(car.electricitySplitRatio); }); // 检查总和是否等于100 if (totalBbbA != 100) return this.$modal.msgError("电费分成比例相加必须等于100%"); let totalBbbB = 0; this.carList.forEach((car) => { - totalBbbB += Number(car.ccc); + totalBbbB += Number(car.serviceSplitRatio); }); // 检查总和是否等于100 if (totalBbbB != 100) return this.$modal.msgError("服务费分成比例相加必须等于100%"); let trueCount = 0; this.carList.forEach((car) => { - if (car.state) trueCount++; + if (car.feeFlag) trueCount++; }); // 检查是否只有一个人承担手续费 - if (trueCount != 1) return this.$modal.msgError("手续费只能有一个人承担"); - this.$modal.msgSuccess("修改成功"); + if (trueCount != 1) return this.$modal.msgError("手续费有且只能有1位承担方"); + 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() {}, + // 根据站点id 查询站点分成配置 + getList() { + getSplitConfigList(this.stationId) + .then((response) => { + console.log("根据站点id 查询站点分成配置", response); + this.carList = response.rows; + }) + .catch((error) => { + console.error("查询站点分成配置时出错", error); + }); + }, }, }; From deb3a05f6decd1d3f5aee90c5881ecf03d75d7cf Mon Sep 17 00:00:00 2001 From: "BOOL\\25024" Date: Thu, 2 Jan 2025 17:04:49 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=BA=9F=E5=BC=83?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/pile/station/splitConfig.vue | 20 ------------------- 1 file changed, 20 deletions(-) diff --git a/jsowell-ui/src/views/pile/station/splitConfig.vue b/jsowell-ui/src/views/pile/station/splitConfig.vue index d44f291ac..4853e2955 100644 --- a/jsowell-ui/src/views/pile/station/splitConfig.vue +++ b/jsowell-ui/src/views/pile/station/splitConfig.vue @@ -113,26 +113,6 @@ export default { form: {}, createMerchantVip: {}, carList: [], - // aaa: { - // merchantId: "18", - // stationId: "1", - // splitUserDetailList: [ - // { - // adapayMemberId: "AM29102732", - // electricitySplitRatio: 0, - // feeFlag: Y, - // serviceSplitRatio: 0, - // splitName: "举视新能源", - // }, - // { - // adapayMemberId: "ACM69424215", - // electricitySplitRatio: 0, - // feeFlag: N, - // serviceSplitRatio: 0, - // splitName: "景泰昌运汽车运输有限公司", - // }, - // ], - // }, }; }, created() {