index.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  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" /> -->
  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. <activityAlert :show="centerImageShow" :list="centerImage" @click="handleCenterImageClick" @cancel="handleCenterImageCancelClick" />
  39. <!-- 采美豆提示弹窗 -->
  40. <activityBean
  41. v-if="isActivityBean"
  42. :show="isActivityBean"
  43. :beansType="beansType"
  44. :beanNumber="beanNumber"
  45. @cancel="handleBeanlClick"
  46. />
  47. <cm-seller-modal :suid="suid" />
  48. </view>
  49. </template>
  50. <script>
  51. import { mapState, mapMutations } from 'vuex'
  52. import customer from './components/customer.vue'
  53. import banner from './components/banner.vue'
  54. import navbars from './components/navbars.vue'
  55. import coupon from './components/coupon.vue'
  56. import pageFloor from './components/pageFloor.vue'
  57. import hotFloor from './components/hotFloor.vue'
  58. import pageSpecial from './components/pageSpecial.vue'
  59. import supplierList from './components/supplierList.vue'
  60. import activityAlert from '@/components/cm-module/activity/activities.vue'
  61. import activityBean from '@/components/cm-module/activity/activityBean.vue'
  62. import cmSellerModal from '@/components/cm-share-popup/cm-seller-modal.vue'
  63. import homeMiXins from './index.js'
  64. export default {
  65. mixins: [ homeMiXins ],
  66. components: {
  67. customer,
  68. banner,
  69. navbars,
  70. coupon,
  71. pageFloor,
  72. hotFloor,
  73. pageSpecial,
  74. supplierList,
  75. activityAlert,
  76. activityBean,
  77. cmSellerModal
  78. },
  79. data() {
  80. return {
  81. nvabarData: {
  82. // 顶部自定义导航
  83. showCapsule: 1, // 是否显示左上角图标 1表示显示 0表示不显示,
  84. showSearch: 0,
  85. title: '采美采购商城', // 导航栏 中间的标题
  86. haveBack: false,
  87. textLeft: this.$store.state.isIphone,
  88. textColor: '#333333'
  89. },
  90. CustomBar: this.CustomBar, // 顶部导航栏高度
  91. isScrollTop: false,
  92. }
  93. },
  94. onLoad(option) {
  95. this.options = option
  96. },
  97. computed: {
  98. ...mapState(['hasLogin', 'userInfo'])
  99. },
  100. onPageScroll(e) {
  101. if (e.scrollTop > 0) {
  102. this.isScroll = true
  103. } else {
  104. this.isScroll = false
  105. }
  106. if (e.scrollTop > 400) {
  107. this.isScrollTop = true
  108. } else {
  109. this.isScrollTop = false
  110. }
  111. },
  112. onPullDownRefresh() {
  113. //下拉刷新
  114. this.getHomeInformation()
  115. uni.stopPullDownRefresh()
  116. },
  117. onShareAppMessage(res) {
  118. //分享转发
  119. if (res.from === 'button') {
  120. // 来自页面内转发按钮
  121. }
  122. return {
  123. title: '生美医美正品采购服务平台',
  124. path: 'pages/tabBar/home/index',
  125. imageUrl: 'https://static.caimei365.com/app/img/bg/min-banner.jpg'
  126. }
  127. },
  128. onShow() {
  129. this.autoplay = true
  130. this.GetWxAuthorize()
  131. const suid = this.options.suid ? this.options.suid : uni.getStorageSync('suid') * 1 ? uni.getStorageSync('suid') * 1 : 0 // 协销userId
  132. const spId = this.options.spId ? this.options.spId : uni.getStorageSync('spId') * 1 ? uni.getStorageSync('spId') * 1 : 0 // 协销id
  133. const isShare = this.options.type == 4 ? true : false //是否从分享页进入
  134. if ((isShare || uni.getStorageSync('suid') * 1 > 0) && this.userInfo.userIdentity !== 1) { // 分享进入 且 用户非协销
  135. if (!uni.getStorageSync('spUserId') || (uni.getStorageSync('spUserId') * 1 === uni.getStorageSync('suid') * 1)) {// 如果未分配或者分配相同
  136. this.suid = suid
  137. uni.setStorageSync('suid', suid)
  138. uni.setStorageSync('spId', spId)
  139. } else {
  140. uni.setStorageSync('suid', 0)
  141. this.suid = 0
  142. uni.setStorageSync('spId', 0)
  143. }
  144. }
  145. console.log(this.suid, 'uni.getStorageSync(\'spId\')', uni.getStorageSync('spId'))
  146. },
  147. onHide() {
  148. this.autoplay = false
  149. }
  150. }
  151. </script>
  152. <style lang="scss">
  153. page {
  154. background-color: #ffffff;
  155. }
  156. .container-section {
  157. width: 100%;
  158. height: auto;
  159. background-color: #f7f7f7;
  160. }
  161. </style>