good-floor.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  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. if(this.isWxAuthorize){
  56. wxLogin.wxLoginAuthorize()
  57. }else{
  58. console.log(new Date +'用户未授权微信信息')
  59. }
  60. }
  61. this.pageId = option.linkId
  62. this.$api.getComStorage('userInfo').then((resolve) =>{
  63. this.userID = resolve.userId ? resolve.userId : 0;
  64. this.shopId = resolve.shopId ? resolve.shopId : 0;
  65. this.userIdentity = resolve.userIdentity
  66. this.GetInstrumentPageData();
  67. }).catch(error =>{
  68. this.GetInstrumentPageData();
  69. })
  70. setTimeout(()=>{
  71. this.skeletonShow = false
  72. },2000)
  73. },
  74. methods:{
  75. GetInstrumentPageData(){//获取楼层数据
  76. this.CommonService.GetInstrumentPageData({pageId:this.pageId,userId:this.userID,source:2}).then(response =>{
  77. let data = response.data
  78. this.typeSort = data.page.typeSort
  79. this.pageList = data.floorList
  80. this.GetHomeInit()
  81. }).catch(error =>{
  82. this.$util.msg(error.msg,2000)
  83. })
  84. },
  85. GetHomeInit(){//金刚区分类
  86. this.CommonService.GetFirstClassly({typeSort:this.typeSort,source:'crm'}).then(response =>{
  87. this.navBarsList = response.data
  88. this.isRequest =true
  89. }).catch(error =>{
  90. this.$util.msg(error.msg,2000)
  91. })
  92. },
  93. setHeaderBtnPosi(){
  94. // 获得胶囊按钮位置信息
  95. let headerBtnPosi = uni.getMenuButtonBoundingClientRect();
  96. return headerBtnPosi
  97. },
  98. setSysteminfo(){
  99. let systeminfo;
  100. uni.getSystemInfo({ // 获取设备信息
  101. success: (res) => {
  102. systeminfo = res
  103. },
  104. })
  105. return systeminfo
  106. },
  107. },
  108. onPageScroll(e){//实时获取到滚动的值
  109. if(e.scrollTop>400){
  110. this.isScrollTop = true
  111. }else{
  112. this.isScrollTop = false
  113. }
  114. },
  115. onPullDownRefresh() {
  116. setTimeout(() => {
  117. uni.stopPullDownRefresh()
  118. }, 200)
  119. },
  120. onShareAppMessage(res){//分享转发
  121. if (res.from === 'button') {
  122. // 来自页面内转发按钮
  123. }
  124. return {
  125. title: '采美-一站式生/医美采购服务平台',
  126. path: `pages/goods/good-floor?type=share&linkId=${this.pageId}`
  127. }
  128. },
  129. onShow() {
  130. }
  131. }
  132. </script>
  133. <style lang="scss">
  134. page{
  135. background-color: #FFFFFF;
  136. }
  137. .container-home{
  138. width: 100%;
  139. height: auto;
  140. }
  141. .container-section{
  142. width: 100%;
  143. height: auto;
  144. background-color: #F7F7F7;
  145. }
  146. </style>