From c1912107eb54bf9a39313155def2305ada1b9032 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E9=A3=9E=E6=B4=8B?= <15778543+xufeiyang6017@user.noreply.gitee.com> Date: Fri, 16 Jan 2026 17:31:01 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=95=86=E5=93=81=E5=8D=A1?= =?UTF-8?q?=E7=89=87=E6=96=87=E5=AD=97=E9=81=AE=E6=8C=A1=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/index/index.js | 8 +++++ pages/index/index.wxml | 24 ++++++------- pages/index/index.wxss | 81 ++++++++++++++++++++---------------------- 3 files changed, 59 insertions(+), 54 deletions(-) diff --git a/pages/index/index.js b/pages/index/index.js index efe2e09..94b48d8 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -835,6 +835,14 @@ Page({ // 处理商品数据 - 淘宝风格 processGoodsData: function (products, isLoadMore = false) { + // 检查第一个商品是否包含description字段 + if (products.length > 0) { + console.log('商品数据包含的所有字段:', Object.keys(products[0])); + console.log('description字段是否存在:', 'description' in products[0]); + if ('description' in products[0]) { + console.log('description字段的值:', products[0].description); + } + } let newGoods = products.map(product => { const imageUrls = product.imageUrls || product.images || []; const formattedImageUrls = Array.isArray(imageUrls) ? imageUrls : [imageUrls]; diff --git a/pages/index/index.wxml b/pages/index/index.wxml index fc3cdab..9651362 100644 --- a/pages/index/index.wxml +++ b/pages/index/index.wxml @@ -274,10 +274,8 @@ autoplay="{{true}}" loop="{{true}}" muted="{{true}}" - object-fit="fill" - poster="" - style="height: 270rpx; display: block; box-sizing: border-box; width: 337rpx; position: absolute; top: 0; left: 0; right: 0; bottom: 0; z-index: 1;"> - + poster="" + > + > 预售 现货 售空 - - {{item.name}} - {{item.displaySpecification}} | {{item.displayYolk}} - - {{item.sourceType || ''}} - {{item.negotiateStatus}} + + {{item.name}} + + {{item.sourceType || ''}} + + {{item.description || ''}} + + 库存:{{item.totalStock && item.totalStock !== '充足' ? item.totalStock + '件' : (item.totalStock || '充足')}} 已售:{{item.originalTotalStock || 0}}件 - 已有{{item.frequency || 0}}人浏览 + 已有{{item.frequency || 0}}人浏览 {{item.region || ''}} diff --git a/pages/index/index.wxss b/pages/index/index.wxss index 23a46b4..bc453cb 100644 --- a/pages/index/index.wxss +++ b/pages/index/index.wxss @@ -1643,13 +1643,14 @@ wx-button:not([size=mini]) { .product-image-wrapper { position: relative; width: 100%; - height: 320rpx; /* 固定图片高度 */ + height: 320rpx; background: #f5f5f5; border-radius: 16rpx 16rpx 0 0; overflow: hidden; } -.product-image { +/* 统一媒体元素样式 */ +.product-media { width: 100%; height: 100%; display: block; @@ -1660,7 +1661,8 @@ wx-button:not([size=mini]) { /* 视频样式增强 */ video.product-media { - object-fit: fill; + object-fit: cover; + z-index: 1; } @@ -1739,10 +1741,13 @@ video.product-media { /* 商品信息区域 */ .product-info { padding: 16rpx; - height: 210rpx; /* 固定信息区域高度 (600 - 350 - 40 = 210) */ + height: auto; + min-height: 210rpx; display: flex; flex-direction: column; - justify-content: space-between; /* 内容均匀分布 */ + justify-content: space-between; + gap: 10rpx; + box-sizing: border-box; } /* 商品标题 */ @@ -1750,70 +1755,62 @@ video.product-media { font-size: 26rpx; color: #000000; line-height: 1.4; - height: 72rpx; /* 固定标题高度 */ + height: 72rpx; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; - margin-bottom: 8rpx; font-weight: 700; } -/* 商品规格 */ -.product-spec { +/* 商品描述 */ +.product-description { font-size: 22rpx; - color: #333333; - height: 32rpx; /* 固定规格高度 */ + color: #666; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; - margin-bottom: 10rpx; - line-height: 1.3; + flex: 1; } -/* 价格区域 - 淘宝风格突出显示 */ -.product-price-row { - height: 48rpx; /* 固定价格区域高度 */ - margin-bottom: 8rpx; +/* 商品状态行 */ +.product-status-row { display: flex; - align-items: baseline; - justify-content: space-between; + align-items: center; + gap: 8rpx; + flex-wrap: wrap; } -.price-wrapper { +/* 商品库存行 */ +.product-stock-row { display: flex; - align-items: baseline; -} - -.price-unit { - font-size: 24rpx; - color: #ff4d4f; - font-weight: 700; -} - -.price-value { - font-size: 40rpx; - color: #ff4d4f; - font-weight: 800; - margin: 0 2rpx; - letter-spacing: 1rpx; -} - -.price-unit:last-child { - margin-left: 4rpx; - font-size: 22rpx; - color: #ff4d4f; + align-items: center; } /* 销量和地区 - 淘宝风格 */ .product-meta { - height: 32rpx; /* 固定元信息高度 */ display: flex; justify-content: space-between; align-items: center; font-size: 22rpx; color: #999; + margin-top: 8rpx; +} + +/* 商品卡片 */ +.product-card { + width: 100%; + height: auto; + min-height: 450rpx; + background: #fff; + border-radius: 16rpx; + overflow: hidden; + box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.08); + transition: all 0.3s ease; + display: flex; + flex-direction: column; + position: relative; } .sales-count {