lxf
2025-04-24 6ae727d83d6e42428711fa2337528679aae239eb
src/page/user/Warehouse/data.list.vue
@@ -17,22 +17,16 @@
      :loading-text="$t('hj430')"
      @load="onLoad"
    >
      <div
        v-if="actives === 0"
      <div v-if="actives === 0"
        class="sport-content-li"
        :style="actives === 1 ? 'height:5.52rem' : 'height:7.52rem'"
        v-for="(item, index) in dataList"
        :key="index"
        @click="$router.push(`/Stockdetail?codes=${item.positionSn}`)"
      >
        @click="$router.push(`/Stockdetail?codes=${item.positionSn}`)" >
        <div @click.stop="pushRouter(item)">
          <div class="title-box" style="justify-content: space-between;">
            <div
              class="span"
              :style="item.isListed == false ? 'color:red;' : ''"
            >
              {{ item.stockName }}
            </div>
            <div class="span" :style="item.isListed==false?'color:red;':''">{{ item.stockName }}</div>
            <div
              class="states"
              :class="item.orderDirection === '买跌' ? 'states-red' : ''"
@@ -45,18 +39,11 @@
        <van-row>
          <van-col span="8">
            <div style="text-align: left">
              <div class="sport-content-title2">
              <div class="sport-content-title2" >
                {{ $t("盈虧") }} ({{ activeObj.symbolCode }})
              </div>
              <div
                class="sport-content-text2"
                :style="
                  item.profitAndLoseParent.charAt(0) == '-'
                    ? 'color:#cc1b1b;'
                    : 'color:#3e9976;'
                "
              >
                ₹{{ item.profitAndLose | _toLocaleString }}
              <div class="sport-content-text2" :style="item.profitAndLoseParent.charAt(0)=='-'?'color:#cc1b1b;':'color:#3e9976;'">
                {{ item.profitAndLose  }}
              </div>
            </div>
          </van-col>
@@ -65,14 +52,7 @@
              <div class="sport-content-title2">
                {{ $t("hj141") }} ({{ activeObj.symbolCode }})
              </div>
              <div
                class="sport-content-text2"
                :style="
                  item.profitAndLoseParent.charAt(0) == '-'
                    ? 'color:#cc1b1b;'
                    : 'color:#3e9976;'
                "
              >
              <div class="sport-content-text2" :style="item.profitAndLoseParent.charAt(0)=='-'?'color:#cc1b1b;':'color:#3e9976;'">
                {{ item.profitAndLoseParent }}
              </div>
            </div>
@@ -91,7 +71,7 @@
                {{ $t("hj40") }}({{ activeObj.symbolCode }})
              </div>
              <div class="sport-content-text2">
                ₹{{ item.now_price | _toLocaleString }}
                {{ item.now_price  }}
              </div>
            </div>
          </van-col>
@@ -101,7 +81,7 @@
                {{ $t("持倉價") }} ({{ activeObj.symbolCode }})
              </div>
              <div class="sport-content-text2">
                ₹{{ item.buyOrderPrice | _toLocaleString }}
                {{ item.buyOrderPrice  }}
              </div>
            </div>
          </van-col>
@@ -111,7 +91,7 @@
                {{ $t("訂單金額") }} ({{ activeObj.symbolCode }})
              </div>
              <div class="sport-content-text2">
                ₹{{ item.orderTotalPrice | _toLocaleString }}
                {{ item.orderTotalPrice  }}
              </div>
            </div>
          </van-col>
@@ -123,7 +103,7 @@
                {{ $t("hj44") }} ({{ activeObj.symbolCode }})
              </div>
              <div class="sport-content-text2">
                ₹{{ item.orderFee | _toLocaleString }}
               {{ item.orderFee  }}
              </div>
            </div>
          </van-col>
@@ -133,17 +113,17 @@
                {{ $t("待补金额") }} ({{ activeObj.symbolCode }})
              </div>
              <div class="sport-content-text2">
                ₹{{ item.amountToBeCovered | _toLocaleString }}
               {{ item.amountToBeCovered  }}
              </div>
            </div>
          </van-col>
          <!-- <van-col span="8">
         <!-- <van-col span="8">
            <div style="text-align: center">
              <div class="sport-content-title2">
                {{ $t("止損價") }} ({{ activeObj.symbolCode }})
              </div>
              <div class="sport-content-text2">
                {{ item.stopTargetPrice | _toLocaleString }}
                {{ item.stopTargetPrice  }}
              </div>
            </div>
          </van-col>
