...
|
...
|
@@ -24,7 +24,7 @@ Page({ |
|
|
},
|
|
|
expandItem: function(e) {
|
|
|
const {idx} = e.currentTarget.dataset;
|
|
|
const sub = this.data.cateList[idx].sub;
|
|
|
const sub = this._subCate(idx);
|
|
|
|
|
|
if (!this.data.expand) {
|
|
|
this.setData({
|
...
|
...
|
@@ -47,7 +47,30 @@ Page({ |
|
|
}
|
|
|
}
|
|
|
},
|
|
|
toProductList: function() {
|
|
|
_subCate: function(idx) {
|
|
|
const parent = this.data.cateList[idx];
|
|
|
let sub = parent.sub.slice();
|
|
|
|
|
|
sub.unshift({
|
|
|
category_name: `全部${parent.category_name}`
|
|
|
});
|
|
|
return sub;
|
|
|
},
|
|
|
goAll: function() {
|
|
|
router.go('shopProductList', {title: '全部商品'});
|
|
|
},
|
|
|
goItemList: function(e) {
|
|
|
const subIdx = e.target.dataset.idx;
|
|
|
const subItem = this.data.subCateList[subIdx];
|
|
|
|
|
|
let params = {};
|
|
|
|
|
|
if (!subIdx) {
|
|
|
params.sort = this.data.cateList[this.data.expandIndex].relation_parameter.sort;
|
|
|
} else {
|
|
|
params.sort = subItem.relation_parameter.sort;
|
|
|
}
|
|
|
params.title = subItem.category_name;
|
|
|
router.go('shopProductList', params);
|
|
|
}
|
|
|
}); |
...
|
...
|
|