dcc
2024-05-16 289948f53b5e0b00a656d60c08efbff0eb05fa90
src/page/list/tradingList/data.list.vue
@@ -2,21 +2,31 @@
  <div class="list-data">
    <div class="header-box">
      <van-row type="flex" align="center" gutter="20">
        <van-col span="8">
        <van-col span="12">
          <div>
            {{ $t("hj313") }}
          </div></van-col
        >
        <van-col span="10"
          ><div style="text-align: right">
          </div>
        </van-col>
        <van-col span="3" v-if="active == 'IN'">
          <div>
            {{ $t("hj62") }}
          </div>
        </van-col>
        <van-col span="3" v-if="active == 'IN'">
          <div style="text-align: right">
            {{ $t("hj314") }}
          </div></van-col
        >
          </div>
        </van-col>
        <van-col span="6" v-else>
          <div style="text-align: right">
            {{ $t("hj314") }}
          </div>
        </van-col>
        <van-col span="6">
          <div style="text-align: right">
            {{ $t("hj315") }}
          </div></van-col
        >
          </div>
        </van-col>
      </van-row>
    </div>
@@ -24,6 +34,7 @@
      style="margin-bottom: 50px"
      v-model="loadings"
      :finished="finished"
      :loading-text="$t('hj430')"
      :finished-text="$t('hj43')"
      @load="onLoads"
      :immediate-check="false"
@@ -35,7 +46,7 @@
        :key="item.indexCode"
      >
        <van-row type="flex" align="center" gutter="20">
          <van-col span="8">
          <van-col span="12">
            <div>
              <div class="tp">
                <span class="collection" @click="optionszx(item)">
@@ -61,8 +72,24 @@
              </div>
            </div></van-col
          >
          <van-col span="10">
          <van-col span="3" v-if="active == 'IN'">
            <div style="text-align: right">
              <div class="tp">
                <span class="price_color">{{ item.gid }}</span>
              </div>
            </div>
          </van-col>
          <van-col span="3"  v-if="active == 'IN'">
            <div style="text-align: right">
              <div class="tp">
                <span class="price_color">{{ item.nowPrice }}</span>
              </div>
              <div class="bt">
                <span>{{ item.addTime }}</span>
              </div>
            </div>
          </van-col>
          <van-col span="6"  v-else>
            <div style="text-align: right">
              <div class="tp">
                <span class="price_color">{{ item.nowPrice }}</span>
@@ -76,9 +103,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>
@@ -106,6 +133,10 @@
      default: "",
    },
    tabsList: {
      type: Array,
      default: [],
    },
    zxtabsList: {
      type: Array,
      default: [],
    },
@@ -139,6 +170,7 @@
      finished: false,
      listArr: [],
      pageNumVal: 1,
      getInterval: null,
    };
  },
@@ -146,6 +178,9 @@
    this.listArr = [];
    this.pageNumVal = 1;
    this.getStock(this.active, this.zxactive, 1);
    this.getInterval = setInterval(() => {
      this.getStock(this.active, this.zxactive, 1);
    }, 5000);
  },
  methods: {
    filterSH(val) {
@@ -180,6 +215,7 @@
        },
      });
    },
    // 获取列表
    getStock: handleDt.debounce(async function (a, b, c) {
      a = this.active;
@@ -187,41 +223,62 @@
      if (a !== "") {
        let array = this.tabsList.filter((item) => item.key === a);
        stockType = array[0].name;
      } else {
        let array = this.zxtabsList.filter((item) => item.key === b);
        stockType = array[0].name;
      }
      let pageNumVal = c || this.pageNumVal;
      let opt = {
        pageNum: pageNumVal,
        pageSize: 15,
        pageSize: 100,
        stockPlate: "",
        keyWords: this.sousuo,
        stockType: stockType,
        orderBy: "",
      };
      let data = await api.getStockByType(opt);
      this.loadings = false;
      // console.log();
      // api.positionzx;
      let data;
      if (a !== "") {
        data = await api.getStockByType(opt);
      } else {
        // 自选
        data = await api.positionzx(opt);
      }
      if (data.status === 0) {
        console.log(data.data.list.length < 15);
        if (data.data.list.length < 15) {
          this.finished = true;
        }
        if (pageNumVal !== 1) {
          this.listArr = [...this.listArr, ...data.data.list];
        } else {
          this.listArr = data.data.list;
          if (this.active) {
            if (this.active === data.data.stockType) {
              this.listArr = data.data.list;
              this.loadings = false;
              this.finished = true;
            }
          } else {
            if (this.zxactive === data.data.stockType) {
              this.listArr = data.data.list;
              this.loadings = false;
              this.finished = true;
            }
          }
        }
      } else {
        this.finished = true;
      }
    }, 500),
    onLoads() {
      console.log(333333);
      // if (!this.loading) {
      this.pageNumVal++;
      this.loadings = true;
      this.getStock();
      // }
      // this.pageNumVal++;
      // this.loadings = true;
      // this.getStock();
    },
    optionszx() {},
  },
  destroyed() {
    clearInterval(this.getInterval);
    this.getInterval = null;
  },
};
</script>
@@ -288,4 +345,4 @@
  text-align: left;
  color: #14181f;
}
</style>
</style>