index.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. <template>
  2. <view class='recommend'>
  3. <view class="common-hd">
  4. <view class="title" :style="{ 'background-image': `url(${domain}/static/images/index-title.png)`}">为你推荐</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~2024 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 {initiateAssistApi} from '@/api/activity.js';
  24. import {toLogin} from '@/libs/login.js';
  25. import WaterfallsFlow from '@/components/WaterfallsFlow/WaterfallsFlow.vue'
  26. import { HTTP_REQUEST_URL } from '@/config/app';
  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. domain: HTTP_REQUEST_URL,
  49. };
  50. },
  51. mounted() {
  52. },
  53. onPullDownRefresh(){
  54. // 模拟上拉刷新
  55. setTimeout(()=>{
  56. const newList = this.hostProduct.reverse();
  57. this.hostProduct = newList;
  58. uni.stopPullDownRefresh();
  59. },500)
  60. },
  61. methods: {
  62. goDetail(item){
  63. goShopDetail(item, this.uid).then(res => {
  64. if (this.isLogin) {
  65. initiateAssistApi(item.activity_id).then(res => {
  66. let id = res.data.product_assist_set_id;
  67. uni.hideLoading();
  68. uni.navigateTo({
  69. url: '/pages/activity/assist_detail/index?id=' + id
  70. });
  71. }).catch((err) => {
  72. uni.showToast({
  73. title: err,
  74. icon: 'none'
  75. })
  76. });
  77. } else {
  78. toLogin();
  79. }
  80. })
  81. }
  82. }
  83. }
  84. </script>
  85. <style scoped lang="scss">
  86. .common-hd {
  87. display: flex;
  88. align-items: center;
  89. justify-content: center;
  90. height: 118rpx;
  91. .title {
  92. padding: 0 80rpx;
  93. font-size: 34rpx;
  94. color: $theme-color;
  95. font-weight: bold;
  96. background-repeat: no-repeat;
  97. background-size: 100% auto;
  98. background-position: left center;
  99. }
  100. }
  101. .recommend .recommendList {
  102. padding: 0 20rpx;
  103. min-height: 100rpx;
  104. }
  105. .recommend .recommendList.on{
  106. padding: 0;
  107. }
  108. /deep/.looming-gray{
  109. border-radius: 16rpx 16rpx 0 0;
  110. }
  111. </style>