zzzz
2024-03-26 c790779e2c578d892e184932c660023eb4d466aa
src/page/list/tradingList/data.list.vue
@@ -1,13 +1,23 @@
<template>
  <div class="list-data">
    <div class="header-box">
      <div style="min-width: 180px; max-width: 180px">{{ $t("hj313") }}</div>
      <div style="text-align: right; flex: 1; margin-right: 20px">
        {{ $t("hj314") }}
      </div>
      <div style="text-align: right; max-width: 90px; min-width: 90px">
        {{ $t("hj315") }}
      </div>
      <van-row type="flex" align="center" gutter="20">
        <van-col span="8">
          <div>
            {{ $t("hj313") }}
          </div></van-col
        >
        <van-col span="10"
          ><div style="text-align: right">
            {{ $t("hj314") }}
          </div></van-col
        >
        <van-col span="6">
          <div style="text-align: right">
            {{ $t("hj315") }}
          </div></van-col
        >
      </van-row>
    </div>
    <van-list
@@ -23,48 +33,55 @@
        v-for="(item, index) in listArr"
        :key="item.indexCode"
      >
        <div class="left_title" style="min-width: 180px; max-width: 180px">
          <div class="tp">
            <span class="collection" @click="optionszx(item)">
              <span
                class="shu"
                :class="item.isOption == '1' ? 'shublue' : ''"
              ></span>
            </span>
            <span
              class="title_color"
              style="
                overflow: hidden;
                -webkit-line-clamp: 1;
                text-overflow: ellipsis;
                display: -webkit-box;
                -webkit-box-orient: vertical;
              "
              >{{ item.name }}</span
            >
          </div>
          <div class="bt">
            <span>{{ item.spell }}</span>
          </div>
        </div>
        <div class="center_price" style="align-items: center">
          <div class="tp">
            <span class="price_color">{{ item.nowPrice }}</span>
          </div>
          <div class="bt">
            <span>{{ item.addTime }}</span>
          </div>
        </div>
        <div
          class="right_bs"
          style="max-width: 90px; min-width: 90px"
          :class="`${item.hcrate > 0 ? 'green' : 'red'}`"
        >
          <div class="tp">
            <span class="price_color">{{ item.hcrate }}</span>
          </div>
          <div class="bt"></div>
        </div>
        <van-row type="flex" align="center" gutter="20">
          <van-col span="8">
            <div>
              <div class="tp">
                <span class="collection" @click="optionszx(item)">
                  <span
                    class="shu"
                    :class="item.isOption == '1' ? 'shublue' : ''"
                  ></span>
                </span>
                <span
                  class="title_color"
                  style="
                    overflow: hidden;
                    -webkit-line-clamp: 1;
                    text-overflow: ellipsis;
                    display: -webkit-box;
                    -webkit-box-orient: vertical;
                  "
                  >{{ item.name }}</span
                >
              </div>
              <div class="bt">
                <span>{{ item.spell }}</span>
              </div>
            </div></van-col
          >
          <van-col span="10">
            <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">
            <div style="text-align: right">
              <div
                class="tp right_bs"
                :class="`${item.hcrate > 0 ? 'green' : 'red'}`"
              >
                <span class="price_color">{{ item.hcrate }}</span>
              </div>
            </div>
          </van-col>
        </van-row>
      </div>
    </van-list>
  </div>
@@ -83,13 +100,33 @@
      type: String,
      default: "",
    },
    sousuo: {
      type: String,
      default: "",
    },
    tabsList: {
      type: Array,
      default: [],
    },
  },
  watch: {
    active(e) {
      console.log(e);
      this.finished = false;
      this.listArr = [];
      this.pageNumVal = 1;
      this.getStock(e, this.zxactive);
    },
    zxactive(e) {
      console.log(e);
      this.finished = false;
      this.listArr = [];
      this.pageNumVal = 1;
      this.getStock(this.active, e);
    },
    sousuo(e) {
      this.finished = false;
      this.listArr = [];
      this.pageNumVal = 1;
      this.getStock(this.active, this.zxactive);
    },
  },
  data() {
@@ -97,11 +134,14 @@
      loadings: false,
      finished: false,
      listArr: [],
      pageNumVal: 1,
    };
  },
  mounted() {
    this.getStock();
    this.listArr = [];
    this.pageNumVal = 1;
    this.getStock(this.active, this.zxactive);
  },
  methods: {
    filterSH(val) {
@@ -111,8 +151,8 @@
        return 0;
      }
    },
    // 点击进入详情
    handleGoToKlineDetail1(item) {
      console.log(item);
      const obj = {
        pid: item.code || "",
        type: item.stock_type || "",
@@ -136,27 +176,45 @@
        },
      });
    },
    getStock: handleDt.debounce(async function (pageNum) {
      let stockType = "IN";
      let pageNumVal = 1;
    // 获取列表
    getStock: handleDt.debounce(async function (a, b) {
      a = this.active;
      let stockType = "";
      if (a !== "") {
        let array = this.tabsList.filter((item) => item.key === a);
        stockType = array[0].name;
      }
      let opt = {
        pageNum: pageNumVal,
        pageNum: this.pageNumVal,
        pageSize: 15,
        stockPlate: "",
        keyWords: "",
        keyWords: this.sousuo,
        stockType: stockType,
        orderBy: "",
      };
      let data = await api.getStockByType(opt);
      this.loading = false;
      if (data.status === 0) {
        if (data.data.list.length < 15) {
        if (this.listArr.length >= data.data.total) {
          this.finished = true;
        }
        this.listArr = data.data.list;
        if (this.pageNumVal !== 1) {
          this.listArr = [...this.listArr, ...data.data.list];
        } else {
          this.listArr = data.data.list;
        }
      } else {
        this.loading = false;
        this.finished = true;
      }
    }, 500),
    onLoads() {},
    onLoads() {
      if (!this.loading) {
        this.pageNumVal++;
        this.loading = true;
        this.getStock();
      }
    },
    optionszx() {},
  },
};
@@ -165,22 +223,21 @@
<style lang="less" scoped>
.list-data {
  width: 100%;
  height: 100vh;
  background-color: #fff;
  .header-box {
    padding: 20px 15px;
    display: flex;
    justify-content: space-between;
    color: rgb(140, 159, 173);
  }
}
.item {
  // width: 100%;
  margin: 12px 15px;
  padding-bottom: 15px;
  display: flex;
  justify-content: space-between;
  // display: flex;
  // justify-content: space-between;
  border-bottom: 1px solid #f0f2f3;
  .right_bs {
    text-align: center;