From c9828c33f3133c1aae133964f2abc337ac1aa0a9 Mon Sep 17 00:00:00 2001 From: Trae AI Date: Tue, 6 Jan 2026 17:39:20 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=88=86=E4=BA=AB=E6=A0=87?= =?UTF-8?q?=E9=A2=98=E5=AD=97=E6=AE=B5=E9=A1=BA=E5=BA=8F=EF=BC=9A=E5=9C=B0?= =?UTF-8?q?=E5=8C=BA=E3=80=81=E8=A7=84=E6=A0=BC=E3=80=81=E6=95=B0=E9=87=8F?= =?UTF-8?q?=E3=80=81=E8=9B=8B=E9=BB=84=E9=A2=9C=E8=89=B2=E3=80=81=E8=9B=8B?= =?UTF-8?q?=E5=A3=B3=E9=A2=9C=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/goods-detail/goods-detail.js | 45 +++++++++++------------------- 1 file changed, 17 insertions(+), 28 deletions(-) diff --git a/pages/goods-detail/goods-detail.js b/pages/goods-detail/goods-detail.js index 1ebc8bc..cf998e0 100644 --- a/pages/goods-detail/goods-detail.js +++ b/pages/goods-detail/goods-detail.js @@ -11,36 +11,32 @@ function getSourceTypeColor(sourceType) { return colorMap[sourceType] || '#4d9dff'; } -// 格式化分享标题 - 按优先级: 规格、地区、数量(鸡场直销-三方货源)、蛋黄颜色、蛋壳颜色 +// 格式化分享标题 - 按优先级: 地区、规格、数量、蛋黄颜色、蛋壳颜色 function formatShareTitle(goodsDetail) { console.log('===== formatShareTitle 开始 ====='); console.log('goodsDetail:', JSON.stringify(goodsDetail, null, 2)); const titleParts = []; - // 1. 规格 (specification/spec) - const specification = (goodsDetail.specification || goodsDetail.spec || goodsDetail.specs || '').trim(); - console.log('specification:', specification); - if (specification) { - titleParts.push(specification); - } - - // 2. 地区 (region) + // 1. 地区 (region) const region = (goodsDetail.region || '').trim(); console.log('region:', region); if (region) { titleParts.push(region); } - // 3. 数量 + (鸡场直销-三方货源) + // 2. 规格 (specification/spec) + const specification = (goodsDetail.specification || goodsDetail.spec || goodsDetail.specs || '').trim(); + console.log('specification:', specification); + if (specification) { + titleParts.push(specification); + } + + // 3. 数量 (quantity) const quantity = (goodsDetail.quantity || '').trim(); - const sourceType = (goodsDetail.sourceType || '').trim(); - console.log('quantity:', quantity, 'sourceType:', sourceType); + console.log('quantity:', quantity); if (quantity) { - const sourceLabel = sourceType ? `(${sourceType})` : ''; - titleParts.push(`${quantity}件${sourceLabel}`); - } else if (sourceType) { - titleParts.push(`(${sourceType})`); + titleParts.push(`${quantity}件`); } // 4. 蛋黄颜色 (yolk) @@ -50,18 +46,11 @@ function formatShareTitle(goodsDetail) { titleParts.push(yolk); } - // 5. 蛋壳颜色 (eggshell) - 使用品种(breed)作为备选 - const eggshell = (goodsDetail.eggshell || goodsDetail.shell || goodsDetail.breed || '').trim(); - console.log('eggshell:', eggshell); - if (eggshell) { - titleParts.push(eggshell); - } - - // 6. 货源描述 (description) - const description = (goodsDetail.description || goodsDetail.shareTitle || '').trim(); - console.log('description:', description); - if (description) { - titleParts.push(description); + // 5. 蛋壳颜色 (category) + const category = (goodsDetail.category || '').trim(); + console.log('category:', category); + if (category) { + titleParts.push(category); } // 过滤空值后组合标题