站点修改费率

This commit is contained in:
BOOL\25024
2024-02-23 14:49:53 +08:00
parent e5afcea626
commit 11a7e4c199
2 changed files with 95 additions and 43 deletions

View File

@@ -175,10 +175,11 @@
</div>
</el-dialog>
<!-- 添加修改站点 -->
<el-dialog title="添加站点" :visible.sync="getSite" :before-close="getCancel" width="1000px" append-to-body>
<el-form ref="exchangeRate" :model="exchangeRate" :rules="dialogRules">
<el-dialog :title="getTitle" :visible.sync="getSite" :before-close="getCancel" width="1000px" append-to-body>
<el-form ref="exchangeRateB" :model="exchangeRateB" :rules="dialogRules">
<el-form-item label="请选择站点">
<el-select v-model="selectSite" placeholder="请选择站点" filterable style="width:300px" @change="queryInfo">
<el-select v-model="selectSite" placeholder="请选择站点" filterable :disabled="getDisabled"
style="width:300px" @change="queryInfo">
<el-option v-for="(station, index) in stationList" :key="index" :label="station.stationName"
:value="station.id" />
</el-select>
@@ -218,13 +219,13 @@
</el-col>
<el-col :span="4">
<el-form-item prop="modifyServiceA">
<el-input v-model="exchangeRate.modifyServiceA" type="number" class="clearInputScore"
<el-input v-model="exchangeRateB.modifyServiceA" type="number" class="clearInputScore"
placeholder="0" clearable />
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item prop="modifyElectricityA">
<el-input v-model="exchangeRate.modifyElectricityA" placeholder="0" clearable type="number"
<el-input v-model="exchangeRateB.modifyElectricityA" placeholder="0" clearable type="number"
class="clearInputScore" />
</el-form-item>
</el-col>
@@ -248,13 +249,13 @@
</el-col>
<el-col :span="4">
<el-form-item prop="modifyServiceB">
<el-input v-model="exchangeRate.modifyServiceB" type="number" class="clearInputScore"
<el-input v-model="exchangeRateB.modifyServiceB" type="number" class="clearInputScore"
placeholder="0" clearable />
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item prop="modifyElectricityB">
<el-input v-model="exchangeRate.modifyElectricityB" placeholder="0" clearable type="number"
<el-input v-model="exchangeRateB.modifyElectricityB" placeholder="0" clearable type="number"
class="clearInputScore" />
</el-form-item>
</el-col>
@@ -278,13 +279,13 @@
</el-col>
<el-col :span="4">
<el-form-item prop="modifyServiceC">
<el-input v-model="exchangeRate.modifyServiceC" type="number" class="clearInputScore"
<el-input v-model="exchangeRateB.modifyServiceC" type="number" class="clearInputScore"
placeholder="0" clearable />
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item prop="modifyElectricityC">
<el-input v-model="exchangeRate.modifyElectricityC" placeholder="0" clearable type="number"
<el-input v-model="exchangeRateB.modifyElectricityC" placeholder="0" clearable type="number"
class="clearInputScore" />
</el-form-item>
</el-col>
@@ -308,13 +309,13 @@
</el-col>
<el-col :span="4">
<el-form-item prop="modifyServiceD">
<el-input v-model="exchangeRate.modifyServiceD" type="number" class="clearInputScore"
<el-input v-model="exchangeRateB.modifyServiceD" type="number" class="clearInputScore"
placeholder="0" clearable />
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item prop="modifyElectricityD">
<el-input v-model="exchangeRate.modifyElectricityD" placeholder="0" clearable type="number"
<el-input v-model="exchangeRateB.modifyElectricityD" placeholder="0" clearable type="number"
class="clearInputScore" />
</el-form-item>
</el-col>
@@ -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;
});
}
},
},
};
</script>