From 067883c72b282546402064eb1b78d8618d45b74d Mon Sep 17 00:00:00 2001
From: jhzh <1628036192@qq.com>
Date: Mon, 21 Apr 2025 17:23:10 +0800
Subject: [PATCH] 1

---
 src/page/user/Warehouse/data.list.vue |  101 +++++++++++++++++++++++++++++++++++---------------
 1 files changed, 71 insertions(+), 30 deletions(-)

diff --git a/src/page/user/Warehouse/data.list.vue b/src/page/user/Warehouse/data.list.vue
index d5a9f8c..03e2e22 100644
--- a/src/page/user/Warehouse/data.list.vue
+++ b/src/page/user/Warehouse/data.list.vue
@@ -24,8 +24,9 @@
         :key="index"
         @click="$router.push(`/Stockdetail?codes=${item.positionSn}`)" >
         <div @click.stop="pushRouter(item)">
+
           <div class="title-box" style="justify-content: space-between;">
-            <div class="span">{{ item.stockName }}</div>
+            <div class="span" :style="item.isListed==false?'color:red;':''">{{ item.stockName }}</div>
             <div
               class="states"
               :class="item.orderDirection === '买跌' ? 'states-red' : ''"
@@ -41,7 +42,7 @@
               <div class="sport-content-title2" >
                 {{ $t("盈虧") }} ({{ activeObj.symbolCode }})
               </div>
-              <div class="sport-content-text" style="color:#3e9976;">
+              <div class="sport-content-text2" :style="item.profitAndLoseParent.charAt(0)=='-'?'color:#cc1b1b;':'color:#3e9976;'">
                 ₹{{ item.profitAndLose | _toLocaleString }}
               </div>
             </div>
@@ -51,7 +52,7 @@
               <div class="sport-content-title2">
                 {{ $t("hj141") }} ({{ activeObj.symbolCode }})
               </div>
-              <div class="sport-content-text2" style="color:#3e9976;">
+              <div class="sport-content-text2" :style="item.profitAndLoseParent.charAt(0)=='-'?'color:#cc1b1b;':'color:#3e9976;'">
                 {{ item.profitAndLoseParent }}
               </div>
             </div>
@@ -59,7 +60,7 @@
           <van-col span="8">
             <div style="text-align: right">
               <div class="sport-content-title2">{{ $t("倉位(股)") }}</div>
-              <div class="sport-content-text">{{ item.orderNum }}</div>
+              <div class="sport-content-text2">{{ item.orderNum }}</div>
             </div></van-col
           >
         </van-row>
@@ -96,13 +97,23 @@
           </van-col>
         </van-row>
         <van-row>
-          <van-col span="8">
+          <van-col span="12">
             <div style="text-align: left">
               <div class="sport-content-title2">
                 {{ $t("hj44") }} ({{ activeObj.symbolCode }})
               </div>
               <div class="sport-content-text2">
                ₹{{ item.orderFee | _toLocaleString }}
+              </div>
+            </div>
+          </van-col>
+          <van-col span="12">
+            <div style="text-align: right">
+              <div class="sport-content-title2">
+                {{ $t("待补金额") }} ({{ activeObj.symbolCode }})
+              </div>
+              <div class="sport-content-text2">
+               ₹{{ item.amountToBeCovered | _toLocaleString }}
               </div>
             </div>
           </van-col>
@@ -175,7 +186,7 @@
               <div class="sport-content-title2">
                 {{ $t("盈虧") }} ({{ activeObj.symbolCode }})
               </div>
-              <div class="sport-content-text" style="color:#3e9976;">
+              <div class="sport-content-text2" :style="item.profitAndLoseParent.charAt(0)=='-'?'color:#cc1b1b;':'color:#3e9976;'">
                 ₹{{ item.profitAndLose | _toLocaleString }}
               </div>
             </div>
@@ -185,7 +196,7 @@
               <div class="sport-content-title2">
                 {{ $t("hj141") }} ({{ activeObj.symbolCode }})
               </div>
-              <div class="sport-content-text2" style="color:#3e9976;">
+              <div class="sport-content-text2" :style="item.profitAndLoseParent.charAt(0)=='-'?'color:#cc1b1b;':'color:#3e9976;'">
                 {{ item.profitAndLoseParent }}
               </div>
             </div>
@@ -193,7 +204,7 @@
           <van-col span="8">
             <div style="text-align: right">
               <div class="sport-content-title2">{{ $t("倉位(股)") }}</div>
