...
|
...
|
@@ -41,6 +41,15 @@ const keyMap = { |
|
|
折扣: 'discount'
|
|
|
};
|
|
|
|
|
|
const convertMap = {
|
|
|
brand: 'brand',
|
|
|
group_sort: 'sort',
|
|
|
color: 'color',
|
|
|
size: 'size',
|
|
|
price: 'price',
|
|
|
discount: 'discount',
|
|
|
};
|
|
|
|
|
|
module.exports = {
|
|
|
props: {
|
|
|
val: String,
|
...
|
...
|
@@ -166,10 +175,11 @@ module.exports = { |
|
|
|
|
|
_.each(this.chosen, (val, key) => {
|
|
|
ids = [];
|
|
|
key = convertMap[key];
|
|
|
keys = Object.keys(val);
|
|
|
|
|
|
_.each(keys, v => {
|
|
|
if (key !== '品类') {
|
|
|
if (key !== 'sort') {
|
|
|
ids.push(val[v].id);
|
|
|
} else {
|
|
|
ids.push(val[v].relation_parameter.sort);
|
...
|
...
|
@@ -177,9 +187,9 @@ module.exports = { |
|
|
});
|
|
|
|
|
|
if (ids.length) {
|
|
|
filter[keyMap[key]] = ids.join(',');
|
|
|
filter[key] = ids.join(',');
|
|
|
} else {
|
|
|
delete filter[keyMap[key]];
|
|
|
delete filter[key];
|
|
|
}
|
|
|
});
|
|
|
|
...
|
...
|
@@ -208,10 +218,39 @@ module.exports = { |
|
|
},
|
|
|
expandSub(type){
|
|
|
this.subType = type;
|
|
|
this.valueData = this.values && this.values[type];
|
|
|
this.subFilterData = this.filter ? this.filter[type] : {};
|
|
|
this.$refs.filterSub.isVisible = true;
|
|
|
},
|
|
|
subFilterChange(sub){
|
|
|
bus.$emit('subFilter.change', sub);
|
|
|
},
|
|
|
subChosenChange(name, chosen) {
|
|
|
let keyArr = Object.keys(chosen);
|
|
|
|
|
|
if (keyArr.length) {
|
|
|
let id, nm;
|
|
|
|
|
|
this.values[name] = [];
|
|
|
_.each(keyArr, key => {
|
|
|
id = name !== 'group_sort' ?
|
|
|
chosen[key].id :
|
|
|
chosen[key].relation_parameter.sort;
|
|
|
|
|
|
nm = name !== 'group_sort' ?
|
|
|
chosen[key].name :
|
|
|
chosen[key].category_name;
|
|
|
|
|
|
this.values[name].push({
|
|
|
id,
|
|
|
name: nm
|
|
|
});
|
|
|
});
|
|
|
this.chosen[name] = chosen;
|
|
|
} else {
|
|
|
this.values[name] = [];
|
|
|
delete this.chosen[name];
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
watch: {
|
...
|
...
|
@@ -230,10 +269,6 @@ module.exports = { |
|
|
}
|
|
|
|
|
|
this.showLay();
|
|
|
},
|
|
|
subType(type){
|
|
|
this.valueData = this.values && this.values[type];
|
|
|
this.subFilterData = this.filter ? this.filter[type] : {};
|
|
|
}
|
|
|
},
|
|
|
components: {
|
...
|
...
|
@@ -253,13 +288,7 @@ module.exports = { |
|
|
this.filterItems[4].choices = this.filter.priceRange;
|
|
|
this.filterItems[5].choices = this.filter.discount;
|
|
|
|
|
|
bus.$on('choice.change', (name, chosen) => {
|
|
|
if (!_.isArray(chosen)) {
|
|
|
this.chosen[name] = chosen;
|
|
|
} else {
|
|
|
delete this.chosen[name];
|
|
|
}
|
|
|
});
|
|
|
bus.$on('subChosen.change', this.subChosenChange);
|
|
|
|
|
|
bus.$on('expand.choice.only', name => {
|
|
|
bus.$emit('fold.choice.except', name);
|
...
|
...
|
|