<template>
  <van-pull-refresh v-model="refreshing" @refresh="onRefresh">
      <van-list
        v-model="loading"
        :finished="true"
        finished-text="没有更多了~"
        @load="onLoad"
      >
        <div class="list">
          <div class="list-item" v-for="item in list" :key="item.src">
            <div class="list-item-left">
              <img :src="item.waresPic" alt="" srcset="" />
            </div>
            <div class="list-item-right">
              <div class="item-right-top">
               {{ item.waresDetail }} 
              </div>
              <div class="item-right-bottom">
                {{ item.waresName }}
              </div>
            </div>
          </div>
        </div>
      </van-list>
    </van-pull-refresh>
</template>

<script>
import Vue from "vue";
import {
  PullRefresh,
  List,
} from "vant";

Vue.use(PullRefresh);
Vue.use(List)

export default {
  head() {
    return {
      title: "订单页",
    };
  },
  data() {
    return {
      images: [],
      list: [],
      loading: false, //加载状态
      finished: false, //是否完成加载
      refreshing: false, //是否正在上拉刷新
    };
  },
  beforeCreate() {},
  created() {},
  beforeMount() {},
  mounted() {
    this.onLoad();
  },
  beforeUpdate() {},
  updated() {},
  beforeDestroy() {},
  destroyed() {},
  methods: {
    onLoad() {
      var that = this;
      that.$axios
        .get("/getIntegralWaresInfoList", {
          params: {
            stationId: "1",
          },
        })
        .then((res) => {
          console.log(res)
          if (res.data.retCode == 0) {
            that.list = res.data.data; //追加数据
            // 加载状态结束
            that.loading = false;
            that.finished = true;
            console.log(that.list);
          }
        });
    },
    onRefresh() {
      // 清空列表数据
      that.finished = true;
      // 重新加载数据
      // 将 loading 设置为 true，表示处于加载状态
      that.loading = true;
      that.onLoad();
    },
  },
};
</script>

<style scope>
.list {
  width: 92vw;
}
.list .list-item {
  display: flex;
  margin-top: 30px;
  width: 92vw;
  height: 28.5vw;
}
.list .list-item .list-item-left {
  width: 28.5vw;
  height: 28.5vw;
  border: 0.26vw solid #eeeeee;
  flex-shrink: 0;
}
.list .list-item .list-item-left img {
  display: inline-block;
  width: 100%;
  height: 100%;
  border-radius: 3vw;
}
.list .list-item .list-item-right {
  margin-left: 3vw;
  width: 60.5vw;
  color: red;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  font-size: 4.266vw;
  font-weight: 400;
  color: #111111;
  line-height: 6vw;
  height: 28.5vw;
}
.list .list-item .list-item-right .item-right-top {
  width: 60.5vw;
  height: 12vm;
  flex-shrink: 0;
  word-break:break-all;
  height:20vw
}

.list .list-item .list-item-right .item-right-top{
  width: 60.5vw;
  height: 12vm;
  flex-shrink: 0;
}

</style>
