From 18778a73744fd5d534813017ab956742c6bda271 Mon Sep 17 00:00:00 2001 From: chenbo <623659388@qq.com> Date: Fri, 14 May 2021 17:17:22 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=93=81=E9=A6=96=E4=BB=98=E4=B8=8E?= =?UTF-8?q?=E4=BA=BA=E6=B0=94=E6=8E=A8=E8=8D=90=E7=9A=84=E4=BB=B7=E6=A0=BC?= =?UTF-8?q?=E6=8E=92=E5=BA=8F=E4=B8=8E=E9=94=80=E9=87=8F=E6=8E=92=E5=BA=8F?= =?UTF-8?q?=E6=90=9C=E7=B4=A2=E5=AF=BC=E8=87=B4=E7=9A=84=E5=95=86=E5=93=81?= =?UTF-8?q?=E9=87=8D=E5=A4=8D=E5=87=BA=E7=8E=B0=E7=9A=84bug=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- wx-mini-program/pages/hotGoods/hotGoods.js | 16 +++++++++++----- wx-mini-program/pages/newGoods/newGoods.js | 18 ++++++++++++------ 2 files changed, 23 insertions(+), 11 deletions(-) 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(); }