li.shaoyi il y a 3 ans
Parent
commit
a52459991c

+ 1 - 1
src/services/bus/login.ts

@@ -15,11 +15,11 @@ import { LoginResponse } from '../socket/login/interface/index';
 import Router from '@/router';
 
 export const logout = (): void => {
-    timerUtil.clearAll();
     logoutResponse();
     removeLoginData();
     APP.closeServer();
     APP.closeQuote();
+    timerUtil.clearAll();
     Router.replace('/login');
 };
 

+ 1 - 1
src/services/index.ts

@@ -114,7 +114,7 @@ export default new (class LifeCycleCtr {
             this.dataCenter.reset();
             // sessionStorage.clear();
             // localStorageUtil.removeItem('loginData');
-            timerUtil.clearAll();
+            // timerUtil.clearAll();
         }
     }
 

+ 2 - 2
src/services/socket/quota/index.ts

@@ -65,7 +65,7 @@ function actionSubcribe() {
                     })
                     .catch((err) => {
                         isSubscribeSucess = false
-                        console.log('订阅失败:', err);
+                        console.log('解析失败:', err);
                         // 失败原因:行情断
                         // 重新 走行情链接逻辑
                     });
@@ -73,7 +73,7 @@ function actionSubcribe() {
             onFail: (err) => {
                 if (isLogin()) {
                     isSubscribeSucess = false
-                    console.log('订阅失败:', err)
+                    console.log('订阅失败:', err.message)
                 } else {
                     isSubscribeSucess = true
                 }

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

@@ -40,7 +40,7 @@
 
             <a-col :span="24">
               <a-form-item label="挂牌数量" name="OrderQty">
-                <a-input-number class="commonInput" style="width: 260px" :min="0" :max="getMaxNum()" v-model:value="formState.OrderQty" />
+                <a-input-number class="commonInput" style="width: 260px" :min="0" :max="listingType === 'buy' ? getMaxNum() : wrPosition.creditenableqty" v-model:value="formState.OrderQty" />
                 <span class="input-enumdicname">{{ selectedRow.enumdicname }}</span>
               </a-form-item>
             </a-col>
@@ -51,11 +51,15 @@
             </a-col>
             <a-col :span="24" class="mt-10">
               <a-form-item>
-                <a-slider :min="0" v-model:value="formState.OrderQty" :max="getMaxNum()" class="formSlider" />
-                <div class="unit">
+                <a-slider :min="0" v-model:value="formState.OrderQty" :max="listingType === 'buy' ? getMaxNum() : wrPosition.creditenableqty" class="formSlider" />
+                <div class="unit" v-if="listingType === 'buy'">
                   <span>{{ getMaxNum() ? selectedRow.minivalue : 0 }}</span>
                   <span>{{ getMaxNum() }}{{ selectedRow.enumdicname }}</span>
                 </div>
+                <div class="unit" v-else>
+                  <span>{{ wrPosition.creditenableqty ? selectedRow.minivalue : 0 }}</span>
+                  <span>{{ wrPosition.creditenableqty }}{{ selectedRow.enumdicname }}</span>
+                </div>
               </a-form-item>
             </a-col>
             <a-col :span="24">
@@ -104,7 +108,7 @@
         <a-row :gutter="24">
           <a-col :span="24" class="fixedBtns">
             <a-form-item class="btnCenter">
-              <a-button class="listedBtn" @click="submit" :loading="loading">买入</a-button>
+              <a-button class="listedBtn" @click="submit" :loading="loading">{{ listingType === 'buy' ? '买入' : '卖出' }}</a-button>
               <a-button class="ml10 cancelBtn" @click="cancel(false)" :disabled="loading">取消</a-button>
             </a-form-item>
           </a-col>
@@ -173,6 +177,7 @@ export default defineComponent({
     const { rules, formState, formRef } = handleForm(props.selectedRow);
     const loading = ref<boolean>(false);
     const accountList = getAccountTypeList([2]);
+    const wrPosition = ref<WrPosition>(); // 预售仓单头寸
     const listingType = ref<'buy' | 'sell'>('buy'); // 挂牌方式
     const showListingType = ref(false); // 是否显示挂牌方式
 
@@ -201,18 +206,17 @@ export default defineComponent({
             // 获取持仓头寸
             queryWrPosition({ haswr: 0, querytype: 2, }).then((res) => {
               const { wrfactortypeid, wrstandardid, warehouseid, dgitemname } = props.selectedRow;
-              let wrPosition: WrPosition | undefined = undefined;
 
               if (wrfactortypeid) {
                 // 根据仓单要素id查询头寸
-                wrPosition = res.find((e) => e.wrfactortypeid === wrfactortypeid);
+                wrPosition.value = res.find((e) => e.wrfactortypeid === wrfactortypeid);
               } else {
                 // 根据商品、仓库、品牌查询持仓头寸
-                wrPosition = res.find((e) => e.wrstandardid === wrstandardid && e.warehouseid === warehouseid && e.wrtypename.includes(dgitemname));
+                wrPosition.value = res.find((e) => e.wrstandardid === wrstandardid && e.warehouseid === warehouseid && e.wrtypename.includes(dgitemname));
               }
 
               // 卖方需要有仓单头寸 “预售可用额度”
-              if (wrPosition && wrPosition?.creditenableqty > 0) {
+              if (wrPosition.value && wrPosition.value.creditenableqty > 0) {
                 showListingType.value = true;
               }
             })
@@ -295,7 +299,7 @@ export default defineComponent({
           PerformanceTemplateID: res.permaceTempId, // 履约计划模板ID
           UserID: getUserId(),
           OperatorID: getUserId(), // 操作员账号ID
-          BuyOrSell: 0, // 买卖方向 0买1卖
+          BuyOrSell: listingType.value === 'buy' ? 0 : 1, // 买卖方向 0买1卖
           PriceDisplayMode: 1, // 浮动价显示方式 1:合并显示 2:分开显示
           CanBargain: 0, // 挂牌是否可议价0:不可1:可-摘牌是否议价
           Attachment1: '', // 附件1
@@ -319,7 +323,7 @@ export default defineComponent({
               })
               : [], // DGFactoryItems 要素类型明细集合(没有仓单要素ID填写)
         };
-        requestResultLoadingAndInfo(hdWROrder, param, loading, ['求购成功', '求购失败:']).then(() => {
+        requestResultLoadingAndInfo(hdWROrder, param, loading, ['挂牌成功', '挂牌失败:']).then(() => {
           cancel(true);
         });
       });
@@ -333,6 +337,7 @@ export default defineComponent({
       rules,
       formState,
       formRef,
+      wrPosition,
       listingType,
       showListingType,
       isFloat,

+ 2 - 2
src/views/order/swap_the_order/components/swap_commodity_contract_summary/index.vue

@@ -30,9 +30,9 @@
           <a>{{ getLastprice(record) }}</a>
         </template>
         <!-- 均价 -->
-        <template #averageprice="{ record }">
+        <!-- <template #averageprice="{ record }">
           <a>{{ handleNoneValue(record.averageprice.toFixed(record.decimalplace)) }}</a>
-        </template>
+        </template> -->
         <!-- 持仓盈亏 -->
         <template #profitloss="{ record }">
           <span :class="[+useProfitloss(record, findGoodsCode(record.goodsid, record.goodscode, swapList)) > 0 ? 'up-quote-color' : +useProfitloss(record, findGoodsCode(record.goodsid, record.goodscode, swapList)) < 0 ? 'down-quote-color' : '']">{{ record.averageprice ? useProfitloss(record, findGoodsCode(record.goodsid, record.goodscode, swapList)) : '--' }}</span>