From d49790d12686c807f9884ac117e40047f10bd003 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Fri, 18 Sep 2026 16:45:27 +0800 Subject: [PATCH] =?UTF-8?q?fix(storefront):=20=E8=AE=A9=E5=88=A9=E5=8E=9F?= =?UTF-8?q?=E4=BB=B7=E5=B9=B6=E5=85=A5=E4=BB=B7=E6=A0=BC=E5=8D=95=E5=85=83?= =?UTF-8?q?=E6=A0=BC(HBox=E5=B9=B6=E6=8E=92=E7=BA=A2=E4=BB=B7+=E5=88=92?= =?UTF-8?q?=E7=BA=BF=E5=8E=9F=E4=BB=B7)=E2=80=94=E2=80=94=E7=8B=AC?= =?UTF-8?q?=E7=AB=8B=E5=88=97=E8=87=B4=E8=A1=8C=E6=A0=BC=E6=95=B0=E2=89=A0?= =?UTF-8?q?=E8=A1=A8=E5=A4=B4=E5=88=97=E6=95=B0=E9=94=99=E4=BD=8D(2026-09-?= =?UTF-8?q?18=E5=AE=9E=E6=B5=8B);Jinja=E7=9C=9F=E6=B8=B2=E6=9F=93=E9=AA=8C?= =?UTF-8?q?row=5Fcells=3D2=E5=AF=B9=E9=BD=90+orig=E5=88=92=E7=BA=BF?= =?UTF-8?q?=E5=9C=A8=E6=A0=BC=E5=86=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- product_management/core.py | 9 ++++++--- wwwroot/storefront/index.ui | 9 ++++++++- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/product_management/core.py b/product_management/core.py index bf0f7f2..40a2a42 100644 --- a/product_management/core.py +++ b/product_management/core.py @@ -1365,10 +1365,13 @@ class ProductManager: v = (p.get('filter_labels') or {}).get(key[2:], '') vals.append(str(v if v is not None else '')) cells = [{'t': v, 'k': ''} for v in vals] - cells.append({'t': '¥%.4g %s' % (p['amount'], p.get('unit_label') or '元'), - 'k': 'price'}) + price_cell = {'t': '¥%.4g %s' % (p['amount'], p.get('unit_label') or '元'), + 'k': 'price', 'orig': None} if discount < 1.0 - 1e-9: - cells.append({'t': '¥%.4g' % p['original_price'], 'k': 'orig'}) + # 原价与折后价同单元格(.ui 渲染为并排两 Text:红价+划线原价), + # 不占独立列——否则行单元格数≠表头列数导致错位(2026-09-18 实测) + price_cell['orig'] = '¥%.4g' % p['original_price'] + cells.append(price_cell) rows.append(cells) return {'headers': headers, 'rows': rows} diff --git a/wwwroot/storefront/index.ui b/wwwroot/storefront/index.ui index 3a3a6b1..2c903e0 100644 --- a/wwwroot/storefront/index.ui +++ b/wwwroot/storefront/index.ui @@ -183,7 +183,14 @@ "options": {"css": "tabular-row", "width": "100%"}, "subwidgets": [ {% for c in row %} - {"widgettype": "Text", "options": {"otext": {{json.dumps(c.t, ensure_ascii=False)}}, "text": {{json.dumps(c.t, ensure_ascii=False)}}, "i18n": true, "halign": "left", "css": "filler", "cfontsize": 0.75{% if c.k == 'price' %}, "color": "#e74c3c"{% elif c.k == 'orig' %}, "color": "var(--ink-3)", "textDecoration": "line-through"{% else %}, "color": "var(--ink-2)"{% endif %}}}{{ "," if not loop.last }} +{% if c.k == 'price' %} + {"widgettype": "HBox", "options": {"css": "filler", "gap": "6px", "alignItems": "center"}, "subwidgets": [ + {"widgettype": "Text", "options": {"otext": {{json.dumps(c.t, ensure_ascii=False)}}, "text": {{json.dumps(c.t, ensure_ascii=False)}}, "i18n": true, "halign": "left", "cfontsize": 0.75, "color": "#e74c3c"}}{% if c.orig %}, + {"widgettype": "Text", "options": {"otext": {{json.dumps(c.orig, ensure_ascii=False)}}, "text": {{json.dumps(c.orig, ensure_ascii=False)}}, "i18n": true, "halign": "left", "cfontsize": 0.75, "color": "var(--ink-3)", "textDecoration": "line-through"}}{% endif %} + ]}{{ "," if not loop.last }} +{% else %} + {"widgettype": "Text", "options": {"otext": {{json.dumps(c.t, ensure_ascii=False)}}, "text": {{json.dumps(c.t, ensure_ascii=False)}}, "i18n": true, "halign": "left", "css": "filler", "cfontsize": 0.75, "color": "var(--ink-2)"}}{{ "," if not loop.last }} +{% endif %} {% endfor %} ] }{{ "," if not loop.last }}