index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392
  1. <template>
  2. <page-layout class="exhibitor-index">
  3. <nav-bar title="展商信息" @init="onInitNavbar"></nav-bar>
  4. <u-scroll-view :tabbar-conflict="true">
  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"
  10. @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"
  15. @dropdown="onSelectDropdown(2)" @change="searchExhibitorsList()" />
  16. </view>
  17. <view>
  18. <view class="exhibitor-filter-label">应用领域</view>
  19. <u-dropdown-select ref="select3" v-model="searchApplicationAreas" placeholder="选择应用领域"
  20. :options="applicationAreass" @dropdown="onSelectDropdown(3)" @change="searchExhibitorsList()" />
  21. </view>
  22. </view> -->
  23. <view class="search-box">
  24. <view class="search-title item-title">
  25. 搜索
  26. </view>
  27. <u-search v-model="searchKeyword" placeholder="搜索展商 / 展品名称 / 会议" @search="onSearch" />
  28. </view>
  29. <view class="select-box">
  30. <view class="select-title item-title">
  31. 筛选
  32. </view>
  33. <view class="select-list">
  34. <u-select title="展馆号" v-model="searchHall" :data="halls" uId="dropdown1"
  35. @change-event="searchExhibitorsList()"></u-select>
  36. <u-select title="展品分类" v-model="searchCategoryId" :data="categories" uId="dropdown2" :children="true"
  37. @change-event="searchExhibitorsList()"></u-select>
  38. <u-select title="应用领域" v-model="searchApplicationAreas" :data="applicationAreass" uId="dropdown3"
  39. @change-event="searchExhibitorsList()"></u-select>
  40. </view>
  41. <view class="select-search-btn" @click="searchExhibitorsList()">搜索</view>
  42. </view>
  43. <view class="ad-space" @tap="navigateToAdLink(adInfo.ad_link)">
  44. <image :src="adInfo.ad_file" />
  45. </view>
  46. <van-empty v-if="exhibitorList.length === 0" description="暂无数据" />
  47. <view v-else class="exhibitor-list">
  48. <template v-for="(item, index) in exhibitorList">
  49. <exhibitor-item :item="item" :key="index" :pollShow="pollShow.exhibitors_poll_show"
  50. @share="(e) => $emit('share', e)" @updateItemValue="updateItemValue()" />
  51. </template>
  52. </view>
  53. <u-pagination :pageSize="exhibitorsParams.page_size" :total="total"
  54. @page-change="handlePageChange()" v-if="total>0"></u-pagination>
  55. <disclaimer-text></disclaimer-text>
  56. </view>
  57. </u-scroll-view>
  58. <contact-us :show.sync="showContactUs" :qrcode_url="q_url" />
  59. <float-button @custom-event="updateContactStatus()"></float-button>
  60. </page-layout></template>
  61. <script>
  62. import NavBar from '@/components/layout/nav-bar'
  63. import USelect from '@/components/common/u-select/index.vue'
  64. import UScrollView from '@/components/common/u-scroll-view'
  65. import USearch from '@/components/common/u-search'
  66. import UPagination from '@/components/common/u-pagination/index.vue'
  67. import UDropdownSelect from '@/components/common/u-dropdown-select'
  68. import ExhibitorItem from '@/pages/exhibitor/components/exhibitor-item.vue'
  69. import floatButton from "@/components/layout/float-button"
  70. import ContactUs from '@/pages/index/components/contact-us.vue'
  71. import {
  72. exhibitorsList,
  73. productCategoryList,
  74. exhibitorsHallList,
  75. applicationAreasList,
  76. globalPollShow
  77. } from '@/api/exhibitor'
  78. import {
  79. getAdInfo
  80. } from '@/api'
  81. import DisclaimerText from '@/components/disclaimer-text/index.vue'
  82. import PageLayout from "@/components/layout/page-layout";
  83. export default {
  84. options: {
  85. styleIsolation: 'shared'
  86. },
  87. components: {
  88. PageLayout,
  89. NavBar,
  90. USearch,
  91. UScrollView,
  92. UDropdownSelect,
  93. ExhibitorItem,
  94. DisclaimerText,
  95. UPagination,
  96. USelect,
  97. floatButton,
  98. ContactUs
  99. },
  100. data() {
  101. return {
  102. searchCategoryId: '',
  103. searchHall: '',
  104. searchApplicationAreas: '',
  105. searchKeyword: '',
  106. exhibitorsParams: {
  107. page: 1,
  108. page_size: 20,
  109. keyword: '',
  110. country: '',
  111. hall_id: '',
  112. product_cate_id: '',
  113. application_areas_id: ''
  114. },
  115. exhibitorList: [],
  116. exhibitorListLoading: false,
  117. exhibitorListLastPage: 1,
  118. categories: [],
  119. halls: [],
  120. applicationAreass: [],
  121. pollShow: {
  122. exhibitors_poll_show: 0,
  123. product_poll_show: 0
  124. },
  125. total: 0,
  126. baseUrl: 'https://mp-test-onlinecatelogue.matchexpo.cn',
  127. showContactUs: false,
  128. q_url: '',
  129. adInfo: {
  130. ad_file: 'https://oss.starify.cn/prod/starify/up/0001018678/20241108/672da70a6c76a.png?x-oss-process=image/resize,w_200'
  131. }
  132. }
  133. },
  134. created() {
  135. this.loadFontFace('Poppins')
  136. this.getProductCategoryList()
  137. this.getExhibitorsHallList()
  138. this.getApplicationAreasList()
  139. this.getExhibitorsList()
  140. this.getGlobalPollShow()
  141. this.getAdData()
  142. },
  143. methods: {
  144. getApplicationAreasList() {
  145. applicationAreasList().then(res => {
  146. let areas = []
  147. res.data.forEach(item => {
  148. areas.push({
  149. label: item.name,
  150. value: item.id,
  151. })
  152. })
  153. this.applicationAreass = areas
  154. })
  155. },
  156. getExhibitorsHallList() {
  157. exhibitorsHallList().then(res => {
  158. let halls = []
  159. res.data.forEach(item => {
  160. halls.push({
  161. label: item.name,
  162. value: item.id,
  163. })
  164. })
  165. this.halls = halls
  166. })
  167. },
  168. getProductCategoryList() {
  169. productCategoryList().then(res => {
  170. let cate = []
  171. res.data.forEach(item => {
  172. let child = []
  173. item.children.forEach(itemC => {
  174. child.push({
  175. label: itemC.name,
  176. value: itemC.id
  177. })
  178. })
  179. cate.push({
  180. label: item.name,
  181. value: item.id,
  182. children: child
  183. })
  184. })
  185. this.categories = cate
  186. })
  187. },
  188. searchExhibitorsList() {
  189. let hall_ids = ''
  190. let product_cate_ids = ''
  191. let application_areas_ids = ''
  192. if (this.searchHall.length === 0) {
  193. hall_ids = 'hall='
  194. } else {
  195. for (let i = 0; i < this.searchHall.length; i++) {
  196. if (i === this.searchHall.length - 1) {
  197. hall_ids = hall_ids + 'hall[]=' + this.searchHall[i]
  198. } else {
  199. hall_ids = hall_ids + 'hall[]=' + this.searchHall[i] + '&'
  200. }
  201. }
  202. }
  203. if (this.searchCategoryId.length === 0) {
  204. product_cate_ids = 'product_cate_id='
  205. } else {
  206. for (let i = 0; i < this.searchCategoryId.length; i++) {
  207. if (i === this.searchCategoryId.length - 1) {
  208. product_cate_ids = product_cate_ids + 'product_cate_id[]=' + this.searchCategoryId[i]
  209. } else {
  210. product_cate_ids = product_cate_ids + 'product_cate_id[]=' + this.searchCategoryId[i] + '&'
  211. }
  212. }
  213. }
  214. if (this.searchApplicationAreas.length === 0) {
  215. application_areas_ids = 'application_areas_id='
  216. } else {
  217. for (let i = 0; i < this.searchApplicationAreas.length; i++) {
  218. if (i === this.searchApplicationAreas.length - 1) {
  219. application_areas_ids = application_areas_ids + 'application_areas_id[]=' + this.searchApplicationAreas[i]
  220. } else {
  221. application_areas_ids = application_areas_ids + 'application_areas_id[]=' + this.searchApplicationAreas[
  222. i] + '&'
  223. }
  224. }
  225. }
  226. let url = this.baseUrl + '/api/exhibitors/list?page=1&page_size=20&keyword=&country=&' + hall_ids + '&' +
  227. product_cate_ids + '&' + application_areas_ids
  228. uni.request({
  229. url: url,
  230. method: 'GET',
  231. success: (res) => {
  232. // 处理返回的数据
  233. this.exhibitorList = res.data.data
  234. this.total = res.data.total
  235. this.exhibitorListLastPage = res.data.last_page
  236. },
  237. fail: (err) => {
  238. console.error('请求失败', err);
  239. }
  240. });
  241. },
  242. getExhibitorsList() {
  243. exhibitorsList(this.exhibitorsParams).then(res => {
  244. if (res.data.data) {
  245. this.exhibitorList = res.data.data
  246. this.total = res.data.total
  247. this.exhibitorListLastPage = res.data.last_page
  248. } else {
  249. this.showToast('系统繁忙,稍候再试')
  250. }
  251. this.exhibitorListLoading = false
  252. })
  253. },
  254. // onScrollToLower(e) {
  255. // if (this.exhibitorListLastPage === this.exhibitorsParams.page) {
  256. // return
  257. // }
  258. // if (this.exhibitorListLoading === true) {
  259. // return
  260. // }
  261. // this.exhibitorListLoading = true
  262. // this.exhibitorsParams.page = this.exhibitorsParams.page + 1
  263. // this.getExhibitorsList()
  264. // },
  265. onSelectDropdown(index) {
  266. ['select1', 'select2', 'select3'].forEach(v => {
  267. if (v !== 'select' + index) {
  268. this.$refs[v].hideDropdown()
  269. }
  270. })
  271. },
  272. onSearch() {
  273. this.navigateTo('/pages/index/search?query=' + this.searchKeyword)
  274. },
  275. getGlobalPollShow() {
  276. globalPollShow().then(res => {
  277. this.pollShow = res.data
  278. })
  279. },
  280. updateItemValue(e) {
  281. this.exhibitorList.forEach((item) => {
  282. if (item.id === e.id) {
  283. item[e.key] = e.value
  284. }
  285. })
  286. },
  287. handlePageChange(page) {
  288. this.exhibitorsParams.page = page
  289. exhibitorsList(this.exhibitorsParams).then(res => {
  290. if (res.data.data) {
  291. this.exhibitorList = res.data.data
  292. } else {
  293. this.showToast('系统繁忙,稍候再试')
  294. }
  295. this.exhibitorListLoading = false
  296. })
  297. },
  298. updateContactStatus(data) {
  299. this.showContactUs = data.showContactUs
  300. this.q_url = data.q_url
  301. },
  302. navigateToAdLink(href) {
  303. this.navigateTo(href)
  304. },
  305. getAdData() {
  306. getAdInfo({
  307. number: "ExhibitorListTop001"
  308. }).then(res => {
  309. this.adInfo = res.data[0]
  310. })
  311. }
  312. }
  313. }
  314. </script>
  315. <style lang="scss">
  316. checkbox {
  317. .wx-checkbox-input {
  318. width: 20rpx;
  319. height: 20rpx;
  320. &.wx-checkbox-input-checked {
  321. background-color: #E57519;
  322. &::before {
  323. content: '';
  324. }
  325. }
  326. }
  327. &.open {
  328. color: #E57519;
  329. background-color: #FDF4EB;
  330. }
  331. }
  332. .exhibitor-index {
  333. .item-title {
  334. font-size: $fontSize3;
  335. font-weight: bold;
  336. &.select-title {
  337. color: #E57519;
  338. }
  339. }
  340. .select-box {
  341. display: flex;
  342. flex-direction: column;
  343. background-color: #FFFFFF;
  344. border-radius: 21rpx;
  345. border: 2rpx dashed #94A3B8;
  346. padding: 34rpx 30rpx 54rpx 30rpx;
  347. margin-bottom: 42rpx;
  348. .select-title {
  349. margin-bottom: 30rpx;
  350. }
  351. .select-list {
  352. display: flex;
  353. flex-direction: column;
  354. grid-gap: 30rpx;
  355. margin-bottom: 30rpx;
  356. }
  357. .select-search-btn {
  358. padding: 18rpx 25rpx;
  359. border: 1rpx solid #E57519;
  360. background-color: #E57519;
  361. font-size: $fontSize2;
  362. width: 100%;
  363. color: #FFFFFF;
  364. display: flex;
  365. justify-content: center;
  366. align-items: center;
  367. border-radius: 13rpx;
  368. grid-gap: 20rpx;
  369. font-weight: bold;
  370. &::before {
  371. content: '\e86f';
  372. font-size: $fontSize3;
  373. font-family: iconfont;
  374. font-weight: bold;
  375. }
  376. }
  377. }
  378. } </style>