<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=Edge">
    <meta charset="UTF-8">
    <meta property="qc:admins" content="301275672376035363757" />
    <meta property="wb:webmaster" content="b1c2224d37e609de" />
    <title>
        <!--{$page_title}-->-<!--{$config.sitename}-->-
        <!--{$copyright_header}-->
    </title>
    <meta name="description" content="<!--{$page_description}-->">
    <meta name="keywords" content="<!--{$page_keyword}-->">
    <meta name="viewport" content="width=1226">
    <meta property="qc:admins" content="065116425576035363757" />
    <link rel="shortcut icon" href="" type="image/x-icon">
    <link rel="stylesheet" href="<!--{$skinpath}-->assets/css/base.min.css">
    <link href="<!--{$skinpath}-->assets/css/global.css" rel="stylesheet" type="text/css"  />
    <script src="<!--{$skinpath}-->assets/js/jquery-1.8.2.min.js"></script>
    <script src="<!--{$skinpath}-->assets/js/zzsc.js"></script>
    <link rel="stylesheet" type="text/css" href="<!--{$skinpath}-->assets/css/goods-detail.min.css" />
    <link rel="stylesheet" type="text/css" href="<!--{$skinpath}-->assets/jqZoom/css/jqzoom.css" />
    <script type="text/javascript" src="<!--{$skinpath}-->assets/jqZoom/js/jqzoom.pack.1.0.1.js"></script>
    <link rel="stylesheet" type="text/css" href="<!--{$skinpath}-->assets/css/cart.css">
    <script type="text/javascript" src="<!--{$skinpath}-->assets/js/layer.js"></script>
    <script type="text/javascript" src="<!--{$skinpath}-->assets/js/layui.js"></script>
    <script type="text/javascript" src="<!--{$skinpath}-->assets/js/bootstrap.min.js"></script>
    <script type="text/javascript" src="<!--{$skinpath}-->assets/js/qrcode.js"></script>
</head>
<style>
    .xm-pagenavi {
        height: 30px;
        padding: 15px 0;
        text-align: center;
    }

</style>
<body>
<div class="site-topbar">
    <div class="container">
        <div class="topbar-nav">
            <a href="index.php" >首页</a><span class="sep">|</span>
        </div>
        <div class="topbar-cart" id="J_miniCartTrigger">
            <a class="cart-mini" id="J_miniCartBtn" href="./index.php?c=user&a=shopping">
                <i class="iconfont"></i>去购物车
            </a>
        </div>
        <div class="topbar-info" id="J_userInfo">
            <!--{if !empty($check)}-->

            <a class="link" href="./index.php?c=user">个人中心</a><a class="link userid" >欢迎<!--{$username}--></a>&nbsp;<span class="sep">|</span><a class="link" href="javascript:;" id="userexit" >退出</a>

            <!--{else}-->

            <a class="link" href="./index.php?c=user&a=login">登录</a><span class="sep">|</span><a class="link" href="./index.php?c=user&a=register" >注册</a>

            <!--{/if}-->


        </div>
    </div>
</div>

