exhibit.vue 6.0 KB

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