<template>
	<view class="lotteryIndex">
		<loadlogo v-if="loadlogo"></loadlogo>
		<view class="title" :style="{ width: imgstyle.width + 'px', height: (!!lotteryInfo.adv && lotteryInfo.adv.length > 0)?imgstyle.height + 'px':'35px' }" >
			<swiper class="swiper" v-if="!!lotteryInfo.adv && lotteryInfo.adv.length > 0"  indicator-color="rgba(255,255,255,.4)" indicator-active-color="rgba(255,255,255,.85)" :indicator-dots="true" :autoplay="true" :interval="2000" :duration="500">
				<swiper-item v-for="(item, index) in lotteryInfo.adv" :key="index" @click="goLink(item.link)">
					<image :src="item.thumb" style="width: 100%; height: 100%;" mode="scaleToFill"></image>
				</swiper-item>
			</swiper>
			<view class="countDown" v-if="lotteryInfo.supstatus == 0&& !!time.timeobj">
				<view class="tag"></view>
				<view class="tagText">距离开奖</view>
				<view class="numberBox">{{time.timeobj.day1}}</view>
				<view class="numberBox">{{time.timeobj.day2}}</view>
				<view class="day">天</view>
				<view class="numberBox">{{time.timeobj.hous1}}</view>
				<view class="numberBox">{{time.timeobj.hous2}}</view>
				<view class="douhao">:</view>
				<view class="numberBox">{{time.timeobj.min1}}</view>
				<view class="numberBox">{{time.timeobj.min2}}</view>
				<view class="douhao">:</view>
				<view class="numberBox">{{time.timeobj.sin1}}</view>
				<view class="numberBox" style="margin: 0;">{{time.timeobj.sin2}}</view>
			</view>
			<view class="countDown" v-else>
				<view class="tag" style="background-color: #398CFF;"></view>
				<view class="tagText">剩余人数</view>
				<view class="day f-w">还差</view>
				<view class="bnumberBox" v-for="(item,index) in time.timeobj" :key="index">{{item}}</view>
				<view class="day f-w">人次开奖，敬请期待！</view>
			</view>
		</view>
		<view class="barrage" :class="{tipsShow:tipsShow}" v-if="lotteryInfo.luckylist.length > 0 && barrageIndex == index" v-for="(item,index) in lotteryInfo.luckylist" :key="index">
			<image :src="item.avatar" mode=""></image>
			<view class="barrageText">
				<text style="padding-right: 10upx;">{{item.nickname}}</text>
				<text style="padding-right: 10upx;">抽中</text>
				<text>{{item.goodsname}}</text>
			</view>
		</view>
		<view class="content">
			<view class="award">
				<view class="commodityList">
					<view class="commodityItem" v-for="(item,index) in lotteryInfo.prize" :key="index">
						<image class="grade" :src="imgfixUrls + 'lotteryImg/fone.png'" mode="" v-if="index == 0"></image>
						<image class="grade" :src="imgfixUrls + 'lotteryImg/ftwo.png'" mode="" v-if="index == 1"></image>
						<image class="grade" :src="imgfixUrls + 'lotteryImg/fthree.png'" mode="" v-if="index == 2"></image>
						<image :src="item.image" mode=""></image>
						<view class="commodityName">
							{{item.title}}
						</view>
						<view class="awardNum">
							{{item.number}}份奖品
						</view>
					</view>
				</view>
				<view class="publicityText">
					{{lotteryInfo.tips}}
				</view>
				<view class="participationNumber">
					<view class="imgbox">
						<image class="clientTitle" :src="item.avatar" mode="" v-for="(item,index) in lotteryInfo.headlist" :key="index"></image>
					</view>
					<view class="numberText">
						{{lotteryInfo.joinnum}}人次正在参与
					</view>
				</view>
			</view>
			<view class="winner" v-if="!!codes && codes.length > 0">
				<view class="switchover">
					<v-tabs
						:lineScale="0.3" 
						:lineRadius="'4px 4px 0px 0px'" 
						:lineHeight="'6rpx'"
						:height="'100rpx'"
						:fontSize="'30rpx'"
						:activeFontSize="'30rpx'"
						:paddingItem="'40rpx 22rpx 40rpx'" 
						:activeColor="'#ff4444'" 
						:lineColor="'#ff4444'"
						v-model="sort" 
						@change="changeTab"
						:scroll="false"
						:bold="false"
						:tabs="tabsList"></v-tabs>
				</view>
				<view class="winnerText">
					中奖者名单({{codesMumber}}人)
				</view>
				<view class="winnerList">
					<view class="winnerItem"  v-for="(item,index) in codes" :key="index">
						<view class="winnerImg">
							<image :src="item.avatar" mode=""></image>
							<view class="ibox" v-if="item.own == 1">
								我
							</view>
						</view>
						<view class="winnerName">
							{{item.nickname}}
						</view>
						<view class="winnerCode">
							{{item.codenum}}
						</view>
					</view>
				</view>
			</view>
			<view class="LotteryYards" v-if="!!lotteryInfo.mycode && lotteryInfo.mycode.length > 0">
				<view>
					<text class="col-3 f-32 f-w">我的抽奖码</text>
					<text class="col-f4 f-24">({{!!lotteryInfo.mycode && lotteryInfo.mycode.length > 0?lotteryInfo.mycode.length:0}}张)</text>
				</view>
				<view class="LotteryYardsList">
					<view class="yardsItem" 
					:style="{background:'url('+ imgfixUrls + 'lotteryImg/jinkuang.png)',backgroundSize: '100% 100%',backgroundRepeat: 'no-repeat'}" 
					v-for="(item,index) in lotteryInfo.mycode" :key="index" v-if="index < 8">
						{{item.codenum}}
					</view>
					<view class="yardsItem textmroe" @click="goCodeList" v-if="lotteryInfo.mycode.length > 9"
					:style="{background:'url('+ imgfixUrls + 'lotteryImg/yinkang.png)',backgroundSize: '100% 100%',backgroundRepeat: 'no-repeat'}">
						查看更多
					</view>
				</view>
			</view>
			<view class="merchandiseList" v-if="!!lotteryInfo.buygoodslist && lotteryInfo.buygoodslist.length > 0">
				<view class="f-32 f-w col-3 m-btm30">
					购买商品获得抽奖码
				</view>
				<view  v-for="(item,index) in lotteryInfo.buygoodslist" :key="index">
					<draw-commodity :goodItem="item"></draw-commodity>
				</view>
				<view class="f-24 col-9 t-c" @click="goshoping">
					<text>查看更多</text>
					<text style="font-size: 24upx;" class="iconfont icon-unfold"></text>
				</view>
			</view>
			<view class="richText">
				<view class="f-32 f-w col-3 m-btm30">
					抽奖说明
				</view>
				<view v-if="lotteryInfo.detail">
					<jyf-parser  domain="https://6874-html-foe72-1259071903.tcb.qcloud.la" gesture-zoom lazy-load ref="article"
					 selectable showWithAnimation show-with-animation use-anchor :html="lotteryInfo.detail"></jyf-parser>
				</view>
			</view>
		</view>
		<view class="more" >
			<view class="dis-flex flex-box">
				<view class="flex-box t-c" @click="goIndex">
					<image :src="imgfixUrls + 'lotteryImg/home.png'" mode=""></image>
					<view class="f-20 col-3">
						首页
					</view>
				</view>
				<view class="flex-box t-c" @click="goCodeList">
					<image :src="imgfixUrls + 'lotteryImg/LotteryYards.png'" mode=""></image>
					<view class="f-20 col-3">
						抽奖码
					</view>
				</view>
				<view class="flex-box t-c" @click="goPrevious">
					<image :src="imgfixUrls + 'lotteryImg/previous.png'" mode=""></image>
					<view class="f-20 col-3">
						往期
					</view>
				</view>
			</view>
			<view class="moreBtn" @click="openshow" v-if="lotteryInfo.status == 0">
				获取更多抽奖码
			</view>
			<view class="nomoreBtn" @click="openshow" v-else>
				{{lotteryInfo.status == 1?'活动即将抽奖,敬请期待':'抽奖已结束,请关注其他活动'}}
			</view>
		</view>
		<!-- //弹窗 -->
		<PopManager :show="showRule" type="bottom" @clickmask="showRule = false">
			<view class="popShareBox">
				<view class="classShare">
					<view class="classItem" @click="goshoping" v-if="!!lotteryInfo.buygoodslist && lotteryInfo.buygoodslist.length > 0">
						<image :src="imgfixUrls + 'lotteryImg/shoping.png'" mode=""></image>
						<view class="className">
							购买商品
						</view>
					</view>
					<!-- #ifdef MP-WEIXIN -->
					<view class="classItem" v-if="lotteryInfo.drawvideostatus == 1" @click="videoDarw">
						<image :src="imgfixUrls + 'lotteryImg/lookvideo.png'" mode=""></image>
						<view class="className">
							视频广告
						</view>
					</view>
					<view class="classItem" v-if="lotteryInfo.drawsharestatus == 1 && lotteryInfo.nomobile == 1" @click="openShare">
						<image :src="imgfixUrls + 'lotteryImg/shareDraw.png'" mode=""></image>
						<view class="className">
							好友分享
						</view>
					</view>
					<button open-type="share" class="classItem" v-else-if="lotteryInfo.drawsharestatus == 1 && lotteryInfo.nomobile != 1">
						<image :src="imgfixUrls + 'lotteryImg/shareDraw.png'" mode=""></image>
						<view class="className">
							好友分享
						</view>
					</button>
					<!-- #endif -->
					<!-- #ifdef H5 -->
					<view class="classItem" v-if="lotteryInfo.drawsharestatus == 1" @click="openShare">
						<image :src="imgfixUrls + 'lotteryImg/shareDraw.png'" mode=""></image>
						<view class="className">
							好友分享
						</view>
					</view>
					<!-- #endif -->
					
				</view>
				<view class="close" @click="showRule = false">
					关闭
				</view>
			</view>
		</PopManager>
		<!-- #ifdef H5 -->
		<PopManager :show="shareShow" :type="'top'" @clickmask="shareShow = false">
			<cover-view>
				<cover-image :src="imageRoot + 'share.png'" class="coverImg"></cover-image>
			</cover-view>
		</PopManager>
		<!-- #endif -->
		<!-- 获奖样式 -->
		<PopManager :show="winner" :type="'center'" :overlay="'false'" :showOverlay="'false'" @clickmask="winner = false">
			<view class="zjbj" :style="{background: 'url('+ (imgfixUrls + '/kjbj2.png') +')',backgroundSize: '100% 100%'}">
				<!-- <image style="width: 70vw;height: 80vh;" :src="imgfixUrls + '/kjbj.png'" mode=""></image> -->
				<text class="iconfont icon-close dis-il-block t-c f-w closeBtn" @click="winner = false"></text>
				<!-- <view class="contenttitle t-c">
					<view class="text" v-if="endid !== '0' && endid !== 0">
						中奖啦
					</view>
					<view class="text" v-else>
						谢谢惠顾
					</view>
				</view> -->
				<view class="zjbox" style="margin: auto;" v-if="winner">
					<view class="f-w f-48 t-c" style="color: #FB2F24;padding-bottom: 36upx;">
						{{lotteryInfo.mycodestatus == 2?'一等奖':lotteryInfo.mycodestatus == 3?'二等奖':'三等奖'}}
					</view>
					<view >
						<image style="border-radius: 50%;height: 240upx;width: 240upx;margin-left: 20vw;border: 2upx solid #FFC853;" :src="lotteryInfo.mygoodslogo"
						 mode=""></image>
					</view>
					<view  style="padding:20upx 0 50upx;">
						<!-- <view class="col-f f-38" style="text-align: center;">
							{{}}
						</view> -->
		
						<view class="col-f f-40 " style="text-align: center;margin-bottom: 10upx;">
							<text style="color: #E5492C;">{{'恭喜你获得了'}}</text>
						</view>
						<view class="col-f f-50 t-c" style="text-align: center;">
							<text style="color: #FF2D26;">{{lotteryInfo.mygoodstitle}}</text>
						</view>
					</view>
					<view class="dis-flex">
						<view  style="flex: 0.45;position: relative;height: 90upx;">
							<!-- <view class="t-c f-34" style="background-color: #EB9B2F;color: #FFFFFF;padding: 15upx 30upx;border-radius: 10upx;margin-top: 30upx;"
							 >
								查看奖品
							</view> -->
							<image style="width: 250upx;height: 90upx;" :src="imgfixUrls + '/hsbtn.png'" mode=""></image>
							<view @click="myprize" class="f-32 t-c" style="position: absolute;left: 0;top: 0;height: 90upx;line-height: 80upx;width: 250upx;color: #FF3D25;">
								查看奖品
							</view>
						</view>
						<view  style="flex: 0.1;width: 30upx;">
		
						</view>
						<view class="f-34" style="flex: 0.45;position: relative;height: 90upx;">
							<!-- <view class="t-c" style="background-color: #EB9B2F;color: #FFFFFF;padding: 15upx 30upx;border-radius: 10upx;margin-top: 30upx;"
							 @click="close(1)">
								继续抽奖
							</view> -->
							<image style="width: 250upx;height: 90upx;" :src="imgfixUrls + '/cjredbtn.png'" mode=""></image>
							<view @click="getMyPrize(lotteryInfo.mycodeid)" class="f-32 t-c" style="position: absolute;left: 0;top: 0;height: 90upx;line-height: 80upx;width: 250upx;color: #FFFFFF;">
								领取奖品
							</view>
						</view>
					</view>
				</view>
			</view>
		
		</PopManager>
		<PhoneMask :show1="popShow" @clickmask1="closePop"></PhoneMask>
		<getvxphone :show="vxshow" @showFalse="showFalse"></getvxphone>
	</view>
