优化:限价单已经完成的不可以撤消
This commit is contained in:
parent
fffd7461df
commit
0069ae8357
@ -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,
|
||||
}
|
||||
}
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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
|
||||
|
||||
@ -358,7 +358,7 @@
|
||||
size="small"
|
||||
class="order-cancel-icon"
|
||||
color="error"
|
||||
:disabled="cancelOrderLoading"
|
||||
:disabled="cancelOrderLoading || ord.fullyFilled"
|
||||
@click.stop="cancelOrder(ord)"
|
||||
>
|
||||
<v-icon size="20">mdi-close</v-icon>
|
||||
@ -404,7 +404,7 @@
|
||||
variant="text"
|
||||
size="small"
|
||||
color="error"
|
||||
:disabled="cancelOrderLoading"
|
||||
:disabled="cancelOrderLoading || ord.fullyFilled"
|
||||
@click="cancelOrder(ord)"
|
||||
>Cancel</v-btn
|
||||
>
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user