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 }}