
function add_money(user_id){

    $.get("/admin/user/wallet/"+user_id+"/edit?type=div", {}, function(str){
        //console.log(str);
        layer.open({
            id:'page_wallet',
            shadeClose:true,
            area: '900px',
            scrollbar: false,
            type: 1,
            content: str //注意，如果str是object，那么需要字符拼接。
        });
        $("#page_wallet .box-header").hide();
        $('#page_wallet form .after-submit').parent().hide();

        $("#page_wallet .btn-primary").click(function(){
            layer.closeAll();
        });
    });
}

layui.use(['element', 'layer'], function(){
    var $ = layui.jquery
        , element = layui.element
        , layer = layui.layer;
    $("#tab-form-1 .box,#tab-form-2 .box").css('border-top','none');

    $("h2.layui-colla-title").click(function(){
        var user_id = $(this).attr('id');
        var html = $("#"+user_id).next().html();

        if(html == ''){
            get_log(user_id);
        }

        function get_log(user_id){
            var _method = $("input[name='_method']").val();
            var id = user_id;
            var data = {
                id : id,
                _method : _method,
                _token : LA.token
            };

            $.ajax({
                method: 'GET',
                url: '/admin/user/wallet/log/'+id,
                data: data,
                success: function (ret) {
                    var log = JSON.parse(ret);
                    $("#"+user_id).next().html('累计佣金金额总数:'+log.valueCount);
                }
            });
        }

    });
});
