jhzh
2024-09-19 e3097587828362e34352cf4f378c8f5a260ea700
src/page/user/Warehouse/data.list.vue
@@ -17,15 +17,14 @@
      :loading-text="$t('hj430')"
      @load="onLoad"
    >
      <div
      <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">
          <div class="title-box" style="justify-content: space-between;">
            <div class="span">{{ item.stockName }}</div>
            <div
              class="states"
@@ -36,15 +35,14 @@
          </div>
          {{ item.stockSpell }}
        </div>
        <!-- <div @click="$router.push('/Stockdetail')"></div> -->
        <van-row>
          <van-col span="8">
            <div style="text-align: left">
              <div class="sport-content-title2">
                {{ $t("盈虧") }} ({{ activeObj.symbolCode }})
              </div>
              <div class="sport-content-text" style="color: #d04b64">
                {{ item.profitAndLose | _toString }}
              <div class="sport-content-text" >
                ₹{{ item.profitAndLose | _toLocaleString }}
              </div>
            </div>
          </van-col>
@@ -72,7 +70,7 @@
                {{ $t("hj40") }}({{ activeObj.symbolCode }})
              </div>
              <div class="sport-content-text2">
                {{ item.now_price | _toString }}
                ₹{{ item.now_price | _toLocaleString }}
              </div>
            </div>
          </van-col>
@@ -82,7 +80,7 @@
                {{ $t("持倉價") }} ({{ activeObj.symbolCode }})
              </div>
              <div class="sport-content-text2">
                {{ item.buyOrderPrice | _toString }}
                ₹{{ item.buyOrderPrice | _toLocaleString }}
              </div>
            </div>
          </van-col>
@@ -92,7 +90,7 @@
                {{ $t("訂單金額") }} ({{ activeObj.symbolCode }})
              </div>
              <div class="sport-content-text2">
                {{ item.orderTotalPrice | _toString }}
                ₹{{ item.orderTotalPrice | _toLocaleString }}
              </div>
            </div>
          </van-col>
@@ -104,17 +102,17 @@
                {{ $t("hj44") }} ({{ activeObj.symbolCode }})
              </div>
              <div class="sport-content-text2">
                {{ item.orderFee | _toString }}
               ₹{{ item.orderFee | _toLocaleString }}
              </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.profitTargetPrice | _toString }}
                {{ item.stopTargetPrice | _toLocaleString }}
              </div>
            </div>
          </van-col>
