ProductList.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. <template>
  2. <van-pull-refresh v-model="refreshing" @refresh="onRefresh">
  3. <van-list
  4. v-model="loading"
  5. :finished="true"
  6. finished-text="没有更多了~"
  7. @load="onLoad"
  8. >
  9. <div class="shoplist">
  10. <nuxt-link class="list-item" v-for="item in list" :key="item.src" to="/point/detail" tag="div">
  11. <div class="list-item-left">
  12. <img :src="item.waresPic" alt="" srcset="" />
  13. </div>
  14. <div class="list-item-right">
  15. <div class="item-right-top">
  16. <span class="info">
  17. {{ item.waresName }}
  18. </span>
  19. {{ item.waresDetail }}
  20. </div>
  21. <div class="item-right-bottom">
  22. <span class="price"><span class="icon"></span>40</span>
  23. <span class="sold">已兑换 233</span>
  24. </div>
  25. </div>
  26. </nuxt-link>
  27. </div>
  28. </van-list>
  29. </van-pull-refresh>
  30. </template>
  31. <script>
  32. import Vue from "vue";
  33. import { PullRefresh, List } from "vant";
  34. Vue.use(PullRefresh);
  35. Vue.use(List);
  36. export default {
  37. head() {
  38. return {
  39. title: "订单页",
  40. };
  41. },
  42. data() {
  43. return {
  44. images: [],
  45. list: [],
  46. loading: false, //加载状态
  47. finished: false, //是否完成加载
  48. refreshing: false, //是否正在上拉刷新
  49. };
  50. },
  51. beforeCreate() {},
  52. created() {},
  53. beforeMount() {},
  54. mounted() {
  55. this.onLoad();
  56. },
  57. beforeUpdate() {},
  58. updated() {},
  59. beforeDestroy() {},
  60. destroyed() {},
  61. methods: {
  62. onLoad() {
  63. var that = this;
  64. that.$axios
  65. .get("/getIntegralWaresInfoList", {
  66. params: {
  67. stationId: "1",
  68. },
  69. })
  70. .then((res) => {
  71. console.log(res);
  72. if (res.data.retCode == 0) {
  73. that.list = res.data.data; //追加数据
  74. // 加载状态结束
  75. that.loading = false;
  76. that.finished = true;
  77. console.log(that.list);
  78. }
  79. });
  80. },
  81. onRefresh() {
  82. // 清空列表数据
  83. that.finished = true;
  84. // 重新加载数据
  85. // 将 loading 设置为 true,表示处于加载状态
  86. that.loading = true;
  87. that.onLoad();
  88. },
  89. },
  90. };
  91. </script>
  92. <style scope>
  93. .shoplist {
  94. width: 92vw;
  95. }
  96. .shoplist .list-item {
  97. display: flex;
  98. margin-top: 30px;
  99. width: 92vw;
  100. height: 28.5vw;
  101. }
  102. .shoplist .list-item .list-item-left {
  103. width: 28.5vw;
  104. height: 28.5vw;
  105. border: 0.26vw solid #eeeeee;
  106. flex-shrink: 0;
  107. }
  108. .shoplist .list-item .list-item-left img {
  109. display: inline-block;
  110. width: 100%;
  111. height: 100%;
  112. border-radius: 3vw;
  113. }
  114. .shoplist .list-item .list-item-right {
  115. margin-left: 3vw;
  116. width: 60.5vw;
  117. color: red;
  118. display: flex;
  119. flex-direction: column;
  120. flex-shrink: 0;
  121. font-size: 4.266vw;
  122. font-weight: 400;
  123. color: #111111;
  124. line-height: 6vw;
  125. height: 28.5vw;
  126. }
  127. .shoplist .list-item .list-item-right .item-right-top {
  128. flex-shrink: 0;
  129. word-break: break-all;
  130. width: 4.53rem;
  131. height: 1.45rem;
  132. font-size: 0.32rem;
  133. font-family: PingFangSC-Regular, PingFang SC;
  134. font-weight: 400;
  135. color: #111111;
  136. line-height: 0.45rem;
  137. }
  138. .shoplist .list-item .list-item-right .item-right-top .info {
  139. font-weight: 500;
  140. }
  141. .shoplist .list-item .list-item-right .item-right-bottom {
  142. width: 4.53rem;
  143. height: 0.9rem;
  144. position: relative;
  145. }
  146. .shoplist .list-item .list-item-right .item-right-bottom .price {
  147. font-size: 0.4rem;
  148. font-family: PingFangSC-Medium, PingFang SC;
  149. font-weight: 500;
  150. color: #fe9700;
  151. line-height: 0.56rem;
  152. position: absolute;
  153. left: 0.1rem;
  154. bottom: 0rem;
  155. }
  156. .shoplist .list-item .list-item-right .item-right-bottom .price .icon {
  157. display: inline-block;
  158. width: 0.3rem;
  159. height: 0.3rem;
  160. background: url("../static/common/a01_jifen@2x.png") no-repeat;
  161. background-size: cover;
  162. margin-right: 0.1rem;
  163. }
  164. .shoplist .list-item .list-item-right .item-right-bottom .sold {
  165. height: 0.4rem;
  166. font-size: 0.28rem;
  167. font-family: PingFangSC-Regular, PingFang SC;
  168. font-weight: 400;
  169. color: #bcbcbc;
  170. line-height: 0.4rem;
  171. position: absolute;
  172. right: 0.1rem;
  173. bottom: 0.03rem;
  174. }
  175. </style>