...
|
...
|
@@ -9,15 +9,25 @@ |
|
|
</ul>
|
|
|
<div class="sub-level-container">
|
|
|
<ul class="sub-level">
|
|
|
<li class="ellipsis">
|
|
|
<a v-if="jump" href="/product/list?sort={{rightAll.sortId || '' }}&sort_name=全部{{rightAll.categoryName || ''}}&gender={{gender}}">全部{{rightAll.categoryName}}</a>
|
|
|
<a v-else @click="noJumpReturn(rightAll.sortId, '全部' + rightAll.categoryName)">全部{{rightAll.categoryName}}</a>
|
|
|
<li :class="{'sub-checked': rightAll.checked}">
|
|
|
<div class="block ellipsis">
|
|
|
<a v-if="jump" href="/product/list?sort={{rightAll.sortId || '' }}&sort_name=全部{{rightAll.categoryName || ''}}&gender={{gender}}">全部{{rightAll.categoryName}}</a>
|
|
|
<a v-else @click="noJumpReturn(rightAll.sortId, '全部' + rightAll.categoryName, true)">全部{{rightAll.categoryName}}</a>
|
|
|
</div>
|
|
|
<div class="checked">
|
|
|
<i class="icon icon-check"></i>
|
|
|
</div>
|
|
|
</li>
|
|
|
</ul>
|
|
|
<ul class="sub-level">
|
|
|
<li v-for="sub in cateNavRightData" class="ellipsis">
|
|
|
<a v-if="jump" href="/product/list?sort={{sub.relation_parameter.sort}}&sort_name={{sub.category_name}}&gender={{gender}}">{{sub.category_name}}</a>
|
|
|
<a v-else @click="noJumpReturn(sub.relation_parameter.sort, sub.category_name)">{{sub.category_name}}</a>
|
|
|
<li v-for="sub in cateNavRightData" :class="{'sub-checked': sub.checked}">
|
|
|
<div class="block ellipsis">
|
|
|
<a v-if="jump" href="/product/list?sort={{sub.relation_parameter.sort}}&sort_name={{sub.category_name}}&gender={{gender}}">{{sub.category_name}}</a>
|
|
|
<a v-else @click="noJumpReturn(sub.relation_parameter.sort, sub.category_name)">{{sub.category_name}}</a>
|
|
|
</div>
|
|
|
<div class="checked">
|
|
|
<i class="icon icon-check"></i>
|
|
|
</div>
|
|
|
</li>
|
|
|
</ul>
|
|
|
</div>
|
...
|
...
|
@@ -184,30 +194,44 @@ |
|
|
line-height: 88px;
|
|
|
border-bottom: 1px solid #e6e6e6;
|
|
|
padding-left: 30px;
|
|
|
margin-right: 30px;
|
|
|
user-select: none;
|
|
|
white-space: nowrap;
|
|
|
overflow-y: auto;
|
|
|
display: flex;
|
|
|
|
|
|
&.highlight {
|
|
|
background: #eee;
|
|
|
}
|
|
|
|
|
|
&.sub-checked {
|
|
|
.icon {
|
|
|
display: inline !important;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
&:hover {
|
|
|
background-color: #efefef;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
a {
|
|
|
position: absolute;
|
|
|
top: 0;
|
|
|
right: 0;
|
|
|
bottom: 0;
|
|
|
left: 20px;
|
|
|
display: inline;
|
|
|
color: #b0b0b0;
|
|
|
overflow: hidden;
|
|
|
text-overflow: ellipsis;
|
|
|
.block {
|
|
|
flex: 1;
|
|
|
}
|
|
|
|
|
|
.checked {
|
|
|
width: 100px;
|
|
|
text-align: center;
|
|
|
color: #000;
|
|
|
|
|
|
.icon {
|
|
|
display: none;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
a {
|
|
|
color: #b0b0b0;
|
|
|
display: block;
|
|
|
width: 100%;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
...
|
...
|
@@ -225,6 +249,12 @@ |
|
|
},
|
|
|
gender: {
|
|
|
type: String
|
|
|
},
|
|
|
value: {
|
|
|
type: Array,
|
|
|
default() {
|
|
|
return [];
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
data() {
|
...
|
...
|
@@ -232,10 +262,15 @@ |
|
|
cateNavLeftData: [], // 左侧分类数据
|
|
|
cateNavRightData: [], // 右侧分类数据
|
|
|
leftcurrent: 0, // 标记当前左侧选中条目
|
|
|
rightAll: {} // 全部XX
|
|
|
rightAll: {}, // 全部XX
|
|
|
currentValue: this.value
|
|
|
};
|
|
|
},
|
|
|
watch: {
|
|
|
value(val) {
|
|
|
this.currentValue = val;
|
|
|
this.categoryChangeHandler();
|
|
|
},
|
|
|
category() {
|
|
|
this.categoryChangeHandler();
|
|
|
}
|
...
|
...
|
@@ -244,17 +279,48 @@ |
|
|
cateNavLeftFun(index, categoryId, categoryName) {
|
|
|
this.leftcurrent = index;
|
|
|
this.cateNavRightData = this.cateNavLeftData[index].sub;
|
|
|
let allSorts = this.getAllSortId(this.cateNavRightData);
|
|
|
|
|
|
this.rightAll = {
|
|
|
sortId: categoryId ? categoryId : '',
|
|
|
categoryName: categoryName ? categoryName : ''
|
|
|
sortId: allSorts,
|
|
|
categoryName: categoryName ? categoryName : '',
|
|
|
checked: this.currentValue.some(cate => {
|
|
|
return cate.id.toString() === allSorts;
|
|
|
})
|
|
|
};
|
|
|
},
|
|
|
|
|
|
/* 筛选列表使用返回值 */
|
|
|
noJumpReturn(categoryId, categoryName) {
|
|
|
this.$dispatch('select', {
|
|
|
id: categoryId,
|
|
|
name: categoryName
|
|
|
noJumpReturn(categoryId, categoryName, isall) {
|
|
|
let cateIndex = this.currentValue.findIndex(cate => cate.id.toString() === categoryId);
|
|
|
|
|
|
if (cateIndex >= 0) {
|
|
|
this.currentValue.splice(cateIndex, 1);
|
|
|
} else {
|
|
|
this.currentValue.push({
|
|
|
id: categoryId,
|
|
|
name: categoryName
|
|
|
});
|
|
|
}
|
|
|
if (isall) {
|
|
|
this.cateNavRightData.forEach(cate => {
|
|
|
let cateRmIndex = this.currentValue
|
|
|
.findIndex(c => c.id.toString() === cate.relation_parameter.sort);
|
|
|
|
|
|
if (cateRmIndex >= 0) {
|
|
|
this.currentValue.splice(cateRmIndex, 1);
|
|
|
}
|
|
|
});
|
|
|
} else if (this.rightAll.checked) {
|
|
|
let cateRmIndex = this.currentValue.findIndex(c => c.id.toString() === this.rightAll.sortId);
|
|
|
|
|
|
if (cateRmIndex >= 0) {
|
|
|
this.currentValue.splice(cateRmIndex, 1);
|
|
|
}
|
|
|
}
|
|
|
this.$emit('select', {
|
|
|
value: this.currentValue,
|
|
|
subType: 'group_sort'
|
|
|
});
|
|
|
},
|
|
|
|
...
|
...
|
@@ -262,17 +328,30 @@ |
|
|
if (!this.category || !this.category.length) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
this.$set('cateNavLeftData', this.category);
|
|
|
this.$set('cateNavRightData', this.cateNavLeftData ? this.cateNavLeftData[0].sub : []);
|
|
|
let selectLeftCate = this.cateNavLeftData[this.leftcurrent] || {};
|
|
|
|
|
|
let allSorts = this.cateNavLeftData[0].sub ?
|
|
|
this.cateNavLeftData[0].sub.map(sort=>sort.relation_parameter.sort).join(',') : '';
|
|
|
this.cateNavRightData = [];
|
|
|
this.$nextTick(() => {
|
|
|
this.$set('cateNavRightData', selectLeftCate.sub);
|
|
|
|
|
|
this.$set('rightAll', this.cateNavLeftData ? {
|
|
|
sortId: allSorts,
|
|
|
categoryName: this.cateNavLeftData[0].category_name
|
|
|
} : {});
|
|
|
this.cateNavRightData.forEach(cate => {
|
|
|
cate.checked = this.currentValue
|
|
|
.some(selCate =>
|
|
|
selCate.id.toString() === cate.relation_parameter.sort);
|
|
|
});
|
|
|
|
|
|
let allSorts = this.getAllSortId(this.cateNavRightData);
|
|
|
|
|
|
this.$set('rightAll', this.cateNavLeftData ? {
|
|
|
sortId: allSorts,
|
|
|
categoryName: selectLeftCate.category_name,
|
|
|
checked: this.currentValue.some(cate => cate.id.toString() === allSorts)
|
|
|
} : {});
|
|
|
});
|
|
|
},
|
|
|
getAllSortId(sub) {
|
|
|
return sub.map(sort=>sort.relation_parameter.sort).join(',') + ',';
|
|
|
}
|
|
|
},
|
|
|
created() {
|
...
|
...
|
|