shopList.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. <template>
  2. <view class="main">
  3. <view class="list-box-h">
  4. <view v-for="(item, index) in list" :key="index" class="guess-item" @click="navToDetailPage(item)">
  5. <image :src="item.image"></image>
  6. <view class="guess-box">
  7. <view class="title clamp2">{{ item.store_name }}</view>
  8. <view class="flex itemContent">
  9. <view>
  10. <view v-if='vip!=1' class="price-box flex">
  11. <view class="yuanprice">{{ item.ot_price }}</view>
  12. <image src="../../static/img/jiantou.png" mode=""></image>
  13. <view class="jiang">直降{{ (item.ot_price - item.price).toFixed(2) }}元</view>
  14. </view>
  15. <view class="price" >¥{{ item.price }}</view>
  16. </view>
  17. <view class="btn">立即购买</view>
  18. </view>
  19. </view>
  20. </view>
  21. </view>
  22. <uni-load-more :status="loadingType"></uni-load-more>
  23. </view>
  24. </template>
  25. <script>
  26. import {
  27. getProducts
  28. } from '@/api/product.js';
  29. export default {
  30. data() {
  31. return {
  32. list: [],
  33. page: 1,
  34. limit: 10,
  35. loadingType: 'more',
  36. cid: 0,
  37. vip: 0
  38. }
  39. },
  40. onLoad(opt) {
  41. this.cid = opt.cid || ''
  42. this.tit = decodeURI(opt.tit)
  43. console.log(opt.tit, this.tit);
  44. uni.setNavigationBarTitle({
  45. title: this.tit
  46. })
  47. this.vip = +opt.vip || 0
  48. this.getArticleList()
  49. },
  50. methods: {
  51. navToDetailPage(item) {
  52. uni.navigateTo({
  53. url: '/pages/product/product?id=' + item.id
  54. });
  55. },
  56. getArticleList() {
  57. let obj = this
  58. if (obj.loadingType == 'noMore' || obj.loadingType == 'loading') {
  59. return
  60. }
  61. obj.loadingType = 'loading'
  62. getProducts({
  63. page: obj.page,
  64. limit: obj.limit,
  65. can_up_level: this.vip //设置是否vip商品
  66. }, obj.cid).then(({
  67. data
  68. }) => {
  69. obj.list = obj.list.concat(data)
  70. obj.page++
  71. if (data.length == obj.limit) {
  72. obj.loadingType = 'more'
  73. } else {
  74. obj.loadingType = 'noMore'
  75. }
  76. })
  77. }
  78. }
  79. }
  80. </script>
  81. <style lang="scss" scoped>
  82. page {
  83. background-color: #fff;
  84. min-height: 100%;
  85. }
  86. .list-box-h {
  87. padding: 20rpx;
  88. }
  89. .guess-item {
  90. padding: 10rpx;
  91. display: flex;
  92. min-width: 100%;
  93. width: 0;
  94. margin-bottom: 20rpx;
  95. background: #ffffff;
  96. border-radius: 10rpx;
  97. box-shadow: 0px 0px 20rpx 0px rgba(50, 50, 52, 0.06);
  98. image {
  99. width: 200rpx;
  100. height: 200rpx;
  101. border-radius: 10rpx;
  102. flex-shrink: 0;
  103. }
  104. .guess-box {
  105. width: 100%;
  106. padding: 5px;
  107. position: relative;
  108. .itemContent {
  109. position: absolute ;
  110. width: 100%;
  111. padding: 20rpx 10rpx;
  112. bottom: 0;
  113. right: 0;
  114. }
  115. .title {
  116. font-size: 30rpx;
  117. font-weight: bold;
  118. color: #333333;
  119. height: 2.5em;
  120. line-height: 1.25em;
  121. }
  122. .price-box {
  123. justify-content: flex-start;
  124. .yuanprice {
  125. font-size: 26rpx;
  126. font-family: PingFang SC;
  127. font-weight: 500;
  128. text-decoration: line-through;
  129. color: #999999;
  130. padding-right: 6rpx;
  131. }
  132. image {
  133. width: 14rpx;
  134. height: 16rpx;
  135. }
  136. .jiang {
  137. padding-left: 2rpx;
  138. font-size: 24rpx;
  139. font-family: PingFang SC;
  140. font-weight: bold;
  141. color: #b59467;
  142. }
  143. }
  144. .price {
  145. font-size: 36rpx;
  146. font-family: PingFang SC;
  147. font-weight: bold;
  148. color: #FF6F0F;
  149. }
  150. .btn {
  151. background: #16cc9f;
  152. border-radius: 28rpx;
  153. font-size: 28rpx;
  154. font-weight: 500;
  155. color: #ffffff;
  156. float: right;
  157. padding: 10rpx 20rpx;
  158. }
  159. }
  160. }
  161. </style>