index.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  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. <disclaimer-text></disclaimer-text>
  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. import DisclaimerText from '@/components/disclaimer-text/index.vue'
  43. export default {
  44. options: {
  45. styleIsolation: 'shared'
  46. },
  47. components: {
  48. NavBar,
  49. USearch,
  50. UScrollView,
  51. UDropdownSelect,
  52. ExhibitorItem,
  53. DisclaimerText
  54. },
  55. data() {
  56. return {
  57. searchCategoryId: '',
  58. searchHall: '',
  59. searchApplicationAreas: '',
  60. searchKeyword: '',
  61. exhibitorsParams: {
  62. page: 1,
  63. page_size: 10,
  64. keyword: '',
  65. country: '',
  66. hall_id: '',
  67. product_cate_id: '',
  68. application_areas_id: ''
  69. },
  70. exhibitorList: [],
  71. exhibitorListLoading: false,
  72. exhibitorListLastPage: 1,
  73. categories: [],
  74. halls: [],
  75. applicationAreass: [],
  76. pollShow: {
  77. exhibitors_poll_show: 0,
  78. product_poll_show: 0
  79. }
  80. }
  81. },
  82. created() {
  83. this.loadFontFace('Poppins')
  84. this.getProductCategoryList()
  85. this.getExhibitorsHallList()
  86. this.getApplicationAreasList()
  87. this.getExhibitorsList()
  88. this.getGlobalPollShow()
  89. },
  90. methods: {
  91. getApplicationAreasList() {
  92. applicationAreasList().then(res => {
  93. let areas = []
  94. res.data.forEach(item => {
  95. areas.push({
  96. label: item.name,
  97. value: item.id,
  98. })
  99. })
  100. this.applicationAreass = areas
  101. })
  102. },
  103. getExhibitorsHallList() {
  104. exhibitorsHallList().then(res => {
  105. let halls = []
  106. res.data.forEach(item => {
  107. halls.push({
  108. label: item.name,
  109. value: item.id,
  110. })
  111. })
  112. this.halls = halls
  113. })
  114. },
  115. getProductCategoryList() {
  116. productCategoryList().then(res => {
  117. let cate = []
  118. res.data.forEach(item => {
  119. let child = []
  120. item.children.forEach(itemC => {
  121. child.push({
  122. label: itemC.name,
  123. value: itemC.id
  124. })
  125. })
  126. cate.push({
  127. label: item.name,
  128. value: item.id,
  129. children: child
  130. })
  131. })
  132. this.categories = cate
  133. })
  134. },
  135. searchExhibitorsList() {
  136. this.exhibitorsParams.application_areas_id = this.searchApplicationAreas || ''
  137. this.exhibitorsParams.product_cate_id = this.searchCategoryId || ''
  138. this.exhibitorsParams.hall_id = this.searchHall || ''
  139. this.exhibitorsParams.page = 1
  140. this.getExhibitorsList()
  141. },
  142. getExhibitorsList() {
  143. if (this.exhibitorListLoading === true) {
  144. return
  145. }
  146. this.exhibitorListLoading = true
  147. exhibitorsList(this.exhibitorsParams).then(res => {
  148. if (res.data.data) {
  149. if (this.exhibitorsParams.page > 1) {
  150. this.exhibitorList = [...this.exhibitorList, ...res.data.data]
  151. } else {
  152. this.exhibitorList = res.data.data
  153. this.exhibitorListLastPage = res.data.last_page
  154. }
  155. } else {
  156. this.showToast('系统繁忙,稍候再试')
  157. }
  158. this.exhibitorListLoading = false
  159. })
  160. },
  161. onScrollToLower(e) {
  162. if (this.exhibitorListLastPage === this.exhibitorsParams.page) {
  163. return
  164. }
  165. this.exhibitorsParams.page = this.exhibitorsParams.page+1
  166. this.getExhibitorsList()
  167. },
  168. onSelectDropdown(index) {
  169. ['select1', 'select2', 'select3'].forEach(v => {
  170. if (v !== 'select' + index) {
  171. this.$refs[v].hideDropdown()
  172. }
  173. })
  174. },
  175. onSearch() {
  176. this.navigateTo('/pages/index/search?query=' + this.searchKeyword)
  177. },
  178. getGlobalPollShow() {
  179. globalPollShow().then(res => {
  180. this.pollShow = res.data
  181. })
  182. }
  183. }
  184. }
  185. </script>
  186. <style lang="scss">
  187. </style>