good-floorMore.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. <template>
  2. <view class="container floor clearfix">
  3. <view class="navbar-wrap">
  4. <view class="gosearch-btn" @click="this.$api.navigateTo(clickPath)">
  5. <view class="search-icon"> <text class="iconfont icon-iconfonticonfontsousuo1"></text> </view>
  6. <view class="search-text">{{ hotSearchText }}</view>
  7. </view>
  8. </view>
  9. <tui-skeleton
  10. v-if="skeletonShow"
  11. backgroundColor="#fafafa"
  12. borderRadius="10rpx"
  13. :isLoading="true"
  14. :loadingType="5"
  15. ></tui-skeleton>
  16. <!-- 楼层 -->
  17. <view class="container-section tui-skeleton">
  18. <template v-if="pageData.floorContent.templateType == '1'">
  19. <templateA :pageData="pageData" :userIdentity="userIdentity" v-if="isRequest"></templateA>
  20. </template>
  21. <template v-if="pageData.floorContent.templateType == '2'">
  22. <templateB :pageData="pageData" :userIdentity="userIdentity" v-if="isRequest"></templateB>
  23. </template>
  24. <template v-if="pageData.floorContent.templateType == '3'">
  25. <templateC :pageData="pageData" :userIdentity="userIdentity" v-if="isRequest"></templateC>
  26. </template>
  27. <template v-if="pageData.floorContent.templateType == '4'">
  28. <templateD :pageData="pageData" :userIdentity="userIdentity" v-if="isRequest"></templateD>
  29. </template>
  30. <template v-if="pageData.floorContent.templateType == '5' || pageData.floorContent.templateType == '6'">
  31. <templateE :pageData="pageData" :userIdentity="userIdentity" v-if="isRequest"></templateE>
  32. </template>
  33. <template v-if="pageData.floorContent.templateType == '7'">
  34. <templateF :pageData="pageData" :userIdentity="userIdentity" v-if="isRequest"></templateF>
  35. </template>
  36. </view>
  37. </view>
  38. </template>
  39. <script>
  40. import { mapState, mapMutations } from 'vuex'
  41. import templateA from './components/template-floor/templateA.vue'
  42. import templateB from './components/template-floor/templateB.vue'
  43. import templateC from './components/template-floor/templateC.vue'
  44. import templateD from './components/template-floor/templateD.vue'
  45. import templateE from './components/template-floor/templateE.vue'
  46. import templateF from './components/template-floor/templateF.vue'
  47. export default {
  48. components: {
  49. templateA,
  50. templateB,
  51. templateC,
  52. templateD,
  53. templateE,
  54. templateF
  55. },
  56. data() {
  57. return {
  58. userId: 0,
  59. clickPath: '/pages/search/search',
  60. hotSearchText: '搜索商品/项目仪器',
  61. userIdentity: 0,
  62. skeletonShow: true,
  63. isRequest: false,
  64. navBarsList: [],
  65. pageData: {}, //楼层
  66. floorId: null,
  67. pageType: null
  68. }
  69. },
  70. onLoad(option) {
  71. this.floorId = Number(option.floorId)
  72. uni.setNavigationBarTitle({ title: option.title })
  73. this.initGetStotage(option.pageType)
  74. },
  75. computed: {
  76. ...mapState(['hasLogin', 'userInfo', 'identity'])
  77. },
  78. methods: {
  79. async initGetStotage(pageType) {
  80. // 初始化
  81. const userInfo = await this.$api.getStorage()
  82. this.userId = userInfo.userId ? userInfo.userId : 0
  83. this.shopId = userInfo.shopId ? userInfo.shopId : 0
  84. this.userIdentity = userInfo.userIdentity
  85. this.GetHomeFloorContentDetails(pageType)
  86. },
  87. GetHomeFloorContentDetails(pageType) {
  88. //楼层查看更多
  89. if (pageType == '1') {
  90. this.CommonService.GetHomeFloorContentDetails({ userId: this.userId, floorId: this.floorId, source: 2 })
  91. .then(response => {
  92. this.pageData = response.data
  93. this.skeletonShow = false
  94. this.isRequest = true
  95. })
  96. .catch(error => {
  97. this.$util.msg(error.msg, 2000)
  98. })
  99. } else {
  100. this.CommonService.GePageFloorContentDetails({ userId: this.userId, centreId: this.floorId, source: 2 })
  101. .then(response => {
  102. this.pageData = response.data
  103. this.skeletonShow = false
  104. this.isRequest = true
  105. })
  106. .catch(error => {
  107. this.$util.msg(error.msg, 2000)
  108. })
  109. }
  110. }
  111. },
  112. onPullDownRefresh() {
  113. setTimeout(() => {
  114. this.GetHomeFloorContentDetails(this.pageType)
  115. uni.stopPullDownRefresh()
  116. }, 200)
  117. },
  118. onShow() {}
  119. }
  120. </script>
  121. <style lang="scss">
  122. page {
  123. background-color: #ffffff;
  124. }
  125. .container-home {
  126. width: 100%;
  127. height: auto;
  128. }
  129. .container-section {
  130. width: 100%;
  131. height: auto;
  132. background-color: #f7f7f7;
  133. box-sizing: border-box;
  134. padding: 24rpx;
  135. }
  136. .navbar-wrap {
  137. width: 100%;
  138. height: 116rpx;
  139. box-sizing: border-box;
  140. background: #ffffff;
  141. padding: 25rpx 24rpx;
  142. .gosearch-btn {
  143. width: 100%;
  144. height: 100%;
  145. border-radius: 40rpx;
  146. font-size: 28rpx;
  147. line-height: 66rpx;
  148. color: #8a8a8a;
  149. background: #f7f7f7;
  150. position: relative;
  151. box-sizing: border-box;
  152. padding-left: 66rpx;
  153. .search-icon {
  154. width: 66rpx;
  155. height: 66rpx;
  156. position: absolute;
  157. left: 0;
  158. top: 2rpx;
  159. text-align: center;
  160. line-height: 66rpx;
  161. .icon-iconfonticonfontsousuo1 {
  162. margin: 0 6rpx;
  163. font-size: $font-size-34;
  164. color: #8a8a8a;
  165. z-index: 10;
  166. }
  167. }
  168. .search-text {
  169. font-size: $font-size-24;
  170. line-height: 66rpx;
  171. color: #8a8a8a;
  172. }
  173. }
  174. }
  175. </style>