Browse Source

修复上滑无法加载售空数据的问题

pull/11/head
徐飞洋 2 months ago
parent
commit
16a929318a
  1. 16
      pages/index/index.js

16
pages/index/index.js

@ -1063,15 +1063,11 @@ Page({
}
// 如果没有published商品,查询sold_out状态
if (page === 1) {
console.log('没有published商品,查询sold_out状态');
console.log('查询参数 - page:', page, 'pageSize:', pageSize, 'keyword:', currentKeyword, 'category:', currentCategory);
this.setData({ isQueryingSoldOut: true, soldOutPage: 1, soldOutPageSize: pageSize });
this.loadSoldOutData(cacheKey, currentKeyword, currentCategory, timestamp, isLoadMore);
return;
} else {
this.setData({ loadingMore: false, isLoading: false });
}
console.log('没有published商品,查询sold_out状态');
console.log('查询参数 - page:', page, 'pageSize:', pageSize, 'keyword:', currentKeyword, 'category:', currentCategory);
this.setData({ isQueryingSoldOut: true, soldOutPage: 1, soldOutPageSize: pageSize });
this.loadSoldOutData(cacheKey, currentKeyword, currentCategory, timestamp, isLoadMore);
return;
})
.catch(err => {
console.error('加载商品数据失败:', err);
@ -1112,7 +1108,7 @@ Page({
if (soldOutRes.success && soldOutRes.products && soldOutRes.products.length > 0) {
const soldOutTotal = soldOutRes.total || 0;
const soldOutTotalPages = soldOutRes.totalPages || Math.ceil(soldOutTotal / pageSize);
const soldOutHasMore = soldOutPageNum < soldOutTotalPages && soldOutRes.products.length >= pageSize;
const soldOutHasMore = soldOutPageNum < soldOutTotalPages;
// 更新缓存
const updatedCache = { ...this.data.categoryQueryCache };

Loading…
Cancel
Save