<div class="site-header">
    <div class="container">
        <div class="header-logo">
            <a class="logo" id="logo" href="./index.php" title="" style="width:231px;height:61px;">
                <img src="<!--{$config.logo}-->" alt="">
            </a>
        </div>
        <div class="header-nav">
            <ul class="nav-list J_navMainList clearfix" style="width: 880px">
                <li id="J_navCategory" class="nav-category">
                    <a class="link-category" href="" style="visibility: hidden;"><span class="text">全部商品分类</span></a>
                    <div class="site-category">
                        <script type="text/javascript">
                            $(function() {
                                $('#J_categoryList>.category-item').hover(function() {
                                    $(this).addClass('category-item-active').siblings().removeClass('category-item-active');
                                }, function() {
                                    $(this).removeClass('category-item-active');
                                });
                            })
                        </script>
                        <ul id="J_categoryList" class="site-category-list clearfix">
                            <!--{assign var='productcategory' value=vo_category("type={treecat} rootid={119}")}-->
                            <!--{foreach $productcategory as $key => $value}-->
                            <li class="category-item ">
                                <a class="title" href="<!--{$value.url}-->">
                                    <!--{$value.catname}--><i class="iconfont"></i></a>
                                <div class="children clearfix children-col-3">
                                    <ul class="children-list children-list-col children-list-col-1">
                                        <!--{foreach  $value.childcatgory as $k => $v}-->
                                        <!--{if $k<=5}-->
                                        <li class="star-goods">
                                            <a class="link" href="<!--{$v.url}-->">
                                                <span class="text"><!--{$v.catname|mb_substr:0:8:'utf8'}--></span>
                                            </a>
                                            <a class="btn btn-line-primary btn-small btn-buy" href="<!--{$v.url}-->">选购</a>
                                        </li>
                                        <!--{/if}-->
                                        <!--{/foreach}-->
                                    </ul>
                                    <ul class="children-list children-list-col children-list-col-2">
                                        <!--{foreach  $value.childcatgory as $k => $v}-->
                                        <!--{if $k<=11&&$k>=6}-->
                                        <li class="star-goods">
                                            <a class="link" href="<!--{$v.url}-->">
                                                <span class="text"><!--{$v.catname|mb_substr:0:8:'utf8'}--></span>
                                            </a>
                                            <a class="btn btn-line-primary btn-small btn-buy" href="<!--{$v.url}-->">选购</a>
                                        </li>
                                        <!--{/if}-->
                                        <!--{/foreach}-->
                                    </ul>
                                    <ul class="children-list children-list-col children-list-col-3">
                                        <!--{foreach  $value.childcatgory as $k => $v}-->
                                        <!--{if $k<=17&&$k>=13}-->
                                        <li class="star-goods">
                                            <a class="link" href="<!--{$v.url}-->">
                                                <span class="text"><!--{$v.catname|mb_substr:0:8:'utf8'}--></span>
                                            </a>
                                            <a class="btn btn-line-primary btn-small btn-buy" href="<!--{$v.url}-->">选购</a>
                                        </li>
                                        <!--{/if}-->
                                        <!--{/foreach}-->
                                    </ul>
                                </div>
                            </li>

                            <!--{/foreach}-->
                        </ul>
                    </div>
                </li>
                <!--{assign var='mymenu' value=vo_category("type={sedmenu}")}-->
                <!--{foreach $mymenu as $v}-->
                <li class="nav-item">
                    <a class="link" href="<!--{$v.url}-->"><span class="text"><!--{$v.catname}--></span><span class="arrow"></span></a>
                </li>
                <!--{/foreach}-->
            </ul>
        </div>
        <div class="header-search">
            <form id="J_searchForm" class="search-form clearfix" action="index.php?c=search" method="get">
                <input type="hidden" name="c" id="searchtype" value="search">
                <label for="search" class="hide">站内搜索</label>
                <input class="search-text" type="search" id="search" name="content" autocomplete="off" placeholder="搜索产品">
                <input type="submit" class="search-btn iconfont" value="">
                <div class="search-hot-words">
                    <a href=""></a>
                    <a href=""></a>
                </div>
                <div id="J_keywordList" class="keyword-list hide">
                    <ul class="result-list"></ul>
                </div>
            </form>
        </div>
    </div>

</div>
<!-------------------------------------- 头部结束 -------------------------------------->
<link rel="stylesheet" href="<!--{$skinpath}-->assets/css/main.css">
<!-------------------------------------- 主体开始 -------------------------------------->

<link rel="stylesheet" href="<!--{$skinpath}-->assets/css/layer.css">

