|
@@ -28,6 +28,20 @@
|
|
|
{{ formatDecimal(position.closepl, position.decimalplace) }}
|
|
{{ formatDecimal(position.closepl, position.decimalplace) }}
|
|
|
</span>
|
|
</span>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
|
|
+ <el-form-item prop="PriceMode" :label="t('quote.pricing.pricemode')">
|
|
|
|
|
+ <el-radio-group v-model="formData.PriceMode">
|
|
|
|
|
+ <el-radio v-for="(item, index) in getPricemode2List()" :key="index" :label="item.value">
|
|
|
|
|
+ {{ item.label }}
|
|
|
|
|
+ </el-radio>
|
|
|
|
|
+ </el-radio-group>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item prop="MarketMaxSub" :label="t('quote.pricing.marketmaxsub')" v-if="formData.PriceMode === PriceMode.Market">
|
|
|
|
|
+ <el-input-number ref="priceRef" :placeholder="t('common.pleaseenter')" :min="0" :max="999" v-model="formData.MarketMaxSub" />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item prop="OrderPrice" :label="t('position.transfer.transferprice')" v-if="formData.PriceMode === PriceMode.Limit">
|
|
|
|
|
+ <el-input-number :placeholder="t('position.transfer.tips3')" v-model="formData.OrderPrice" :step="decimalvalue"
|
|
|
|
|
+ :precision="decimalplace" />
|
|
|
|
|
+ </el-form-item>
|
|
|
<el-form-item prop="OrderQty" :label="t('position.transfer.transferqty')">
|
|
<el-form-item prop="OrderQty" :label="t('position.transfer.transferqty')">
|
|
|
<div class="g-qty-group">
|
|
<div class="g-qty-group">
|
|
|
<el-input-number :placeholder="t('position.transfer.tips4')" v-model="formData.OrderQty" :precision="0"
|
|
<el-input-number :placeholder="t('position.transfer.tips4')" v-model="formData.OrderQty" :precision="0"
|
|
@@ -40,10 +54,6 @@
|
|
|
</el-radio-group>
|
|
</el-radio-group>
|
|
|
</div>
|
|
</div>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
- <el-form-item prop="OrderPrice" :label="t('position.transfer.transferprice')">
|
|
|
|
|
- <el-input-number :placeholder="t('position.transfer.tips3')" v-model="formData.OrderPrice" :step="decimalvalue"
|
|
|
|
|
- :precision="decimalplace" />
|
|
|
|
|
- </el-form-item>
|
|
|
|
|
</el-form>
|
|
</el-form>
|
|
|
<template #footer>
|
|
<template #footer>
|
|
|
<el-button type="info" @click="onCancel(false)">{{ t('operation.cancel') }}</el-button>
|
|
<el-button type="info" @click="onCancel(false)">{{ t('operation.cancel') }}</el-button>
|
|
@@ -53,12 +63,12 @@
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts" setup>
|
|
<script lang="ts" setup>
|
|
|
-import { ref, PropType, onMounted } from 'vue'
|
|
|
|
|
|
|
+import { ref, PropType, onMounted, computed } from 'vue'
|
|
|
import { ElMessage, FormInstance, FormRules } from 'element-plus'
|
|
import { ElMessage, FormInstance, FormRules } from 'element-plus'
|
|
|
import { useOrder } from '@/business/trade'
|
|
import { useOrder } from '@/business/trade'
|
|
|
import { formatDecimal, parsePercent } from '@/filters'
|
|
import { formatDecimal, parsePercent } from '@/filters'
|
|
|
-import { getBuyOrSellName, BuyOrSell } from '@/constants/order'
|
|
|
|
|
-import { useFuturesStore, i18n } from '@/stores'
|
|
|
|
|
|
|
+import { getBuyOrSellName, BuyOrSell, getPricemode2List, PriceMode } from '@/constants/order'
|
|
|
|
|
+import { useFuturesStore, i18n, useSettingStore } from '@/stores'
|
|
|
import { EBuildType, EDelistingType, EListingSelectType, EOrderOperateType, EPriceMode, EValidType } from '@/constants/client'
|
|
import { EBuildType, EDelistingType, EListingSelectType, EOrderOperateType, EPriceMode, EValidType } from '@/constants/client'
|
|
|
import AppDrawer from '@pc/components/base/drawer/index.vue'
|
|
import AppDrawer from '@pc/components/base/drawer/index.vue'
|
|
|
|
|
|
|
@@ -73,6 +83,10 @@ const props = defineProps({
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
const futuresStore = useFuturesStore()
|
|
const futuresStore = useFuturesStore()
|
|
|
|
|
+const settingStore = useSettingStore()
|
|
|
|
|
+
|
|
|
|
|
+// 价格类型
|
|
|
|
|
+const orderPriceType = computed(() => settingStore.getSettingValue('orderPriceType'))
|
|
|
const quote = futuresStore.getGoodsQuote(props.position.goodscode)
|
|
const quote = futuresStore.getGoodsQuote(props.position.goodscode)
|
|
|
const { decimalplace = 0 } = quote.value ?? {}
|
|
const { decimalplace = 0 } = quote.value ?? {}
|
|
|
const quoteminunit = quote.value?.quoteminunit ?? 1
|
|
const quoteminunit = quote.value?.quoteminunit ?? 1
|
|
@@ -92,6 +106,16 @@ const formRules: FormRules = {
|
|
|
return !!formData.OrderPrice
|
|
return !!formData.OrderPrice
|
|
|
}
|
|
}
|
|
|
}],
|
|
}],
|
|
|
|
|
+ MarketMaxSub: [{
|
|
|
|
|
+ type: 'number',
|
|
|
|
|
+ validator: (rule, value, callback) => {
|
|
|
|
|
+ if (value) {
|
|
|
|
|
+ callback()
|
|
|
|
|
+ } else {
|
|
|
|
|
+ callback(new Error(t('quote.pricing.tips3')))
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }],
|
|
|
OrderQty: [{
|
|
OrderQty: [{
|
|
|
message: t('position.transfer.tips4'),
|
|
message: t('position.transfer.tips4'),
|
|
|
validator: () => {
|
|
validator: () => {
|
|
@@ -105,6 +129,31 @@ const onCancel = (isRefresh = false) => {
|
|
|
refresh.value = isRefresh
|
|
refresh.value = isRefresh
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+const getOrderPrice = () => {
|
|
|
|
|
+ const { last, bid, ask, presettle = 0 } = quote.value ?? {}
|
|
|
|
|
+ const price = last || presettle
|
|
|
|
|
+ // 1=现价,2=对手价,3=实时价,4=实时对手价
|
|
|
|
|
+ switch (orderPriceType.value) {
|
|
|
|
|
+ case 1:
|
|
|
|
|
+ case 3:
|
|
|
|
|
+ return price
|
|
|
|
|
+ case 2:
|
|
|
|
|
+ case 4:
|
|
|
|
|
+ if (formData.BuyOrSell === BuyOrSell.Buy) {
|
|
|
|
|
+ return ask || price
|
|
|
|
|
+ } else {
|
|
|
|
|
+ return bid || price
|
|
|
|
|
+ }
|
|
|
|
|
+ default:
|
|
|
|
|
+ return 0
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+const marketPrice = computed(() => {
|
|
|
|
|
+ const { ask = 0, bid = 0 } = quote.value ?? {}
|
|
|
|
|
+ return formData.BuyOrSell === BuyOrSell.Buy ? ask : bid
|
|
|
|
|
+})
|
|
|
|
|
+
|
|
|
const onCloseSumit = () => {
|
|
const onCloseSumit = () => {
|
|
|
formRef.value?.validate((valid) => {
|
|
formRef.value?.validate((valid) => {
|
|
|
if (valid) {
|
|
if (valid) {
|
|
@@ -112,7 +161,7 @@ const onCloseSumit = () => {
|
|
|
/// 市场ID
|
|
/// 市场ID
|
|
|
formData.Header = { GoodsID: goodsid }
|
|
formData.Header = { GoodsID: goodsid }
|
|
|
formData.MarketID = marketid
|
|
formData.MarketID = marketid
|
|
|
- formData.PriceMode = EPriceMode.PRICEMODE_LIMIT
|
|
|
|
|
|
|
+ if (formData.PriceMode === PriceMode.Market) { formData.OrderPrice = marketPrice.value }
|
|
|
formData.BuyOrSell = buyorsell === BuyOrSell.Buy ? BuyOrSell.Sell : BuyOrSell.Buy
|
|
formData.BuyOrSell = buyorsell === BuyOrSell.Buy ? BuyOrSell.Sell : BuyOrSell.Buy
|
|
|
formData.GoodsID = goodsid
|
|
formData.GoodsID = goodsid
|
|
|
formData.ListingSelectType = EListingSelectType.LISTINGSELECTTYPE_DELISTINGTHENLISTING
|
|
formData.ListingSelectType = EListingSelectType.LISTINGSELECTTYPE_DELISTINGTHENLISTING
|
|
@@ -147,6 +196,9 @@ onMounted(() => {
|
|
|
default:
|
|
default:
|
|
|
formData.OrderPrice = last || presettle
|
|
formData.OrderPrice = last || presettle
|
|
|
}
|
|
}
|
|
|
|
|
+ formData.OrderPrice = getOrderPrice()
|
|
|
formData.OrderQty = props.position.enableqty
|
|
formData.OrderQty = props.position.enableqty
|
|
|
|
|
+ formData.PriceMode = PriceMode.Market
|
|
|
|
|
+ formData.MarketMaxSub = 100.0
|
|
|
})
|
|
})
|
|
|
</script>
|
|
</script>
|