<?php if( !defined( 'ONGPHP')) exit( 'Error ONGSOFT');
$D = db('');
/*获取会员信息*/
$user = $D -> setbiao('user') -> where( 
	array( 
		"uid" => $_SESSION['uid'], 
	) 
) -> find();	

// $_SESSION['uid'] = 21;


?><!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8" />
    <title><?php echo $shezhi['title'] ?></title>
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.2, user-scalable=0">
    <meta content="yes" name="apple-mobile-web-app-capable" />
    <meta content="yes" name="apple-touch-fullscreen" />
    <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
    <meta http-equiv="Pragma" content="no-cache" />
    <meta http-equiv="Expires" content="0" />
    <meta content="telephone=no,email=no" name="format-detection">
	<link rel="stylesheet" href="/wabao/reset.css"/>
	<!-- <link rel="stylesheet" href="http://www.90ibang.com/themes/2018/res/css/style.css?3333223"/> -->
	<link rel="stylesheet" href="/wabao/style.css?3333223"/>

	<script type="text/javascript" src="/wabao/jquery.min.js"></script>
	<script type="text/javascript" src="/wabao/layer.js"></script>
	

	<!-- <script type="text/javascript" src="/layer_mobile/layer.js"></script> -->



<style type="text/css">
	
.pay-price-three {
    position: absolute;
    bottom: 4%;
    width: 100%;
    color: #fff;
    text-align: center;
    font-size: 1.024rem;
}
.pay-price-three em {
    font-size: 12px;
    color: #FFF !important;
}
</style>


</head>
<body id="preloader">
<input type="hidden" value="0" id="user_amount" />
<input type="hidden" value="5" id="one_user_fc" />
<input type="hidden" value="2" id="two_user_fc" />
<input type="hidden" value="0" id="daili_fc" />
<input type="hidden" value="/order/ido007gzh" id="pay_url" />
<input type="hidden" value="app.9968857.cn" id="js_domain" />
<input type="hidden" value="590512b90b1609d27a9f4060" id="userid" />
<input type="hidden" value="<?php echo $user['name'] ?>" id="user_nickname" />
<input type="hidden" value="" id="tixian_appid" />
<input type="hidden" value="" id="tixian_openid" />
<input type="hidden" value="5" id="tixian_min_money" />
<input type="hidden" value="5" id="yao_song_chan_count" />
<input type="hidden" value="http://t.cn/RXVgtft" id="content_link" />


	<div id="home">
		<div class="header-red-bg">
			<div class="head">

			<?php 
				

			if ($user['touxiang']=='') {
				?>
				<img src="/wabao/tou.png">

				<?php
				
			}else{
				?>

				<img src="<?php echo $user['touxiang'] ?>">
				<?php
			}

			?>
				



                <div class="nick"><?php echo $user['name'] ?></div>
			</div>
            <div class="user-id-box">
                <span class="user-id">我的ID:<?php echo $user['uid'] ?></span>
            </div>
             <div class="rule-box service" onClick="show_guize();" >
                <span class="rule-btn">游戏奖励规则</span>
            </div>
		</div>

		<div class="luck">

		<?php 
			

		/*获取抓取的红包*/



		?>

		<script type="text/javascript">
			var mContent=new Array(); //滚动
			<?php 
				

				$jj = $shezhi['zuobi'];

				if ( $shezhi['istanchuang'] ) {
					$uu = 0;
					foreach($jj as  $k => $v){


			?>

						mContent[<?php echo $uu ?>]='<span> &nbsp; <?php echo $v ?></span>';
						

						<?php 
						$uu+=1;

							}
						}
						?>


						var mInterval=new Array(); //定义一些常用而且要经常用到的变量
			var mId=0;
			var mDelay=2000;
			var mHeight=35;
			function initMarquee() { 
				var str=mContent[0]; 
				document.write('<div id=mBox style="overflow:hidden;height:'+mHeight*0.064+'rem" onmouseover="clearInterval(mInterval[0])" onmouseout="mInterval[0]=setInterval(\'startMarquee()\',mDelay)"><div>'+str+'</div></div>'); 
				mId++; 
				mInterval[0]=setInterval("startMarquee()",mDelay); 
			}
			function startMarquee() {
				var str=mContent[mId];
				mId++;
				if(mId>=mContent.length) mId=0;
				if(mBox.childNodes.length==1) {
					var nextLine=document.createElement('DIV');
					nextLine.innerHTML=str;
					mBox.appendChild(nextLine);
				}
				else {
					mBox.childNodes[0].innerHTML=str;
					mBox.appendChild(mBox.childNodes[0]);
					mBox.scrollTop=0;
				}
				clearInterval(mInterval[1]);
				mInterval[1]=setInterval("scrollMarquee()",10);
			}
			function scrollMarquee() {
				mBox.scrollTop++;
				if(mBox.scrollTop%mHeight==mHeight){
					clearInterval(mInterval[1]);
				}
			}
			if(mContent.length>0)
			{
				initMarquee();
			}
			
		</script>




		</div>
		<div class="red-box" >
			<div class="red-two-box clearFloat">
				<div class="floatLeft left-redpackage box-shadow keya0" onclick="redwin(0);">
					<div class="red-price-box"><img src="/wabao/chan-tie.png"><em><?php echo $user['tiechan'] ?></em></div>
					<p class="pay-price-two" style="bottom: 20%"><em>购买</em>铁铲</p>
                    <p class="pay-price-three"><em><?php echo $shezhi['tietishi'] ?></em></p>
					<img src="/wabao/redpackage.png">
				</div>
				<div class="floatRight right-redpackage box-shadow keya1" onclick="redwin(1);">
					<div class="red-price-box"><img src="/wabao/chan-ton.png"><em><?php echo $user['tongchan'] ?></em></div>
					<p class="pay-price-two" style="bottom: 20%"><em>购买</em>铜铲</p>
                    <p class="pay-price-three"><em><?php echo $shezhi['tongtishi'] ?></em></p>
					<img src="/wabao/redpackage.png">
				</div>
			</div>
			<div class="red-two-box clearFloat">
				<div class="floatLeft left-redpackage box-shadow keya2" onclick="redwin(2);">
					<div class="red-price-box"><img src="/wabao/chan-yin.png"><em><?php echo $user['yinchan'] ?></em></div>
					<p class="pay-price-two" style="bottom: 20%"><em>购买</em>银铲</p>
                    <p class="pay-price-three"><em><?php echo $shezhi['yintishi'] ?></em></p>
					<img src="/wabao/redpackage.png">
				</div>
				<div class="floatRight right-redpackage box-shadow keya3" onclick="redwin(3);" >
					<div class="red-price-box"><img src="/wabao/chan-jin.png"><em><?php echo $user['jinchan'] ?></em></div>
					<p class="pay-price-two" style="bottom: 20%"><em>购买</em>金铲</p>
                    <p class="pay-price-three"><em><?php echo $shezhi['jintishi'] ?></em></p>
					<img src="/wabao/redpackage.png">
				</div>
			</div>
		</div>
		<div class="footer-red-bg" >
        	<div class="lxkfs"><a href="javascript:void(0);" onclick="lxkf();" >保存平台永久入口，防止平台丢失</a></div>
		</div>
	</div>
	
	<?php

	$lan = 'index';
	 include QTPL.'foot.php';

	 ?>


	<div id="ajax"><!--加载其他页面--></div>

	<?php 
		if ($user) {
	?>

	<script type="text/javascript">
		$(function(){
			// setInterval(function(){push();}, 1500);

				<?php 
					
					if ($user['islingqu']==0) {

						if ($shezhi['iszengchan'] =='1') {
							?>
							songchan();

							<?php

						}


				?>
						

				<?php 
					}
				?>

					});

		var boommsg = '&#128557; ';//全局变量
		var domain = 'http://www.90ibang.com/themes/2018';
	</script>

	<?php 
		}
	?>






