|
|
@@ -6,7 +6,7 @@
|
|
|
<Cell>
|
|
|
<template #title v-if="quote">
|
|
|
<h3 :class="quote.lastColor">
|
|
|
- <span>{{ quote.last }}</span>
|
|
|
+ <span>{{ handleNumberValue(quote.last.toFixed(quote.decimalplace)) }}</span>
|
|
|
</h3>
|
|
|
<span :class="quote.lastColor">{{ parsePercent(quote.change) }}</span>
|
|
|
</template>
|
|
|
@@ -34,16 +34,17 @@
|
|
|
<app-select v-model="formData.PriceMode" :options="getPricemode2List()" />
|
|
|
</template>
|
|
|
</Field>
|
|
|
- <Field label="价格" v-if="formData.PriceMode === PriceMode.Limit">
|
|
|
+ <Field label="价格" :rules="formRules.OrderPrice" v-if="formData.PriceMode === PriceMode.Limit">
|
|
|
<template #input>
|
|
|
<app-stepper v-model="formData.OrderPrice" :min="0" :decimal-length="quote?.decimalplace"
|
|
|
:step="quote?.decimalvalue" />
|
|
|
</template>
|
|
|
</Field>
|
|
|
<Cell title="价格" value="最优市价" v-if="formData.PriceMode === PriceMode.Market" />
|
|
|
- <Field label="数量">
|
|
|
+ <Field label="数量" :rules="formRules.OrderQty">
|
|
|
<template #input>
|
|
|
- <app-stepper v-model="formData.OrderQty" :min="0" />
|
|
|
+ <app-stepper v-model="formData.OrderQty" :min="0"
|
|
|
+ :decimal-length="baseAccount?.currencydecimalplace" />
|
|
|
</template>
|
|
|
</Field>
|
|
|
<Cell :title="formData.BuyOrSell === BuyOrSell.Buy ? '预估支付' : '预估获取'"
|
|
|
@@ -84,10 +85,10 @@
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
import { shallowRef, reactive, computed, onMounted, onUnmounted, onActivated } from 'vue'
|
|
|
-import { Form, Button, CellGroup, Field, Cell, Tab, Tabs, Col, Row, FormInstance, showDialog } from 'vant'
|
|
|
+import { Form, Button, CellGroup, Field, Cell, Tab, Tabs, Col, Row, FormInstance, showDialog, FieldRule } from 'vant'
|
|
|
import { fullloading } from '@/utils/vant'
|
|
|
+import { parsePercent, formatDecimal,handleNumberValue } from '@/filters'
|
|
|
import { EBuildType, EDelistingType, EListingSelectType, EOrderOperateType, EValidType } from '@/constants/client'
|
|
|
-import { parsePercent, formatDecimal } from '@/filters'
|
|
|
import { BuyOrSell, PriceMode, getPricemode2List } from '@/constants/order'
|
|
|
import { useNavigation } from '@mobile/router/navigation'
|
|
|
import { digitalOrder } from '@/services/api/digital'
|
|
|
@@ -164,6 +165,20 @@ const calculations = computed(() => {
|
|
|
}
|
|
|
})
|
|
|
|
|
|
+// 表单验证规则
|
|
|
+const formRules: { [key: string]: FieldRule[] } = {
|
|
|
+ OrderPrice: [{
|
|
|
+ message: '请输入价格',
|
|
|
+ validator: () => {
|
|
|
+ return Number(formData.OrderPrice) > 0
|
|
|
+ }
|
|
|
+ }],
|
|
|
+ OrderQty: [{
|
|
|
+ message: '请输入数量',
|
|
|
+ validator: () => Number(formData.OrderQty) > 0
|
|
|
+ }],
|
|
|
+}
|
|
|
+
|
|
|
const navigateToGoodsChart = () => {
|
|
|
router.push({
|
|
|
name: 'spot-goods-chart',
|