...
|
...
|
@@ -48,19 +48,28 @@ Page({ |
|
|
},
|
|
|
onLoad: function (option) {
|
|
|
try{
|
|
|
console.log('====================================');
|
|
|
console.log(option);
|
|
|
console.log('====================================');
|
|
|
if(option){
|
|
|
let categoryId = option.categoryId;
|
|
|
let firstProductSkn = option.firstProductSkn;
|
|
|
// let navigate = option.navigate;
|
|
|
let sort = option.sort;
|
|
|
let subCategoryId = option.subCategoryId;
|
|
|
let title = option.title;
|
|
|
let firstProductSkn = option.firstProductSkn ? option.firstProductSkn : '';
|
|
|
let sort = option.sort ? option.sort : '';
|
|
|
let subCategoryId = option.subCategoryId ? option.subCategoryId : '';
|
|
|
let title = option.title ? option.title : '';
|
|
|
let gender = option.gender ? option.gender : '';
|
|
|
console.log("categoryId:"+categoryId+"==subCategoryId:"+subCategoryId+"==sort:"+sort+"==firstProductSkn:"+firstProductSkn);
|
|
|
|
|
|
this.data.categoryId = option.categoryId;
|
|
|
this.data.subCategoryId = option.subCategoryId;
|
|
|
this.data.sort = option.sort;
|
|
|
this.data.firstProductSkn = option.firstProductSkn;
|
|
|
this.data.categoryId = categoryId;
|
|
|
this.data.subCategoryId = subCategoryId;
|
|
|
this.data.sort = sort;
|
|
|
this.data.firstProductSkn = firstProductSkn;
|
|
|
this.data.title = title;
|
|
|
this.data.gender = gender;
|
|
|
|
|
|
tt.setNavigationBarTitle({
|
|
|
title: title
|
|
|
});
|
|
|
}
|
|
|
let systemInfo = tt.getSystemInfoSync();
|
|
|
let contentWidth = systemInfo.screenWidth;
|
...
|
...
|
@@ -77,7 +86,7 @@ Page({ |
|
|
let tab = this.data.tabs[0];
|
|
|
// let filterParams = this.data.filterParams;
|
|
|
this.fechProductList(tab,1);
|
|
|
this.fechFilter();
|
|
|
// this.fechFilter();
|
|
|
},
|
|
|
onShow: function () {
|
|
|
if(this.data.isRefresh){
|
...
|
...
|
@@ -95,7 +104,6 @@ Page({ |
|
|
let tab = this.data.tabs[current];
|
|
|
this.fechProductList(tab,1);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
},
|
|
|
onTabClick: function (e) {
|
...
|
...
|
@@ -119,7 +127,6 @@ Page({ |
|
|
if(tabData && tabData.page){
|
|
|
page = tabData.page;
|
|
|
}
|
|
|
// let filterParams = {};
|
|
|
this.fechProductList(tab,page);
|
|
|
}
|
|
|
|
...
|
...
|
@@ -130,7 +137,6 @@ Page({ |
|
|
let orderType = tab.iconType;
|
|
|
let iconUrl = tab.iconUrl;
|
|
|
let order = "s_p_desc";
|
|
|
// console.log("id:"+id+"===orderType:"+orderType);
|
|
|
|
|
|
//设置是否显示加载中
|
|
|
let thatTabs = this.data.tabs;
|
...
|
...
|
@@ -159,16 +165,18 @@ Page({ |
|
|
let categoryId = that.data.categoryId;
|
|
|
let subCategoryId = that.data.subCategoryId;
|
|
|
let firstProductSkn = that.data.firstProductSkn;
|
|
|
let title = that.data.title;
|
|
|
let gender = that.data.gender;
|
|
|
let param = {
|
|
|
method: "app.search.category",
|
|
|
firstProductSkn: firstProductSkn,
|
|
|
gender:"1,3",
|
|
|
limit: 10,
|
|
|
gender,
|
|
|
limit: 60,
|
|
|
page: currentPage,
|
|
|
sort: sort,
|
|
|
subCategoryId: subCategoryId,
|
|
|
title: "POLO",
|
|
|
order: order,
|
|
|
categoryId,
|
|
|
subCategoryId,
|
|
|
title
|
|
|
}
|
|
|
let params = Object.assign(filterParams, param);
|
|
|
api.get({data: params})
|
...
|
...
|
@@ -219,126 +227,4 @@ Page({ |
|
|
}
|
|
|
|
|
|
},
|
|
|
fechFilter: function() {
|
|
|
let that = this;
|
|
|
let sort = that.data.sort;
|
|
|
let categoryId = that.data.categoryId;
|
|
|
let subCategoryId = that.data.subCategoryId;
|
|
|
let firstProductSkn = that.data.firstProductSkn;
|
|
|
let params = {
|
|
|
categoryId: categoryId,
|
|
|
firstProductSkn: firstProductSkn,
|
|
|
limit: 20,
|
|
|
method: "app.search.category.filter",
|
|
|
new_filter: 1,
|
|
|
// order: "",
|
|
|
page: 1,
|
|
|
sort: sort,
|
|
|
subCategoryId: subCategoryId,
|
|
|
}
|
|
|
api.get({data: params})
|
|
|
.then(data => {
|
|
|
let filter = data.data.filter;
|
|
|
let newFilter = this.parseFilter(filter);
|
|
|
that.setData({
|
|
|
filter: newFilter,
|
|
|
});
|
|
|
|
|
|
});
|
|
|
|
|
|
},
|
|
|
parseFilter: function (filter){
|
|
|
let newFilter = [];
|
|
|
for(var i = 0; i < filter.length; i++){
|
|
|
let itemList = filter[i].itemList;
|
|
|
// let newItemList = [];
|
|
|
for(var j = 0; j < itemList.length; j++){
|
|
|
let item = itemList[j];
|
|
|
let columnIndex = j % 3;
|
|
|
item.columnIndex = columnIndex;
|
|
|
item.subItemIndex = j;
|
|
|
item.itemIndex = i;
|
|
|
// newItemList.push(item)
|
|
|
}
|
|
|
// newFilter.push(newItemList);
|
|
|
}
|
|
|
|
|
|
let new_filter = filter;
|
|
|
return new_filter
|
|
|
},
|
|
|
onItemClick: function(e) {
|
|
|
let subItem = e.detail;
|
|
|
if(subItem){
|
|
|
let subItemIndex = subItem.subItemIndex;
|
|
|
let itemIndex = subItem.itemIndex;
|
|
|
let itemId = subItem.itemId;
|
|
|
let itemName = subItem.itemName;
|
|
|
let itemIsSelected = subItem.isSelected;
|
|
|
|
|
|
|
|
|
let filter = this.data.filter;
|
|
|
let itemInfo = filter[itemIndex];
|
|
|
//已经选择的信息。默认为undefind
|
|
|
let itemSelectedName = itemInfo.selectedName;
|
|
|
let itemSelectedId = itemInfo.selectedId;
|
|
|
|
|
|
//当前选择的信息
|
|
|
let currentSelectedName = subItem.itemName+",";
|
|
|
let currentSelectedId = subItem.itemId+",";
|
|
|
|
|
|
//即将选择的信息
|
|
|
let futureSelectedId = "";
|
|
|
let futureSelectedName = "";
|
|
|
//已经有选择项
|
|
|
if(itemSelectedId) {
|
|
|
//取消该选择项
|
|
|
if(!itemIsSelected) {
|
|
|
futureSelectedId = itemSelectedId.replace(currentSelectedId,"");
|
|
|
futureSelectedName = itemSelectedName.replace(currentSelectedName,"");
|
|
|
}else {//添加该选项
|
|
|
futureSelectedId = itemSelectedId+currentSelectedId;
|
|
|
futureSelectedName = itemSelectedName+currentSelectedName;
|
|
|
}
|
|
|
}else {
|
|
|
futureSelectedId = currentSelectedId;
|
|
|
futureSelectedName = currentSelectedName;
|
|
|
}
|
|
|
console.log("itemIsSelected:"+itemIsSelected+"==futureSelectedId:"+futureSelectedId)
|
|
|
|
|
|
itemInfo.itemList[subItemIndex] = subItem;
|
|
|
itemInfo.selectedName = futureSelectedName;
|
|
|
itemInfo.selectedId = futureSelectedId;
|
|
|
//用于搜索
|
|
|
itemInfo.selectedIdParam = futureSelectedId.substring(0, futureSelectedId.lastIndexOf(','));
|
|
|
//用于显示
|
|
|
itemInfo.selectedNameStr = futureSelectedName.substring(0, futureSelectedName.lastIndexOf(','));
|
|
|
|
|
|
filter[itemIndex] = itemInfo;
|
|
|
this.setData({
|
|
|
filter: filter,
|
|
|
});
|
|
|
|
|
|
|
|
|
console.log(itemId)
|
|
|
}
|
|
|
|
|
|
|
|
|
},
|
|
|
onShowItem: function(e) {
|
|
|
let detail = e.detail;
|
|
|
console.log("itemIndex:"+itemIndex);
|
|
|
let itemIndex = detail.itemIndex;
|
|
|
let filter = this.data.filter;
|
|
|
let itemInfo = filter[itemIndex];
|
|
|
let isShowItem = itemInfo.isShowItem;
|
|
|
if(isShowItem){
|
|
|
itemInfo.isShowItem = false;
|
|
|
}else {
|
|
|
itemInfo.isShowItem = true;
|
|
|
}
|
|
|
this.setData({
|
|
|
filter: filter,
|
|
|
});
|
|
|
},
|
|
|
|
|
|
}) |
|
|
\ No newline at end of file |
...
|
...
|
|