<script type="text/javascript">
	

(function (doc, win) {
	var docEl = doc.documentElement,
		resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize',
		recalc = function () {
			var clientWidth = docEl.clientWidth;
			if (!clientWidth) return;
			docEl.style.fontSize = (clientWidth / 375) + 'rem';
		};
	if (!doc.addEventListener) return;
	win.addEventListener(resizeEvt, recalc, false);
	doc.addEventListener('DOMContentLoaded', recalc, false);
})(document, window);


function push() {

	var useramount = $("#user_amount").val();
	
	$.post(
	"?action=ajax",
	{
		'action':'getnum',
		"act" :"getnum"
	},

	function(data){



		if(data.status == 'ok'){
			$(".keya0 .red-price-box em").text(data.a0);
			if(data.a0 > 0){

				$(".keya0 .pay-price-two").html("用铁铲<em>挖红包</em>");

			}else{
				$(".keya0 .pay-price-two").html("<em>购买</em>铁铲");
			}
			$(".keya1 .red-price-box em").text(data.a1);
			if(data.a1 > 0){
				$(".keya1 .pay-price-two").html("用铜铲<em>挖红包</em>");
			}else{
				$(".keya1 .pay-price-two").html("<em>购买</em>铜铲");
			}
			$(".keya2 .red-price-box em").text(data.a2);
			if(data.a2 > 0){
				$(".keya2 .pay-price-two").html("用银铲<em>挖红包</em>");
			}else{
				$(".keya2 .pay-price-two").html("<em>购买</em>银铲");
			}
			$(".keya3 .red-price-box em").text(data.a3);
			if(data.a3 > 0){
				$(".keya3 .pay-price-two").html("用金铲<em>挖红包</em>");
			}else{
				$(".keya3 .pay-price-two").html("<em>购买</em>金铲");
			}
			$("#user_amount").val(data.amount);
			
			if(data.gg){
				$(".gonggao").show();
				$(".gonggao p").html(data.gg);
				$(".gonggao p").animate({width:"100%"}, 4000);
			}else{
				$(".gonggao p").animate({width:"0%"}, 4000);
			}
		}

	}, "json");
}


