|
|
@@ -22,7 +22,7 @@
|
|
|
<el-form-item prop="OrderPrice" label="价格">
|
|
|
<div class="el-form-item--col">
|
|
|
<el-input-number ref="priceRef" placeholder="请输入" :min="0" :step="priceStep"
|
|
|
- :precision="selectedGoods?.decimalplace" v-model="formData.OrderPrice"
|
|
|
+ :precision="selectedGoods?.decimalplace" :disabled="orderPriceType === 3" v-model="orderPrice"
|
|
|
@keyup.enter="qtyInputFocus" />
|
|
|
<div v-if="selectedGoods">
|
|
|
<div class="row-price g-price-up">
|
|
|
@@ -45,31 +45,31 @@
|
|
|
</el-radio-group>
|
|
|
</div>
|
|
|
</el-form-item>
|
|
|
+ <el-form-item>
|
|
|
+ <template v-if="formData.BuyOrSell === BuyOrSell.Buy">
|
|
|
+ <el-button ref="submitRef" type="primary" :loading="loading"
|
|
|
+ :disabled="!selectedGoodsId || !formData.OrderQty"
|
|
|
+ @click="onSubmit(EBuildType.BUILDTYPE_OPEN)">订立</el-button>
|
|
|
+ <el-button type="primary" :loading="loading"
|
|
|
+ :disabled="!formData.OrderQty || !sellQty || (formData.OrderQty > sellQty)"
|
|
|
+ @click="onSubmit(EBuildType.BUILDTYPE_CLOSE)">
|
|
|
+ <span>转让</span>
|
|
|
+ <span v-if="sellQty">(≤{{ sellQty }})</span>
|
|
|
+ </el-button>
|
|
|
+ </template>
|
|
|
+ <template v-if="formData.BuyOrSell === BuyOrSell.Sell">
|
|
|
+ <el-button ref="submitRef" type="primary" :loading="loading"
|
|
|
+ :disabled="!selectedGoodsId || !formData.OrderQty"
|
|
|
+ @click="onSubmit(EBuildType.BUILDTYPE_OPEN)">订立</el-button>
|
|
|
+ <el-button type="primary" :loading="loading"
|
|
|
+ :disabled="!formData.OrderQty || !buyQty || (formData.OrderQty > buyQty)"
|
|
|
+ @click="onSubmit(EBuildType.BUILDTYPE_CLOSE)">
|
|
|
+ <span>转让</span>
|
|
|
+ <span v-if="buyQty">(≤{{ buyQty }})</span>
|
|
|
+ </el-button>
|
|
|
+ </template>
|
|
|
+ </el-form-item>
|
|
|
</el-form>
|
|
|
- <div class="footer-btnbar">
|
|
|
- <template v-if="formData.BuyOrSell === BuyOrSell.Buy">
|
|
|
- <el-button ref="submitRef" type="primary" :loading="loading"
|
|
|
- :disabled="!selectedGoodsId || !formData.OrderQty"
|
|
|
- @click="onSubmit(EBuildType.BUILDTYPE_OPEN)">订立买入</el-button>
|
|
|
- <el-button type="primary" :loading="loading"
|
|
|
- :disabled="!formData.OrderQty || !sellQty || (formData.OrderQty > sellQty)"
|
|
|
- @click="onSubmit(EBuildType.BUILDTYPE_CLOSE)">
|
|
|
- <span>转让买入</span>
|
|
|
- <span v-if="sellQty">(≤{{ sellQty }})</span>
|
|
|
- </el-button>
|
|
|
- </template>
|
|
|
- <template v-if="formData.BuyOrSell === BuyOrSell.Sell">
|
|
|
- <el-button ref="submitRef" type="primary" :loading="loading"
|
|
|
- :disabled="!selectedGoodsId || !formData.OrderQty"
|
|
|
- @click="onSubmit(EBuildType.BUILDTYPE_OPEN)">订立卖出</el-button>
|
|
|
- <el-button type="primary" :loading="loading"
|
|
|
- :disabled="!formData.OrderQty || !buyQty || (formData.OrderQty > buyQty)"
|
|
|
- @click="onSubmit(EBuildType.BUILDTYPE_CLOSE)">
|
|
|
- <span>转让卖出</span>
|
|
|
- <span v-if="buyQty">(≤{{ buyQty }})</span>
|
|
|
- </el-button>
|
|
|
- </template>
|
|
|
- </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
@@ -81,10 +81,11 @@ import { EPriceMode, EListingSelectType, EDelistingType, EBuildType, EValidType,
|
|
|
import { BuyOrSell, getBuyOrSellList } from '@/constants/order'
|
|
|
import { useOrder } from '@/business/trade'
|
|
|
import { usePosition } from '@/business/position'
|
|
|
-import { useFuturesStore } from '@/stores'
|
|
|
+import { useFuturesStore, useSettingStore } from '@/stores'
|
|
|
import Forex from '@pc/components/modules/quote/forex/index.vue'
|
|
|
import Icon from '@pc/components/base/icon/index.vue'
|
|
|
|
|
|
+const settingStore = useSettingStore()
|
|
|
const futuresStore = useFuturesStore()
|
|
|
const { selectedGoodsId, selectedGoods, marketGoodsList } = futuresStore.$toRefs()
|
|
|
const { formData, loading, formSubmit } = useOrder()
|
|
|
@@ -112,6 +113,32 @@ const buyQty = computed(() => getOrderQty(BuyOrSell.Buy, selectedGoodsId.value))
|
|
|
// 卖方向持仓数量
|
|
|
const sellQty = computed(() => getOrderQty(BuyOrSell.Sell, selectedGoodsId.value))
|
|
|
|
|
|
+// 价格类型
|
|
|
+const orderPriceType = computed(() => settingStore.getSettingValue('orderPriceType'))
|
|
|
+
|
|
|
+// 订单价格
|
|
|
+const orderPrice = computed({
|
|
|
+ get: () => {
|
|
|
+ const { last, bid, ask, presettle = 0 } = selectedGoods.value ?? {}
|
|
|
+ // 1=现价,2=对手价,3=实时价
|
|
|
+ switch (orderPriceType.value) {
|
|
|
+ case 2:
|
|
|
+ if (formData.BuyOrSell === BuyOrSell.Buy) {
|
|
|
+ return ask || last || presettle
|
|
|
+ } else {
|
|
|
+ return bid || last || presettle
|
|
|
+ }
|
|
|
+ case 3:
|
|
|
+ return last || presettle
|
|
|
+ default:
|
|
|
+ return formData.OrderPrice
|
|
|
+ }
|
|
|
+ },
|
|
|
+ set: (val) => {
|
|
|
+ formData.OrderPrice = val
|
|
|
+ }
|
|
|
+})
|
|
|
+
|
|
|
const formRules: FormRules = {
|
|
|
OrderPrice: [{
|
|
|
required: true,
|
|
|
@@ -186,7 +213,12 @@ const onSubmit = (buildType: number) => {
|
|
|
}).catch((err) => {
|
|
|
ElMessage.error('挂牌失败:' + err)
|
|
|
}).finally(() => {
|
|
|
- priceInputFocus()
|
|
|
+ const focusType = settingStore.getSettingValue('orderFocusType')
|
|
|
+ if (focusType === 2 || orderPriceType.value === 3) {
|
|
|
+ qtyInputFocus()
|
|
|
+ } else {
|
|
|
+ priceInputFocus()
|
|
|
+ }
|
|
|
})
|
|
|
})
|
|
|
}
|