exhibit.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457
  1. <template>
  2. <page-layout class="exhibit-index exhibitor-index">
  3. <nav-bar title="展品信息" @init="onInitNavbar"></nav-bar>
  4. <u-scroll-view>
  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="categoryId" placeholder="选择展馆号" :options="categories" @dropdown="onSelectDropdown(1)" @change="searchList()"/>
  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="searchList()" />
  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="searchList()"/>
  18. </view>
  19. </view> -->
  20. <u-search v-model="searchKeyword" placeholder="搜索展商 / 展品名称 / 会议" @search="onSearch" />
  21. <view class="select-box">
  22. <view class="select-title item-title">
  23. 筛选
  24. </view>
  25. <view class="select-list">
  26. <van-collapse :value="activeName" @change="onChange">
  27. <van-collapse-item class="first-title" title="展品分类" name="展品分类">
  28. <!-- <view v-for="(item, index) in categories" :key="index">
  29. {{item.label}}
  30. </view>-->
  31. <u-select title="展品分类" v-model="searchCategoryId" :data="categories" uId="dropdown2" :children="true"
  32. @change-event="searchList()"></u-select>
  33. </van-collapse-item>
  34. <van-collapse-item class="first-title" title="应用领域" name="应用领域">
  35. <!-- <view v-for="(item, index) in applicationAreass" :key="index">
  36. {{item.label}}
  37. </view>-->
  38. <u-select title="应用领域" v-model="searchApplicationAreas" :data="applicationAreass" uId="dropdown3"
  39. @change-event="searchList()"></u-select>
  40. </van-collapse-item>
  41. </van-collapse>
  42. </view>
  43. <view class="select-search-btn" @click="searchList()">搜索</view>
  44. </view>
  45. <view class="ad-space" @tap="navigateToAdLink(adInfo.ad_link)">
  46. <image :src="adInfo.ad_file" mode="widthFix" />
  47. </view>
  48. <van-empty v-if="exhibitList.length === 0" description="暂无数据" />
  49. <view v-else class="exhibit-list exhibitor-list">
  50. <template v-for="(item, index) in exhibitList">
  51. <exhibit-item :item="item" :key="index" :pollShow="pollShow.product_poll_show" @share="onShare"
  52. @updateItemValue="updateItemValue()" />
  53. </template>
  54. </view>
  55. <u-pagination :pageSize="exhibitParams.page_size" :total="total" @page-change="handlePageChange()"
  56. v-if="total>0"></u-pagination>
  57. <disclaimer-text></disclaimer-text>
  58. </view>
  59. </u-scroll-view>
  60. <float-button></float-button>
  61. <van-dialog id="van-dialog" />
  62. <u-share-action-sheet :show.sync="showShare" :show-info="shareInfo" />
  63. </page-layout>
  64. </template>
  65. <script>
  66. import NavBar from '@/components/layout/nav-bar'
  67. import USelect from '@/components/common/u-select/index.vue'
  68. import UScrollView from '@/components/common/u-scroll-view'
  69. import UShareActionSheet from '@/components/common/u-share-action-sheet'
  70. import USearch from '@/components/common/u-search'
  71. import UDropdownSelect from '@/components/common/u-dropdown-select'
  72. import UPagination from '@/components/common/u-pagination/index.vue'
  73. import ExhibitItem from '@/pages/exhibitor/components/exhibit-item.vue'
  74. import floatButton from "@/components/layout/float-button"
  75. import {
  76. exhibitorsProductList,
  77. productCategoryList,
  78. applicationAreasList,
  79. globalPollShow
  80. } from '@/api/exhibitor'
  81. import {
  82. getAdInfo
  83. } from '@/api'
  84. import DisclaimerText from '@/components/disclaimer-text/index.vue'
  85. import PageLayout from "@/components/layout/page-layout";
  86. import vanCollapse from '@/wxcomponents/vant/collapse/index'
  87. import vanCollapseItem from '@/wxcomponents/vant/collapse-item/index'
  88. export default {
  89. options: {
  90. // styleIsolation: 'shared'
  91. },
  92. components: {
  93. PageLayout,
  94. NavBar,
  95. UScrollView,
  96. USearch,
  97. UDropdownSelect,
  98. UShareActionSheet,
  99. ExhibitItem,
  100. DisclaimerText,
  101. USelect,
  102. UPagination,
  103. floatButton,
  104. vanCollapse,
  105. vanCollapseItem
  106. },
  107. computed: {},
  108. data() {
  109. return {
  110. activeName: '',
  111. searchCategoryId: '',
  112. searchApplicationAreas: '',
  113. scrollviewHeight: 0,
  114. searchKeyword: '',
  115. exhibitParams: {
  116. page: 1,
  117. page_size: 10,
  118. keyword: '',
  119. product_cate_id: '',
  120. application_areas_id: ''
  121. },
  122. exhibitList: [],
  123. exhibitListLoading: false,
  124. exhibitListLastPage: 1,
  125. shareInfo: null,
  126. showShare: false,
  127. categories: [],
  128. applicationAreass: [],
  129. pollShow: {
  130. exhibitors_poll_show: 0,
  131. product_poll_show: 0
  132. },
  133. total: 0,
  134. baseUrl: 'https://mp-test-onlinecatelogue.matchexpo.cn',
  135. adInfo: {
  136. ad_file: 'https://oss.starify.cn/prod/starify/up/0001018678/20241108/672da70a6c76a.png?x-oss-process=image/resize,w_200'
  137. }
  138. }
  139. },
  140. created() {
  141. this.loadFontFace('Poppins')
  142. this.getProductCategoryList()
  143. this.getApplicationAreasList()
  144. this.getList()
  145. this.getGlobalPollShow(),
  146. this.getAdData()
  147. },
  148. methods: {
  149. onChange(event) {
  150. this.activeName = event
  151. },
  152. handlePageChange(page) {
  153. this.exhibitParams.page = page
  154. exhibitorsProductList(this.exhibitParams).then(res => {
  155. if (res.data.data) {
  156. this.exhibitList = res.data.data
  157. } else {
  158. this.showToast('系统繁忙,稍候再试')
  159. }
  160. })
  161. },
  162. getApplicationAreasList() {
  163. applicationAreasList().then(res => {
  164. let areas = []
  165. res.data.forEach(item => {
  166. areas.push({
  167. label: item.name,
  168. value: item.id,
  169. })
  170. })
  171. this.applicationAreass = areas
  172. })
  173. },
  174. getProductCategoryList() {
  175. productCategoryList().then(res => {
  176. let cate = []
  177. res.data.forEach(item => {
  178. let child = []
  179. item.children.forEach(itemC => {
  180. child.push({
  181. label: itemC.name,
  182. value: itemC.id
  183. })
  184. })
  185. cate.push({
  186. label: item.name,
  187. value: item.id,
  188. children: child
  189. })
  190. })
  191. this.categories = cate
  192. })
  193. },
  194. searchList() {
  195. this.showLoading()
  196. let product_cate_ids = ''
  197. let application_areas_ids = ''
  198. if (this.searchCategoryId.length === 0) {
  199. product_cate_ids = 'product_cate_id='
  200. } else {
  201. for (let i = 0; i < this.searchCategoryId.length; i++) {
  202. if (i === this.searchCategoryId.length - 1) {
  203. product_cate_ids = product_cate_ids + 'product_cate_id[]=' + this.searchCategoryId[i]
  204. } else {
  205. product_cate_ids = product_cate_ids + 'product_cate_id[]=' + this.searchCategoryId[i] + '&'
  206. }
  207. }
  208. }
  209. if (this.searchApplicationAreas.length === 0) {
  210. application_areas_ids = 'application_areas_id='
  211. } else {
  212. for (let i = 0; i < this.searchApplicationAreas.length; i++) {
  213. if (i === this.searchApplicationAreas.length - 1) {
  214. application_areas_ids = application_areas_ids + 'application_areas_id[]=' + this.searchApplicationAreas[i]
  215. } else {
  216. application_areas_ids = application_areas_ids + 'application_areas_id[]=' + this.searchApplicationAreas[
  217. i] + '&'
  218. }
  219. }
  220. }
  221. let url = this.baseUrl + '/api/exhibitors/product/list?page=1&page_size=10&keyword=&' + product_cate_ids + '&' +
  222. application_areas_ids
  223. uni.request({
  224. url: url,
  225. method: 'GET',
  226. success: (res) => {
  227. // 处理返回的数据
  228. this.exhibitList = res.data.data
  229. this.total = res.data.total
  230. this.exhibitListLastPage = res.data.last_page
  231. this.hideLoading()
  232. },
  233. fail: (err) => {
  234. console.error('请求失败', err);
  235. }
  236. });
  237. },
  238. getList() {
  239. this.showLoading()
  240. exhibitorsProductList(this.exhibitParams).then(res => {
  241. if (res.data.data) {
  242. this.exhibitList = res.data.data
  243. this.total = res.data.total
  244. this.exhibitListLastPage = res.data.last_page
  245. } else {
  246. this.showToast('系统繁忙,稍候再试')
  247. }
  248. this.exhibitListLoading = false
  249. this.hideLoading()
  250. })
  251. },
  252. // onScrollToLower(e) {
  253. // if (this.exhibitListLastPage === this.exhibitParams.page) {
  254. // return
  255. // }
  256. // if (this.exhibitListLoading === true) {
  257. // return
  258. // }
  259. // this.exhibitListLoading = true
  260. // this.exhibitParams.page = this.exhibitParams.page+1
  261. // this.getList()
  262. // },
  263. onShare(e) {
  264. this.shareInfo = e.detail
  265. this.showShare = true
  266. },
  267. onShareAppMessage: function(res) {
  268. if (res.from === 'button') {
  269. if (this.shareInfo) {
  270. return this.shareInfo
  271. }
  272. }
  273. this.shareInfo = null
  274. this.showShare = false
  275. return {
  276. title: '慕尼黑上海电子生产设备展',
  277. path: '/pages/index/index',
  278. imageUrl: 'https://oss.starify.cn/prod/starify/up/0001018678/20241108/672da5a7dd374.png?x-oss-process=image/resize,w_600,h_600,limit_0,m_pad'
  279. }
  280. },
  281. onSelectDropdown(index) {
  282. ['select1', 'select2', 'select3'].forEach(v => {
  283. if (v !== 'select' + index) {
  284. this.$refs[v].hideDropdown()
  285. }
  286. })
  287. },
  288. onClickExhibit(item) {
  289. this.navigateTo('/pages/exhibitor/exhibit-detail')
  290. },
  291. onSearch() {
  292. this.navigateTo('/pages/index/search?query=' + this.searchKeyword)
  293. },
  294. getGlobalPollShow() {
  295. globalPollShow().then(res => {
  296. this.pollShow = res.data
  297. console.log(this.pollShow);
  298. })
  299. },
  300. updateItemValue(e) {
  301. this.exhibitList.forEach((item) => {
  302. if (item.id === e.id) {
  303. item[e.key] = e.value
  304. }
  305. })
  306. },
  307. navigateToAdLink(href) {
  308. this.navigateTo(href)
  309. },
  310. getAdData() {
  311. getAdInfo({
  312. number: "ExhibitorProductTop001"
  313. }).then(res => {
  314. this.adInfo = res.data[0]
  315. })
  316. }
  317. }
  318. }
  319. </script>
  320. <style lang="scss">
  321. checkbox {
  322. color: #333333;
  323. .wx-checkbox-input {
  324. width: 26rpx;
  325. height: 26rpx;
  326. &.wx-checkbox-input-checked {
  327. background-color: #E57519;
  328. &::before {
  329. content: '';
  330. }
  331. }
  332. }
  333. &.open {
  334. color: #E57519;
  335. background-color: #FDF4EB;
  336. }
  337. }
  338. .select-box {
  339. display: flex;
  340. flex-direction: column;
  341. background-color: #FFFFFF;
  342. border-radius: 21rpx;
  343. border: 2rpx dashed #94A3B8;
  344. padding: 34rpx 30rpx 54rpx 30rpx;
  345. margin-bottom: 42rpx;
  346. .select-title {
  347. margin-bottom: 30rpx;
  348. }
  349. .select-list {
  350. margin-bottom: 30rpx;
  351. .van-collapse {
  352. display: flex;
  353. flex-direction: column;
  354. grid-gap: 30rpx;
  355. .first-title {
  356. &>.van-collapse-item {
  357. border-radius: 14rpx;
  358. border: 2rpx solid #B3B3B3;
  359. overflow: hidden;
  360. .van-collapse-item__content {
  361. padding: unset;
  362. }
  363. van-collapse {
  364. .van-collapse-item {
  365. border-bottom: 2rpx solid #e3e9f1;
  366. .van-cell {
  367. grid-gap: 16rpx;
  368. width: 100%;
  369. .van-cell__title {
  370. flex: unset;
  371. width: fit-content;
  372. }
  373. .van-cell__right-icon-wrap {
  374. font-size: $fontSize0;
  375. .van-icon-arrow {
  376. color: #333333;
  377. &::before {
  378. content: '\e819';
  379. font-family: iconfont;
  380. }
  381. }
  382. }
  383. }
  384. .van-collapse-item__wrapper {
  385. .custom-checkbox {
  386. checkbox {
  387. border: unset;
  388. }
  389. }
  390. }
  391. }
  392. &:nth-last-child(1) {
  393. .van-collapse-item {
  394. border: unset;
  395. }
  396. }
  397. }
  398. }
  399. .van-cell {
  400. padding: 16rpx 20rpx;
  401. &::after {
  402. border-bottom: unset;
  403. }
  404. }
  405. }
  406. }
  407. .van-hairline--top-bottom {
  408. &::after {
  409. border: unset;
  410. }
  411. }
  412. }
  413. .select-search-btn {
  414. padding: 18rpx 25rpx;
  415. border: 1rpx solid #E57519;
  416. background-color: #E57519;
  417. font-size: $fontSize3;
  418. width: 100%;
  419. color: #FFFFFF;
  420. display: flex;
  421. justify-content: center;
  422. align-items: center;
  423. border-radius: 13rpx;
  424. grid-gap: 20rpx;
  425. font-weight: bold;
  426. &::before {
  427. content: '\e86f';
  428. font-size: $fontSize3;
  429. font-family: iconfont;
  430. font-weight: bold;
  431. }
  432. }
  433. }
  434. </style>