Prechádzať zdrojové kódy

Merge branch 'zhaosm' of http://120.26.79.179/luxf/mp_exhibitor_miniprog into zhaosm

yanj 3 dní pred
rodič
commit
391c940fd3

+ 16 - 15
pages/exhibitor/components/exhibit-item.vue

@@ -2,20 +2,20 @@
 	<view class="exhibit-item exhibitor-item" hover-class="active" @click="onClickExhibit(item)">
 		<view class="exhibit-body">
 			<view class="exhibitor-body">
-				<view class="exhibitor-logo"><image src="https://oss.starify.cn/prod/starify/up/0001000075/20241113/67343f1c494de.png?x-oss-process=image/resize,w_400" mode="aspectFit" /></view>
-				<view class="exhibitor-name">汽车连接器 86W MLK 1,2 SD-HOLDER</view>
+				<view class="exhibitor-logo"><image :src="item.pic + '?x-oss-process=image/resize,w_400'" mode="aspectFit" /></view>
+				<view class="exhibitor-name">{{ item.name }}</view>
 				<view class="exhibitor-number">
 					<view class="exhibitor-number-label">展位号:</view>
-					<view class="exhibitor-number-text">E1.1101</view>
+					<view class="exhibitor-number-text">{{ item.hall_booth_no }}</view>
 				</view>
 			</view>
 			<view class="exhibitor-name">
-				<view class="exhibitor-name-cn">科世达(上海)连接器有限公司</view>
-				<view class="exhibitor-name-en">Leopold Kostal GmbH & Co. KG</view>
+				<view class="exhibitor-name-cn">{{ item.exhibitors_name_zh_cn }}</view>
+				<view class="exhibitor-name-en">{{ item.exhibitors_name_en_us }}</view>
 			</view>
 		</view>
 		<view v-if="!footerHidden" class="exhibitor-footer">
-			<view class="exhibitor-views">浏览:30911</view>
+			<view class="exhibitor-views">浏览:{{ item.pv }}</view>
 			<view class="exhibitor-action">
 				<view>
 					<button @click.stop="onShare(item)" :plain="true">
@@ -26,17 +26,17 @@
 					</button>
 				</view>
 				<view>
-					<view v-if="item.favourited" class="iconfont icon-favourites-filled-star-symbol active"></view>
+					<view v-if="item.is_collect" class="iconfont icon-favourites-filled-star-symbol active"></view>
 					<view v-else class="iconfont icon-Favourites-Add-Large"></view>
 					<view>收藏</view>
 				</view>
 				<view>
-					<view v-if="item.liked" class="iconfont icon-aixin active"></view>
+					<view v-if="item.is_like" class="iconfont icon-aixin active"></view>
 					<view v-else class="iconfont icon-heart1"></view>
 					<view>点赞</view>
 				</view>
-				<view>
-					<view v-if="item.voted" class="iconfont icon-Ticket1 active"></view>
+				<view v-if="pollShow">
+					<view v-if="item.is_poll" class="iconfont icon-Ticket1 active"></view>
 					<view v-else class="iconfont icon-xiaochengxu-toupiaoicon"></view>
 					<view>投票</view>
 				</view>
