|
@@ -141,11 +141,7 @@
|
|
prop="datePicker"
|
|
prop="datePicker"
|
|
v-show="form.integralActivity == 1"
|
|
v-show="form.integralActivity == 1"
|
|
>
|
|
>
|
|
- <el-select
|
|
|
|
- v-model="form.datePicker"
|
|
|
|
- clearable
|
|
|
|
- size="small"
|
|
|
|
- >
|
|
|
|
|
|
+ <el-select v-model="form.datePicker" clearable size="small">
|
|
<el-option label="每周指定日" value="1"></el-option>
|
|
<el-option label="每周指定日" value="1"></el-option>
|
|
<el-option label="每月指定日" value="2"></el-option>
|
|
<el-option label="每月指定日" value="2"></el-option>
|
|
<el-option label="固定活动日" value="3"></el-option>
|
|
<el-option label="固定活动日" value="3"></el-option>
|
|
@@ -176,7 +172,7 @@
|
|
>
|
|
>
|
|
<div>{{ item }}</div>
|
|
<div>{{ item }}</div>
|
|
<div
|
|
<div
|
|
- v-if="collectClickCalendar.indexOf(index) > -1"
|
|
|
|
|
|
+ v-if="form.collectClickCalendar.indexOf(index) > -1"
|
|
style="
|
|
style="
|
|
width: 4px;
|
|
width: 4px;
|
|
height: 4px;
|
|
height: 4px;
|
|
@@ -210,7 +206,7 @@
|
|
clearable
|
|
clearable
|
|
size="small"
|
|
size="small"
|
|
style="margin-left: 10px; width: 200px"
|
|
style="margin-left: 10px; width: 200px"
|
|
- v-model="pickerTime"
|
|
|
|
|
|
+ v-model="form.collectClickDay"
|
|
type="dates"
|
|
type="dates"
|
|
value-format="yyyy-MM-dd"
|
|
value-format="yyyy-MM-dd"
|
|
placeholder="选择提醒时间设置"
|
|
placeholder="选择提醒时间设置"
|
|
@@ -274,22 +270,18 @@ export default {
|
|
gradeOptions: [],
|
|
gradeOptions: [],
|
|
dialogImageUrl: "",
|
|
dialogImageUrl: "",
|
|
num: 0,
|
|
num: 0,
|
|
- pickerTime: "",
|
|
|
|
dialogVisible: false,
|
|
dialogVisible: false,
|
|
workDaytrue: false,
|
|
workDaytrue: false,
|
|
moonDaytrue: false,
|
|
moonDaytrue: false,
|
|
datetrue: false,
|
|
datetrue: false,
|
|
- // 查询参数
|
|
|
|
- queryParams: {
|
|
|
|
- pageNum: 1,
|
|
|
|
- pageSize: 100,
|
|
|
|
- },
|
|
|
|
rowsnum: 0,
|
|
rowsnum: 0,
|
|
// 表单参数
|
|
// 表单参数
|
|
form: {
|
|
form: {
|
|
itemsDetail: [{}],
|
|
itemsDetail: [{}],
|
|
notOilList: [{}],
|
|
notOilList: [{}],
|
|
imgFileList: [],
|
|
imgFileList: [],
|
|
|
|
+ collectClickCalendar: [], // 收集固定日期选择的日子
|
|
|
|
+ collectClickDay: "",
|
|
},
|
|
},
|
|
deptInfo: {},
|
|
deptInfo: {},
|
|
query: {
|
|
query: {
|
|
@@ -300,8 +292,7 @@ export default {
|
|
headers: {
|
|
headers: {
|
|
Authorization: "Bearer " + getToken(),
|
|
Authorization: "Bearer " + getToken(),
|
|
},
|
|
},
|
|
- collectClickCalendar: [], // 收集固定日期选择的日子
|
|
|
|
- collectClickWorkDay: [],
|
|
|
|
|
|
+
|
|
timeSelect: [
|
|
timeSelect: [
|
|
,
|
|
,
|
|
["周天", "周一", "周二", "周三", "周四", "周五", "周六"],
|
|
["周天", "周一", "周二", "周三", "周四", "周五", "周六"],
|
|
@@ -348,53 +339,29 @@ export default {
|
|
};
|
|
};
|
|
},
|
|
},
|
|
created() {
|
|
created() {
|
|
- listRuleOne(this.queryParams).then((response) => {
|
|
|
|
- console.log("拉取", response.data);
|
|
|
|
|
|
+ listRuleOne({
|
|
|
|
+ pageNum: 1,
|
|
|
|
+ pageSize: 100,
|
|
|
|
+ }).then((response) => {
|
|
|
|
+ console.log("拉取", response.data);``
|
|
this.form = response.data;
|
|
this.form = response.data;
|
|
- if (datepicker == "1" || datepicker == "2") {
|
|
|
|
- this.collectClickWorkDay = this.form.datePickerTime
|
|
|
|
|
|
+ this.form.collectClickCalendar = [];
|
|
|
|
+ this.form.collectClickDay = "";
|
|
|
|
+
|
|
|
|
+ if (this.form.datepicker == "1" || this.form.datepicker == "2") {
|
|
|
|
+ this.collectClickCalendar = this.form.datePickerTime
|
|
.split(",")
|
|
.split(",")
|
|
.map(parseFloat);
|
|
.map(parseFloat);
|
|
} else {
|
|
} else {
|
|
-
|
|
|
|
|
|
+ this.collectClickDay = this.form.datePickerTime;
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
|
|
- listRuleOne(this.queryParams).then((response) => {
|
|
|
|
- console.log("response", response);
|
|
|
|
- if (response.hasOwnProperty("data")) {
|
|
|
|
- this.form = response.data;
|
|
|
|
-
|
|
|
|
- if (response.data.hasOwnProperty("itemsDetail")) {
|
|
|
|
- if (this.form.itemsDetail.length == 0) {
|
|
|
|
- this.form.itemsDetail = [{}];
|
|
|
|
- } else {
|
|
|
|
- this.rowsnum = this.form.itemsDetail.length - 1;
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- this.form.itemsDetail = [{}];
|
|
|
|
- }
|
|
|
|
- let datepicker = this.form.datePicker;
|
|
|
|
- if (datepicker == "1" || datepicker == "2") {
|
|
|
|
- this.workDaytrue = true;
|
|
|
|
- this.collectClickWorkDay = this.form.datePickerTime
|
|
|
|
- .split(",")
|
|
|
|
- .map(parseFloat);
|
|
|
|
-
|
|
|
|
- } else {
|
|
|
|
- if (this.form.datePickerTime != null) {
|
|
|
|
- this.pickerTime = this.form.datePickerTime.split(",");
|
|
|
|
-
|
|
|
|
- } else {
|
|
|
|
- this.pickerTime = null;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- oilNameList(this.queryParams).then((response) => {
|
|
|
|
|
|
+ oilNameList({
|
|
|
|
+ pageNum: 1,
|
|
|
|
+ pageSize: 100,
|
|
|
|
+ }).then((response) => {
|
|
this.oilNameOptions = response.rows;
|
|
this.oilNameOptions = response.rows;
|
|
- console.log("油品名");
|
|
|
|
- console.log(this.oilNameOptions);
|
|
|
|
});
|
|
});
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
@@ -485,157 +452,35 @@ export default {
|
|
console.log("提交");
|
|
console.log("提交");
|
|
this.$refs["form"].validate((valid) => {
|
|
this.$refs["form"].validate((valid) => {
|
|
if (valid) {
|
|
if (valid) {
|
|
|
|
+ if (this.form.datePicker == "1" || this.form.datePicker == "2") {
|
|
|
|
+ this.form.datePickerTime = this.form.collectClickCalendar.toString();
|
|
|
|
+ } else {
|
|
|
|
+ this.form.datePickerTime = this.form.collectClickDay;
|
|
|
|
+ }
|
|
|
|
+
|
|
if (this.form.id != null) {
|
|
if (this.form.id != null) {
|
|
- let datepicker = this.form.datePicker;
|
|
|
|
- console.log("你好", this.collectClickWorkDay);
|
|
|
|
- if (datepicker == "1") {
|
|
|
|
- this.form.datePickerTime = this.collectClickWorkDay.toString();
|
|
|
|
- } else if (datepicker == "2") {
|
|
|
|
- this.form.datePickerTime = this.collectClickWorkDay.toString();
|
|
|
|
- } else {
|
|
|
|
- if (this.pickerTime != null) {
|
|
|
|
- this.form.datePickerTime = this.pickerTime.toString();
|
|
|
|
- } else {
|
|
|
|
- this.form.datePickerTime = "";
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- let itemsDetail = this.form.itemsDetail;
|
|
|
|
- let flag = true;
|
|
|
|
- if (itemsDetail != null && itemsDetail.length > 1) {
|
|
|
|
- for (var i = 0; i < itemsDetail.length; i++) {
|
|
|
|
- for (var j = i + 1; j < itemsDetail.length; j++) {
|
|
|
|
- if (itemsDetail[i].oilName == itemsDetail[j].oilName) {
|
|
|
|
- if (itemsDetail[i].gread == itemsDetail[j].gread) {
|
|
|
|
- flag = false;
|
|
|
|
- break;
|
|
|
|
- } else if (itemsDetail[i].gread != itemsDetail[j].gread) {
|
|
|
|
- if (itemsDetail[i].gread == "所有人") {
|
|
|
|
- flag = false;
|
|
|
|
- break;
|
|
|
|
- } else if (itemsDetail[j].gread == "所有人") {
|
|
|
|
- flag = false;
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- if (!flag) {
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- if (flag) {
|
|
|
|
- updateRule(this.form).then((response) => {
|
|
|
|
- this.msgSuccess("修改成功");
|
|
|
|
- });
|
|
|
|
- } else {
|
|
|
|
- this.msgSuccess("添加的规则明细有重复的,请再次确实积分规则");
|
|
|
|
- }
|
|
|
|
|
|
+ updateRule(this.form).then((response) => {
|
|
|
|
+ this.msgSuccess("修改成功");
|
|
|
|
+ });
|
|
} else {
|
|
} else {
|
|
- if (this.num === 0) {
|
|
|
|
- let datepicker = this.form.datePicker;
|
|
|
|
- if (datepicker == "1") {
|
|
|
|
- if (
|
|
|
|
- this.collectClickWorkDay != null &&
|
|
|
|
- this.collectClickWorkDay.length > 0
|
|
|
|
- ) {
|
|
|
|
- let discountTime = null;
|
|
|
|
- for (let i = 0; i < this.collectClickWorkDay.length; i++) {
|
|
|
|
- if (
|
|
|
|
- !isNaN(this.collectClickWorkDay[i]) &&
|
|
|
|
- this.collectClickWorkDay[i] != "NaN"
|
|
|
|
- ) {
|
|
|
|
- if (discountTime != null) {
|
|
|
|
- discountTime =
|
|
|
|
- discountTime + "," + this.collectClickWorkDay[i];
|
|
|
|
- } else {
|
|
|
|
- discountTime = this.collectClickWorkDay[i];
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- discountTime = discountTime;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- this.form.datePickerTime = discountTime;
|
|
|
|
- discountTime = null;
|
|
|
|
- } else {
|
|
|
|
- this.form.datePickerTime = "";
|
|
|
|
- }
|
|
|
|
- } else if (datepicker == "2") {
|
|
|
|
- if (
|
|
|
|
- this.collectClickCalendar != null &&
|
|
|
|
- this.collectClickCalendar.length > 0
|
|
|
|
- ) {
|
|
|
|
- let discountTime = null;
|
|
|
|
- for (let i = 0; i < this.collectClickCalendar.length; i++) {
|
|
|
|
- if (
|
|
|
|
- !isNaN(this.collectClickCalendar[i]) &&
|
|
|
|
- this.collectClickCalendar[i] != "NaN"
|
|
|
|
- ) {
|
|
|
|
- if (discountTime != null) {
|
|
|
|
- discountTime =
|
|
|
|
- discountTime + "," + this.collectClickCalendar[i];
|
|
|
|
- } else {
|
|
|
|
- discountTime = this.collectClickCalendar[i];
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- discountTime = discountTime;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- this.form.datePickerTime = discountTime;
|
|
|
|
- discountTime = null;
|
|
|
|
- } else {
|
|
|
|
- this.form.datePickerTime = "";
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- if (this.pickerTime != null) {
|
|
|
|
- this.form.datePickerTime = this.pickerTime.toString();
|
|
|
|
- } else {
|
|
|
|
- this.form.datePickerTime = "";
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- let itemsDetail = this.form.itemsDetail;
|
|
|
|
- let flag = true;
|
|
|
|
- //验证积分规则,相同油品,等级为所有人,该油品不能再设置其他等级。相同油品等级不为所有人,可以设置不同等级的规则,不可以设置油品相同等级相同的规则
|
|
|
|
- if (itemsDetail != null && itemsDetail.length > 0) {
|
|
|
|
- for (var i = 0; i < itemsDetail.length; i++) {
|
|
|
|
- for (var j = i + 1; j < itemsDetail.length; j++) {
|
|
|
|
- if (
|
|
|
|
- itemsDetail[i].ruleType == itemsDetail[j].ruleType &&
|
|
|
|
- itemsDetail[i].oilName == itemsDetail[j].oilName &&
|
|
|
|
- itemsDetail[i].gread == itemsDetail[j].gread
|
|
|
|
- ) {
|
|
|
|
- flag = false;
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- if (flag) break;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- if (flag) {
|
|
|
|
- addRule(this.form).then((response) => {
|
|
|
|
- this.msgSuccess("新增成功");
|
|
|
|
- });
|
|
|
|
- } else {
|
|
|
|
- this.msgSuccess("添加的规则明细有重复的,请再次确实积分规则");
|
|
|
|
- }
|
|
|
|
- this.num = this.num + 1;
|
|
|
|
- } else {
|
|
|
|
- this.msgSuccess("已新增成功!如需修改请刷新页面");
|
|
|
|
- }
|
|
|
|
|
|
+ this.form.datePickerTime = "";
|
|
|
|
+ addRule(this.form).then((response) => {
|
|
|
|
+ this.msgSuccess("新增成功");
|
|
|
|
+ });
|
|
}
|
|
}
|
|
}
|
|
}
|
|
});
|
|
});
|
|
},
|
|
},
|
|
|
|
|
|
clickCalendar(index) {
|
|
clickCalendar(index) {
|
|
- if (this.collectClickCalendar.indexOf(index) === -1) {
|
|
|
|
- this.collectClickCalendar.push(index);
|
|
|
|
- } else if (this.collectClickCalendar.indexOf(index) > -1) {
|
|
|
|
- const temp = this.collectClickCalendar.findIndex((ele)=>{
|
|
|
|
- return ele == index
|
|
|
|
- })
|
|
|
|
|
|
+ if (this.form.collectClickCalendar.indexOf(index) === -1) {
|
|
|
|
+ this.form.collectClickCalendar.push(index);
|
|
|
|
+ } else if (this.form.collectClickCalendar.indexOf(index) > -1) {
|
|
|
|
+ const temp = this.form.collectClickCalendar.findIndex((ele) => {
|
|
|
|
+ return ele == index;
|
|
|
|
+ });
|
|
console.log(temp);
|
|
console.log(temp);
|
|
- this.collectClickCalendar.splice(temp,1)
|
|
|
|
|
|
+ this.form.collectClickCalendar.splice(temp, 1);
|
|
}
|
|
}
|
|
},
|
|
},
|
|
},
|
|
},
|