index.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. <template>
  2. <view class="container home clearfix" :style="{ paddingTop: CustomBar + 'px' }">
  3. <tui-skeleton
  4. v-if="skeletonShow"
  5. backgroundColor="#fafafa"
  6. borderRadius="10rpx"
  7. :isLoading="true"
  8. :loadingType="5"
  9. />
  10. <customer ref="customer" :isScroll="isScroll" :navbar-data="nvabarData" :navBarsList="navBarsList" v-if="isNavRequest" /> <!-- 主页内容 -->
  11. <view class="container-home tui-skeleton">
  12. <!-- 轮播 -->
  13. <banner :list="bannerImageList" v-if="isNavRequest" />
  14. <!-- 金刚区菜单 -->
  15. <navbars :list="shortcutList" v-if="isNavRequest" />
  16. <!-- 优惠券入口 -->
  17. <coupon v-if="isNavRequest && couponEntry == 1" />
  18. <!-- 直播 -->
  19. <page-special :templateData="templateData" v-if="isLiveRequest" />
  20. <!-- 新品橱窗 -->
  21. <hot-floor
  22. :list="hotListPageFloor"
  23. :usserIdentity="userIdentity"
  24. :autoplay="autoplay"
  25. v-if="isRequest && hotListPageFloor.length > 0"
  26. />
  27. </view>
  28. <!-- 楼层 -->
  29. <view class="container-section tui-skeleton">
  30. <page-floor :list="pageList" :userIdentity="userIdentity" :pageType="1" v-if="isRequest" />
  31. <supplier-list :supplierObj="supplierObj" v-if="isRequest" />
  32. </view>
  33. <!-- 侧边 -->
  34. <scroll-top :isScrollTop="isScrollTop" :isShowSupplier="true" :isShowKefu='false' :bottom="130" />
  35. <!-- 活动弹窗 -->
  36. <activityAlert :show="isActivity" @click="handleClick" @cancel="handleCancelClick" />
  37. <!-- 采美豆提示弹窗 -->
  38. <activityBean
  39. v-if="isActivityBean"
  40. :show="isActivityBean"
  41. :beansType="beansType"
  42. :beanNumber="beanNumber"
  43. @cancel="handleBeanlClick"
  44. />
  45. <cm-seller-modal :suid="suid" />
  46. </view>
  47. </template>
  48. <script>
  49. import { mapState, mapMutations } from 'vuex'
  50. import customer from '@/components/cm-module/homeIndex/customer.vue'
  51. import banner from '@/components/cm-module/homeIndex/banner.vue'
  52. import navbars from '@/components/cm-module/homeIndex/navbars.vue'
  53. import coupon from '@/components/cm-module/homeIndex/coupon.vue'
  54. import pageFloor from '@/components/cm-module/homeIndex/pageFloor.vue'
  55. import hotFloor from '@/components/cm-module/homeIndex/hotFloor.vue'
  56. import pageSpecial from '@/components/cm-module/homeIndex/pageSpecial.vue'
  57. import supplierList from '@/components/cm-module/homeIndex/supplierList.vue'
  58. import activityAlert from '@/components/cm-module/activity/activity.vue'
  59. import activityBean from '@/components/cm-module/activity/activityBean.vue'
  60. import cmSellerModal from '@/components/cm-share-popup/cm-seller-modal.vue'
  61. import homeMiXins from './index.js'
  62. export default {
  63. mixins: [ homeMiXins ],
  64. components: {
  65. customer,
  66. banner,
  67. navbars,
  68. coupon,
  69. pageFloor,
  70. hotFloor,
  71. pageSpecial,
  72. supplierList,
  73. activityAlert,
  74. activityBean,
  75. cmSellerModal
  76. },
  77. data() {
  78. return {
  79. nvabarData: {
  80. // 顶部自定义导航
  81. showCapsule: 1, // 是否显示左上角图标 1表示显示 0表示不显示,
  82. showSearch: 0,
  83. title: '采美采购商城', // 导航栏 中间的标题
  84. haveBack: false,
  85. textLeft: this.$store.state.isIphone,
  86. textColor: '#333333'
  87. },
  88. CustomBar: this.CustomBar, // 顶部导航栏高度
  89. isScrollTop: false,
  90. }
  91. },
  92. onLoad(option) {
  93. this.options = option
  94. },
  95. computed: {
  96. ...mapState(['hasLogin', 'userInfo'])
  97. },
  98. onPageScroll(e) {
  99. if (e.scrollTop > 0) {
  100. this.isScroll = true
  101. } else {
  102. this.isScroll = false
  103. }
  104. if (e.scrollTop > 400) {
  105. this.isScrollTop = true
  106. } else {
  107. this.isScrollTop = false
  108. }
  109. },
  110. onPullDownRefresh() {
  111. //下拉刷新
  112. this.getHomeInformation()
  113. uni.stopPullDownRefresh()
  114. },
  115. onShareAppMessage(res) {
  116. //分享转发
  117. if (res.from === 'button') {
  118. // 来自页面内转发按钮
  119. }
  120. return {
  121. title: '生美医美正品采购服务平台',
  122. path: 'pages/tabBar/home/index',
  123. imageUrl: 'https://static.caimei365.com/app/img/bg/min-banner.jpg'
  124. }
  125. },
  126. onShow() {
  127. this.autoplay = true
  128. this.GetWxAuthorize()
  129. const suid = this.options.suid ? this.options.suid : uni.getStorageSync('suid') * 1 ? uni.getStorageSync('suid') * 1 : 0 // 协销userId
  130. const spId = this.options.spId ? this.options.spId : uni.getStorageSync('spId') * 1 ? uni.getStorageSync('spId') * 1 : 0 // 协销id
  131. const isShare = this.options.type == 4 ? true : false //是否从分享页进入
  132. if ((isShare || uni.getStorageSync('suid') * 1 > 0) && this.userInfo.userIdentity !== 1) { // 分享进入 且 用户非协销
  133. if (!uni.getStorageSync('spUserId') || (uni.getStorageSync('spUserId') * 1 === uni.getStorageSync('suid') * 1)) {// 如果未分配或者分配相同
  134. this.suid = suid
  135. uni.setStorageSync('suid', suid)
  136. uni.setStorageSync('spId', spId)
  137. } else {
  138. uni.setStorageSync('suid', 0)
  139. this.suid = 0
  140. uni.setStorageSync('spId', 0)
  141. }
  142. }
  143. console.log(this.suid, "uni.getStorageSync('spId')", uni.getStorageSync('spId'))
  144. },
  145. onHide() {
  146. this.autoplay = false
  147. }
  148. }
  149. </script>
  150. <style lang="scss">
  151. page {
  152. background-color: #ffffff;
  153. }
  154. .container-section {
  155. width: 100%;
  156. height: auto;
  157. background-color: #f7f7f7;
  158. }
  159. </style>