Commit cdeafc6d by lixiaomin

修改优惠券的新增区域门店

parent bea0845d
...@@ -69,3 +69,12 @@ export function getCusOrderNum(custId) { ...@@ -69,3 +69,12 @@ export function getCusOrderNum(custId) {
}); });
} }
// 获取优惠券详情
export function getCouponDetail(id) {
return request({
url: "/coupon/detail/" + id,
method: "get",
});
}
...@@ -160,7 +160,8 @@ ...@@ -160,7 +160,8 @@
<el-col> <el-col>
<el-form-item label="适用范围"> <el-form-item label="适用范围">
<el-cascader :options="shopRangeList" v-model="shopRange" clearable placeholder="请选择使用商品范围" class="width" :props="{ multiple: true}" collapse-tags :show-all-levels="false"/> <el-cascader :options="shopRangeList" v-model="shopRange" clearable placeholder="请选择使用商品范围" class="width" :props="{ multiple: true}" collapse-tags :show-all-levels="false"/>
<el-cascader :options="shopAreaTreeList" v-model="storesRange" :props="{ multiple: true }" clearable collapse-tags placeholder="请选择地区门店" :show-all-levels="false" style="margin-left:55px;width:300px;"/> <el-cascader ref="area" :options="shopAreaTreeList" v-model="storesRange" :props="{ multiple: true }" clearable collapse-tags placeholder="请选择地区门店"
:show-all-levels="false" style="margin-left:55px;width:300px;" />
<el-select v-model="form.weekLimit" placeholder="请选择可用日期" multiple collapse-tags style="margin-left: 130px;width: 328px;" clearable> <el-select v-model="form.weekLimit" placeholder="请选择可用日期" multiple collapse-tags style="margin-left: 130px;width: 328px;" clearable>
<el-option <el-option
v-for="item in weekList" v-for="item in weekList"
...@@ -233,7 +234,11 @@ export default { ...@@ -233,7 +234,11 @@ export default {
form: { form: {
categoryIds:[], categoryIds:[],
goodsIds:[], goodsIds:[],
sendMsgTag:2 sendMsgTag:2,
shopIds:[],
area:[],
city:[],
province:[]
}, },
// 表单校验 // 表单校验
rules: { rules: {
...@@ -245,25 +250,25 @@ export default { ...@@ -245,25 +250,25 @@ export default {
}, },
couCategoryList: [], couCategoryList: [],
weekList:[{ weekList:[{
value: 1, value: 2,
label: '星期一' label: '星期一'
}, { }, {
value: 2, value: 3,
label: '星期二' label: '星期二'
}, { }, {
value: 3, value: 4,
label: '星期三' label: '星期三'
}, { }, {
value: 4, value: 5,
label: '星期四' label: '星期四'
}, { }, {
value: 5, value: 6,
label: '星期五' label: '星期五'
}, { }, {
value: 6, value: 7,
label: '星期六' label: '星期六'
}, { }, {
value: 7, value: 1,
label: '星期日' label: '星期日'
}], }],
type:"", type:"",
...@@ -526,7 +531,33 @@ export default { ...@@ -526,7 +531,33 @@ export default {
this.form.goodsIds=goodSList; this.form.goodsIds=goodSList;
} }
if(this.storesRange.length>0){ if(this.storesRange.length>0){
//console.log("this.storesRange",this.storesRange); let proList=[];
let shopIdList=[];
let areaIdList=[];
let cityIdList=[];
if(this.storesRange[0][0]==0){
proList.push(0);
}else{
let areaNode=this.$refs["area"].getCheckedNodes();
areaNode=areaNode.filter(item => !(item.parent && item.parent.checked));
for(let j=0;j<areaNode.length;j++){
if(areaNode[j].level==5){
shopIdList.push(areaNode[j].value)
}else if(areaNode[j].level==4){
areaIdList.push(areaNode[j].value);
}else if(areaNode[j].level==3){
cityIdList.push(areaNode[j].value);
}else if(areaNode[j].level==2){
proList.push(areaNode[j].value);
}else if(areaNode[j].level==1){
proList.push(0);
}
}
}
this.form.shopIds=shopIdList;
this.form.area=areaIdList;
this.form.city=cityIdList;
this.form.province=proList;
} }
if(this.form.sendMsgTag==1){ if(this.form.sendMsgTag==1){
this.form.sendMsg=true; this.form.sendMsg=true;
...@@ -535,17 +566,18 @@ export default { ...@@ -535,17 +566,18 @@ export default {
} }
console.log("this.form",this.form); console.log("this.form",this.form);
if (this.form.id != null) { if (this.form.id != null) {
updateClass(this.form).then((response) => { // updateClass(this.form).then((response) => {
this.$modal.msgSuccess("修改成功"); // this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addCoupon(this.form).then((response) => {
console.log("response",response);
// this.$modal.msgSuccess("新增成功");
// this.open = false; // this.open = false;
// this.getList(); // this.getList();
// });
} else {
addCoupon(this.form).then((response) => {
if(response.code==200){
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
}
}); });
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment