li.shaoyi 3 lat temu
rodzic
commit
84a4b53ed0

+ 3 - 3
src/common/components/echarts/echarts-timeline/options.ts

@@ -1,5 +1,5 @@
 import { ref, watch } from 'vue'
-import { toDecimalFull } from '@/utils/number';
+import { formatDecimal } from '@/utils/number';
 import * as echarts from 'echarts';
 import { State, Colors } from './type'
 import { getTheme, ThemeEnum } from '@/common/config/theme';
@@ -90,7 +90,7 @@ export function useOptions(state: State) {
                     min: minMark,
                     interval,
                     axisLabel: {
-                        formatter: (val: number) => toDecimalFull(val, decimal),
+                        formatter: (val: number) => formatDecimal(val, decimal).toString(),
                         color: (val: any) => {
                             const num = Number(val).toFixed(decimal);
                             if (Number(num) > yestClose) return colors.upColor;
@@ -231,7 +231,7 @@ export function useOptions(state: State) {
         }
         if (yestclose > 0) {
             const result = (num - yestclose) / yestclose * 100;
-            return toDecimalFull(result) + '%';
+            return formatDecimal(result) + '%';
         }
         return '0%';
     }

+ 23 - 13
src/utils/number/index.ts

@@ -21,29 +21,39 @@ export function getDecimalsNum(val: any, decimal = 2, maxCount = 6) {
 }
 
 /**
- * 强制保留小数位,零位四舍五入取整
+ * 强制保留小数位,不足位数自动补零
  * @param value 
- * @param decimal 保留小数位 默认2 
+ * @param decimal 保留小数位
+ * @param round 是否四舍五入
  * @returns 
  */
-export function toDecimalFull(value: number, decimal = 2) {
+export function formatDecimal(value: number, decimal = 2, round = true) {
     if (decimal <= 0) {
-        return Math.round(value).toString();
+        if (round) {
+            return Math.round(value);
+        }
+        return Math.trunc(value);
     } else {
-        let str = value.toString();
-        const num = str.indexOf('.');
-        if (num < 0) {
+        if (round) {
+            return Number(value.toFixed(decimal));
+        }
+
+        let num = value.toString();
+        const index = num.indexOf('.');
+
+        if (index < 0) {
             // 小数位自动补零
             if (decimal > 0) {
-                const count = str.length;
-                str += '.';
-                while (str.length <= count + decimal) {
-                    str += '0';
+                const count = num.length;
+                num += '.';
+                while (num.length <= count + decimal) {
+                    num += '0';
                 }
             }
-            return str;
         }
-        return value.toFixed(decimal);
+
+        const result = num.substring(0, decimal + index + 1);
+        return Number(result);
     }
 }
 

+ 2 - 2
src/views/market/market-spot/components/filter/index.vue

@@ -20,7 +20,7 @@
 
 <script lang="ts">
 import FilterOption from '@/common/components/filter/index.vue';
-import { defineComponent, onMounted, PropType } from 'vue';
+import { defineComponent, onBeforeUnmount, PropType } from 'vue';
 import { ref } from 'vue';
 import { initData } from '@/common/methods';
 import { handleFtDeliveryGoods } from '../../setup';
@@ -101,7 +101,7 @@ export default defineComponent({
       addSubscribeQuotation(uuid, arr);
       context.emit('filterGoods', id);
     }
-    onMounted(() => {
+    onBeforeUnmount(() => {
       removeSubscribeQuotation(uuid);
     });
     // 交收月

+ 195 - 246
src/views/market/market-spot/spot_trade_order_transaction/spot_trade_order_transaction_swap/components/delisting/index.vue

@@ -1,13 +1,6 @@
 <template>
   <!-- 挂牌求购 -->
-  <Drawer
-    :title="!isBuy() ? '摘牌买入' : '摘牌卖出'"
-    :placement="'right'"
-    :visible="visible"
-    :width="1052"
-    @cancel="cancel"
-    class="post-buying-container"
-  >
+  <Drawer :title="!isBuy() ? '摘牌买入' : '摘牌卖出'" :placement="'right'" :visible="visible" :width="1052" @cancel="cancel" class="post-buying-container">
     <a-row>
       <a-col :span="12">
         <div class="post_buying_chart">
@@ -16,47 +9,32 @@
             <div class="content--right">{{ parantSelectedRow.goodsname }}</div>
           </div>
           <div class="chart-tips__last">
-            <div
-              :class="['content--left', handleQuotePriceColor_out(parantSelectedRow.refgoodscode, 'last')]"
-            >{{ getQuoteValue_out(parantSelectedRow.refgoodscode, 'last') }}</div>
+            <div :class="['content--left', handleQuotePriceColor_out(parantSelectedRow.refgoodscode, 'last')]">{{ getQuoteValue_out(parantSelectedRow.refgoodscode, 'last') }}</div>
             <div class="content--right">
-              <span
-                :class="handleQuotePriceColor_out(parantSelectedRow.refgoodscode, 'last')"
-              >{{ quoteChange_out(parantSelectedRow.refgoodscode) }}</span>
-              <span
-                :class="handleQuotePriceColor_out(parantSelectedRow.refgoodscode, 'last')"
-              >{{ quoteAmplitude_out(parantSelectedRow.refgoodscode) }}</span>
+              <span :class="handleQuotePriceColor_out(parantSelectedRow.refgoodscode, 'last')">{{ quoteChange_out(parantSelectedRow.refgoodscode) }}</span>
+              <span :class="handleQuotePriceColor_out(parantSelectedRow.refgoodscode, 'last')">{{ quoteAmplitude_out(parantSelectedRow.refgoodscode) }}</span>
             </div>
           </div>
           <a-row>
             <a-col :span="4" :offset="2">最高价</a-col>
             <a-col :span="6">
-              <span
-                :class="handleQuotePriceColor_out(parantSelectedRow.refgoodscode, 'highest')"
-              >{{ getQuoteValue_out(parantSelectedRow.refgoodscode, 'highest') }}</span>
+              <span :class="handleQuotePriceColor_out(parantSelectedRow.refgoodscode, 'highest')">{{ getQuoteValue_out(parantSelectedRow.refgoodscode, 'highest') }}</span>
             </a-col>
             <a-col :span="4" :offset="2">开盘价</a-col>
             <a-col :span="6">
-              <span
-                :class="handleQuotePriceColor_out(parantSelectedRow.refgoodscode, 'opened')"
-              >{{ getQuoteValue_out(parantSelectedRow.refgoodscode, 'opened') }}</span>
+              <span :class="handleQuotePriceColor_out(parantSelectedRow.refgoodscode, 'opened')">{{ getQuoteValue_out(parantSelectedRow.refgoodscode, 'opened') }}</span>
             </a-col>
           </a-row>
           <a-row>
             <a-col :span="4" :offset="2">最低价</a-col>
             <a-col :span="6">
-              <span
-                :class="handleQuotePriceColor_out(parantSelectedRow.refgoodscode, 'lowest')"
-              >{{ getQuoteValue_out(parantSelectedRow.refgoodscode, 'lowest') }}</span>
+              <span :class="handleQuotePriceColor_out(parantSelectedRow.refgoodscode, 'lowest')">{{ getQuoteValue_out(parantSelectedRow.refgoodscode, 'lowest') }}</span>
             </a-col>
             <a-col :span="4" :offset="2">昨结价</a-col>
             <a-col :span="6">{{ getQuoteValue_out(parantSelectedRow.refgoodscode, 'presettle') }}</a-col>
           </a-row>
           <div class="chart-content">
-            <Chart
-              :selectedRow="getQuoteDayInfoByCode(parantSelectedRow.refgoodscode)"
-              :showExchange="false"
-            />
+            <Chart :selectedRow="getQuoteDayInfoByCode(parantSelectedRow.refgoodscode)" :showExchange="false" />
           </div>
         </div>
       </a-col>
@@ -67,17 +45,8 @@
               <a-row :gutter="24">
                 <a-col :span="24">
                   <a-form-item label="贸易账户" name="accountid">
-                    <a-select
-                      class="inlineFormSelect"
-                      style="width: 260px"
-                      v-model:value="formState.accountid"
-                      placeholder="请选择"
-                    >
-                      <a-select-option
-                        v-for="item in accountList"
-                        :value="item.accountid"
-                        :key="item.accountid"
-                      >{{ item.accountid }}</a-select-option>
+                    <a-select class="inlineFormSelect" style="width: 260px" v-model:value="formState.accountid" placeholder="请选择">
+                      <a-select-option v-for="item in accountList" :value="item.accountid" :key="item.accountid">{{ item.accountid }}</a-select-option>
                     </a-select>
                   </a-form-item>
                 </a-col>
@@ -106,14 +75,9 @@
                 </a-col>
                 <a-col :span="24" v-if="isFloat() && isLimit()">
                   <a-form-item label="摘牌价格" name="price" class="inputIconBox">
-                    <a-input-number
-                      class="commonInput"
-                      style="width: 260px"
-                      :min="0"
-                      v-model:value="formState.price"
-                    />
-                    <MinusOutlined @click="decreasePrice" />
-                    <PlusOutlined @click="increasePrice" />
+                    <a-input-number class="commonInput" style="width: 260px" :min="0" v-model:value="formState.price" />
+                    <MinusOutlined @click="decreasePrice('price')" />
+                    <PlusOutlined @click="increasePrice('price')" />
                   </a-form-item>
                 </a-col>
                 <a-col :span="24">
@@ -128,26 +92,15 @@
                 </a-col>
                 <a-col :span="24" v-if="useUserType()">
                   <a-form-item label="摘牌数量" name="num" class="inputIconBox">
-                    <a-input-number
-                      class="commonInput"
-                      style="width: 260px"
-                      :min="0"
-                      :max="selectedRow.orderqty"
-                      v-model:value="formState.num"
-                    />
-                    <MinusOutlined @click="decreaseNumber" />
-                    <PlusOutlined @click="increaseNumber" />
+                    <a-input-number class="commonInput" style="width: 260px" :min="0" :max="selectedRow.orderqty" v-model:value="formState.num" />
+                    <MinusOutlined @click="decreaseNumber('num')" />
+                    <PlusOutlined @click="increaseNumber('num')" />
                     <span class="input-enumdicname">{{ selectedRow.enumdicname }}</span>
                   </a-form-item>
                 </a-col>
                 <a-col :span="24" v-if="useUserType()" class="mt-10">
                   <a-form-item>
-                    <a-slider
-                      :min="0"
-                      v-model:value="formState.num"
-                      :max="selectedRow.orderqty"
-                      class="formSlider"
-                    />
+                    <a-slider :min="0" v-model:value="formState.num" :max="selectedRow.orderqty" class="formSlider" />
                     <div class="unit">
                       <span>0</span>
                       <span>{{ selectedRow.orderqty }}{{ selectedRow.enumdicname }}</span>
@@ -417,239 +370,235 @@ export default defineComponent({
 
 <style lang="less">
 .post-buying-container {
-  top: 101px;
-  .ant-drawer-content-wrapper {
-    height: 605px;
-  }
+    top: 101px;
+    .ant-drawer-content-wrapper {
+        height: 605px;
+    }
 }
 .chart-content {
-  height: 400px;
-  .chart-content__header,
-  .chart-content__main {
-    width: 90% !important;
-    margin: auto !important;
-  }
+    height: 400px;
+    .chart-content__header,
+    .chart-content__main {
+        width: 90% !important;
+        margin: auto !important;
+    }
 
-  .chart-slider {
-    display: none;
-  }
+    .chart-slider {
+        display: none;
+    }
 }
 .formBar {
-  height: 100%;
-  max-height: 100%;
+    height: 100%;
+    max-height: 100%;
 }
 .post_buying_chart {
-  [theme="light"] & {
-    --bgcolor: #fff;
-    --tab-border-color: #dae5ec;
-    --tab-checked-color: #0866b8;
-    --tab-checked-bgcolor: #d4e0ff;
-    --slider-border-color: #b2c4dd;
-    --slider-bgcolor: #edf2f7;
-    --slider-button-color: #b2c4dd;
-    --row-border-color: #dae5ec;
-    --row-title-color: #acb8c0;
-    --row-content-color: #3c454b;
-    --tik-title-bgcolor: #ecf2f5;
-    --tik-title-color: #7a8a94;
-  }
-  color: @m-grey67;
+    [theme='light'] & {
+        --bgcolor: #fff;
+        --tab-border-color: #dae5ec;
+        --tab-checked-color: #0866b8;
+        --tab-checked-bgcolor: #d4e0ff;
+        --slider-border-color: #b2c4dd;
+        --slider-bgcolor: #edf2f7;
+        --slider-button-color: #b2c4dd;
+        --row-border-color: #dae5ec;
+        --row-title-color: #acb8c0;
+        --row-content-color: #3c454b;
+        --tik-title-bgcolor: #ecf2f5;
+        --tik-title-color: #7a8a94;
+    }
+    color: @m-grey67;
 
-  // background-color: var(--bgcolor, #0e0e0f);
+    // background-color: var(--bgcolor, #0e0e0f);
 
-  // background: @m-blue37;
-  // color: @m-grey67;
-  .buying_chart {
-    display: flex;
+    // background: @m-blue37;
+    // color: @m-grey67;
+    .buying_chart {
+        display: flex;
 
-    // background-color: @m-blue36;
-    &__nav {
-      display: flex;
-      justify-content: center;
-      align-items: center;
+        // background-color: @m-blue36;
+        &__nav {
+            display: flex;
+            justify-content: center;
+            align-items: center;
 
-      .content {
-        &:first-child:not(:last-child) {
-          margin-right: 16px;
-        }
+            .content {
+                &:first-child:not(:last-child) {
+                    margin-right: 16px;
+                }
 
-        &--left {
-          font-size: 16px;
-          color: var(--row-content-color, #acb8c0);
-          margin-right: 6px;
-        }
+                &--left {
+                    font-size: 16px;
+                    color: var(--row-content-color, #acb8c0);
+                    margin-right: 6px;
+                }
 
-        &--right {
-          font-size: 24px;
-          color: #fc9618;
+                &--right {
+                    font-size: 24px;
+                    color: #fc9618;
+                }
+            }
         }
-      }
     }
-  }
-  .chart-tips {
-    display: flex;
-    flex-direction: column;
-    width: 300px;
-    height: 100%;
+    .chart-tips {
+        display: flex;
+        flex-direction: column;
+        width: 300px;
+        height: 100%;
 
-    &__last {
-      display: flex;
-      justify-content: center;
-      align-items: center;
-      padding: 16px 0;
-      .content {
-        &--left {
-          font-size: 24px;
-          margin-right: 16px;
-        }
+        &__last {
+            display: flex;
+            justify-content: center;
+            align-items: center;
+            padding: 16px 0;
+            .content {
+                &--left {
+                    font-size: 24px;
+                    margin-right: 16px;
+                }
 
-        &--right {
-          display: flex;
-          flex-direction: column;
-          align-items: flex-start;
+                &--right {
+                    display: flex;
+                    flex-direction: column;
+                    align-items: flex-start;
+                }
+            }
         }
-      }
     }
-  }
 }
 .post_buying {
-  width: 100%;
-  height: 100%;
-  .flex;
-  flex-direction: column;
-  position: relative;
-  overflow: hidden;
-  .ant-form {
-    height: 100%;
-  }
-  .condition {
     width: 100%;
-    height: 48px;
-    margin: 0 16px;
-    padding: 10px 0;
-    border-bottom: 1px solid @m-black6;
-    .inlineflex;
-    .conditionBtn {
-      align-self: center;
-      align-items: center;
-      border: 0;
-      min-width: 80px;
-      height: 28px;
-      line-height: 28px;
-      background: @m-black7;
-      .rounded-corners(3px);
-      font-size: 14px;
-      color: @m-blue0;
-      &:hover {
-        background: @m-black7-hover;
-        color: @m-blue0-hover;
-      }
+    height: 100%;
+    .flex;
+    flex-direction: column;
+    position: relative;
+    overflow: hidden;
+    .ant-form {
+        height: 100%;
     }
-    .conditionBtn + .conditionBtn {
-      margin-left: 10px;
+    .condition {
+        width: 100%;
+        height: 48px;
+        margin: 0 16px;
+        padding: 10px 0;
+        border-bottom: 1px solid @m-black6;
+        .inlineflex;
+        .conditionBtn {
+            align-self: center;
+            align-items: center;
+            border: 0;
+            min-width: 80px;
+            height: 28px;
+            line-height: 28px;
+            background: @m-black7;
+            .rounded-corners(3px);
+            font-size: 14px;
+            color: @m-blue0;
+            &:hover {
+                background: @m-black7-hover;
+                color: @m-blue0-hover;
+            }
+        }
+        .conditionBtn + .conditionBtn {
+            margin-left: 10px;
+        }
     }
-  }
 }
 
 .unit {
-  margin-left: 70px;
-  width: 260px;
-  .flex;
-  justify-content: space-between;
-  font-size: 14px;
-  color: @m-grey41;
-  height: 14px;
-  line-height: 14px;
+    margin-left: 70px;
+    width: 260px;
+    .flex;
+    justify-content: space-between;
+    font-size: 14px;
+    color: @m-grey41;
+    height: 14px;
+    line-height: 14px;
 }
 .listedBtn {
-  width: 120px;
-  height: 30px;
-  line-height: 30px;
-  background: linear-gradient(0deg, @m-blue2 0%, @m-blue0 100%);
-  border-radius: 3px;
-  color: @m-white0;
-  font-size: 14px;
-  text-align: center;
-  border: 0;
-  &:hover {
-    background: linear-gradient(0deg, @m-blue0-hover 0%, @m-blue2-hover 100%);
-    color: @m-white0-hover;
-  }
+    width: 120px;
+    height: 30px;
+    line-height: 30px;
+    background: linear-gradient(0deg, @m-blue2 0%, @m-blue0 100%);
+    border-radius: 3px;
+    color: @m-white0;
+    font-size: 14px;
+    text-align: center;
+    border: 0;
+    &:hover {
+        background: linear-gradient(0deg, @m-blue0-hover 0%, @m-blue2-hover 100%);
+        color: @m-white0-hover;
+    }
 }
 .cancelBtn:extend(.listedBtn) {
-  background: linear-gradient(0deg, @m-grey12 0%, @m-grey13 100%) !important;
-  &:hover {
-    background: linear-gradient(
-      0deg,
-      @m-grey12-hover 0%,
-      @m-grey13-hover 100%
-    ) !important;
-    color: @m-white0-hover;
-  }
+    background: linear-gradient(0deg, @m-grey12 0%, @m-grey13 100%) !important;
+    &:hover {
+        background: linear-gradient(0deg, @m-grey12-hover 0%, @m-grey13-hover 100%) !important;
+        color: @m-white0-hover;
+    }
 }
 .ml10 {
-  margin-left: 10px;
+    margin-left: 10px;
 }
 .ant-form.dialogForm .ant-row.ant-form-item {
-  margin-bottom: 14px;
+    margin-bottom: 14px;
 }
 .mt20 {
-  margin-top: 20px;
+    margin-top: 20px;
 }
 .mt-10 {
-  margin-top: -10px;
+    margin-top: -10px;
 }
 .ant-input-suffix {
-  position: absolute;
-  right: -25px;
+    position: absolute;
+    right: -25px;
 }
 .minusBtn,
 .plusBtn {
-  width: 15px;
-  height: 32px;
-  line-height: 32px;
-  font-size: 15px;
-  color: @m-blue15;
-  cursor: pointer;
+    width: 15px;
+    height: 32px;
+    line-height: 32px;
+    font-size: 15px;
+    color: @m-blue15;
+    cursor: pointer;
 }
 .minusBtn {
-  position: absolute;
-  top: -6px;
-  left: 14px;
-  z-index: 1;
+    position: absolute;
+    top: -6px;
+    left: 14px;
+    z-index: 1;
 }
 .plusBtn {
-  position: absolute;
-  top: -6px;
-  right: 14px;
-  z-index: 1;
+    position: absolute;
+    top: -6px;
+    right: 14px;
+    z-index: 1;
 }
 .stepper {
-  padding-left: 30px;
-  padding-right: 30px;
-  text-align: center;
-  color: @m-yellow1;
-  font-size: 16px;
+    padding-left: 30px;
+    padding-right: 30px;
+    text-align: center;
+    color: @m-yellow1;
+    font-size: 16px;
 }
 .ant-slider.formSlider {
-  width: 260px !important;
-  margin-left: 70px;
-  .ant-slider-rail {
-    margin-right: 0;
-    padding-right: 0;
-    height: 3px !important;
-    border-radius: 2px !important;
-    background-color: @m-blue14;
-  }
-  .ant-slider-track {
-    height: 3px;
-    background-color: @m-blue0;
-  }
-  .ant-slider-step {
-    height: 3px;
-  }
-  .ant-progress-text {
-    display: none;
-  }
+    width: 260px !important;
+    margin-left: 70px;
+    .ant-slider-rail {
+        margin-right: 0;
+        padding-right: 0;
+        height: 3px !important;
+        border-radius: 2px !important;
+        background-color: @m-blue14;
+    }
+    .ant-slider-track {
+        height: 3px;
+        background-color: @m-blue0;
+    }
+    .ant-slider-step {
+        height: 3px;
+    }
+    .ant-progress-text {
+        display: none;
+    }
 }
 </style>

+ 10 - 6
src/views/market/market-spot/spot_trade_order_transaction/spot_trade_order_transaction_swap/components/delisting/setup.ts

@@ -3,7 +3,7 @@ import { RuleObject } from "ant-design-vue/lib/form/interface";
 import { onBeforeUnmount, reactive, ref, UnwrapRef } from "vue";
 import { FormParam } from "./interface";
 
-
+const formRef = ref();
 const formState: UnwrapRef<FormParam> = reactive({
     accountid: undefined,
     num: 0,
@@ -18,7 +18,7 @@ export function handleForm() {
     const v_price = async (rule: RuleObject, value: number) => {
         return validateCommon(value, '请输入限价');
     };
-    const formRef = ref();
+
     const rules = {
         num: [{ required: true, message: '请输入挂牌数量', trigger: 'blur', type: 'number', min: 1 }],
         price: [{ required: true, trigger: 'blur', type: 'number', validator: v_price }],
@@ -33,26 +33,30 @@ export function handleForm() {
 // 价格
 export const useBlocksPrice = () => {
     const priceCheck = ref<boolean>(false); // 是否可议价
-    function increasePrice() {
+    function increasePrice(field: string) {
         formState.price++;
+        formRef.value?.validateField(field); // 触发字段验证
     }
-    function decreasePrice() {
+    function decreasePrice(field: string) {
         if (formState.price) {
             formState.price--;
         }
+        formRef.value?.validateField(field); // 触发字段验证
     }
     return { priceCheck, increasePrice, decreasePrice };
 };
 
 // 数量
 export const useBlocksNumber = () => {
-    function increaseNumber() {
+    function increaseNumber(field: string) {
         formState.num++;
+        formRef.value?.validateField(field); // 触发字段验证
     }
-    function decreaseNumber() {
+    function decreaseNumber(field: string) {
         if (formState.num) {
             formState.num--;
         }
+        formRef.value?.validateField(field); // 触发字段验证
     }
     return { increaseNumber, decreaseNumber };
 };

+ 4 - 4
src/views/market/market-spot/spot_trade_order_transaction/spot_trade_order_transaction_swap/components/post_buying/index.vue

@@ -83,8 +83,8 @@
                     <a-col :span="24" v-if="!isFloat()">
                       <a-form-item label="挂牌价格" name="FixedPrice" class="inputIconBox">
                         <a-input-number class="commonInput" style="width: 260px" :min="0" v-model:value="formState.FixedPrice" />
-                        <MinusOutlined @click="decreasePrice" />
-                        <PlusOutlined @click="increasePrice" />
+                        <MinusOutlined @click="decreasePrice('FixedPrice')" />
+                        <PlusOutlined @click="increasePrice('FixedPrice')" />
                       </a-form-item>
                     </a-col>
                     <a-col :span="24" v-else>
@@ -101,8 +101,8 @@
                     <a-col :span="24">
                       <a-form-item label="挂牌数量" name="OrderQty" class="inputIconBox">
                         <a-input-number class="commonInput" style="width: 260px" :min="0" :max="getMaxNum()" v-model:value="formState.OrderQty" />
-                        <MinusOutlined @click="decreaseNum" />
-                        <PlusOutlined @click="increaseNum" />
+                        <MinusOutlined @click="decreaseNum('OrderQty')" />
+                        <PlusOutlined @click="increaseNum('OrderQty')" />
                         <span class="input-enumdicname">{{ selected.enumdicname }}</span>
                       </a-form-item>
                     </a-col>

+ 10 - 7
src/views/market/market-spot/spot_trade_order_transaction/spot_trade_order_transaction_swap/components/post_buying/setup.ts

@@ -4,7 +4,7 @@ import { RuleObject } from "ant-design-vue/lib/form/interface";
 import { onBeforeUnmount, reactive, ref, UnwrapRef } from "vue";
 import { FormParam } from "./interface";
 
-
+const formRef = ref();
 const formState: UnwrapRef<FormParam> = reactive({
     accountid: undefined,
     FixedPrice: 0,
@@ -23,9 +23,8 @@ export function handleForm() {
     const v_price = async (rule: RuleObject, value: number) => {
         return validateCommon(value, '请输入挂牌价格');
     };
-    const formRef = ref();
     const rules = {
-        FixedPrice: [{ required: true, message: '请输入挂牌价格', trigger: 'blur', type: 'number', validator: v_price }],
+        FixedPrice: [{ required: true, type: 'number', validator: v_price }],
         OrderQty: [{ required: true, message: '请输入挂牌数量', trigger: 'blur', type: 'number', min: 1 }],
         PriceMove: [{ required: true, message: '请输入点差', trigger: 'blur', type: 'number' }],
         accountid: [{ required: true, message: '请输入交易账号' }],
@@ -56,28 +55,32 @@ export function useBuySellDirection() {
 
 // 价格
 export const usePrice = () => {
-    function increasePrice() {
+    function increasePrice(field: string) {
         formState.FixedPrice++;
+        formRef.value?.validateField(field); // 触发字段验证
     }
-    function decreasePrice() {
+    function decreasePrice(field: string) {
         if (formState.FixedPrice) {
             formState.FixedPrice--;
         }
+        formRef.value?.validateField(field); // 触发字段验证
     }
     return { increasePrice, decreasePrice };
 };
 
 export const useNum = (getMaxNum: Function) => {
-    function increaseNum() {
+    function increaseNum(field: string) {
         const max = getMaxNum()
         if (max && formState.OrderQty < max) {
             formState.OrderQty++;
         }
+        formRef.value?.validateField(field); // 触发字段验证
     }
-    function decreaseNum() {
+    function decreaseNum(field: string) {
         if (formState.OrderQty) {
             formState.OrderQty--;
         }
+        formRef.value?.validateField(field); // 触发字段验证
     }
     return { increaseNum, decreaseNum };
 }

+ 2 - 2
src/views/order/pre_sale_warehouse_receipt/components/pre_sale_warehouse_receipt_order_summary/components/listed/index.vue

@@ -333,7 +333,7 @@ import { getGoodsPrice } from '@/views/market/market-spot/components/buy-sell-ma
 import { message } from 'ant-design-vue';
 import moment from 'moment';
 import { v4 as uuidv4, v4 } from 'uuid';
-import { defineComponent, onMounted, PropType, ref } from 'vue';
+import { defineComponent, onBeforeUnmount, PropType, ref } from 'vue';
 import { ListingForm } from './interface';
 import { handleForm, handleGoods, handleNumAndPrice } from './setup';
 
@@ -392,7 +392,7 @@ export default defineComponent({
 
             return result;
         }
-        onMounted(() => {
+        onBeforeUnmount(() => {
             removeSubscribeQuotation(uuid);
         });
         const { getWrMoney, getWrMargin, isFloat, isFixed, isBlocs } = handleNumAndPrice();

+ 2 - 2
src/views/order/spot_warran/components/spot_warrant_spot_details/components/listing/index.vue

@@ -201,7 +201,7 @@ import Bus from '@/utils/eventBus/index';
 import { message } from 'ant-design-vue';
 import moment from 'moment';
 import { v4 } from 'uuid';
-import { defineComponent, onMounted, PropType, ref } from 'vue';
+import { defineComponent, onBeforeUnmount, PropType, ref } from 'vue';
 import { ListingForm } from './interface';
 import { handleForm, handleGoods, handleNumAndPrice, queryMarketSection } from './setup';
 
@@ -290,7 +290,7 @@ export default defineComponent({
 
       return result;
     }
-    onMounted(() => {
+    onBeforeUnmount(() => {
       removeSubscribeQuotation(uuid);
     });
     const { getWrMoney, getWrMargin, isFloat, isFixed, isBlocs } = handleNumAndPrice();