<div class="page-main user-main">
    <div class="container">
        <!--{if !empty($check)}-->
        <div class="row">
            <div class="span4">
                <div class="uc-box uc-sub-box">
                    <div class="uc-nav-box">
                        <div class="box-hd">
                            <h3 class="title">个人中心</h3>
                        </div>
                        <div class="box-bd">
                            <ul class="uc-nav-list J_navList">
                                <li><a class="J_noRandom" href="index.php?c=user">我的个人中心</a></li>

                                <li><a class="J_noRandom" href="./index.php?c=user&a=user_info">个人信息</a></li>
                                <li><a class="J_noRandom" href="./index.php?c=user&a=profit">我的收益</a></li>
                                <li><a class="J_noRandom" href="index.php?c=user&a=share">我的推广</a></li>
                                <li><a class="J_noRandom" href="./index.php?c=user&a=user_address">收货地址</a></li>
                                <li><a class="J_noRandom" href="./index.php?c=user&a=user_edit">修改密码</a></li>
                            </ul>
                        </div>
                    </div>
                    <div class="uc-nav-box">
                        <div class="box-hd">
                            <h3 class="title">订单中心</h3>
                        </div>
                        <div class="box-bd">
                            <ul class="uc-nav-list J_navList">

                                <li  class="active"><a class="J_noRandom" href="./index.php?c=user&a=order_list">我的订单</a></li>
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
            <div class="span16">
                <div class="uc-box uc-main-box">
                    <div class="uc-content-box order-view-box">
                        <div class="box-hd">
                            <h1 class="title">订单详情</h1>
                            <div class="more clearfix">
                                <h2 class="subtitle">订单号：<!--{$data.ordernum}-->  
                                </h2>
                               
                                <h2 class="subtitle" style="font-size:15px; margin-left: 50px; color: orangered;">状态：<!--{$data.status}-->  
                                </h2>
                                <input type="hidden" id="yueprice" value="<!--{$mbrdata.balance}-->"/>
                                <div class="actions">
                                    <!--<a id="J_cancelOrder" class="btn btn-small btn-line-gray" title="取消订单" data-order-id="5190905981706411" href="javascript:;" data-confirm="你真的要取消此订单吗?">取消订单</a>
                                    -->

                                    
                            </div>
                        </div>
                        <div class="box-bd">
                            <div class="uc-order-item uc-order-item-pay">
                                <div class="order-detail">


                                    <table class="order-items-table">
                                        <tbody>
                                        <!--{foreach $data.goodslist as $v}-->
                                        <tr>
                                            <td class="col col-thumb">
                                                <div class="figure figure-thumb">
                                                    <a target="_blank" href="//item.mi.com/1192500029.html">
                                                        <img src="<!--{$v.goodsimg}-->" width="80" height="80" alt="<!--{$v.goodsname}-->">
                                                    </a>
                                                </div>
                                            </td>
                                            <td class="col col-name">
                                                <p class="name">
                                                    <a target="_blank" href="//item.mi.com/1192500029.html" ><!--{$v.goodsname}--></a>
                                                </p>
                                            </td>
                                            <td class="col col-price">

                                                <p class="price"><!--{$v.goodsprice}--> <!--{if <!--{$data.is_integral}-->=='1'}-->
                                                    积分                                                                <!--{else}-->
                                                    元                                                                <!--{/if}-->  × <!--{$v.goodsnum}-->  </p>

                                            </td>
                                            <td class="col col-actions">
                                            </td>
                                        </tr>
                                        <!--{/foreach}-->

                                        </tbody></table>
                                </div>


                                <!-- 订金盲约订单 -->


                                <div id="editAddr" class="order-detail-info">

                                    <h3>收货信息</h3>
                                    <table class="info-table">
                                        <tbody><tr>
                                            <th>姓&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;名：</th>
                                            <td><!--{$data.linkman}--></td>
                                        </tr>
                                        <tr>
                                            <th>联系电话：</th>
                                            <td><!--{$data.linkphone}--></td>
                                        </tr>
                                        <tr>
                                            <th>收货地址：</th>
                                            <td><!--{$data.province}--><!--{$data.city}--><!--{$data.county}--><!--{$data.address}-->   </td>
                                        </tr>
                                        </tbody></table>
                                    <div class="actions">

                                   <!--     <a class="btn btn-small btn-line-gray J_editAddr" href="#editAddr" data-get="https://order.mi.com/order/updaterender/orderId/5190905981706411/type/address" data-update="https://order.mi.com/order/updatehandler/orderId/5190905981706411/type/address" data-stat-id="f3585d01715c42ca" onclick="_msq.push(['trackEvent', 'def887f04ebe922f-f3585d01715c42ca', '#editAddr', 'pcpid', '']);">修改</a>
                                   -->
                                    </div>

                                </div>

                                

                                <div class="order-detail-total">
                                    <table class="total-table">
                                        <tbody>
                                        <!--{if <!--{$data.is_integral}-->=='1'}-->
                                        <tr>
                                            <th>商品所需积分：</th>
                                            <td><span class="num"><!--{$data.orderprice}--></span></td>
                                        </tr>
                                        <tr>
                                            <th>运费：</th>
                                            <td><span class="num">0</span>元</td>
                                        </tr>
                                        <tr>
                                            <th class="total">花费积分：</th>
                                            <td class="total"><span class="num"><!--{$data.orderprice}--></span></td>
                                        </tr>                                                              <!--{else}-->

                                        <tr>
                                            <th>商品总价：</th>
                                            <td><span class="num"><!--{$data.orderprice}--></span>元</td>
                                        </tr>
                                        <tr>
                                            <th>运费：</th>
                                            <td><span class="num">0</span>元</td>
                                        </tr>
                                        <tr>
                                            <th class="total">应付金额：</th>
                                            <td class="total"><span class="num"><!--{$data.orderprice}--></span>元</td>
                                        </tr>
                                                                                                 <!--{/if}-->
                                        <!-- 预售 开始支付定金 -->


                                        </tbody></table>
                                </div>
                            <div id="editTime" class="order-detail-info">
                                        <!--{if <!--{$data.status}-->=='待付款'}-->
                                            <h3>支付方式</h3>
                                   <table class="info-table">
                                      
                                   
                                    
                                        <tbody>
                                            
                                            <tr>
                                            <th>支付方式：</th>
                                            <td >
                                               <div class="col-sm-4">
                                                    <button type="button"  data-paytype="alipay"
                                                            class="btn btn-lg btn-outline btn-default btn-squared padding-0 zhifubao" ordernum="<!--{$data.ordernum}-->"><img
                                                                src="http://www.8cms.com/data/attachment/link/payOnline_zfb.png">
                                                    </button>

                                                </div>
                                            </td>
                                            <td style="padding-left:40px;">
                                                <!--{assign var='plugin_data' value=XHook::doAction('adm_wx_pay_ext')}-->
                                                <div align="center" id="qrcode">
                                                            <div id="myDiv"></div><div id="timer" style="display: none;">0</div>
                                                    </div>
                                            </td>
                                            <td style="padding-left:40px;">
                                                <div class="col-sm-4">
                                                    <button type="button"  data-paytype="alipay"
                                                            class="btn btn-lg btn-outline btn-default btn-squared padding-0 yuepay" ordernum="<!--{$data.ordernum}-->">
                                                        <span style="color:orange;">余额支付</span>
                                                    </button>

                                                </div>
                                            </td>
                                        </tr>
                                        
                                        </tbody></table>
                                                                 <!--{/if}-->
                                    <div class="actions">
                                    </div>
                                </div>

                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <!--{else}-->
        <a class="btn btn-primary" href="./index.php?c=user&a=login">去登录</a>
        <!--{/if}-->
    </div>
