This commit is contained in:
aaron 2026-02-15 13:29:54 +08:00
parent cdbccefef7
commit 9f796d1efc

View File

@ -577,10 +577,10 @@
<!-- 活跃订单 -->
<div v-if="activeTab === 'active'">
<!-- 持仓汇总 -->
<div v-if="activeOrders.length > 0" class="position-summary">
<div v-if="openOrdersCount > 0" class="position-summary">
<div class="summary-item">
<span class="summary-label">持仓数量</span>
<span class="summary-value">{{ activeOrders.length }}</span>
<span class="summary-value">{{ openOrdersCount }}</span>
</div>
<div class="summary-item">
<span class="summary-label">总仓位</span>
@ -1051,14 +1051,24 @@
}
},
computed: {
// 总仓位
totalPosition() {
return this.activeOrders.reduce((sum, order) => sum + (order.quantity || 0), 0);
// 只计算已开仓的订单(不包括挂单)
openOrders() {
return this.activeOrders.filter(order => order.status === 'open');
},
// 总浮动盈亏
// 持仓数量(只计算已开仓)
openOrdersCount() {
return this.openOrders.length;
},
// 总仓位(只计算已开仓)
totalPosition() {
return this.openOrders.reduce((sum, order) => sum + (order.quantity || 0), 0);
},
// 总浮动盈亏(只计算已开仓)
totalUnrealizedPnl() {
return this.activeOrders.reduce((sum, order) => {
return this.openOrders.reduce((sum, order) => {
return sum + this.getUnrealizedPnl(order).pnl;
}, 0);
},