function jilu(){

	var zhi = $('.jixu').attr('zhi');
	

	if (zhi>=0) {

		$('.jixu').attr('zhi',parseInt(zhi)+1);
	}




}


// 选择红包
function redwin(n) {


	

	loading();
	if(n == 1){
		var title = '铜铲';
		var style = 'ton';
	}else if(n==2){
		var title = '银铲';
		var style = 'yin';
	}else if(n==3){
		var title = '金铲';
		var style = 'jin';
	}else{
		var title = '铁铲';
		var style = 'tie';
	}
	var html = '<div>';
		html += '<a href="javascript:void(0);" class="colse" onclick="layer.closeAll();location.reload()"><img src="' + domain + '/res/img/open-colse.png"></a>';
		html += '<div class="top"><img src="' + domain + '/res/img/chan-'+ style +'.png"><em>'+ title +'</em></div>';
		html+= '<div class="open">';
		html+= '<div class="list"><span class="' + style + '"><em>&nbsp;</em></span><span class="' + style + '"><em>&nbsp;</em></span><span class="' + style + '"><em>&nbsp;</em></span><span class="' + style + '"><em>&nbsp;</em></span></div>';
		html+= '<div class="list"><span class="' + style + '"><em>&nbsp;</em></span><span class="' + style + '"><em>&nbsp;</em></span><span class="' + style + '"><em>&nbsp;</em></span><span class="' + style + '"><em>&nbsp;</em></span></div>';
		html+= '<div class="tips">挖到石头后铲子折断消失,中途退出游戏视为铲子消耗</div>';
		html+= '</div>';
		html+= '<div class="sq"></div>';
		html+= '<div class="chai" onclick="jilu(); redwin('+ n +');   "><img src="' + domain + '/res/img/red-jxwa.png"></div>';
		html+= '</div>';

		var jixu = $('.jixu').attr('zhi');
		
	$.post("?action=ajax&huo=1",{
		'action':'num',
		"n" : n,
		'jixu':jixu,
	},

	function(data){


		noload();


		if (data.status=="ok" ){
			layer.open({
				type: 1,
				className: 'layui-m-open',
				content: html,
				shadeClose: false,
				style: 'margin-top: -5.76rem;border-radius: 0.32rem;'
			});



			$(".layui-m-open .list span").each(function() {
				var p = $(this);

				/*这个是红包点击*/

				p.click(function() {


					$(this).children("em").css({
						'animation-name':'major',
						'animation-duration':'0.9s',
						'-webkit-animation-duration':'0.9s',
						'animation-timing-function':'linear',
						'animation-iteration-count':'infinite'
					})


					$(".layui-m-open .list span").unbind('click'); //连续翻动
					var time = "<?php 
					$rr = time();
					echo $rr;
					?>";
					var token = "<?php  
					 $to = token();
					 $_SESSION['token'] = $to;
					 echo $to;
					  ?>";

					$.post("?action=ajax&wa=1",{
						action:'wa',
						"n" : n,
						key: data.key,
						jixu: jixu,
						token:token,
						time:time

					},
					function(data){
						if(data.status == 'bad'){
							layer.open({content: data.msg,skin: 'msg',time: 3});
						}else{
							var hid = data.id; //红包id
							var prize = data.money; //翻中的红包
							var jxkey = data.key; //继续挖包的KEY
							var bh=data.bianhao;//红包编号




							var mydata = eval(data.list); //将JSON转换成数组
							p.css({"font-size": "22px", "background": "#FBD523"});
							p.attr("id", "r"); //标记中奖方块的id
							if (prize == 0){ //挖到石头
								p.html("<img src='" + domain + "/res/img/stone"+ n +".png' width='65%'>");
								layer.open({content: boommsg + '挖到石头了，铲子折断了',skin: 'msg',time: 2});
								$(".chai").html('');

								//更新图标
								push();
							}else{
								p.html("<font color=red>"+ parseFloat(prize).toFixed(2) +"</font>");
								push();
							}
							$(".layui-m-open .list span").delay("500").not($('#r')[0]).each(function(index) {
								var pr = $(this);
								pr.css({"font-size": "22px", "background": "#B8B8B8"});
								if (mydata[index] == 0){ //挖到石头
									pr.html("<img src='" + domain + "/res/img/stone.png' width='70%'>");
								}else{
									pr.text(parseFloat(mydata[index]).toFixed(2));
								}
							});
							if(data.show=="yes")
							{
								$(".layui-m-open .sq").html('<div class="luck" onclick="lookluck(\''+ hid +'\',\''+ bh +'\',\''+ title +'\',\''+ prize +'\');"><看看其他人的手气></div>');
							}
							
							$(".layui-m-open .chai").show();
						}
					}, "json");
				});
			});
		}else if (data.status=="bad"){
			layer.open({content: '账号异常，不能挖包',skin: 'msg',time: 3});
		}else{
			shopkey();
		}
	}, "json");
}


