|
|
|
@ -930,7 +930,8 @@ Page({ |
|
|
|
|
|
|
|
// 加载商品数据 - 优化版带缓存,支持状态优先级
|
|
|
|
loadGoods: function (isLoadMore = false, forceRefresh = false) { |
|
|
|
if (isLoadMore && !this.data.hasMoreData) { |
|
|
|
// 当正在加载售空商品时,即使hasMoreData为false也继续加载
|
|
|
|
if (isLoadMore && !this.data.hasMoreData && !this.data.isQueryingSoldOut) { |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
@ -946,7 +947,7 @@ Page({ |
|
|
|
|
|
|
|
// 如果正在加载sold_out,继续加载sold_out
|
|
|
|
if (isLoadMore && this.data.isQueryingSoldOut) { |
|
|
|
this.loadSoldOutData(cacheKey, currentKeyword, currentCategory, timestamp, true); |
|
|
|
this.loadSoldOutData(cacheKey, currentKeyword, currentCategory, timestamp, isLoadMore); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
@ -1021,7 +1022,7 @@ Page({ |
|
|
|
} |
|
|
|
|
|
|
|
this.setData({ |
|
|
|
hasMoreData: publishedHasMore || true, // 当切换到加载售空商品时,保持hasMoreData为true以允许继续加载
|
|
|
|
hasMoreData: true, // 保持hasMoreData为true,以便在已发布商品加载完毕后继续加载售空商品
|
|
|
|
isQueryingSoldOut: !publishedHasMore, // 当已发布商品加载完毕时,切换到加载售空商品
|
|
|
|
publishedHasMore: publishedHasMore, |
|
|
|
categoryQueryCache: updatedCache, |
|
|
|
@ -1102,7 +1103,7 @@ Page({ |
|
|
|
goodsCache: updatedCache[cacheKey] |
|
|
|
}); |
|
|
|
|
|
|
|
this.processGoodsData(updatedCache[cacheKey], isLoadMore); |
|
|
|
this.processGoodsData(uniqueSoldOutProducts, isLoadMore); |
|
|
|
console.log('sold_out数据加载完成,总商品数:', updatedCache[cacheKey].length, 'hasMoreData:', soldOutHasMore); |
|
|
|
} else { |
|
|
|
console.log('没有找到更多sold_out商品'); |
|
|
|
|