shopList.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  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 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. }
  37. },
  38. onLoad(opt) {
  39. this.getArticleList()
  40. },
  41. methods: {
  42. navToDetailPage(item) {
  43. uni.navigateTo({
  44. url: '/pages/product/product?id=' + item.id
  45. });
  46. },
  47. getArticleList() {
  48. let obj = this
  49. if (obj.loadingType == 'noMore' || obj.loadingType == 'loading') {
  50. return
  51. }
  52. obj.loadingType = 'loading'
  53. getProducts({
  54. page: obj.page,
  55. limit: obj.limit,
  56. is_gp:1 //设置是否vip商品
  57. }, obj.cid).then(({
  58. data
  59. }) => {
  60. obj.list = obj.list.concat(data)
  61. obj.page++
  62. if (data.length == obj.limit) {
  63. obj.loadingType = 'more'
  64. } else {
  65. obj.loadingType = 'noMore'
  66. }
  67. })
  68. }
  69. }
  70. }
  71. </script>
  72. <style lang="scss" scoped>
  73. page {
  74. background-color: #fff;
  75. min-height: 100%;
  76. }
  77. .list-box-h {
  78. padding: 20rpx;
  79. }
  80. .guess-item {
  81. padding: 10rpx;
  82. display: flex;
  83. min-width: 100%;
  84. width: 0;
  85. margin-bottom: 20rpx;
  86. background: #ffffff;
  87. border-radius: 10rpx;
  88. box-shadow: 0px 0px 20rpx 0px rgba(50, 50, 52, 0.06);
  89. image {
  90. width: 200rpx;
  91. height: 200rpx;
  92. border-radius: 10rpx;
  93. flex-shrink: 0;
  94. }
  95. .guess-box {
  96. width: 100%;
  97. padding: 5px;
  98. position: relative;
  99. .itemContent {
  100. position: absolute ;
  101. width: 100%;
  102. padding: 20rpx 10rpx;
  103. bottom: 0;
  104. right: 0;
  105. }
  106. .title {
  107. font-size: 30rpx;
  108. font-weight: bold;
  109. color: #333333;
  110. height: 2.5em;
  111. line-height: 1.25em;
  112. }
  113. .price-box {
  114. justify-content: flex-start;
  115. .yuanprice {
  116. font-size: 26rpx;
  117. font-family: PingFang SC;
  118. font-weight: 500;
  119. text-decoration: line-through;
  120. color: #999999;
  121. padding-right: 6rpx;
  122. }
  123. image {
  124. width: 14rpx;
  125. height: 16rpx;
  126. }
  127. .jiang {
  128. padding-left: 2rpx;
  129. font-size: 24rpx;
  130. font-family: PingFang SC;
  131. font-weight: bold;
  132. color: #b59467;
  133. }
  134. }
  135. .price {
  136. font-size: 36rpx;
  137. font-family: PingFang SC;
  138. font-weight: bold;
  139. color: #FF6F0F;
  140. }
  141. .btn {
  142. background: #16cc9f;
  143. border-radius: 28rpx;
  144. font-size: 28rpx;
  145. font-weight: 500;
  146. color: #ffffff;
  147. float: right;
  148. padding: 10rpx 20rpx;
  149. }
  150. }
  151. }
  152. </style>