yumoqing 78ff190789 feat(credit): redesign credit limit UI with dashboard, overview and management views
- Add hub.ui as main entry with stat cards (total/used/available/usage%)
- Add credit_overview.ui for user's own credit visualization with progress bars
- Add credit_manage.ui for distributor sales to manage customer credits
- Add set_credit_form.ui and set_customer_credit.dspy for credit adjustment
- Add credit_summary.dspy API for stats data
- Enhance creditlimit.py with get_credit_stats, get_my_credit_list, get_all_customer_credits
- Register new functions in init.py with ServerEnv
2026-05-30 21:00:27 +08:00

302 lines
12 KiB
XML

{% set cstats = get_credit_stats_web(request) %}
{
"widgettype": "VBox",
"options": {
"width": "100%",
"height": "100%",
"padding": "16px",
"gap": "16px"
},
"subwidgets": [
{
"widgettype": "Text",
"options": {
"text": "信用额度管理",
"fontSize": "22px",
"fontWeight": "700",
"color": "#F1F5F9"
}
},
{
"widgettype": "ResponsableBox",
"options": {
"gap": "12px",
"minWidth": "200px"
},
"subwidgets": [
{
"widgettype": "VBox",
"options": {
"bgcolor": "#1E293B",
"padding": "16px",
"borderRadius": "10px",
"border": "1px solid #334155",
"flex": "1",
"minHeight": "100px"
},
"subwidgets": [
{
"widgettype": "HBox",
"options": {
"alignItems": "center",
"marginBottom": "8px"
},
"subwidgets": [
{
"widgettype": "Svg",
"options": {
"svg": "<svg width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"#3B82F6\" stroke-width=\"2\"><path d=\"M12 2v20M17 5H9.5a3.5 3.5 0 000 7h5a3.5 3.5 0 010 7H6\"/></svg>",
"width": "20px",
"height": "20px"
}
},
{"widgettype": "Filler"}
]
},
{
"widgettype": "Text",
"options": {
"text": "¥{{'%.2f' % cstats.total_credit}}",
"fontSize": "26px",
"fontWeight": "700",
"color": "#3B82F6",
"lineHeight": "1.2"
}
},
{
"widgettype": "Text",
"options": {
"text": "授信总额度",
"fontSize": "13px",
"color": "#94A3B8",
"marginTop": "4px"
}
}
]
},
{
"widgettype": "VBox",
"options": {
"bgcolor": "#1E293B",
"padding": "16px",
"borderRadius": "10px",
"border": "1px solid #334155",
"flex": "1",
"minHeight": "100px"
},
"subwidgets": [
{
"widgettype": "HBox",
"options": {
"alignItems": "center",
"marginBottom": "8px"
},
"subwidgets": [
{
"widgettype": "Svg",
"options": {
"svg": "<svg width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"#F59E0B\" stroke-width=\"2\"><path d=\"M21 12a9 9 0 11-18 0 9 9 0 0118 0z\"/><path d=\"M9 12l2 2 4-4\"/></svg>",
"width": "20px",
"height": "20px"
}
},
{"widgettype": "Filler"}
]
},
{
"widgettype": "Text",
"options": {
"text": "¥{{'%.2f' % cstats.total_used}}",
"fontSize": "26px",
"fontWeight": "700",
"color": "#F59E0B",
"lineHeight": "1.2"
}
},
{
"widgettype": "Text",
"options": {
"text": "已用额度",
"fontSize": "13px",
"color": "#94A3B8",
"marginTop": "4px"
}
}
]
},
{
"widgettype": "VBox",
"options": {
"bgcolor": "#1E293B",
"padding": "16px",
"borderRadius": "10px",
"border": "1px solid #334155",
"flex": "1",
"minHeight": "100px"
},
"subwidgets": [
{
"widgettype": "HBox",
"options": {
"alignItems": "center",
"marginBottom": "8px"
},
"subwidgets": [
{
"widgettype": "Svg",
"options": {
"svg": "<svg width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"#22C55E\" stroke-width=\"2\"><path d=\"M2.25 18.75a60.07 60.07 0 0115.797 2.101c.727.198 1.453-.342 1.453-1.096V18.75M3.75 4.5v.75A.75.75 0 013 6h-.75m0 0v-.375c0-.621.504-1.125 1.125-1.125H20.25c.621 0 1.125.504 1.125 1.125v8.25c0 .621-.504 1.125-1.125 1.125H3.375a.75.75 0 01-.75-.75V4.5\"/></svg>",
"width": "20px",
"height": "20px"
}
},
{"widgettype": "Filler"}
]
},
{
"widgettype": "Text",
"options": {
"text": "¥{{'%.2f' % cstats.total_available}}",
"fontSize": "26px",
"fontWeight": "700",
"color": "#22C55E",
"lineHeight": "1.2"
}
},
{
"widgettype": "Text",
"options": {
"text": "剩余额度",
"fontSize": "13px",
"color": "#94A3B8",
"marginTop": "4px"
}
}
]
},
{
"widgettype": "VBox",
"options": {
"bgcolor": "#1E293B",
"padding": "16px",
"borderRadius": "10px",
"border": "1px solid #334155",
"flex": "1",
"minHeight": "100px"
},
"subwidgets": [
{
"widgettype": "HBox",
"options": {
"alignItems": "center",
"marginBottom": "8px"
},
"subwidgets": [
{
"widgettype": "Svg",
"options": {
"svg": "<svg width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"#A78BFA\" stroke-width=\"2\"><path d=\"M3 3v18h18\"/><path d=\"M18.7 8l-5.1 5.2-2.8-2.7L7 14.3\"/></svg>",
"width": "20px",
"height": "20px"
}
},
{"widgettype": "Filler"}
]
},
{
"widgettype": "Text",
"options": {
"text": "{{cstats.usage_pct}}%",
"fontSize": "26px",
"fontWeight": "700",
"color": "#A78BFA",
"lineHeight": "1.2"
}
},
{
"widgettype": "Text",
"options": {
"text": "额度使用率 ({{cstats.active_count}}/{{cstats.customer_count}}户)",
"fontSize": "13px",
"color": "#94A3B8",
"marginTop": "4px"
}
}
]
}
]
},
{
"widgettype": "HBox",
"options": {
"gap": "8px",
"alignItems": "center"
},
"subwidgets": [
{
"widgettype": "Button",
"options": {
"label": "我的额度",
"bgcolor": "#3B82F6",
"color": "#FFFFFF",
"borderRadius": "6px",
"padding": "8px 16px"
},
"binds": [{
"wid": "self",
"event": "click",
"actiontype": "urlwidget",
"target": "app.credit_content",
"options": {"url": "{{entire_url('/accounting/credit_limit/credit_overview.ui')}}"},
"mode": "replace"
}]
},
{
"widgettype": "Button",
"options": {
"label": "客户额度管理",
"bgcolor": "#475569",
"color": "#FFFFFF",
"borderRadius": "6px",
"padding": "8px 16px"
},
"binds": [{
"wid": "self",
"event": "click",
"actiontype": "urlwidget",
"target": "app.credit_content",
"options": {"url": "{{entire_url('/accounting/credit_limit/credit_manage.ui')}}"},
"mode": "replace"
}]
},
{
"widgettype": "Button",
"options": {
"label": "全部客户查询",
"bgcolor": "#475569",
"color": "#FFFFFF",
"borderRadius": "6px",
"padding": "8px 16px"
},
"binds": [{
"wid": "self",
"event": "click",
"actiontype": "urlwidget",
"target": "app.credit_content",
"options": {"url": "{{entire_url('/accounting/credit_limit/index.ui')}}"},
"mode": "replace"
}]
}
]
},
{
"widgettype": "VBox",
"id": "credit_content",
"options": {
"width": "100%",
"flex": "1"
}
}
]
}