diff --git a/jsowell-ui/src/api/billing/template.js b/jsowell-ui/src/api/billing/template.js index 5cf6fc158..5dd151ea3 100644 --- a/jsowell-ui/src/api/billing/template.js +++ b/jsowell-ui/src/api/billing/template.js @@ -105,4 +105,10 @@ export function changeStationTemplate(data) { }) } -// 查询全部计费模板 +// 查询vip站点计费模板 +export function queryStationPreferentialBillingTemplateList(stationId) { + return request({ + url: "/billing/template/queryStationPreferentialBillingTemplateList/" + stationId, + method: "get", + }); +} diff --git a/jsowell-ui/src/views/member/memberGroup/detail.vue b/jsowell-ui/src/views/member/memberGroup/detail.vue index b32e5bf9a..828b6d9df 100644 --- a/jsowell-ui/src/views/member/memberGroup/detail.vue +++ b/jsowell-ui/src/views/member/memberGroup/detail.vue @@ -175,10 +175,11 @@ - - + + - + @@ -218,13 +219,13 @@ - - @@ -248,13 +249,13 @@ - - @@ -278,13 +279,13 @@ - - @@ -308,13 +309,13 @@ - - @@ -340,7 +341,7 @@ import { addMember, queryMemberList, preferentialTemplates, queryStationList } from "@/api/member/memberGroup"; import { listOrder } from "@/api/order/order"; import { getStationListByMerchantId } from "@/api/pile/station"; -import { queryStationBillingTemplateList, getTemplate } from "@/api/billing/template.js"; +import { queryStationBillingTemplateList, getTemplate, queryStationPreferentialBillingTemplateList, updateBillingTemplate } from "@/api/billing/template.js"; export default { name: 'JsowellUiDetail', @@ -450,6 +451,8 @@ export default { servicePriceC: '', electricityPriceD: '', servicePriceD: '', + }, + exchangeRateB: { modifyServiceA: '', modifyElectricityA: '', modifyServiceB: '', @@ -494,7 +497,10 @@ export default { pageSize: 10, groupCode: this.$route.params.groupCode.split('&')[0], }, - stationTotal: 0 + stationTotal: 0, + getDisabled: false, + getTitle: '', + stationBillingTemplate: null }; }, @@ -551,14 +557,42 @@ export default { }); }, //添加站点 - addasite() { - console.log(this.$route.params.groupCode.split('&')[1]); - let value = this.$route.params.groupCode.split('&')[1] - this.getSite = true - getStationListByMerchantId(value).then((response) => { - console.log('站点', response); - this.stationList = response.data; - }); + addasite(row) { + console.log(this.$route.params.groupCode.split('&')[1], row); + // 判断是修改站点还是添加站点 + if (row.stationName) { + this.selectSite = row.stationName; + this.getTitle = '修改站点' + this.getSite = true; + this.getDisabled = true; + this.queryInfo(row.stationId); + // 查询vip计费模板详情 + queryStationPreferentialBillingTemplateList(row.stationId).then((response) => { + console.log("通过站点id查询vip计费模板 result: ", response.rows, response.rows[0].templateId); + this.stationBillingTemplate = response.rows[0].templateId; + getTemplate(response.rows[0].templateId).then((response) => { + console.log("查询vip计费模板详情", response); + this.exchangeRateB = { + modifyServiceA: response.data.electricityPriceA, + modifyElectricityA: response.data.servicePriceA, + modifyServiceB: response.data.electricityPriceB, + modifyElectricityB: response.data.servicePriceB, + modifyServiceC: response.data.electricityPriceC, + modifyElectricityC: response.data.servicePriceC, + modifyServiceD: response.data.electricityPriceD, + modifyElectricityD: response.data.servicePriceD, + } + }); + }); + } else { + let value = this.$route.params.groupCode.split('&')[1] + this.getTitle = '添加站点' + this.getSite = true; + getStationListByMerchantId(value).then((response) => { + console.log('站点', response); + this.stationList = response.data; + }); + } }, // 站点弹框取消重置 getCancel() { @@ -574,6 +608,8 @@ export default { servicePriceC: "", electricityPriceD: "", servicePriceD: "", + }; + this.exchangeRateB = { modifyServiceA: "", modifyElectricityA: "", modifyServiceB: "", @@ -582,32 +618,45 @@ export default { modifyElectricityC: "", modifyServiceD: "", modifyElectricityD: "", - }; - this.$refs["exchangeRate"].resetFields(); + } + this.$refs["exchangeRateB"].resetFields(); + this.getDisabled = false; + this.stationBillingTemplate = null; }, // 站点弹框确认 siteConfirmation() { - this.$refs["exchangeRate"].validate(valid => { + this.$refs["exchangeRateB"].validate(valid => { if (valid) { let newOffers = { + billingTemplateId: this.stationBillingTemplate, groupCode: this.$route.params.groupCode.split('&')[0], stationId: this.stationId, - electricityPriceA: this.exchangeRate.modifyServiceA, - servicePriceA: this.exchangeRate.modifyElectricityA, - electricityPriceB: this.exchangeRate.modifyServiceB, - servicePriceB: this.exchangeRate.modifyElectricityB, - electricityPriceC: this.exchangeRate.modifyServiceC, - servicePriceC: this.exchangeRate.modifyElectricityC, - electricityPriceD: this.exchangeRate.modifyServiceD, - servicePriceD: this.exchangeRate.modifyElectricityD, + electricityPriceA: this.exchangeRateB.modifyServiceA, + servicePriceA: this.exchangeRateB.modifyElectricityA, + electricityPriceB: this.exchangeRateB.modifyServiceB, + servicePriceB: this.exchangeRateB.modifyElectricityB, + electricityPriceC: this.exchangeRateB.modifyServiceC, + servicePriceC: this.exchangeRateB.modifyElectricityC, + electricityPriceD: this.exchangeRateB.modifyServiceD, + servicePriceD: this.exchangeRateB.modifyElectricityD, timeArray: this.exchangeRate.timeArray } console.log('验证成功', newOffers); - preferentialTemplates(newOffers).then((response) => { - console.log("添加站点优惠模板", response); - this.$modal.msgSuccess("添加成功"); - this.getCancel() //重置 - }); + if (this.stationBillingTemplate) { + updateBillingTemplate(newOffers).then((response) => { + console.log("接口返回", response); + this.$message.success("修改成功"); + this.getStationList(); + this.getCancel() //重置 + }); + } else { + preferentialTemplates(newOffers).then((response) => { + console.log("添加站点优惠模板", response); + this.$modal.msgSuccess("添加成功"); + this.getCancel() //重置 + this.getStationList(); + }); + } } else { console.log('验证失败'); } @@ -616,16 +665,13 @@ export default { // 查计费模板详情 queryInfo(stationId) { console.log(stationId); - this.stationId = stationId + this.stationId = stationId; queryStationBillingTemplateList(stationId).then((response) => { console.log("通过站点id查询计费模板 result: ", response.rows, response.rows[0].templateId); - this.stationBillingTemplate = response.rows; getTemplate(response.rows[0].templateId).then((response) => { console.log("查询计费模板详情", response); this.exchangeRate = response.data; this.dynamicTags(); - // 重置验证 - this.$refs["exchangeRate"].resetFields(); }); }); }, @@ -667,7 +713,7 @@ export default { this.stationTotal = response.total; this.loading = false; }); - } + }, }, };