<!--{include file="<!--{$tplpath}-->block_header.tpl"}-->
<!-------------------------------------- 头部结束 -------------------------------------->
    <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 class="active"><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><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 portal-content-box">
                  <div class="box-bd">
                      <div class="portal-main clearfix">
                          <div class="user-card">
                              <h2 class="username">  <!--{if <!--{$data.nickname}-->==''}-->
                                  <!--{$data.name}-->
                                  <!--{else}-->
                                  <!--{$data.nickname}-->
                                  <!--{/if}--></h2>
                              <p class="tip"><!--{$hao}-->～</p>
                              <a class="link" href="/index.php?c=user&a=user_info" target="_blank" data-stat-id="30d619c492c43471" onclick="_msq.push(['trackEvent', 'f4f3444fdfa3d27a-30d619c492c43471', 'https://account.xiaomi.com/pass/userInfo', 'pcpid', '']);">修改个人信息 &gt;</a>
                              <!--{if <!--{$data.pic}-->==''}-->
                              <img class="avatar" src="<!--{$mpath}-->images/timg.png" width="150" height="150" alt="<!--{$data.nickname}-->。">
                              <!--{else}-->
                              <img class="avatar" src="<!--{$data.pic}-->" width="150" height="150" alt="<!--{$data.nickname}-->">
                              <!--{/if}-->

                          </div>
                          <div class="user-actions">
                              <ul class="action-list">
                                  <li>我的余额：<span class="tel level-1"><!--{$data.balance}-->￥</span>
    &nbsp;    &nbsp;
                                         <a href="index.php?c=user&a=recharge"><span style="color:red;">充值</span></a>

                                  </li>
                                  <li>绑定手机：<span class="tel"><!--{$data.name}--></span></li>

                                  <li>绑定邮箱：<span class="tel">
                                            <!--{if <!--{$data.email}-->==''}-->
                                                    未绑定
                                          <!--{else}-->
                                          <!--{$data.email}-->
                                          <!--{/if}-->

                                      </span></li>
                              </ul>
                          </div>
                      </div>
                      <div class="portal-sub">
                          <ul class="info-list clearfix">
                              <li>
                                  <h3>待支付的订单：<span class="num"><!--{$total}--></span></h3>
                                  <a href="index.php?c=user&a=order_list&status=1" >查看待支付订单<i class="iconfont"></i></a>
                                  <img src="//s01.mifile.cn/i/user/portal-icon-1.png" alt="">
                              </li>
                              <li>
                                  <h3>待收货的订单：<span class="num"><!--{$total1}--></span></h3>
                                  <a href="index.php?c=user&a=order_list&status=3">查看待收货订单<i class="iconfont"></i></a>
                                  <img src="//s01.mifile.cn/i/user/portal-icon-2.png" alt="">
                              </li>
                              <li>
                                  <h3>我的积分：<span class="num"><!--{$data.integral}--></span></h3>
                                  <a href="index.php?c=user&a=profit" >我的收益<i class="iconfont"></i></a>

                                  <img src="//s01.mifile.cn/i/user/portal-icon-3.png" alt="">
                              </li>
                              <li>
                                  <h3>预计收益：<span class="num"><!--{$yuji}--></span></h3>
                                  <a href="index.php?c=user&a=profit">我的收益<i class="iconfont"></i></a>
                                  <img src="//s01.mifile.cn/i/user/portal-icon-4.png" alt="">
                              </li>
                          </ul>
                      </div>
                  </div>
              </div>
          </div>
      </div>
    </div>
        <!--{else}-->
        <a class="btn btn-primary" href="./index.php?c=user&a=login">去登录</a>
        <!--{/if}-->
  </div>
</div>



<script>
              $(function(){
                    $("#edit_btn").bind("click", function(){ //提交

                            $nickname=$("[name=nickname]").val();

                            $phone=$("[name=phone]").val();
                       
                            $email=$("[name=youxiang]").val();
                         
                            $sex='';
                            if($('#sex_0').is(':checked')) {
                                 $sex="male";
                            }

                            if($('#sex_1').is(':checked')) {
                                $sex="female";
                            }
                            $.ajax({
                                    type: "POST",
                                    url: "index.php?c=user&a=ajaxeditinfo",
                                    cache: false,
                                    data: {nickname:$nickname,phone:$phone,email:$email,sex:$sex},
                                    dataType: "json",
                                    success: function(data) {
                                            var json = eval(data);
                                            var response = json.response;
                                            var result = json.result;                                          
                                            if (response == "1") {
                                                  alert(result);
                                                  
                                                  window.location.reload();
                                            }
                                            else {
                                                  alert(result);
                                            }
                                    },
                                   
                                   
                            });

                    });

            });
         </script>
        
 <script>
	layui.use('upload', function(){
  var $ = layui.jquery,
  upload = layui.upload;
  
  //普通图片上传
  var uploadInst = upload.render({
    elem: '#testList',
    url: 'index.php?c=user&a=upload'
    ,before: function(obj){
      //预读本地文件示例，不支持ie8
      obj.preview(function(index, file, result){
        $('#demo1').attr('src', result); //图片链接（base64）
      });
    }
    ,done: function(res){
      //如果上传失败
      if(res.code > 0){
        return layer.msg('上传失败');
      }else{
          $("[name=img]").attr("src",res.name);
          $("[name=headerimg]").val(res.name1);
      }
      //上传成功
    }
    ,error: function(){
      //演示失败状态，并实现重传
      var demoText = $('#demoText');
      demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-xs demo-reload">重试</a>');
      demoText.find('.demo-reload').on('click', function(){
        uploadInst.upload();
      });
    }
  });
  

  
  //绑定原始文件域
  upload.render({
    elem: '#test20'
    ,url: '/upload/'
    ,done: function(res){
      console.log(res)
    }
  });
  

  //支付
  $("[name=usernowpay]").bind("click",function () {
    var omb = $(this).attr('data-ordernumber');
    var gdsnm = $(this).attr('data-ordername');
    var ototal = $(this).attr('data-orderprice');
    pay(omb,gdsnm,ototal);
  })
      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();
         }

  // 查看订单详情
  $("[name=userordxq]").bind("click",function () {

  })


});
</script>        

        <!-------------------------------------- 主体结束 -------------------------------------->
        <!-------------------------------------- 尾部开始 -------------------------------------->

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

