Align tablet trade records with close-record layout and row actions.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-06-30 00:05:33 +08:00
parent 21d68f6269
commit a6b3c4a657
3 changed files with 170 additions and 64 deletions
+45 -18
View File
@@ -30,13 +30,17 @@
</label>
<div class="records-mobile-list" id="records-trade-mobile">
{% for t in trades %}
<button type="button" class="records-mobile-item records-trade-item" data-trade='{{ {
{% set trade_pnl = t.pnl_net if t.pnl_net is not none else t.pnl %}
{% set trade_px = t.close_price if t.close_price else t.entry_price %}
{% set pnl_cls = 'is-profit' if trade_pnl and trade_pnl > 0 else ('is-loss' if trade_pnl and trade_pnl < 0 else 'is-flat') %}
<div class="records-trade-row" data-trade-id="{{ t.id }}" data-trade='{{ {
"symbol": t.symbol_name or t.symbol,
"symbol_code": t.symbol,
"monitor_type": t.monitor_type,
"source": "柜台" if t.source == "ctp" else "本地",
"direction": "做多" if t.direction == "long" else "做空",
"entry_price": t.entry_price,
"close_price": t.close_price,
"stop_loss": t.stop_loss,
"take_profit": t.take_profit,
"lots": t.lots,
@@ -52,28 +56,51 @@
"result": t.result,
"verified": t.verified,
"fill_review_url": url_for("fill_review_from_trade", tid=t.id),
"del_url": url_for("del_trade", tid=t.id)
"del_url": url_for("del_trade", tid=t.id),
"verify_url": url_for("update_trade", tid=t.id)
} | tojson }}'>
<div class="records-mobile-item-head">
<span class="records-mobile-symbol">{{ t.symbol_name or t.symbol }}</span>
<span class="badge dir">{{ '做多' if t.direction == 'long' else '做空' }}</span>
<div class="records-trade-main">
<div class="records-trade-head">
<span class="records-trade-title">
<span class="records-mobile-symbol">{{ t.symbol_name or t.symbol }}</span>
{% if t.symbol and (t.symbol_name or '')|lower != (t.symbol or '')|lower %}
<span class="text-accent records-trade-code">{{ t.symbol }}</span>
{% endif %}
<span class="badge dir">{{ '做多' if t.direction == 'long' else '做空' }}</span>
{% if t.verified %}<span class="badge active records-verified-badge">已核对</span>{% endif %}
</span>
</div>
<div class="records-trade-summary">
{{ (t.lots or 0)|int }}手 平仓 {{ trade_px if trade_px is not none else '-' }}
盈亏 <span class="records-mobile-pnl {{ pnl_cls }}">{{ trade_pnl if trade_pnl is not none else '-' }}</span>
</div>
</div>
<div class="records-mobile-item-meta">
<span>{{ (t.close_time or t.open_time or '')[:16].replace('T', ' ') }}</span>
{% if t.result == '止盈' %}<span class="badge profit">{{ t.result }}</span>
{% elif t.result == '止损' %}<span class="badge loss">{{ t.result }}</span>
{% elif t.result in ('移动止盈', '保本止盈') %}<span class="badge profit">{{ t.result }}</span>
{% elif t.result == '手动平仓' %}<span class="badge result-manual">{{ t.result }}</span>
{% else %}<span class="badge result-external">{{ t.result }}</span>{% endif %}
<span>{{ '柜台' if t.source == 'ctp' else '本地' }}</span>
<div class="records-trade-actions">
<button type="button" class="btn-link records-trade-detail-btn">详情</button>
<a href="{{ url_for('fill_review_from_trade', tid=t.id) }}" class="btn-fill">复盘</a>
<form method="post" action="{{ url_for('update_trade', tid=t.id) }}" class="records-trade-verify-form">
<input type="hidden" name="symbol_name" value="{{ t.symbol_name or t.symbol }}">
<input type="hidden" name="monitor_type" value="{{ t.monitor_type }}">
<input type="hidden" name="direction" value="{{ t.direction }}">
<input type="hidden" name="entry_price" value="{{ t.entry_price }}">
<input type="hidden" name="stop_loss" value="{{ t.stop_loss }}">
<input type="hidden" name="take_profit" value="{{ t.take_profit }}">
<input type="hidden" name="close_price" value="{{ t.close_price or '' }}">
<input type="hidden" name="lots" value="{{ t.lots }}">
<input type="hidden" name="margin" value="{{ t.margin or '' }}">
<input type="hidden" name="holding_minutes" value="{{ t.holding_minutes or 0 }}">
<input type="hidden" name="open_time" value="{{ t.open_time or '' }}">
<input type="hidden" name="close_time" value="{{ t.close_time or '' }}">
<input type="hidden" name="pnl" value="{{ t.pnl or '' }}">
<input type="hidden" name="result" value="{{ t.result }}">
<button type="submit" class="btn-verify" {% if t.verified %}disabled{% endif %}>{% if t.verified %}已核对{% else %}核对{% endif %}</button>
</form>
<a href="{{ url_for('del_trade', tid=t.id) }}" class="btn-del" onclick="return confirm('删除?')">删除</a>
</div>
<div class="records-mobile-item-foot">
<span class="records-mobile-pnl {{ 'is-profit' if t.pnl_net and t.pnl_net > 0 else ('is-loss' if t.pnl_net and t.pnl_net < 0 else 'is-flat') }}">
<span class="records-mobile-pnl-lbl">净盈亏 </span>{{ t.pnl_net if t.pnl_net is not none else '-' }}
</span>
<div class="records-trade-phone-foot">
<span class="records-mobile-chevron">详情 </span>
</div>
</button>
</div>
{% else %}
<p class="records-mobile-empty">暂无交易记录</p>
{% endfor %}