diff --git a/pages/index/index.js b/pages/index/index.js index 4777554..ab1ac9b 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -457,7 +457,10 @@ Page({ // 保存当前筛选条件,用于验证请求结果 refreshCategory: currentCategory, refreshKeyword: currentKeyword, - refreshRegion: currentRegion + refreshRegion: currentRegion, + // 下拉刷新时确保从published状态开始加载 + isQueryingSoldOut: false, + publishedHasMore: true }) const timestamp = new Date().getTime(); @@ -956,6 +959,9 @@ Page({ const currentKeyword = this.data.searchKeyword; const cacheKey = `${currentCategory}_${currentKeyword}`; + // 下拉刷新后检查返回的商品数量,决定是否还有更多published商品 + const hasMorePublished = newGoodsOnly.length >= this.data.pageSize; + this.setData({ goods: newGoodsOnly, filteredGoods: filteredGoods, @@ -963,6 +969,11 @@ Page({ loadingMore: false, isLoading: false, page: this.data.page + 1, + // 确保下拉刷新后继续加载published状态商品 + isQueryingSoldOut: !hasMorePublished, + publishedHasMore: hasMorePublished, + // 如果切换到售空商品,重置售空商品页码 + soldOutPage: !hasMorePublished ? 1 : this.data.soldOutPage, // 更新缓存时间戳 lastDataTimestamp: new Date().getTime() })