<!--{include file="<!--{$mpath}-->block_header.tpl"}-->

<!--loading页开始-->
<div class="loading">
    <div class="loader">
        <div class="loader-inner pacman">
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            <div></div>
        </div>
    </div>
</div>
<!--loading页结束-->
<body>
<header class="mui-bar mui-bar-nav report-header box-s" id="header">
    <a href="index.php"><i class="iconfont icon-fanhui fl"></i></a>
    <p>订单支付</p>
</header>
<div id="main" class="mui-clearfix contaniner sorder">
    <div class="warning clearfloat box-s">
        提示：请在24小时内完成在线支付，逾期将视为订单无效
    </div>
    <div class="odernum clearfloat">
        <ul>
            <li>您的订单号：<!--{$orderinfo.ordernum}--></li>
            <li>应付金额：<span>￥<!--{$orderinfo.orderprice}--></span></li>
        </ul>
    </div>
    <div class="pay-method clearfloat">
        <ul>
            <li>请选择支付方式</li>
        </ul>
    </div>
    <div class="addlist clearfloat">
        <!--<div class="bottom clearfloat box-s">
            <section class="shopcar clearfloat">
                <div class="shopcar-checkbox fr">
                    <label for="shopcar" onselectstart="return false" class="shopcar-checkd"></label>
                    <input type="checkbox" id="shopcar"/>
                </div>
                <div class="sorder-list clearfloat fl">
                    <i class="iconfont icon-weixinzhifu fl"></i>
                    <div class="zuo fl">
                        <p class="tit">微信支付</p>
                        <p class="fu-tit">亿万用户的选择，更快更安全</p>
                    </div>
                </div>
            </section>
        </div>-->

        <div class="bottom clearfloat box-s">
            <section class="shopcar clearfloat">
                <div class="shopcar-checkbox fr">
                    <label for="shopcar" onselectstart="return false" class="shopcar-checkd" id="zhifubao"></label>
                    <input type="checkbox" id="shopcar"/>
                </div>
                <div class="sorder-list clearfloat fl">
                    <i class="iconfont icon-zhifubao fl"></i>
                    <div class="zuo fl">
                        <p class="tit">支付宝</p>
                        <p class="fu-tit">客户端支持最便捷！可银行卡支付！</p>
                    </div>
                </div>
            </section>
        </div>
        <div class="bottom clearfloat box-s">
         <section class="shopcar clearfloat">
             <div class="shopcar-checkbox fr">
                 <label for="shopcar" onselectstart="return false" id="yue"></label>
                 <input type="checkbox" id="shopcar"/>
             </div>
             <div class="sorder-list clearfloat fl">
                 <i class="iconfont icon-ruhezhuanqian fl"></i>
                 <div class="zuo fl">
                     <input type="hidden" id="yueprice" value="<!--{$data.balance}-->"/>
                     <p class="tit">余额支付(<span style="color:red;">￥<!--{$data.balance}--></span>)</p>
                     <p class="fu-tit">亿万用户的选择，更快更安全</p>
                 </div>
             </div>
         </section>
     </div>
    </div>
    <a href="javascript:void(0);" class="tui-btn pay" ordernum="<!--{$orderinfo.ordernum}-->" price="<!--{$orderinfo.orderprice}-->">
        确认支付
    </a>
</div>

</body>
<script type="text/javascript" src="<!--{$mpath}-->js/jquery-1.8.3.min.js" ></script>
<script src="<!--{$mpath}-->layer_mobile/layer.js"></script>
<script src="<!--{$mpath}-->js/fastclick.js"></script>
<script src="<!--{$mpath}-->js/mui.min.js"></script>
<script type="text/javascript" src="<!--{$mpath}-->js/hmt.js" ></script>
<script type="text/javascript">
    $(".shopcar-checkbox label").on('touchstart',function(){
        if($(this).hasClass('shopcar-checkd')){
            $(this).removeClass("shopcar-checkd")
        }else{
            $(".shopcar-checkbox label").removeClass("shopcar-checkd")
            $(this).addClass("shopcar-checkd")
        }
    })
     $('.pay').click(function(e){
         var zhifubao =$('#zhifubao').hasClass('shopcar-checkd');
         var yue =$('#yue').hasClass('shopcar-checkd');
         var url='/source/plugin/alipay/alipayapi.php';
         var order_number=$(this).attr('ordernum');
         var order_name='商城订单';
         var oeder_price=$(this).attr('price');
         var type=0;
         if(zhifubao==true){
             // alert(oeder_price);
             var parames = new Array();
             parames.push({ name: "WIDout_trade_no", value: order_number});
             parames.push({ name: "WIDsubject", value: order_name});
             parames.push({ name: "WIDtotal_fee", value: oeder_price});
             parames.push({ name: "WIDbody", value: order_name});
             Post(url, parames);
             return false;
         }
         if(yue==true){
             type=2;
             var balance = $('#yueprice').val();
           //  alert(oeder_price)
             if(eval(balance)<eval(oeder_price)){
                 alert('余额不足');
                 return  false;
             }
             $.post("<!--{$urlpath}-->index.php?c=product&a=yue_pay", {
                 order_number:order_number,oeder_price:oeder_price
             }, function (data) {
                 if (data.response == '1') {
                     layer.open({
                         content: data.result
                         ,skin: 'msg'
                         ,time: 2 //2秒后自动关闭
                     });
                     setTimeout( function(){
                         window.location.href = '/index.php?c=user&a=order_pay_wan&order_number'+order_number;
                     }, 1 * 1000 );//延迟5000毫米
                 } else {
                     layer.open({
                         content: data.result
                         ,skin: 'msg'
                         ,time: 2 //2秒后自动关闭
                     });
                 }
             }, "json");
         }
         if(type==0){
             alert('请选择支付方式');
             return  false;
         }

     });
            /*
         *功能： 模拟form表单的提交
         *参数： URL 跳转地址 PARAMTERS 参数
         */
       function Post(url, parames) {
            //创建form表单
             var temp_form = document.createElement("form");
             temp_form.action = url;
             //如需打开新窗口，form的target属性要设置为'_blank'
            temp_form.target = "_blank";
             temp_form.method = "post";
            temp_form.style.display = "none";
             //添加参数
             for (var item in parames) {
                var opt = document.createElement("input");
                 opt.name = parames[item].name;
                 opt.value = parames[item].value;
                 temp_form.appendChild(opt);
             }
            document.body.appendChild(temp_form);

             //提交数据
             temp_form.submit();
         }
</script>
</html>
