From f202d44b5b3201014f974108c3b5dc41b62cc8b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E5=BF=A0=E6=9E=97?= <170083662@qq.com> Date: Fri, 3 Jul 2026 16:47:45 +0800 Subject: [PATCH] =?UTF-8?q?fix(sku-selector):=20=E4=BF=AE=E6=AD=A3?= =?UTF-8?q?=E4=BB=B7=E6=A0=BC=E5=AD=97=E6=AE=B5=E9=80=BB=E8=BE=91=E5=8C=BA?= =?UTF-8?q?=E5=88=86=E5=88=B0=E6=89=8B=E4=BB=B7=E5=92=8C=E5=B8=82=E5=9C=BA?= =?UTF-8?q?=E4=BB=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 调整 fakeSku 中 price 和 salePrice 字段赋值,price 为实际到手价,salePrice 为划掉的市场价 - 更新 currentPrice 计算逻辑,优先显示实际到手价,避免弹窗误将市场价作为售价 - 添加注释说明价格字段的约定,明确 price 和 salePrice 的含义及使用场景 --- src/components/business/SkuSelector/index.tsx | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/components/business/SkuSelector/index.tsx b/src/components/business/SkuSelector/index.tsx index adbd7d8..7fdfe3c 100644 --- a/src/components/business/SkuSelector/index.tsx +++ b/src/components/business/SkuSelector/index.tsx @@ -157,8 +157,9 @@ const SkuSelector: React.FC = ({ const fakeSku: ShopGoodsSku = { id: 0, goodsId: product.goodsId!, - price: product.salePrice || product.price, - salePrice: product.salePrice || product.price, + // price 字段是到手价(主价格),salePrice 是划掉的"市场价" + price: product.price, + salePrice: product.salePrice, stock: product.stock, image: product.image, } @@ -187,7 +188,11 @@ const SkuSelector: React.FC = ({ } } - const currentPrice = selectedSku?.salePrice || selectedSku?.price || product?.salePrice || product?.price || '0' + // 价格字段约定: + // - product.salePrice / sku.salePrice : 划掉的"市场价" + // - product.price / sku.price : 实际"到手价"(详情页主价格) + // 弹窗应展示到手价,避免误把市场价当成售价 + const currentPrice = selectedSku?.price || product?.price || selectedSku?.salePrice || product?.salePrice || '0' const currentStock = selectedSku?.stock ?? product?.stock ?? 0 const currentImage = selectedSku?.image || product?.image || (product?.files?.split(',')[0]) || ''