|
|
@@ -12,12 +12,12 @@
|
|
|
<template #input>
|
|
|
<div class="g-qty-group">
|
|
|
<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>
|
|
|
</div>
|
|
|
<RadioGroup v-model="qtyStep" direction="horizontal" @change="onRadioChange">
|
|
|
<Radio v-for="(value, index) in qtyStepList" :key="index" :name="value">
|
|
|
- {{ value + getGoodsUnitName(selectedRow.goodsUnitID) }}
|
|
|
+ {{ parsePercent(value, 0) }}
|
|
|
</Radio>
|
|
|
</RadioGroup>
|
|
|
</div>
|
|
|
@@ -39,7 +39,7 @@ import { shallowRef, PropType, onMounted, computed, reactive } from 'vue'
|
|
|
import { CellGroup, Cell, Button, Stepper, Field, Form, FormInstance, FieldRule, RadioGroup, Radio } from 'vant'
|
|
|
import { BuyOrSell } from '@/constants/order'
|
|
|
import { fullloading } from '@/utils/vant'
|
|
|
-import { handleRequestBigNumber } from '@/filters'
|
|
|
+import { handleRequestBigNumber,parsePercent } from '@/filters'
|
|
|
import AppModal from '@/components/base/modal/index.vue'
|
|
|
import { marketOrderDeliveryApply } from '@/services/api/trade'
|
|
|
import { getGoodsUnitName } from '@/constants/unit'
|
|
|
@@ -60,13 +60,7 @@ const qtyStep = shallowRef(1) // 数量步长
|
|
|
// 合约乘数
|
|
|
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(() => {
|
|
|
@@ -95,9 +89,8 @@ const getTagName = () => {
|
|
|
}
|
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
|
const onSubmit = () => {
|
|
|
@@ -127,7 +120,6 @@ const closed = (isRefresh = false) => {
|
|
|
|
|
|
onMounted(() => {
|
|
|
orderQty.value = enableqty.value
|
|
|
- qtyStep.value = qtyStepList.value[0]
|
|
|
})
|
|
|
|
|
|
// 暴露组件属性给父组件调用
|