|
@@ -0,0 +1,77 @@
|
|
|
|
|
+<!-- 挂牌点价-持仓明细-一键退订 -->
|
|
|
|
|
+<template>
|
|
|
|
|
+ <app-drawer :title="t('common.tips')" v-model:show="show" :loading="loading" :refresh="refresh">
|
|
|
|
|
+ <div class="g-text-message">是否退订全部订单?</div>
|
|
|
|
|
+ <template #footer>
|
|
|
|
|
+ <el-button type="info" @click="onCancel(false)">{{ t('operation.cancel') }}</el-button>
|
|
|
|
|
+ <el-button type="primary" @click="onSubmit">{{ t('operation.confirm') }}</el-button>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </app-drawer>
|
|
|
|
|
+</template>
|
|
|
|
|
+
|
|
|
|
|
+<script lang="ts" setup>
|
|
|
|
|
+import { ref } from 'vue'
|
|
|
|
|
+import { ElMessage } from 'element-plus'
|
|
|
|
|
+import { handleRequestBigNumber } from '@/filters'
|
|
|
|
|
+import { EBuildType, EDelistingType, EListingSelectType, EValidType, EOrderOperateType } from '@/constants/client'
|
|
|
|
|
+import { BuyOrSell, PriceMode } from '@/constants/order'
|
|
|
|
|
+import { useOrder } from '@/business/trade'
|
|
|
|
|
+import { i18n, useSBYJOrderStore, useFuturesStore } from '@/stores'
|
|
|
|
|
+import AppDrawer from '@pc/components/base/drawer/index.vue'
|
|
|
|
|
+
|
|
|
|
|
+const { t } = i18n.global
|
|
|
|
|
+
|
|
|
|
|
+const sbyjOrderStore = useSBYJOrderStore()
|
|
|
|
|
+const futuresStore = useFuturesStore()
|
|
|
|
|
+const show = ref(true)
|
|
|
|
|
+const refresh = ref(false)
|
|
|
|
|
+const loading = ref(false)
|
|
|
|
|
+
|
|
|
|
|
+const { formSubmit, formData } = useOrder()
|
|
|
|
|
+
|
|
|
|
|
+const onCancel = (isRefresh = false) => {
|
|
|
|
|
+ show.value = false
|
|
|
|
|
+ refresh.value = isRefresh
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+const onSubmit = async () => {
|
|
|
|
|
+ loading.value = true
|
|
|
|
|
+ const list = sbyjOrderStore.orderComputedList
|
|
|
|
|
+ const errMessage: string[] = []
|
|
|
|
|
+
|
|
|
|
|
+ for (let i = 0; i < list.length; i++) {
|
|
|
|
|
+ const { holderQty, freezeQty, marketID, goodsID, buyOrSell, tradeID } = list[i].tHDetailEx
|
|
|
|
|
+ const enableQty = holderQty - freezeQty // 可用数量
|
|
|
|
|
+ const quote = futuresStore.getGoodsQuote(list[i].goodsCode)
|
|
|
|
|
+
|
|
|
|
|
+ if (quote.value && enableQty) {
|
|
|
|
|
+ formData.Header = { MarketID: marketID, GoodsID: goodsID }
|
|
|
|
|
+ formData.MarketID = marketID
|
|
|
|
|
+ formData.GoodsID = goodsID
|
|
|
|
|
+ formData.PriceMode = PriceMode.Market
|
|
|
|
|
+ formData.BuyOrSell = buyOrSell === BuyOrSell.Buy ? BuyOrSell.Sell : BuyOrSell.Buy
|
|
|
|
|
+ formData.OrderPrice = buyOrSell === BuyOrSell.Buy ? quote.value.ask : quote.value.bid
|
|
|
|
|
+ formData.ListingSelectType = EListingSelectType.LISTINGSELECTTYPE_DELISTINGTHENLISTING
|
|
|
|
|
+ formData.DelistingType = EDelistingType.DELISTINGTYPE_PRICE
|
|
|
|
|
+ formData.BuildType = EBuildType.BUILDTYPE_CLOSE
|
|
|
|
|
+ formData.TimevalidType = EValidType.VALIDTYPE_DR
|
|
|
|
|
+ formData.OperateType = EOrderOperateType.ORDEROPERATETYPE_HOLDER_CLOSE
|
|
|
|
|
+ formData.RelatedID = handleRequestBigNumber(tradeID)
|
|
|
|
|
+ formData.OrderQty = enableQty
|
|
|
|
|
+
|
|
|
|
|
+ await formSubmit().catch((err) => {
|
|
|
|
|
+ errMessage.push(err)
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ loading.value = false
|
|
|
|
|
+
|
|
|
|
|
+ if (errMessage.length) {
|
|
|
|
|
+ ElMessage.error(t('common.tips5') + errMessage[0])
|
|
|
|
|
+ } else {
|
|
|
|
|
+ ElMessage.success(t('common.tips4'))
|
|
|
|
|
+ }
|
|
|
|
|
+ onCancel(true)
|
|
|
|
|
+}
|
|
|
|
|
+</script>
|