// 查看大家人气
function lookluck(id,bh,name,amount) {
	var html = '<div>';
		html+= '<div class="title">【'+ name +'】第'+ bh +'组挖红包手气详情</div>';
		html+= '<div class="txt">···</div>';
		html+= '<div class="tips">同一组红包不限制每人挖掘次数，可以重复挖包直至挖完</div>';
		html+= '<div class="list"><div class="loading">正在载入...</div></div>';
		html+= '</div>';
	layer.open({
		type: 1,
		className: 'layui-m-luck',
		content: html,
		btn: '关闭窗口',
		anim: 'up'
	});
	$('.layui-m-luck').bind("touchmove",function(e){
		e.preventDefault();
	});
	$.post("?action=ajax",{
		"id" : id,
		'action':'getinfo'
	},
	function(result){
		if(result.status == 'bad'){
			layer.open({content: result.msg,skin: 'msg',time: 3});
		}else{
			//$(".layui-m-luck .txt").html('已挖'+ result['data'].y +'个，共'+ result['data'].g +'元<span class="l"></span>');
			$(".layui-m-luck .txt").html('已挖'+ result['data'].y +'个<span class="l"></span>');
			$(".layui-m-luck .list").html(result['data'].l);
		}
	}, "json");
}

//	购买铲子
function shopkey() {
	var html = '<div>';
		html += '<a href="javascript:void(0);" class="colse" onclick="layer.closeAll();"><img src="' + domain + '/res/img/shopkey-colse.png"></a>';
		html += '<div class="key-two clearFloat">';
		html += '<a class="floatLeft" href="javascript:void(0);" onclick="xzpay(0,\'5.00\');"></a>';
		html += '<a class="floatLeft" style="margin-left:20px;" href="javascript:void(0);" onclick="xzpay(1,\'10.00\');"></a>';
		html += '</div>';
		html += '<div class="key-two clearFloat" style="top: 12.16rem;">';
		html += '<a class="floatLeft" href="javascript:void(0);" onclick="xzpay(2,\'30.00\');"></a>';
		html += '<a class="floatLeft" style="margin-left:20px;" href="javascript:void(0);" onclick="xzpay(3,\'50.00\');"></a>';
		html += '</div>';
		html += '<div class="tips">每次购买铲子将随机优惠0.01-0.05元</div>';
		html += '</div>';
	layer.open({
		type: 1,
		className: 'layui-m-shopkey',
		content: html,
		shadeClose: false,
		style: 'border-radius: 0.32rem;'
	});
}

// 支付选择
function xzpay(n, je) {
	var amount = $("#user_amount").val();
	layer.closeAll();
	if (parseFloat(amount) > parseFloat(je)){
		layer.open({
			type: 1,
			className: 'layui-m-pay',
			content: '<h1>选择购买方式，来支付<b style="color: #f60;">'+ je +'</b>元</h1><div class="amount"><span class="tttext">当前账户余额：</span><span class="ttprice">￥'+ parseFloat(amount).toFixed(2) +'</span></div><a href="javascript:;" class="yebtn" onclick="payyue('+ n +',\''+ je +'\');">用账户余额直接购买</a><a href="javascript:;" class="yebtn sm" onclick="paycode('+ n +',\''+ je +'\');">用微信扫码支付购买</a>',
			anim: 'up',
			btn: ['关闭'],
			style: 'position:fixed; bottom:0; left:0;padding:0.64rem 0; border:none;'
		});
	}else{
		// paycode(n, je);

		location.href='pay.php?y=pay&jine='+je+'&paytype=5&n='+n;

	}
}

// 余额支付
function payyue(n, je) {
	$.post("/hb/payyue",{
		"n" : n
	},
	function(data){
		if(data.status == 'ok'){
			layer.closeAll();
			layer.open({content: data.msg,skin: 'msg',time: 3});
			push();
		}{
			layer.open({content: data.msg,skin: 'msg',time: 3});
		}
	}, "json");
}
//打开摄像头
function go_scan_pay()
{
	var js_domain=$("#js_domain").val();
	location.href="http://"+js_domain+'/help/goscanpay';
}

