Commit bea0845d by lixiaomin

修改页面

parent bc7e1fb9
......@@ -145,3 +145,10 @@ export function getShopCity() {
method: "get",
});
}
export function getShopAreaTree() {
return request({
url: "/system/shop/area/tree",
method: "get",
});
}
......@@ -48,7 +48,12 @@
{{ scope.row.ruleDesc }}{{scope.row.ruleName}}
</template>
</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">
<template slot-scope="scope">
<p>{{formateTime(scope.row.useStartTime)}}{{formateTime(scope.row.useEndTime)}}</p>
......@@ -155,7 +160,7 @@
<el-col>
<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="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-option
v-for="item in weekList"
......@@ -198,7 +203,7 @@ import {getCouCategoryList} from "@/api/coupon/couponType";
import GiveCoupon from './giveCoupon.vue';
import {listClass} from "@/api/system/category";
import {listSpu} from "@/api/system/goods";
import {listShop} from "@/api/system/shop";
import {listShop,getShopAreaTree} from "@/api/system/shop";
import piovince from '@/utils/piovince'
export default {
name: "Class",
......@@ -239,7 +244,6 @@ export default {
sendMsgTag: [{required: true, message: "不能为空", trigger: "change" }]
},
couCategoryList: [],
storesList:[],
weekList:[{
value: 1,
label: '星期一'
......@@ -275,6 +279,7 @@ export default {
cityList:[],
storesRange:[],
selectMess:true,
shopAreaTreeList:[]
};
},
created() {
......@@ -330,41 +335,26 @@ export default {
}
this.shopRangeList=[{value:0,label:"全品类"},{value:1,label:"分品类",children:catList},{value:2,label:"分商品",children:shList}]
},
//封装门店下拉数据
getStoresList(){
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++){
if(sheng==piovinceList[i].value){
let shiList=piovinceList[i].children;
if(shiList.length>0){
for(let j=0;j<shiList.length;j++){
if(shi==shiList[j].value){
let quList=shiList[j].children;
if(quList.length>0){
let arry=[];
for(let q=0;q<quList.length;q++){
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);
}
}
}
//把省市区封装成map集合
getMap(){
let list=new Map();
let piovinceList=this.piovince;
for(let i=0;i<piovinceList.length;i++){
list.set(piovinceList[i].value,piovinceList[i].label);
if(piovinceList[i].children.length>0){
let firstList=piovinceList[i].children;
for(let j=0;j<firstList.length;j++){
list.set(firstList[j].value,firstList[j].label);
if(firstList[j].children.length>0){
let twoList=firstList[j].children;
for(let t=0;t<twoList.length;t++){
list.set(twoList[t].value,twoList[t].label);
}
}
}
}
}
}
return list;
},
changeMsg(val){
this.selectMess=false;
......@@ -414,19 +404,7 @@ export default {
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
id: null,
name: null,
status: "0",
remarks: null,
code: null,
createTime: null,
};
},
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
......@@ -441,12 +419,11 @@ export default {
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.form.sendMsgTag=2
this.open = true;
this.title = "新增优惠券";
this.getShopRangeList();
this.getStoresList();
this.getShopAreaTree();
},
/** 上线、下线按钮操作 */
handleStatus(row,tag) {
......@@ -587,8 +564,34 @@ export default {
this.$modal.msgSuccess("删除成功");
}
})
.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>
......
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