|
@@ -22,12 +22,12 @@
|
|
|
<template #input>
|
|
<template #input>
|
|
|
<div class="g-qty-group">
|
|
<div class="g-qty-group">
|
|
|
<div class="g-qty-group__stepper">
|
|
<div class="g-qty-group__stepper">
|
|
|
- <Stepper v-model="orderQty" :min="0" :max="enableqty" :step="qtyStep" integer />
|
|
|
|
|
|
|
+ <Stepper v-model="orderQty" :min="0" :max="enableqty" :step="agreeunit" integer />
|
|
|
<span>{{ getGoodsUnitName(selectedRow.goodsUnitID) }}</span>
|
|
<span>{{ getGoodsUnitName(selectedRow.goodsUnitID) }}</span>
|
|
|
</div>
|
|
</div>
|
|
|
<RadioGroup v-model="qtyStep" direction="horizontal" @change="onRadioChange">
|
|
<RadioGroup v-model="qtyStep" direction="horizontal" @change="onRadioChange">
|
|
|
<Radio v-for="(value, index) in qtyStepList" :key="index" :name="value">
|
|
<Radio v-for="(value, index) in qtyStepList" :key="index" :name="value">
|
|
|
- {{ value + getGoodsUnitName(selectedRow.goodsUnitID) }}
|
|
|
|
|
|
|
+ {{ parsePercent(value, 0) }}
|
|
|
</Radio>
|
|
</Radio>
|
|
|
</RadioGroup>
|
|
</RadioGroup>
|
|
|
</div>
|
|
</div>
|
|
@@ -48,7 +48,7 @@
|
|
|
import { shallowRef, PropType, onMounted, onUnmounted, computed } from 'vue'
|
|
import { shallowRef, PropType, onMounted, onUnmounted, computed } from 'vue'
|
|
|
import { CellGroup, Cell, Button, Stepper, Field, Form, FormInstance, FieldRule, RadioGroup, Radio } from 'vant'
|
|
import { CellGroup, Cell, Button, Stepper, Field, Form, FormInstance, FieldRule, RadioGroup, Radio } from 'vant'
|
|
|
import { fullloading } from '@/utils/vant'
|
|
import { fullloading } from '@/utils/vant'
|
|
|
-import { handleRequestBigNumber, handleNumberValue, formatDecimal } from '@/filters'
|
|
|
|
|
|
|
+import { handleRequestBigNumber, handleNumberValue, formatDecimal, parsePercent } from '@/filters'
|
|
|
import { getGoodsUnitName } from '@/constants/unit'
|
|
import { getGoodsUnitName } from '@/constants/unit'
|
|
|
import { useOrder } from '@/business/trade'
|
|
import { useOrder } from '@/business/trade'
|
|
|
import { useFuturesStore } from '@/stores'
|
|
import { useFuturesStore } from '@/stores'
|
|
@@ -76,13 +76,7 @@ const subscribe = quoteSocket.createSubscribe()
|
|
|
// 合约乘数
|
|
// 合约乘数
|
|
|
const agreeunit = computed(() => props.selectedRow.agreeUnit ?? 0)
|
|
const agreeunit = computed(() => props.selectedRow.agreeUnit ?? 0)
|
|
|
// 数量步长列表
|
|
// 数量步长列表
|
|
|
-const qtyStepList = computed(() => {
|
|
|
|
|
- return [
|
|
|
|
|
- agreeunit.value * 100,
|
|
|
|
|
- agreeunit.value * 500,
|
|
|
|
|
- agreeunit.value * 1000
|
|
|
|
|
- ]
|
|
|
|
|
-})
|
|
|
|
|
|
|
+const qtyStepList = [0.25, 0.5, 0.75, 1] // 数量步长列表
|
|
|
|
|
|
|
|
// 可用重量
|
|
// 可用重量
|
|
|
const enableqty = computed(() => {
|
|
const enableqty = computed(() => {
|
|
@@ -106,9 +100,8 @@ const formRules: { [key in keyof Proto.OrderReq]?: FieldRule[] } = {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const onRadioChange = (value: number) => {
|
|
const onRadioChange = (value: number) => {
|
|
|
- if (orderQty.value % agreeunit.value > 0) {
|
|
|
|
|
- orderQty.value = Math.min(enableqty.value, value)
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ const res = enableqty.value * value
|
|
|
|
|
+ orderQty.value = Math.round(res / agreeunit.value) * agreeunit.value
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 下单
|
|
// 下单
|
|
@@ -144,7 +137,6 @@ const closed = (isRefresh = false) => {
|
|
|
|
|
|
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
|
subscribe.start(props.selectedRow.goodsCode)
|
|
subscribe.start(props.selectedRow.goodsCode)
|
|
|
- qtyStep.value = qtyStepList.value[0]
|
|
|
|
|
orderQty.value = enableqty.value
|
|
orderQty.value = enableqty.value
|
|
|
})
|
|
})
|
|
|
|
|
|