index.vue 5.4 KB

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