fix: 生成促销码改用script+fetch POST传参,绕过urlwidget/PopupWindow参数传递问题

This commit is contained in:
yumoqing 2026-08-05 17:53:59 +08:00
parent 763e41b7eb
commit 9dbb44fbd9

View File

@ -77,22 +77,8 @@
{
"wid": "self",
"event": "gen_promo",
"actiontype": "urlwidget",
"target": "PopupWindow",
"popup_options": {
"title": "生成促销码",
"cwidth": 16,
"cheight": 10
},
"params_mapping": {
"mapping": {
"id": "marketing_id"
},
"need_other": false
},
"options": {
"url": "{{entire_url('../api/gen_promo_from_mkt.dspy')}}"
}
"actiontype": "script",
"script": "(function(){var id='${id}$';var x=new XMLHttpRequest();x.open('POST','{{entire_url('../api/gen_promo_from_mkt.dspy')}}',true);x.setRequestHeader('Content-Type','application/x-www-form-urlencoded');x.onload=function(){try{var d=JSON.parse(x.responseText);if(d.widgettype==='Message'){var m=new bricks.Message(d.options);m.show();}else{alert(d.options.message||x.responseText);}}catch(e){alert(x.responseText);}};x.send('marketing_id='+encodeURIComponent(id));})();"
}
],
"new_data_url": "{{entire_url('/discount/api/marketing_create.dspy')}}",
@ -100,4 +86,4 @@
"delete_data_url": "{{entire_url('/discount/api/marketing_delete.dspy')}}",
"logined_userorgid": "resellerid"
}
}
}