yumoqing bc8af7a4cf fix: 产品折扣设置显示基准折扣(1.0)并标记方案内产品
- get_discount_setting_products: LEFT JOIN基准折扣方案_HeaX, COALESCE优先方案折扣, 新增in_plan字段
- get_products_with_discount.dspy: 同步加基准折扣COALESCE
- index.ui: 折扣默认1.0, 新增'✓方案内'标记列
- save_discount: old_discount默认1.0
2026-07-04 19:49:02 +08:00

105 lines
4.1 KiB
XML

{% set products = get_discount_setting_products(request) %}
{% set info = get_discount_info(request) %}
{
\t"widgettype": "VBox",
\t"options": {
\t\t"width": "100%",
\t\t"height": "100%",
\t\t"css": "filler"
\t},
\t"subwidgets": [
\t\t{
\t\t\t"widgettype": "Text",
\t\t\t"options": {
\t\t\t\t"text": "产品折扣设置 - {{info.name or ''}}{% if info.customer %} ({{info.customer}}){% endif %}",
\t\t\t\t"fontSize": "16px",
\t\t\t\t"fontWeight": "600",
\t\t\t\t"color": "#F1F5F9",
\t\t\t\t"padding": "8px 12px"
\t\t\t}
\t\t},
\t\t{
\t\t\t"widgettype": "HBox",
\t\t\t"options": {
\t\t\t\t"bgcolor": "#0F172A",
\t\t\t\t"padding": "8px 0",
\t\t\t\t"borderRadius": "6px 6px 0 0",
\t\t\t\t"alignItems": "center",
\t\t\t\t"width": "100%"
\t\t\t},
\t\t\t"subwidgets": [
\t\t\t\t{"widgettype": "Text", "options": {"text": "产品分类", "width": "20%", "padding": "0 8px", "fontSize": "12px", "fontWeight": "600", "color": "#94A3B8"}},
\t\t\t\t{"widgettype": "Text", "options": {"text": "产品名称", "width": "28%", "padding": "0 8px", "fontSize": "12px", "fontWeight": "600", "color": "#94A3B8"}},
\t\t\t\t{"widgettype": "Text", "options": {"text": "产品编码", "width": "18%", "padding": "0 8px", "fontSize": "12px", "fontWeight": "600", "color": "#94A3B8"}},
\t\t\t\t{"widgettype": "Text", "options": {"text": "折扣", "width": "14%", "padding": "0 8px", "fontSize": "12px", "fontWeight": "600", "color": "#94A3B8"}},
\t\t\t\t{"widgettype": "Text", "options": {"text": "状态", "width": "16%", "padding": "0 8px", "fontSize": "12px", "fontWeight": "600", "color": "#94A3B8"}}
\t\t\t]
\t\t},
\t\t{
\t\t\t"widgettype": "VScrollPanel",
\t\t\t"options": {
\t\t\t\t"width": "100%",
\t\t\t\t"flex": "1"
\t\t\t},
\t\t\t"subwidgets": [
\t\t\t\t{
\t\t\t\t\t"widgettype": "VBox",
\t\t\t\t\t"options": {
\t\t\t\t\t\t"width": "100%"
\t\t\t\t\t},
\t\t\t\t\t"subwidgets": [
{% for p in products %}
\t\t\t\t\t\t{
\t\t\t\t\t\t\t"widgettype": "HBox",
\t\t\t\t\t\t\t"options": {
\t\t\t\t\t\t\t\t"padding": "6px 0",
\t\t\t\t\t\t\t\t"border": "0 0 1px 0",
\t\t\t\t\t\t\t\t"borderColor": "#334155",
\t\t\t\t\t\t\t\t"alignItems": "center",
\t\t\t\t\t\t\t\t"width": "100%"
\t\t\t\t\t\t\t},
\t\t\t\t\t\t\t"subwidgets": [
\t\t\t\t\t\t\t\t{"widgettype": "Text", "options": {"text": "{{p.category_name or ''}}", "width": "20%", "padding": "0 8px", "fontSize": "12px", "color": "#E2E8F0"}},
\t\t\t\t\t\t\t\t{"widgettype": "Text", "options": {"text": "{{p.product_name or ''}}", "width": "28%", "padding": "0 8px", "fontSize": "12px", "color": "#F1F5F9"}},
\t\t\t\t\t\t\t\t{"widgettype": "Text", "options": {"text": "{{p.product_code or ''}}", "width": "18%", "padding": "0 8px", "fontSize": "12px", "color": "#E2E8F0"}},
\t\t\t\t\t\t\t\t{
\t\t\t\t\t\t\t\t\t"widgettype": "UiFloat",
\t\t\t\t\t\t\t\t\t"options": {
\t\t\t\t\t\t\t\t\t\t"width": "14%",
\t\t\t\t\t\t\t\t\t\t"padding": "0 8px",
\t\t\t\t\t\t\t\t\t\t"name": "discount",
\t\t\t\t\t\t\t\t\t\t"value": "{{p.discount or '1.0'}}",
\t\t\t\t\t\t\t\t\t\t"placeholder": "0~1",
\t\t\t\t\t\t\t\t\t\t"dec_len": 2,
\t\t\t\t\t\t\t\t\t\t"fontSize": "12px"
\t\t\t\t\t\t\t\t\t},
\t\t\t\t\t\t\t\t\t"binds": [
\t\t\t\t\t\t\t\t\t\t{
\t\t\t\t\t\t\t\t\t\t\t"wid": "self",
\t\t\t\t\t\t\t\t\t\t\t"event": "blur",
\t\t\t\t\t\t\t\t\t\t\t"actiontype": "urlwidget",
\t\t\t\t\t\t\t\t\t\t\t"datawidget": "self",
\t\t\t\t\t\t\t\t\t\t\t"target": "self",
\t\t\t\t\t\t\t\t\t\t\t"options": {
\t\t\t\t\t\t\t\t\t\t\t\t"url": "{{entire_url('./save_discount.dspy')}}",
\t\t\t\t\t\t\t\t\t\t\t\t"params": {
\t\t\t\t\t\t\t\t\t\t\t\t\t"discountid": "{{params_kw.discountid}}",
\t\t\t\t\t\t\t\t\t\t\t\t\t"old_discount": "{{p.discount or '1.0'}}",
\t\t\t\t\t\t\t\t\t\t\t\t\t"productid": "{{p.productid}}",
\t\t\t\t\t\t\t\t\t\t\t\t\t"detail_id": "{{p.detail_id or ''}}"
\t\t\t\t\t\t\t\t\t\t\t\t}
\t\t\t\t\t\t\t\t\t\t\t}
\t\t\t\t\t\t\t\t\t\t}
\t\t\t\t\t\t\t\t\t]
\t\t\t\t\t\t\t\t},
\t\t\t\t\t\t\t\t{"widgettype": "Text", "options": {"text": "{% if p.in_plan == 1 %}✓方案内{% endif %}", "width": "16%", "padding": "0 8px", "fontSize": "11px", "color": "#34D399"}}
\t\t\t\t\t\t\t]
\t\t\t\t\t\t}{% if not loop.last %},{% endif %}
{% endfor %}
\t\t\t\t\t]
\t\t\t\t}
\t\t\t]
\t\t}
\t]
}