diff --git a/wx-mini-program/pages/hotGoods/hotGoods.js b/wx-mini-program/pages/hotGoods/hotGoods.js index 2405b9f..2d59867 100644 --- a/wx-mini-program/pages/hotGoods/hotGoods.js +++ b/wx-mini-program/pages/hotGoods/hotGoods.js @@ -15,6 +15,7 @@ Page({ currentSortType: 'default', currentSort: 'browse', currentSortOrder: 'desc', + isSearch: true, page: 1, size: 10, totalPages: 1 @@ -47,9 +48,10 @@ Page({ .then(function(res) { if (res.errno === 0) { that.setData({ - goodsList: that.data.goodsList.concat(res.data.goodsList), + goodsList: that.data.isSearch ? res.data.goodsList : that.data.goodsList.concat(res.data.goodsList), filterCategory: res.data.filterCategoryList, - totalPages: res.data.totalPages + totalPages: res.data.totalPages, + isSearch: false }); } }); @@ -83,7 +85,8 @@ Page({ categoryFilter: !this.data.categoryFilter, currentSortType: 'category', currentSort: 'add_time', - currentSortOrder: 'desc' + currentSortOrder: 'desc', + isSearch: true }); break; case 'priceSort': @@ -94,7 +97,8 @@ Page({ currentSortType: 'price', currentSort: 'retail_price', currentSortOrder: tmpSortOrder, - categoryFilter: false + categoryFilter: false, + isSearch: true }); this.getGoodsList(); @@ -107,7 +111,8 @@ Page({ currentSortType: 'sales', currentSort: 'sales', currentSortOrder: tmpSortOrder, - categoryFilter: false + categoryFilter: false, + isSearch: true }); this.getGoodsList(); break; @@ -118,6 +123,7 @@ Page({ currentSort: 'add_time', currentSortOrder: 'desc', categoryFilter: false, + isSearch: true, categoryId: 0, }); this.getGoodsList(); diff --git a/wx-mini-program/pages/newGoods/newGoods.js b/wx-mini-program/pages/newGoods/newGoods.js index dc8c4a2..62d5f10 100644 --- a/wx-mini-program/pages/newGoods/newGoods.js +++ b/wx-mini-program/pages/newGoods/newGoods.js @@ -15,6 +15,7 @@ Page({ currentSortType: 'default', currentSort: 'add_time', currentSortOrder: 'desc', + isSearch: true, page: 1, size: 10, totalPages: 1 @@ -33,9 +34,10 @@ Page({ .then(function(res) { if (res.errno === 0) { that.setData({ - goodsList: that.data.goodsList.concat(res.data.goodsList), + goodsList: that.data.isSearch ? res.data.goodsList : that.data.goodsList.concat(res.data.goodsList), filterCategory: res.data.filterCategoryList, - totalPages: res.data.totalPages + totalPages: res.data.totalPages, + isSearch: false }); } }); @@ -68,7 +70,8 @@ Page({ categoryFilter: !this.data.categoryFilter, currentSortType: 'category', currentSort: 'add_time', - currentSortOrder: 'desc' + currentSortOrder: 'desc', + isSearch: true }); break; case 'priceSort': @@ -79,7 +82,8 @@ Page({ currentSortType: 'price', currentSort: 'retail_price', currentSortOrder: tmpSortOrder, - categoryFilter: false + categoryFilter: false, + isSearch: true }); this.getGoodsList(); @@ -92,7 +96,8 @@ Page({ currentSortType: 'sales', currentSort: 'sales', currentSortOrder: tmpSortOrder, - categoryFilter: false + categoryFilter: false, + isSearch: true }); this.getGoodsList(); break; @@ -103,7 +108,8 @@ Page({ currentSort: 'add_time', currentSortOrder: 'desc', categoryFilter: false, - categoryId: 0 + categoryId: 0, + isSearch: true }); this.getGoodsList(); }