// 支付二维码
function paycode(n, je) {

	layer.closeAll();
	var content_link=$("#content_link").val();
	layer.open({
		type: 1,
		className: 'layui-m-pay',
		content: '<h1>微信支付<b style="color: #f60;">'+ je +'</b>元,支付步骤：</h1><div class="msg4"><a href="'+content_link+'"><span class="rule-btn">《怎么支付?点击查看扫码支付图文教程》</span></a></div><div class="msg2">1.长按二维码保存或截图。<br />2.点击下面红色按钮。<br />3.选择相册，扫一扫刚才保存的二维码。</div><div class="ewm"><div class="loading"></div></div><div class="msg3"><input type="button" value="保存后，点击我扫一扫支付" onClick="go_scan_pay();" /></div>',
		anim: 'up',
		btn: ['关闭'],
		style: 'position:fixed; bottom:0; left:0;padding:0.64rem 0; border:none;'
	});
	if(sharedata.checkChongzhi)
	{
		sharedata.checkChongzhi="yes";
	}
	var pay_url=$("#pay_url").val();
	$.ajax({
		 type: 'POST',
		 dataType : 'jsonp',  
		 jsonp:"jsoncallback",  
		 url:pay_url,
		 data: {"type" : n,userid:$("#userid").val(),money:je} ,
		 success: function(data){
			if(data.status == 'bad'){
				layer.open({content: data.msg,skin: 'msg',time: 3});
			}else
			{
				if(data.type==2)
				{
					self.location.href=data.url;
					return;
				}
				if(data.type==1)
				{
					var qrurl=data.url;
					$(".ewm").html('<img src="'+qrurl+'">');
					if(data.order_id!=""){
						var ag_count=30;
						var ag_add=0;
						var getIntval = setInterval(function(){
							ag_add++;
							$.ajax({
								 type: 'POST',
								 dataType : 'json',  
								 url:'/order/checkorder' ,
								 data: {userid:$("#userid").val(),order_id:data.order_id} ,
								 success: function(json){
									 if(json.status=="ok")
									 {
										$(".ewm").css({'background-image':'url('+ qrurl +')'});
										$(".ewm").html('<div class="msg"><i class="icon-success"></i><p>支付成功</p></div>');
										clearInterval(getIntval);
										push();
										sharedata.checkChongzhi="no";
									 }
								} 
							});
							$(".layui-m-pay .layui-m-layerbtn").click(function() {
								clearInterval(getIntval);
								sharedata.checkChongzhi="no";
							});
							if(ag_add > ag_count)
							{
								clearInterval(getIntval);
								sharedata.checkChongzhi="no";
							}
						}, 2000);
					}
					return;
				}
			}
		} 
	});
}

// 送铲子
function songchan(){
	layer.closeAll();
	var html = '<div>';
		html += '<img src="' + domain + '/res/img/songchan.png" width="100%">';
		html += '<p><span>铲子可以用于挖红包获得现金</span></p>';
		html += '<a href="javascript:void(0);" class="lqbtn">立即领取</a>';
		html += '<p>右下角“我的账户”中可以将现金提现至您的微信零钱</p>';
		html += '</div>';
		html += '</div>';
	layer.open({
		type: 1,
		className: 'layui-m-songchan',
		content: html,
		shadeClose: false,
		style: 'border-radius: 0.32rem;'
	});
	$(".layui-m-songchan .lqbtn").each(function() {
		var p = $(this);
		p.click(function() {
			$.post("?action=ajax",{
				action:'song',
				"act" : "song"
			},
			function(data){
				if(data.status == 'bad'){
					layer.closeAll();
					layer.open({content: data.msg,skin: 'msg',time: 5});
				}else{
					layer.closeAll();
					layer.open({content: data.msg,skin: 'msg',time: 5});
					push();
				}
			}, "json");
		});
	});
}




//用户首次注册显示
function first_show() {
	var html = '<div>';
		html += '<a href="javascript:void(0);" class="colse" onclick="layer.closeAll();"><img src="' + domain + '/res/img/rule-colse.png"></a>';
		//html += '<div class="title"><img src="' + domain + '/res/img/rule-title.png"></div>';
		html += '<div class="title">游戏规则</div>';
		html += '<div class="content">';
		html += '<p>1、保存平台永久入口二维码，可以免费获取一把挖红包的铁铲。</p>';
		html += '<p  style="text-align:center;"><img src="/site/buildrukouqr"></p>';
		html += '<div class="lxkfs"><a href="javascript:void(0);" onClick="songchan();" >我已经保存二维码，获取1把铁铲</a></div>';

		html += '</div></div>';
		layer.open({
			type: 1,
			className: 'layui-m-rule',
			content: html,
			end:function(){songchan();},
			anim: 'bt',
			shadeClose: true,
			style: 'border-radius: 0.32rem;box-shadow: none;'
		});
}

// 我的二维码
function myewm(){
	loading();
	$.post("?action=ajax",{
		action:"yaoqing",
	},
	function(html){
		$("#home").hide();
		$("#ajax").show();
		$(".footer .active").removeClass('active');
		$(".footer .yq").addClass('active');
		$("#ajax").html(html);
		noload();
	});
}

// 底部切换
$(".footer a").each(function() {
	var p = $(this);
	var data = p.attr("data");

	p.click(function() {
		loading();
		if (data == 0){
			noload();
			$("html").css({"background": "#FFF1B2"});
			$("#ajax").hide();
			$("#home").show();
			$(".footer .active").removeClass('active');
			p.addClass('active');
		}else{
			$.post(data,{},
			function(html){
				$("html").css({"background": "#FEFAED"});
				$("#home").hide();
				$("#ajax").show();
				$(".footer .active").removeClass('active');
				p.addClass('active');
				$("#ajax").html(html);
				noload();
			});
		}
	});
});



