You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

180 lines
4.0 KiB

3 months ago
  1. <template>
  2. <view class='recommend'>
  3. <view class='title acea-row row-center-wrapper'>
  4. <text class='iconfont icon-zhuangshixian'></text>
  5. <text class='name'>热门推荐</text>
  6. <text class='iconfont icon-zhuangshixian lefticon'></text>
  7. </view>
  8. <view class='recommendList acea-row row-between-wrapper'>
  9. <view class='item' v-for="(item,index) in tempArr" :key="index" hover-class='none'
  10. @tap="goDetail(item)">
  11. <view class='pictrue'>
  12. <image :src='item.image'></image>
  13. <view :style="{ backgroundImage: `url(${item.activityStyle})` }" class="border-picture"></view>
  14. <span class="pictrue_log_big pictrue_log_class"
  15. v-if="item.activityH5 && item.activityH5.type === '1'">秒杀</span>
  16. <span class="pictrue_log_big pictrue_log_class"
  17. v-if="item.activityH5 && item.activityH5.type === '2'">砍价</span>
  18. <span class="pictrue_log_big pictrue_log_class"
  19. v-if="item.activityH5 && item.activityH5.type === '3'">拼团</span>
  20. </view>
  21. <view class='name line1'>{{item.storeName}}</view>
  22. <view class='money'><text class='num'>{{item.price}}</text></view>
  23. </view>
  24. </view>
  25. <view class='loadingicon acea-row row-center-wrapper' :hidden='loading==false'>
  26. <text class='loading iconfont icon-jiazai'></text>
  27. </view>
  28. <view class="mores-txt flex" v-if="goodScroll">
  29. <text>我也是有底线的~</text>
  30. </view>
  31. </view>
  32. </template>
  33. <script>
  34. import {
  35. mapGetters
  36. } from "vuex";
  37. import {
  38. goShopDetail
  39. } from '@/libs/order.js'
  40. import animationType from '@/utils/animationType.js'
  41. import {
  42. getProductHot
  43. } from '@/api/store.js';
  44. export default {
  45. computed: mapGetters(['uid']),
  46. props: {
  47. hostProduct: {
  48. type: Array,
  49. default: function() {
  50. return [];
  51. }
  52. }
  53. },
  54. mounted() {
  55. this.params.page = 1;
  56. this.goodScroll = false;
  57. this.tempArr = [];
  58. this.get_host_product();
  59. },
  60. data() {
  61. return {
  62. goodScroll: false,
  63. params: { //精品推荐分页
  64. page: 1,
  65. limit: 10
  66. },
  67. loading: false,
  68. tempArr: []
  69. };
  70. },
  71. methods: {
  72. /**
  73. * 获取我的推荐
  74. */
  75. get_host_product: function() {
  76. if (this.goodScroll) return;
  77. this.loading = true
  78. getProductHot(
  79. this.params.page,
  80. this.params.limit
  81. ).then((res) => {
  82. this.$set(this.params, 'page', this.params.page + 1);
  83. this.goodScroll = this.params.page > res.data.totalPage;
  84. this.tempArr = this.tempArr.concat(res.data.list || []);
  85. this.$emit('getRecommendLength', this.tempArr.length);
  86. this.loading = false
  87. }).catch(err => {
  88. this.loading = false
  89. });
  90. },
  91. goDetail(item) {
  92. goShopDetail(item, this.uid).then(res => {
  93. uni.navigateTo({
  94. animationType: animationType.type,
  95. animationDuration: animationType.duration,
  96. url: `/pages/goods/goods_details/index?id=${item.id}`
  97. })
  98. })
  99. }
  100. }
  101. }
  102. </script>
  103. <style scoped lang="scss">
  104. .mores-txt {
  105. width: 100%;
  106. align-items: center;
  107. justify-content: center;
  108. height: 70rpx;
  109. color: #999;
  110. font-size: 24rpx;
  111. .iconfont {
  112. margin-top: 2rpx;
  113. font-size: 20rpx;
  114. }
  115. }
  116. .recommend {
  117. background-color: #fff;
  118. }
  119. .recommend .title {
  120. height: 135rpx;
  121. line-height: 135rpx;
  122. font-size: 28rpx;
  123. color: #282828;
  124. }
  125. .recommend .title .name {
  126. margin: 0 28rpx;
  127. }
  128. .recommend .title .iconfont {
  129. font-size: 170rpx;
  130. color: #454545;
  131. }
  132. .recommend .title .iconfont.lefticon {
  133. transform: rotate(180deg);
  134. }
  135. .recommend .recommendList {
  136. padding: 0 30rpx;
  137. }
  138. .recommend .recommendList .item {
  139. width: 335rpx;
  140. margin-bottom: 30rpx;
  141. }
  142. .recommend .recommendList .item .pictrue {
  143. position: relative;
  144. width: 100%;
  145. height: 335rpx;
  146. }
  147. .recommend .recommendList .item .pictrue image {
  148. width: 100%;
  149. height: 100%;
  150. border-radius: 14rpx;
  151. }
  152. .recommend .recommendList .item .name {
  153. font-size: 28rpx;
  154. color: #282828;
  155. margin-top: 20rpx;
  156. }
  157. .money {
  158. font-size: 20rpx;
  159. margin-top: 8rpx;
  160. font-weight: 600;
  161. @include price_color(theme);
  162. }
  163. .recommend .recommendList .item .money .num {
  164. font-size: 28rpx;
  165. }
  166. </style>