<?php 
$huiyuan = $user = uid( $_SESSION['uid'],1 );
?>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <title><?php echo $shezhi['title']?></title>
    <script src="/js/jQuery-2.1.4.min.js"></script>
    <script src="/js/fontsize.js"></script>
    <link rel="stylesheet" href="/css/reset.css">
    <link rel="stylesheet" href="/css/index.css">
    <script src='/js/layer.js'></script>
<style>
	.wlbh{position:fixed;left:0;top:0;width: 100%;height: 100%;z-index: 3;background:rgba(0,0,0,0.8);display: none;}
.wlbh img{width: 3rem;height: 3rem;display: block;position:absolute;left:50%;top:50%;margin-left: -1.5rem;margin-top: -1.5rem;}

	
*{ margin:0; padding:0; list-style:none;}

#lanren #audio-btn{width: 30px;height: 30px; background-size: 100% 100%;}
.imgon{background: url('/images/music_on.png') no-repeat 0 0;-webkit-animation: rotating 1.2s linear infinite;animation: rotating 1.2s linear infinite;}
.imgoff{background: url('/images/music_off.png') no-repeat 0 0;}
@-webkit-keyframes rotating {
	from{
		-webkit-transform: rotate(0deg);
		-moz-transform: rotate(0deg);
		-ms-transform: rotate(0deg);
		-o-transform: rotate(0deg);
    	transform: rotate(0deg);
	}
	to{
		-webkit-transform: rotate(360deg);
		-moz-transform: rotate(360deg);
		-ms-transform: rotate(360deg);
		-o-transform: rotate(360deg);
		transform: rotate(360deg);
	}
}
@keyframes rotating {
    from{
        -webkit-transform: rotate(0deg);
		-moz-transform: rotate(0deg);
		-ms-transform: rotate(0deg);
		-o-transform: rotate(0deg);
        transform: rotate(0deg);
    }
    to{
        -webkit-transform: rotate(360deg);
		-moz-transform: rotate(360deg);
		-ms-transform: rotate(360deg);
		-o-transform: rotate(360deg);
        transform: rotate(360deg);
    }
}
</style>
</head>
<audio autoplay id="bgMusic"  src="666.mp3" loop="loop" style="display:none"></audio>
<script>
   function autoPlayAudio() {
        wx.config({
            // 配置信息, 即使不正确也能使用 wx.ready
            debug: false,
            appId: '',
            timestamp: 1,
            nonceStr: '',
            signature: '',
            jsApiList: []
        });
        wx.ready(function() {
            var globalAudio=document.getElementById("bgMusic");
            globalAudio.play();
        });
    };
// 解决ios音乐不自动播放的问题
autoPlayAudio();
</script>
<body class="cz_box yxtx_box youxi" >
<header>
    <div class="tip"><img src="/images/laba.png" alt=""><marquee behavior="" direction=""><?php echo $shezhi['ads'] ?></marquee></div>
    <a href="?action=kefu"><div class="kf"><img src="/images/kf.png" alt=""></div></a>
</header>
<!-- 	<div class="title ">
		<span>大小场</span><span style="color: #401a39; border-color: #401a39;border-bottom-color: #fff3cf; ">单双场</span>
	</div> -->
<div class="dl_box down yxtx">
    <div class="qh" style="display: block;">
        <input type="hidden" name="game_type" id="gameType" value="0">
        <input type="hidden" name="multiple" id="multiple" value="1">
        <input type="hidden" name="bet_type" id="bet_type" value="0">
        <p class="liaojie" data-modle='dx'>还不会玩？点击了解 >>><span>查看规则</span></p>
        <ul >
            <li class="kong"><span>数量</span><label class="a" for="">最小</label><label class="b d" for="">+</label><label class="c" for=""><i id="jishou">1</i></label><label class="b" for="">-</label><label class="e" for="">最大</label></li>
        </ul>
        <ul class="new">
                <li><span>预期收益(元)</span><label class="shouyi" for="">10.00 元</label></li>
                <li><span>下注费(元)</span><label class="color xiafei"  for="">1.0 元</label></li>
                <li><span>通知费(元)<label class="xiazhu">(下注打款微信钱包)</label></span><label  class="color" for="">1.0 元</label></li>
        </ul>
            <div class="zhu">
                <div class="da yazhu" data-type="0" style="background: rgb(255, 255, 255); color: rgb(184, 92, 125);">大</div>
                <div class="da" data-type="1">小</div>
                <div class="da" data-type="2">单</div>
                <div class="da" data-type="3">双</div>
            </div>
            <input type="hidden" name="game_type" id="gameType" value="0">
            <input type="hidden" name="multiple" id="multiple" value="1">
            <input type="hidden" name="bet_type" id="bet_type" value="0">
            <button type="submit" onclick="loading()" style="padding: 0"> <div class="tip">开始夺宝</div></button>
            
        
    </div>
