fix: 客户视图模型排行改sect_top_models,币种费用去jinja2_macro
This commit is contained in:
parent
a50935f669
commit
72c522b5c9
@ -68,7 +68,7 @@
|
||||
"options": {"css": "card", "width": "50%", "padding": "16px"},
|
||||
"subwidgets": [
|
||||
{"widgettype": "Title4", "options": {"fontWeight": "600", "otext": "我的模型(按金额Top5)", "i18n": true, "marginBottom": "8px"}},
|
||||
{"widgettype": "RefreshWidget", "options": {"period_seconds": 60, "url": "{{entire_url('sect_user_apikeys.ui')}}", "width": "100%"}}
|
||||
{"widgettype": "RefreshWidget", "options": {"period_seconds": 60, "url": "{{entire_url('sect_top_models.ui')}}", "width": "100%"}}
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@ -2,37 +2,38 @@
|
||||
{% set month_data = j2_customer_currency(request, 'month') %}
|
||||
{% set year_data = j2_customer_currency(request, 'year') %}
|
||||
{% set all_data = j2_customer_currency(request, 'all') %}
|
||||
|
||||
{% macro sum_cny(data) %}{% set total = namespace(v=0) %}{% for r in data %}{% set total.v = total.v + r.revenue_cny %}{% endfor %}{{ '%.2f' % total.v }}{% endmacro %}
|
||||
|
||||
{% 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", "marginBottom": "12px"},
|
||||
{"widgettype": "HBox", "options": {"width": "100%", "gap": "10px"},
|
||||
"subwidgets": [
|
||||
{"widgettype": "VBox", "options": {"css": "card", "padding": "10px", "borderRadius": "6px", "width": "25%"},
|
||||
{"widgettype": "VBox", "options": {"css": "card", "padding": "8px", "borderRadius": "6px", "width": "25%"},
|
||||
"subwidgets": [
|
||||
{"widgettype": "Text", "options": {"otext": "今天", "i18n": true, "fontWeight": "600", "fontSize": "12px"}},
|
||||
{"widgettype": "Text", "options": {"text": {{json.dumps('¥' + sum_cny(today_data), ensure_ascii=False)}},"fontWeight": "700", "fontSize": "16px", "marginTop": "4px"}}
|
||||
{"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": "10px", "borderRadius": "6px", "width": "25%"},
|
||||
{"widgettype": "VBox", "options": {"css": "card", "padding": "8px", "borderRadius": "6px", "width": "25%"},
|
||||
"subwidgets": [
|
||||
{"widgettype": "Text", "options": {"otext": "本月", "i18n": true, "fontWeight": "600", "fontSize": "12px"}},
|
||||
{"widgettype": "Text", "options": {"text": {{json.dumps('¥' + sum_cny(month_data), ensure_ascii=False)}},"fontWeight": "700", "fontSize": "16px", "marginTop": "4px"}}
|
||||
{"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": "10px", "borderRadius": "6px", "width": "25%"},
|
||||
{"widgettype": "VBox", "options": {"css": "card", "padding": "8px", "borderRadius": "6px", "width": "25%"},
|
||||
"subwidgets": [
|
||||
{"widgettype": "Text", "options": {"otext": "本年", "i18n": true, "fontWeight": "600", "fontSize": "12px"}},
|
||||
{"widgettype": "Text", "options": {"text": {{json.dumps('¥' + sum_cny(year_data), ensure_ascii=False)}},"fontWeight": "700", "fontSize": "16px", "marginTop": "4px"}}
|
||||
{"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": "10px", "borderRadius": "6px", "width": "25%"},
|
||||
{"widgettype": "VBox", "options": {"css": "card", "padding": "8px", "borderRadius": "6px", "width": "25%"},
|
||||
"subwidgets": [
|
||||
{"widgettype": "Text", "options": {"otext": "累计", "i18n": true, "fontWeight": "600", "fontSize": "12px"}},
|
||||
{"widgettype": "Text", "options": {"text": {{json.dumps('¥' + sum_cny(all_data), ensure_ascii=False)}},"fontWeight": "700", "fontSize": "16px", "marginTop": "4px"}}
|
||||
{"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"}}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user