</div>
<input type="hidden" id="ordernum" value="<!--{$data.ordernum}-->"/>    
<input type="hidden" id="order_number" value=""/>




<script>
    layui.use('upload', function(){
        var $ = layui.jquery,
            upload = layui.upload;
        $('.zhifubao').click(function(e){
              var url='source/plugin/alipay/alipayapi.php';
            var order_number=$(this).attr('ordernum');
              var order_name='商城订单';
            $.post("<!--{$urlpath}-->index.php?c=user&a=order_detail", {
                    order_number:order_number,type:1
             }, function (data) {
                    if (data.response == '1') {
                       var oeder_price=data.data.orderprice;                      
                            // 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;
                        
                    

                    } else {
                        layer.open({
                            content: data.result
                            ,skin: 'msg'
                            ,time: 2 //2秒后自动关闭
                        });
                    }
            }, "json");      
        });
         $('.yuepay').click(function(e){       
            var order_number=$(this).attr('ordernum');
            $.post("<!--{$urlpath}-->index.php?c=user&a=order_detail", {
                    order_number:order_number,type:1
             }, function (data) {
                    if (data.response == '1') {
                         var oeder_price=data.data.orderprice;                      
                         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: 10 //2秒后自动关闭
                                // });
                                    alert(data.result);
                                    setTimeout( function(){
                                        //return false;
                                    // window.location.href = 'index.php?c=user&a=order_pay_wan&order_number'+order_number;
                                        window.location.href = 'index.php?c=user&a=order_list';
                                    }, 1 * 1000 );//延迟5000毫米
                                } else {
                                    layer.open({
                                        content: data.result
                                        ,skin: 'msg'
                                        ,time: 2 //2秒后自动关闭
                                    });
                                }
                            }, "json");
                    } else {
                        layer.open({
                            content: data.result
                            ,skin: 'msg'
                            ,time: 2 //2秒后自动关闭
                        });
                    }
            }, "json");      
        });
        function pay(omb,gdsnm,ototal){
            var url='/source/plugin/alipay/alipayapi.php';
            var order_number=omb;
            var order_name=gdsnm;
            var oeder_price=ototal;
            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;
        }
        /*
     *功能： 模拟form表单的提交
     *参数： URL 跳转地址 PARAMTERS 参数
     */
        function Post(URL, PARAMTERS) {
            //创建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 PARAMTERS) {
                var opt = document.createElement("input");
                opt.name = PARAMTERS[item].name;
                opt.value = PARAMTERS[item].value;
                temp_form.appendChild(opt);
            }
            document.body.appendChild(temp_form);
            //提交数据
            temp_form.submit();
        }



    });
