This commit is contained in:
13405411873 2024-09-19 14:33:28 +08:00
parent 45c78f6413
commit 6a3d7af6c1

View File

@ -375,8 +375,24 @@ export default {
weekList: ["周一", "周二", "周三", "周四", "周五", "周六", "周日"], weekList: ["周一", "周二", "周三", "周四", "周五", "周六", "周日"],
weekDay: [], weekDay: [],
monthDay: [], monthDay: [],
orderList: [], orderList: [{
refuelList: [], activeManner: 0,
full: "",
sub: "",
randomFront: "",
randomAfter: "",
maxPreferential: "",
enjoyDiscount: "",
}],
refuelList: [{
activeManner: 1,
full: "",
sub: "",
randomFront: "",
randomAfter: "",
maxPreferential: "",
enjoyDiscount: "",
}],
// //
rules: { rules: {
activeName: [ activeName: [
@ -569,6 +585,133 @@ export default {
return; return;
} }
} }
if (this.ruleForm.activeManner.length==0){
this.$message.warning("请选择活动方式");
return
}
if (this.ruleForm.activeManner.indexOf("0")){
let flag1 = true;
//
if (this.ruleForm.offerType == 0 && this.ruleForm.activeType == 0){
this.orderList.forEach(item=>{
if (!item.full){
flag1 = false
}
if (!item.sub){
flag1 = false
}
})
}
if (this.ruleForm.offerType == 0 && this.ruleForm.activeType == 1){
this.orderList.forEach(item=>{
if (!item.full){
flag1 = false
}
if (!item.randomFront){
flag1 = false
}
if (!item.randomAfter){
flag1 = false
}
})
}
if (this.ruleForm.offerType == 0 && this.ruleForm.activeType == 2){
this.orderList.forEach(item=>{
if (!item.full){
flag1 = false
}
if (!item.sub){
flag1 = false
}
if (!item.maxPreferential){
flag1 = false
}
})
}
if (this.ruleForm.offerType == 1 && this.ruleForm.activeType == 0){
this.orderList.forEach(item=>{
if (!item.full){
flag1 = false
}
if (!item.enjoyDiscount){
flag1 = false
}
if (!item.maxPreferential){
flag1 = false
}
})
}
if (!flag1){
this.$message.warning("活动方式按订单金额,请填写完整");
return
}
}
if (this.ruleForm.activeManner.indexOf("1")){
let flag1 = true
//
if (this.ruleForm.offerType == 0 && this.ruleForm.activeType == 0){
this.refuelList.forEach(item=>{
if (!item.full){
flag1 = false
}
if (!item.sub){
flag1 = false
}
})
}
if (this.ruleForm.offerType == 0 && this.ruleForm.activeType == 1){
this.refuelList.forEach(item=>{
if (!item.full){
flag1 = false
}
if (!item.randomFront){
flag1 = false
}
if (!item.randomAfter){
flag1 = false
}
})
}
if (this.ruleForm.offerType == 0 && this.ruleForm.activeType == 2){
this.refuelList.forEach(item=>{
if (!item.full){
flag1 = false
}
if (!item.sub){
flag1 = false
}
if (!item.maxPreferential){
flag1 = false
}
})
}
if (this.ruleForm.offerType == 1 && this.ruleForm.activeType == 0){
this.refuelList.forEach(item=>{
if (!item.full){
flag1 = false
}
if (!item.enjoyDiscount){
flag1 = false
}
if (!item.maxPreferential){
flag1 = false
}
})
}
if (!flag1){
this.$message.warning("活动方式按加油升数,请填写完整");
return
}
}
this.$refs[formName].validate((valid) => { this.$refs[formName].validate((valid) => {
if (valid) { if (valid) {
if (this.ruleForm.timeType == 0) { if (this.ruleForm.timeType == 0) {
@ -583,7 +726,6 @@ export default {
if (this.ruleForm.activeManner) this.ruleForm.activeManner = this.ruleForm.activeManner.toString() if (this.ruleForm.activeManner) this.ruleForm.activeManner = this.ruleForm.activeManner.toString()
if (this.orderList) this.ruleForm.orderList = this.orderList if (this.orderList) this.ruleForm.orderList = this.orderList
if (this.refuelList) this.ruleForm.refuelList = this.refuelList if (this.refuelList) this.ruleForm.refuelList = this.refuelList
if (this.ruleForm.id) { if (this.ruleForm.id) {
// //
editActiveSubPrice(this.ruleForm).then(res => { editActiveSubPrice(this.ruleForm).then(res => {