This commit is contained in:
aaron 2026-03-29 18:33:24 +08:00
parent ba45ccd712
commit eb5edf919c

View File

@ -421,6 +421,7 @@
</td>
<td>
<button class="btn btn-danger btn-small" @click="closeOrder(order)">平仓</button>
<button v-if="adminMode" class="btn btn-secondary btn-small" @click="deleteOrder(order)" style="margin-left: 4px;">删除</button>
</td>
</tr>
</tbody>
@ -479,6 +480,7 @@
<th>收益率</th>
<th>状态</th>
<th>时间</th>
<th v-if="adminMode">操作</th>
</tr>
</thead>
<tbody>
@ -504,6 +506,9 @@
</span>
</td>
<td>{{ formatTime(order.closed_at) }}</td>
<td v-if="adminMode">
<button class="btn btn-danger btn-small" @click="deleteOrder(order)">删除</button>
</td>
</tr>
</tbody>
</table>
@ -784,6 +789,23 @@
}
},
async deleteOrder(order) {
if (!confirm('确定要删除该订单吗?此操作不可恢复!')) return;
try {
const response = await axios.delete(`/api/trading/orders/${order.order_id}`);
if (response.data.success) {
await this.refreshData();
alert('订单删除成功');
} else {
alert('删除失败: ' + (response.data.message || '未知错误'));
}
} catch (error) {
console.error('删除订单失败:', error);
alert('删除失败: ' + (error.response?.data?.detail || error.message));
}
},
async resetAccount() {
if (!confirm('确定要重置账户吗?这将清除所有持仓和订单!')) return;