index.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  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" @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 } 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: '',
  65. product_cate_id: '',
  66. application_areas_id: ''
  67. },
  68. exhibitorList: [],
  69. exhibitorListLoading: false,
  70. exhibitorListLastPage: 1,
  71. categories: [],
  72. halls: [],
  73. applicationAreass: []
  74. }
  75. },
  76. created() {
  77. this.loadFontFace('Poppins')
  78. this.getProductCategoryList()
  79. this.getExhibitorsHallList()
  80. this.getApplicationAreasList()
  81. this.getExhibitorsList()
  82. },
  83. methods: {
  84. getApplicationAreasList() {
  85. applicationAreasList().then(res => {
  86. let areas = []
  87. res.data.forEach(item => {
  88. areas.push({
  89. label: item.name,
  90. value: item.id,
  91. })
  92. })
  93. this.applicationAreass = areas
  94. })
  95. },
  96. getExhibitorsHallList() {
  97. exhibitorsHallList().then(res => {
  98. let halls = []
  99. res.data.forEach(item => {
  100. halls.push({
  101. label: item.name,
  102. value: item.id,
  103. })
  104. })
  105. this.halls = halls
  106. })
  107. },
  108. getProductCategoryList() {
  109. productCategoryList().then(res => {
  110. let cate = []
  111. res.data.forEach(item => {
  112. let child = []
  113. item.children.forEach(itemC => {
  114. child.push({
  115. label: itemC.name,
  116. value: itemC.id
  117. })
  118. })
  119. cate.push({
  120. label: item.name,
  121. value: item.id,
  122. children: child
  123. })
  124. })
  125. this.categories = cate
  126. })
  127. },
  128. searchExhibitorsList() {
  129. this.exhibitorsParams.application_areas_id = this.searchApplicationAreas || ''
  130. this.exhibitorsParams.product_cate_id = this.searchCategoryId || ''
  131. this.exhibitorsParams.hall = this.searchHall || ''
  132. this.exhibitorsParams.page = 1
  133. this.getExhibitorsList()
  134. },
  135. getExhibitorsList() {
  136. if (this.exhibitorListLoading === true) {
  137. return
  138. }
  139. this.exhibitorListLoading = true
  140. exhibitorsList(this.exhibitorsParams).then(res => {
  141. if (res.data.data) {
  142. if (this.exhibitorsParams.page > 1) {
  143. this.exhibitorList = [...this.exhibitorList, ...res.data.data]
  144. } else {
  145. this.exhibitorList = res.data.data
  146. this.exhibitorListLastPage = res.data.last_page
  147. }
  148. } else {
  149. this.showToast('系统繁忙,稍候再试')
  150. }
  151. this.exhibitorListLoading = false
  152. })
  153. },
  154. onScrollToLower(e) {
  155. if (this.exhibitorListLastPage === this.exhibitorsParams.page) {
  156. return
  157. }
  158. this.exhibitorsParams.page = this.exhibitorsParams.page+1
  159. this.getExhibitorsList()
  160. },
  161. onSelectDropdown(index) {
  162. ['select1', 'select2', 'select3'].forEach(v => {
  163. if (v !== 'select' + index) {
  164. this.$refs[v].hideDropdown()
  165. }
  166. })
  167. },
  168. onSearch() {
  169. this.navigateTo('/pages/index/search?query=' + this.searchKeyword)
  170. }
  171. }
  172. }
  173. </script>
  174. <style lang="scss">
  175. </style>