index.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. <template>
  2. <view class="activity-box">
  3. <view class="activity_header"
  4. :style="{'background-image': pointsgoodsImg}">
  5. <!-- #ifndef H5 -->
  6. <view class='cart_nav'>
  7. <nav-bar navTitle="热门推荐" iconColor='#fff' :backgroundColor="backgroundColor"
  8. :isBackgroundColor="isBackgroundColor" ref="navBarRef"></nav-bar>
  9. </view>
  10. <!-- #endif -->
  11. </view>
  12. <view class="list-box" :style="{'z-index':listZindex}" @touchstart="touchStart">
  13. <view class="list-item" v-for="(item, index) in integralGood" :key="index">
  14. <view class="group-bottom acea-row row-between" @click="toGroupDeatil(item)">
  15. <view class="group-bottom-left relative">
  16. <view v-show="item.stock===0" class="sellOut">已售罄</view>
  17. <easy-loadimage :image-src="item.image" width="220rpx" height="220rpx"
  18. :radius="10"></easy-loadimage>
  19. </view>
  20. <view class="group-bottom-right acea-row row-column row-between w-210">
  21. <view class="title line2 h-80 lh-40rpx mb-46rpx mt-12">{{item.name}}</view>
  22. <PointsPrice :pointsPrice="item" :pointsGoodsStyle="hotPointsStyle"></PointsPrice>
  23. <view class="right-bottom acea-row row-between mt-20rpx pos-rel">
  24. <view class="sales text-24rpx text-999">已有{{item.sales}}人兑换</view>
  25. <view class="btn-box mt-0 lh-56rpx h-56 px-32 abs-rb">
  26. <view class="btn f-s-26">去兑换</view>
  27. </view>
  28. </view>
  29. </view>
  30. </view>
  31. </view>
  32. </view>
  33. </view>
  34. </template>
  35. <script>
  36. /**
  37. * 积分商品推荐样式
  38. */
  39. import {
  40. goProductDetail
  41. } from "../../../libs/order";
  42. export const hotPointsStyle = {
  43. iconStyle: {
  44. width: '32rpx',
  45. height: '32rpx'
  46. },
  47. priceStyle: {
  48. fontSize: '32rpx',
  49. },
  50. unitStyle: {
  51. fontSize: '28rpx',
  52. },
  53. }
  54. import {
  55. integralProductHotApi,
  56. } from '@/api/activity.js'
  57. import navBar from '@/components/navBar';
  58. import priceStyle from '@/components/priceStyle'
  59. import easyLoadimage from '@/components/base/easy-loadimage.vue';
  60. import PointsPrice from '@/components/PointsPrice.vue';
  61. let app = getApp();
  62. export default {
  63. components: {
  64. navBar,
  65. priceStyle,
  66. easyLoadimage,
  67. PointsPrice
  68. },
  69. data() {
  70. return {
  71. urlDomain: this.$Cache.get("imgHost"),
  72. hotPointsStyle: hotPointsStyle,
  73. theme: app.globalData.theme,
  74. backgroundColor: 'transparent',
  75. isBackgroundColor: false,
  76. headerZindex: 9,
  77. listZindex: 99,
  78. where: {
  79. page: 1,
  80. limit: 10,
  81. },
  82. loadend: false,
  83. loading: false,
  84. loadTitle: '加载更多',
  85. integralGood: []
  86. }
  87. },
  88. computed: {
  89. // #ifdef APP-PLUS || MP
  90. pointsgoodsImg() {
  91. return 'url(' + this.urlDomain + 'crmebimage/presets/pointsgoods.png' + ')'
  92. },
  93. // #endif
  94. // #ifdef H5
  95. pointsgoodsImg() {
  96. return 'url(' + this.urlDomain + 'crmebimage/presets/pointsgoodsh5.png' + ')'
  97. },
  98. // #endif
  99. },
  100. onLoad() {
  101. this.getIntegralList();
  102. },
  103. methods: {
  104. //滚动
  105. touchStart() {
  106. this.$refs.navBarRef.currentPage = false;
  107. },
  108. //积分商品列表
  109. getIntegralList() {
  110. if (this.loadend) return;
  111. if (this.loading) return;
  112. this.loading = true;
  113. integralProductHotApi(this.where).then(res => {
  114. let list = res.data.list;
  115. let limit = this.where.limit;
  116. this.where.page++;
  117. this.loadend = limit > list.length;
  118. this.integralGood = this.integralGood.concat(list);
  119. this.loading = false;
  120. this.loadTitle = loadend ? '没有更多内容啦~' : '加载更多';
  121. }).catch(err => {
  122. this.loading = false;
  123. this.loadTitle = '加载更多';
  124. return this.$util.Tips({
  125. title: err
  126. });
  127. })
  128. },
  129. onPageScroll(e) {
  130. if (e.scrollTop > 130) {
  131. this.backgroundColor = '#E93323';
  132. this.listZindex = 9
  133. this.headerZindex = 99
  134. } else {
  135. this.backgroundColor = 'transparent';
  136. this.listZindex = 99
  137. this.headerZindex = 9
  138. }
  139. // 传入scrollTop值并触发所有easy-loadimage组件下的滚动监听事件
  140. uni.$emit('scroll');
  141. },
  142. //to积分详情
  143. toGroupDeatil(item) {
  144. goProductDetail(item.id, 0, '', 1)
  145. }
  146. },
  147. onReachBottom() {
  148. this.getIntegralList();
  149. }
  150. }
  151. </script>
  152. <style lang="scss" scoped>
  153. .activity_header{
  154. /* #ifndef MP */
  155. height: 438rpx !important;
  156. /* #endif */
  157. /* #ifdef MP */
  158. height: 550rpx !important;
  159. /* #endif */
  160. }
  161. .list-box {
  162. background: linear-gradient(0deg, #F5F5F5 0%, rgba(255, 255, 255, 0) 100%) !important;
  163. top: -170rpx !important;
  164. }
  165. .mb-46rpx {
  166. margin-bottom: 42rpx;
  167. }
  168. .group-bottom {
  169. padding: 24rpx !important;
  170. }
  171. .btn-box {
  172. background: #FFF3E5;
  173. border-radius: 29rpx 29rpx 29rpx 29rpx;
  174. color: #FF8C00;
  175. }
  176. @import "../static/css/activity.scss";
  177. </style>