sage_datamart/wwwroot/sect_customer_currency.ui

43 lines
3.0 KiB
XML

{% set today_data = j2_customer_currency(request, 'today') %}
{% set month_data = j2_customer_currency(request, 'month') %}
{% set year_data = j2_customer_currency(request, 'year') %}
{% set all_data = j2_customer_currency(request, 'all') %}
{% set today_sum = namespace(v=0) %}{% for r in today_data %}{% set today_sum.v = today_sum.v + r.revenue_cny %}{% endfor %}
{% set month_sum = namespace(v=0) %}{% for r in month_data %}{% set month_sum.v = month_sum.v + r.revenue_cny %}{% endfor %}
{% set year_sum = namespace(v=0) %}{% for r in year_data %}{% set year_sum.v = year_sum.v + r.revenue_cny %}{% endfor %}
{% set all_sum = namespace(v=0) %}{% for r in all_data %}{% set all_sum.v = all_sum.v + r.revenue_cny %}{% endfor %}
{
"widgettype": "VBox",
"options": {"width": "100%"},
"subwidgets": [
{"widgettype": "HBox", "options": {"width": "100%", "gap": "10px"},
"subwidgets": [
{"widgettype": "VBox", "options": {"css": "card", "padding": "8px", "borderRadius": "6px", "width": "25%"},
"subwidgets": [
{"widgettype": "Text", "options": {"otext": "今天", "i18n": true, "fontWeight": "600", "fontSize": "11px"}},
{"widgettype": "Text", "options": {"text": {{json.dumps('¥' + ('%.2f' % today_sum.v), ensure_ascii=False)}}, "fontWeight": "700", "fontSize": "14px", "marginTop": "2px"}}
]
},
{"widgettype": "VBox", "options": {"css": "card", "padding": "8px", "borderRadius": "6px", "width": "25%"},
"subwidgets": [
{"widgettype": "Text", "options": {"otext": "本月", "i18n": true, "fontWeight": "600", "fontSize": "11px"}},
{"widgettype": "Text", "options": {"text": {{json.dumps('¥' + ('%.2f' % month_sum.v), ensure_ascii=False)}}, "fontWeight": "700", "fontSize": "14px", "marginTop": "2px"}}
]
},
{"widgettype": "VBox", "options": {"css": "card", "padding": "8px", "borderRadius": "6px", "width": "25%"},
"subwidgets": [
{"widgettype": "Text", "options": {"otext": "本年", "i18n": true, "fontWeight": "600", "fontSize": "11px"}},
{"widgettype": "Text", "options": {"text": {{json.dumps('¥' + ('%.2f' % year_sum.v), ensure_ascii=False)}}, "fontWeight": "700", "fontSize": "14px", "marginTop": "2px"}}
]
},
{"widgettype": "VBox", "options": {"css": "card", "padding": "8px", "borderRadius": "6px", "width": "25%"},
"subwidgets": [
{"widgettype": "Text", "options": {"otext": "累计", "i18n": true, "fontWeight": "600", "fontSize": "11px"}},
{"widgettype": "Text", "options": {"text": {{json.dumps('¥' + ('%.2f' % all_sum.v), ensure_ascii=False)}}, "fontWeight": "700", "fontSize": "14px", "marginTop": "2px"}}
]
}
]
}
]
}