shop.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. <template>
  2. <div class="shop-index">
  3. <van-search placeholder="请输入商品关键词" />
  4. <van-swipe class="my-swipe" :autoplay="3000" indicator-color="white">
  5. <!-- <van-swipe-item v-for="(image, index) in images" :key="index">
  6. <img v-lazy="image" />
  7. </van-swipe-item> -->
  8. <van-swipe-item>1</van-swipe-item>
  9. <van-swipe-item>2</van-swipe-item>
  10. <van-swipe-item>3</van-swipe-item>
  11. <van-swipe-item>4</van-swipe-item>
  12. </van-swipe>
  13. <div class="show">
  14. <product-list />
  15. </div>
  16. </div>
  17. </template>
  18. <script type="text/javascript">
  19. import Vue from "vue";
  20. import axios from "axios";
  21. import ProductList from "../../components/ProductList";
  22. import {
  23. NavBar,
  24. Search,
  25. Swipe,
  26. SwipeItem,
  27. Lazyload,
  28. Card,
  29. PullRefresh,
  30. List,
  31. } from "vant";
  32. Vue.use(NavBar);
  33. Vue.use(Search);
  34. Vue.use(Swipe);
  35. Vue.use(SwipeItem);
  36. Vue.use(Lazyload);
  37. Vue.use(Card);
  38. Vue.use(PullRefresh);
  39. Vue.use(List);
  40. Vue.prototype.$http = axios;
  41. export default {
  42. head() {
  43. return {
  44. title: "智慧易加",
  45. };
  46. },
  47. data() {
  48. return {
  49. images: [],
  50. list: [],
  51. loading: false, //加载状态
  52. finished: false, //是否完成加载
  53. refreshing: false, //是否正在上拉刷新
  54. };
  55. },
  56. components: {
  57. ProductList,
  58. },
  59. beforeCreate() {},
  60. created() {},
  61. beforeMount() {},
  62. mounted() {},
  63. beforeUpdate() {},
  64. updated() {},
  65. beforeDestroy() {},
  66. destroyed() {},
  67. methods: {
  68. onLoad() {
  69. var that = this;
  70. that.$axios
  71. .get("/getIntegralWaresInfoList", {
  72. params: {
  73. stationId: "1",
  74. },
  75. })
  76. .then((res) => {
  77. if (res.data.retCode == 0) {
  78. that.list = res.data.data; //追加数据
  79. // 加载状态结束
  80. that.loading = false;
  81. that.finished = true;
  82. console.log(that.list);
  83. }
  84. });
  85. },
  86. onRefresh() {
  87. // 清空列表数据
  88. that.finished = true;
  89. // 重新加载数据
  90. // 将 loading 设置为 true,表示处于加载状态
  91. that.loading = true;
  92. that.onLoad();
  93. },
  94. },
  95. };
  96. </script>
  97. <style scope>
  98. .shop-index * {
  99. box-sizing: border-box;
  100. }
  101. .shop-index .my-swipe .van-swipe-item {
  102. color: #fff;
  103. font-size: 20px;
  104. line-height: 150px;
  105. text-align: center;
  106. background-color: #39a9ed;
  107. border-radius: 4vw;
  108. }
  109. .shop-index {
  110. width: 92vw;
  111. margin: 0 auto;
  112. }
  113. .shop-index .list {
  114. width: 92vw;
  115. }
  116. .shop-index .list .list-item {
  117. display: flex;
  118. margin-top: 30px;
  119. width: 92vw;
  120. height: 28.5vw;
  121. }
  122. .shop-index .list .list-item .list-item-left {
  123. width: 28.5vw;
  124. height: 28.5vw;
  125. border: 0.26vw solid #eeeeee;
  126. flex-shrink: 0;
  127. }
  128. .shop-index .list .list-item .list-item-left img {
  129. display: inline-block;
  130. width: 100%;
  131. height: 100%;
  132. border-radius: 3vw;
  133. }
  134. .shop-index .list .list-item .list-item-right {
  135. margin-left: 3vw;
  136. width: 60.5vw;
  137. color: red;
  138. display: flex;
  139. flex-direction: column;
  140. flex-shrink: 0;
  141. font-size: 4.266vw;
  142. font-weight: 400;
  143. color: #111111;
  144. line-height: 6vw;
  145. height: 28.5vw;
  146. }
  147. .shop-index .list .list-item .list-item-right .item-right-top {
  148. width: 60.5vw;
  149. height: 12vm;
  150. flex-shrink: 0;
  151. word-break: break-all;
  152. height: 20vw;
  153. }
  154. .shop-index .list .list-item .list-item-right .item-right-top {
  155. width: 60.5vw;
  156. height: 12vm;
  157. flex-shrink: 0;
  158. }
  159. </style>