From 8852f8d5ccf02049b9e90a2d537be53c671d8472 Mon Sep 17 00:00:00 2001
From: lxf <1371462558@qq.com>
Date: Wed, 30 Apr 2025 01:07:12 +0800
Subject: [PATCH] 大宗无数据一直加载的bug

---
 src/page/list/tradingList/data.list.vue |   63 +++++++++++++++++++------------
 1 files changed, 39 insertions(+), 24 deletions(-)

diff --git a/src/page/list/tradingList/data.list.vue b/src/page/list/tradingList/data.list.vue
index 8aadde9..53547c6 100644
--- a/src/page/list/tradingList/data.list.vue
+++ b/src/page/list/tradingList/data.list.vue
@@ -2,16 +2,16 @@
   <div class="list-data">
     <div class="header-box">
       <van-row type="flex" align="center" gutter="20">
-        <van-col span="8">
+        <van-col span="11">
           <div>
             {{ $t("hj313") }}
           </div>
         </van-col>
-        <van-col span="3">
+        <!-- <van-col span="3">
           <div style="text-align: right">
             {{ $t("市场") }}
           </div>
-        </van-col>
+        </van-col> -->
         <van-col :span="active == 'DZ' ? '12' : '7'">
           <div style="text-align: right">
             {{ $t("hj314") }}
@@ -31,7 +31,7 @@
             @select="onSelect"
           >
             <template #reference>
-              <van-button type="primary">الترتيب</van-button>
+              <van-button type="primary">{{ $t("排序") }}</van-button>
             </template>
           </van-popover>
         </van-col>
@@ -59,7 +59,7 @@
           :key="item.indexCode"
         >
           <van-row type="flex" align="center" gutter="20">
-            <van-col span="8" style="padding-right: 0 !important;">
+            <van-col span="13" style="padding-right: 0 !important;">
               <div>
                 <div class="tp">
                   <div class="collection" @click="optionszx(item)">
@@ -78,7 +78,7 @@
                       white-space: nowrap;
                     "
                   >
-                    {{ item.name || item.stockName }}
+                    {{ item.st_name || item.name || item.stockName }}
                   </div>
                 </div>
                 <div class="bt">
@@ -87,17 +87,17 @@
               </div>
             </van-col>
 
-            <van-col span="3" v-if="active != 'HJ'">
+            <!-- <van-col span="3" v-if="active != 'HJ'">
               <div style="text-align: right">
                 {{ (item.gid || item.stockGid).toUpperCase() }}
               </div>
-            </van-col>
+            </van-col> -->
 
-            <van-col :span="active == 'DZ' ? '12' : '7'">
+            <van-col :span="active == 'DZ' ? '12' : '5'">
               <div style="text-align: right">
                 <div class="tp">
                   <span class="price_color">
-                    {{ item.nowPrice | _toLocaleString(false) }}
+                    {{ item.nowPrice }}
                   </span>
                 </div>
                 <div class="bt" v-if="active != 'DZ'">
@@ -105,7 +105,7 @@
                 </div>
               </div>
             </van-col>
-            <van-col span="6" v-if="!['DZ', 'HJ'].includes(active)">
+            <van-col span="6" v-if="!['DZ'].includes(active)">
               <div style="text-align: right">
                 <div
                   class="tp right_bs"
@@ -198,12 +198,12 @@
       pageNumVal: 1,
       getInterval: null,
       num: 1,
-      orderBy: '',
+      orderBy: "",
       refreshing: false,
-      actions:[
-        { text: 'ترتيب', zh: '升序', val: 'asc' },
-        { text: 'التخفيض',zh:'降序' , val: 'desc'},
-        { text: 'طبيعي' ,zh: '正常', val: ''},
+      actions: [
+        { text: this.$t("升序"), zh: "升序", val: "asc" },
+        { text: this.$t("降序"), zh: "降序", val: "desc" },
+        { text: this.$t("正常"), zh: "正常", val: "" }
       ]
     };
   },
@@ -224,7 +224,7 @@
   },
   methods: {
     onSelect(action) {
-      this.orderBy = (action.val);
+      this.orderBy = action.val;
       this.getStock(this.active, this.zxactive, 1);
     },
     filterSH(val) {
@@ -246,7 +246,8 @@
       // 点击进入详情
       const obj = {
         pid: item.code || "",
-        type: item.stock_type || ""
+        type: item.stock_type || "",
+        name: item.name || ""
       };
       window.localStorage.setItem("kLine", JSON.stringify(obj));
       // return;
@@ -303,17 +304,31 @@
         } else if (a == "HJ") {
           data = await api.getGoldCrudeOil();
 
-          data.data.list = Object.entries(data.data).map(
-            ([name, nowPrice]) => ({
+          data.data.list = Object.entries(data.data).map(([name, nowPrice]) => {
+            let nowPriceArr = Object.entries(nowPrice);
+            let nowPriceObj = {};
+            nowPriceArr.map(item => {
+              if (name === item[0]) {
+                nowPriceObj.st_name = item[0];
+                nowPriceObj.nowPrice = item[1];
+              }
+              nowPriceObj = {
+                ...nowPriceObj,
+                [item[0]]: item[1]
+              };
+            });
+            return {
               name,
-              nowPrice,
-              stock_type: "HJ"
-            })
-          );
+              stock_type: "HJ",
+              ...nowPriceObj
+            };
+          });
         } else {
           //大宗
           opt.stockType = "";
           data = await api.stockgetDzList(opt);
+          this.loadings = false;
+          this.finished = true;
         }
       } else {
         // 自选

--
Gitblit v1.9.3