index.vue 5.8 KB

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