</template>

<script>
	import App from "@/common/js/app.js"
	import drawCommodity from '@/components/template/drawCommodity.vue';
	import loadlogo from '@/components/template/loadlogo';
	import follow from '@/components/template/follow.vue';
	import PopManager from '@/components/template/PopManager';
	import jyfParser from '@/components/jyf-parser/jyf-parser.vue';
	import PhoneMask from '@/components/template/PhoneMask';
	import getvxphone from '@/components/template/getVXphone.vue';
	import vTabs from '@/components/v-tabs/v-tabs.vue'
	// #ifdef H5
	import wxApi from '@/common/js/wxApi.js';
	//#endif
	export default{
		data(){
			return{
				imgstyle:{},
				swiperList:[1,2,3],
				text:'',
				sort:0,
				popShow: false,
				vxshow:false,
				showRule:false,
				loadlogo:true,
				lotteryInfo:{},
				time:{},
				barrageIndex:0,
				barr:null,
				timeout:null,
				tipsShow:false,
				videoAd:null,
				codes:[],
				codesMumber:0,
				shareShow:false,
				winner:false,
				pluginList:[
					{
						type:'rush',
						title:'抢购'
					},
					{
						type:'groupon',
						title:'团购'
					},
					{
						type:'fightgroup',
						title:'拼团'
					},
					{
						type:'coupon',
						title:'卡券'
					},
					{
						type:'bargain',
						title:'砍价'
					},
					{
						type:'activity',
						title:'活动'
					},
					{
						type:'payonline',
						title:'买单'
					},
					{
						type:'citydelivery',
						title:'配送'
					},
					{
						type:'drawvideo',
						title:'视频'
					},
					{
						type:'drawshare',
						title:'分享'
					},
					{
						type:'store',
						title:'商户'
					},
					{
						type:'wlfightgroup',
						title:'拼团'
					}
				],
				recordid:'',
				pageId:'',
				userInfo:{},
				tabsList:['一等奖','二等奖','三等奖'],
				lat:'',
				lng:''
			}
		},
		components:{
			drawCommodity,
			loadlogo,
			follow,
			PopManager,
			jyfParser,
			PhoneMask,
			getvxphone,
			vTabs
		},
		onLoad(e) {
			this.imgstyle = uni.getStorageSync('imgstyle');
			this.userInfo = uni.getStorageSync('userinfo');
			this.recordid = e.recordid || '';
			this.pageId = e.id || '';
			this.head_id = e.head_id || '';
			let myLocation = uni.getStorageSync('curLoction');
			this.lng = myLocation.longitude || '';
			this.lat = myLocation.latitude || '';
			
			// if(e.head_id){
				
			// }
			
		},
		onShow() {
			this.getLotteryInfo();
		},
		methods:{
			openshow(){
				let _this = this;
				let token = uni.getStorageSync('weliam_user_token');
				if (token) {
					_this.showRule = true;
				}else{
					//#ifdef H5
					// _this.popShow = true;
						// App.doLogin();
					//#endif
					//#ifndef H5
					App.doLogin();
					App.loginstate = true;
					//#endif
					return
				}
			},
			getMyPrize(id){
				let _this = this;
				App._post_form('&p=luckydraw&do=getDrawGoods', {
					id:id
				}, res => {
					if(JSON.stringify(res.data) == '[]'){
						uni.showToast({
							icon:'success',
							title:'领取成功'
						})
						_this.winner = false;
					}else{
						let buy_barginData = {
								goods_id: res.data.goodsid,
								plugin: res.data.plugin,
								luckydrawid:id,
								goods_num: 1
							};
						App.navigationTo({
							url: 'pages/subPages/submitOrder/submitOrder?' + App.urlEncode(buy_barginData)
						});
					}
					
				}, false, () => {
					// _this.loadlogo = false;
				})
			},
			myprize(){
				App.navigationTo({
					url:'pages/subPages2/lottery/lotteryCode/lotteryCode?type=2'
				})
			},
			showFalse(flag){
				console.log('进了showfalse')
				this.vxshow = false;
				if(flag){
					_this.lotteryInfo.nomobile = 0;
				}
			},
			closePop(flag) {
				let _this = this
				_this.popShow = false;
				if(flag){
					_this.lotteryInfo.nomobile = 0;
				}
			},
			goIndex(){
				uni.reLaunch({
				    url: '/pages/mainPages/index/index'
				});
			},
			goCodeList(){
				App.navigationTo({
					url:'pages/subPages2/lottery/lotteryCode/lotteryCode'
				})
			},
			goPrevious(){
				App.navigationTo({
					url:'pages/subPages2/lottery/previous/previous?id=' + this.pageId
				})
			},
			openShare(){
				let _this = this;
				if (_this.lotteryInfo.nomobile == 1) {
					//#ifdef H5
					_this.popShow = true;
					//#endif
					//#ifndef H5
					_this.vxshow = true;
					//#endif
					return
				}
				this.shareShow = true;
			},
			goshoping(){
				let _this = this;
				App.navigationTo({
					url:'pages/subPages2/lottery/lotteryList/lotteryList?id=' + _this.pageId
				})
			},
			videoDarw(){
				let _this = this;
				if (_this.lotteryInfo.nomobile == 1) {
					//#ifdef H5
					_this.popShow = true;
					//#endif
					//#ifndef H5
					_this.vxshow = true;
					//#endif
					return
				}
				this.videoAd.show();
			},
			//看视频获取分享次数
			getVideoNum(){
				let _this = this;
				App._post_form('&p=luckydraw&do=getVideoCode', {
					id:_this.pageId,
					recordid:_this.lotteryInfo.recordid
				}, res => {
					uni.showToast({
						title:'抽奖码领取成功'
					})
					this.getLotteryInfo(true);
				}, false, () => {
					_this.loadlogo = false;
				})
			},
			//分享获取抽奖次数
			getDrawNum(sharemid,recordid){
				let _this = this;
				App._post_form('&p=luckydraw&do=getShareCode', {
					sharemid:sharemid,
					recordid:_this.lotteryInfo.recordid
				}, res => {
					_this.head_id = '';
					this.getLotteryInfo(true);
				}, false, () => {
					// _this.loadlogo = false;
				})
			},
			getShareInfo() {
				//#ifdef H5
				let	url = location.href,
					head_id = uni.getStorageSync('userinfo').mid;
					url = url.split('/#/')[1] + '&sharemid=' + head_id + '&recordid=' + this.lotteryInfo.recordid;
				//#endif
				//#ifdef MP-WEIXIN
				//#endif
				let _this = this,
					data = {
						pageinfo: url
					};
				App._post_form('&do=Shareinfo', data, res => {
					this.shareinfo = res.data;
					//#ifdef H5
					wxApi.wxRegister(() => {
						wxApi.wxShare({
							title: this.shareinfo.title || '',
							desc: this.shareinfo.desc || '',
							link: this.shareinfo.mpurl || '',
							imgUrl: this.shareinfo.img || '',
							success: function() {
							},
							trigger: function(res) {
								// _this.isshare();
							},
							cancel: function() {}
						});
					});
					//#endif
				})
			},
			getLotteryInfo(flag = false){
				let _this = this;
				App._post_form('&p=luckydraw&do=drawPageInfo', {
					id:_this.pageId,
					recordid:_this.recordid,
					lat:_this.lat,
					lng:_this.lng
				}, res => {
					_this.lotteryInfo = res.data;
					if(_this.head_id){
						_this.getDrawNum(_this.head_id);
						// return
					}
					_this.lotteryInfo.buygoodslist.map(item=>{
						_this.pluginList.map(it=>{
							if(item.plugin == it.type){
								item.pluginName = it.title;
							}
						})
					})
					if(res.data.onecodenum){
						_this.codesMumber = _this.lotteryInfo.onecodenum;
						_this.codes = _this.lotteryInfo.onecodes;
					};
					if(_this.lotteryInfo.mycodeid > 0 && !flag){
						_this.winner = true;
					}
					_this.tabsList = !res.data.twocodenum && !res.data.thrcodenum?['一等奖']:res.data.twocodenum && !res.data.thrcodenum?['一等奖','二等奖']:!res.data.twocodenum && res.data.thrcodenum?['一等奖','三等奖']:['一等奖','二等奖','三等奖']
					// #ifdef MP-WEIXIN
					// 在页面中定义激励视频广告
					// 在页面onLoad回调事件中创建激励视频广告实例
					if (wx.createRewardedVideoAd && !_this.videoAd) {
					  _this.videoAd = wx.createRewardedVideoAd({
					    adUnitId: _this.lotteryInfo.videoid
					  })
					  _this.videoAd.onLoad(() => {})
					  _this.videoAd.onError((err) => {
						  
					  })
					  _this.videoAd.onClose((res) => {
						  if (res && res.isEnded) {
						        // 正常播放结束，可以下发游戏奖励
								_this.getVideoNum()
						      } else {
						        // 播放中途退出，不下发游戏奖励
						      }
					  })
					}
					// #endif
					// clearInterval(_this.barr)
					clearInterval(_this.barrb)
					_this.barrb = setInterval(()=>{
						_this.tipsShow = true;
						setTimeout(()=>{
							_this.tipsShow = false;
							if(_this.barrageIndex == _this.lotteryInfo.luckylist.length - 1){
								_this.barrageIndex = 0;
							}else{
								_this.barrageIndex++;
							}
						},3000)
					},5000)
					//#ifdef H5
					// _this.getShareInfo()
					//#endif
					if(_this.lotteryInfo.supstatus == 1){
						// _this.$set(_this.time, 'timeobj', timeobj)
						let timeobj = [];
						_this.lotteryInfo.supnum = _this.lotteryInfo.supnum + '';
						let length = _this.lotteryInfo.supnum.length;
						for(let i = 0;i<length;i++){
							timeobj[i] = _this.lotteryInfo.supnum[i];
						}
						_this.$set(_this.time, 'timeobj', timeobj)
					}else{
					clearInterval(_this.timeout)
					_this.timeout = setInterval(function() {
						if(_this.lotteryInfo.supnum > 0){
							_this.lotteryInfo.supnum = _this.lotteryInfo.supnum - 1;
						}else{
							_this.getTimeData(_this.lotteryInfo.supnum);
							return
						}
						_this.getTimeData(_this.lotteryInfo.supnum);
							// if (timer_num == 0) {
							// 	clearInterval(timeClock);
							// }
						}, 1000);
					}
					
				}, false, () => {
					_this.loadlogo = false;
				})
			},
			// 时间戳转时间
			getTimeData(dataValue) {
				let _this = this;
				// debugger
				 var date = new Date(Number(dataValue)) //时间戳为10位需*1000，时间戳为13位的话不需乘1000
				        // var Y = date.getFullYear() + '-'
				        // var M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '-'
				        // let day = date.getDate()  + ''
				        // let hous = date.getHours() + ''
				        // let min = date.getMinutes() + ''
				        // let sin = date.getSeconds() + ''
						let day = parseInt(dataValue / (60 * 60 * 24)) + '';
						let hous = parseInt((dataValue % (60 * 60 * 24)) / (60 * 60)) + '';
						let min = parseInt((dataValue % (60 * 60)) / (60)) + '';
						let sin = parseInt((dataValue % (60))) + '';
						day =  day.length == 1?'0' + day:day;
						hous = hous.length == 1?'0' + hous:hous;
						min =  min.length == 1?'0' + min:min;
						sin =  sin.length == 1?'0' + sin:sin;
						let timeobj = {};
						timeobj.day1 =  day[0] < 0?0:day[0]
						timeobj.day2 =  day[1] < 0?0:day[1]
						timeobj.hous1 = hous[0] < 0?0:hous[0]
						timeobj.hous2 = hous[1] < 0?0:hous[1]
						timeobj.min1 = min[0] < 0?0:min[0]
						timeobj.min2 = min[1] < 0?0:min[1]
						timeobj.sin1 = sin[0] < 0?0:sin[0]
						timeobj.sin2 =  sin[1] < 0?0:sin[1]
						_this.$set(_this.time, 'timeobj', timeobj)
						// console.log(_this.time)
						// debugger
				        // return Y+M+D+h+m+s
				        // console.log(timestampToTime (1533293827000))
				// return {
				// 	label: Y + M + D + h + m
				// };
			},
			goLink(url) {
				App.navigationTo({
					url: url
				});
			},
			changeTab(e){
				if(e==0){
					this.codes = this.lotteryInfo.onecodes;
					this.codesMumber = this.lotteryInfo.onecodenum;
				}else if(e==1){
					this.codes = this.lotteryInfo.twocodes;
					this.codesMumber = this.lotteryInfo.twocodenum;
				}else{
					this.codes = this.lotteryInfo.thrcodes;
					this.codesMumber = this.lotteryInfo.thrcodenum;
				}
			}
		},
		onShareAppMessage() {
			let _this = this,
			head_id = uni.getStorageSync('userinfo').mid;
			_this.shareinfo = uni.getStorageSync('shareDataInfo');
			return {
				title: _this.shareinfo.title, // 分享标题
				desc: _this.shareinfo.desc, // 分享描述
				imageUrl:_this.shareinfo.img,
				path: _this.shareinfo.mpurl + '&head_id=' + head_id + '&recordid=' + this.lotteryInfo.recordid + '&id=' +  _this.pageId
			};
		},
		onShareTimeline() {
			let _this = this,
			head_id = uni.getStorageSync('userinfo').mid;
			_this.shareinfo = uni.getStorageSync('shareDataInfo');
			// '&head_id=' + head_id + '&recordid=' + _this.lotteryInfo.recordid;
			let	query = 'head_id=' + head_id + '&recordid=' + _this.lotteryInfo.recordid + '&id=' +  _this.pageId;
			return {
				title: _this.shareinfo.title,  // 分享描述
				imageUrl:_this.shareinfo.img,
				query:query
			};
		},
	}