// 联系客服
function lxkf2() {
    layer.open({
      type: 1,
	  className: 'layui-m-lxkf',
	  content: '<h1>如果有购买问题，请联系我们</h1><div class="ewm"><img src="/upload/kf.jpg?11"></div>',
	  anim: 'up',
	  btn: ['关闭'],
	  style: 'position:fixed; bottom:0; left:0;padding:0.64rem 0; border:none;'
    });
}
// 提现
function cash(img) {
	var amount = parseFloat($("#user_amount").val());
	var tixian_min_money=parseFloat($("#tixian_min_money").val());

	var html = '<div>';
		html += '<a href="javascript:void(0);" class="colse" onclick="layer.closeAll();"><img src="' + domain + '/res/img/tixian_colse.png"></a>';
		html += '<div class="title">提现到微信零钱</div>';
		html += '<div class="cont">';
		html += '<div class="money">';
		html += '<span class="tttext">账户余额</span>';
		html += '<span class="ttprice">￥'+ parseFloat(amount).toFixed(2) +'</span>';
		html += '</div>';
		html += '<div class="lebe"><img src="' + domain + '/res/img/tixian_ico.png"> 微信零钱<img src="'+ img +'" class="r"></div>';
		html += '<a href="javascript:void(0);" class="txbtn">确认提现</a>';
		html += '<p>满'+parseFloat(tixian_min_money).toFixed(2)+'元才可提现，预计1分钟内到账</p>';
		html += '</div>';
	if (amount < tixian_min_money){
		layer.open({
			content: '余额需满'+parseFloat(tixian_min_money).toFixed(2)+'元才可提现',
			skin: 'msg',
			time: 3
		});
		return false;
	}
	layer.open({
		type: 1,
		className: 'layui-m-cash',
		content: html,
		shadeClose: false,
		style: 'border-radius: 0.32rem;'
	});
	$(".txbtn").click(function() {
		layer.open({type: 2,shade: false,className: 'layui-m-load',content: '提现请求中',time: 3});
		$.post("?action=ajax",{
			"amount" : amount,
			"action":'tixian',

		},
		function(data){
			if(data.status == 'ok'){
				layer.closeAll();
				layer.open({content: data.msg,skin: 'msg',time: 3});
				$("#amount").html("0.00<em>元</em>");
				$("#user_amount").val(0);
			}else{
				if(data.status=="noopenid")
				{
					self.location.href=data.url;
				}
				else{
					layer.closeAll();
					layer.open({content: data.msg,skin: 'msg',time: 3});
				}
			}
		}, "json");
	});
}


// 提现1
function cash1(img) {


	var amount = parseFloat($("#user_amount").val());
	var tixian_min_money=parseFloat($("#tixian_min_money").val());

	var html = '<div>';
		html += '<a href="javascript:void(0);" class="colse" onclick="layer.closeAll();"><img src="' + domain + '/res/img/tixian_colse.png"></a>';
		html += '<div class="title">提现</div>';
		html += '<div class="cont">';
		html += '<div class="">';
		html += '<span class="tttext">账户余额</span>';
		html += '<span class="ttprice">￥'+ parseFloat(amount).toFixed(2) +'</span>';
		html += '</div>';
		html += '<div class=""><table class="bibb"><tr><td>类型</td><td><select class="jjj"><option value="支付宝">支付宝</option></select></td></tr><tr><td>账号</td><td><input class="zhanghao"></td></tr><tr><td>姓名</td><td><input class="xingming"></td></tr></table></div>';
		html += '<a href="javascript:void(0);" class="txbtn1">确认提现</a>';
		html += '<p>满'+parseFloat(tixian_min_money).toFixed(2)+'元才可提现，预计1分钟内到账</p>';
		html += '</div>';
	if (amount < tixian_min_money){
		layer.open({
			content: '余额需满'+parseFloat(tixian_min_money).toFixed(2)+'元才可提现',
			skin: 'msg',
			time: 3
		});
		return false;
	}
	layer.open({
		type: 1,
		className: 'layui-m-cash',
		content: html,
		shadeClose: false,
		style: 'border-radius: 0.32rem;'
	});
	$(".txbtn1").click(function() {
		var jjj = jQuery(".jjj").val();
		var zhanghao = jQuery(".zhanghao").val();
		var xingming = jQuery(".xingming").val();
		if (zhanghao=='') {
			alert('账号不能为空');
			return false;
		}

		if (xingming=='') {

			alert('姓名不能为空');
			return false;
		}





		layer.open({type: 2,shade: false,className: 'layui-m-load',content: '提现请求中',time: 3});
		$.post("?action=ajax",{
			"amount" : amount,
			"action":'tixian1',
			zhanghao:zhanghao,
			xingming:xingming

		},
		function(data){
			if(data.status == 'ok'){
				layer.closeAll();
				layer.open({content: data.msg,skin: 'msg',time: 3});
				$("#amount").html("0.00<em>元</em>");
				$("#user_amount").val(0);
			}else{
				if(data.status=="noopenid")
				{
					self.location.href=data.url;
				}
				else{
					layer.closeAll();
					layer.open({content: data.msg,skin: 'msg',time: 3});
				}
			}
		}, "json");
	});
}







