feat(trade): wait on colleague order until status is final
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -251,6 +251,7 @@ import BasicButton from '@/components/BasicPacks/BasicButton.vue'
|
||||
import router from '@/router'
|
||||
import { useWalletStore } from '@/store/walletStore'
|
||||
import { createOrder } from '@/api/order'
|
||||
import { afterCreateOrder } from '@/composables/useColleagueOrderWait'
|
||||
import { message } from 'ant-design-vue'
|
||||
import type { Price } from '@/models/home'
|
||||
import { getLastPrice } from '@/api/home'
|
||||
@@ -790,7 +791,7 @@ async function ok() {
|
||||
loading.value = true
|
||||
await nextTick()
|
||||
infoVisible.value = true
|
||||
await createOrder({
|
||||
const res = await createOrder({
|
||||
direction: isBuy.value ? 1 : 2,
|
||||
price: Math.round(unitPrice.value),
|
||||
amount: normalizeOrderGoldAmount(orderGoldAmount.value),
|
||||
@@ -798,17 +799,16 @@ async function ok() {
|
||||
target_cash: calcTradeTargetCash(form.value.goldCash, inputLock.value),
|
||||
abshode_id: props.ProductItem?.id,
|
||||
})
|
||||
await walletStore.getMyWallet()
|
||||
await loadWalletAssets(true)
|
||||
await router.push({ name: 'transactions' })
|
||||
const result = await afterCreateOrder(res)
|
||||
if (result !== 'success') {
|
||||
return
|
||||
}
|
||||
form.value = {
|
||||
goldValue: undefined,
|
||||
goldCash: undefined,
|
||||
percentWallet: 0,
|
||||
}
|
||||
inputLock.value = null
|
||||
message.success('سفارش شما با موفقیت انجام شد')
|
||||
await fundStore.getMyFund()
|
||||
} catch (e) {
|
||||
// console.log(e)
|
||||
// await initPrice()
|
||||
|
||||
@@ -252,6 +252,7 @@ import BasicButton from '@/components/BasicPacks/BasicButton.vue'
|
||||
import router from '@/router'
|
||||
import { useWalletStore } from '@/store/walletStore'
|
||||
import { createOrder } from '@/api/order'
|
||||
import { afterCreateOrder } from '@/composables/useColleagueOrderWait'
|
||||
import { FormInstance, message } from 'ant-design-vue'
|
||||
import type { Price } from '@/models/home'
|
||||
import Icon from '@/components/BasicPacks/BasicIcon.vue'
|
||||
@@ -734,9 +735,10 @@ async function ok() {
|
||||
window.location.href = returnUrl
|
||||
return // Stop execution here
|
||||
}
|
||||
// If no gateway, continue with normal flow
|
||||
await walletStore.getMyWallet()
|
||||
await router.push({ name: 'transactions' })
|
||||
const result = await afterCreateOrder(data)
|
||||
if (result !== 'success') {
|
||||
return
|
||||
}
|
||||
form.value = {
|
||||
goldValue: undefined,
|
||||
goldCash: undefined,
|
||||
@@ -744,9 +746,6 @@ async function ok() {
|
||||
method: 'cash',
|
||||
gateway: false
|
||||
}
|
||||
// refreshTable()
|
||||
message.success('سفارش شما با موفقیت انجام شد')
|
||||
await loadWalletAssets(true)
|
||||
} catch (e) {
|
||||
// console.log(e)
|
||||
// await initPrice()
|
||||
|
||||
Reference in New Issue
Block a user