|
@@ -3,87 +3,26 @@
|
|
|
<div v-if="labelForm.labelArr.length == 0">
|
|
|
你未添加标签,请先添加标签后再来设置规则
|
|
|
</div>
|
|
|
- <el-collapse v-model="activeNames" @change="handleChange" class="collapse">
|
|
|
- <el-collapse-item title="标签1" name="1">
|
|
|
- <div style="margin-left: 200px; float: right" @click="addRule($event)">
|
|
|
- <i class="header-icon el-icon-plus"></i>添加规则
|
|
|
- </div>
|
|
|
- <el-table :data="discountList" :border="false" :stripe="false">
|
|
|
- <af-table-column label="油品名称" align="center" prop="oilName" />
|
|
|
- <af-table-column label="优惠条件" align="center">
|
|
|
- <template slot-scope="scope">
|
|
|
- 满 {{ scope.row.discountAmt }}
|
|
|
- {{ scope.row.discountTerm == 2 ? "元" : "L" }},每升优惠
|
|
|
- {{ scope.row.discountLitersAmt }} 元
|
|
|
- </template>
|
|
|
- </af-table-column>
|
|
|
- <af-table-column
|
|
|
- label="优惠条件金额"
|
|
|
- v-if="false"
|
|
|
- align="center"
|
|
|
- prop="discountAmt"
|
|
|
- />
|
|
|
- <af-table-column
|
|
|
- label="优惠金额"
|
|
|
- v-if="false"
|
|
|
- align="center"
|
|
|
- prop="discountLitersAmt"
|
|
|
- />
|
|
|
- <af-table-column
|
|
|
- label="优惠方案类型"
|
|
|
- v-if="false"
|
|
|
- align="center"
|
|
|
- prop="discountPlanType"
|
|
|
- />
|
|
|
- <af-table-column
|
|
|
- label="操作"
|
|
|
- align="center"
|
|
|
- class-name="small-padding fixed-width"
|
|
|
- >
|
|
|
- <template slot-scope="scope">
|
|
|
- <!-- <el-button
|
|
|
- size="mini"
|
|
|
- type="text"
|
|
|
- icon="el-icon-edit"
|
|
|
- @click="handleUpdate(scope.row)"
|
|
|
- >修改</el-button
|
|
|
- > -->
|
|
|
- <el-button
|
|
|
- size="mini"
|
|
|
- type="text"
|
|
|
- icon="el-icon-delete"
|
|
|
- @click.stop="handleDelete(scope.row)"
|
|
|
- >删除</el-button
|
|
|
- >
|
|
|
- </template>
|
|
|
- </af-table-column>
|
|
|
- </el-table>
|
|
|
- </el-collapse-item>
|
|
|
- <el-collapse-item title="标签2" name="2">
|
|
|
- <div>
|
|
|
- 控制反馈:通过界面样式和交互动效让用户可以清晰的感知自己的操作;
|
|
|
- </div>
|
|
|
- <div>页面反馈:操作后,通过页面元素的变化清晰地展现当前状态。</div>
|
|
|
- </el-collapse-item>
|
|
|
- <el-collapse-item title="标签3" name="3">
|
|
|
- <div>简化流程:设计简洁直观的操作流程;</div>
|
|
|
- <div>
|
|
|
- 清晰明确:语言表达清晰且表意明确,让用户快速理解进而作出决策;
|
|
|
- </div>
|
|
|
- <div>
|
|
|
- 帮助用户识别:界面简单直白,让用户快速识别而非回忆,减少用户记忆负担。
|
|
|
- </div>
|
|
|
- </el-collapse-item>
|
|
|
+ <el-collapse v-model="activeNames" class="collapse">
|
|
|
<el-collapse-item
|
|
|
:title="ele.labelName"
|
|
|
:name="ele.id"
|
|
|
v-for="ele in labelForm.labelArr"
|
|
|
:key="ele.id"
|
|
|
>
|
|
|
- <div style="margin-left: 200px; float: right" @click="addRule($event, ele)">
|
|
|
+ <div v-if="(ele.labelRuleDetailList || []).length == 0">
|
|
|
+ 此条标签下面没有规则
|
|
|
+ </div>
|
|
|
+ <div
|
|
|
+ style="margin-left: 200px; float: right"
|
|
|
+ @click="addRule($event, ele)"
|
|
|
+ >
|
|
|
<i class="header-icon el-icon-plus"></i>添加规则
|
|
|
</div>
|
|
|
- <el-table :data="ele.labelRuleDetailList">
|
|
|
+ <el-table
|
|
|
+ :data="ele.labelRuleDetailList"
|
|
|
+ v-if="(ele.labelRuleDetailList || []).length != 0"
|
|
|
+ >
|
|
|
<af-table-column label="油品名称" align="center" prop="oilName" />
|
|
|
<af-table-column label="优惠条件" align="center">
|
|
|
<template slot-scope="scope">
|
|
@@ -126,7 +65,7 @@
|
|
|
<el-popconfirm
|
|
|
title="确认删除此条规则?"
|
|
|
confirm-button-text="删除"
|
|
|
- @onConfirm="handleDelete(scope.row)"
|
|
|
+ @onConfirm="handleDelete(scope.row, ele)"
|
|
|
>
|
|
|
<el-button
|
|
|
slot="reference"
|
|
@@ -160,23 +99,25 @@
|
|
|
:label="dict.oilName"
|
|
|
:value="dict.oilName"
|
|
|
/>
|
|
|
-
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="优惠条件" prop="discountLitersAmt" :rules="{
|
|
|
+ <el-form-item
|
|
|
+ label="优惠条件"
|
|
|
+ prop="discountLitersAmt"
|
|
|
+ :rules="{
|
|
|
required: true,
|
|
|
message: '优惠条件不能为空',
|
|
|
trigger: 'blur',
|
|
|
- }">
|
|
|
- <el-radio-group
|
|
|
- v-model="addRulesForm.discountTerm"
|
|
|
- >
|
|
|
+ }"
|
|
|
+ >
|
|
|
+ <el-radio-group v-model="addRulesForm.discountTerm">
|
|
|
<el-radio :label="2">按加油金额优惠</el-radio>
|
|
|
<el-radio :label="1">按加油升数优惠</el-radio>
|
|
|
</el-radio-group>
|
|
|
<div
|
|
|
- v-show="addRulesForm.discountTerm == 2 ||
|
|
|
- addRulesForm.discountTerm == 1"
|
|
|
+ v-show="
|
|
|
+ addRulesForm.discountTerm == 2 || addRulesForm.discountTerm == 1
|
|
|
+ "
|
|
|
>
|
|
|
满
|
|
|
<el-input-number
|
|
@@ -185,9 +126,7 @@
|
|
|
:min="0"
|
|
|
/>
|
|
|
|
|
|
- <span>{{
|
|
|
- addRulesForm.discountTerm == 1 ? "L" : "元"
|
|
|
- }}</span>
|
|
|
+ <span>{{ addRulesForm.discountTerm == 1 ? "L" : "元" }}</span>
|
|
|
,每升优惠
|
|
|
<el-input-number
|
|
|
v-model="addRulesForm.discountLitersAmt"
|
|
@@ -212,6 +151,8 @@ import {
|
|
|
labelRulelist,
|
|
|
selectLabelList,
|
|
|
deleteLabelRuleDetail,
|
|
|
+ addDetail,
|
|
|
+ detailList,
|
|
|
} from "@/api/label/label";
|
|
|
import { listPrice } from "@/api/station/price";
|
|
|
export default {
|
|
@@ -219,127 +160,58 @@ export default {
|
|
|
data() {
|
|
|
return {
|
|
|
activeNames: ["1"],
|
|
|
- discountList: [
|
|
|
- {
|
|
|
- searchValue: null,
|
|
|
- createBy: "13",
|
|
|
- createTime: "2021-06-16 09:40:39",
|
|
|
- updateBy: null,
|
|
|
- updateTime: null,
|
|
|
- remark: null,
|
|
|
- params: {},
|
|
|
- stationIdList: null,
|
|
|
- id: 26,
|
|
|
- grade: "92#",
|
|
|
- discountTerm: "2",
|
|
|
- discountAmt: "100",
|
|
|
- discountLitersAmt: "1",
|
|
|
- vipDiscountyPlus: "0",
|
|
|
- couponPlus: "0",
|
|
|
- discountPlanType: "3",
|
|
|
- oilName: "92#",
|
|
|
- stationId: 123,
|
|
|
- stationName: "智慧易加-西站",
|
|
|
- status: "0",
|
|
|
- },
|
|
|
- {
|
|
|
- searchValue: null,
|
|
|
- createBy: "13",
|
|
|
- createTime: "2021-06-16 09:40:58",
|
|
|
- updateBy: null,
|
|
|
- updateTime: null,
|
|
|
- remark: null,
|
|
|
- params: {},
|
|
|
- stationIdList: null,
|
|
|
- id: 27,
|
|
|
- grade: "95#",
|
|
|
- discountTerm: "2",
|
|
|
- discountAmt: "100",
|
|
|
- discountLitersAmt: "1",
|
|
|
- vipDiscountyPlus: "0",
|
|
|
- couponPlus: "0",
|
|
|
- discountPlanType: "3",
|
|
|
- oilName: "95#",
|
|
|
- stationId: 123,
|
|
|
- stationName: "智慧易加-西站",
|
|
|
- status: "0",
|
|
|
- },
|
|
|
- {
|
|
|
- searchValue: null,
|
|
|
- createBy: "13",
|
|
|
- createTime: "2021-06-16 09:45:56",
|
|
|
- updateBy: null,
|
|
|
- updateTime: null,
|
|
|
- remark: null,
|
|
|
- params: {},
|
|
|
- stationIdList: null,
|
|
|
- id: 28,
|
|
|
- grade: "98#",
|
|
|
- discountTerm: "2",
|
|
|
- discountAmt: "100",
|
|
|
- discountLitersAmt: "0.5",
|
|
|
- vipDiscountyPlus: "0",
|
|
|
- couponPlus: "0",
|
|
|
- discountPlanType: "3",
|
|
|
- oilName: "98#",
|
|
|
- stationId: 123,
|
|
|
- stationName: "智慧易加-西站",
|
|
|
- status: "0",
|
|
|
- },
|
|
|
- ],
|
|
|
openDialog: false,
|
|
|
addRulesForm: {},
|
|
|
labelForm: {},
|
|
|
oilNameOptions: [],
|
|
|
- filterOilNameOptions:[],
|
|
|
-
|
|
|
+ filterOilNameOptions: [],
|
|
|
+ currentLabel: {},
|
|
|
};
|
|
|
},
|
|
|
created() {
|
|
|
this.init();
|
|
|
- // setTimeout(() => {
|
|
|
- // console.log("哈哈");
|
|
|
- // console.log(this.oilNameOptions);
|
|
|
- // const arr = this.filterOilNameOptions([
|
|
|
- // {
|
|
|
- // oilName: "92#",
|
|
|
- // },
|
|
|
- // ]);
|
|
|
- // console.log(arr);
|
|
|
- // }, 1000);
|
|
|
- selectLabelList().then((res) => {
|
|
|
- console.log("哈哈");
|
|
|
- console.log(res);
|
|
|
- });
|
|
|
},
|
|
|
methods: {
|
|
|
init() {
|
|
|
this.getList();
|
|
|
+ this.getOilName();
|
|
|
+ },
|
|
|
+ getOilName() {
|
|
|
listPrice().then((response) => {
|
|
|
- this.oilNameOptions = response.rows;
|
|
|
- console.log(this.oilNameOptions);
|
|
|
+ console.log(response);
|
|
|
+ if (response.code == 200) {
|
|
|
+ this.oilNameOptions = response.rows;
|
|
|
+ } else {
|
|
|
+ this.msgError("拉取油品名失败");
|
|
|
+ }
|
|
|
});
|
|
|
},
|
|
|
- handleChange(val) {
|
|
|
- console.log(val);
|
|
|
- },
|
|
|
addRule(e, ele) {
|
|
|
- console.log(ele)
|
|
|
e.stopPropagation();
|
|
|
- this.addRulesForm.parentid = ele.id
|
|
|
- this.filterOilNameOptions = this.filterOilNameOptionsMethod(ele.labelRuleDetailList)
|
|
|
+ this.currentLabel = ele;
|
|
|
+ this.addRulesForm = {};
|
|
|
+ this.addRulesForm.parentId = ele.id;
|
|
|
+ this.filterOilNameOptions = this.filterOilNameOptionsMethod(
|
|
|
+ ele.labelRuleDetailList
|
|
|
+ );
|
|
|
this.openDialog = true;
|
|
|
},
|
|
|
handleSubmit() {
|
|
|
this.$refs["addRulesForm"].validate((valid) => {
|
|
|
if (valid) {
|
|
|
- console.log(this.addRulesForm);
|
|
|
+ addDetail(this.addRulesForm).then((res) => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.openDialog = false;
|
|
|
+ this.getSingleList(this.currentLabel);
|
|
|
+ } else {
|
|
|
+ this.msgError("添加规则失败");
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
cancelSubmit() {
|
|
|
this.openDialog = false;
|
|
|
- this.addRulesForm = {}
|
|
|
},
|
|
|
getList() {
|
|
|
return selectLabelList().then((res) => {
|
|
@@ -351,15 +223,32 @@ export default {
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
- handleDelete(ele) {
|
|
|
+ getSingleList(ele) {
|
|
|
+ detailList({
|
|
|
+ parentId: ele.id,
|
|
|
+ }).then((res) => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ ele.labelRuleDetailList = res.rows;
|
|
|
+ } else {
|
|
|
+ this.msgError("查询失败,请刷新此页面");
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ handleDelete(row, ele) {
|
|
|
deleteLabelRuleDetail({
|
|
|
- id: ele.id,
|
|
|
+ id: row.id,
|
|
|
}).then((res) => {
|
|
|
- console.log(res);
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.getSingleList(ele);
|
|
|
+ } else {
|
|
|
+ this.msgError("删除此条规则失败");
|
|
|
+ }
|
|
|
});
|
|
|
},
|
|
|
filterOilNameOptionsMethod(arr) {
|
|
|
- console.log("123", arr);
|
|
|
+ if (arr == null) {
|
|
|
+ arr = [];
|
|
|
+ }
|
|
|
return this.oilNameOptions.filter((ele) => {
|
|
|
let flag = true;
|
|
|
arr.forEach((item) => {
|