|
|
|
@ -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 |
|
|
|
}) |
|
|
|
} |
|
|
|
} 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 |
|
|
|
}); |
|
|
|
} |
|
|
|
} 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); |
|
|
|
|