Vipgift.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. <template>
  2. <view class="content padding-t-20">
  3. <view class="flex item padding-v-20 padding-c-20" v-for="(item, index) in goodsList">
  4. <view class="imgbox"><image class="img" :src="item.image" mode="scaleToFill"></image></view>
  5. <view class="contentbox padding-l-20 flex">
  6. <view class="clamp2 title">{{ item.store_name }}</view>
  7. <view class="oldMoneyBox ">
  8. <!-- <view class="flex-start padding-b-10">
  9. <text class="oldMoney">¥{{ item.ot_price }}</text>
  10. <image class="icon padding-l-10" src="../../static/img/domIcon.png" mode="scaleToFill"></image>
  11. <text class="domMoney font-size-sm">直降{{ item.ot_price * 1 - item.price * 1 }}元</text>
  12. </view> -->
  13. <view class="flex">
  14. <view class="money">¥{{ item.price }}</view>
  15. <view class="buttomPay" @click="navto('/pages/product/product?id=' + item.id)">立即购买</view>
  16. </view>
  17. </view>
  18. </view>
  19. </view>
  20. <uni-load-more :status="loadingType"></uni-load-more>
  21. </view>
  22. </template>
  23. <script>
  24. import { groomList } from '@/api/product.js';
  25. export default {
  26. data() {
  27. return {
  28. // 列表
  29. goodsList: [],
  30. limit: 10, //每次加载数据条数
  31. page: 1, //当前页数
  32. loadingType: 'more' //加载更多状态
  33. };
  34. },
  35. onLoad() {
  36. this.getProducts();
  37. },
  38. onShow() {},
  39. onPullDownRefresh() {
  40. this.getProducts('refresh');
  41. },
  42. methods: {
  43. navto(url) {
  44. // #ifdef H5
  45. console.log(url.indexOf('http'), 'banner');
  46. if (url.indexOf('http') >= 0) {
  47. window.location.href = url;
  48. }
  49. // #endif
  50. //测试数据没有写id,用title代替
  51. uni.navigateTo({
  52. url: url
  53. });
  54. },
  55. async getProducts(type) {
  56. let obj = this;
  57. // 判断是否为重新加载数据
  58. if (type !== 'refresh') {
  59. //没有更多数据直接跳出方法
  60. if (obj.loadingType === 'nomore') {
  61. return;
  62. }
  63. if (obj.loadingType === 'loading') {
  64. //防止重复加载
  65. return;
  66. }
  67. // 设置当前为数据载入中
  68. obj.loadingType = 'loading';
  69. } else {
  70. this.page = 1;
  71. obj.goodsList = [];
  72. //当重新加载数据时更新状态为可继续添加数据
  73. obj.loadingType = 'more';
  74. }
  75. let data = {
  76. page: obj.page,
  77. limit: obj.limit
  78. };
  79. groomList(data, 5).then(e => {
  80. obj.goodsList = obj.goodsList.concat(e.data.list);
  81. //判断是否还有下一页,有是more 没有是nomore
  82. if (obj.limit == e.data.list.length) {
  83. obj.page++;
  84. obj.loadingType = 'more';
  85. } else {
  86. obj.loadingType = 'nomore';
  87. }
  88. });
  89. }
  90. }
  91. };
  92. </script>
  93. <style lang="scss">
  94. page,
  95. .content {
  96. min-height: 100%;
  97. height: auto;
  98. }
  99. .item {
  100. border-radius: 10rpx;
  101. background-color: #ffffff;
  102. width: 690rpx;
  103. margin: 0 30rpx 20rpx 30rpx;
  104. align-items: stretch;
  105. line-height: 1;
  106. .imgbox {
  107. line-height: 0;
  108. background-color: #ee2f72;
  109. border-radius: 10rpx;
  110. overflow: hidden;
  111. flex-shrink: 0;
  112. .img {
  113. height: 246rpx;
  114. width: 246rpx;
  115. }
  116. }
  117. .contentbox {
  118. flex-wrap: wrap;
  119. .title {
  120. width: 100%;
  121. align-self: flex-start;
  122. font-size: $font-lg;
  123. color: $font-color-dark;
  124. line-height: 1.5;
  125. }
  126. .money {
  127. font-size: $font-lg + 4rpx;
  128. font-weight: bold;
  129. color: #ee2f72;
  130. }
  131. .oldMoneyBox {
  132. align-self: flex-end;
  133. width: 100%;
  134. .oldMoney {
  135. font-size: $font-sm;
  136. text-decoration: line-through;
  137. color: $font-color-light;
  138. }
  139. .domMoney {
  140. color: #b59467;
  141. }
  142. .icon {
  143. width: 14rpx;
  144. height: 16rpx;
  145. }
  146. .buttomPay {
  147. padding: 14rpx 26rpx;
  148. font-size: $font-base;
  149. color: #fff;
  150. background: linear-gradient(90deg, #ff4a8a, #ff77a7);
  151. border-radius: 26px;
  152. }
  153. }
  154. }
  155. }
  156. </style>