index.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. <template>
  2. <view class='recommend'>
  3. <view class="common-hd">
  4. <view class="title">为你推荐</view>
  5. </view>
  6. <view class='recommendList' :class="indexP?'on':''">
  7. <WaterfallsFlow :wfList='hostProduct' @itemTap="goDetail" :type="0" />
  8. </view>
  9. </view>
  10. </template>
  11. <script>
  12. // +----------------------------------------------------------------------
  13. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  14. // +----------------------------------------------------------------------
  15. // | Copyright (c) 2016~2021 https://www.crmeb.com All rights reserved.
  16. // +----------------------------------------------------------------------
  17. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  18. // +----------------------------------------------------------------------
  19. // | Author: CRMEB Team <admin@crmeb.com>
  20. // +----------------------------------------------------------------------
  21. import {mapGetters} from "vuex";
  22. import { goShopDetail } from '@/libs/order.js'
  23. import {openBargainSubscribe} from '@/utils/SubscribeMessage.js';
  24. import {initiateAssistApi} from '@/api/activity.js';
  25. import {toLogin} from '@/libs/login.js';
  26. import WaterfallsFlow from '@/components/WaterfallsFlow/WaterfallsFlow.vue'
  27. export default {
  28. components:{WaterfallsFlow},
  29. computed: mapGetters(['uid']),
  30. props: {
  31. hostProduct: {
  32. type: Array,
  33. default: function() {
  34. return [];
  35. }
  36. },
  37. indexP:{
  38. type: Boolean,
  39. default: false
  40. },
  41. isLogin:{
  42. type: Boolean,
  43. default: false
  44. }
  45. },
  46. data() {
  47. return {
  48. };
  49. },
  50. mounted() {
  51. },
  52. onPullDownRefresh(){
  53. // 模拟上拉刷新
  54. setTimeout(()=>{
  55. const newList = this.hostProduct.reverse();
  56. this.hostProduct = newList;
  57. uni.stopPullDownRefresh();
  58. },500)
  59. },
  60. methods: {
  61. goDetail(item){
  62. goShopDetail(item, this.uid).then(res => {
  63. if (this.isLogin) {
  64. initiateAssistApi(item.activity_id).then(res => {
  65. let id = res.data.product_assist_set_id;
  66. uni.hideLoading();
  67. // #ifndef MP
  68. uni.navigateTo({
  69. url: '/pages/activity/assist_detail/index?id=' + id
  70. });
  71. // #endif
  72. // #ifdef MP
  73. openBargainSubscribe().then(res => {
  74. uni.hideLoading();
  75. uni.navigateTo({
  76. url: '/pages/activity/assist_detail/index?id=' + id
  77. });
  78. }).catch((err) => {
  79. uni.hideLoading();
  80. });
  81. // #endif
  82. }).catch((err) => {
  83. uni.showToast({
  84. title: err,
  85. icon: 'none'
  86. })
  87. });
  88. } else {
  89. // #ifdef H5 || APP-PLUS
  90. toLogin();
  91. // #endif
  92. // #ifdef MP
  93. this.$emit('isShowAuth', true);
  94. this.$emit('isAuto', true);
  95. // #endif
  96. }
  97. })
  98. }
  99. }
  100. }
  101. </script>
  102. <style scoped lang="scss">
  103. .common-hd {
  104. display: flex;
  105. align-items: center;
  106. justify-content: center;
  107. height: 118rpx;
  108. .title {
  109. padding: 0 80rpx;
  110. font-size: 34rpx;
  111. color: $theme-color;
  112. font-weight: bold;
  113. background-image: url("~@/static/images/index-title.png");
  114. background-repeat: no-repeat;
  115. background-size: 100% auto;
  116. background-position: left center;
  117. }
  118. }
  119. .recommend .recommendList {
  120. padding: 0 20rpx;
  121. min-height: 100rpx;
  122. }
  123. .recommend{
  124. background-color:rgba(245,245,245,1);
  125. }
  126. .recommend .recommendList.on{
  127. padding: 0;
  128. }
  129. /deep/.looming-gray{
  130. border-radius: 16rpx 16rpx 0 0;
  131. }
  132. </style>