Authored by 肖亚东

搜索和品类筛选逻辑修改 — review by 黄敬囿

... ... @@ -15,7 +15,7 @@ Component({
},
ready: function () {
//头条列表渲染不支持字典循环,故转换成数组 2018/12/7
if (onlyTextBrand == '1') {
if (this.properties.onlyTextBrand == '1') {
let textBrandKey = [];
let textBrandData = [];
for (const iterator of Object.keys(this.properties.data)) {
... ...
... ... @@ -242,7 +242,7 @@ Page({
// }
// logEvent(YB_CATEGORY_FL,param);
tt.navigateTo({
url: '../goodsList/goodsList' + queryString
url: '../productList/index' + queryString
});
},
... ...
... ... @@ -248,7 +248,7 @@ Page(extend({}, Actionsheet,{
msort: msort,
misort: misort,
page_name: this.data.current_page_name,
sharePath: '/pages/goodsList/goodsList?union_type=' + app.globalData.user_union_type + "&" + params,
sharePath: '/pages/productList/index?union_type=' + app.globalData.user_union_type + "&" + params,
sort: this.data.sort,
categoryID: this.data.current_page_param,
}
... ...
... ... @@ -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;
... ... @@ -81,10 +90,21 @@ Page({
},
onShow: function () {
if(this.data.isRefresh){
let filter = this.data.filter;
if(filter){
for(var i = 0; i < filter.length; i++){
let filterItem = filter[i];
let itemId = filterItem.filterId;
let selectedIdParam = filterItem.selectedIdParam;
if(selectedIdParam){
this.data.filterParams[itemId] = selectedIdParam;
}
}
let current = this.data.activeIndex
let tab = this.data.tabs[current];
this.fechProductList(tab,1);
}
}
},
onTabClick: function (e) {
... ... @@ -145,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})
... ...
... ... @@ -13,7 +13,7 @@ Page({
selectedFilter = lastPageData.filter;
}
//有筛选数据使用筛选数据,没有筛选数据使用接口请求的数据
debugger
if(selectedFilter && selectedFilter.length > 0){
this.setData({
filter: selectedFilter,
... ... @@ -26,21 +26,25 @@ Page({
},
fechFilter: function(option) {
console.log('====================================');
console.log(option);
console.log('====================================');
let that = this;
let sort = option.sort;
let categoryId = option.categoryId;
let subCategoryId = option.subCategoryId;
let firstProductSkn = option.firstProductSkn;
let sort = option.sort ? option.sort : '';
let categoryId = option.categoryId ? option.categoryId : '';
let subCategoryId = option.subCategoryId ? option.subCategoryId : '';
let firstProductSkn = option.firstProductSkn ? option.firstProductSkn : '';
let query = option.query ? option.query : '';
let method = option.method ? option.method : "app.search.category.filter";
let params = {
categoryId: categoryId,
firstProductSkn: firstProductSkn,
limit: 20,
method: "app.search.category.filter",
categoryId,
firstProductSkn,
method,
query,
new_filter: 1,
// order: "",
page: 1,
sort: sort,
subCategoryId: subCategoryId,
sort,
subCategoryId,
}
api.get({data: params})
.then(data => {
... ... @@ -49,7 +53,6 @@ Page({
that.setData({
filter: newFilter,
});
});
},
... ...
{
"navigationBarTitleText": "筛选",
"usingComponents": {
"proFilter": "../../components/productFilter/proFilter",
"filter-item": "../../components/productFilter/item/filter-item",
"filter-title": "../../components/productFilter/item/filter-title"
}
}
\ No newline at end of file
... ...
... ... @@ -558,11 +558,8 @@ Page(extend({}, Actionsheet,{
},
jumpToFilterPage: function () {
let params = Object.assign({ method: 'miniapp.search.fuzzy.filter' }, this.data.keyword_param);
let storageKey = this.data.filterStorageKey;
let paramString = JSON.stringify(params);
tt.navigateTo({
url: '../goodsList/productListFilterPage?storageKey=' + storageKey + '&params=' + paramString
url: '../productListFilter/filter?storageKey=' + this.data.filterStorageKey + '&method=' + 'miniapp.search.fuzzy.filter' + '&query=' + this.data.keyword
})
},
... ...
... ... @@ -6,7 +6,7 @@ import router from './router';
const ACTION_TYPE = {
h5: 'go.h5',
goodsList: 'go.list',
productList: 'go.list',
brandStore: 'go.shop',
}
... ... @@ -63,13 +63,13 @@ export default {
this.go('webview', yohobuy);
break;
}
case ACTION_TYPE.goodsList: {
case ACTION_TYPE.productList: {
let yohobuy = {
...yoho.params,
url: yoho.params.url,
action: yoho.action
}
this.go('goodsList', yohobuy);
this.go('productList', yohobuy);
break;
}
case ACTION_TYPE.brandStore: {
... ...
... ... @@ -2,8 +2,8 @@ export default {
home: {
path: '../index/index'
},
goodsList: {
path: '../goodsList/goodsList'
productList: {
path: '../productList/index'
},
brandStore: {
path: '../goodsList/brandStore'
... ...