li.shaoyi 2 tahun lalu
induk
melakukan
92d826cffb

+ 12 - 8
src/packages/pc/components/modules/listing/index.vue

@@ -28,7 +28,8 @@
                     <div class="el-form-item--col">
                         <div class="qty-group">
                             <el-input-number placeholder="请输入" :min="agreeunit" :step="qtyStep" v-model="orderQty" />
-                            <el-radio-group size="small" v-model="qtyStep" @change="onRadioChange">
+                            <el-radio-group size="small" v-model="qtyStep" @change="onRadioChange"
+                                v-if="qtyStepList.length">
                                 <el-radio v-for="(value, index) in qtyStepList" :key="index" :label="value" border />
                             </el-radio-group>
                         </div>
@@ -38,7 +39,7 @@
             </el-form>
             <div class="footer-btnbar">
                 <template v-if="formData.BuyOrSell === BuyOrSell.Buy">
-                    <el-button type="primary" :loading="loading"
+                    <el-button type="primary" :loading="loading" :disabled="!goodsStore.goodsId"
                         @click="onSubmit(EBuildType.BUILDTYPE_OPEN)">订立买入</el-button>
                     <el-button type="primary" :loading="loading" :disabled="(sellQty === 0) || (orderQty > sellQty)"
                         @click="onSubmit(EBuildType.BUILDTYPE_CLOSE)">
@@ -47,7 +48,7 @@
                     </el-button>
                 </template>
                 <template v-if="formData.BuyOrSell === BuyOrSell.Sell">
-                    <el-button type="primary" :loading="loading"
+                    <el-button type="primary" :loading="loading" :disabled="!goodsStore.goodsId"
                         @click="onSubmit(EBuildType.BUILDTYPE_OPEN)">订立卖出</el-button>
                     <el-button type="primary" :loading="loading" :disabled="(buyQty === 0) || (orderQty > buyQty)"
                         @click="onSubmit(EBuildType.BUILDTYPE_CLOSE)">
@@ -104,11 +105,14 @@ const priceStep = computed(() => {
 
 // 数量步长列表
 const qtyStepList = computed(() => {
-    return [
-        agreeunit.value * 1,
-        agreeunit.value * 10,
-        agreeunit.value * 100,
-    ]
+    if (agreeunit.value) {
+        return [
+            agreeunit.value * 1,
+            agreeunit.value * 10,
+            agreeunit.value * 100,
+        ]
+    }
+    return []
 })
 
 // 买方向持仓数量

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

@@ -81,7 +81,7 @@ export const useEnumStore = defineStore(() => {
     // 根据枚举值获取枚举名称
     const getEnumTypeName = (enums: EnumType[], value?: number) => {
         const item = enums.find((e) => e.value === value)
-        return item?.label ?? value?.toString() ?? '无效枚举'
+        return item?.label ?? value?.toString() ?? '--'
     }
 
     // 根据枚举名称获取对应的值

+ 2 - 2
src/stores/modules/goods.ts

@@ -13,7 +13,7 @@ export const useGoodsStore = defineStore(() => {
     const state = reactive({
         loading: false,
         quoteGoodsList: <Model.QuoteGoodsListRsp[]>[],
-        goodsId: 0,
+        goodsId: <number | undefined>undefined,
     })
 
     // 当前选中的商品信息
@@ -43,7 +43,7 @@ export const useGoodsStore = defineStore(() => {
 
             // 查找当前选中的商品
             if (!data.every((e) => e.goodsid === state.goodsId)) {
-                state.goodsId = data[0]?.goodsid ?? 0
+                state.goodsId = data[0].goodsid
             }
         } finally {
             state.loading = false