vip.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. <template>
  2. <view class="center">
  3. <view class="list-box-h">
  4. <view v-for="(item, index) in dataList" :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.title }}</view>
  8. <view class="price-box flex">
  9. <view class="yuanprice">{{ item.ot_price }}</view>
  10. <image src="../../static/img/jiantou.png" mode=""></image>
  11. <view class="jiang">直降{{ (item.ot_price - item.price).toFixed(2) }}元</view>
  12. </view>
  13. <view class="price">¥{{ item.price }}</view>
  14. <view class="btn">立即购买</view>
  15. </view>
  16. </view>
  17. </view>
  18. </view>
  19. </template>
  20. <script>
  21. import { dhList } from '@/api/product.js';
  22. export default {
  23. data() {
  24. return {
  25. dataList: [],
  26. page: 1,
  27. limit: 10,
  28. loadingType:'more'
  29. };
  30. },
  31. onLoad() {
  32. this.loadData();
  33. },
  34. onReachBottom(){
  35. this.loadData()
  36. },
  37. methods: {
  38. loadData() {
  39. const obj = this;
  40. if (this.loadingType === 'loading') {
  41. //防止重复加载
  42. return;
  43. }
  44. if (this.loadingType === 'noMore') {
  45. //防止重复加载
  46. return;
  47. }
  48. this.loadingType = 'loading';
  49. dhList({ page: this.page, limit: this.limit }).then(({ data }) => {
  50. console.log(data)
  51. if(data.length > 0){
  52. this.dataList = this.dataList.concat(data)
  53. }
  54. this.$nextTick(function() {
  55. if (obj.limit == data.length) {
  56. //判断是否还有数据, 有改为 more, 没有改为noMore
  57. obj.loadingType = 'more';
  58. return;
  59. } else {
  60. //判断是否还有数据, 有改为 more, 没有改为noMore
  61. obj.loadingType = 'noMore';
  62. }
  63. });
  64. this.$set(obj.dataList, 'loaded', true);
  65. });
  66. },
  67. navToDetailPage(item){
  68. uni.navigateTo({
  69. url:'/pages/product/vipProduct?id=' + item.id
  70. })
  71. }
  72. }
  73. };
  74. </script>
  75. <style lang="scss">
  76. page,
  77. .center {
  78. height: auto;
  79. min-height: 100%;
  80. background-color: #ffffff;
  81. }
  82. .guess-item {
  83. display: flex;
  84. width: 710rpx;
  85. height: 290rpx;
  86. background: #ffffff;
  87. box-shadow: 0px 0px 20rpx 0px rgba(50, 50, 52, 0.06);
  88. border-radius: 10rpx;
  89. padding: 15rpx;
  90. padding-bottom: 150rpx;
  91. margin: 20rpx auto 0;
  92. position: relative;
  93. image {
  94. width: 200rpx;
  95. height: 200rpx;
  96. border-radius: 10rpx;
  97. }
  98. .guess-box {
  99. padding: 12rpx 0 0 24rpx;
  100. width: 436rpx;
  101. .title {
  102. font-size: 36rpx;
  103. padding-left: 4rpx;
  104. font-family: PingFang SC;
  105. font-weight: 500;
  106. color: #333333;
  107. width: 368rpx;
  108. line-height: 36rpx;
  109. .tuanF {
  110. display: inline-block;
  111. margin-right: 4rpx;
  112. position: relative;
  113. top: -6rpx;
  114. .tuan {
  115. display: flex;
  116. align-items: center;
  117. padding: 10rpx;
  118. height: 36rpx;
  119. background: #ffebe9;
  120. border-radius: 18rpx;
  121. .tuan-image {
  122. width: 18rpx;
  123. height: 18rpx;
  124. }
  125. .tuan-font {
  126. display: inline;
  127. font-size: 20rpx;
  128. font-family: PingFang SC;
  129. font-weight: 500;
  130. color: #ff1135;
  131. margin-left: 2rpx;
  132. }
  133. }
  134. }
  135. }
  136. .ping-box {
  137. margin-top: 15rpx;
  138. justify-content: flex-start;
  139. .ping {
  140. margin-left: 10rpx;
  141. height: 39rpx;
  142. background: #fdf7eb;
  143. border-radius: 5rpx;
  144. font-size: 22rpx;
  145. font-family: PingFang SC;
  146. font-weight: 500;
  147. color: #ff911f;
  148. display: flex;
  149. align-items: center;
  150. padding: 0 10rpx;
  151. }
  152. }
  153. .price-box {
  154. margin-top: 80rpx;
  155. justify-content: flex-start;
  156. .yuanprice {
  157. font-size: 26rpx;
  158. font-family: PingFang SC;
  159. font-weight: 500;
  160. text-decoration: line-through;
  161. color: #999999;
  162. padding-right: 6rpx;
  163. }
  164. image {
  165. width: 14rpx;
  166. height: 16rpx;
  167. }
  168. .jiang {
  169. padding-left: 2rpx;
  170. font-size: 24rpx;
  171. font-family: PingFang SC;
  172. font-weight: bold;
  173. color: #b59467;
  174. }
  175. }
  176. .price {
  177. font-size: 36rpx;
  178. font-family: PingFang SC;
  179. font-weight: bold;
  180. color: #ff1135;
  181. }
  182. .btn {
  183. width: 137rpx;
  184. height: 56rpx;
  185. background: #16cc9f;
  186. border-radius: 28rpx;
  187. font-size: 28rpx;
  188. font-family: PingFang SC;
  189. font-weight: 500;
  190. color: #ffffff;
  191. line-height: 56rpx;
  192. text-align: center;
  193. position: absolute;
  194. bottom: 25rpx;
  195. right: 25rpx;
  196. }
  197. }
  198. }
  199. </style>