Authored by huangyCode

删除冗余代码

... ... @@ -65,20 +65,11 @@ export default {
};
},
activated() {
let params = this.$route.query;
let params = {...this.$route.query};
if (this.yoho.direction === 'forword') {
Object.assign(this.$data, this.$options.data());
}
if (Object.keys(params).length && params.listType) {
this.listType = params.listType;
delete params.listType;
}
if (Object.keys(params).length && params.type) {
this.type = params.type;
} else {
params.type = 6;
}
!params.order && (params.order = 'sale_desc');
this.fetchData(params);
},
... ...
... ... @@ -57,11 +57,9 @@ export default {
pullUpLoad: true
},
fixed: false,
selectedType: 2,
selectedType: 2, // tab类型高亮
priceDesc: true,
arrowImage: '',
listType: 1,
type: 6,
title: '',
productList: {
showErrorPage: false,
... ... @@ -98,7 +96,7 @@ export default {
Object.assign(this.$data, this.$options.data());
}
this.changeArrow();
let params = this.$route.query;
let params = {...this.$route.query};
if (params.title) {
this.title = params.title;
... ... @@ -106,13 +104,6 @@ export default {
} else {
this.title = '商品列表';
}
if (Object.keys(params).length && params.listType) {
this.listType = params.listType;
delete params.listType;
}
if (Object.keys(params).length && params.type) {
this.type = params.type;
}
!params.order && (params.order = 'sale_desc');
this.fetchList({...params, isReset: true});
},
... ... @@ -183,37 +174,31 @@ export default {
}
},
// 点击tab type, 0: 推荐, 1: 价格, 2: 人气, 3: 新品
pressType(type) {
if (type === this.selectedType && type !== 1) {
// 点击tab flag, 0: 推荐, 1: 价格, 2: 人气, 3: 新品
pressType(flag) {
if (flag === this.selectedType && flag !== 1) {
return;
}
let filterParams = this.$refs.filtrate.getParams();
let {sort} = this.searchParams;
let params = {
type: this.type,
sort: filterParams.sort.join(',') || sort,
brand: filterParams.brand.join(','), // 品牌id
gender: filterParams.gender.join(','), // 性别
size: filterParams.size.join(','), // 尺码id
};
if (this.listType === 4) {
delete params.type;
}
this.selectedType = type;
if (type === 1) {
this.selectedType = flag;
if (flag === 1) {
this.priceDesc = !this.priceDesc;
params.order = this.priceDesc ? 'p_desc' : 'p_asc';
} else if (type === 2) {
} else if (flag === 2) {
this.priceDesc = true;
params.order = 'sale_desc';
} else if (type === 3) {
} else if (flag === 3) {
this.priceDesc = true;
params.order = 'st_desc';
}
params.listType = this.listType;
params.isReset = true;
this.fetchList(params);
this.changeArrow();
... ...