shop.vue 3.6 KB

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