| 
									
										
										
										
											2024-08-16 18:26:19 +08:00
										 |  |  | <template> | 
					
						
							|  |  |  | 	<view class="content"> | 
					
						
							|  |  |  | 		<view class="container"> | 
					
						
							|  |  |  | 			<view class="my-header"> | 
					
						
							|  |  |  | 				<view class="my-icons" @click="goback"> <uni-icons type="left" size="16"></uni-icons> </view> | 
					
						
							|  |  |  | 				<view class="my-text">商品详情</view> | 
					
						
							|  |  |  | 				<view class="my-icons"></view> | 
					
						
							|  |  |  | 			</view> | 
					
						
							|  |  |  | 			<!-- 顶部区域 --> | 
					
						
							|  |  |  | 			<view class=""> | 
					
						
							|  |  |  | 				<u-swiper :list="giftImages" height="390" @change="change" @click="click"></u-swiper> | 
					
						
							|  |  |  | 			</view> | 
					
						
							|  |  |  | 			<view class="bai-box"> | 
					
						
							|  |  |  | 				<view class="box-title">{{goodsInfo.giftName}}</view> | 
					
						
							| 
									
										
										
										
											2024-09-25 15:31:59 +08:00
										 |  |  | 				<view class="price_num"> | 
					
						
							|  |  |  | 					<span | 
					
						
							|  |  |  | 						v-if="goodsInfo.exchangeMethod == '积分' || goodsInfo.exchangeMethod == '积分+金额' || goodsInfo.exchangeMethod == '积分+加钱购'">{{goodsInfo.exchangePoints}}积分</span> | 
					
						
							|  |  |  | 					<span v-if="goodsInfo.exchangeMethod == '积分+金额'">+</span> | 
					
						
							|  |  |  | 					<span | 
					
						
							|  |  |  | 						v-if="goodsInfo.exchangeMethod == '金额' || goodsInfo.exchangeMethod == '积分+金额'">¥{{goodsInfo.exchangeAmount}}</span> | 
					
						
							|  |  |  | 				</view> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-08-16 18:26:19 +08:00
										 |  |  | 				<view class="dt-box"> | 
					
						
							| 
									
										
										
										
											2024-09-23 17:41:41 +08:00
										 |  |  | 					<view class="hui_"> | 
					
						
							| 
									
										
										
										
											2024-09-25 15:31:59 +08:00
										 |  |  | 						¥{{goodsInfo.market}} | 
					
						
							| 
									
										
										
										
											2024-09-23 17:41:41 +08:00
										 |  |  | 					</view> | 
					
						
							| 
									
										
										
										
											2024-09-25 15:31:59 +08:00
										 |  |  | 					<view class="or_size" v-if="goodsInfo.deliveryMethod"> | 
					
						
							|  |  |  | 						{{JSON.parse(goodsInfo.deliveryMethod)}} | 
					
						
							| 
									
										
										
										
											2024-09-23 17:41:41 +08:00
										 |  |  | 					</view> | 
					
						
							| 
									
										
										
										
											2024-08-16 18:26:19 +08:00
										 |  |  | 				</view> | 
					
						
							|  |  |  | 			</view> | 
					
						
							| 
									
										
										
										
											2024-09-23 17:41:41 +08:00
										 |  |  | 			<view class="bai_box"> | 
					
						
							|  |  |  | 				<view class="">兑换数量</view> | 
					
						
							|  |  |  | 				<u-number-box v-model="value" @change="valChange"></u-number-box> | 
					
						
							| 
									
										
										
										
											2024-08-16 18:26:19 +08:00
										 |  |  | 			</view> | 
					
						
							|  |  |  | 		</view> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		<view class="bottom-d"> | 
					
						
							|  |  |  | 			<view class="anniux" @click="goorder()"> | 
					
						
							| 
									
										
										
										
											2024-09-23 17:41:41 +08:00
										 |  |  | 				<text>立即购买</text> | 
					
						
							| 
									
										
										
										
											2024-08-16 18:26:19 +08:00
										 |  |  | 			</view> | 
					
						
							|  |  |  | 		</view> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	</view> | 
					
						
							|  |  |  | 	</view> | 
					
						
							|  |  |  | </template> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <script> | 
					
						
							|  |  |  | 	import config from '@/config' | 
					
						
							|  |  |  | 	import request from '../../utils/request' | 
					
						
							|  |  |  | 	export default { | 
					
						
							|  |  |  | 		data() { | 
					
						
							|  |  |  | 			return { | 
					
						
							|  |  |  | 				title: '', | 
					
						
							|  |  |  | 				goodsInfo: '', | 
					
						
							|  |  |  | 				baseUrl: config.baseUrl, | 
					
						
							|  |  |  | 				deliveryMethod: '', | 
					
						
							|  |  |  | 				giftImages: [], | 
					
						
							| 
									
										
										
										
											2024-09-23 17:41:41 +08:00
										 |  |  | 				value: 0 | 
					
						
							| 
									
										
										
										
											2024-08-16 18:26:19 +08:00
										 |  |  | 			} | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		onLoad() { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 		onShow() { | 
					
						
							|  |  |  | 			uni.$on('goodsInfo', (data) => { | 
					
						
							|  |  |  | 				this.goodsInfo = data | 
					
						
							|  |  |  | 				if (this.goodsInfo != null) { | 
					
						
							|  |  |  | 					this.dataProcessing() | 
					
						
							|  |  |  | 				} | 
					
						
							|  |  |  | 			}) | 
					
						
							|  |  |  | 			uni.$emit('un') | 
					
						
							| 
									
										
										
										
											2024-09-25 15:31:59 +08:00
										 |  |  | 			console.log(this.goodsInfo,67); | 
					
						
							| 
									
										
										
										
											2024-08-16 18:26:19 +08:00
										 |  |  | 		}, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		methods: { | 
					
						
							| 
									
										
										
										
											2024-09-23 17:41:41 +08:00
										 |  |  | 			valChange(e) { | 
					
						
							|  |  |  | 				console.log('当前值为: ' + e.value) | 
					
						
							|  |  |  | 			}, | 
					
						
							| 
									
										
										
										
											2024-08-16 18:26:19 +08:00
										 |  |  | 			change() {}, | 
					
						
							|  |  |  | 			click() {}, | 
					
						
							|  |  |  | 			// 配送信息
 | 
					
						
							|  |  |  | 			dataProcessing() { | 
					
						
							|  |  |  | 				this.giftImages = [] | 
					
						
							|  |  |  | 				if (this.goodsInfo.giftImages != null && this.goodsInfo.giftImages != undefined) { | 
					
						
							|  |  |  | 					const myGiftImages = JSON.parse(this.goodsInfo.giftImages); | 
					
						
							|  |  |  | 					myGiftImages.forEach(res => { | 
					
						
							|  |  |  | 						let url = this.baseUrl + res | 
					
						
							|  |  |  | 						this.giftImages.push(url); | 
					
						
							|  |  |  | 					}) | 
					
						
							|  |  |  | 				} | 
					
						
							|  |  |  | 				if (this.goodsInfo.deliveryMethod != null && this.goodsInfo.deliveryMethod != undefined) { | 
					
						
							|  |  |  | 					const deliveryData = JSON.parse(this.goodsInfo.deliveryMethod); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 					this.deliveryMethod = deliveryData.join('+'); | 
					
						
							|  |  |  | 				} else { | 
					
						
							|  |  |  | 					this.deliveryMethod = '无配送信息' | 
					
						
							|  |  |  | 				} | 
					
						
							|  |  |  | 			}, | 
					
						
							|  |  |  | 			// 立即兑换
 | 
					
						
							|  |  |  | 			goorder() { | 
					
						
							|  |  |  | 				// 先判断积分是否足够兑换
 | 
					
						
							|  |  |  | 				request({ | 
					
						
							|  |  |  | 					url: 'business/userManager/user/getByUniApp', | 
					
						
							|  |  |  | 					method: 'get', | 
					
						
							|  |  |  | 					params: { | 
					
						
							|  |  |  | 						chainStoreId: uni.getStorageSync('chainStoreId') | 
					
						
							|  |  |  | 					} | 
					
						
							|  |  |  | 				}).then((res) => { | 
					
						
							|  |  |  | 					if (res.code == 200 && res.data) { | 
					
						
							|  |  |  | 						this.myPoints = res.data.points | 
					
						
							|  |  |  | 						console.log("this.goodsInfo1", this.goodsInfo) | 
					
						
							|  |  |  | 						console.log("this.goodsInfo1", res.data) | 
					
						
							|  |  |  | 						if (res.data.points != undefined) { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 							if (!this.goodsInfo.exchangePoints) { | 
					
						
							|  |  |  | 								uni.navigateTo({ | 
					
						
							|  |  |  | 									url: '/pagesHome/order/order' | 
					
						
							|  |  |  | 								}) | 
					
						
							|  |  |  | 							} else if (res.data.points < this.goodsInfo.exchangePoints && ( | 
					
						
							|  |  |  | 									this.goodsInfo.exchangeMethod == '积分' || | 
					
						
							|  |  |  | 									this.goodsInfo.exchangeMethod == '积分+金额')) { | 
					
						
							|  |  |  | 								// 积分不足
 | 
					
						
							|  |  |  | 								uni.showToast({ | 
					
						
							|  |  |  | 									icon: 'none', | 
					
						
							|  |  |  | 									title: "积分不足" | 
					
						
							|  |  |  | 								}) | 
					
						
							|  |  |  | 							} else { | 
					
						
							|  |  |  | 								uni.navigateTo({ | 
					
						
							|  |  |  | 									url: '/pagesHome/order/order' | 
					
						
							|  |  |  | 								}) | 
					
						
							|  |  |  | 							} | 
					
						
							|  |  |  | 						} | 
					
						
							|  |  |  | 					} else { | 
					
						
							|  |  |  | 						// 错误处理
 | 
					
						
							|  |  |  | 						uni.showToast({ | 
					
						
							|  |  |  | 							icon: 'none', | 
					
						
							|  |  |  | 							title: "积分不足" | 
					
						
							|  |  |  | 						}) | 
					
						
							|  |  |  | 					} | 
					
						
							|  |  |  | 				}) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 			}, | 
					
						
							|  |  |  | 			// 返回
 | 
					
						
							|  |  |  | 			goback() { | 
					
						
							|  |  |  | 				uni.navigateBack() | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | </script> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <style scoped lang="scss"> | 
					
						
							|  |  |  | 	.content { | 
					
						
							|  |  |  | 		background: #f4f5f6; | 
					
						
							|  |  |  | 		width: 100%; | 
					
						
							|  |  |  | 		height: 100vh; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	.container { | 
					
						
							|  |  |  | 		width: 100%; | 
					
						
							|  |  |  | 		height: 100vh; | 
					
						
							|  |  |  | 		box-sizing: border-box; | 
					
						
							|  |  |  | 		padding-top: 88px; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	.my-header { | 
					
						
							|  |  |  | 		width: 100%; | 
					
						
							|  |  |  | 		height: 88px; | 
					
						
							|  |  |  | 		background: #ffffff; | 
					
						
							|  |  |  | 		display: flex; | 
					
						
							|  |  |  | 		align-items: center; | 
					
						
							|  |  |  | 		justify-content: space-between; | 
					
						
							|  |  |  | 		color: #000; | 
					
						
							|  |  |  | 		box-sizing: border-box; | 
					
						
							|  |  |  | 		padding: 0px 15px; | 
					
						
							|  |  |  | 		padding-top: 40px; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		.my-icons { | 
					
						
							|  |  |  | 			width: 20px; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		position: fixed; | 
					
						
							|  |  |  | 		top: 0px; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	.bai-box { | 
					
						
							|  |  |  | 		width: 100%; | 
					
						
							|  |  |  | 		background-color: #ffffff; | 
					
						
							|  |  |  | 		padding: 10px; | 
					
						
							|  |  |  | 		margin: 10px auto; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	.dt-box { | 
					
						
							|  |  |  | 		width: 92%; | 
					
						
							|  |  |  | 		display: flex; | 
					
						
							|  |  |  | 		align-items: center; | 
					
						
							|  |  |  | 		justify-content: space-between; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	.box-title { | 
					
						
							|  |  |  | 		font-weight: bold; | 
					
						
							|  |  |  | 		font-size: 18px; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	.box-jg { | 
					
						
							|  |  |  | 		font-size: 20px; | 
					
						
							|  |  |  | 		color: red; | 
					
						
							|  |  |  | 		margin: 10px auto; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	.hui-time { | 
					
						
							|  |  |  | 		color: #999999; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	.bottom-d { | 
					
						
							|  |  |  | 		display: flex; | 
					
						
							|  |  |  | 		align-items: center; | 
					
						
							|  |  |  | 		justify-content: center; | 
					
						
							|  |  |  | 		background-color: #ffffff; | 
					
						
							|  |  |  | 		width: 100%; | 
					
						
							|  |  |  | 		height: 88px; | 
					
						
							|  |  |  | 		position: fixed; | 
					
						
							|  |  |  | 		bottom: 0px; | 
					
						
							|  |  |  | 		z-index: 99999; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	.anniux { | 
					
						
							|  |  |  | 		width: 90%; | 
					
						
							| 
									
										
										
										
											2024-09-23 17:41:41 +08:00
										 |  |  | 		background: #FF9655; | 
					
						
							| 
									
										
										
										
											2024-08-16 18:26:19 +08:00
										 |  |  | 		color: white; | 
					
						
							|  |  |  | 		display: flex; | 
					
						
							|  |  |  | 		align-items: center; | 
					
						
							|  |  |  | 		justify-content: center; | 
					
						
							|  |  |  | 		color: white; | 
					
						
							|  |  |  | 		border-radius: 50px; | 
					
						
							| 
									
										
										
										
											2024-09-23 17:41:41 +08:00
										 |  |  | 		height: 40px; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	.or_size { | 
					
						
							|  |  |  | 		font-weight: 500; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		color: #FA6400; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	.hui_ { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		color: #999; | 
					
						
							|  |  |  | 		text-decoration: line-through | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	.price_num { | 
					
						
							|  |  |  | 		font-size: 14px; | 
					
						
							|  |  |  | 		color: #E02020; | 
					
						
							|  |  |  | 		margin: 5px 0px; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	.bai_box { | 
					
						
							|  |  |  | 		background: #fff; | 
					
						
							|  |  |  | 		box-sizing: border-box; | 
					
						
							|  |  |  | 		padding: 15px; | 
					
						
							|  |  |  | 		width: 100%; | 
					
						
							|  |  |  | 		display: flex; | 
					
						
							|  |  |  | 		align-items: center; | 
					
						
							|  |  |  | 		justify-content: space-between; | 
					
						
							| 
									
										
										
										
											2024-08-16 18:26:19 +08:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2024-09-23 17:41:41 +08:00
										 |  |  | </style> |