cartt.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. <template>
  2. <view class="content">
  3. <empty v-if="loaded && list.length === 0"></empty>
  4. <view class="good-wrap">
  5. <view class="good" v-for="item in list" @click="gotoDetail(item)">
  6. <image :src="item.image" mode="" class="goo-img"></image>
  7. <view class="good-tit clamp">
  8. {{item.store_name}}
  9. </view>
  10. <view class="good-price flex">
  11. <view class="new-price">
  12. ¥{{item.price}}
  13. </view>
  14. <!-- <view class="old-price">
  15. ¥{{item.}}
  16. </view> -->
  17. </view>
  18. </view>
  19. </view>
  20. <uni-load-more :status="loadingType"></uni-load-more>
  21. <view class="sq" @click="navto('/pages/category/apply')">
  22. <image src="../../static/user/u3.png" mode="" class="sq-logo"></image>
  23. <view class="sq-tit">
  24. 申请
  25. </view>
  26. </view>
  27. </view>
  28. </template>
  29. <script>
  30. import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
  31. import empty from '@/components/empty';
  32. import { getProducts } from '@/api/product.js'
  33. export default {
  34. components: {
  35. empty,
  36. uniLoadMore
  37. },
  38. data() {
  39. return {
  40. page: 1,
  41. limit: 10,
  42. list: [],
  43. loadingType: 'more',
  44. loaded: false
  45. }
  46. },
  47. onLoad() {
  48. this.getProductList()
  49. },
  50. onReachBottom() {
  51. this.getProductList()
  52. },
  53. methods: {
  54. navto(url) {
  55. uni.navigateTo({
  56. url: url
  57. })
  58. },
  59. gotoDetail(item) {
  60. uni.navigateTo({
  61. url: '/pages/product/product?id=' + item.id
  62. })
  63. },
  64. getProductList() {
  65. let obj = this
  66. if(obj.loadingType == 'loading' || obj.loadingType == 'noMore') {
  67. return
  68. }
  69. obj.loadingType = 'loading'
  70. getProducts({
  71. page: obj.page,
  72. limit: obj.limit,
  73. is_gold: 0,
  74. is_integral: 0
  75. }).then(({data}) => {
  76. obj.list = obj.list.concat(data)
  77. obj.page++
  78. if(data.length == obj.limit) {
  79. obj.loadingType = 'more'
  80. }else {
  81. obj.loadingType = 'noMore'
  82. }
  83. this.loaded = true
  84. })
  85. }
  86. }
  87. }
  88. </script>
  89. <style lang="scss">
  90. .good-wrap {
  91. display: flex;
  92. // padding: 0 0 20rpx 20rpx;
  93. padding-left: 20rpx;
  94. padding-top: 20rpx;
  95. flex-wrap: wrap;
  96. }
  97. .good {
  98. width: 345rpx;
  99. height: 480rpx;
  100. margin-right: 20rpx;
  101. margin-bottom: 20rpx;
  102. background: #FFFFFF;
  103. box-shadow: 0px 0px 20rpx 0px rgba(50, 50, 52, 0.06);
  104. border-radius: 10rpx;
  105. position: relative;
  106. .xrlb {
  107. position: absolute;
  108. display: inline-block;
  109. padding: 5rpx 10rpx;
  110. background-color: #FF4C4C;
  111. color: #fff;
  112. text-align: center;
  113. border-radius: 0 10rpx 10rpx 0;
  114. // width: 100rpx;
  115. top: 0;
  116. left: 0;
  117. }
  118. .goo-img {
  119. width: 345rpx;
  120. height: 345rpx;
  121. border-radius: 10rpx 10rpx 0 0;
  122. // background-color: #bfa;
  123. }
  124. .good-tit {
  125. padding: 15rpx 20rpx;
  126. font-size: 30rpx;
  127. font-family: PingFang SC;
  128. font-weight: bold;
  129. color: #333333;
  130. line-height: 35rpx;
  131. }
  132. .good-price {
  133. padding-left: 20rpx;
  134. justify-content: flex-start;
  135. .new-price {
  136. font-size: 36rpx;
  137. font-family: PingFang SC;
  138. font-weight: bold;
  139. color: #FF4C4C;
  140. }
  141. .old-price {
  142. padding-left: 8rpx;
  143. font-size: 26rpx;
  144. font-family: PingFang SC;
  145. font-weight: bold;
  146. text-decoration: line-through;
  147. color: #999999;
  148. }
  149. }
  150. }
  151. .sq {
  152. position: fixed;
  153. bottom: 300rpx;
  154. right: 20rpx;
  155. background-color: #fff;
  156. border-radius: 50%;
  157. box-shadow: 0px 0 10rpx #999;
  158. width: 100rpx;
  159. height: 100rpx;
  160. display: flex;
  161. flex-direction: column;
  162. justify-content: center;
  163. align-items: center;
  164. .sq-logo {
  165. width: 40rpx;
  166. height: 40rpx;
  167. }
  168. .sq-tit {
  169. padding-top: 10rpx;
  170. font-size: 22rpx;
  171. }
  172. }
  173. </style>