Explorar el Código

修改 可用资金 为 负数 的时候,的bug

huangbin hace 4 años
padre
commit
c81d976426

+ 5 - 4
src/common/setup/trade/index.ts

@@ -38,7 +38,7 @@ export function useTradeRule() {
 export function useBuyFixedPricMaxNum<T extends CommomTradeForm>(formState: T, canUseMoney: Function) {
     let result = 0
     // 可用资金
-    const money = canUseMoney()
+    const money = canUseMoney() > 0 ? canUseMoney() : 0
     const { isRatioInBuyMarginType, buymarginvalue } = useTradeRule()
 
     // 最大数量 = 可用资金/(履约保证金*挂牌价格)
@@ -55,7 +55,7 @@ export function useBuyFixedPricMaxNum<T extends CommomTradeForm>(formState: T, c
 export function useSellFixedPriceMaxNum<T extends CommomTradeForm>(formState: T, canUseMoney: Function) {
     let result = 0
     // 可用资金
-    const money = canUseMoney()
+    const money = canUseMoney() > 0 ? canUseMoney() : 0
     const { isRationInSellMarginType, sellmarginvalue } = useTradeRule()
     // 最大数量 = 可用资金/(履约保证金*挂牌价格)
     const marginValue = isRationInSellMarginType() ? (sellmarginvalue * formState.FixedPrice) : (sellmarginvalue + formState.FixedPrice)
@@ -96,7 +96,7 @@ export function useListingTradeNumAndPrice<T extends CommomTradeForm>({ formStat
 
     function getMaxNum(value: number, isBuy: boolean) {
         // 可用资金
-        const money = canUseMoney()
+        const money = canUseMoney() > 0 ? canUseMoney() : 0
         // 挂牌 最大数量=可用资金/(买方履约保证金比例*挂牌价格)
         let result = 0
         if (isFloat()) {
@@ -112,6 +112,7 @@ export function useListingTradeNumAndPrice<T extends CommomTradeForm>({ formStat
 
     // 挂买 最大数量
     function getListingBuyMaxNum() {
+        debugger
         const { buymarginvalue } = useTradeRule()
         return getMaxNum(buymarginvalue, true)
     }
@@ -161,7 +162,7 @@ export function useListingTradeNumAndPrice<T extends CommomTradeForm>({ formStat
 export function useBuyDelistingRatioMaxNum(OrderQty: number, canUseMoney: Function) {
     let result = 0;
     const { buymarginvalue } = useTradeRule()
-    const money = canUseMoney()
+    const money = canUseMoney() > 0 ? canUseMoney() : 0
     if (money && !isNaN(money)) {
         const num = +(money / buymarginvalue).toFixed(0);
         // 买 最大可摘数量=min{挂牌数量,可用资金/(履约保证金比例)}

+ 72 - 78
src/views/market/spot_trade/spot_trade_order_transaction/spot_trade_order_transaction_swap/index.vue

@@ -1,85 +1,79 @@
 <template>
-    <!--订单交易 挂牌转让-->
-    <div class="topTableHeight">
-        <div class="filterTable">
-            <div class="filter-custom-table">
-                <a-select
-                    class="conditionSelect"
-                    :style="{width: '180px', maxHeight: '400px', overflow: 'auto' }"
-                    @change="goodsChange"
-                    placeholder="全部标的合约"
-                >
-                    <a-select-option
-                        v-for="item in getRefGoodsList()"
-                        :value="item"
-                        :key="item"
-                    >{{item}}</a-select-option>
-                </a-select>
-                <!-- <a-button class="btnDeafault"
+  <!--订单交易 挂牌转让-->
+  <div class="topTableHeight">
+    <div class="filterTable">
+      <div class="filter-custom-table">
+        <a-select class="conditionSelect"
+                  :style="{width: '180px', maxHeight: '400px', overflow: 'auto' }"
+                  @change="goodsChange"
+                  placeholder="全部标的合约">
+          <a-select-option v-for="item in getRefGoodsList()"
+                           :value="item"
+                           :key="item">{{item}}</a-select-option>
+        </a-select>
+        <!-- <a-button class="btnDeafault"
                 @click="search(true)"
                 style="width: 80px">筛选</a-button>-->
-            </div>
-        </div>
-        <a-table
-            :columns="columns"
-            :class="['srcollYTable', isBottom ? 'secondTabTable' : 'secondTabTableNoBottom', goodsList.length ? 'noPlaceHolder' : 'hasPlaceHolder']"
-            :scroll="{ x: '100%', y: isBottom ? 'calc(100vh- 407px)' : 'calc(100vh - 167px)' }"
-            :pagination="false"
-            :loading="loading"
-            :expandedRowKeys="expandedRowKeys"
-            :customRow="Rowclick"
-            rowKey="goodscode"
-            ref="tableRef"
-            :data-source="goodsList"
-        >
-            <template #totalturnover="{ text }">
-                <span>{{changeUnit(text)}}</span>
-            </template>
-            <!-- 涨跌 -->
-            <template #change="{ record }">
-                <span>{{quoteChange(record, record.decimalplace)}}</span>
-            </template>
-            <!-- 幅度 -->
-            <template #amplitude="{ record }">
-                <span>{{quoteAmplituOfVibration(record, record.decimalplace)}}</span>
-            </template>
-            <!-- 振幅 -->
-            <template #vibration="{ record }">
-                <span>{{quoteAmplituOfVibration(record, record.decimalplace)}}</span>
-            </template>
-            <template #index="{ index }">
-                <span>{{index + 1}}</span>
-            </template>
-            <!-- 买价 -->
-            <template #bid="{ text, record }">
-                <span :class="handleQuotePriceColor(text, record.presettle)">{{text}}</span>
-            </template>
-            <!-- 卖价 -->
-            <template #ask="{ text, record }">
-                <span :class="handleQuotePriceColor(text, record.presettle)">{{text}}</span>
-            </template>
-            <!-- 最新价 -->
-            <template #last="{ text, record }">
-                <span :class="handleQuotePriceColor(text, record.presettle)">{{text}}</span>
-            </template>
-            <!-- 最低价 -->
-            <template #lowest="{ text, record }">
-                <span :class="handleQuotePriceColor(text, record.presettle)">{{text}}</span>
-            </template>
-            <!-- 最高价 -->
-            <template #highest="{ text, record }">
-                <span :class="handleQuotePriceColor(text, record.presettle)">{{text}}</span>
-            </template>
-        </a-table>
-        <!-- 右键 -->
-        <contextMenu :contextMenu="contextMenu" @cancel="closeContext" :list="btnList"></contextMenu>
-        <component
-            :is="componentId"
-            v-if="componentId"
-            :selectedRow="selectedRow"
-            @cancel="closeComponent"
-        ></component>
+      </div>
     </div>
+    <a-table :columns="columns"
+             :class="['srcollYTable', isBottom ? 'secondTabTable' : 'secondTabTableNoBottom', goodsList.length ? 'noPlaceHolder' : 'hasPlaceHolder']"
+             :scroll="{ x: '100%', y: isBottom ? 'calc(100vh- 407px)' : 'calc(100vh - 167px)' }"
+             :pagination="false"
+             :loading="loading"
+             :expandedRowKeys="expandedRowKeys"
+             :customRow="Rowclick"
+             rowKey="goodscode"
+             ref="tableRef"
+             :data-source="goodsList">
+      <template #totalturnover="{ text }">
+        <span>{{changeUnit(text)}}</span>
+      </template>
+      <!-- 涨跌 -->
+      <template #change="{ record }">
+        <span>{{quoteChange(record, record.decimalplace)}}</span>
+      </template>
+      <!-- 幅度 -->
+      <template #amplitude="{ record }">
+        <span>{{quoteAmplituOfVibration(record, record.decimalplace)}}</span>
+      </template>
+      <!-- 振幅 -->
+      <template #vibration="{ record }">
+        <span>{{quoteAmplituOfVibration(record, record.decimalplace)}}</span>
+      </template>
+      <template #index="{ index }">
+        <span>{{index + 1}}</span>
+      </template>
+      <!-- 买价 -->
+      <template #bid="{ text, record }">
+        <span :class="handleQuotePriceColor(text, record.presettle)">{{text}}</span>
+      </template>
+      <!-- 卖价 -->
+      <template #ask="{ text, record }">
+        <span :class="handleQuotePriceColor(text, record.presettle)">{{text}}</span>
+      </template>
+      <!-- 最新价 -->
+      <template #last="{ text, record }">
+        <span :class="handleQuotePriceColor(text, record.presettle)">{{text}}</span>
+      </template>
+      <!-- 最低价 -->
+      <template #lowest="{ text, record }">
+        <span :class="handleQuotePriceColor(text, record.presettle)">{{text}}</span>
+      </template>
+      <!-- 最高价 -->
+      <template #highest="{ text, record }">
+        <span :class="handleQuotePriceColor(text, record.presettle)">{{text}}</span>
+      </template>
+    </a-table>
+    <!-- 右键 -->
+    <contextMenu :contextMenu="contextMenu"
+                 @cancel="closeContext"
+                 :list="btnList"></contextMenu>
+    <component :is="componentId"
+               v-if="componentId"
+               :selectedRow="selectedRow"
+               @cancel="closeComponent"></component>
+  </div>
 </template>
 
 <script lang="ts">