good-floor.vue 4.5 KB

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