From 0069ae83575200f9f160c35a53f01f40e7526751 Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 1 Mar 2026 00:46:06 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=EF=BC=9A=E9=99=90=E4=BB=B7?= =?UTF-8?q?=E5=8D=95=E5=B7=B2=E7=BB=8F=E5=AE=8C=E6=88=90=E7=9A=84=E4=B8=8D?= =?UTF-8?q?=E5=8F=AF=E4=BB=A5=E6=92=A4=E6=B6=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/order.ts | 4 ++++ src/components/OrderBook.vue | 3 ++- src/views/TradeDetail.vue | 3 ++- src/views/Wallet.vue | 7 +++++-- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/api/order.ts b/src/api/order.ts index 0b6f453..7e50bb3 100644 --- a/src/api/order.ts +++ b/src/api/order.ts @@ -191,6 +191,8 @@ export interface OpenOrderDisplayItem { filledDisplay?: string orderID?: number tokenID?: string + /** 已成交数量达到原始总数量,不可撤单 */ + fullyFilled?: boolean } /** OrderType GTC=0 表示 Until Cancelled */ @@ -219,6 +221,7 @@ export function mapOrderToOpenOrderItem(order: ClobOrderItem): OpenOrderDisplayI const expiration = order.orderType === OrderType.GTC ? 'Until Cancelled' : order.expiration?.toString() ?? '' const actionLabel = sideNum === Side.Buy ? `Buy ${outcome}` : `Sell ${outcome}` + const fullyFilled = originalSize <= 0 || sizeMatched >= originalSize return { id, market, @@ -232,5 +235,6 @@ export function mapOrderToOpenOrderItem(order: ClobOrderItem): OpenOrderDisplayI filledDisplay: filled, orderID: order.ID, tokenID: order.assetID, + fullyFilled, } } diff --git a/src/components/OrderBook.vue b/src/components/OrderBook.vue index ff7680b..7bad62e 100644 --- a/src/components/OrderBook.vue +++ b/src/components/OrderBook.vue @@ -250,7 +250,8 @@ const bidsWithCumulativeTotal = computed(() => { return sortedBids.map((bid) => { // Calculate current bid's value - const bidValue = (bid.price * bid.shares) / 100 // Convert cents to dollars + console.log('bid.price', bid.price) + const bidValue = (bid.price * bid.shares) / 100.0 // Convert cents to dollars cumulativeTotal += bidValue return { ...bid, diff --git a/src/views/TradeDetail.vue b/src/views/TradeDetail.vue index 34e2692..4bb36be 100644 --- a/src/views/TradeDetail.vue +++ b/src/views/TradeDetail.vue @@ -108,7 +108,7 @@ variant="text" size="small" color="error" - :disabled="cancelOrderLoading" + :disabled="cancelOrderLoading || ord.fullyFilled" @click="cancelMarketOrder(ord)" > {{ t('activity.cancelOrder') }} @@ -993,6 +993,7 @@ async function loadMarketOpenOrders() { const cancelOrderLoading = ref(false) async function cancelMarketOrder(ord: OpenOrderDisplayItem) { + if (ord.fullyFilled) return const orderID = ord.orderID ?? 0 const tokenID = ord.tokenID ?? '' const uid = userStore.user?.id ?? userStore.user?.ID diff --git a/src/views/Wallet.vue b/src/views/Wallet.vue index bb5b620..a31be82 100644 --- a/src/views/Wallet.vue +++ b/src/views/Wallet.vue @@ -358,7 +358,7 @@ size="small" class="order-cancel-icon" color="error" - :disabled="cancelOrderLoading" + :disabled="cancelOrderLoading || ord.fullyFilled" @click.stop="cancelOrder(ord)" > mdi-close @@ -404,7 +404,7 @@ variant="text" size="small" color="error" - :disabled="cancelOrderLoading" + :disabled="cancelOrderLoading || ord.fullyFilled" @click="cancelOrder(ord)" >Cancel @@ -718,6 +718,8 @@ interface OpenOrder { /** 取消订单 API 用 */ orderID?: number tokenID?: string + /** 已成交数量达到原始总数量,不可撤单 */ + fullyFilled?: boolean } interface HistoryItem { id: string @@ -977,6 +979,7 @@ const cancelOrderLoading = ref(false) const cancelOrderError = ref('') const showCancelError = ref(false) async function cancelOrder(ord: OpenOrder) { + if (ord.fullyFilled) return const orderID = ord.orderID ?? 5 const tokenID = ord.tokenID ?? MOCK_TOKEN_ID const uid = userStore.user?.id ?? userStore.user?.ID