good-floor.vue 4.0 KB

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