This commit is contained in:
aaron 2026-02-23 00:17:39 +08:00
parent 5a5ce5ada4
commit a9f0aa0717

View File

@ -448,9 +448,9 @@
<div class="tabs"> <div class="tabs">
<button <button
class="tab" class="tab"
:class="{ active: currentTab === 'active' }" :class="{ active: currentTab === 'positions' }"
@click="currentTab = 'active'"> @click="currentTab = 'positions'">
活跃订单 ({{ activeOrders.length }}) 交易所持仓 ({{ exchangePositions.length }})
</button> </button>
<button <button
class="tab" class="tab"
@ -458,12 +458,6 @@
@click="currentTab = 'history'"> @click="currentTab = 'history'">
历史订单 历史订单
</button> </button>
<button
class="tab"
:class="{ active: currentTab === 'positions' }"
@click="currentTab = 'positions'">
交易所持仓
</button>
</div> </div>
<!-- 订单列表 --> <!-- 订单列表 -->
@ -473,11 +467,11 @@
<p style="margin-top: 12px;">加载中...</p> <p style="margin-top: 12px;">加载中...</p>
</div> </div>
<div v-else-if="currentTab === 'active' && activeOrders.length === 0" class="empty-state"> <div v-else-if="currentTab === 'positions' && exchangePositions.length === 0" class="empty-state">
<svg fill="none" viewBox="0 0 24 24" stroke="currentColor"> <svg fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" /> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" />
</svg> </svg>
<p>暂无活跃订单</p> <p>暂无持仓</p>
</div> </div>
<div v-else-if="currentTab === 'history' && historyOrders.length === 0" class="empty-state"> <div v-else-if="currentTab === 'history' && historyOrders.length === 0" class="empty-state">
@ -487,13 +481,6 @@
<p>暂无历史订单</p> <p>暂无历史订单</p>
</div> </div>
<div v-else-if="currentTab === 'positions' && exchangePositions.length === 0" class="empty-state">
<svg fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" />
</svg>
<p>暂无持仓</p>
</div>
<table class="orders-table" v-else> <table class="orders-table" v-else>
<thead> <thead>
<tr v-if="currentTab === 'positions'"> <tr v-if="currentTab === 'positions'">
@ -596,7 +583,7 @@
createApp({ createApp({
data() { data() {
return { return {
currentTab: 'active', currentTab: 'positions',
loading: false, loading: false,
serviceEnabled: false, serviceEnabled: false,
apiConfigured: false, apiConfigured: false,
@ -608,7 +595,6 @@
total_position_value: 0 total_position_value: 0
}, },
stats: null, stats: null,
activeOrders: [],
historyOrders: [], historyOrders: [],
exchangePositions: [], exchangePositions: [],
autoRefreshInterval: null autoRefreshInterval: null
@ -616,7 +602,6 @@
}, },
computed: { computed: {
displayOrders() { displayOrders() {
if (this.currentTab === 'active') return this.activeOrders;
if (this.currentTab === 'history') return this.historyOrders; if (this.currentTab === 'history') return this.historyOrders;
if (this.currentTab === 'positions') return this.exchangePositions; if (this.currentTab === 'positions') return this.exchangePositions;
return []; return [];
@ -630,7 +615,6 @@
this.fetchServiceStatus(), this.fetchServiceStatus(),
this.fetchAccountStatus(), this.fetchAccountStatus(),
this.fetchStats(), this.fetchStats(),
this.fetchActiveOrders(),
this.fetchHistoryOrders(), this.fetchHistoryOrders(),
this.fetchExchangePositions() this.fetchExchangePositions()
]); ]);
@ -678,17 +662,6 @@
} }
}, },
async fetchActiveOrders() {
try {
const response = await axios.get('/api/real-trading/orders/active');
if (response.data.success) {
this.activeOrders = response.data.orders;
}
} catch (error) {
console.error('获取活跃订单失败:', error);
}
},
async fetchHistoryOrders() { async fetchHistoryOrders() {
try { try {
const response = await axios.get('/api/real-trading/orders?status=closed&limit=50'); const response = await axios.get('/api/real-trading/orders?status=closed&limit=50');