-              <div class="sport-content-text">{{ item.orderNum }}</div>
+              <div class="sport-content-text2">{{ item.orderNum }}</div>
             </div></van-col
           >
         </van-row>
@@ -300,9 +311,10 @@
           </div>
           <div class="hang">
             <div class="left">{{ $t("倉位(股)") }}</div>
-            <div class="right" style="color: rgb(3, 173, 143)">
+            <!-- <div class="right" style="color: rgb(3, 173, 143)">
               {{ closeSell.orderNum }}
-            </div>
+            </div> -->
+            <input class="input_box" type="number" :max="closeSell.orderNum" :placeholder="$t('hj262')"  v-model="ordernum" />
           </div>
           <div class="hang">
             <div class="left">{{ $t("類型") }}</div>
@@ -338,6 +350,7 @@
       closeSell: {},
       show: false,
       actives: 0,
+      ordernum:'',
       dataList: [],
       newdataList:[],
       timer: null,
@@ -365,7 +378,7 @@
       // this.dataList = [];
       this.timer = setInterval(() => {
         this.getList();
-      }, 3000);
+      }, 1000);
     },
     pushRouter(item) {
       const obj = {
@@ -394,18 +407,43 @@
       this.loading = true;
     },
     async confirm() {
+      this.$refs.closeDialog.show = false;
       const res = await sell({
         positionSn: this.closeSell.positionSn,
+        number:this.ordernum
       });
       if (res.status === 0) {
-        this.$refs.closeDialog.show = false;
         this.dataList = [];
         this.pageNum = 1;
         this.finished = false;
+        Notify({ type: "success", message: res.msg });
         this.getList();
         this.$emit("closingPosition");
       } else {
         Notify({ type: "danger", message: res.msg });
+      }
+    },
+    // 获取仓位列表
+    async getLists(laber) {
+      if (laber) {
+        this.dataList = [];
+        this.pageNum = 1;
+        this.finished = false;
+      }
+      const res = await getchicang({
+        state: this.actives,
+        stockType: laber || this.activeObj.laber,
+        pageNum: 1,
+        pageSize: 30,
+      });
+
+      this.loading = false;
+      if (res.status === 0) {
+        this.newdataList = res.data.list;
+        this.finished = true;
+      } else {
+        this.loading = false;
+        this.finished = true;
       }
     },
     // 获取仓位列表
@@ -419,24 +457,14 @@
         state: this.actives,
         stockType: laber || this.activeObj.laber,
         pageNum: 1,
-        pageSize: 100,
+        pageSize: 30,
       });
 
       this.loading = false;
       if (res.status === 0) {
-        if(this.actives == 0){
-          this.dataList = res.data.list;
-        }else{
-          this.newdataList = res.data.list;
-        }
-        this.$forceUpdate(); // 强制Vue重新渲染
-        // if (res.data.total <= this.dataList.length) {
+        this.dataList = []
+        this.dataList = res.data.list;
         this.finished = true;
-        // this.dsq()
-        // this.timer = setInterval(() => {
-        //   this.getList();
-        // }, 3000);
-        //   }
       } else {
         this.loading = false;
         this.finished = true;
@@ -445,23 +473,30 @@
     close(item) {
       this.closeSell = item;
       this.$refs.closeDialog.show = true;
+      this.ordernum = ''
     },
+
     clickTabs(e) {
-      this.dataList = [];
       this.pageNum = 1;
       this.finished = false;
       this.actives = e.key;
-      this.$forceUpdate(); // 强制Vue重新渲染
+      this.newdataList = []
+      this.dataList = []
+
       if(e.key==1){
-        clearTimeout(this.timer);
+        clearInterval(this.timer); // 在组件销毁前清除定时器
+        // clearTimeout(this.timer);
         // setTimeout(()=>{
         //   clearInterval(this.timer); // 在组件销毁前清除定时器
         // },3000)
-        this.getList()
-
+        this.getLists()
+        // this.startPolling();
+        // this.dsq()
       }else{
+        clearInterval(this.timer); // 在组件销毁前清除定时器
         this.dsq()
       }
+      this.$forceUpdate(); // 强制Vue重新渲染
 
       // this.getList()
       // if(e.key !=this.actives){
@@ -477,6 +512,12 @@
 </script>
 
 <style lang="less" scoped>
+  .input_box{
+        text-align: right;
+        font-size: 16px;
+
+            padding: 0 4px;
+  }
 .sport-tabs {
   // font-family: PingFang SC;
   font-family: "DINPro";

--
Gitblit v1.9.3