|
@@ -8,11 +8,13 @@
|
|
|
<script lang="ts" setup>
|
|
<script lang="ts" setup>
|
|
|
import { shallowRef, onMounted, PropType } from 'vue'
|
|
import { shallowRef, onMounted, PropType } from 'vue'
|
|
|
import { Dialog } from 'vant'
|
|
import { Dialog } from 'vant'
|
|
|
-import { useHolderClose } from '@/business/trade'
|
|
|
|
|
|
|
+import { useOrder } from '@/business/trade'
|
|
|
import { handleRequestBigNumber } from '@/filters'
|
|
import { handleRequestBigNumber } from '@/filters'
|
|
|
import { fullloading } from '@/utils/vant'
|
|
import { fullloading } from '@/utils/vant'
|
|
|
import { i18n } from '@/stores'
|
|
import { i18n } from '@/stores'
|
|
|
-
|
|
|
|
|
|
|
+import { EPriceMode, EValidType, EBuildType, EOrderOperateType } from '@/constants/client'
|
|
|
|
|
+import { BuyOrSell } from '@/constants/order'
|
|
|
|
|
+import { useUserStore } from '@/stores'
|
|
|
|
|
|
|
|
const props = defineProps({
|
|
const props = defineProps({
|
|
|
selectedRow: {
|
|
selectedRow: {
|
|
@@ -21,11 +23,12 @@ const props = defineProps({
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
-const { holderCloseSubmit, formData } = useHolderClose()
|
|
|
|
|
|
|
+const { formData, formSubmit } = useOrder()
|
|
|
const emit = defineEmits(['closed'])
|
|
const emit = defineEmits(['closed'])
|
|
|
const { global: { t } } = i18n
|
|
const { global: { t } } = i18n
|
|
|
const showDialog = shallowRef(false)
|
|
const showDialog = shallowRef(false)
|
|
|
const refresh = shallowRef(false) // 是否刷新父组件数据
|
|
const refresh = shallowRef(false) // 是否刷新父组件数据
|
|
|
|
|
+const userStore = useUserStore()
|
|
|
|
|
|
|
|
const onBeforeClose = (action: string) => {
|
|
const onBeforeClose = (action: string) => {
|
|
|
if (action === 'confirm') {
|
|
if (action === 'confirm') {
|
|
@@ -41,21 +44,31 @@ const onClosed = () => {
|
|
|
|
|
|
|
|
const marketClose = () => {
|
|
const marketClose = () => {
|
|
|
|
|
|
|
|
- const { marketID, goodsID, buyOrSell, tradeID } = props.selectedRow.tHDetailEx
|
|
|
|
|
- formData.Header = { MarketID: marketID }
|
|
|
|
|
- formData.GoodsID = goodsID
|
|
|
|
|
- formData.BuyOrSell = buyOrSell
|
|
|
|
|
- formData.MarketID = marketID
|
|
|
|
|
- formData.TradeID = handleRequestBigNumber(tradeID)
|
|
|
|
|
- /// loding....
|
|
|
|
|
- fullloading((hideLoading) => {
|
|
|
|
|
- holderCloseSubmit().then(() => {
|
|
|
|
|
- hideLoading(t('position.swap.tips2'))
|
|
|
|
|
- onClosed()
|
|
|
|
|
- }).catch((err) => {
|
|
|
|
|
- hideLoading(err, 'fail')
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ const { tHDetailEx, agreeUnit } = props.selectedRow ?? {}
|
|
|
|
|
+ const { marketID, goodsID, holderQty } = tHDetailEx
|
|
|
|
|
+
|
|
|
|
|
+ /// 获取对应的市场ID
|
|
|
|
|
+ formData.Header = { GoodsID: goodsID, MarketID: marketID }
|
|
|
|
|
+ formData.MarketID = marketID
|
|
|
|
|
+ formData.PriceMode = EPriceMode.PRICEMODE_MARKET
|
|
|
|
|
+ formData.GoodsID = goodsID
|
|
|
|
|
+ formData.TimevalidType = EValidType.VALIDTYPE_DR
|
|
|
|
|
+ formData.OperateType = EOrderOperateType.ORDEROPERATETYPE_HOLDER_CLOSE
|
|
|
|
|
+ formData.BuildType = EBuildType.BUILDTYPE_CLOSE
|
|
|
|
|
+ formData.OrderQty = holderQty / agreeUnit // 数量÷合约乘数
|
|
|
|
|
+ formData.RelatedID = handleRequestBigNumber(tHDetailEx.tradeID) // 关联单号
|
|
|
|
|
+ formData.BuyOrSell = tHDetailEx.buyOrSell === BuyOrSell.Buy ? BuyOrSell.Sell : BuyOrSell.Buy // 持仓反方向
|
|
|
|
|
+ const param112 = userStore.getSystemParamValue('112')
|
|
|
|
|
+ formData.MarketMaxSub = Number(param112) || 100
|
|
|
|
|
+
|
|
|
|
|
+ fullloading((hideLoading) => {
|
|
|
|
|
+ formSubmit().then(() => {
|
|
|
|
|
+ hideLoading('提交成功', 'success')
|
|
|
|
|
+ onClosed()
|
|
|
|
|
+ }).catch((err) => {
|
|
|
|
|
+ hideLoading(err, 'fail')
|
|
|
})
|
|
})
|
|
|
|
|
+ })
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
onMounted(() => {
|
|
onMounted(() => {
|