@@ -153,7 +133,7 @@
                {{ $t("止盈價") }} ({{ activeObj.symbolCode }})
              </div>
              <div class="sport-content-text2">
                {{ item.profitTargetPrice | _toLocaleString }}
                {{ item.profitTargetPrice  }}
              </div>
            </div>
          </van-col> -->
@@ -181,14 +161,13 @@
        </div>
      </div>
      <div
        v-if="actives === 1"
      <div v-if="actives === 1"
        class="sport-content-li"
        :style="actives === 1 ? 'height:5.52rem' : 'height:7.52rem'"
        v-for="(item, index) in newdataList"
        :key="index"
        @click="$router.push(`/Stockdetail?codes=${item.positionSn}`)"
      >
        @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>
@@ -207,15 +186,8 @@
              <div class="sport-content-title2">
                {{ $t("盈虧") }} ({{ activeObj.symbolCode }})
              </div>
              <div
                class="sport-content-text2"
                :style="
                  item.profitAndLoseParent.charAt(0) == '-'
                    ? 'color:#cc1b1b;'
                    : 'color:#3e9976;'
                "
              >
                ₹{{ item.profitAndLose | _toLocaleString }}
              <div class="sport-content-text2" :style="item.profitAndLoseParent.charAt(0)=='-'?'color:#cc1b1b;':'color:#3e9976;'">
                {{ item.profitAndLose  }}
              </div>
            </div>
          </van-col>
@@ -224,14 +196,7 @@
              <div class="sport-content-title2">
                {{ $t("hj141") }} ({{ activeObj.symbolCode }})
              </div>
              <div
                class="sport-content-text2"
                :style="
                  item.profitAndLoseParent.charAt(0) == '-'
                    ? 'color:#cc1b1b;'
                    : 'color:#3e9976;'
                "
              >
              <div class="sport-content-text2" :style="item.profitAndLoseParent.charAt(0)=='-'?'color:#cc1b1b;':'color:#3e9976;'">
                {{ item.profitAndLoseParent }}
              </div>
            </div>
@@ -250,7 +215,7 @@
                {{ $t("hj40") }}({{ activeObj.symbolCode }})
              </div>
              <div class="sport-content-text2">
                ₹{{ item.now_price | _toLocaleString }}
                {{ item.now_price  }}
              </div>
            </div>
          </van-col>
@@ -260,7 +225,7 @@
                {{ $t("持倉價") }} ({{ activeObj.symbolCode }})
              </div>
              <div class="sport-content-text2">
                ₹{{ item.buyOrderPrice | _toLocaleString }}
                {{ item.buyOrderPrice  }}
              </div>
            </div>
          </van-col>
@@ -270,7 +235,7 @@
                {{ $t("訂單金額") }} ({{ activeObj.symbolCode }})
              </div>
              <div class="sport-content-text2">
                ₹{{ item.orderTotalPrice | _toLocaleString }}
                {{ item.orderTotalPrice  }}
              </div>
            </div>
          </van-col>
@@ -282,17 +247,17 @@
                {{ $t("hj44") }} ({{ activeObj.symbolCode }})
              </div>
              <div class="sport-content-text2">
                ₹{{ item.orderFee | _toLocaleString }}
               {{ item.orderFee  }}
              </div>
            </div>
          </van-col>
          <!-- <van-col span="8">
         <!-- <van-col span="8">
            <div style="text-align: center">
              <div class="sport-content-title2">
                {{ $t("止損價") }} ({{ activeObj.symbolCode }})
              </div>
              <div class="sport-content-text2">
                {{ item.stopTargetPrice | _toLocaleString }}
                {{ item.stopTargetPrice  }}
              </div>
            </div>
          </van-col>
@@ -302,7 +267,7 @@
                {{ $t("止盈價") }} ({{ activeObj.symbolCode }})
              </div>
              <div class="sport-content-text2">
                {{ item.profitTargetPrice | _toLocaleString }}
                {{ item.profitTargetPrice  }}
              </div>
            </div>
          </van-col> -->
@@ -349,13 +314,7 @@
            <!-- <div class="right" style="color: rgb(3, 173, 143)">
              {{ closeSell.orderNum }}
            </div> -->
            <input
              class="input_box"
              type="number"
              :max="closeSell.orderNum"
              :placeholder="$t('hj262')"
              v-model="ordernum"
            />
            <input class="input_box" type="number" :max="closeSell.orderNum" :placeholder="$t('hj262')"  v-model="ordernum" />
          </div>
          <div class="hang">
            <div class="left">{{ $t("類型") }}</div>
