用户决策(2026-09-06): 1. 折扣率允许大于1:平台可加价卖产品给客户(如存储缺省1.5); 也可小于1让利(如百炼模型0.9,供应商有折扣传导给客户) 2. 解析规则:确定客户→查客户专属折扣;查不到→'*'通配兜底;再无→1.0 旧实现bug:专属与通配OR混查取全局min——专属0.95+通配0.8返回0.8, 专属记录形同虚设 改动: - init.py sor_get_min_product_discount: 两步查询(专属层min→通配层min) - init.py add/update_discount_detail: 上限1→9.9999(DB double(5,4)约束) - discount_setting/save_discount.dspy: 兜底记录识别'*'+NULL两种形态; 「客户折扣率不得高于通用折扣率」校验保留(加价语义下=单客户价不贵于通用价) - marketing_discount_setting/save_discount.dspy: >1上限放开,保留<基准约束 - generate_qr.dspy: 同上放开 - index.ui: placeholder 0~1→'>1加价 <1折扣',dec_len 2→4 本地mock测试5场景全过:专属优先/通配兜底/无记录1.0/exact_match不兜底/层内min
105 lines
3.6 KiB
XML
105 lines
3.6 KiB
XML
{% set products = get_discount_setting_products(request) %}
|
|
{% set info = get_discount_info(request) %}
|
|
{
|
|
"widgettype": "VBox",
|
|
"options": {
|
|
"width": "100%",
|
|
"height": "100%",
|
|
"css": "filler"
|
|
},
|
|
"subwidgets": [
|
|
{
|
|
"widgettype": "Text",
|
|
"options": {
|
|
"text": {{json.dumps('产品折扣设置 - ' + (info.name or ''), ensure_ascii=False)}},
|
|
"fontSize": "16px",
|
|
"fontWeight": "600",
|
|
"color": "#F1F5F9",
|
|
"padding": "8px 12px"
|
|
}
|
|
},
|
|
{
|
|
"widgettype": "HBox",
|
|
"options": {
|
|
"bgcolor": "#0F172A",
|
|
"padding": "8px 0",
|
|
"borderRadius": "6px 6px 0 0",
|
|
"alignItems": "center",
|
|
"width": "100%"
|
|
},
|
|
"subwidgets": [
|
|
{"widgettype": "Text", "options": {"text": "产品分类", "width": "20%", "padding": "0 8px", "fontSize": "12px", "fontWeight": "600", "color": "#94A3B8"}},
|
|
{"widgettype": "Text", "options": {"text": "产品名称", "width": "28%", "padding": "0 8px", "fontSize": "12px", "fontWeight": "600", "color": "#94A3B8"}},
|
|
{"widgettype": "Text", "options": {"text": "产品编码", "width": "18%", "padding": "0 8px", "fontSize": "12px", "fontWeight": "600", "color": "#94A3B8"}},
|
|
{"widgettype": "Text", "options": {"text": "折扣", "width": "14%", "padding": "0 8px", "fontSize": "12px", "fontWeight": "600", "color": "#94A3B8"}},
|
|
{"widgettype": "Text", "options": {"text": "状态", "width": "16%", "padding": "0 8px", "fontSize": "12px", "fontWeight": "600", "color": "#94A3B8"}}
|
|
]
|
|
},
|
|
{
|
|
"widgettype": "VScrollPanel",
|
|
"options": {
|
|
"width": "100%",
|
|
"flex": "1"
|
|
},
|
|
"subwidgets": [
|
|
{
|
|
"widgettype": "VBox",
|
|
"options": {
|
|
"width": "100%"
|
|
},
|
|
"subwidgets": [
|
|
{% for p in products %}
|
|
{
|
|
"widgettype": "HBox",
|
|
"options": {
|
|
"padding": "6px 0",
|
|
"border": "0 0 1px 0",
|
|
"borderColor": "#334155",
|
|
"alignItems": "center",
|
|
"width": "100%"
|
|
},
|
|
"subwidgets": [
|
|
{"widgettype": "Text", "options": {"text": {{json.dumps(p.category_name or '')}}, "width": "20%", "padding": "0 8px", "fontSize": "12px", "color": "#E2E8F0"}},
|
|
{"widgettype": "Text", "options": {"text": {{json.dumps(p.product_name or '')}}, "width": "28%", "padding": "0 8px", "fontSize": "12px", "color": "#F1F5F9"}},
|
|
{"widgettype": "Text", "options": {"text": {{json.dumps(p.product_code or '')}}, "width": "18%", "padding": "0 8px", "fontSize": "12px", "color": "#E2E8F0"}},
|
|
{
|
|
"widgettype": "UiFloat",
|
|
"options": {
|
|
"width": "14%",
|
|
"padding": "0 8px",
|
|
"name": "discount",
|
|
"value": {{json.dumps(p.discount or '1.0')}},
|
|
"placeholder": ">1加价 <1折扣",
|
|
"dec_len": 4,
|
|
"fontSize": "12px"
|
|
},
|
|
"binds": [
|
|
{
|
|
"wid": "self",
|
|
"event": "blur",
|
|
"actiontype": "urlwidget",
|
|
"datawidget": "self",
|
|
"target": "self",
|
|
"options": {
|
|
"url": "{{entire_url('./save_discount.dspy')}}",
|
|
"params": {
|
|
"discountid": {{json.dumps(params_kw.discountid)}},
|
|
"old_discount": {{json.dumps(p.discount or '1.0')}},
|
|
"productid": {{json.dumps(p.productid)}},
|
|
"detail_id": {{json.dumps(p.detail_id or '')}}
|
|
}
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{"widgettype": "Text", "options": {"text": {% if p.in_plan == 1 %}"✓方案内"{% else %}""{% endif %}, "width": "16%", "padding": "0 8px", "fontSize": "11px", "color": "#34D399"}}
|
|
]
|
|
}{% if not loop.last %},{% endif %}
|
|
{% endfor %}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|