vipShop.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. <template>
  2. <view>
  3. <view class="jx-box-content" v-for="item in vipList" @click="navToDetailPage(item)">
  4. <view class="content-left">
  5. <image :src=item.image mode=""></image>
  6. </view>
  7. <view class="content-right">
  8. <view class="shop-name">
  9. {{item.store_name}}
  10. </view>
  11. <view class="shop-content">
  12. <view class="shop-content-left">
  13. <view class="price-box">
  14. <view class="yuan-price">
  15. ¥{{item.ot_price}}
  16. </view>
  17. <image src="../../static/sy/sy06.png" mode=""></image>
  18. <view class="j-price">
  19. 直降{{item.ot_price*1-item.price*1}}元
  20. </view>
  21. </view>
  22. <view class="price-x">
  23. ¥{{item.price}}
  24. </view>
  25. </view>
  26. <view class="shop-content-right" >
  27. 立即购买
  28. </view>
  29. </view>
  30. </view>
  31. </view>
  32. <uni-load-more :status="loadingType"></uni-load-more>
  33. </view>
  34. </template>
  35. <script>
  36. import uniLoadMore from '@/uview-ui/components/u-loadmore/u-loadmore.vue';
  37. import {getVip} from '@/api/index.js';
  38. export default {
  39. components:{
  40. uniLoadMore
  41. },
  42. data() {
  43. return {
  44. vipList:[],//商品列表
  45. page:1,
  46. limit:10,
  47. loadingType:'more'
  48. };
  49. },
  50. onLoad() {
  51. this.getVipList()
  52. },
  53. onReachBottom() {
  54. this.getVipList()
  55. },
  56. methods:{
  57. navToDetailPage(item) {
  58. let id = item.id;
  59. uni.navigateTo({
  60. url: '/pages/product/product?id=' + id +'&isVip='+0
  61. });
  62. },
  63. getVipList(){
  64. let obj = this
  65. if(obj.loadingType === 'loading' || obj.loadingType === 'noMore'){
  66. return //如果正在加载中,防止重复加载
  67. }
  68. obj.loadingType = 'loading'
  69. getVip(
  70. { page:obj.page,
  71. limit:obj.limit,
  72. is_vip:3
  73. }).then(res=>{
  74. res.data.forEach(e=>{
  75. e.isVip = e.store_type? "3" : "0"
  76. })
  77. console.log(res.data,'vip商品');
  78. if(res.data.length>0){
  79. obj.vipList = obj.vipList.concat(res.data)
  80. console.log(obj.vipList,'vip');
  81. obj.page++
  82. }
  83. if(obj.limit == res.data.length){
  84. console.log("haiyou");
  85. obj.loadingType = 'more'
  86. }else{
  87. console.log("wule");
  88. obj.loadingType = 'noMore'
  89. }
  90. console.log(obj.loadingType,"12345789");
  91. uni.hideLoading()
  92. this.$set(obj.vipList,'loaded',true)
  93. })
  94. }
  95. }
  96. }
  97. </script>
  98. <style lang="scss">
  99. .jx-box-content {
  100. display: flex;
  101. .content-left {
  102. margin: 20rpx 15rpx;
  103. width: 236rpx;
  104. height: 236rpx;
  105. background: #E2E2E2;
  106. border-radius: 10rpx;
  107. image {
  108. width: 100%;
  109. height:100%;
  110. }
  111. }
  112. .content-right {
  113. display: flex;
  114. flex-direction: column;
  115. justify-content: space-around;
  116. .shop-name {
  117. width: 382rpx;
  118. font-size: 32rpx;
  119. font-weight: bold;
  120. color: #333333;
  121. overflow: hidden;
  122. text-overflow: ellipsis;
  123. display:-webkit-box;
  124. -webkit-box-orient:vertical;
  125. -webkit-line-clamp:2;
  126. }
  127. .shop-content {
  128. width: 455rpx;
  129. display: flex;
  130. justify-content: space-between;
  131. .shop-content-left {
  132. display: flex;
  133. flex-direction: column;
  134. .price-box {
  135. display: flex;
  136. align-items: center;
  137. .yuan-price {
  138. font-size: 26rpx;
  139. font-weight: 500;
  140. text-decoration: line-through;
  141. color: #999999;
  142. }
  143. image {
  144. margin: 0 10rpx;
  145. width: 16rpx;
  146. height: 18rpx;
  147. }
  148. .j-price {
  149. font-size: 24rpx;
  150. font-weight: bold;
  151. color: #B59467;
  152. }
  153. }
  154. .price-x {
  155. font-size: 36rpx;
  156. font-weight: bold;
  157. color: #FF4C4C;
  158. }
  159. }
  160. .shop-content-right {
  161. margin-top:20rpx ;
  162. align-items: center;
  163. text-align: center;
  164. width: 137rpx;
  165. height: 52rpx;
  166. font-size: 26rpx;
  167. font-weight: 500;
  168. color: #fff;
  169. background: #f75022;
  170. border-radius: 26rpx;
  171. line-height: 52rpx;
  172. }
  173. }
  174. }
  175. }
  176. </style>