Commit bea0845d by lixiaomin

修改页面

parent bc7e1fb9
...@@ -145,3 +145,10 @@ export function getShopCity() { ...@@ -145,3 +145,10 @@ export function getShopCity() {
method: "get", method: "get",
}); });
} }
export function getShopAreaTree() {
return request({
url: "/system/shop/area/tree",
method: "get",
});
}
...@@ -48,7 +48,12 @@ ...@@ -48,7 +48,12 @@
{{ scope.row.ruleDesc }}{{scope.row.ruleName}} {{ scope.row.ruleDesc }}{{scope.row.ruleName}}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="使用范围" align="center" prop="goodsCount" /> <el-table-column label="使用范围" align="center">
<template slot-scope="scope">
<p v-show="scope.row.goodLimitDesc!=''">{{scope.row.goodLimitDesc}}</p>
<p v-show="scope.row.areaLimitDesc!=''">{{scope.row.areaLimitDesc}}</p>
</template>
</el-table-column>
<el-table-column label="时效" align="center" width="300"> <el-table-column label="时效" align="center" width="300">
<template slot-scope="scope"> <template slot-scope="scope">
<p>{{formateTime(scope.row.useStartTime)}}{{formateTime(scope.row.useEndTime)}}</p> <p>{{formateTime(scope.row.useStartTime)}}{{formateTime(scope.row.useEndTime)}}</p>
...@@ -155,7 +160,7 @@ ...@@ -155,7 +160,7 @@
<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="storesList" v-model="storesRange" :props="{ multiple: true }" clearable collapse-tags placeholder="请选择地区门店" :show-all-levels="false" style="margin-left:55px;width:300px;"/> <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-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"
...@@ -198,7 +203,7 @@ import {getCouCategoryList} from "@/api/coupon/couponType"; ...@@ -198,7 +203,7 @@ import {getCouCategoryList} from "@/api/coupon/couponType";
import GiveCoupon from './giveCoupon.vue'; import GiveCoupon from './giveCoupon.vue';
import {listClass} from "@/api/system/category"; import {listClass} from "@/api/system/category";
import {listSpu} from "@/api/system/goods"; import {listSpu} from "@/api/system/goods";
import {listShop} from "@/api/system/shop"; import {listShop,getShopAreaTree} from "@/api/system/shop";
import piovince from '@/utils/piovince' import piovince from '@/utils/piovince'
export default { export default {
name: "Class", name: "Class",
...@@ -239,7 +244,6 @@ export default { ...@@ -239,7 +244,6 @@ export default {
sendMsgTag: [{required: true, message: "不能为空", trigger: "change" }] sendMsgTag: [{required: true, message: "不能为空", trigger: "change" }]
}, },
couCategoryList: [], couCategoryList: [],
storesList:[],
weekList:[{ weekList:[{
value: 1, value: 1,
label: '星期一' label: '星期一'
...@@ -275,6 +279,7 @@ export default { ...@@ -275,6 +279,7 @@ export default {
cityList:[], cityList:[],
storesRange:[], storesRange:[],
selectMess:true, selectMess:true,
shopAreaTreeList:[]
}; };
}, },
created() { created() {
...@@ -330,41 +335,26 @@ export default { ...@@ -330,41 +335,26 @@ export default {
} }
this.shopRangeList=[{value:0,label:"全品类"},{value:1,label:"分品类",children:catList},{value:2,label:"分商品",children:shList}] this.shopRangeList=[{value:0,label:"全品类"},{value:1,label:"分品类",children:catList},{value:2,label:"分商品",children:shList}]
}, },
//封装门店下拉数据 //把省市区封装成map集合
getStoresList(){ getMap(){
let list=new Map();
let piovinceList=this.piovince; let piovinceList=this.piovince;
if(this.cityList.length>0){
for(let a=0;a<this.cityList.length;a++){
let sheng=this.cityList[a].province;
let shi=this.cityList[a].city;
let qu=this.cityList[a].zone;
let storesName=this.cityList[a].name;
let storesId=this.cityList[a].id;
for(let i=0;i<piovinceList.length;i++){ for(let i=0;i<piovinceList.length;i++){
if(sheng==piovinceList[i].value){ list.set(piovinceList[i].value,piovinceList[i].label);
let shiList=piovinceList[i].children; if(piovinceList[i].children.length>0){
if(shiList.length>0){ let firstList=piovinceList[i].children;
for(let j=0;j<shiList.length;j++){ for(let j=0;j<firstList.length;j++){
if(shi==shiList[j].value){ list.set(firstList[j].value,firstList[j].label);
let quList=shiList[j].children; if(firstList[j].children.length>0){
if(quList.length>0){ let twoList=firstList[j].children;
let arry=[]; for(let t=0;t<twoList.length;t++){
for(let q=0;q<quList.length;q++){ list.set(twoList[t].value,twoList[t].label);
if(qu==quList[q].value){
let quObj={value:qu,label:quList[q].label,children:[{value:storesId,label:storesName}]}
arry.push(quObj);
}
}
let obj={value:sheng,label:piovinceList[i].label,children:[{value:shi,label:shiList[j].label,children:arry}]}
this.storesList.push(obj);
}
}
}
} }
} }
} }
} }
} }
return list;
}, },
changeMsg(val){ changeMsg(val){
this.selectMess=false; this.selectMess=false;
...@@ -414,18 +404,6 @@ export default { ...@@ -414,18 +404,6 @@ export default {
// 取消按钮 // 取消按钮
cancel() { cancel() {
this.open = false; this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
id: null,
name: null,
status: "0",
remarks: null,
code: null,
createTime: null,
};
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery() { handleQuery() {
...@@ -441,12 +419,11 @@ export default { ...@@ -441,12 +419,11 @@ export default {
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
this.reset();
this.form.sendMsgTag=2 this.form.sendMsgTag=2
this.open = true; this.open = true;
this.title = "新增优惠券"; this.title = "新增优惠券";
this.getShopRangeList(); this.getShopRangeList();
this.getStoresList(); this.getShopAreaTree();
}, },
/** 上线、下线按钮操作 */ /** 上线、下线按钮操作 */
handleStatus(row,tag) { handleStatus(row,tag) {
...@@ -589,6 +566,32 @@ export default { ...@@ -589,6 +566,32 @@ export default {
}) })
.catch(() => { }); .catch(() => { });
}, },
//获取省市区门店
getShopAreaTree(){
let list=this.getMap();
getShopAreaTree().then((response) => {
if(response.code==200){
let treeList=response.data;
//填充省市区的label值
for(let i=0;i<treeList.length;i++){
treeList[i].label=list.get(treeList[i].value);
if(treeList[i].children.length>0){
let firChildrenList=treeList[i].children;
for(let j=0;j<firChildrenList.length;j++){
firChildrenList[j].label=list.get(firChildrenList[j].value);
if(firChildrenList[j].children.length>0){
let childrenList=firChildrenList[j].children;
for(let s=0;s<childrenList.length;s++){
childrenList[s].label=list.get(childrenList[s].value);
}
}
}
}
}
this.shopAreaTreeList=[{value:"0",label:"全国通用"},{value:"1",label:"限定区域",children:treeList}]
}
});
}
}, },
}; };
</script> </script>
......
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