This commit is contained in:
yumoqing 2026-06-29 11:09:28 +08:00
parent e9a0cf6650
commit 4c7a47d71f

View File

@ -1,8 +1,4 @@
{ {
"widgettype": "VBox",
"options": {"height": "100%", "width": "100%"},
"subwidgets": [
{
"id": "product_discount_tbl", "id": "product_discount_tbl",
"widgettype": "Tabular", "widgettype": "Tabular",
"options": { "options": {
@ -22,6 +18,9 @@
] ]
}, },
"data_url": "{{entire_url('./get_products_with_discount.dspy')}}", "data_url": "{{entire_url('./get_products_with_discount.dspy')}}",
"params": {
"discountid": "{{params_kw.discountid}}"
},
"data_method": "GET", "data_method": "GET",
"row_options": { "row_options": {
"idField": "productid", "idField": "productid",
@ -65,15 +64,4 @@
"script": "var dv = bricks.getWidgetById('product_discount_tbl', bricks.app.root); if (!dv || !dv.select_row || !dv.select_row.user_data) { alert('请先选中一个产品'); return; } var row = dv.select_row.user_data; var discountid = new URLSearchParams(window.location.search).get('discountid') || ''; var mf = new bricks.ModalForm({title: '设置折扣 - ' + row.product_name, width: '400px', auto_open: true, fields: [{name: 'discountid', uitype: 'hide', value: discountid}, {name: 'productid', uitype: 'hide', value: row.productid}, {name: 'category_id', uitype: 'hide', value: row.category_id}, {name: 'detail_id', uitype: 'hide', value: row.detail_id || ''}, {name: 'product_name', label: '产品', uitype: 'text', value: row.product_name}, {name: 'category_name', label: '分类', uitype: 'text', value: row.category_name}, {name: 'discount', label: '折扣(0-1)', uitype: 'float', value: row.discount || '', tip: '0到1之间如0.8表示8折留空或0表示清除折扣'}], submit_url: '{{entire_url('./save_discount.dspy')}}'}); mf.bind('submited', async function(params) { await bricks.show_resp_message_or_error(params); await dv.render({}); });" "script": "var dv = bricks.getWidgetById('product_discount_tbl', bricks.app.root); if (!dv || !dv.select_row || !dv.select_row.user_data) { alert('请先选中一个产品'); return; } var row = dv.select_row.user_data; var discountid = new URLSearchParams(window.location.search).get('discountid') || ''; var mf = new bricks.ModalForm({title: '设置折扣 - ' + row.product_name, width: '400px', auto_open: true, fields: [{name: 'discountid', uitype: 'hide', value: discountid}, {name: 'productid', uitype: 'hide', value: row.productid}, {name: 'category_id', uitype: 'hide', value: row.category_id}, {name: 'detail_id', uitype: 'hide', value: row.detail_id || ''}, {name: 'product_name', label: '产品', uitype: 'text', value: row.product_name}, {name: 'category_name', label: '分类', uitype: 'text', value: row.category_name}, {name: 'discount', label: '折扣(0-1)', uitype: 'float', value: row.discount || '', tip: '0到1之间如0.8表示8折留空或0表示清除折扣'}], submit_url: '{{entire_url('./save_discount.dspy')}}'}); mf.bind('submited', async function(params) { await bricks.show_resp_message_or_error(params); await dv.render({}); });"
} }
] ]
}
],
"binds": [
{
"wid": "self",
"event": "init",
"actiontype": "script",
"target": "product_discount_tbl",
"script": "var discountid = new URLSearchParams(window.location.search).get('discountid') || ''; if (discountid) { await this.render({discountid: discountid}); }"
}
]
} }