diff --git a/README.md b/README.md index e197993..47f7c5b 100644 --- a/README.md +++ b/README.md @@ -245,6 +245,7 @@ product_use(product_id, user_id, user_org_id, used_amount, used_unit) ### 商店展示价与卡片行为(storefront) - **展示价唯一入口** `get_customer_price_display(product_id, user_org_id)`:显示价 = 资源真实定价 × 客户折扣率(专属折扣 → `'*'` 兜底 → 1.0;未登录按 `'*'` 报价,访客可见)。 +- **原价仅让利时显示**(2026-09-08):折扣 <1 才输出 `original_text` 原价划线;折扣 ≥1(无折扣/加价,如存储 1.5、产线 1.0)不显示原价——加价时「原价」低于现价还划线是误导。展示页(core.py)与购买页(purchase_confirm.dspy 服务端初始价 + 前端 JS 刷新脚本)三处同规则。 - **多价目必带表头**(2026-09-08):产品有多个价格因子时(如模型按量的 非缓存输入Token/输出tokens/缓存Token 三档),`pricing_text` 每段前拼 `factor_label`(来自定价 YAML fields 的 label),禁止输出裸的「¥2.1 元/百万 | ¥8.4 元/百万」让客户猜含义。单价目(如存储 元/GB月)不加表头;产线用 包月/包年 表头。 - **卡片按钮按 product_type 分流**: | product_type | 卡片点击 | 右下角 | diff --git a/product_management/core.py b/product_management/core.py index 67afb88..4c46e8b 100644 --- a/product_management/core.py +++ b/product_management/core.py @@ -1414,7 +1414,9 @@ class ProductManager: 'prices': [], 'pricing_text': '未配置定价', 'discount': discount, 'original_text': ''} - # 4. 拼展示文本(折扣≠1 时同时给原价,让客户看见让利/加价幅度) + # 4. 拼展示文本(仅折扣<1 让利时给原价划线,让客户看见优惠幅度; + # 折扣≥1(无折扣/加价)不显示原价——2026-09-08 用户定夺:加价时 + # 「原价」低于现价还划线展示是误导,产线展示页/购买页同规则) # 多价目产品(如模型按量:输入/输出/缓存三档 tokens 价)必须带因子表头, # 否则客户看到裸的「¥2.1 元/百万 | ¥8.4 元/百万」不知道各是什么价 # (2026-09-08 用户反馈)。factor_label 来自定价 YAML fields 的 label。 @@ -1427,7 +1429,7 @@ class ProductManager: seg = ('%s ' % head if head else '') + '¥%.4g %s' % ( p['amount'], p['unit_label'] or '元') parts.append(seg.strip()) - if abs(discount - 1.0) > 1e-9: + if discount < 1.0 - 1e-9: orig_parts.append('%.4g' % p['original_price']) pricing_text = ' | '.join(parts) diff --git a/wwwroot/storefront/api/purchase_confirm.dspy b/wwwroot/storefront/api/purchase_confirm.dspy index b713058..4c35f60 100644 --- a/wwwroot/storefront/api/purchase_confirm.dspy +++ b/wwwroot/storefront/api/purchase_confirm.dspy @@ -70,7 +70,9 @@ else: _orig = float(_c.get('original_amount', 0) or 0) _disc = float(_c.get('discount', 1.0) or 1.0) init_price_text = '应付金额:¥ %.2f' % _amt - if abs(_disc - 1.0) > 1e-9: + # 仅让利(折扣<1)显示原价;折扣≥1 不显示(2026-09-08 用户定夺, + # 与展示页 get_customer_price_display 同规则) + if _disc < 1.0 - 1e-9: init_price_text += '(原价 ¥ %.2f × 折扣 %.4g)' % (_orig, _disc) else: init_price_text = '算价失败:%s' % ((_c or {}).get('message', '') or '未知')[:80] @@ -117,7 +119,7 @@ else: "{method:'POST',body:params}).then(function(r){return r.json()}).then(function(d){" " var t=bricks.getWidgetById('buy_price_text',bricks.app); if(!t)return;" " if(d.success){var s='应付金额:¥ '+(Math.round(d.amount*100)/100).toFixed(2);" - " if(Math.abs((d.discount||1)-1)>1e-9){" + " if((d.discount||1)<1-1e-9){" " s+='(原价 ¥ '+(Math.round(d.original_amount*100)/100).toFixed(2)" " +' × 折扣 '+d.discount+')';}" " t.set_text(s);t.dom_element.style.color='#e74c3c';"