From 26f99a60e9ee814d6f3bd54c0ce99c0d8ad69345 Mon Sep 17 00:00:00 2001 From: Trae AI Date: Sat, 17 Jan 2026 11:30:11 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=95=86=E5=93=81=E5=8D=A1?= =?UTF-8?q?=E7=89=87=E5=B8=83=E5=B1=80=E5=92=8C=E6=B5=8F=E8=A7=88=E8=AE=B0?= =?UTF-8?q?=E5=BD=95=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/index/index.js | 34 ++++++++++++++++++++++++++++- pages/index/index.wxml | 9 ++++---- pages/index/index.wxss | 49 ++++++++++++++++++++++++++---------------- 3 files changed, 67 insertions(+), 25 deletions(-) diff --git a/pages/index/index.js b/pages/index/index.js index 94b48d8..d1c65fc 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -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; diff --git a/pages/index/index.wxml b/pages/index/index.wxml index 9651362..6fbb427 100644 --- a/pages/index/index.wxml +++ b/pages/index/index.wxml @@ -291,11 +291,10 @@ 售空 - {{item.name}} - - {{item.sourceType || ''}} - - {{item.description || ''}} + + {{item.sourceType || ''}} + {{item.name}} + {{item.description || ''}} 库存:{{item.totalStock && item.totalStock !== '充足' ? item.totalStock + '件' : (item.totalStock || '充足')}} diff --git a/pages/index/index.wxss b/pages/index/index.wxss index bc453cb..6b52e24 100644 --- a/pages/index/index.wxss +++ b/pages/index/index.wxss @@ -1750,36 +1750,42 @@ video.product-media { box-sizing: border-box; } +/* 第一行布局:货源类型 | 产品名称 | 货源描述 */ +.product-first-row { + display: block; + width: 100%; + line-height: 1.4; +} + /* 商品标题 */ .product-title { font-size: 26rpx; color: #000000; - line-height: 1.4; - height: 72rpx; - overflow: hidden; - text-overflow: ellipsis; - display: -webkit-box; - -webkit-line-clamp: 2; - -webkit-box-orient: vertical; font-weight: 700; + display: inline; + margin-right: 8rpx; } /* 商品描述 */ .product-description { - font-size: 22rpx; - color: #666; - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; - flex: 1; + font-size: 26rpx; + color: #000000; + font-weight: 700; + display: inline; + word-break: break-word; } -/* 商品状态行 */ -.product-status-row { - display: flex; - align-items: center; - gap: 8rpx; - flex-wrap: wrap; +/* 状态标签样式 */ +.status-tag { + display: inline; + margin-right: 8rpx; +} + +/* 已浏览商品样式 */ +.product-title.viewed, +.product-description.viewed { + color: #999999; + opacity: 0.8; } /* 商品库存行 */ @@ -1798,6 +1804,11 @@ video.product-media { margin-top: 8rpx; } +/* 移除旧的产品状态行样式 */ +.product-status-row { + display: none; +} + /* 商品卡片 */ .product-card { width: 100%; -- 2.30.2