@@ -376,8 +335,8 @@
  props: {
    activeObj: {
      type: Object,
      default: {}
    }
      default: {},
    },
  },
  mounted() {
    this.getList();
@@ -391,40 +350,40 @@
      closeSell: {},
      show: false,
      actives: 0,
      ordernum: "",
      ordernum:'',
      dataList: [],
      newdataList: [],
      newdataList:[],
      timer: null,
      tabsList: [
        {
          title: this.$t("持倉"),
          key: 0
          key: 0,
        },
        {
          title: this.$t("平倉"),
          key: 1
        }
      ]
          key: 1,
        },
      ],
    };
  },
  created() {
    this.dsq();
  created(){
   this.dsq()
  },
  beforeDestroy() {
    clearInterval(this.timer); // 在组件销毁前清除定时器
  },
  methods: {
    dsq() {
    dsq(){
      // this.dataList = [];
      this.timer = setInterval(() => {
      // this.timer = setInterval(() => {
        this.getList();
      }, 1000);
      // }, 1000);
    },
    pushRouter(item) {
      const obj = {
        pid: item.stockCode || "",
        type: item.stockGid || ""
        type: item.stockGid || "",
      };
      window.localStorage.setItem("kLine", JSON.stringify(obj));
      // return;
@@ -439,8 +398,8 @@
          if_us: "",
          if_zhishu: 0,
          sok: "",
          type: item.stockGid
        }
          type: item.stockGid,
        },
      });
    },
    onLoad() {
@@ -451,7 +410,7 @@
      this.$refs.closeDialog.show = false;
      const res = await sell({
        positionSn: this.closeSell.positionSn,
        number: this.ordernum
        number:this.ordernum
      });
      if (res.status === 0) {
        this.dataList = [];
@@ -474,9 +433,8 @@
      const res = await getchicang({
        state: this.actives,
        stockType: laber || this.activeObj.laber,
        stockCode: "HJYY",
        pageNum: 1,
        pageSize: 30
        pageSize: 30,
      });
      this.loading = false;
@@ -495,21 +453,16 @@
        this.pageNum = 1;
        this.finished = false;
      }
      const _laber = laber || this.activeObj.laber;
      let opt = {
      const res = await getchicang({
        state: this.actives,
        stockType: _laber,
        stockType: laber || this.activeObj.laber,
        pageNum: 1,
        pageSize: 30
      };
      if (_laber === "USDT") {
        opt.stockCode = "HJYY";
      }
      const res = await getchicang(opt);
        pageSize: 30,
      });
      this.loading = false;
      if (res.status === 0) {
        this.dataList = [];
        this.dataList = []
        this.dataList = res.data.list;
        this.finished = true;
      } else {
@@ -520,50 +473,51 @@
    close(item) {
      this.closeSell = item;
      this.$refs.closeDialog.show = true;
      this.ordernum = "";
      this.ordernum = ''
    },
    clickTabs(e) {
      this.pageNum = 1;
      this.finished = false;
      this.actives = e.key;
      this.newdataList = [];
      this.dataList = [];
      this.newdataList = []
      this.dataList = []
      if (e.key == 1) {
      if(e.key==1){
        clearInterval(this.timer); // 在组件销毁前清除定时器
        // clearTimeout(this.timer);
        // setTimeout(()=>{
        //   clearInterval(this.timer); // 在组件销毁前清除定时器
        // },3000)
        this.getLists();
        this.getLists()
        // this.startPolling();
        // this.dsq()
      } else {
      }else{
        clearInterval(this.timer); // 在组件销毁前清除定时器
        this.dsq();
        this.dsq()
      }
      this.$forceUpdate(); // 强制Vue重新渲染
      // this.getList()
      // if(e.key !=this.actives){
      // }else{
      //   this.actives = e.key;
      //   this.dsq()
      // }
    }
  }
    },
  },
};
</script>
<style lang="less" scoped>
.input_box {
  text-align: right;
  font-size: 16px;
  .input_box{
        text-align: right;
        font-size: 16px;
  padding: 0 4px;
}
            padding: 0 4px;
  }
.sport-tabs {
  // font-family: PingFang SC;
  font-family: "DINPro";