@@ -56,7 +56,8 @@
 		props: {
 			// 数据
 			item: Object,
-			footerHidden: Boolean
+			footerHidden: Boolean,
+			pollShow: Number
 		},
 		data() {
 			return {
@@ -67,16 +68,16 @@
 		methods: {
 			onShare(item) {
 				const shareInfo = {
-					title: item.name || '汽车连接器 86W MLK 1,2 SD-HOLDER',
-					path: `/pages/exhibitor/exhibit-detail`,
-					imageUrl: 'https://oss.starify.cn/prod/starify/up/0001000075/20241113/67343f1c494de.png?x-oss-process=image/resize,w_400'
+					title: item.name,
+					path: `/pages/exhibitor/exhibit-detail` + item.id,
+					imageUrl: item.pic + '?x-oss-process=image/resize,w_400'
 				}
 				this.$emit('share', {
 					detail: shareInfo
 				})
 			},
 			onClickExhibit(item) {
-				this.navigateTo('/pages/exhibitor/exhibit-detail')
+				this.navigateTo('/pages/exhibitor/exhibit-detail?id=' + item.id)
 			}
 		}
 	}

+ 3 - 3
pages/exhibitor/components/exhibitor-item.vue

@@ -65,9 +65,9 @@
 		methods: {
 			onShare(item) {
 				const shareInfo = {
-					title: item.name || '科世达(上海)连接器有限公司',
-					path: `/pages/exhibitor/exhibit-detail`,
-					imageUrl: item.logo || 'https://oss.starify.cn/prod/starify/up/0001018678/20241108/672da70c02212.png?x-oss-process=image/resize,w_400'
+					title: item.name,
+					path: `/pages/exhibitor/exhibit-detail?id=` + item.id,
+					imageUrl: item.logo
 				}
 				this.$emit('share', {
 					detail: shareInfo

+ 5 - 6
pages/exhibitor/detail.vue

@@ -129,7 +129,10 @@
 					product_cate_names: [],
 					application_areas_names: [],
 					pv: 0,
-					poll_count: 0
+					poll_count: 0,
+					is_collect: 0,
+					is_like: 0,
+					is_poll: 0
 				},
 				exhibitorId: 0,
 				pollShow: {
@@ -151,11 +154,7 @@
 				})
 			},
 			onShareAppMessage(ops) {
-				return {
-					title: '科世达(上海)连接器有限公司',
-					path: `/pages/exhibitor/detail`,
-					imageUrl: this.exhibitor.logo + '?x-oss-process=image/resize,w_600,h_600,limit_0,m_pad'
-				}
+				return this.shareInfo
 			},
 			onShare() {
 				this.shareInfo = {

+ 96 - 39
pages/exhibitor/exhibit-detail.vue

@@ -4,34 +4,29 @@
 		<u-scroll-view>
 			<view class="main-container">
 				<view class="exhibit-image">
-					<image src="https://oss.starify.cn/prod/starify/up/0001000075/20241113/67343f1c494de.png?x-oss-process=image/resize,w_800" mode="aspectFit"/>
-					<view class="exhibit-tag">2025新品</view>
+					<image :src="exhibit.pic + '?x-oss-process=image/resize,w_800'" mode="aspectFit"/>
+					<view v-for="(item) in exhibit.product_attr_names" class="exhibit-tag">{{ item }}</view>
 				</view>
-				<view class="exhibit-name">汽车连接器 86W MLK 1,2 SD-HOLDER</view>
-				<view class="exhibit-desc">适用于连接器、连接器系统的生产加工,汽车零部件、电子元器件、机械设备及其零配件、工具、模具、连接器产品及其生产设备的批发、进出口、佣金代理(拍卖除外),并提供相关配套服务(包括上门安装、保养、维修服务)。</view>
+				<view class="exhibit-name">{{ exhibit.name }}</view>
+				<view class="exhibit-desc">{{ exhibit.summary}}</view>
 				<view class="exhibit-tags exhibitor-tags">
 					<view class="exhibitor-tags-category">产品分类:</view>
 					<view class="exhibitor-tags-list">
-						<view class="exhibitor-tag">柔性与印刷电子</view>
-						<view class="exhibitor-tag">电子制造服务</view>
-						<view class="exhibitor-tag">PCB焊接和连接技术</view>
-						<view class="exhibitor-tag">线束和连接器</view>
-						<view class="exhibitor-tag">柔性与印刷电子</view>
-						<view class="exhibitor-tag">电子制造服务</view>
+						<view v-for="(item) in exhibit.product_cate_names" class="exhibitor-tag">{{ item }}</view>
 					</view>
 				</view>
 				<view class="exhibit-tags exhibitor-tags">
 					<view class="exhibitor-tags-category">应用领域:</view>
-					<view class="exhibitor-tags-list"></view>
-					<view class="exhibitor-tag">电脑和周边设备</view>
-					<view class="exhibitor-tag">新能源</view>
+					<view class="exhibitor-tags-list">
+						<view v-for="(item) in exhibit.application_areas_names" class="exhibitor-tag">{{ item }}</view>
+					</view>
 				</view>
 				<view class="exhibit-operation exhibitor-operation">
-					<view class="exhibitor-views">浏览:30911</view>
+					<view class="exhibitor-views">浏览:{{ exhibit.pv }}</view>
 					<view class="exhibitor-action">
-						<view>
+						<view v-if="pollShow.product_poll_show">
 							<view class="iconfont icon-xiaochengxu-renqiicon"></view>
-							<view>人气:11192</view>
+							<view>人气:{{ exhibit.poll_count }}</view>
 						</view>
 						<view>
 							<button :plain="true" @click.stop="onShare">
@@ -41,18 +36,18 @@
 								</view>
 							</button>
 						</view>
-						<view>
-							<view v-if="exhibitor.favourited" class="iconfont icon-favourites-filled-star-symbol active"></view>
+						<view @click="onCollect()">
+							<view v-if="exhibit.is_collect" class="iconfont icon-favourites-filled-star-symbol active"></view>
 							<view v-else class="iconfont icon-Favourites-Add-Large"></view>
 							<view>收藏</view>
 						</view>
-						<view>
-							<view v-if="exhibitor.liked" class="iconfont icon-aixin active"></view>
+						<view @click="onLike()">
+							<view v-if="exhibit.is_like" class="iconfont icon-aixin active"></view>
 							<view v-else class="iconfont icon-heart1"></view>
 							<view>点赞</view>
 						</view>
-						<view>
-							<view v-if="exhibitor.voted" class="iconfont icon-Ticket1 active"></view>
+						<view v-if="pollShow.product_poll_show" @click="onPoll()">
+							<view v-if="exhibit.is_poll" class="iconfont icon-Ticket1 active"></view>
 							<view v-else class="iconfont icon-xiaochengxu-toupiaoicon"></view>
 							<view>投票</view>
 						</view>
@@ -62,10 +57,10 @@
 					<view class="exhibitor-card">
 						<view class="exhibitor-info">
 							<view class="exhibitor-logo">
-								<image src="https://oss.starify.cn/prod/starify/up/0001018678/20241108/672da70c02212.png?x-oss-process=image/resize,w_400" mode="widthFix" />
+								<image :src="exhibit.exhibitors_logo + '?x-oss-process=image/resize,w_400'" mode="widthFix" />
 							</view>
-							<view class="exhibitor-name-cn">科世达(上海)连接器有限公司</view>
-							<view class="exhibitor-name-en">Leopold Kostal GmbH & Co. KG</view>
+							<view class="exhibitor-name-cn">{{ exhibit.exhibitors_name_zh_cn }}</view>
+							<view class="exhibitor-name-en">{{ exhibit.exhibitors_name_en_us }}</view>
 							<view class="exhibitor-detail-link">
 								<van-button type="primary" @click="onClickDetail">
 									<template>
@@ -76,7 +71,7 @@
 						</view>
 						<view class="exhibitor-number">
 							<view class="exhibitor-number-label">我们的展位号</view>
-							<view class="exhibitor-number-text">E1馆 1101</view>
+							<view class="exhibitor-number-text">{{ exhibit.exhibitors_hall }}馆 {{ exhibit.exhibitors_booth_no }}</view>
 						</view>
 					</view>
 				</u-panel>
@@ -91,6 +86,7 @@
 	import UScrollView from '@/components/common/u-scroll-view'
 	import UShareActionSheet from '@/components/common/u-share-action-sheet'
 	import UPanel from '@/components/common/u-panel'
+	import { exhibitorsProductInfo, globalPollShow, exhibitorsProductCollect, exhibitorsProductLike, exhibitorsProductPoll } from '@/api/exhibitor'
 	
 	export default {
 		options: {
@@ -108,34 +104,95 @@
 				showShare: false,
 				shareInfo: null,
 				exhibit: {
-					favourited: true,
-					liked: false,
-					voted: false
+					is_collect: 0,
+					is_like: 0,
+					is_poll: 0,
+					name: '',
+					summary: '',
+					product_cate_names: [],
+					application_areas_names: [],
+					product_attr_names: [],
+					pic: '',
+					poll_count: 0,
+					pv: 0,
+					exhibitors_logo: '',
+					exhibitors_name_zh_cn: '',
+					exhibitors_name_en_us: '',
+					exhibitors_hall: '',
+					exhibitors_booth_no: ''
+				},
+				id: 0,
+				pollShow: {
+					exhibitors_poll_show: 0,
+					product_poll_show: 0
 				}
 			}
 		},
+		onLoad(options) {
+			this.id = options.id
+			this.getProductInfo()
+		},
 		created() {
 			this.loadFontFace('Poppins')
+			this.getGlobalPollShow()
 		},
 		methods: {
+			getProductInfo() {
+				exhibitorsProductInfo({id: this.id}).then(res => {
+					if (res.code === 0) {
+						this.exhibit = res.data
+					}
+				})
+			},
 			onShareAppMessage() {
-				return {
-					title: '汽车连接器 86W MLK 1,2 SD-HOLDER',
-					path: `/pages/exhibitor/exhibit-detail`,
-					imageUrl: 'https://oss.starify.cn/prod/starify/up/0001000075/20241113/67343f1c494de.png?x-oss-process=image/resize,w_600,h_600,limit_0,m_pad'
-				}
+				return this.shareInfo
 			},
 			onShare() {
 				this.shareInfo = {
-					title: '汽车连接器 86W MLK 1,2 SD-HOLDER',
-					path: `/pages/exhibitor/exhibit-detail`,
-					imageUrl: 'https://oss.starify.cn/prod/starify/up/0001000075/20241113/67343f1c494de.png?x-oss-process=image/resize,w_600,h_600,limit_0,m_pad'
+					title: this.exhibit.name,
+					path: `/pages/exhibitor/exhibit-detail` + this.id,
+					imageUrl: this.exhibit.pic + '?x-oss-process=image/resize,w_600,h_600,limit_0,m_pad'
 				}
 				this.showShare = true
 			},
 			onClickDetail(e) {
-				this.navigateTo('/pages/exhibitor/detail')
-			}
+				this.navigateTo('/pages/exhibitor/detail?id=' + this.exhibit.exhibitors_id)
+			},
+			getGlobalPollShow() {
+				globalPollShow().then(res => {
+					this.pollShow = res.data
+				})
+			},
+			onCollect() { // 收藏
+				this.checkAuth('/pages/exhibitor/exhibit-detail?id=' + this.id)
+				exhibitorsProductCollect({ id: this.id }).then(res => {
+					if (res.code === 0) {
+						this.exhibit.is_collect = this.exhibit.is_collect === 0 ? 1 : 0
+					}
+				})
+			},
+			onLike() { // 点赞
+				this.checkAuth('/pages/exhibitor/exhibit-detail?id=' + this.id)
+				exhibitorsProductLike({ id: this.id }).then(res => {
+					if (res.code === 0) {
+						this.exhibit.is_like = this.exhibit.is_like === 0 ? 1 : 0
+					}
+				})
+			},
+			onPoll() { // 投票
+				this.checkAuth('/pages/exhibitor/exhibit-detail?id=' + this.id)
+				exhibitorsProductPoll({ id: this.id }).then(res => {
+					if (res.code === 0) {
+						this.exhibit.is_poll = this.exhibit.is_poll === 0 ? 1 : 0
+						if (this.exhibit.is_poll === 1) {
+							this.exhibit.poll_count = this.exhibit.poll_count + 1
+						} else {
+							this.exhibit.poll_count = this.exhibit.poll_count - 1
+							this.exhibit.poll_count = this.exhibit.poll_count < 0 ? 0 : this.exhibit.poll_count
+						}
+					}
+				})
+			},
 		}
 	}
 </script>

+ 93 - 45
pages/exhibitor/exhibit.vue

@@ -1,20 +1,20 @@
 <template>
 	<view class="exhibit-index exhibitor-index">
 		<nav-bar title="展品信息" @init="onInitNavbar"></nav-bar>
-		<u-scroll-view>
+		<u-scroll-view @scroll-near-lower="onScrollToLower">
 			<view class="main-container">
 				<view class="exhibitor-filter">
 					<view>
 						<view class="exhibitor-filter-label">展馆号</view>
-						<u-dropdown-select ref="select1" v-model="categoryId" placeholder="选择展馆号" :options="categories" @dropdown="onSelectDropdown(1)" /> 
+						<u-dropdown-select ref="select1" v-model="categoryId" placeholder="选择展馆号" :options="categories" @dropdown="onSelectDropdown(1)" @change="searchList()"/> 
 					</view>
 					<view>
 						<view class="exhibitor-filter-label">产品类别</view>
-						<u-dropdown-select ref="select2" v-model="categoryId" placeholder="选择产品类别" :options="categories" @dropdown="onSelectDropdown(2)" /> 
+						<u-dropdown-select ref="select2" v-model="searchCategoryId" placeholder="选择产品类别" :options="categories" @dropdown="onSelectDropdown(2)" @change="searchList()" /> 
 					</view>
 					<view>
 						<view class="exhibitor-filter-label">应用领域</view>
-						<u-dropdown-select  ref="select3" v-model="categoryId" placeholder="选择应用领域" :options="categories" @dropdown="onSelectDropdown(3)" /> 
+						<u-dropdown-select  ref="select3" v-model="searchApplicationAreas" placeholder="选择应用领域" :options="applicationAreass" @dropdown="onSelectDropdown(3)" @change="searchList()"/> 
 					</view>
 				</view>
 				<u-search v-model="searchKeyword" placeholder="搜索展商 / 展品名称 / 会议" @search="onSearch" />
@@ -24,7 +24,7 @@
 				<van-empty v-if="exhibitList.length === 0" description="暂无数据" />
 				<view v-else class="exhibit-list exhibitor-list">
 					<template v-for="(item, index) in exhibitList">
-						<exhibit-item :item="item" :key="index" @share="onShare" />
+						<exhibit-item :item="item" :key="index" :pollShow="pollShow.product_poll_show" @share="onShare" />
 					</template>	
 				</view>
 			</view>
@@ -40,6 +40,7 @@
 	import USearch from '@/components/common/u-search'
 	import UDropdownSelect from '@/components/common/u-dropdown-select'
 	import ExhibitItem from '@/pages/exhibitor/components/exhibit-item.vue'
+	import { exhibitorsProductList, productCategoryList, applicationAreasList, globalPollShow } from '@/api/exhibitor'
 	
 	export default {
 		options: {
@@ -57,56 +58,103 @@
 		},
 		data() {
 			return {
-				categoryId: undefined,
+				searchCategoryId: '',
+				searchApplicationAreas: '',
 				scrollviewHeight: 0,
 				searchKeyword: '',
-				exhibitList: [{ favourited: true }, { liked: true }, { voted: true }, {} ],
+				exhibitList: [],
+				exhibitParams: {
+					page: 1,
+					page_size: 10,
+					keyword: '',
+					product_cate_id: '',
+					application_areas_id: ''
+				},
+				exhibitList: [],
+				exhibitListLoading: false,
+				exhibitListLastPage: 1,
 				shareInfo: null,
 				showShare: false,
-				categories: [{
-					label: '表面贴装',
-					value: 1,
-					children: [{
-						label: '表面贴装技术',
-						value: 11
-					}, {
-						label: 'PCB焊接和连接技术',
-						value: 12
-					}, {
-						label: '测试测量和质量保证',
-						value: 13
-					}, {
-						label: '电子组装自动化',
-						value: 14
-					}, {
-						label: '生产物流和物流技术',
-						value: 15
-					}, {
-						label: '清洗技术',
-						value: 16
-					}]
-				}, {
-					label: '线束加工',
-					value: 2
-				}, {
-					label: '工厂自动化',
-					value: 3
-				}, {
-					label: '点胶注胶',
-					value: 4
-				}, {
-					label: '电子制造服务',
-					value: 5
-				}, {
-					label: '未来服务',
-					value: 6
-				}]
+				categories: [],
+				applicationAreass: [],
+				pollShow: {
+					exhibitors_poll_show: 0,
+					product_poll_show: 0
+				}
 			}
 		},
 		created() {
 			this.loadFontFace('Poppins')
+			this.getProductCategoryList()
+			this.getApplicationAreasList()
+			this.getList()
+			this.getGlobalPollShow()
 		},
 		methods: {
+			getApplicationAreasList() {
+				applicationAreasList().then(res => {
+					let areas = []
+					res.data.forEach(item => {
+						areas.push({
+							label: item.name,
+							value: item.id,
+						})
+					})
+					this.applicationAreass = areas
+				})
+			},
+			getProductCategoryList() {
+				productCategoryList().then(res => {
+					let cate = []
+					res.data.forEach(item => {
+						let child = []
+						item.children.forEach(itemC => {
+							child.push({
+								label: itemC.name,
+								value: itemC.id
+							})
+						})
+						cate.push({
+							label: item.name,
+							value: item.id,
+							children: child
+						})
+					})
+					this.categories = cate
+				})
+			},
+			searchList() {
+				this.exhibitParams.application_areas_id = this.searchApplicationAreas || ''
+				this.exhibitParams.product_cate_id = this.searchCategoryId || ''
+				this.exhibitParams.page = 1
+				this.getList()
+			},
+			getList() {
+				if (this.exhibitListLoading === true) {
+					return
+				}
+				this.exhibitListLoading = true
+				exhibitorsProductList(this.exhibitParams).then(res => {
+					if (res.data.data) {
+						if (this.exhibitParams.page > 1) {
+							this.exhibitList = [...this.exhibitList, ...res.data.data]
+						} else {
+							this.exhibitList = res.data.data
+							this.exhibitListLastPage = res.data.last_page
+						}
+					} else {
+						this.showToast('系统繁忙,稍候再试')
+					}
+					this.exhibitListLoading = false
+				})
+			},
+			onScrollToLower(e) {
+				if (this.exhibitListLastPage === this.exhibitParams.page) {
+					return
+				}
+				this.exhibitParams.page = this.exhibitParams.page+1
+				this.getList()
+			},
 			onShare(e) {
 				this.shareInfo = e.detail
 				this.showShare = true

+ 0 - 1
pages/exhibitor/index.vue

@@ -3,7 +3,6 @@
 		<nav-bar title="展商信息" @init="onInitNavbar"></nav-bar>
 		<u-scroll-view :tabbar-conflict="true" @scroll-near-lower="onScrollToLower">
 			<view class="main-container">
-				<view>{{ categoryId }}</view>
 				<view class="exhibitor-filter">
 					<view>
 						<view class="exhibitor-filter-label">展馆号</view>