// 财务明细
function record_caiwu(n) {
	if (n == 1){
		var s1 = "class=\"active\"",s2 = "",s3 = "";
	}else if (n == 2){
		var s1 = "",s2 = "class=\"active\"",s3 = "";
	}else{
		var s1 = "",s2 = "",s3 = "class=\"active\"";
	}

	var html = '<div>';
		html += '<a href="javascript:void(0);" class="colse" onclick="layer.closeAll();"><img src="/wabao/record-colse.png"></a>';
		html += '<div class="title">财务明细</div>';

		if (n==4) {

			html += '<div class="tab "><span class="active" data="1">挖包记录</span></div>';
			
		
		}else{

			html += '<div class="tab cw"><span '+ s1 +' data="1">余额明细</span><span '+ s2 +' data="2">佣金明细</span><span '+ s3 +' data="3">铲子明细</span></div>';

		}

		


		html += '<div class="list cw"><span class="loading">正在加载...</span></div>';
		html += '</div>';
	layer.open({
		type: 1,
		className: 'layui-m-record',
		content: html,
		shadeClose: false,
		style: 'border-radius: 0.32rem;'
	});
	//拉取数据
	record_data("cw", n);
	// tab切换
	$(".layui-m-record .tab span").each(function() {
		var p = $(this);
		var data = p.attr("data");
		p.click(function() {
			$(".layui-m-record .tab span.active").removeClass('active');
			p.addClass('active');
			$(".layui-m-record .list").html('<span class="loading">正在加载...</span>');
			record_data("cw", data);
		});
	});
}

// 好友管理
function record_haoyou() {
	var html = '<div>';
		html += '<a href="javascript:void(0);" class="colse" onclick="layer.closeAll();"><img src="' + domain + 'wabao/record-colse.png"></a>';
		html += '<div class="title">我的好友</div>';
		html += '<div class="tab rc"><span class="active" data="1">一级好友</span><span data="2">二级好友</span></div>';
		html += '<div class="list hy"><span class="loading">正在加载...</span></div>';
		html += '</div>';
	layer.open({
		type: 1,
		className: 'layui-m-record',
		content: html,
		shadeClose: false,
		style: 'border-radius: 0.32rem;'
	});
	//拉取数据
	record_data("hy", 1);
	// tab切换
	$(".layui-m-record .tab span").each(function() {
		var p = $(this);
		var data = p.attr("data");
		p.click(function() {
			$(".layui-m-record .tab span.active").removeClass('active');
			p.addClass('active');
			$(".layui-m-record .list").html('<span class="loading">正在加载...</span>');
			record_data("hy", data);
		});
	});
}

// 挖包记录
function record_chai() {

	var html = '<div>';
		html += '<a href="javascript:void(0);" class="colse" onclick="layer.closeAll();"><img src="/wabao/record-colse.png"></a>';
		html += '<div class="title">挖包记录</div>';
		html += '<div class="list red"><span class="loading">正在加载...</span></div>';
		html += '</div>';
	layer.open({
		type: 1,
		className: 'layui-m-record',
		content: html,
		shadeClose: false,
		style: 'border-radius: 0.32rem;'
	});
	record_data("cb", 0);
}

function record_data(type, n) {
	$.post("?action=ajax",{
		"action":"mingxi",
		"n":n,
		"type" : type
	},
	function(data){
		if(data.status == 'ok'){
			$(".layui-m-record .list").html(data.l);
		}else{
			layer.open({content: data.msg,skin: 'msg',time: 3});
		}
	}, "json");
}

function loading(str) {
	var c=arguments[0]?arguments[0]:'加载中...'; 
	layer.open({type: 2,shade: false,className: 'layui-m-load',content:c,time: 10000});
}
function noload() {
	layer.closeAll();
}



</script>



	<script type="text/javascript">

	<?php 
		


		if ($shezhi['tiaozhuan']) {

        	$ewmurl = WZHOST.'ewm.php?data='.$shezhi['tiaozhuan'].'?shuju='.WZHOST;

	    }else{

	        $ewmurl = WZHOST.'ewm.php?data='.WZHOST.'tg.php?tuid='.$_SESSION['uid'];

	    }
	    


	?>



	var ewmurl = "<?php echo $ewmurl ?>";

// 永久入口
function lxkf() {
    layer.open({
      type: 1,
	  className: 'layui-m-lxkf',
	  content: '<h1>长按二维码->保存或收藏平台永久入口</h1><div class="ewm"><img src="'+ewmurl+'"></div>',
	  anim: 'up',
	  btn: ['关闭'],
	  style: 'position:fixed; bottom:0; left:0;padding:0.64rem 0; border:none;'
    });
}
		

