From 2d869c1fbcfcfe0cae9324a904b6597dd8069865 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Mon, 29 Jun 2026 12:05:41 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20cwidth=E6=94=B9=E4=B8=BAwidth=E7=99=BE?= =?UTF-8?q?=E5=88=86=E6=AF=94(22/34/22/22);=20discountid=E6=94=B9=E7=94=A8?= =?UTF-8?q?rel=5Furl.query=E5=A4=9A=E7=A7=8D=E6=96=B9=E5=BC=8F=E8=8E=B7?= =?UTF-8?q?=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- discount/init.py | 9 ++++++++- wwwroot/discount_setting/index.ui | 26 +++++++++++++------------- 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/discount/init.py b/discount/init.py index 65bf13d..7b819e6 100644 --- a/discount/init.py +++ b/discount/init.py @@ -739,7 +739,14 @@ async def get_discount_setting_products(request): Used in Jinja2 template: {% set products = get_discount_setting_products(request) %} """ env = request._run_ns - discountid = (getattr(request, '_params_kw', {}) or {}).get('discountid', '') + # Try multiple ways to get discountid from URL query params + discountid = '' + if hasattr(request, 'rel_url') and request.rel_url: + discountid = request.rel_url.query.get('discountid', '') + if not discountid and hasattr(request, 'query'): + discountid = request.query.get('discountid', '') + if not discountid: + discountid = (getattr(request, '_params_kw', {}) or {}).get('discountid', '') user_orgid = await env.get_userorgid() if not discountid or not user_orgid: diff --git a/wwwroot/discount_setting/index.ui b/wwwroot/discount_setting/index.ui index b785584..ee4c5a6 100644 --- a/wwwroot/discount_setting/index.ui +++ b/wwwroot/discount_setting/index.ui @@ -21,44 +21,44 @@ "widgettype": "HBox", "options": { "bgcolor": "#0F172A", - "padding": "8px 12px", + "padding": "8px 0", "borderRadius": "6px 6px 0 0", - "alignItems": "center" + "alignItems": "center", + "width": "100%" }, "subwidgets": [ - {"widgettype": "Text", "options": {"text": "产品分类", "cwidth": 3, "fontSize": "12px", "fontWeight": "600", "color": "#94A3B8"}}, - {"widgettype": "Text", "options": {"text": "产品名称", "cwidth": 5, "fontSize": "12px", "fontWeight": "600", "color": "#94A3B8"}}, - {"widgettype": "Text", "options": {"text": "产品编码", "cwidth": 3, "fontSize": "12px", "fontWeight": "600", "color": "#94A3B8"}}, - {"widgettype": "Text", "options": {"text": "折扣(可编辑)", "cwidth": 3, "fontSize": "12px", "fontWeight": "600", "color": "#94A3B8"}} + {"widgettype": "Text", "options": {"text": "产品分类", "width": "22%", "padding": "0 12px", "fontSize": "12px", "fontWeight": "600", "color": "#94A3B8"}}, + {"widgettype": "Text", "options": {"text": "产品名称", "width": "34%", "padding": "0 12px", "fontSize": "12px", "fontWeight": "600", "color": "#94A3B8"}}, + {"widgettype": "Text", "options": {"text": "产品编码", "width": "22%", "padding": "0 12px", "fontSize": "12px", "fontWeight": "600", "color": "#94A3B8"}}, + {"widgettype": "Text", "options": {"text": "折扣(可编辑)", "width": "22%", "padding": "0 12px", "fontSize": "12px", "fontWeight": "600", "color": "#94A3B8"}} ] }, { "widgettype": "VBox", "id": "discount_rows", "options": { - "width": "100%", - "css": "childrensize" + "width": "100%" }, "subwidgets": [ {% for p in products %} { "widgettype": "HBox", "options": { - "padding": "6px 12px", + "padding": "6px 0", "border": "0 0 1px 0", "borderColor": "#334155", "alignItems": "center", "width": "100%" }, "subwidgets": [ - {"widgettype": "Text", "options": {"text": "{{p.category_name or ''}}", "cwidth": 3, "fontSize": "12px", "color": "#E2E8F0"}}, - {"widgettype": "Text", "options": {"text": "{{p.product_name or ''}}", "cwidth": 5, "fontSize": "12px", "color": "#F1F5F9"}}, - {"widgettype": "Text", "options": {"text": "{{p.product_code or ''}}", "cwidth": 3, "fontSize": "12px", "color": "#E2E8F0"}}, + {"widgettype": "Text", "options": {"text": "{{p.category_name or ''}}", "width": "22%", "padding": "0 12px", "fontSize": "12px", "color": "#E2E8F0"}}, + {"widgettype": "Text", "options": {"text": "{{p.product_name or ''}}", "width": "34%", "padding": "0 12px", "fontSize": "12px", "color": "#F1F5F9"}}, + {"widgettype": "Text", "options": {"text": "{{p.product_code or ''}}", "width": "22%", "padding": "0 12px", "fontSize": "12px", "color": "#E2E8F0"}}, { "widgettype": "Form", "id": "discount_form_{{loop.index}}", "options": { - "cwidth": 3, + "width": "22%", "show_label": false, "css": "childrensize", "submit_url": "{{entire_url('./save_discount.dspy')}}",