</script>

<style scoped lang="scss">
	.lotteryIndex{
		padding-bottom: 150upx;
		.popShareBox{
			border-radius: 20upx 20upx 0 0;
			background-color: #ffffff;
			width: 100vw;
			.classShare{
				display: flex;
				padding: 30upx 0;
				
			}
			.close{
				padding: 30upx 0;
				text-align: center;
				font-size: 28upx;
				width: 100%;
				border-top: 1upx solid #EEEEEE;
			}
			.classItem{
				text-align: center;
				background-color: #ffffff;
				flex: 1;
				image{
					width: 100upx;
					height: 100upx;
				}
				.className{
					font-size: 24upx;
					padding-top: 10upx;
					color: #333333;
				}
			}
		}
		.more{
			width: 92%;
			// height: 120upx;
			// line-height: 120upx;
			text-align: center;
			background: #ffffff;
			font-size: 32upx;
			position: fixed;
			bottom: 0;
			left: 0;
			opacity: 1;
			display: flex;
			padding: 20upx 30upx;
			border-top: 1upx solid #f8f8f8;
			// border-radius: 30upx 30upx 0upx 0upx;
			z-index: 1;
			image{
				width: 40upx;
				height: 40upx;
				margin-top: 10upx;
				margin-bottom: 10upx;
			}
			.moreBtn{
				width: 350upx;
				height: 100upx;
				border-radius: 10upx;
				line-height: 100upx;
				text-align: center;
				background-color: #ff4444;
				color: #ffffff;
				font-size: 30upx;
				font-weight: bold;
			}
			.nomoreBtn{
				width: 350upx;
				height: 100upx;
				border-radius: 10upx;
				line-height: 100upx;
				text-align: center;
				background-color: #cccccc;
				color: #ffffff;
				font-size: 28upx;
				font-weight: bold;
			}
		}
		.title{
			position: relative;
			.swiper{
				height: 100%;
				width: 100%;
			}
			.countDown{
				margin: 30upx;
				width: 86%;
				border-radius: 10upx;
				padding: 20upx;
				background-color: #FFFFFF;
				display: flex;
				position: absolute;
				bottom: -110upx;
				.tag{
					width: 10upx;
					height: 70upx;
					background-color: #ff4444;
					border-radius: 8upx;
					margin-right: 20upx;
				}
				.tagText{
					width: 56upx;
					font-size: 28upx;
					font-weight: bold;
					line-height: 36upx;
					color: #333333;
					height: 76upx;
					margin-right: 20upx;
				}
				.bnumberBox{
					background-color: #333333;
					width: 30upx;
					height: 70upx;
					line-height: 70upx;
					text-align: center;
					border-radius: 8upx;
					color: #FFFFFF;
					font-size: 40upx;
					margin-right: 10upx;
				}
				.numberBox{
					background-color: #333333;
					width: 40upx;
					height: 70upx;
					line-height: 70upx;
					text-align: center;
					border-radius: 8upx;
					color: #FFFFFF;
					font-size: 50upx;
					margin-right: 10upx;
				}
				.day{
					font-size: 24upx;
					height: 70upx;
					line-height: 70upx;
					padding: 0 16upx 0 6upx;
				}
				.douhao{
					font-size: 50upx;
					font-weight: bold;
					height: 70upx;
					line-height: 70upx;
					padding: 0 16upx 0 6upx;
				}
			}
		}
		.tipsShow{
			opacity: 1!important;
			
		}
		.barrage{
			display: flex;
			position: absolute;
			left: 30upx;
			top: 400upx;
			height: 50upx;
			line-height: 50upx;
			min-width: 300upx;
			background-color: rgba(0,0,0,0.3);
			border-radius: 60upx;
			font-size: 26upx;
			color: #ffffff;
			opacity: 0;
			transition: opacity 1s;
			.barrageText{
				padding-right: 10upx;
				max-width: 500upx;
				overflow: hidden; /*超出部分隐藏*/
				text-overflow: ellipsis; /* 超出部分显示省略号 */
				white-space: nowrap; /*规定段落中的文本不进行换行 */
			}
			
			image{
				width: 40upx;
				height: 40upx;
				border-radius: 50%;
				margin: 5upx;
				margin-right: 10upx;
			}
		}
		.content{
			padding: 30upx;
			margin-top: 75upx;
			
			.award{
				padding: 20upx 0upx 20upx 20upx;
				background-color: #FFFFFF;
				border-radius: 15upx;
				.publicityText{
					color: #EE6E0C;
					width: 610upx;
					padding: 0 20upx;
					// height: 50upx;
					line-height: 50upx;
					text-align: left;
					background-color: #FDF5E3;
					border-radius: 60upx;
					font-size: 24upx;
					margin: 20upx 0;
				}
				.participationNumber{
					display: flex;
					
					.imgbox{
						justify-content: center;
						flex-wrap: wrap;
						.clientTitle{
							width: 56upx;
							height: 56upx;
							border-radius: 60upx;
							margin-right: -20upx;
							// position: relative;
						}
					}
					.numberText{
						text-align: right;
						font-size: 24upx;
						color: #333333;
						height: 56upx;
						line-height: 56upx;
						flex: 1;
						margin-right: 30upx;
					}
					
				}
				.commodityList{
					overflow: auto;
					display: flex;
					.commodityItem{
						width: 300upx;
						background-color: #F8F8F8;
						border-radius: 15upx;
						margin-right: 20upx;
						position: relative;
						image{
							width: 300upx;
							height: 300upx;
							border-radius: 15upx;
						}
						.grade{
							position: absolute;
							width: 50upx;
							height: 120upx;
							left: 10upx;
							top: 10upx;
							z-index: 1;
							border-radius: 0;
						}
						.awardNum{
							font-size: 20upx;
							color: #FFFFFF;
							background-color: rgba(0,0,0,0.3);
							position: absolute;
							right: 10upx;
							top: 240upx;
						}
						.commodityName{
							font-size: 30upx;
							font-weight: 700;
							margin: 10upx;
							text-overflow: -o-ellipsis-lastline;
							overflow: hidden;
							text-overflow: ellipsis;
							display: -webkit-box;
							border-radius: 0 0 20upx 20upx;
							-webkit-line-clamp: 2;
							line-clamp: 2;
							-webkit-box-orient: vertical;
						}
					}
				}
			}
			.winner{
				background-color: #FFFFFF;
				padding: 0upx 20upx 30upx 30upx;
				border-radius: 20upx;
				margin: 20upx 0;
				.winnerText{
					width: 690upx;
					height: 54upx;
					line-height: 54upx;
					background: #FDF5E3;
					color: #EE6E0C;
					font-size: 24upx;
					text-align: center;
					position: relative;
					left: -30upx;
				}
				.winnerList{
					padding: 30upx 0 0;
					display: flex;
					width: auto;
					justify-content: space-between;
					flex-wrap: wrap;
					width: 100%;
					overflow: hidden;
					.winnerItem{
						text-align: center;
						padding: 10upx;
						margin-bottom: 12upx;
						// border-radius: 10upx;
						flex: 0.18;
						min-width: 18%;
						margin-right: 10upx;
						width: 120upx;
						// height: 80upx;
						// line-height: 80upx;
						overflow: hidden;
						.winnerImg{
							position: relative;
							.ibox{
								position: absolute;
								width: 35upx;
								height: 35upx;
								background-color: #ff4444;
								line-height: 35upx;
								text-align: center;
								color: #ffffff;
								font-size: 20upx;
								right: 10upx;
								bottom: 10upx;
								border-radius: 50%;
							}
							image{
								width: 70upx;
								height: 70upx;
								border-radius: 50%;
							}
						}
						.winnerName{
							font-size: 24upx;
							padding: 10upx 0;
							height: 30upx;
							line-height: 30upx;
							text-align: center;
							width:120upx;
							overflow:hidden;
							text-overflow:ellipsis;
							-o-text-overflow:ellipsis;
							white-space:nowrap;
						}
						.winnerCode{
							height: 30upx;
							line-height: 30upx;
							font-size: 24upx;
							color: #FF4444;
						}
					}
				}
				.winnerList:after {
				      content: "";
				      flex: 0.18;
					  min-width: 18%;
				}
			}
			.LotteryYards{
				background-color: #FFFFFF;
				padding: 30upx 20upx 30upx 30upx;
				border-radius: 20upx;
				margin: 20upx 0;
				.LotteryYardsList{
					padding: 30upx 0;
					display: flex;
					width: auto;
					justify-content: space-between;
					flex-wrap: wrap;
					width: 100%;
					overflow: hidden;
					.yardsItem{
						text-align: center;
						padding: 10upx;
						font-size: 28upx;
						margin-bottom: 12upx;
						// border-radius: 10upx;
						flex: 0.28;
						min-width: 28%;
						margin-right: 10upx;
						width: 196upx;
						height: 80upx;
						line-height: 80upx;
						overflow: hidden;
					}
					.textmroe{
						color: #999999;
						font-size: 28upx;
					}
				}
				.LotteryYardsList:after {
				      content: "";
				      flex: 0.33;
					  min-width: 33%;
				}
			}
			.merchandiseList{
				padding: 30upx;
				background-color: #FFFFFF;
				border-radius: 20upx;
			}
			.richText{
				padding: 30upx;
				background-color: #FFFFFF;
				border-radius: 20upx;
				margin-top: 20upx;
			}
		}
	}
	.coverImg {
		width: 750upx;
	}
	.zjbj {
		// background-image: url(../../../static/images/xxhg3.png);
		// background-size: 100% 100%;
		// padding: 54upx;
		border-radius: 10upx;
		width: 85vw;
		height: 870upx;
		position: relative;
	
		.zjbox {
			position: absolute;
			left: 50%;
			top: 24%;
			transform: translate(-50%);
		}
	
		.closeBtn {
			font-size: 28upx;
			height: 40upx;
			width: 40upx;
			border-radius: 60upx;
			background-color: rgba(0, 0, 0, 0.8);
			color: #A8A2B2;
			line-height: 40upx;
			position: absolute;
			right: 0upx;
			top: 0upx;
		}
	
		.contenttitle {
			// width: 236upx;
			// height: 69upx;
			// position: relative;
			z-index: 99;
			// margin: auto;
			// background: linear-gradient(to bottom, #FEE76A 0%, #FBCD1C 100%);
			padding-bottom: 30upx;
			margin-bottom: 30upx;
			border-bottom: 1upx dotted #CCCCCC;
	
			.text {
	
				text-align: center;
				color: #ffffff;
				line-height: 69upx;
				font-size: 40upx;
				font-weight: 700;
				text-shadow:
					-2upx -2upx 0 #ff4444,
					4upx -2upx 0 #ff4444,
					-4upx 4upx 0 #ff4444,
					4upx 4upx 0 #ff4444,
					0upx 4upx 4upx rgba(0, 0, 0, 0.6);
			}
		}
	}
</style>
<style>
	page{
		background-color: #f8f8f8;
	}
</style>