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 %} ] } - ] + ] + } +] }