jhzh
2025-04-25 dfa832402406320240380fb5372f4a19ed62b2f7
src/page/user/Warehouse/data.list.vue
@@ -17,16 +17,22 @@
      :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' : ''"
@@ -39,11 +45,18 @@
        <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>
@@ -52,7 +65,14 @@
              <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>
@@ -71,7 +91,7 @@
                {{ $t("hj40") }}({{ activeObj.symbolCode }})
              </div>
              <div class="sport-content-text2">
                ₹{{ item.now_price | _toLocaleString }}
                ₹{{ item.now_price   }}
              </div>
            </div>
          </van-col>
@@ -81,7 +101,7 @@
                {{ $t("持倉價") }} ({{ activeObj.symbolCode }})
              </div>
              <div class="sport-content-text2">
                ₹{{ item.buyOrderPrice | _toLocaleString }}
                ₹{{ item.buyOrderPrice   }}
              </div>
            </div>
          </van-col>
@@ -91,7 +111,7 @@
                {{ $t("訂單金額") }} ({{ activeObj.symbolCode }})
              </div>
              <div class="sport-content-text2">
                ₹{{ item.orderTotalPrice | _toLocaleString }}
                ₹{{ item.orderTotalPrice   }}
              </div>
            </div>
          </van-col>
@@ -103,7 +123,7 @@
                {{ $t("hj44") }} ({{ activeObj.symbolCode }})
              </div>
              <div class="sport-content-text2">
               ₹{{ item.orderFee | _toLocaleString }}
                ₹{{ item.orderFee   }}
              </div>
            </div>
          </van-col>
@@ -113,17 +133,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>
@@ -133,7 +153,7 @@
                {{ $t("止盈價") }} ({{ activeObj.symbolCode }})
              </div>
              <div class="sport-content-text2">
                {{ item.profitTargetPrice | _toLocaleString }}
                {{ item.profitTargetPrice   }}
              </div>
            </div>
          </van-col> -->
@@ -161,13 +181,14 @@
        </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>
@@ -186,8 +207,15 @@
              <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>
@@ -196,7 +224,14 @@
              <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>
@@ -215,7 +250,7 @@
                {{ $t("hj40") }}({{ activeObj.symbolCode }})
              </div>
              <div class="sport-content-text2">
                ₹{{ item.now_price | _toLocaleString }}
                ₹{{ item.now_price   }}
              </div>
            </div>
          </van-col>
@@ -225,7 +260,7 @@
                {{ $t("持倉價") }} ({{ activeObj.symbolCode }})
              </div>
              <div class="sport-content-text2">
                ₹{{ item.buyOrderPrice | _toLocaleString }}
                ₹{{ item.buyOrderPrice   }}
              </div>
            </div>
          </van-col>
@@ -235,7 +270,7 @@
                {{ $t("訂單金額") }} ({{ activeObj.symbolCode }})
              </div>
              <div class="sport-content-text2">
                ₹{{ item.orderTotalPrice | _toLocaleString }}
                ₹{{ item.orderTotalPrice   }}
              </div>
            </div>
          </van-col>
@@ -247,17 +282,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>
@@ -267,7 +302,7 @@
                {{ $t("止盈價") }} ({{ activeObj.symbolCode }})
              </div>
              <div class="sport-content-text2">
                {{ item.profitTargetPrice | _toLocaleString }}
                {{ item.profitTargetPrice   }}
              </div>
            </div>
          </van-col> -->
@@ -314,7 +349,13 @@
            <!-- <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>
@@ -335,8 +376,8 @@
  props: {
    activeObj: {
      type: Object,
      default: {},
    },
      default: {}
    }
  },
  mounted() {
    this.getList();
@@ -350,31 +391,31 @@
      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.getList();
@@ -383,7 +424,7 @@
    pushRouter(item) {
      const obj = {
        pid: item.stockCode || "",
        type: item.stockGid || "",
        type: item.stockGid || ""
      };
      window.localStorage.setItem("kLine", JSON.stringify(obj));
      // return;
@@ -398,8 +439,8 @@
          if_us: "",
          if_zhishu: 0,
          sok: "",
          type: item.stockGid,
        },
          type: item.stockGid
        }
      });
    },
    onLoad() {
@@ -410,7 +451,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 = [];
@@ -430,12 +471,18 @@
        this.pageNum = 1;
        this.finished = false;
      }
      const res = await getchicang({
      const _laber = laber || this.activeObj.laber;
      let opt = {
        state: this.actives,
        stockType: laber || this.activeObj.laber,
        stockType: _laber,
        pageNum: 1,
        pageSize: 30,
      });
        pageSize: 30
      };
      if (_laber === "USDT") {
        opt.stockCode = "HJYY";
      }
      const res = await getchicang(opt);
      this.loading = false;
      if (res.status === 0) {
@@ -453,16 +500,21 @@
        this.pageNum = 1;
        this.finished = false;
      }
      const res = await getchicang({
      const _laber = laber || this.activeObj.laber;
      let opt = {
        state: this.actives,
        stockType: laber || this.activeObj.laber,
        stockType: _laber,
        pageNum: 1,
        pageSize: 30,
      });
        pageSize: 30
      };
      if (_laber === "USDT") {
        opt.stockCode = "HJYY";
      }
      const res = await getchicang(opt);
      this.loading = false;
      if (res.status === 0) {
        this.dataList = []
        this.dataList = [];
        this.dataList = res.data.list;
        this.finished = true;
      } else {
@@ -473,51 +525,50 @@
    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";