index.vue 5.5 KB

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