exhibit.vue 11 KB

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