<template>
	<view class="water">
		<view class="bg-box">
			<image class="bg" src="https://zswl-dev.oss-cn-chengdu.aliyuncs.com/63b7c68b71a69169d1b33f92/store/bdb/user/avatar/P2up4p3ELZAH766942076ec3d579665764a3355f5ec7.png/1.png" mode=""></image>
			<view class="btn" @click="handleBtn">
				立即领取
			</view>
		</view>

		<view class="content">
			<image class="title" src="../static/water-title.png" mode=""></image>
			<view class="rule">
				1.该活动仅限本平台会员中国移动用户专享。
			</view>

			<view class="rule">
				2.本活动每位会员（手机号所绑定会员）仅限领取一桶原价18元的贵州泉品质桶桶装饮用水。
			</view>

			<view class="rule">
				3.本活动桶装水免费领取，但空桶需缴纳押金，待桶回收后押金可退，若继续订购则无需再次缴纳空桶押金。
			</view>
		</view>
		<!-- <web-view v-if="showWeb" @load="loadedPage" src="https://wechat.gzqspring.ltd/#/coupon_receive_index?ID=17"></web-view> -->
	</view>
</template>

<script>
	import {
		qrcode
	} from '@/api/common.js';
	export default {
		data() {
			return {
				showWeb: false,
				src: '',
				test: ''
			}
		},
		methods: {
			handleBtn() {
				if(uni.getStorageSync('token')){
					if(JSON.parse(uni.getStorageSync('userInfo')).setMealCode != 0){
						uni.navigateToMiniProgram({
							appId:'wx63342614cf0af2f7',
							path:'pages/webview/webview?url=https%3A%2F%2Fwechat.gzqspring.ltd%2F%23%2Fcoupon_receive_index%3FID%3D17'
						})
					}else{
						uni.showModal({
							title:'此商品需要开通会员才能购买',
							cancelText:'下次再说',
							confirmText:'立即开通',
							success(res) {
								if(res.confirm){
									uni.navigateTo({
										url:'/my/memberCenter/index'
									})
								}
							}
						})
					}
					
				}else{
					return uni.showModal({
						title:'请登录',
						confirmText:'去登录',
						success(res){
							if(res.confirm){
								uni.navigateTo({
									url:'/login/login/login?redirect=/special/water'
								})
							}
						}
					})
				}
				// this.showWeb = true
				// uni.showLoading({
				// 	title:'加载中'
				// })
				// uni.setClipboardData({
				// 	data: 'bf3452e12c4146025894ce8c1a707c31',
				// 	showToast:false,
				// 	success: function () {
				// 		uni.showModal({
				// 			title:'领取成功',
				// 			content:'兑换码已复制到剪切板，到贵州泉小程序粘贴兑换码兑换',
				// 			showCancel:false,
				// 			success(){
				// 				uni.navigateToMiniProgram({
				// 					appId:'wx63342614cf0af2f7',
				// 					path:'pages/webview/webview?url=https%3A%2F%2Fwechat.gzqspring.ltd%2F%23%2Fcoupon_receive_index%3FID%3D17'
				// 				})
				// 			}
				// 		})
						
				// 	}
				// });
				
			},
			loadedPage(){
				uni.hideLoading()
			},
			onmessage(val){
				console.log(val);
			}
		},
		 created() {
			
			

			
		},
	
	
	}
</script>

<style lang="scss" scoped>
	.water {
		.bg-box {
			position: relative;

			.bg {
				width: 100%;
				height: 716rpx;
			}

			.btn {
				width: 360rpx;
				line-height: 80rpx;
				text-align: center;
				background: linear-gradient(180deg, #0F615C 0%, #0E6F51 100%);
				border-radius: 40rpx 40rpx 40rpx 40rpx;
				font-weight: bold;
				color: #FFFFFF;
				font-size: 32rpx;
				position: absolute;
				left: 50%;
				bottom: 20rpx;
				transform: translate(-50%, 50%);
			}
		}

		.content {
			.title {
				margin: 72rpx auto 0;
				width: 350rpx;
				height: 48rpx;
				display: block;
			}

			.rule {
				margin-top: 24rpx;
				font-size: 24rpx;
				color: #222222;
				line-height: 40rpx;
				padding: 0 24rpx;
			}
		}

		.img {
			width: 300rpx;
			height: 300rpx;
		}
	}
</style>