Handy_Cao 1 rok temu
rodzic
commit
cce214cfa1

+ 14 - 10
src/packages/mobile/views/pricing/detail/components/trade/Index.vue

@@ -252,16 +252,6 @@ const formRules: { [key in keyof Proto.OrderReq]?: FieldRule[] } = {
     }],
 }
 
-onMounted(() => {
-    subscribe.start(props.goodsCode)
-    formData.BuyOrSell = props.buyOrSell
-    formData.BuildType = BuildType.Open
-    formData.PriceMode = PriceMode.Market
-    formData.MarketMaxSub = 100.0
-})
-
-onUnmounted(() => subscribe.stop())
-
 // 获取当前商品持仓汇总
 useRequest(queryTradePosition, {
     params: {
@@ -355,6 +345,20 @@ const closed = (isRefresh = true) => {
     showModal.value = false
 }
 
+onMounted(() => {
+    subscribe.start(props.goodsCode)
+    formData.BuyOrSell = props.buyOrSell
+    formData.BuildType = BuildType.Open
+    formData.PriceMode = PriceMode.Market
+    formData.MarketMaxSub = 100.0
+    /// 默认价格和数量
+    const { last = 0, presettle = 0 } = quote.value ?? {}
+    formData.OrderPrice = last || presettle
+    formData.OrderQty = qtyStep.value
+})
+
+onUnmounted(() => subscribe.stop())
+
 // 暴露组件属性给父组件调用
 defineExpose({
     closed,

+ 10 - 10
src/packages/mobile/views/pricing/list/Index.vue

@@ -43,7 +43,7 @@
 <script lang="ts" setup>
 
 import { computed, onUnmounted, PropType } from 'vue'
-import { parsePercent, handleNumberValue } from '@/filters'
+import { parsePercent, handleNumberValue, formatDecimal } from '@/filters'
 import { useNavigation } from '@mobile/router/navigation'
 import { useRequest } from '@/hooks/request'
 import { queryQuoteGoodsList } from '@/services/api/swap'
@@ -84,23 +84,23 @@ const { dataList } = useRequest(queryQuoteGoodsList, {
 const tableList = computed(() => {
     return dataList.value.map((item) => {
         const quote = futuresStore.getGoodsQuote(item.goodscode)
-        const { lastColor, openedColor, lowestColor, highestColor, last, presettle, rise, change, amplitude, highest, lowest, opened, ask, bid, bidColor, askColor } = quote.value ?? {}
+        const { lastColor, openedColor, lowestColor, highestColor, last = 0, presettle = 0, rise = 0, change, amplitude, highest = 0, lowest = 0, opened = 0, ask = 0, bid = 0, bidColor, askColor, decimalplace } = quote.value ?? {}
         return {
             ...item,
             lastColor,
             openedColor,
             lowestColor,
             highestColor,
-            last: handleNumberValue(last),
-            rise: handleNumberValue(rise?.toFixed(item.decimalplace)),
+            last: handleNumberValue(formatDecimal(last, decimalplace)),
+            rise: handleNumberValue(formatDecimal(rise, decimalplace)),
             change: parsePercent(change),
-            opened: handleNumberValue(opened),
-            presettle: handleNumberValue(presettle),
-            lowest: handleNumberValue(lowest),
-            highest: handleNumberValue(highest),
+            opened: handleNumberValue(formatDecimal(opened, decimalplace)),
+            presettle: handleNumberValue(formatDecimal(presettle, decimalplace)),
+            lowest: handleNumberValue(formatDecimal(lowest, decimalplace)),
+            highest: handleNumberValue(formatDecimal(highest, decimalplace)),
             amplitude: parsePercent(amplitude),
-            ask: handleNumberValue(ask),
-            bid: handleNumberValue(bid),
+            ask: handleNumberValue(formatDecimal(ask, decimalplace)),
+            bid: handleNumberValue(formatDecimal(bid, decimalplace)),
             bidColor,
             askColor
         }

+ 1 - 1
src/stores/modules/language.ts

@@ -6,7 +6,7 @@ import enUS from '@public/locales/en-US.json'
 const appLanguage = localData.getRef('appLanguage')
 
 export const i18n = createI18n({
-    locale: 'en-US',//appLanguage.value,
+    locale: appLanguage.value,
     fallbackLocale: 'zh-CN',
     messages: {
         'zh-CN': zhCN,