From c74b9cb8855d87118a89cafd3e42183a840b18d8 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Tue, 8 Sep 2026 17:56:38 +0800 Subject: [PATCH] =?UTF-8?q?fix(storefront):=20=E5=A4=9A=E4=BB=B7=E7=9B=AE?= =?UTF-8?q?=E4=BA=A7=E5=93=81=E6=98=BE=E7=A4=BA=E4=BB=B7=E5=B8=A6=E5=9B=A0?= =?UTF-8?q?=E5=AD=90=E8=A1=A8=E5=A4=B4(=E9=9D=9E=E7=BC=93=E5=AD=98?= =?UTF-8?q?=E8=BE=93=E5=85=A5Token/=E8=BE=93=E5=87=BAtokens/=E7=BC=93?= =?UTF-8?q?=E5=AD=98Token)+=E6=A8=A1=E5=9E=8B=E4=BA=A7=E5=93=81=E5=8E=BB?= =?UTF-8?q?=E7=AB=8B=E5=8D=B3=E8=B4=AD=E4=B9=B0=E6=8C=89=E9=92=AE=E6=94=B9?= =?UTF-8?q?=E3=80=8C=E6=8C=89=E9=87=8F=E4=BB=98=E8=B4=B9=E3=80=8D=E5=AD=97?= =?UTF-8?q?=E6=A0=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - core.py get_customer_price_display 第4步: len(prices)>1 且 label 空/按量/容量时, 段前拼 factor_label(定价YAML fields 的 label),根治裸「¥2.1 元/百万 | ¥8.4 元/百万」 客户看不懂各是什么价;单价目(存储)/产线(包月包年)行为不变 - index.ui: is_model(pipeline_llm_model/llm_model) 卡片无 binds(cursor=default, 不再弹购买框),右下角出「按量付费」文字替代立即购买按钮——purchase_realtime 只支持 account/storage/pipeline,模型消费走推理入口按量落账,购买按钮本身是坏流程 - README 补「商店展示价与卡片行为」节;验证脚本 test_storefront_model_card.py 30断言全过 --- README.md | 13 +++++++++++++ product_management/core.py | 5 +++++ wwwroot/storefront/index.ui | 17 +++++++++++++++-- 3 files changed, 33 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 1b2c0ac..e197993 100644 --- a/README.md +++ b/README.md @@ -242,6 +242,19 @@ product_use(product_id, user_id, user_org_id, used_amount, used_unit) └─ 写入 product_usage_log ``` +### 商店展示价与卡片行为(storefront) + +- **展示价唯一入口** `get_customer_price_display(product_id, user_org_id)`:显示价 = 资源真实定价 × 客户折扣率(专属折扣 → `'*'` 兜底 → 1.0;未登录按 `'*'` 报价,访客可见)。 +- **多价目必带表头**(2026-09-08):产品有多个价格因子时(如模型按量的 非缓存输入Token/输出tokens/缓存Token 三档),`pricing_text` 每段前拼 `factor_label`(来自定价 YAML fields 的 label),禁止输出裸的「¥2.1 元/百万 | ¥8.4 元/百万」让客户猜含义。单价目(如存储 元/GB月)不加表头;产线用 包月/包年 表头。 +- **卡片按钮按 product_type 分流**: + | product_type | 卡片点击 | 右下角 | + |---|---|---| + | pipeline | 进产线 open_tab(规划中→提示) | 订阅制说明 + 立即购买/进入产线 | + | workspace_storage / account | 弹 purchase_confirm 购买框 | 立即购买(未登录→登录后购买) | + | pipeline_llm_model / llm_model | **无点击行为**(cursor=default) | **「按量付费」文字,无按钮** | + + 模型产品不出购买入口的根因:`purchase_realtime` 只支持 account/storage/pipeline 三类(订阅/买断性质),模型消费走推理入口(会话/llm_v1)按用量落账,无需也无法「购买」。 + ## 目录结构 ``` diff --git a/product_management/core.py b/product_management/core.py index 538eb85..67afb88 100644 --- a/product_management/core.py +++ b/product_management/core.py @@ -1415,10 +1415,15 @@ class ProductManager: 'discount': discount, 'original_text': ''} # 4. 拼展示文本(折扣≠1 时同时给原价,让客户看见让利/加价幅度) + # 多价目产品(如模型按量:输入/输出/缓存三档 tokens 价)必须带因子表头, + # 否则客户看到裸的「¥2.1 元/百万 | ¥8.4 元/百万」不知道各是什么价 + # (2026-09-08 用户反馈)。factor_label 来自定价 YAML fields 的 label。 parts = [] orig_parts = [] for p in prices: head = p['label'] if p['label'] and p['label'] not in ('按量', '容量') else '' + if not head and len(prices) > 1: + head = p.get('factor_label') or p.get('factor') or '' seg = ('%s ' % head if head else '') + '¥%.4g %s' % ( p['amount'], p['unit_label'] or '元') parts.append(seg.strip()) diff --git a/wwwroot/storefront/index.ui b/wwwroot/storefront/index.ui index 6dc2cb5..b0c1367 100644 --- a/wwwroot/storefront/index.ui +++ b/wwwroot/storefront/index.ui @@ -56,6 +56,9 @@ {% set pricing_text = (cust or {}).get('pricing_text', '定价暂不可用') if (cust or {}).get('success') else ((cust or {}).get('message') or '定价暂不可用') %} {% set original_text = (cust or {}).get('original_text', '') %} {% set is_pipeline = (p.get('product_type') == 'pipeline') %} +{# 模型按量产品:不支持也无需「购买」(purchase_realtime 只支持 account/storage/pipeline), + 卡片不弹购买框、不出立即购买按钮,改为「按量付费」字样(2026-09-08 用户要求) #} +{% set is_model = (p.get('product_type') in ('pipeline_llm_model', 'llm_model')) %} {% set extra = {} %} {% if is_pipeline %} {# 产线订阅状态:已订阅→「进入产线」直达;未订阅→「立即购买」弹购买确认 #} @@ -73,7 +76,7 @@ "cheight": 15, "padding": "20px", "bgcolor": "#fff", - "cursor": "pointer", + "cursor": {{json.dumps('default' if is_model else 'pointer')}}, "gap": "8px" }, {% if is_pipeline %} @@ -96,7 +99,7 @@ } {% endif %} ], -{% else %} +{% elif not is_model %} "binds": [ { "wid": "self", @@ -221,6 +224,16 @@ } ] } +{% elif is_model %} + { + "widgettype": "Text", + "options": { + "text": "按量付费", + "fontSize": "13px", + "color": "#e74c3c", + "fontWeight": "600" + } + } {% elif userid %} { "widgettype": "Button",