//规则
function show_guize() {
	<?php 
		$guizearr = $shezhi['guize'];
		if (is_array( $guizearr )) {
			$html = '';
			foreach($guizearr as  $k => $v){
				$html.="<p>".$v."</p>";

			}

		}


	?>


	var hh = "<?php echo $html  ?>";

	var yao_song_chan_count=$("#yao_song_chan_count").val();
	var html = '<div>';
		html += '<a href="javascript:void(0);" class="colse" onclick="layer.closeAll();"><img src="' + domain + '/res/img/rule-colse.png"></a>';
		//html += '<div class="title"><img src="' + domain + '/res/img/rule-title.png"></div>';
		html += '<div class="title">挖宝规则</div>';
		html += '<div class="content">';
		html += hh;
		html += '</div></div>';
		layer.open({
			type: 1,
			className: 'layui-m-rule',
			content: html,
			anim: 'bt',
			shadeClose: false,
			style: 'border-radius: 0.32rem;box-shadow: none;'
		});
};

	</script>


    <script type="text/javascript">
 var current_domain=document.domain;
 var sharedata = {
	'title':"【"+$("#user_nickname").val()+'】邀请你一起幸运挖雷。',
	'link':"<?php echo WZHOST ?>",
	'imgUrl':'http://www.90ibang.com/upload/logo.png',
	'desc':'Wa！幸运挖雷',
	'qtitle':"【"+$("#user_nickname").val()+'】邀请你一起幸运挖雷。',
	'qlink':'<?php echo WZHOST ?>',
	'qimgUrl':'http://www.90ibang.com/upload/logo.png',
	'tsGoUrl':'http://'+current_domain+'/help/tousu',
	'backUrl':'http://'+current_domain+'/help/ajaxtousu',
	'checkChongzhi':'no',//检测是在充值
	'success':function(res){
		if(res == "friend"){
		//	alert("分享成功");
		}else if(res == "timeline"){
		//	alert("分享失败");
		}
	}
};
</script>
<script type="text/javascript" src="/wabao/android.min.js?111"></script>
<div style="display:none">



</div>


	<div class="jixu" style="display: none;" zhi="0">
		



	</div>


<style type="text/css">
	
.wuwei{
	border:none; background-color:#D85150; color:#fff;
}

#biaobiao{
	width: 100%;

}
#biaobiao tr{
	height: 50px;
}
#biaobiao input{
	border: none;
	line-height: 30px;
	width: 100%;
	border-radius: 3px;

}

.anniu{
	background: #ccc;
	padding: 10px 20px;
	color: #000;
	border-radius: 2px;
}
#ann{
	padding-top: 20px;
}

.huoquyanzhengm{
	/*background: #fff;*/
	/*color: #000;*/
	padding:  10px;
	border-radius: 5px;
	line-height: 30px;
	color: #fff;
}


</style>


<?php 
	

	if ($_SESSION['uid']=='' || !isset($_SESSION['uid'])) {

		if ($shezhi['isweixin']!='1') {

?>

<script type="text/javascript">

var html = '<div><table id="biaobiao"><tr><td style="width:20%">手机号：</td><td> <input class="shouji1" />	</td></tr><tr><td style="width:20%">验证码：</td><td> <input  style="width:50%;float:left" class="yanzhengma1" ><span class="btn yanzhengma huoquyanzhengm" id="btnSendCode"	>获取验证码</span>	</td></tr><tr><td></td><td id="ann">  <span class="button anniu denglu">登录</span>	</td></tr></table></div>';
layer.open({
  className: 'wuwei',
  content:html
})


</script>

<?php 
	}
		}
?>




<script type="text/javascript">
$(function(){

	/*登录*/

	jQuery(".denglu").click(function(){
		var shouji1 = jQuery(".shouji1").val();
		var yanzhengma  = jQuery(".yanzhengma1").val();

		var re = /^1\d{10}$/;
		if (!re.test(shouji1)) {
			alert('手机格式不正确');
			return false;
		}





		if (yanzhengma=='') {
			alert('验证码不能为空');
			return false;
		}

		$.ajax({
			async: true,
			type:"POST",
			url:"?action=ajax&uu",
			data:{action:'login',name:shouji1,yanzhengma:yanzhengma},
			dataType:'json',
			success:function(data){
				if (data.o=='yes') {
					location.href='index.php';
				}
					
			}
		})


	})


    //获取手机验证码

     var zhixng = function(event){
         var shoujihao = $(".shouji1").val();
         var re = /^1\d{10}$/;
         if (!re.test(shoujihao)) {
             alert('手机格式错误');
             return false;
         }
         var htmln =   $(".yanzhengma").html();
         if (htmln=='获取验证码') {
             $.ajax({
                 async: true,
                 type:"POST",
                 url:"?action=ajax&lx=yanzhengma",
                 data:{shoujihao:shoujihao,action:'yanzhengma'},
                 dataType:'json',
                 success:function(data){
                 	if (data.o=='1') {
                 		
                 		alert('短信发送成功');

                 	}

                 }
             })
         };



         var zhi = 60;
         clearInterval(oTimer);
         var oTimer = setInterval(function(){

             zhi = zhi-1;
             $(".yanzhengma").html(zhi);

              $("#btnSendCode").unbind('click');




             if (zhi=='0') {
                   window.clearInterval(oTimer); 
                   $(".yanzhengma").html("获取验证码");
                   $("#btnSendCode").bind('click',zhixng);

             };

         },1000);

     }

     //验证码绑定事件
     $("#btnSendCode").bind('click',zhixng);
});
</script>


</body>
</html>

