good-floor.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. <template>
  2. <view class="container floor clearfix" :style="{ paddingTop: CustomBar + 'px' }">
  3. <custom-floor :systeminfo="systeminfo" :navbar-data="nvabarData" :headerBtnPosi="headerBtnPosi" />
  4. <tui-skeleton
  5. v-if="!isRequest"
  6. backgroundColor="#fafafa"
  7. borderRadius="10rpx"
  8. :isLoading="true"
  9. :loadingType="5"
  10. />
  11. <template v-else>
  12. <view class="container-home tui-skeleton">
  13. <!-- 金刚区菜单 -->
  14. <templateNav :list="navBarsList" v-if="isRequest" />
  15. </view>
  16. <!-- 楼层 -->
  17. <view class="container-section tui-skeleton">
  18. <page-floor :list="pageList" :userIdentity="userIdentity" :pageType="2" v-if="isRequest" />
  19. </view>
  20. <!-- 侧边 -->
  21. <scroll-top :isScrollTop="isScrollTop" :bottom="50" />
  22. </template>
  23. </view>
  24. </template>
  25. <script>
  26. import { mapState, mapMutations } from 'vuex'
  27. import customFloor from '@/components/cm-custom/custom-floor' //自定义导航
  28. import templateNav from '@/components/cm-module/pageTemplate/templateNav.vue'
  29. import pageFloor from './components/pageFloor.vue'
  30. import authorize from '@/common/config/authorize.js'
  31. import wxLogin from '@/common/config/wxLogin.js'
  32. export default {
  33. components: {
  34. customFloor,
  35. templateNav,
  36. pageFloor
  37. },
  38. data() {
  39. return {
  40. userId: 0,
  41. shopId: 0,
  42. userIdentity: 0,
  43. headerBtnPosi: this.setHeaderBtnPosi(), //获取设备顶部胶囊高度
  44. systeminfo: this.setSysteminfo(), //获取设备信息
  45. CustomBar: this.CustomBar, // 顶部导航栏高度
  46. navBarsList: [],
  47. pageList: [], //楼层
  48. isRequest: false,
  49. isScrollTop: false,
  50. pageId: '',
  51. typeSort: ''
  52. }
  53. },
  54. computed: {
  55. ...mapState(['hasLogin', 'userInfo','isWxAuthorize'])
  56. },
  57. onLoad(option) {
  58. if (option.type == 'share') {
  59. wxLogin.wxLoginAuthorize()
  60. }
  61. this.pageId = option.linkId
  62. this.GetInstrumentPageDataa(this.pageId)
  63. },
  64. methods: {
  65. async GetInstrumentPageDataa(pageId) {
  66. //获取楼层数据
  67. const userInfo = await this.$api.getStorage()
  68. this.userId = userInfo.userId ? userInfo.userId : 0
  69. this.shopId = userInfo.shopId ? userInfo.shopId : 0
  70. this.userIdentity = userInfo.userIdentity
  71. this.CommonService.GetInstrumentPageData({ pageId: pageId, userId: this.userId, source: 2 })
  72. .then(response => {
  73. let data = response.data
  74. uni.setStorageSync('pageLabel', `${data.contentLabel}`)
  75. this.GetHomeInit(data.typeSort, data.floorList)
  76. })
  77. .catch(error => {
  78. this.$util.msg(error.msg, 2000)
  79. })
  80. },
  81. //金刚区分类
  82. async GetHomeInit(typeSort, floorList) {
  83. try{
  84. const res = await this.CommonService.GetFirstClassly({ typeSort: typeSort, source: 'crm' })
  85. this.navBarsList = res.data
  86. this.pageList = floorList
  87. this.isRequest = true
  88. }catch(error){
  89. console.log('error',error)
  90. }
  91. },
  92. setHeaderBtnPosi() {
  93. // 获得胶囊按钮位置信息
  94. let headerBtnPosi = uni.getMenuButtonBoundingClientRect()
  95. return headerBtnPosi
  96. },
  97. setSysteminfo() {
  98. let systeminfo
  99. uni.getSystemInfo({
  100. // 获取设备信息
  101. success: res => {
  102. systeminfo = res
  103. }
  104. })
  105. return systeminfo
  106. }
  107. },
  108. onPageScroll(e) {
  109. //实时获取到滚动的值
  110. if (e.scrollTop > 400) {
  111. this.isScrollTop = true
  112. } else {
  113. this.isScrollTop = false
  114. }
  115. },
  116. onPullDownRefresh() {
  117. setTimeout(() => {
  118. uni.stopPullDownRefresh()
  119. }, 200)
  120. },
  121. onShareAppMessage(res) {
  122. //分享转发
  123. if (res.from === 'button') {
  124. // 来自页面内转发按钮
  125. }
  126. return {
  127. title: '采美-一站式生/医美采购服务平台',
  128. path: `pages/goods/good-floor?type=share&linkId=${this.pageId}`
  129. }
  130. },
  131. onShow() {}
  132. }
  133. </script>
  134. <style lang="scss">
  135. page {
  136. background-color: #ffffff;
  137. }
  138. .container-home {
  139. width: 100%;
  140. height: auto;
  141. }
  142. .container-ross {
  143. width: 100%;
  144. height: 264rpx;
  145. box-sizing: border-box;
  146. padding: 24rpx 24rpx 0 24rpx;
  147. float: left;
  148. background-color: #f5f5f5;
  149. .ross-image {
  150. width: 100%;
  151. height: 100%;
  152. line-height: 240rpx;
  153. background-color: #f3920d;
  154. border-radius: 16rpx;
  155. text-align: center;
  156. font-size: 80rpx;
  157. color: #ffffff;
  158. .image {
  159. width: 100%;
  160. height: 100%;
  161. border-radius: 16rpx;
  162. display: block;
  163. }
  164. }
  165. }
  166. .container-section {
  167. width: 100%;
  168. height: auto;
  169. background-color: #f7f7f7;
  170. }
  171. </style>