<!--{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><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 class="active"><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">
                        <div class="box-hd">
                            <h1 class="title">我的收益</h1>
                            <div class="more clearfix">
                                <ul class="filter-list J_addrType">
                                    <li <!--{if <!--{$status}-->==''}--> class="first active"<!--{/if}-->>
                                        <a href="index.php?c=user&a=profit">全部记录<span class="m-num"></span></a>
                                    </li>
                                    <li <!--{if <!--{$status}-->=='1'}--> class=" active"<!--{/if}-->>
                                        <a href="index.php?c=user&a=profit&type=1" >收入记录</a>
                                    </li>
                                    <li <!--{if <!--{$status}-->=='2'}--> class=" active"<!--{/if}-->>
                                        <a href="index.php?c=user&a=profit&type=2">支出记录</a>
                                    </li>
                                </ul>
                            </div>

                        </div>
                        <div class="box-bd">
                            <div id="J_orderList">
                                <!--{if empty($list)}-->
                                <p class="empty">当前没有交易订单。</p>
                                <!--{else}-->
                                <!--{foreach $list as $volist}-->
                                <ul class="order-list" style="margin-left: -40px;" >
                                    <li class="uc-order-item uc-order-item-pay" style="list-style:none;">
                                        <div class="order-detail">

                                            <table class="order-detail-table">
                                                <thead>
                                                <tr>
                                                    <th class="col-main">
                                                        <span class="fl tit"><!--{$volist.desc}--></span>
                                                        <!--{if <!--{$volist.status}-->=='1'}-->冻结中<!--{/if}-->
                                                    </th>
                                                    <th class="col-sub" style="float: right;">
                                                        <span class="fr time" style="float: right;"><!--{$volist.time|date_format:"%Y-%m-%d %H:%M:%S"}--></span>
                                                    </th>
                                                </tr>
                                                </thead>
                                            </table>
                                        </div>
                                    </li>
                                </ul>
                                <!--{/foreach}-->
                                <!--{/if}-->
                            </div>
                            <div id="J_orderListPages">
                                <div class="xm-pagenavi">
                                    <!--{$showpage}-->
                                </div>

                            </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"}-->
<!-------------------------------------- 尾部结束 -------------------------------------->

