feat: 营销方案CRUD添加「生成促销码」工具按钮 — 选中方案后一键生成该用户的促销码
This commit is contained in:
parent
7dbac3bfdb
commit
1e771df6e5
@ -50,6 +50,11 @@
|
|||||||
"selected_row": true,
|
"selected_row": true,
|
||||||
"label": "产品明细",
|
"label": "产品明细",
|
||||||
"icon": "{{entire_url('/bricks/imgs/list.svg')}}"
|
"icon": "{{entire_url('/bricks/imgs/list.svg')}}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "gen_promo",
|
||||||
|
"selected_row": true,
|
||||||
|
"label": "生成促销码"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -68,6 +73,20 @@
|
|||||||
"options": {
|
"options": {
|
||||||
"url": "{{entire_url('../marketing_discount_setting')}}"
|
"url": "{{entire_url('../marketing_discount_setting')}}"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"wid": "self",
|
||||||
|
"event": "gen_promo",
|
||||||
|
"actiontype": "urlwidget",
|
||||||
|
"target": "PopupWindow",
|
||||||
|
"popup_options": {
|
||||||
|
"title": "生成促销码",
|
||||||
|
"cwidth": 16,
|
||||||
|
"cheight": 10
|
||||||
|
},
|
||||||
|
"options": {
|
||||||
|
"url": "{{entire_url('../api/gen_promo_from_mkt.dspy')}}?marketing_id=${id}$"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"new_data_url": "{{entire_url('/discount/api/marketing_create.dspy')}}",
|
"new_data_url": "{{entire_url('/discount/api/marketing_create.dspy')}}",
|
||||||
|
|||||||
17
wwwroot/api/gen_promo_from_mkt.dspy
Normal file
17
wwwroot/api/gen_promo_from_mkt.dspy
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
# 从营销方案直接生成促销码(toolbar 工具按钮调用)
|
||||||
|
marketing_id = params_kw.get('marketing_id', '')
|
||||||
|
if not marketing_id:
|
||||||
|
return {"widgettype": "Error", "options": {"title": "操作失败", "message": "缺少方案ID", "cwidth": 16, "cheight": 9, "timeout": 3}}
|
||||||
|
|
||||||
|
result = await generate_promo_code(request, {"marketing_id": marketing_id})
|
||||||
|
if result.get("status") == "success":
|
||||||
|
return {
|
||||||
|
"widgettype": "Message",
|
||||||
|
"options": {
|
||||||
|
"title": "促销码已生成",
|
||||||
|
"message": "促销码: " + result["code"],
|
||||||
|
"type": "success",
|
||||||
|
"timeout": 5
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return {"widgettype": "Error", "options": {"title": "操作失败", "message": str(result.get("message", "")), "cwidth": 16, "cheight": 9, "timeout": 3}}
|
||||||
Loading…
x
Reference in New Issue
Block a user