From 74bcf0374dad94d352b68f10e2e3d6e0ebc2c9dc Mon Sep 17 00:00:00 2001
From: zzzz <690498789@qq.com>
Date: Sun, 07 Apr 2024 12:32:13 +0800
Subject: [PATCH] 1

---
 src/page/list/tradingList/data.list.vue |   59 +++++++++++++++++++++++++++++++++++++++++------------------
 1 files changed, 41 insertions(+), 18 deletions(-)

diff --git a/src/page/list/tradingList/data.list.vue b/src/page/list/tradingList/data.list.vue
index 0329c97..498117e 100644
--- a/src/page/list/tradingList/data.list.vue
+++ b/src/page/list/tradingList/data.list.vue
@@ -21,6 +21,7 @@
     </div>
 
     <van-list
+      style="margin-bottom: 50px"
       v-model="loadings"
       :finished="finished"
       :finished-text="$t('hj43')"
@@ -75,9 +76,9 @@
             <div style="text-align: right">
               <div
                 class="tp right_bs"
-                :class="`${item.hcrate > 0 ? 'green' : 'red'}`"
+                :class="`${item.color > 0 ? 'green' : 'red'}`"
               >
-                <span class="price_color">{{ item.hcrate }}</span>
+                <span class="price_color">{{ item.hcrateP }}</span>
               </div>
             </div>
           </van-col>
@@ -108,25 +109,32 @@
       type: Array,
       default: [],
     },
+    zxtabsList: {
+      type: Array,
+      default: [],
+    },
   },
   watch: {
     active(e) {
       this.finished = false;
       this.listArr = [];
       this.pageNumVal = 1;
-      this.getStock(e, this.zxactive);
+      this.loadings = true;
+      this.getStock(e, this.zxactive, 1);
     },
     zxactive(e) {
       this.finished = false;
       this.listArr = [];
       this.pageNumVal = 1;
-      this.getStock(this.active, e);
+      this.loadings = true;
+      this.getStock(this.active, e, 1);
     },
     sousuo(e) {
       this.finished = false;
       this.listArr = [];
       this.pageNumVal = 1;
-      this.getStock(this.active, this.zxactive);
+      this.loadings = true;
+      this.getStock(this.active, this.zxactive, 1);
     },
   },
   data() {
@@ -141,7 +149,7 @@
   mounted() {
     this.listArr = [];
     this.pageNumVal = 1;
-    this.getStock(this.active, this.zxactive);
+    this.getStock(this.active, this.zxactive, 1);
   },
   methods: {
     filterSH(val) {
@@ -176,44 +184,59 @@
         },
       });
     },
+
     // 获取列表
-    getStock: handleDt.debounce(async function (a, b) {
+    getStock: handleDt.debounce(async function (a, b, c) {
       a = this.active;
+
       let stockType = "";
       if (a !== "") {
         let array = this.tabsList.filter((item) => item.key === a);
         stockType = array[0].name;
+      } else {
+        // return this.getStockzx();
+        let array = this.zxtabsList.filter((item) => item.key === b);
+        stockType = array[0].name;
       }
+      console.log(a, b, c, "=====");
+      let pageNumVal = c || this.pageNumVal;
       let opt = {
-        pageNum: this.pageNumVal,
+        pageNum: pageNumVal,
         pageSize: 15,
         stockPlate: "",
         keyWords: this.sousuo,
         stockType: stockType,
         orderBy: "",
       };
-      let data = await api.getStockByType(opt);
-      this.loading = false;
+
+      // console.log();
+      // api.positionzx;
+      let data;
+      if (a !== "") {
+        data = await api.getStockByType(opt);
+      } else {
+        // 自选
+        data = await api.positionzx(opt);
+      }
+
+      this.loadings = false;
       if (data.status === 0) {
-        if (this.listArr.length >= data.data.total) {
+        if (data.data.list.length < 15) {
           this.finished = true;
         }
-        if (this.pageNumVal !== 1) {
+        if (pageNumVal !== 1) {
           this.listArr = [...this.listArr, ...data.data.list];
         } else {
           this.listArr = data.data.list;
         }
       } else {
-        this.loading = false;
         this.finished = true;
       }
     }, 500),
     onLoads() {
-      if (!this.loading) {
-        this.pageNumVal++;
-        this.loading = true;
-        this.getStock();
-      }
+      this.pageNumVal++;
+      this.loadings = true;
+      this.getStock();
     },
     optionszx() {},
   },

--
Gitblit v1.9.3