From 885b915d28e25dbf58cb9e0fdbcb37b143507ed8 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Mon, 29 Jun 2026 16:32:02 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20JSON=E9=97=AD=E5=90=88VScrollPanel,=20ur?= =?UTF-8?q?lwidget=E2=86=92script+fetch=E8=AF=BBinput=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- wwwroot/discount_setting/index.ui | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/wwwroot/discount_setting/index.ui b/wwwroot/discount_setting/index.ui index 11d805f..4977bee 100644 --- a/wwwroot/discount_setting/index.ui +++ b/wwwroot/discount_setting/index.ui @@ -34,11 +34,18 @@ ] }, { - "widgettype": "VBox", + "widgettype": "VScrollPanel", "options": { - "width": "100%" + "width": "100%", + "flex": "1" }, "subwidgets": [ + { + "widgettype": "VBox", + "options": { + "width": "100%" + }, + "subwidgets": [ {% for p in products %} { "widgettype": "HBox", @@ -68,17 +75,9 @@ { "wid": "self", "event": "blur", - "actiontype": "urlwidget", - "target": "discount_rows", - "options": { - "url": "{{entire_url('./save_discount.dspy')}}", - "params": { - "discountid": "{{params_kw.discountid}}", - "productid": "{{p.productid}}", - "detail_id": "{{p.detail_id or ''}}", - "discount": "{{p.discount or ''}}" - } - } + "actiontype": "script", + "target": "self", + "script": "var v=this.target.dom_element.querySelector('input');if(!v)return;var nv=v.value;fetch('{{entire_url(\"./save_discount.dspy\")}}',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({discountid:'{{params_kw.discountid}}',productid:'{{p.productid}}',detail_id:'{{p.detail_id or ''}}',discount:nv})}).then(function(r){return r.json()}).then(function(r){if(r.widgettype==='Error')bricks.show_error(r.options)}).catch(function(e){console.error(e)})" } ] } @@ -87,5 +86,7 @@ {% endfor %} ] } - ] + ] + } +] }