</div>
<div class="anniu">
    <a href="javascript:void(0);"><span>当前余额：</span><label for="" id="my_money"><?php echo $user['jine'] ?>  </label></a>
    <a href="?action=chongzhi">充值</a>
</div>
<div class="nav" style="">
    <div class="nav_box">
        <a href="?action=index"><span><i class="iconfont">&#xe67a;</i>首页</span></a>
        <a href="?action=zhuye"><span class="asd"><i class="iconfont">&#xe61b;</i>夺宝</span></a>
        <a href="?action=chongzhi"><span><i class="iconfont">&#xe65a;</i>充值</span></a>
        <a href="?action=orderlog"><span ><i class="iconfont">&#xe635;</i>明细</span></a>
    </div>
</div>

<!-- 模态框 -->
<div class="modle" ></div>
<div class="models daxiao" data-modle='dx' >
    <div class="title" data-modle='ds'>规则说明</div>
    <div class="content">以<span>微信提现</span>产生订单号最后一位为开奖结果，该订单号由腾讯产生，绝对公平公正且唯一。</div>
    <div class="maina">
        <div class="heade">
            <span>开奖结果</span>
            <span>夺宝结果</span>
            <span>赔率</span>
        </div>
        <div class="heade">
            <span>5|6|7|8|9</span>
            <span>大</span>
            <span>2.00倍</span>
        </div>
        <div class="heade">
            <span>0|1|2|3|4</span>
            <span>小</span>
            <span>2.00倍</span>
        </div>
		 <div class="heade">
            <span>1|3|5|7|9</span>
            <span>单</span>
            <span>2.00倍</span>
        </div>
		 <div class="heade">
            <span>0|2|4|6|8</span>
            <span>双</span>
            <span>2.00倍</span>
        </div>
    </div>
    <div class="td">我已了解规则</div>
     <!--<a href="dlzq.html"><div class="td">通道二</div></a>--> 
</div>
<div class="models daxiao" data-modle='ds' >
    <div class="title">规则说明<label>(单双场)</label></div>
    <div class="content">以<span>微信提现</span>产生订单号最后一位为开奖结果，该订单号由腾讯产生，绝对公平公正且唯一。</div>
    <div class="maina">
        <div class="heade">
            <span>开奖结果</span>
            <span>夺宝结果</span>
            <span>赔率</span>
        </div>
        <div class="heade">
            <span>1|3|5|7|9</span>
            <span>单</span>
            <span>2.00倍</span>
        </div>
        <div class="heade">
            <span>0|2|4|6|8</span>
            <span>双</span>
            <span>2.00倍</span>
        </div>
    </div>
    <div class="td">我已了解规则</div>
    <!-- <a href="dlzq.html"><div class="td">通道二</div></a> -->
</div>
<div class="models sll" data-modle='sl' id="kui" >
    <div class="title" id="kaijiangtitle">很遗憾，你输了~</div>
    <div class="sl_li">投注内容：<span id="touzhuneirong">未知类型.*手</span> <a href="?action=xinshou"><label for="">如何验证公平性</label></a></div>
    <div class="sl_li">夺宝结果：<span class="info" id="huodejine"></span></div>
    <div class="sl_li">订单编号：<span ><div style="display:inline;" id="dingdanhao">12345678</div><i id="weihao">9</i></span></div>

    <div class="td">确定</div>
    <!-- <a href="dlzq.html"><div class="td">通道二</div></a> -->
</div>
<div class="models sll" data-modle='yl' id="ying">
    <div class="title">恭喜你，你赢啦！</div>
    <div class="sl_li">投注内容：<span>未知类型.*手</span> <a href="?action=xinshou"><label for="">如何验证公平性</label></a></div>
    <div class="sl_li">夺宝结果：<span class="info">+ 元</span></div>
    <div class="sl_li">订单编号：<span >12345678<i>9</i></span></div>

    <div class="td">确定</div>
    <!-- <a href="dlzq.html"><div class="td">通道二</div></a> -->
</div>
<div class="models"  style="height: 7.02rem;top:-62px;" data-modle='tk' id="error_msg">
    <div class="title">提示</div>
    <div class="td" id="msg"></div>
</div>

<!-- 网络不好时调用 -->
    <div class="wlbh">
        <img src="/vns/loading/zhuan.gif"  alt="" />
    </div>

<script src='/js/jquery.cookie.js'></script>
<script src='/js/index.js'></script>

