<template>
<div class="game">
    <div class="game-box">
		<div class="img-yqjl">
			<img src="./img/yqjl.png" @click="showInvitationRecord()"/>
		</div>
		
		<div class="logo">logo</div>
		<img src="./img/zhuti.png" class="img-zhuti">
		<div class="btn-div">
			<button @click="showPrize()">领取红包</button>
			<div class="rule-btn" @click="showRule()">查看邀请规则></div>
		</div>
    </div>
    <!-- 中奖 -->
    <div class="mask" v-show="prizeMask">
		<div class="w-prize">
			<img src="./img/gxn.png" class="gxn">
			<div class="prize-hbinfo">获得￥<span>2.8</span>现金红包</div>
			<div class="prize-info">邀请好友购买产品后</div>
			<div class="prize-hbinfo2">获得￥<span>88</span>现金红包</div>
			<div>
				<button class="yaoqing-btn" @click="showPopup()">邀请好友</button>
			</div>
		</div>
		<div class="clear-div">
			<span class="clear" @click="clear()"></span>
		</div>
	</div>
	<!-- 规则 -->
    <div class="mask" v-show="ruleMask">
		<div class="rule-box">
			<div class="clear-gz">
				<img src="./img/hdgz.png" class="tc-icon">
				<span class="clear" @click="clear()"></span>
			</div>
			<img src="./img/gz.png" class="gz-title">
			<div class="rule-info">
				<h4>活动时间</h4>
				<p>2020/03/24</p>
				<h4>活动范围</h4>
				<p>全国（不包括港澳台地区）</p>
				<h4>活动范围</h4>
				<p>一等奖</p>
				<p>二等奖</p>
				<p>三等奖</p>
			</div>
		</div>
	</div>
	<!-- 邀请记录 -->
    <div class="mask" v-show="yaoqingMask">
		<div class="rule-box">
			<div class="clear-gz">
				<img src="./img/yqjl.png" class="tc-icon">
				<span class="clear" @click="clear()"></span>
			</div>
			<img src="./img/gz.png" class="gz-title">
			<div class="rule-info">
				<div class="item">
					<div class="item-left">
						<p class="title">差一点是帅哥</p>
						<p class="time">2020.02.21 9:45</p>
					</div>
					<div class="item-right">已购酒</div>
				</div>
				<div class="item">
					<div class="item-left">
						<p class="title">差一点是帅哥</p>
						<p class="time">2020.02.21 9:45</p>
					</div>
					<div class="item-right">已购酒</div>
				</div>
				<div class="item">
					<div class="item-left">
						<p class="title">差一点是帅哥</p>
						<p class="time">2020.02.21 9:45</p>
					</div>
					<div class="item-right">已购酒</div>
				</div>
				<div class="item">
					<div class="item-left">
						<p class="title">差一点是帅哥</p>
						<p class="time">2020.02.21 9:45</p>
					</div>
					<div class="item-right">已购酒</div>
				</div>
				<div class="item">
					<div class="item-left">
						<p class="title">差一点是帅哥</p>
						<p class="time">2020.02.21 9:45</p>
					</div>
					<div class="item-right">已购酒</div>
				</div>
			</div>
		</div>
	</div>
    <mt-popup
	v-model="popupVisible"
	:closeOnClickModal="false"
	position="bottom"
	style="width:100%">
		<div class="popup-box">
			<div class="popup-top">
				<div class="invitation-title">
					<div class="replication-success" v-show="replication">链接复制成功</div>
					<img src="./img/yq.png" style="width:.9rem;">
					<span>选择邀请方式</span>
				</div>
				<div class="cl invitation-method">
					<div class="link-div">
						<img src="./img/sharelink.png" class="share-img" @click="sharelink()">
						<p>链接邀请</p>
					</div>
					<div class="poster-div">
						<img src="./img/sharebao.png"  class="share-img" @click="showHaibao()">
						<p>海报邀请</p>
					</div>
				</div>
			</div>
			<div class="popup-bottom" @click="clear()">取消</div>
		</div>
	</mt-popup>
	<!-- 海报 -->
	<div class="share-poster" v-show="showPoster">
		<img src="./img/haibao.png" alt="">
		<p class="share-poster-txt">保存海报并分享给你的好友吧</p>
	</div>
</div>
</template>

<script>
import { Toast } from "mint-ui";
import apiHelper from "@/assets/js/apiHelper.js";
import { Indicator } from "mint-ui";
import ut from "@/assets/js/utils.js";

export default {
	name: "customerRecommendation",
	props: ["comp", "cfg", "selectedPage"],
	data() {
		return {
			popupVisible:false,
			replication:false,//链接复制
			showPoster:false,
			prizeMask:false,
			ruleMask:false,
			yaoqingMask:false,
			guajiangFlag:false //防止多次刮奖
		};
	},
	created: function() {
		// var that = this;
		// this.mergeCompProps(this.comp);

		switch (this.sup8.env) {
			case this.sup8._def.env.design:
				this.env = "设计器模式";
				this.envType = "design";
				break;
			case this.sup8._def.env.preview:
				this.env = "预览模式";
				break;
			case this.sup8._def.env.run:
				this.env = "运行模式";
				break;
			default:
				break;
		}
	},
	mounted() {
	},
	methods: {
		sharelink(){
			this.replication = true;
			setTimeout(()=>{
				this.replication = false;
			},1500);
		},
		showHaibao(){
			this.popupVisible = false;
			this.showPoster = true;
		},
		showPopup(){
			this.popupVisible = true;
			this.prizeMask = false;
		},
		showRule(){
			this.ruleMask=true;
		},
		showInvitationRecord(){
			this.yaoqingMask=true;
		},
		clear(){
			this.prizeMask = false;
			this.ruleMask = false;
			this.popupVisible = false;
			this.yaoqingMask = false;
		},
		showPrize(){
			this.prizeMask = true;
		}
	}
};
</script>

