123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178 |
- <template>
- <van-pull-refresh v-model="refreshing" @refresh="onRefresh">
- <van-list
- v-model="loading"
- :finished="true"
- finished-text="没有更多了~"
- @load="onLoad"
- >
- <div class="shoplist">
- <nuxt-link
- class="list-item"
- v-for="item in wareList"
- :key="item.id"
- :to="'/point/detail/' + item.id"
- tag="div"
- >
- <div class="list-item-left">
- <img :src="item.waresPic" alt="" srcset="" />
- </div>
- <div class="list-item-right">
- <div class="item-right-top">
- <span class="info">
- {{ item.waresName }}
- </span>
- {{ item.waresDetail }}
- </div>
- <div class="item-right-bottom">
- <span class="price"><span class="icon"></span>{{ item.saleIntegral }}</span>
- <span class="sold">{{ "库存 " + item.waresCount }}</span>
- </div>
- </div>
- </nuxt-link>
- </div>
- </van-list>
- </van-pull-refresh>
- </template>
- <script>
- import Vue from "vue";
- import { PullRefresh, List } from "vant";
- import { mapState, mapActions } from "vuex";
- Vue.use(PullRefresh);
- Vue.use(List);
- export default {
- head() {
- return {
- title: "商品列表",
- };
- },
- data() {
- return {
- images: [],
- loading: false, //加载状态
- finished: false, //是否完成加载
- refreshing: false, //是否正在上拉刷新
- };
- },
- mounted() {
- this.onLoad();
- },
- computed: {
- ...mapState({
- wareList: (state) => state.point.wareList,
- }),
- },
- methods: {
- ...mapActions({
- getWareList: "point/getWareList",
- }),
- onLoad() {
- var that = this;
- this.getWareList().then((res) => {
- that.loading = false;
- that.finished = true;
- });
- },
- onRefresh() {
- // 清空列表数据
- that.finished = true;
- // 重新加载数据
- // 将 loading 设置为 true,表示处于加载状态
- that.loading = true;
- that.onLoad();
- },
- },
- };
- </script>
- <style scope>
- .shoplist {
- width: 92vw;
- }
- .shoplist .list-item {
- display: flex;
- margin-top: 30px;
- width: 92vw;
- height: 28.5vw;
- }
- .shoplist .list-item .list-item-left {
- width: 28.5vw;
- height: 28.5vw;
- border: 0.26vw solid #eeeeee;
- flex-shrink: 0;
- }
- .shoplist .list-item .list-item-left img {
- display: inline-block;
- width: 100%;
- height: 100%;
- border-radius: 3vw;
- }
- .shoplist .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;
- }
- .shoplist .list-item .list-item-right .item-right-top {
- flex-shrink: 0;
- word-break: break-all;
- width: 4.53rem;
- height: 1.45rem;
- font-size: 0.32rem;
- font-family: PingFangSC-Regular, PingFang SC;
- font-weight: 400;
- color: #111111;
- line-height: 0.45rem;
- }
- .shoplist .list-item .list-item-right .item-right-top .info {
- font-weight: 500;
- }
- .shoplist .list-item .list-item-right .item-right-bottom {
- width: 4.53rem;
- height: 0.9rem;
- position: relative;
- }
- .shoplist .list-item .list-item-right .item-right-bottom .price {
- font-size: 0.4rem;
- font-family: PingFangSC-Medium, PingFang SC;
- font-weight: 500;
- color: #fe9700;
- line-height: 0.56rem;
- position: absolute;
- left: 0.1rem;
- bottom: 0rem;
- }
- .shoplist .list-item .list-item-right .item-right-bottom .price .icon {
- display: inline-block;
- width: 0.3rem;
- height: 0.3rem;
- background: url("../static/common/a01_jifen@2x.png") no-repeat;
- background-size: cover;
- margin-right: 0.1rem;
- }
- .shoplist .list-item .list-item-right .item-right-bottom .sold {
- height: 0.4rem;
- font-size: 0.28rem;
- font-family: PingFangSC-Regular, PingFang SC;
- font-weight: 400;
- color: #bcbcbc;
- line-height: 0.4rem;
- position: absolute;
- right: 0.1rem;
- bottom: 0.03rem;
- }
- </style>
|