|
|
<template>
|
|
|
<div class="container" v-show="showType">
|
|
|
<div class="header">
|
|
|
<div class="back" @click="hide()"></div>
|
|
|
<div class="back" @click="back()"></div>
|
|
|
</div>
|
|
|
<div class="title">筛选</div>
|
|
|
<div class="content">
|
|
|
<div class="item" v-for="(filter,row) in filterData">
|
|
|
<div class="content-search">
|
|
|
<div class="item" v-if="filterData && filterData.length" v-for="(filter,row) in filterData">
|
|
|
<div class="item-title">{{filter.filterName}}</div>
|
|
|
<div v-if="filter.itemList && filter.itemList.length" class="item-list">
|
|
|
<div class="item-img-content" v-if="filter.filterId === 'brand'"
|
...
|
...
|
@@ -17,10 +17,15 @@ |
|
|
</div>
|
|
|
<div class="item-text item-size" v-if="filter.filterId === 'size'" :style="i===0 && 'margin-left:1rem'"
|
|
|
:class="filterParams.size.includes(item.itemId) && 'item-text-selected'"
|
|
|
v-for="(item,i) in filter.itemList" @click="select({filterId:filter.filterId, itemId:item.itemId, row})">{{item.itemName}}</div>
|
|
|
<div class="item-text" v-if="filter.filterId === 'sort' || filter.filterId === 'gender'" :style="i===0 && 'margin-left:1rem'"
|
|
|
v-for="(item,i) in filter.itemList" @click="select({filterId:filter.filterId, itemId:item.itemId, row})">
|
|
|
{{item.itemName}}
|
|
|
</div>
|
|
|
<div class="item-text" v-if="filter.filterId === 'sort' || filter.filterId === 'gender'"
|
|
|
:style="i===0 && 'margin-left:1rem'"
|
|
|
:class="(filterParams.sort.includes(item.itemId) || filterParams.gender.includes(item.itemId)) && 'item-text-selected'"
|
|
|
v-for="(item,i) in filter.itemList" @click="select({filterId:filter.filterId, itemId:item.itemId, row})">{{item.itemName}}</div>
|
|
|
v-for="(item,i) in filter.itemList" @click="select({filterId:filter.filterId, itemId:item.itemId, row})">
|
|
|
{{item.itemName}}
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
...
|
...
|
@@ -52,6 +57,12 @@ export default { |
|
|
},
|
|
|
filterData: [],
|
|
|
filterVisible: false,
|
|
|
copyFilterParams: {
|
|
|
sort: [], // 品类id
|
|
|
brand: [], // 品牌id
|
|
|
gender: [], // 性别
|
|
|
size: [], // 尺码id
|
|
|
}
|
|
|
};
|
|
|
},
|
|
|
activated() {
|
...
|
...
|
@@ -72,12 +83,19 @@ export default { |
|
|
methods: {
|
|
|
...mapActions(['fetchFilterData']),
|
|
|
clear() {
|
|
|
this.setFilterParam({
|
|
|
let filterParams = {
|
|
|
sort: [], // 品类id
|
|
|
brand: [], // 品牌id
|
|
|
gender: [], // 性别
|
|
|
size: [], // 尺码id
|
|
|
});
|
|
|
};
|
|
|
|
|
|
for (let item of this.filterData) {
|
|
|
if (item.itemList && item.itemList.length === 1) {
|
|
|
filterParams[item.filterId].push(item.itemList[0].itemId);
|
|
|
}
|
|
|
}
|
|
|
this.setFilterParam(filterParams);
|
|
|
},
|
|
|
|
|
|
fetchData: async function(params) {
|
...
|
...
|
@@ -93,7 +111,13 @@ export default { |
|
|
this.filterParams = filterParams;
|
|
|
},
|
|
|
|
|
|
back() {
|
|
|
this.filterParams = {...this.copyFilterParams};
|
|
|
this.hide();
|
|
|
},
|
|
|
|
|
|
submit() {
|
|
|
this.copyFilterParams = {...this.filterParams};
|
|
|
let params = {
|
|
|
sort: this.filterParams.sort.join(','),
|
|
|
brand: this.filterParams.brand.join(','), // 品牌id
|
...
|
...
|
@@ -137,7 +161,7 @@ export default { |
|
|
this.setFilterParam(optParams);
|
|
|
},
|
|
|
|
|
|
setFilterParam({filter}) {
|
|
|
setFilterParam(filter) {
|
|
|
let filterParams = this.filterParams;
|
|
|
|
|
|
if (typeof filter === 'object' && Object.keys(filter).length) {
|
...
|
...
|
@@ -158,7 +182,7 @@ export default { |
|
|
}
|
|
|
};
|
|
|
</script>
|
|
|
<style scoped>
|
|
|
<style lang="scss" scoped>
|
|
|
.header {
|
|
|
width: 100%;
|
|
|
height: 45PX;
|
...
|
...
|
@@ -190,45 +214,7 @@ export default { |
|
|
margin-left: 40px;
|
|
|
}
|
|
|
|
|
|
.content {
|
|
|
}
|
|
|
|
|
|
.bottom {
|
|
|
height: 120px;
|
|
|
position: fixed;
|
|
|
bottom: 0;
|
|
|
z-index: 9;
|
|
|
width: 100%;
|
|
|
background: #fff;
|
|
|
display: flex;
|
|
|
border-top: 1px solid rgba(0, 0, 0, 0.12);
|
|
|
justify-content: space-between;
|
|
|
align-items: center;
|
|
|
}
|
|
|
|
|
|
.clear {
|
|
|
margin-left: 32px;
|
|
|
line-height: 80px;
|
|
|
text-align: center;
|
|
|
width: 330px;
|
|
|
height: 80px;
|
|
|
color: #000;
|
|
|
font-size: 32px;
|
|
|
border: 1px solid rgba(0, 0, 0, 0.12);
|
|
|
border-radius: 40px;
|
|
|
}
|
|
|
|
|
|
.submit {
|
|
|
line-height: 80px;
|
|
|
background-color: #08304B;
|
|
|
width: 330px;
|
|
|
height: 80px;
|
|
|
text-align: center;
|
|
|
color: #fff;
|
|
|
font-size: 32px;
|
|
|
border-radius: 40px;
|
|
|
margin-right: 32px;
|
|
|
}
|
|
|
.content-search {
|
|
|
|
|
|
.item {
|
|
|
margin-bottom: 60px;
|
...
|
...
|
@@ -305,6 +291,44 @@ export default { |
|
|
width: 140px;
|
|
|
height: 64px;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
.bottom {
|
|
|
height: 120px;
|
|
|
position: fixed;
|
|
|
bottom: 0;
|
|
|
z-index: 9;
|
|
|
width: 100%;
|
|
|
background: #fff;
|
|
|
display: flex;
|
|
|
border-top: 1px solid rgba(0, 0, 0, 0.12);
|
|
|
justify-content: space-between;
|
|
|
align-items: center;
|
|
|
}
|
|
|
|
|
|
.clear {
|
|
|
margin-left: 32px;
|
|
|
line-height: 80px;
|
|
|
text-align: center;
|
|
|
width: 330px;
|
|
|
height: 80px;
|
|
|
color: #000;
|
|
|
font-size: 32px;
|
|
|
border: 1px solid rgba(0, 0, 0, 0.12);
|
|
|
border-radius: 40px;
|
|
|
}
|
|
|
|
|
|
.submit {
|
|
|
line-height: 80px;
|
|
|
background-color: #08304B;
|
|
|
width: 330px;
|
|
|
height: 80px;
|
|
|
text-align: center;
|
|
|
color: #fff;
|
|
|
font-size: 32px;
|
|
|
border-radius: 40px;
|
|
|
margin-right: 32px;
|
|
|
}
|
|
|
|
|
|
.back {
|
|
|
margin-top: 24px;
|
...
|
...
|
|