{% set credits = get_all_credits_web(request) %} { "widgettype": "VBox", "options": { "width": "100%", "gap": "12px", "padding": "4px" }, "subwidgets": [ { "widgettype": "HBox", "options": { "alignItems": "center", "justifyContent": "space-between" }, "subwidgets": [ { "widgettype": "Text", "options": { "text": "客户额度管理 (共{{credits|length}}条)", "fontSize": "16px", "fontWeight": "600", "color": "#F1F5F9" } }, { "widgettype": "Button", "options": { "label": "新增授信", "bgcolor": "#3B82F6", "color": "#FFFFFF", "borderRadius": "6px", "padding": "6px 14px" }, "binds": [{ "wid": "self", "event": "click", "actiontype": "urlwidget", "target": "PopupWindow", "popup_options": { "title": "新增客户授信", "width": "480px", "height": "520px" }, "options": { "url": "{{entire_url('/accounting/credit_limit/api/set_credit_form.ui')}}" } }] } ] }, { "widgettype": "VBox", "options": { "bgcolor": "#1E293B", "borderRadius": "10px", "border": "1px solid #334155", "width": "100%" }, "subwidgets": [ { "widgettype": "HBox", "options": { "bgcolor": "#0F172A", "padding": "10px 16px", "borderRadius": "10px 10px 0 0", "alignItems": "center" }, "subwidgets": [ { "widgettype": "Text", "options": {"text": "客户名称", "fontSize": "12px", "fontWeight": "600", "color": "#94A3B8", "cwidth": 10} }, { "widgettype": "Text", "options": {"text": "授信额度", "fontSize": "12px", "fontWeight": "600", "color": "#94A3B8", "cwidth": 8} }, { "widgettype": "Text", "options": {"text": "已用/剩余", "fontSize": "12px", "fontWeight": "600", "color": "#94A3B8", "cwidth": 10} }, { "widgettype": "Text", "options": {"text": "使用率", "fontSize": "12px", "fontWeight": "600", "color": "#94A3B8", "cwidth": 6} }, { "widgettype": "Text", "options": {"text": "状态", "fontSize": "12px", "fontWeight": "600", "color": "#94A3B8", "cwidth": 4} }, { "widgettype": "Text", "options": {"text": "操作", "fontSize": "12px", "fontWeight": "600", "color": "#94A3B8", "cwidth": 6} } ] }, {% if credits|length == 0 %} { "widgettype": "VBox", "options": { "padding": "30px", "alignItems": "center" }, "subwidgets": [ { "widgettype": "Text", "options": { "text": "暂无客户授信记录", "fontSize": "14px", "color": "#64748B" } } ] } {% else %} {% for c in credits %} { "widgettype": "HBox", "options": { "padding": "12px 16px", "alignItems": "center", "border": "0 0 1px 0", "borderColor": "#334155" }, "subwidgets": [ { "widgettype": "VBox", "options": {"cwidth": 10, "gap": "2px"}, "subwidgets": [ { "widgettype": "Text", "options": { "text": "{{c.orgname_text or c.accountid}}", "fontSize": "13px", "fontWeight": "500", "color": "#F1F5F9" } }, { "widgettype": "Text", "options": { "text": "{{c.subject_name or ''}}", "fontSize": "11px", "color": "#64748B" } } ] }, { "widgettype": "Text", "options": { "text": "¥{{'%.2f' % c.credit_limit}}", "fontSize": "13px", "fontWeight": "600", "color": "#3B82F6", "cwidth": 8 } }, { "widgettype": "VBox", "options": {"cwidth": 10, "gap": "2px"}, "subwidgets": [ { "widgettype": "Text", "options": { "text": "已用 ¥{{'%.2f' % c.used_credit}}", "fontSize": "12px", "color": "#F59E0B" } }, { "widgettype": "Text", "options": { "text": "剩余 ¥{{'%.2f' % c.available_credit}}", "fontSize": "12px", "color": "#22C55E" } } ] }, { "widgettype": "HBox", "options": {"cwidth": 6, "alignItems": "center", "gap": "4px"}, "subwidgets": [ { "widgettype": "HBox", "options": { "bgcolor": "#334155", "borderRadius": "3px", "height": "6px", "width": "50px" }, "subwidgets": [ { "widgettype": "HBox", "options": { "bgcolor": "{{'#22C55E' if c.usage_pct < 60 else ('#F59E0B' if c.usage_pct < 85 else '#EF4444')}}", "borderRadius": "3px", "height": "6px", "width": "{{c.usage_pct}}%" }, "subwidgets": [] } ] }, { "widgettype": "Text", "options": { "text": "{{c.usage_pct}}%", "fontSize": "11px", "color": "{{'#22C55E' if c.usage_pct < 60 else ('#F59E0B' if c.usage_pct < 85 else '#EF4444')}}" } } ] }, { "widgettype": "VBox", "options": {"cwidth": 4}, "subwidgets": [ { "widgettype": "Text", "options": { "text": "{{'生效' if c.status == 'active' else ('停用' if c.status == 'inactive' else '过期')}}", "fontSize": "11px", "fontWeight": "600", "color": "{{'#22C55E' if c.status == 'active' else '#EF4444'}}" } } ] }, { "widgettype": "HBox", "options": {"cwidth": 6, "gap": "4px"}, "subwidgets": [ { "widgettype": "Button", "options": { "label": "调整", "bgcolor": "#475569", "color": "#FFFFFF", "borderRadius": "4px", "padding": "4px 8px", "fontSize": "11px" }, "binds": [{ "wid": "self", "event": "click", "actiontype": "urlwidget", "target": "PopupWindow", "popup_options": { "title": "调整授信额度", "width": "480px", "height": "520px" }, "options": { "url": "{{entire_url('/accounting/credit_limit/api/set_credit_form.ui')}}", "params_kw": { "id": "{{c.id}}", "accountid": "{{c.accountid}}", "credit_limit": "{{c.credit_limit}}", "valid_from": "{{c.valid_from or ''}}", "valid_to": "{{c.valid_to or ''}}", "remark": "{{c.remark or ''}}" } } }] } ] } ] }{% if not loop.last %},{% endif %} {% endfor %} {% endif %} ] } ] }