index.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. <template>
  2. <view class="exhibitor-index">
  3. <nav-bar title="展商信息" @init="onInitNavbar"></nav-bar>
  4. <u-scroll-view :tabbar-conflict="true" @scroll-near-lower="onScrollToLower">
  5. <view class="main-container">
  6. <view>{{ categoryId }}</view>
  7. <view class="exhibitor-filter">
  8. <view>
  9. <view class="exhibitor-filter-label">展馆号</view>
  10. <u-dropdown-select ref="select1" v-model="searchHall" placeholder="选择展馆号" :options="halls" @dropdown="onSelectDropdown(1)" @change="searchExhibitorsList()"/>
  11. </view>
  12. <view>
  13. <view class="exhibitor-filter-label">产品类别</view>
  14. <u-dropdown-select ref="select2" v-model="searchCategoryId" placeholder="选择产品类别" :options="categories" @dropdown="onSelectDropdown(2)" @change="searchExhibitorsList()"/>
  15. </view>
  16. <view>
  17. <view class="exhibitor-filter-label">应用领域</view>
  18. <u-dropdown-select ref="select3" v-model="searchApplicationAreas" placeholder="选择应用领域" :options="applicationAreass" @dropdown="onSelectDropdown(3)" @change="searchExhibitorsList()"/>
  19. </view>
  20. </view>
  21. <u-search v-model="searchKeyword" placeholder="搜索展商 / 展品名称 / 会议" @search="onSearch" />
  22. <view class="ad-space">
  23. <image src="https://oss.starify.cn/prod/starify/up/0001018678/20241108/672da70a6c76a.png?x-oss-process=image/resize,w_200" mode="aspectFill"/>
  24. </view>
  25. <van-empty v-if="exhibitorList.length === 0" description="暂无数据" />
  26. <view v-else class="exhibitor-list">
  27. <template v-for="(item, index) in exhibitorList">
  28. <exhibitor-item :item="item" :key="index" :pollShow="pollShow.exhibitors_poll_show" @share="(e) => $emit('share', e)" />
  29. </template>
  30. </view>
  31. </view>
  32. </u-scroll-view>
  33. </view>
  34. </template>
  35. <script>
  36. import NavBar from '@/components/layout/nav-bar'
  37. import UScrollView from '@/components/common/u-scroll-view'
  38. import USearch from '@/components/common/u-search'
  39. import UDropdownSelect from '@/components/common/u-dropdown-select'
  40. import ExhibitorItem from '@/pages/exhibitor/components/exhibitor-item.vue'
  41. import { exhibitorsList, productCategoryList, exhibitorsHallList, applicationAreasList, globalPollShow } from '@/api/exhibitor'
  42. export default {
  43. options: {
  44. styleIsolation: 'shared'
  45. },
  46. components: {
  47. NavBar,
  48. USearch,
  49. UScrollView,
  50. UDropdownSelect,
  51. ExhibitorItem
  52. },
  53. data() {
  54. return {
  55. searchCategoryId: '',
  56. searchHall: '',
  57. searchApplicationAreas: '',
  58. searchKeyword: '',
  59. exhibitorsParams: {
  60. page: 1,
  61. page_size: 10,
  62. keyword: '',
  63. country: '',
  64. hall_id: '',
  65. product_cate_id: '',
  66. application_areas_id: ''
  67. },
  68. exhibitorList: [],
  69. exhibitorListLoading: false,
  70. exhibitorListLastPage: 1,
  71. categories: [],
  72. halls: [],
  73. applicationAreass: [],
  74. pollShow: {
  75. exhibitors_poll_show: 0,
  76. product_poll_show: 0
  77. }
  78. }
  79. },
  80. created() {
  81. this.loadFontFace('Poppins')
  82. this.getProductCategoryList()
  83. this.getExhibitorsHallList()
  84. this.getApplicationAreasList()
  85. this.getExhibitorsList()
  86. this.getGlobalPollShow()
  87. },
  88. methods: {
  89. getApplicationAreasList() {
  90. applicationAreasList().then(res => {
  91. let areas = []
  92. res.data.forEach(item => {
  93. areas.push({
  94. label: item.name,
  95. value: item.id,
  96. })
  97. })
  98. this.applicationAreass = areas
  99. })
  100. },
  101. getExhibitorsHallList() {
  102. exhibitorsHallList().then(res => {
  103. let halls = []
  104. res.data.forEach(item => {
  105. halls.push({
  106. label: item.name,
  107. value: item.id,
  108. })
  109. })
  110. this.halls = halls
  111. })
  112. },
  113. getProductCategoryList() {
  114. productCategoryList().then(res => {
  115. let cate = []
  116. res.data.forEach(item => {
  117. let child = []
  118. item.children.forEach(itemC => {
  119. child.push({
  120. label: itemC.name,
  121. value: itemC.id
  122. })
  123. })
  124. cate.push({
  125. label: item.name,
  126. value: item.id,
  127. children: child
  128. })
  129. })
  130. this.categories = cate
  131. })
  132. },
  133. searchExhibitorsList() {
  134. this.exhibitorsParams.application_areas_id = this.searchApplicationAreas || ''
  135. this.exhibitorsParams.product_cate_id = this.searchCategoryId || ''
  136. this.exhibitorsParams.hall_id = this.searchHall || ''
  137. this.exhibitorsParams.page = 1
  138. this.getExhibitorsList()
  139. },
  140. getExhibitorsList() {
  141. if (this.exhibitorListLoading === true) {
  142. return
  143. }
  144. this.exhibitorListLoading = true
  145. exhibitorsList(this.exhibitorsParams).then(res => {
  146. if (res.data.data) {
  147. if (this.exhibitorsParams.page > 1) {
  148. this.exhibitorList = [...this.exhibitorList, ...res.data.data]
  149. } else {
  150. this.exhibitorList = res.data.data
  151. this.exhibitorListLastPage = res.data.last_page
  152. }
  153. } else {
  154. this.showToast('系统繁忙,稍候再试')
  155. }
  156. this.exhibitorListLoading = false
  157. })
  158. },
  159. onScrollToLower(e) {
  160. if (this.exhibitorListLastPage === this.exhibitorsParams.page) {
  161. return
  162. }
  163. this.exhibitorsParams.page = this.exhibitorsParams.page+1
  164. this.getExhibitorsList()
  165. },
  166. onSelectDropdown(index) {
  167. ['select1', 'select2', 'select3'].forEach(v => {
  168. if (v !== 'select' + index) {
  169. this.$refs[v].hideDropdown()
  170. }
  171. })
  172. },
  173. onSearch() {
  174. this.navigateTo('/pages/index/search?query=' + this.searchKeyword)
  175. },
  176. getGlobalPollShow() {
  177. globalPollShow().then(res => {
  178. this.pollShow = res.data
  179. })
  180. }
  181. }
  182. }
  183. </script>
  184. <style lang="scss">
  185. </style>