From e1dc4595a2273502905e3442e405a28c9a44f088 Mon Sep 17 00:00:00 2001 From: fish Date: Mon, 27 Jul 2026 15:08:34 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8C=81=E4=BB=93=E5=88=97=E8=A1=A8=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E5=93=81=E7=A7=8D=E5=AD=90tab=E5=88=87=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.7 --- ft-app/app/templates/trades.html | 43 +++++++++++++++++++++++++++----- 1 file changed, 37 insertions(+), 6 deletions(-) diff --git a/ft-app/app/templates/trades.html b/ft-app/app/templates/trades.html index b99e3f8..5192019 100644 --- a/ft-app/app/templates/trades.html +++ b/ft-app/app/templates/trades.html @@ -5,6 +5,12 @@ {% block content %} {% set view = request.query_params.get('view', '') %} +{% set product_tab = request.query_params.get('tab', '全部') %} +{% set product_codes = product_contracts.keys()|list %} +{% set grouped_open = {} %} +{% for t in open_trades %} + {% set _ = grouped_open.setdefault(t.product_code, []).append(t) %} +{% endfor %}
@@ -76,13 +90,27 @@ {# ── 持仓列表 ── #}
持仓中 · {{ open_trades|length }} 笔
+
+ 全部 + {% for pc in product_codes %} + {% set count = grouped_open.get(pc, [])|length %} + {{ pc }}{% if count %} · {{ count }}{% endif %} + {% endfor %} +
+ {% if open_trades %} -
+{% for pc in product_codes %} +{% if product_tab == '全部' or product_tab == pc %} +{% set trades = grouped_open.get(pc, []) %} +{% if trades %} +
+{% if product_tab == '全部' %} +
{{ pc }} · {{ trades|length }} 笔
+{% endif %} - - {% for t in open_trades %} + + {% for t in trades %} - @@ -107,6 +135,9 @@ {% endfor %}
品种合约方向开仓日期开仓价手续费操作
合约方向开仓日期开仓价手续费操作
{{ t.product_code }} {{ t.contract_code.replace(t.product_code, '', 1) }} {% if t.direction == 'short' %} @@ -99,7 +127,7 @@ onclick="showCloseForm({{ t.id }})">平仓 -
+
+{% endif %} +{% endif %} +{% endfor %} {% else %}
暂无持仓
{% endif %} @@ -370,4 +401,4 @@ function hideConfirm() { } -{% endblock %} \ No newline at end of file +{% endblock %}