exhibit.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. <template>
  2. <view class="exhibit-index exhibitor-index">
  3. <nav-bar title="展品信息" @init="onInitNavbar"></nav-bar>
  4. <u-scroll-view @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="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="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="exhibitList.length === 0" description="暂无数据" />
  25. <view v-else class="exhibit-list exhibitor-list">
  26. <template v-for="(item, index) in exhibitList">
  27. <exhibit-item :item="item" :key="index" :pollShow="pollShow.product_poll_show" @share="onShare" />
  28. </template>
  29. </view>
  30. <disclaimer-text></disclaimer-text>
  31. </view>
  32. </u-scroll-view>
  33. <u-share-action-sheet :show.sync="showShare" :show-info="shareInfo" />
  34. </view>
  35. </template>
  36. <script>
  37. import NavBar from '@/components/layout/nav-bar'
  38. import UScrollView from '@/components/common/u-scroll-view'
  39. import UShareActionSheet from '@/components/common/u-share-action-sheet'
  40. import USearch from '@/components/common/u-search'
  41. import UDropdownSelect from '@/components/common/u-dropdown-select'
  42. import ExhibitItem from '@/pages/exhibitor/components/exhibit-item.vue'
  43. import { exhibitorsProductList, productCategoryList, applicationAreasList, globalPollShow } from '@/api/exhibitor'
  44. import DisclaimerText from '@/components/disclaimer-text/index.vue'
  45. export default {
  46. options: {
  47. // styleIsolation: 'shared'
  48. },
  49. components: {
  50. NavBar,
  51. UScrollView,
  52. USearch,
  53. UDropdownSelect,
  54. UShareActionSheet,
  55. ExhibitItem,
  56. DisclaimerText
  57. },
  58. computed: {
  59. },
  60. data() {
  61. return {
  62. searchCategoryId: '',
  63. searchApplicationAreas: '',
  64. scrollviewHeight: 0,
  65. searchKeyword: '',
  66. exhibitParams: {
  67. page: 1,
  68. page_size: 10,
  69. keyword: '',
  70. product_cate_id: '',
  71. application_areas_id: ''
  72. },
  73. exhibitList: [],
  74. exhibitListLoading: false,
  75. exhibitListLastPage: 1,
  76. shareInfo: null,
  77. showShare: false,
  78. categories: [],
  79. applicationAreass: [],
  80. pollShow: {
  81. exhibitors_poll_show: 0,
  82. product_poll_show: 0
  83. }
  84. }
  85. },
  86. created() {
  87. this.loadFontFace('Poppins')
  88. this.getProductCategoryList()
  89. this.getApplicationAreasList()
  90. this.getList()
  91. this.getGlobalPollShow()
  92. },
  93. methods: {
  94. getApplicationAreasList() {
  95. applicationAreasList().then(res => {
  96. let areas = []
  97. res.data.forEach(item => {
  98. areas.push({
  99. label: item.name,
  100. value: item.id,
  101. })
  102. })
  103. this.applicationAreass = areas
  104. })
  105. },
  106. getProductCategoryList() {
  107. productCategoryList().then(res => {
  108. let cate = []
  109. res.data.forEach(item => {
  110. let child = []
  111. item.children.forEach(itemC => {
  112. child.push({
  113. label: itemC.name,
  114. value: itemC.id
  115. })
  116. })
  117. cate.push({
  118. label: item.name,
  119. value: item.id,
  120. children: child
  121. })
  122. })
  123. this.categories = cate
  124. })
  125. },
  126. searchList() {
  127. this.exhibitParams.application_areas_id = this.searchApplicationAreas || ''
  128. this.exhibitParams.product_cate_id = this.searchCategoryId || ''
  129. this.exhibitParams.page = 1
  130. this.getList()
  131. },
  132. getList() {
  133. if (this.exhibitListLoading === true) {
  134. return
  135. }
  136. this.exhibitListLoading = true
  137. exhibitorsProductList(this.exhibitParams).then(res => {
  138. if (res.data.data) {
  139. if (this.exhibitParams.page > 1) {
  140. this.exhibitList = [...this.exhibitList, ...res.data.data]
  141. } else {
  142. this.exhibitList = res.data.data
  143. this.exhibitListLastPage = res.data.last_page
  144. }
  145. } else {
  146. this.showToast('系统繁忙,稍候再试')
  147. }
  148. this.exhibitListLoading = false
  149. })
  150. },
  151. onScrollToLower(e) {
  152. if (this.exhibitListLastPage === this.exhibitParams.page) {
  153. return
  154. }
  155. if (this.exhibitListLoading === true) {
  156. return
  157. }
  158. this.exhibitListLoading = true
  159. this.exhibitParams.page = this.exhibitParams.page+1
  160. this.getList()
  161. },
  162. onShare(e) {
  163. this.shareInfo = e.detail
  164. this.showShare = true
  165. },
  166. onShareAppMessage: function (res) {
  167. if (res.from === 'button') {
  168. if (this.shareInfo) {
  169. return this.shareInfo
  170. }
  171. }
  172. this.shareInfo = null
  173. this.showShare = false
  174. return {
  175. title: '慕尼黑上海电子生产设备展',
  176. path: '/pages/index/index',
  177. 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'
  178. }
  179. },
  180. onSelectDropdown(index) {
  181. ['select1', 'select2', 'select3'].forEach(v => {
  182. if (v !== 'select' + index) {
  183. this.$refs[v].hideDropdown()
  184. }
  185. })
  186. },
  187. onClickExhibit(item) {
  188. this.navigateTo('/pages/exhibitor/exhibit-detail')
  189. },
  190. onSearch() {
  191. this.navigateTo('/pages/index/search?query=' + this.searchKeyword)
  192. },
  193. getGlobalPollShow() {
  194. globalPollShow().then(res => {
  195. this.pollShow = res.data
  196. })
  197. },
  198. updateItemValue(e) {
  199. this.exhibitList.forEach((item) => {
  200. if (item.id === e.id) {
  201. item[e.key] = e.value
  202. }
  203. })
  204. }
  205. }
  206. }
  207. </script>
  208. <style lang="scss">
  209. </style>