@@ -124,10 +122,144 @@
                {{ $t("止盈價") }} ({{ activeObj.symbolCode }})
              </div>
              <div class="sport-content-text2">
                {{ item.stopTargetPrice | _toString }}
                {{ item.profitTargetPrice | _toLocaleString }}
              </div>
            </div>
          </van-col> -->
        </van-row>
        <van-row>
          <van-col span="12">
            <div style="text-align: left">
              <div class="sport-content-title2">{{ $t("持倉時間") }}</div>
              <div class="sport-content-text2">
                {{ $moment(item.buyOrderTime).format("DD-MM-YYYY hh:mm:ss A") }}
              </div>
            </div>
          </van-col>
          <van-col span="12">
            <div style="text-align: right">
              <div class="sport-content-title2">{{ $t("訂單編號") }}</div>
              <div class="sport-content-text2">{{ item.buyOrderId }}</div>
            </div>
          </van-col>
        </van-row>
        <div class="but-box" v-if="actives === 0" @click.stop="close(item)">
          <div class="but">{{ $t("平仓") }}</div>
          <!-- <div class="but buts">止盈止损</div> -->
        </div>
      </div>
      <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}`)" >
        <div @click.stop="pushRouter(item)">
          <div class="title-box" style="justify-content: space-between;">
            <div class="span">{{ item.stockName }}</div>
            <div
              class="states"
              :class="item.orderDirection === '买跌' ? 'states-red' : ''"
            >
              {{ $t(item.orderDirection) }}
            </div>
          </div>
          {{ item.stockSpell }}
        </div>
        <van-row>
          <van-col span="8">
            <div style="text-align: left">
              <div class="sport-content-title2">
                {{ $t("盈虧") }} ({{ activeObj.symbolCode }})
              </div>
              <div class="sport-content-text" >
                ₹{{ item.profitAndLose | _toLocaleString }}
              </div>
            </div>
          </van-col>
          <van-col span="8">
            <div style="text-align: center">
              <div class="sport-content-title2">
                {{ $t("hj141") }} ({{ activeObj.symbolCode }})
              </div>
              <div class="sport-content-text2">
                {{ item.profitAndLoseParent }}
              </div>
            </div>
          </van-col>
          <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></van-col
          >
        </van-row>
        <van-row>
          <van-col span="8">
            <div style="text-align: left">
              <div class="sport-content-title2">
                {{ $t("hj40") }}({{ activeObj.symbolCode }})
              </div>
              <div class="sport-content-text2">
                ₹{{ item.now_price | _toLocaleString }}
              </div>
            </div>
          </van-col>
          <van-col span="8">
            <div style="text-align: center">
              <div class="sport-content-title2">
                {{ $t("持倉價") }} ({{ activeObj.symbolCode }})
              </div>
              <div class="sport-content-text2">
                ₹{{ item.buyOrderPrice | _toLocaleString }}
              </div>
            </div>
          </van-col>
          <van-col span="8">
            <div style="text-align: right">
              <div class="sport-content-title2">
                {{ $t("訂單金額") }} ({{ activeObj.symbolCode }})
              </div>
              <div class="sport-content-text2">
                ₹{{ item.orderTotalPrice | _toLocaleString }}
              </div>
            </div>
          </van-col>
        </van-row>
        <van-row>
          <van-col span="8">
            <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="8">
            <div style="text-align: center">
              <div class="sport-content-title2">
                {{ $t("止損價") }} ({{ activeObj.symbolCode }})
              </div>
              <div class="sport-content-text2">
                {{ item.stopTargetPrice | _toLocaleString }}
              </div>
            </div>
          </van-col>
          <van-col span="8">
            <div style="text-align: right">
              <div class="sport-content-title2">
                {{ $t("止盈價") }} ({{ activeObj.symbolCode }})
              </div>
              <div class="sport-content-text2">
                {{ item.profitTargetPrice | _toLocaleString }}
              </div>
            </div>
          </van-col> -->
        </van-row>
        <van-row>
          <van-col span="12">
@@ -207,6 +339,8 @@
      show: false,
      actives: 0,
      dataList: [],
      newdataList:[],
      timer: null,
      tabsList: [
        {
          title: this.$t("持倉"),
@@ -220,8 +354,19 @@
      ],
    };
  },
  created(){
   this.dsq()
  },
  beforeDestroy() {
    clearInterval(this.timer); // 在组件销毁前清除定时器
  },
  methods: {
    dsq(){
      // this.dataList = [];
      this.timer = setInterval(() => {
        this.getList();
      }, 3000);
    },
    pushRouter(item) {
      const obj = {
        pid: item.stockCode || "",
@@ -245,7 +390,7 @@
      });
    },
    onLoad() {
      this.pageNum++;
      // this.pageNum++;
      this.loading = true;
    },
    async confirm() {
@@ -273,15 +418,24 @@
      const res = await getchicang({
        state: this.actives,
        stockType: laber || this.activeObj.laber,
        pageNum: this.pageNum,
        pageSize: this.pageSize,
        pageNum: 1,
        pageSize: 100,
      });
      this.loading = false;
      if (res.status === 0) {
        this.dataList = res.data.list;
        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.finished = true;
        // this.dsq()
        // this.timer = setInterval(() => {
        //   this.getList();
        // }, 3000);
        //   }
      } else {
        this.loading = false;
@@ -297,7 +451,26 @@
      this.pageNum = 1;
      this.finished = false;
      this.actives = e.key;
      this.getList();
      this.$forceUpdate(); // 强制Vue重新渲染
      if(e.key==1){
        clearTimeout(this.timer);
        // setTimeout(()=>{
        //   clearInterval(this.timer); // 在组件销毁前清除定时器
        // },3000)
        this.getList()
      }else{
        this.dsq()
      }
      // this.getList()
      // if(e.key !=this.actives){
      // }else{
      //   this.actives = e.key;
      //   this.dsq()
      // }
    },
  },
};