<style scoped>
.game{
  min-height: 100vh;
  background-color: #534499;
  background-image: url("./img/bg.png");
  background-repeat: no-repeat;
  background-size: 100%;
}
.img-yqjl{
	padding: 1rem 1rem;
	text-align: right;
}
.img-yqjl img{
	width: 5rem;
}
.img-bg {
	box-sizing: border-box;
	width: 100%;
	overflow: hidden;
	z-index: 1;
}
.guaguale-box {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
}
.logo{
	text-align: center;
	margin: 0 auto;
	color: #fff;
	font-size: 1.5rem;
}
.img-zhuti{
	display: block;
	width: 70%;
	margin: 0 auto 1.5rem;
}
.btn-div{
	position: absolute;
	width: 100%;
	left: 0;
	bottom: 4rem;
	text-align: center;
	color: #fff;
}
.btn-div button{
	width: 70%;
	height: 2.8rem;
	border-radius: 2.8rem;
	background: linear-gradient(#ffe983, #fbc35a,#f7803a);
	border: none;
	font-size: 1.1rem;
	margin-bottom: 1rem;
	color: #fff;
}
.rule-btn{
	color: #fff;
	font-size: .9rem;
}
.rule-icon{
	display: inline-block;
	width: 0.9rem;
  	height: 1rem;
	/* background: url("./img/gzicon.png"); */
	background-size: 100% 100%;
	color: #7a0409;
	vertical-align: top;
}

.rule {
  position: absolute;
  width: 100%;
  top: 78%;
  text-align: center;
  font-size: 0.9rem;
  color: #404040;
}
.mask {
  position: fixed;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 10000;
}
.w-prize {
  position: fixed;
  padding: 3rem 4rem 0 4rem;
  top: 50%;
  left: 50%;
  width: 20rem;
  height: 20rem;
  margin-left: -10rem;
  margin-top: -10rem;
  background: url("./img/prizebg.png") no-repeat;
  background-size: 100% 100%;
  z-index: 10001;
  box-sizing: border-box;
  text-align: center;
  color: #fff;
}
.gxn{
	width: 8rem;
	display: block;
	margin: 0 auto 1.5rem auto;
}
.prize-hbinfo{
	margin-bottom: 1rem;
	font-size: .8rem;
	color: #ffff8c;
}
.prize-hbinfo span{
	font-size: 1.5rem;
}
.prize-info{
	margin-bottom: 2.5rem;
	font-size: .9rem;
	color: #ffe5c4;
}
.prize-hbinfo2{
	margin-bottom: 2rem;
	font-size: .9rem;
	color: #ffff8c;
}
.prize-hbinfo2 span{
	font-size: 2rem;
}
.prize-info{
	margin-bottom: 1rem;
	font-size: .9rem;
	color: #ffe5c4;
}
.yaoqing-btn{
	width: 90%;
	height: 2rem;
	border-radius: 2rem;
	color: #fff;
	background: linear-gradient(#ffff8c, #f4c66a,#e98c49);
	border: none;
	font-size: 1rem;
}
.clear-div{
	padding: 1rem;
	text-align: right;
}
.tc-icon{
	float: left;
	width: 6rem;
}
.clear{
	float: right;
	width: 1.5rem;
	height: 1.5rem;
	/* display: inline-block; */
	background: url("./img/x.png");
	background-size: 100% 100%;
}
.rule-box{
	position: fixed;
	top: 50%;
	left: 50%;
	width: 80%;
	height: 30rem;
	margin-left: -40%;
	margin-top: -15rem;
	background-size: 100%;
	z-index: 10001;
	box-sizing: border-box;
	border: 3px solid #fed148;
	border-radius: 5px;
	background: #fff;
}
.clear-gz{
	position:absolute;
	padding: .8rem;
	top:0;
	left:0;
	width: 100%;
	text-align: right;
	box-sizing: border-box;
}
.gz-title{
	width: 100%;
}
.rule-info{
	padding: 0 .8rem;
	height: 23rem;
	overflow-y: scroll;
}
.item{
	padding: 1rem 0;
	border-bottom: 1px solid #ddd;
	overflow: hidden;
}
.item .item-left{
	width: calc(100% - 3rem);
	float: left;
}
.item .item-left .title{
	font-weight: bold;
	font-size: 1rem;
}
.item .item-left .time{
	color: #999;
	font-size: .9rem;
}
.item .item-right{
	float: left;
	width: 3rem;
	line-height: 3.5rem;
	text-align: right;
	color: #f9cb06;
}
.popup-box{
	width: 100%;
	background: #f3f6ff;
}
.invitation-title{
	position: relative;
}
.replication-success{
	position:absolute;
	top: 0;
	left: 0;
	width: 100%;
	background: #373636;
	line-height: 2rem;
	border-radius: 2rem;
	color: #fff;
	text-align: center;
}
.popup-top{
	padding: 1rem 2rem;;
	margin-bottom: 1rem;
	background: #fff;
}
.invitation-method{
	padding-top: 1.5rem;
}
.popup-bottom{
	padding: .8rem;
	background: #fff;
	text-align: center;
}
.link-div,.poster-div{
	width: 50%;
	float: left;
	text-align: center;
}
.share-img{
	width: 4rem;
}
.share-poster{
	position: fixed;
	top: 0;
	left: 0;
	background: #534499;
	overflow-y: auto;
	z-index: 3000;
	height: 100vh;
}
.share-poster img{
	width: 100%;
}
.share-poster-txt{
	padding-bottom: 1rem;
	text-align: center;
	color: #fff;
}
</style>
