|
|
@@ -14,16 +14,15 @@
|
|
|
<el-radio :label="3" v-if="selectedRow.pricemode === 3">浮动价</el-radio>
|
|
|
</el-radio-group>
|
|
|
</el-form-item>
|
|
|
+ <el-form-item label="挂牌方向">
|
|
|
+ <span>{{ getBuyOrSellName(selectedRow.buyorsell) }}</span>
|
|
|
+ </el-form-item>
|
|
|
<el-form-item label="挂牌价格">
|
|
|
<span>{{ selectedRow.orderprice }}</span>
|
|
|
</el-form-item>
|
|
|
-
|
|
|
<el-form-item label="可摘数量">
|
|
|
<span>{{ selectedRow.orderqty }}</span>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="估算价格" v-if="priceMove === 3">
|
|
|
- <span>0.0</span>
|
|
|
- </el-form-item>
|
|
|
<el-form-item label="挂牌金额" v-if="priceMove === 2">
|
|
|
<span>{{ amount.toFixed(2) }}</span>
|
|
|
</el-form-item>
|
|
|
@@ -36,10 +35,13 @@
|
|
|
<el-form-item label="可用资金">
|
|
|
<span>{{ accountStore.currentAccount.avaiableMoney?.toFixed(2) }}</span>
|
|
|
</el-form-item>
|
|
|
+ <el-form-item v-if="priceMove === 3" prop="OrderPrice" label="摘牌价格">
|
|
|
+ <el-input-number placeholder="请输入" :min="0" :step="Math.pow(10, -1*(goods?.decimalplace ?? 0))" :precision="(goods?.decimalplace ?? 2)" v-model="formData.OrderPrice" @change="calculateDelistingAmount"/>
|
|
|
+ </el-form-item>
|
|
|
<el-form-item prop="OrderQty" label="摘牌数量">
|
|
|
<div class="g-qty-group">
|
|
|
- <el-input-number placeholder="请输入" :disabled="userStore.userType === 5" :min="0" :max="selectedRow.orderqty" :precision="0" :step="qtyStep"
|
|
|
- v-model="formData.OrderQty" />
|
|
|
+ <el-input-number placeholder="请输入" :min="0" :max="selectedRow.orderqty" :precision="0" :step="qtyStep"
|
|
|
+ v-model="formData.OrderQty" @change="calculateDelistingAmount"/>
|
|
|
<el-radio-group size="small" v-model="qtyStep" @change="onRadioChange" v-if="userStore.userType === 5">
|
|
|
<el-radio v-for="(value, index) in qtyStepList" :key="index" :label="value" border />
|
|
|
</el-radio-group>
|
|
|
@@ -59,7 +61,7 @@ import { shallowRef, PropType, computed } from 'vue'
|
|
|
import { ElMessage, FormInstance, FormRules, ElMessageBox } from 'element-plus'
|
|
|
import { handleRequestBigNumber } from '@/filters'
|
|
|
import { EBuildType, EDelistingType, EListingSelectType, EOrderOperateType, EPriceMode, EValidType } from '@/constants/client'
|
|
|
-import { BuyOrSell } from '@/constants/order'
|
|
|
+import { BuyOrSell, getBuyOrSellName } from '@/constants/order'
|
|
|
import { useOrder } from '@/business/trade'
|
|
|
import { useRequest } from '@/hooks/request'
|
|
|
import { queryTjmdTodayAccountMargin } from '@/services/api/swap'
|
|
|
@@ -80,25 +82,29 @@ const props = defineProps({
|
|
|
const accountStore = useAccountStore()
|
|
|
const userStore = useUserStore()
|
|
|
|
|
|
-
|
|
|
/// 价格类型
|
|
|
-const priceMove = shallowRef(EPriceMode.PRICEMODE_LIMIT)
|
|
|
+const priceMove = shallowRef(props.selectedRow.pricemode)
|
|
|
/// 挂牌金额
|
|
|
const amount = shallowRef(0.0)
|
|
|
/// 履约保证金
|
|
|
const permargin = shallowRef(0.0)
|
|
|
|
|
|
const { formData, formSubmit, loading } = useOrder()
|
|
|
+
|
|
|
const futuresStore = useFuturesStore()
|
|
|
const show = shallowRef(true)
|
|
|
const refresh = shallowRef(false)
|
|
|
const formRef = shallowRef<FormInstance>()
|
|
|
-const qtyStepList = [1, 5, 10, 20, 30, 50] // 数量步长列表
|
|
|
-const qtyStep = shallowRef(qtyStepList[0]) // 数量步长
|
|
|
+// 数量步长列表
|
|
|
+const qtyStepList = [1, 5, 10, 20, 30, 50]
|
|
|
+// 数量步长
|
|
|
+const qtyStep = shallowRef(qtyStepList[0])
|
|
|
/// 保证金配置
|
|
|
const margin = shallowRef<Model.TjmdTodayAccountMarginRsp>()
|
|
|
/// 商品信息
|
|
|
const goods = computed(() => futuresStore.getGoods(props.selectedRow.goodsid) )
|
|
|
+/// 默认价格为挂牌价格
|
|
|
+formData.OrderPrice = props.selectedRow.orderprice ?? 0.0
|
|
|
|
|
|
/// 查询交易保证金信息
|
|
|
useRequest(queryTjmdTodayAccountMargin, {
|
|
|
@@ -122,15 +128,17 @@ const calculateDelistingAmount = () => {
|
|
|
if (margin.value?.infoc) {
|
|
|
const { MarginAlgorithm, MarketMarginValue } = margin.value?.infoc
|
|
|
const { OrderQty = 0 } = formData
|
|
|
- const { orderprice } = props.selectedRow
|
|
|
+ const { OrderPrice = 0.0 } = formData
|
|
|
const { agreeunit = 0 } = goods.value ?? {}
|
|
|
/// 按比例
|
|
|
if (MarginAlgorithm === 1) {
|
|
|
- permargin.value = orderprice*OrderQty*agreeunit*MarketMarginValue
|
|
|
+ /// 价格*数量*合约单位*保证金比例
|
|
|
+ permargin.value = OrderPrice*OrderQty*agreeunit*MarketMarginValue
|
|
|
} else {
|
|
|
+ /// 数量*保证金值
|
|
|
permargin.value = OrderQty*MarketMarginValue
|
|
|
}
|
|
|
- amount.value = OrderQty*orderprice*agreeunit
|
|
|
+ amount.value = OrderQty*OrderPrice*agreeunit
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -145,6 +153,16 @@ const formRules: FormRules = {
|
|
|
}
|
|
|
}
|
|
|
}],
|
|
|
+ OrderPrice: [{
|
|
|
+ required: true,
|
|
|
+ validator: (rule, value, callback) => {
|
|
|
+ if (value) {
|
|
|
+ callback()
|
|
|
+ } else {
|
|
|
+ callback(new Error('请输入摘牌价格'))
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }],
|
|
|
}
|
|
|
|
|
|
const onRadioChange = (value: number) => {
|
|
|
@@ -162,17 +180,15 @@ const onSubmit = (buildType: number) => {
|
|
|
formRef.value?.validate((valid) => {
|
|
|
if (valid) {
|
|
|
ElMessageBox.confirm(
|
|
|
- '*若存在价格匹配的反方向委托订单,系统将会自动撤销。',
|
|
|
'是否立即摘牌?'
|
|
|
).then(() => {
|
|
|
- const { goodsid, orderid, orderprice, buyorsell } = props.selectedRow
|
|
|
+ const { goodsid, orderid, buyorsell } = props.selectedRow
|
|
|
const { marketid = 0 } = goods.value ?? {}
|
|
|
|
|
|
/// 获取对应的市场ID
|
|
|
formData.MarketID = marketid
|
|
|
- formData.PriceMode = EPriceMode.PRICEMODE_LIMIT
|
|
|
+ formData.PriceMode = priceMove.value === EPriceMode.PRICEMODE_LIMIT ? EPriceMode.PRICEMODE_LIMIT : EPriceMode.PRICEMODE_MARKET
|
|
|
formData.RelatedID = handleRequestBigNumber(orderid)
|
|
|
- formData.OrderPrice = orderprice
|
|
|
formData.BuyOrSell = buyorsell === BuyOrSell.Buy ? BuyOrSell.Sell : BuyOrSell.Buy
|
|
|
formData.GoodsID = goodsid
|
|
|
formData.ListingSelectType = EListingSelectType.LISTINGSELECTTYPE_DELISTING
|
|
|
@@ -180,7 +196,8 @@ const onSubmit = (buildType: number) => {
|
|
|
formData.BuildType = buildType
|
|
|
formData.TimevalidType = EValidType.VALIDTYPE_DR
|
|
|
formData.OperateType = EOrderOperateType.ORDEROPERATETYPE_NORMAL
|
|
|
-
|
|
|
+ formData.MarketMaxSub = priceMove.value === EPriceMode.PRICEMODE_LIMIT ? 0.0 : formData.MarketMaxSub
|
|
|
+
|
|
|
formSubmit().then(() => {
|
|
|
ElMessage.success('提交成功')
|
|
|
onCancel(true)
|