|
|
|
@ -59,6 +59,7 @@ Page({ |
|
|
|
needPhoneAuth: false, |
|
|
|
testMode: true, |
|
|
|
partnerstatus: '', |
|
|
|
viewedGoods: [], // 已浏览商品ID列表
|
|
|
|
|
|
|
|
// 侧边栏相关
|
|
|
|
showSidebar: false, |
|
|
|
@ -329,6 +330,32 @@ Page({ |
|
|
|
}); |
|
|
|
}, |
|
|
|
|
|
|
|
// 标记商品为已浏览
|
|
|
|
markGoodsAsViewed: function(productId) { |
|
|
|
let viewedGoods = this.data.viewedGoods; |
|
|
|
if (!viewedGoods.includes(productId)) { |
|
|
|
viewedGoods.push(productId); |
|
|
|
this.setData({ viewedGoods }); |
|
|
|
} |
|
|
|
|
|
|
|
// 更新商品列表,添加已浏览标记
|
|
|
|
let updatedGoods = this.data.goods.map(item => { |
|
|
|
if (String(item.productId || item.id) === productId) { |
|
|
|
return { |
|
|
|
...item, |
|
|
|
isViewed: true |
|
|
|
}; |
|
|
|
} |
|
|
|
return item; |
|
|
|
}); |
|
|
|
|
|
|
|
this.setData({ goods: updatedGoods }, () => { |
|
|
|
// 重新应用筛选条件,确保显示的商品也更新
|
|
|
|
const filteredGoods = this.applyFilters(updatedGoods, true); |
|
|
|
this.setData({ filteredGoods }); |
|
|
|
}); |
|
|
|
}, |
|
|
|
|
|
|
|
// 跳转到我要卖蛋页面
|
|
|
|
navigateToSettlement() { |
|
|
|
wx.navigateTo({ |
|
|
|
@ -630,7 +657,9 @@ Page({ |
|
|
|
refreshRegion: currentRegion, |
|
|
|
// 下拉刷新时确保从published状态开始加载
|
|
|
|
isQueryingSoldOut: false, |
|
|
|
publishedHasMore: true |
|
|
|
publishedHasMore: true, |
|
|
|
// 清除已浏览商品标记
|
|
|
|
viewedGoods: [], |
|
|
|
}) |
|
|
|
|
|
|
|
const timestamp = new Date().getTime(); |
|
|
|
@ -2192,6 +2221,9 @@ Page({ |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
// 记录已浏览商品
|
|
|
|
this.markGoodsAsViewed(productId); |
|
|
|
|
|
|
|
// 将完整的商品数据传递给详情页,包含联系人信息,与buyer页面保持一致
|
|
|
|
// 同时传递登录状态信息,让详情页决定是否显示登录弹窗
|
|
|
|
const needLogin = this.data.needPhoneAuth; |
|
|
|
|