</script>
<script>
    //设置每隔1000毫秒执行一次load() 方法
    var myIntval=setInterval(function(){load()},1000);
    function load(){
        document.getElementById("timer").innerHTML=parseInt(document.getElementById("timer").innerHTML)+1;
        var order_number=$('#order_number').val();
        var xmlhttp;
        if (window.XMLHttpRequest){
            // code for IE7+, Firefox, Chrome, Opera, Safari
            xmlhttp=new XMLHttpRequest();
        }else{
            // code for IE6, IE5
            xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
        xmlhttp.onreadystatechange=function(){
            if (xmlhttp.readyState==4 && xmlhttp.status==200){
                trade_state=xmlhttp.responseText.replace(/\s/g,'');
                if(trade_state=='SUCCESS'){
                    document.getElementById("myDiv").innerHTML='支付成功';
                    //alert(transaction_id);
                    //延迟3000毫秒执行tz() 方法
                    clearInterval(myIntval);
                    setTimeout("location.href='index.php?c=user&a=y_order'",3000);
                }else if(trade_state=='REFUND'){
                    document.getElementById("myDiv").innerHTML='转入退款';
                    clearInterval(myIntval);
                }else if(trade_state=='NOTPAY'){
                    document.getElementById("myDiv").innerHTML='请扫码支付';
                }else if(trade_state=='CLOSED'){
                    document.getElementById("myDiv").innerHTML='已关闭';
                    clearInterval(myIntval);
                }else if(trade_state=='REVOKED'){
                    document.getElementById("myDiv").innerHTML='已撤销';
                    clearInterval(myIntval);
                }else if(trade_state=='USERPAYING'){
                    document.getElementById("myDiv").innerHTML='用户支付中';
                }else if(trade_state=='PAYERROR'){
                    document.getElementById("myDiv").innerHTML='支付失败';
                    clearInterval(myIntval);
                }
            }
        }
        //orderquery.php 文件返回订单状态，通过订单状态确定支付状态
        if(order_number!=''){
            xmlhttp.open("POST","index.php?c=user&a=order_query&out_trade_no",false);
            //下面这句话必须有
            //把标签/值对添加到要发送的头文件。
            xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
            xmlhttp.send("out_trade_no="+order_number);
        }
    }
    
       	function wx_pay() {
            var order_number=$('#ordernum').val();
            var order_name='商城订单';
             var desc='商城订单';
            $.post("<!--{$urlpath}-->index.php?c=user&a=order_detail", {
                    order_number:order_number,type:1
             }, function (data) {
                    if (data.response == '1') {
                         var order_price=data.data.orderprice;                      
                             $.ajax({
									url: "index.php?c=user&a=ajaxorder_wx",
									type: "post",
									data:{order_number:order_number,order_name:order_name,order_price:order_price,desc:desc},
									dataType: "json",
									success: function (data) {
										var json = eval(data);
										var response = json.response;
										var code_url = json.code_url;
										var order_number = json.order_number;
										if (response == "1") {
											//参数1表示图像大小，取值范围1-10；参数2表示质量，取值范围'L','M','Q','H'
											var qr = qrcode(10, 'M');
											$('#order_number').val(order_number);
											qr.addData(code_url);
											qr.make();
											var wording=document.createElement('p');
											wording.innerHTML = "";
											var code=document.createElement('DIV');
											code.innerHTML = qr.createImgTag();
											var element=document.getElementById("qrcode");
											element.appendChild(wording);
											element.appendChild(code);
										} else {
											alert(result);
										}
									},
								});
                    } else {
                        layer.open({
                            content: data.result
                            ,skin: 'msg'
                            ,time: 2 //2秒后自动关闭
                        });
                    }
            }, "json");
                                                        
	}
</script>
<!-------------------------------------- 主体结束 -------------------------------------->
<!-------------------------------------- 尾部开始 -------------------------------------->

<!--{include file="<!--{$tplpath}-->botton.tpl"}-->
<!-------------------------------------- 尾部结束 -------------------------------------->