<script>
var cancai = false;
    function loading() {

        
        var number =$('.yazhu').attr('data-type');
        var total_hand = $('#jishou').html();
        //alert(number);exit;
        if(cancai){

        	return false;
        	
        }
//         $('#button').attr('type','button');
//         layer.open({type: 2,content: '加载中', shadeClose: false});
//         return true;
        cancai = true;
        $.ajax({
            
            url:"?action=ajax",
            type:'post',
            dataType:'json',
            data:{
                action:"buyNumber",
                total_hand: parseInt( total_hand  ),
                number: number
            },
            
            beforeSend: function(){
                $('.wlbh').fadeIn("400");
            },
            success:function(res) {
				
				$('.wlbh').fadeOut("400");
            cancai = false;
                if( res['success']==true ){     //订单成功
					
                	if(res['my_money']>=0){
                        $('#my_money').text(res['my_money']);
                    }
                	
                	if(res['number']==0){
                		$('#touzhuneirong').text('猜大*'+res['total_hand']+"手");
                    } else if(res['number']==1){
                    	$('#touzhuneirong').text('猜小*'+res['total_hand']+"手");
                    } else if(res['number']==2){
                    	$('#touzhuneirong').text('猜单*'+res['total_hand']+"手");
                    } else if(res['number']==3){
                    	$('#touzhuneirong').text('猜双*'+res['total_hand']+"手");
                    }else if(res['number']==4){
                        $('#touzhuneirong').text('猜合.*'+res['total_hand']+"手");
                    }

                	if(res['win_money']>0){
                        $('#kaijiangtitle').text("恭喜你，你赢啦！");
                    }else{
                    	$('#kaijiangtitle').text("很遗憾，你输了~");
                    }
                	// 开奖订单
					$("#huodejine").text(res.win_money);
                    $("#dingdanhao").text(''+res['wx_order_number']);
                    $("#weihao").text(res['tail']);
                	
                    $('#kui').show();
                    
                    
                } else if( res['success']==false ){    //订单失败

                	$("#msg").html(res['msg']);
                	$('#error_msg').show();

                	setTimeout("$('#error_msg').hide()",1000);
                    //alert(res['msg']);
                    
                }
            }
        });
        
    }
    function toDecimal2(x) {
        var f = parseFloat(x);
        if (isNaN(f)) {
            return false;
        }
        var f = Math.round(x*100)/100;
        var s = f.toString();
        var rs = s.indexOf('.');
        if (rs < 0) {
            rs = s.length;
            s += '.';
        }
        while (s.length <= rs + 2) {
            s += '0';
        }
        return s;
    }
    $(document).ready(function(){
        var node = $.cookie('model');
        if(node != null){
            if(node == 1){//大小
                $('.fuck-dx').click();
            }
            if(node == 2){//单双
                $('.fuck-ds').click();
            }
        }
        var msg = '';
                                if(msg !=''){
            $('.models[data-modle=tk]').find('#msg').text(msg);
            $('.modle').css('display','block');
            $('.models[data-modle=tk]').css('display','block');
        }
                $('.zhu .da').click(function(){// 下注大小 单双
                $(this).addClass('yazhu').siblings('div').removeClass('yazhu');
                $(this).css({background:'#fff',color:'#b85c7d'});  
				
            $(this).css({background:'#fff',color:'#b85c7d'});
            $(this).siblings().css({background:'inherit',color:'#fff'});
            $(this).parent().parent().find('#bet_type').val($(this).data('type'));
        });
        var num=0;
        var multiple = 2.00;
        var onceMoney = 10;
        var poundage = 0.10;
        $('.kong .b').click(function(){		//下注数量减
            num=$(this).prev().find('i').html();
            num--;
            if (num<=0) {num=1}
            var youxi = Math.floor(num*onceMoney  * 100) / 100;



            var xiafei = Math.floor(num*onceMoney * poundage  * 100) / 100;
            $(this).prev().find('i').html(num);
            $(".shouyi").html(toDecimal2(youxi) +' 元');
            $(".xiafei").html(toDecimal2(xiafei) +' 元');
            $('#multiple').val(num);
        });

        $('.kong .d').click(function(){//下注数量加
            num=$(this).next().find('i').html();
            num = num *2;

            if (num>=200) {num=200}
            var youxi = Math.floor(num*onceMoney  * 100) / 100;
            var xiafei = Math.floor(num*onceMoney * poundage  * 100) / 100;
            $(this).next().find('i').html(num);
            $(".shouyi").html(toDecimal2(youxi) +' 元');
            $(".xiafei").html(toDecimal2(xiafei) +' 元');
            $('#multiple').val(num);
        });
        $('.kong .e').click(function(){// 最大
            num= 200;
            var youxi = Math.floor(num*onceMoney  * 100) / 100;
            var xiafei = Math.floor(num*onceMoney * poundage  * 100) / 100;
            $(this).parent('.kong').find('i').html(num);
            $(".shouyi").html(toDecimal2(youxi) +' 元');
            $(".xiafei").html(toDecimal2(xiafei) +' 元');
            $('#multiple').val(num);
        });
        $('.kong .a').click(function(){// 最小
            num=1;
            var youxi = Math.floor(num*onceMoney  * 100) / 100;
            var xiafei = Math.floor(num*onceMoney * poundage  * 100) / 100;
            $(this).parent('.kong').find('i').html(num);
            $(".shouyi").html(toDecimal2(youxi) +' 元');
            $(".xiafei").html(toDecimal2(xiafei) +' 元');
            $('#multiple').val(num);
        });

    });



</script>
</body>

</html>
