From f9068b47d4e3bc24f9c836ea5e839e05b4736eaf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E9=A3=9E=E6=B4=8B?= <15778543+xufeiyang6017@user.noreply.gitee.com> Date: Fri, 9 Jan 2026 13:02:37 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=BB=98=E8=AE=A4=E7=AD=9B?= =?UTF-8?q?=E9=80=89=E4=B8=8B=E5=9C=A8=E5=94=AE=E5=95=86=E5=93=81=E5=87=BA?= =?UTF-8?q?=E7=8E=B0=E5=9C=A8=E5=94=AE=E7=A9=BA=E5=95=86=E5=93=81=E4=B9=8B?= =?UTF-8?q?=E5=90=8E=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/index/index.js | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/pages/index/index.js b/pages/index/index.js index b021e00..d606077 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -431,7 +431,7 @@ Page({ }) }, - onRefresh: function (showToast = true) { + onRefresh: function () { if (this.data.isRefreshing) { return } @@ -482,13 +482,11 @@ Page({ if (res.success && res.products) { this.processRefreshData(res.products, existingGoods) - if (showToast) { - wx.showToast({ - title: '刷新成功', - icon: 'success', - duration: 1500 - }) - } + wx.showToast({ + title: '刷新成功', + icon: 'success', + duration: 1500 + }) } else if (res.products.length === 0) { // 如果published状态没有商品,则查询sold_out状态 console.log('没有published状态的商品,查询sold_out状态的商品'); @@ -509,13 +507,11 @@ Page({ if (soldOutRes.success && soldOutRes.products && soldOutRes.products.length > 0) { this.processRefreshData(soldOutRes.products, existingGoods); - if (showToast) { - wx.showToast({ - title: '刷新成功', - icon: 'success', - duration: 1500 - }); - } + wx.showToast({ + title: '刷新成功', + icon: 'success', + duration: 1500 + }); } else { this.setData({ isLoading: false, @@ -1587,7 +1583,7 @@ Page({ if (filteredGoods.length < 3 && this.data.searchKeyword) { console.log('searchGoods - 本地过滤结果不足3个,将重新加载数据'); // 调用下拉刷新函数实现自动刷新 - this.onRefresh(false); + this.onRefresh(); } else { // 本地商品足够,直接使用本地过滤结果 console.log('searchGoods:使用本地商品过滤结果,数量:', filteredGoods.length);