giftList.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. <template>
  2. <view class="container">
  3. <view class="goodsList-box">
  4. <view class="goodsList-item flex" :key="ind" v-for="(ls, ind) in list">
  5. <image :src="ls.image" mode=" scaleToFill"></image>
  6. <view class="goodsList-content">
  7. <view class="title clamp2">
  8. <text>{{ ls.store_name }}</text>
  9. </view>
  10. <view class="goods-money flex">
  11. <view class="money-box">
  12. <view class="money">
  13. <text class="font-size-sm">¥</text>
  14. {{ ls.price }}
  15. </view>
  16. <!-- <view class="otMoney-box">
  17. <text class="otMoney">¥{{ ls.ot_price }}</text>
  18. <text class="sales">已售{{ ls.sales }}件</text>
  19. </view> -->
  20. </view>
  21. <view @click="navTo(ls)" class="cart iconfont iconcart"></view>
  22. </view>
  23. </view>
  24. </view>
  25. </view>
  26. <uni-load-more :status="loadingType"></uni-load-more>
  27. </view>
  28. </template>
  29. <script>
  30. import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
  31. import {
  32. groomList,
  33. getProducts
  34. } from '@/api/product.js';
  35. export default {
  36. components: {
  37. uniLoadMore
  38. },
  39. data() {
  40. return {
  41. list: [],
  42. loadingType: 'more',
  43. page: 1,
  44. limit: 10,
  45. };
  46. },
  47. onLoad(option) {
  48. // 获取查询对象
  49. this.type = option.type;
  50. // 加载基础数据
  51. this.loadData();
  52. },
  53. methods: {
  54. navTo: function(ls) {
  55. uni.navigateTo({
  56. url: '/pages/product/product?id=' + ls.id
  57. });
  58. },
  59. // 请求载入数据
  60. async loadData() {
  61. let obj = this
  62. if (obj.loadingType == 'loading' || obj.loadingType == 'noMore') {
  63. return
  64. }
  65. obj.loadingType = 'loading'
  66. getProducts({
  67. is_up_level: obj.type
  68. }).then(({
  69. data
  70. }) => {
  71. console.log(data)
  72. obj.list = obj.list.concat(data)
  73. obj.page++
  74. if (data.length == obj.limit) {
  75. obj.loadingType = 'more'
  76. } else {
  77. obj.loadingType = 'noMore'
  78. }
  79. })
  80. }
  81. }
  82. };
  83. </script>
  84. <style lang="scss">
  85. page {
  86. background: $page-color-base;
  87. }
  88. .carousel-section {
  89. padding: 0;
  90. .titleNview-placing {
  91. padding-top: 0;
  92. height: 0;
  93. }
  94. .swiper-dots {
  95. left: 45rpx;
  96. bottom: 40rpx;
  97. }
  98. .carousel {
  99. width: 100%;
  100. height: 360rpx;
  101. .carousel-item {
  102. width: 100%;
  103. height: 100%;
  104. overflow: hidden;
  105. }
  106. image {
  107. width: 100%;
  108. height: 100%;
  109. }
  110. }
  111. }
  112. // 中间标题样式
  113. .type-title-box {
  114. padding: 40rpx;
  115. .title-content {
  116. height: 100%;
  117. width: 200rpx;
  118. text-align: center;
  119. font-size: $font-lg;
  120. font-weight: 500;
  121. color: $font-color-dark;
  122. }
  123. .title-border {
  124. width: 250rpx;
  125. height: 2rpx;
  126. background-color: #e9e9e9;
  127. }
  128. }
  129. // 商品列表
  130. .goodsList-box {
  131. .goodsList-item {
  132. margin-bottom: 40rpx;
  133. background-color: #ffffff;
  134. padding: 30rpx;
  135. image {
  136. flex-shrink: 0;
  137. border-radius: $border-radius-sm;
  138. height: 180rpx;
  139. width: 180rpx;
  140. }
  141. .goodsList-content {
  142. margin-left: 20rpx;
  143. flex-grow: 1;
  144. height: 180rpx;
  145. position: relative;
  146. .title {
  147. font-size: $font-base;
  148. color: $font-color-dark;
  149. font-weight: 500;
  150. }
  151. .goods-money {
  152. position: absolute;
  153. left: 0;
  154. bottom: 0;
  155. width: 100%;
  156. .money-box {
  157. .money {
  158. font-size: $font-lg;
  159. color: $color-red;
  160. font-weight: bold;
  161. }
  162. .otMoney-box {
  163. font-size: $font-sm;
  164. .otMoney {
  165. color: $font-color-dark;
  166. padding-right: 20rpx;
  167. }
  168. .sales {
  169. color: $font-color-light;
  170. }
  171. }
  172. }
  173. .cart {
  174. border: 1px solid $color-red;
  175. color: $color-red;
  176. font-size: $font-base;
  177. font-weight: bold;
  178. border-radius: 99px;
  179. width: 55rpx;
  180. height: 55rpx;
  181. display: flex;
  182. justify-content: center;
  183. align-items: center;
  184. }
  185. }
  186. }
  187. }
  188. }
  189. </style>