index.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  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 wxLogin from '@/common/config/wxLogin.js'
  72. import homeMiXins from './index.js'
  73. export default {
  74. mixins: [ homeMiXins ],
  75. components: {
  76. customer,
  77. banner,
  78. navbars,
  79. notice,
  80. coupon,
  81. pageFloor,
  82. hotFloor,
  83. Certificate,
  84. pageSpecial,
  85. supplierList,
  86. activityAlert,
  87. activityBean,
  88. quickOpera,
  89. cmSellerModal
  90. },
  91. data() {
  92. return {
  93. nvabarData: {
  94. // 顶部自定义导航
  95. showCapsule: 1, // 是否显示左上角图标 1表示显示 0表示不显示,
  96. showSearch: 0,
  97. title: '采美采购商城', // 导航栏 中间的标题
  98. haveBack: false,
  99. textLeft: this.$store.state.isIphone,
  100. textColor: '#FFFFFF'
  101. },
  102. CustomBar: this.CustomBar, // 顶部导航栏高度
  103. userID: 0,
  104. clubId: 0,
  105. clubStatus: '',
  106. current: 0,
  107. mode: 'round',
  108. isLogin: false,
  109. skeletonShow: true,
  110. userIdentity: 0,
  111. flootData: [], // 楼层
  112. bannerImageList: [], // 轮播
  113. navBarsList: [], // 导航分类
  114. quickOpreaList: [], // 快捷运营
  115. newsList: [], // 公告
  116. templateData: {},
  117. hotListPageFloor: [], // 新品橱窗
  118. pageList: [], // 楼层
  119. supplierObj: {}, // 供应商列表
  120. isScrollTop: false,
  121. isRequest: false,
  122. isNavRequest: false,
  123. isLiveRequest: false,
  124. isActivityBean: false,
  125. beansType: 1,
  126. beanNumber: 50,
  127. couponEntry: 2,
  128. autoplay: true,
  129. isScroll: false,
  130. suid: 0, // 协销id
  131. options: {}, // 分享数据
  132. }
  133. },
  134. onLoad(option) {
  135. this.options = option
  136. },
  137. onShow() {
  138. wxLogin.wxLoginAuthorize()
  139. console.log('userInfo', this.userInfo, this.options, this.scene, "uni.getStorageSync('suid')", uni.getStorageSync('suid'))
  140. const suid = this.options.suid ? this.options.suid : uni.getStorageSync('suid') > 0 ? uni.getStorageSync('suid') : 0 // 协销userId
  141. const spId = this.options.spId ? this.options.spId : uni.getStorageSync('spId') > 0 ? uni.getStorageSync('spId') : 0 // 协销id
  142. if ((this.options.type == 4 || uni.getStorageSync('suid') > 0) && this.userInfo.userIdentity !== 1) { // 分享进入 且 用户非协销
  143. if (!uni.getStorageSync('spUserId') || (uni.getStorageSync('spUserId') === uni.getStorageSync('suid'))) {// 如果未分配或者分配相同
  144. this.suid = suid
  145. uni.setStorageSync('suid', suid)
  146. uni.setStorageSync('spId', spId)
  147. } else {
  148. uni.setStorageSync('suid', 0)
  149. this.suid = 0
  150. uni.setStorageSync('spId', 0)
  151. }
  152. }
  153. console.log(this.suid)
  154. },
  155. computed: {
  156. ...mapState(['hasLogin', 'userInfo'])
  157. },
  158. onPageScroll(e) {
  159. if (e.scrollTop > 0) {
  160. this.isScroll = true
  161. } else {
  162. this.isScroll = false
  163. }
  164. //实时获取到滚动的值
  165. if (e.scrollTop > 50) {
  166. this.inputActive = 'fixed'
  167. } else {
  168. this.inputActive = 'float'
  169. }
  170. if (e.scrollTop > 400) {
  171. this.isScrollTop = true
  172. } else {
  173. this.isScrollTop = false
  174. }
  175. },
  176. onPullDownRefresh() {
  177. //下拉刷新
  178. this.getHomeInformation()
  179. uni.stopPullDownRefresh()
  180. },
  181. onShareAppMessage(res) {
  182. //分享转发
  183. if (res.from === 'button') {
  184. // 来自页面内转发按钮
  185. }
  186. return {
  187. title: '生美医美正品采购服务平台',
  188. path: 'pages/tabBar/home/index',
  189. imageUrl: 'https://static.caimei365.com/app/img/bg/min-banner.jpg'
  190. }
  191. },
  192. onShow() {
  193. this.autoplay = true
  194. this.GetWxAuthorize()
  195. },
  196. onHide() {
  197. this.autoplay = false
  198. }
  199. }
  200. </script>
  201. <style lang="scss">
  202. page {
  203. background-color: #ffffff;
  204. }
  205. .container-section {
  206. width: 100%;
  207. height: auto;
  208. background-color: #f7f7f7;
  209. }
  210. </style>