li.shaoyi 1 mēnesi atpakaļ
vecāks
revīzija
b0b1c28d2f

+ 3 - 2
src/packages/digital/views/contract/goods/list/index.vue

@@ -5,7 +5,7 @@
                 <Search shape="round" placeholder="搜索" />
             </app-statusbar>
         </template>
-        <Tabs v-model:active="currentGroupId">
+        <Tabs v-model:active="currentGroupId" v-if="goodsGroups.length">
             <template v-for="(item, index) in goodsGroups" :key="index">
                 <Tab :title="item.goodsgroupname" :name="item.goodsgroupid">
                     <table class="table" cellspacing="0" cellpadding="0">
@@ -78,12 +78,13 @@
                 </Tab>
             </template>
         </Tabs>
+        <Empty description="暂无数据" v-else />
     </app-view>
 </template>
 
 <script lang="ts" setup>
 import { shallowRef, onMounted, computed } from 'vue'
-import { Search, Tab, Tabs, Image } from 'vant'
+import { Search, Tab, Tabs, Image, Empty } from 'vant'
 import { useNavigation } from '@mobile/router/navigation'
 import { parsePercent, handleNumberValue, getFirstImage } from '@/filters'
 import { useFuturesStore, useUserStore } from '@/stores'

+ 21 - 6
src/packages/digital/views/spot/goods/detail/index.vue

@@ -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',

+ 3 - 2
src/packages/digital/views/spot/goods/list/index.vue

@@ -5,7 +5,7 @@
                 <Search shape="round" placeholder="搜索" />
             </app-statusbar>
         </template>
-        <Tabs v-model:active="currentGroupId">
+        <Tabs v-model:active="currentGroupId" v-if="goodsGroups.length">
             <template v-for="(item, index) in goodsGroups" :key="index">
                 <Tab :title="item.goodsgroupname" :name="item.goodsgroupid">
                     <table class="table" cellspacing="0" cellpadding="0">
@@ -62,12 +62,13 @@
                 </Tab>
             </template>
         </Tabs>
+        <Empty description="暂无数据" v-else />
     </app-view>
 </template>
 
 <script lang="ts" setup>
 import { shallowRef, onMounted, computed } from 'vue'
-import { Search, Tab, Tabs, Image } from 'vant'
+import { Search, Tab, Tabs, Image,Empty } from 'vant'
 import { useNavigation } from '@mobile/router/navigation'
 import { parsePercent, handleNumberValue, getFirstImage } from '@/filters'
 import { useFuturesStore, useUserStore } from '@/stores'