This commit is contained in:
cun-nan 2024-03-11 11:29:47 +08:00
parent 0f7ba19407
commit 4233e5bdf1
2 changed files with 99 additions and 7 deletions

View File

@ -192,13 +192,17 @@
<el-form-item label="活动名称" prop="name"> <el-form-item label="活动名称" prop="name">
<el-input v-model="form.name" placeholder="请输入活动名称" /> <el-input v-model="form.name" placeholder="请输入活动名称" />
</el-form-item> </el-form-item>
<el-form-item label="满减规则" prop="activeDiscountChildList"> <el-form-item label="折扣规则" prop="activeDiscountChildList">
<div style="width: 100%; display: flex;align-items: center; margin-bottom: 10px " v-for="(item,index) in activeDiscountChildList" :key="index"> <div style="width: 100%; display: flex;align-items: center; margin-bottom: 10px " v-for="(item,index) in activeDiscountChildList" :key="index">
<div style="width: 25%;display: flex; align-items: center;margin-right: 20px " > <div style="width: 25%;display: flex; align-items: center;margin-right: 20px " >
<span></span> <el-input-number v-model="item.amount" :min="0" :max="99999" label="0"></el-input-number> <span></span> <span style="margin: 0 5px"></span>
<el-input-number v-model="item.amount" :min="0" :max="99999" label="0"></el-input-number>
<span style="margin: 0 5px"></span>
</div> </div>
<div style="width: 25%;display: flex; align-items: center;"> <div style="width: 25%;display: flex; align-items: center;">
<span></span> <el-input-number v-model="item.discount" :min="0" :max="9.9" placeholder="1 ~ 9.9" label=""></el-input-number> <span></span> <span style="margin: 0 5px"></span>
<el-input-number v-model="item.discount" :min="0" :max="9.9" placeholder="1 ~ 9.9" label=""></el-input-number>
<span style="margin: 0 5px"></span>
</div> </div>
<div @click="deleteactiveDiscountChildList(index)"> <div @click="deleteactiveDiscountChildList(index)">
@ -233,7 +237,29 @@
</el-col> </el-col>
</el-row> </el-row>
<el-form-item label="是否有会员日" prop="memberDayType">
<el-radio-group v-model="form.memberDayType">
<el-radio label="0">无会员日</el-radio>
<el-radio label="1">指定日</el-radio>
<el-radio label="2">指定星期</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item v-if="form.memberDayType=='1'" prop="monthDay">
<el-checkbox-group v-model="monthDay" @change="changeMonth">
<el-checkbox v-for="item in 31" :key="item" :label="item">{{item}}</el-checkbox>
</el-checkbox-group>
</el-form-item>
<el-form-item v-if="form.memberDayType=='2'" prop="weekDay">
<el-checkbox-group v-model="weekDay">
<el-checkbox label="星期一">星期一</el-checkbox>
<el-checkbox label="星期二">星期二</el-checkbox>
<el-checkbox label="星期三">星期三</el-checkbox>
<el-checkbox label="星期四">星期四</el-checkbox>
<el-checkbox label="星期五">星期五</el-checkbox>
<el-checkbox label="星期六">星期六</el-checkbox>
<el-checkbox label="星期日">星期日</el-checkbox>
</el-checkbox-group>
</el-form-item>
@ -357,11 +383,12 @@ export default {
status: null, status: null,
isonline: null, isonline: null,
}, },
weekDay:[],
monthDay:[],
// //
form: { form: {
}, },
// //
rules: { rules: {
@ -398,6 +425,9 @@ export default {
activeDiscountChildList:[ activeDiscountChildList:[
{ required: true, message: '不能为空', trigger: 'change' } { required: true, message: '不能为空', trigger: 'change' }
], ],
memberDayType:[
{ required: true, message: '不能为空', trigger: 'change' }
],
} }
}; };
}, },
@ -509,9 +539,14 @@ export default {
handleAdd() { handleAdd() {
this.reset(); this.reset();
this.activeDiscountChildList = [ {amount:'',discount:''}, ] this.activeDiscountChildList = [ {amount:'',discount:''}, ]
this.monthDay = []
this.weekDay = []
this.open = true; this.open = true;
this.title = "添加折扣营销"; this.title = "添加折扣营销";
}, },
changeMonth(val){
console.log(val,this.monthDay,111)
},
// //
getName(oilNameList,ids){ getName(oilNameList,ids){
let name = "" let name = ""
@ -537,6 +572,16 @@ export default {
}else { }else {
this.activeDiscountChildList = [ {amount:'',discount:''}, ] this.activeDiscountChildList = [ {amount:'',discount:''}, ]
} }
if (this.form.monthDay){
this.monthDay = this.form.monthDay.split(",")
}else {
this.monthDay = []
}
if (this.form.weekDay){
this.weekDay = this.form.weekDay.split(",")
}else {
this.weekDay = []
}
this.open = true; this.open = true;
this.title = "修改折扣营销"; this.title = "修改折扣营销";
}); });
@ -602,6 +647,8 @@ export default {
this.form.activeDiscountChildList = this.activeDiscountChildList this.form.activeDiscountChildList = this.activeDiscountChildList
this.$refs["form"].validate(valid => { this.$refs["form"].validate(valid => {
if (valid) { if (valid) {
this.form.monthDay = this.monthDay.toString()
this.form.weekDay = this.weekDay.toString()
if (this.form.id != null) { if (this.form.id != null) {
updateActiveDiscount(this.form).then(response => { updateActiveDiscount(this.form).then(response => {
this.$modal.msgSuccess("修改成功"); this.$modal.msgSuccess("修改成功");

View File

@ -183,10 +183,14 @@
<el-form-item label="满减规则" prop="activeDiscountChildList"> <el-form-item label="满减规则" prop="activeDiscountChildList">
<div style="width: 100%; display: flex;align-items: center; margin-bottom: 10px " v-for="(item,index) in activeDiscountChildList" :key="index"> <div style="width: 100%; display: flex;align-items: center; margin-bottom: 10px " v-for="(item,index) in activeDiscountChildList" :key="index">
<div style="width: 25%;display: flex; align-items: center;margin-right: 20px " > <div style="width: 25%;display: flex; align-items: center;margin-right: 20px " >
<span></span> <el-input-number v-model="item.amount" :min="0" :max="99999" label="0"></el-input-number> <span></span> <span style="margin: 0 5px"></span>
<el-input-number v-model="item.amount" :min="0" :max="99999" label="0"></el-input-number>
<span style="margin: 0 5px"></span>
</div> </div>
<div style="width: 25%;display: flex; align-items: center;"> <div style="width: 25%;display: flex; align-items: center;">
<span></span> <el-input-number v-model="item.deductionAmount" :min="0" :max="item.amount||0" label=""></el-input-number> <span></span> <span style="margin: 0 5px"></span>
<el-input-number v-model="item.deductionAmount" :min="0" :max="item.amount||0" label=""></el-input-number>
<span style="margin: 0 5px"></span>
</div> </div>
<div @click="deleteactiveDiscountChildList(index)"> <div @click="deleteactiveDiscountChildList(index)">
<el-button type="danger" icon="el-icon-delete" circle style="margin-left: 8px" ></el-button> <el-button type="danger" icon="el-icon-delete" circle style="margin-left: 8px" ></el-button>
@ -220,6 +224,31 @@
</el-col> </el-col>
</el-row> </el-row>
<el-form-item label="是否有会员日" prop="memberDayType">
<el-radio-group v-model="form.memberDayType">
<el-radio label="0">无会员日</el-radio>
<el-radio label="1">指定日</el-radio>
<el-radio label="2">指定星期</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item v-if="form.memberDayType=='1'" prop="monthDay">
<el-checkbox-group v-model="monthDay">
<el-checkbox v-for="item in 31" :key="item" :label="item">{{item}}</el-checkbox>
</el-checkbox-group>
</el-form-item>
<el-form-item v-if="form.memberDayType=='2'" prop="weekDay">
<el-checkbox-group v-model="weekDay">
<el-checkbox label="星期一">星期一</el-checkbox>
<el-checkbox label="星期二">星期二</el-checkbox>
<el-checkbox label="星期三">星期三</el-checkbox>
<el-checkbox label="星期四">星期四</el-checkbox>
<el-checkbox label="星期五">星期五</el-checkbox>
<el-checkbox label="星期六">星期六</el-checkbox>
<el-checkbox label="星期日">星期日</el-checkbox>
</el-checkbox-group>
</el-form-item>
<el-form-item label="可用油品" prop="adaptOil" > <el-form-item label="可用油品" prop="adaptOil" >
<el-checkbox-group v-model="form.adaptOil"> <el-checkbox-group v-model="form.adaptOil">
<el-checkbox v-for="(item,index) in oillist" :label="item.id" :key="index">{{item.oilType}}{{item.oilName}}</el-checkbox> <el-checkbox v-for="(item,index) in oillist" :label="item.id" :key="index">{{item.oilType}}{{item.oilName}}</el-checkbox>
@ -336,6 +365,8 @@ export default {
status: null, status: null,
isonline: null, isonline: null,
}, },
weekDay:[],
monthDay:[],
// //
form: {}, form: {},
// //
@ -478,6 +509,8 @@ export default {
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
this.reset(); this.reset();
this.monthDay = []
this.weekDay = []
this.activeDiscountChildList = [ {amount:'',deductionAmount:''}, ] this.activeDiscountChildList = [ {amount:'',deductionAmount:''}, ]
this.open = true; this.open = true;
this.title = "添加满减营销"; this.title = "添加满减营销";
@ -507,6 +540,16 @@ export default {
}else { }else {
this.activeDiscountChildList = [ {amount:'',deductionAmount:''}, ] this.activeDiscountChildList = [ {amount:'',deductionAmount:''}, ]
} }
if (this.form.monthDay){
this.monthDay = this.form.monthDay.split(",")
}else {
this.monthDay = []
}
if (this.form.weekDay){
this.weekDay = this.form.weekDay.split(",")
}else {
this.weekDay = []
}
this.open = true; this.open = true;
this.title = "修改满减营销"; this.title = "修改满减营销";
}); });
@ -570,6 +613,8 @@ export default {
this.form.activeDiscountChildList = this.activeDiscountChildList this.form.activeDiscountChildList = this.activeDiscountChildList
this.$refs["form"].validate(valid => { this.$refs["form"].validate(valid => {
if (valid) { if (valid) {
this.form.monthDay = this.monthDay.toString()
this.form.weekDay = this.weekDay.toString()
if (this.form.id != null) { if (this.form.id != null) {
updateActiveFullminus(this.form).then(response => { updateActiveFullminus(this.form).then(response => {
this.$modal.msgSuccess("修改成功"); this.$modal.msgSuccess("修改成功");