index.ui: 显示所有产品 + 基准折扣(全部用户) + 方案折扣, 标志'已加入/未加入' get_products.dspy: 左联全部用户基准折扣 + 营销方案专属折扣 save_discount.dspy: 验证 0<新<基准, upsert 到 discount_detail init.py: get_marketing_discount_products + get_marketing_info marketing_list.json: toolbar 指向新页面
83 lines
5.2 KiB
XML
83 lines
5.2 KiB
XML
{% set products = get_marketing_discount_products(request) %}
|
|
{% set info = get_marketing_info(request) %}
|
|
{
|
|
"widgettype": "VBox",
|
|
"options": {
|
|
"width": "100%",
|
|
"height": "100%",
|
|
"css": "filler"
|
|
},
|
|
"subwidgets": [
|
|
{
|
|
"widgettype": "Text",
|
|
"options": {
|
|
"text": "营销方案产品折扣 - {{info.name or ''}}",
|
|
"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": "26%", "padding": "0 8px", "fontSize": "12px", "fontWeight": "600", "color": "#94A3B8"}},
|
|
{"widgettype": "Text", "options": {"text": "基准折扣", "width": "12%", "padding": "0 8px", "fontSize": "12px", "fontWeight": "600", "color": "#94A3B8"}},
|
|
{"widgettype": "Text", "options": {"text": "方案折扣", "width": "12%", "padding": "0 8px", "fontSize": "12px", "fontWeight": "600", "color": "#F59E0B"}},
|
|
{"widgettype": "Text", "options": {"text": "状态", "width": "10%", "padding": "0 8px", "fontSize": "12px", "fontWeight": "600", "color": "#94A3B8"}},
|
|
{"widgettype": "Text", "options": {"text": "操作", "width": "20%", "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": "{{p.category_name or ''}}", "width": "20%", "padding": "0 8px", "fontSize": "12px", "color": "#E2E8F0"}},
|
|
{"widgettype": "Text", "options": {"text": "{{p.product_name or ''}}", "width": "26%", "padding": "0 8px", "fontSize": "12px", "color": "#F1F5F9"}},
|
|
{"widgettype": "Text", "options": {"text": "{{p.base_discount or '-'}}", "width": "12%", "padding": "0 8px", "fontSize": "12px", "color": "#22C55E"}},
|
|
{"widgettype": "UiFloat", "options": {"name": "discount", "value": "{{p.marketing_discount or ''}}", "placeholder": "{{p.base_discount or ''}}", "dec_len": 2, "width": "12%", "padding": "0 8px", "fontSize": "12px"},
|
|
"binds": [{"wid": "self", "event": "blur", "actiontype": "urlwidget", "datawidget": "self", "target": "self",
|
|
"options": {"url": "{{entire_url('./save_discount.dspy')}}",
|
|
"params": {"discountid": "{{params_kw.discountid}}", "base_discount": "{{p.base_discount or ''}}", "productid": "{{p.productid}}", "detail_id": "{{p.detail_id or ''}}"}}}]},
|
|
{"widgettype": "Text", "options": {"text": "{{'已加入' if p.in_marketing == '1' else '未加入'}}", "width": "10%", "padding": "0 8px", "fontSize": "11px", "color": "{{'#F59E0B' if p.in_marketing == '1' else '#475569'}}"}},
|
|
{"widgettype": "Button", "options": {"label": "{{'移出' if p.in_marketing == '1' else '加入'}}", "padding": "2px 8px", "fontSize": "11px", "borderRadius": "4px",
|
|
"bgcolor": "{{'#991B1B' if p.in_marketing == '1' else '#166534'}}", "color": "#FFFFFF", "border": "none"},
|
|
"binds": [{"wid": "self", "event": "click", "actiontype": "urlwidget", "target": "self",
|
|
"options": {"url": "{{entire_url('./save_discount.dspy')}}",
|
|
"params": {"discountid": "{{params_kw.discountid}}", "base_discount": "{{p.base_discount or '1.0'}}", "productid": "{{p.productid}}", "detail_id": "{{p.detail_id or ''}}", "discount": "{{'0' if p.in_marketing == '1' else p.base_discount or '1.0'}}"}}}]}
|
|
]
|
|
}{% if not loop.last %},{% endif %}
|
|
{% endfor %}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|