index.vue 5.2 KB

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