fix: QR URL改为promote.dspy; 恢复完整表单
This commit is contained in:
parent
2d6fa91ec5
commit
7daff0fcd6
@ -555,7 +555,7 @@ async def generate_promo_qr(request, params_kw):
|
|||||||
return {'widgettype': 'Message', 'options': {'title': 'Error', 'message': f'Promo code {promo_id} not found', 'type': 'error'}}
|
return {'widgettype': 'Message', 'options': {'title': 'Error', 'message': f'Promo code {promo_id} not found', 'type': 'error'}}
|
||||||
|
|
||||||
config = getConfig()
|
config = getConfig()
|
||||||
qr_url = env.entire_url('./promote') + f'?code={promo_id}'
|
qr_url = env.entire_url('./promote.dspy') + f'?code={promo_id}'
|
||||||
fs = FileStorage()
|
fs = FileStorage()
|
||||||
p = fs._name2path(f'{_getID()}.png')
|
p = fs._name2path(f'{_getID()}.png')
|
||||||
gen_qr_withlogo(qr_url, p, logopath=config.logopath, logoloc='cc')
|
gen_qr_withlogo(qr_url, p, logopath=config.logopath, logoloc='cc')
|
||||||
|
|||||||
@ -1 +1,18 @@
|
|||||||
return {"widgettype": "Form", "options": {"url": "/discount/generate_qr.dspy", "fields": [{"name": "discount", "uitype": "float", "label": "折扣"}]}}
|
# Customer promote page - scan QR code to claim discount
|
||||||
|
code = params_kw.get('code', '')
|
||||||
|
|
||||||
|
result = {
|
||||||
|
"widgettype": "Form",
|
||||||
|
"options": {
|
||||||
|
"width": "100%",
|
||||||
|
"height": "100%",
|
||||||
|
"url": "/discount/generate_qr.dspy?code=" + code,
|
||||||
|
"method": "POST",
|
||||||
|
"fields": [
|
||||||
|
{"name": "valid_term", "label": "有效期", "uitype": "str", "tip": "格式:xY, xM, xD"},
|
||||||
|
{"name": "expired_date", "label": "促销失效日期", "uitype": "date", "tip": "需在此日期前使用"},
|
||||||
|
{"name": "discount", "label": "折扣", "uitype": "float", "tip": "0<折扣<1"}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"binds": [{"wid": "self", "event": "submited", "actiontype": "script", "target": "self", "script": "await bricks.show_resp_message_or_error(event.params)"}]
|
||||||
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user