exhibit.vue 10 KB

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