- agreement_discount_setting.ui: product list with UiFloat discount inputs - contract_discount_setting.ui: same for supply contracts - get_agreement_discount_items.dspy + Python function - get_contract_discount_items.dspy + Python function - save_agreement_discount.dspy: create/update/delete items on discount change - save_contract_discount.dspy: same for supply contracts - Updated distribution_agreements_list and supply_contracts_list subtables
58 lines
4.0 KiB
XML
58 lines
4.0 KiB
XML
{% set items = get_contract_discount_items(request) %}
|
|
{% set contract_id = params_kw.contract_id or params_kw.id %}
|
|
{
|
|
"widgettype": "VBox",
|
|
"options": {"width": "100%", "height": "100%", "css": "filler"},
|
|
"subwidgets": [
|
|
{
|
|
"widgettype": "HBox",
|
|
"options": {"bgcolor": "#0F172A", "padding": "8px 0", "borderRadius": "6px 6px 0 0", "alignItems": "center", "width": "100%"},
|
|
"subwidgets": [
|
|
{"widgettype": "Text", "options": {"text": "产品分类", "width": "22%", "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": "12%", "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": "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 items %}
|
|
{
|
|
"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": "22%", "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": "UiFloat",
|
|
"options": {"width": "12%", "padding": "0 8px", "name": "discount", "value": {{json.dumps(p.discount or '1.0')}}, "dec_len": 2, "fontSize": "12px"},
|
|
"binds": [
|
|
{"wid": "self", "event": "blur", "actiontype": "urlwidget", "datawidget": "self", "target": "self",
|
|
"options": {"url": "{{entire_url('/supplychain/api/save_contract_discount.dspy')}}", "params": {
|
|
"contract_id": {{json.dumps(contract_id)}},
|
|
"productid": {{json.dumps(p.productid)}},
|
|
"prodtypeid": {{json.dumps(p.category_id or '')}},
|
|
"old_discount": {{json.dumps(p.discount or '1.0')}},
|
|
"item_id": {{json.dumps(p.item_id or '')}}
|
|
}}}
|
|
]
|
|
},
|
|
{"widgettype": "Text", "options": {"text": {{json.dumps(p.sale_price or '')}}, "width": "14%", "padding": "0 8px", "fontSize": "12px", "color": "#E2E8F0"}},
|
|
{"widgettype": "Text", "options": {"text": {% if p.item_id %}"✓已设置"{% else %}"-未设置"{% endif %}, "width": "20%", "padding": "0 8px", "fontSize": "11px", "color": {% if p.item_id %}"#34D399"{% else %}"#64748B"{% endif %}}}
|
|
]
|
|
}{% if not loop.last %},{% endif %}
|
|
{% endfor %}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|