huangbin 4 anos atrás
pai
commit
7a5abd71d6

+ 2 - 2
src/views/market/spot_trade/components/post_buying/index.vue

@@ -76,9 +76,9 @@
             <a-col :span="24"
                    class="mt-10">
               <a-form-item>
-                <a-slider ::min="0"
+                <a-slider :min="0"
                           v-model:value="formState.OrderQty"
-                          :max="99999999"
+                          :max="getMaxNum()"
                           class="formSlider" />
                 <div class="unit">
                   <span>{{getMaxNum() ? selectedRow.minivalue : 0}}</span>

+ 12 - 5
src/views/market/spot_trade/components/post_buying/setup.ts

@@ -43,14 +43,21 @@ export function handleNumAndPrice(enumName: EnumRouterName, selectedRow: WrOrder
     function getMaxNum() {
         // 可用资金
         const canUseMoney = Number(getCanUseMoney(getSelectedAccount() as AccountListItem))
+        const { buymarginvalue } = rules[0]
         // 挂牌最大数量=可用资金/(买方履约保证金比例*挂牌价格)
-        const margin = marginMethod() ? (buymarginvalue * formState.FixedPrice) : (buymarginvalue + formState.FixedPrice)
-        if (margin) {
-            return Math.floor(canUseMoney / margin)
-
+        let result = 0
+        if (isFloat()) {
+            const price = getPrice()
+            if (price !== '--') {
+                result = canUseMoney / (Number(price) * buymarginvalue)
+            }
         } else {
-            return 0
+            const margin = marginMethod() ? (buymarginvalue * formState.FixedPrice) : (buymarginvalue + formState.FixedPrice)
+            if (margin) {
+                result = Math.floor(canUseMoney / margin)
+            }
         }
+        return +result.toFixed(0)
     }
     //  摘牌金额
     function getMoney() {