index.vue 6.5 KB

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