<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

    <meta charset="UTF-8">
    <title>充值查询列表|----软件管理平台</title>
    <link href="http://admin.vlcms.com/Public/icon.ico" type="image/x-icon" rel="shortcut icon">
    <link rel="stylesheet" type="text/css" href="__CSS__/base.css" media="all">
    <link rel="stylesheet" type="text/css" href="__CSS__/common.css" media="all">
    <link rel="stylesheet" type="text/css" href="__CSS__/module.css">
    <link rel="stylesheet" type="text/css" href="__CSS__/style.css" media="all">
    <link rel="stylesheet" type="text/css" href="__CSS__/default_color.css" media="all">
    <link rel="stylesheet" href="__CSS__/select2.min.css" type="text/css"/>
    <script type="text/javascript" src="__STATIC__/jquery-2.0.3.min.js"></script>
    <script type="text/javascript" src="__JS__/jquery.mousewheel.js"></script>
    <script type="text/javascript" src="__JS__/select2.min.js"></script>
</head>
<style>
    html {
        min-width:100%;
    }
    body {
        padding: 0px;
    }
      .select2-container--default .select2-selection--single {
            color: #000;
        resize: none;
        border-width: 1px;
        border-style: solid;
        border-color: #a7b5bc #ced9df #ced9df #a7b5bc;
        box-shadow: 0px 3px 3px #F7F8F9 inset;height:35px;
        height:28px;border-radius:3px;font-size:12px;
    }
    .select2-container--default .select2-selection--single .select2-selection__rendered {
        line-height:35px;
        line-height:28px;
    }
    .select2-container--default .select2-selection--single .select2-selection__arrow {
        height:26px;
    }
    .select2-container--default .select2-search--dropdown .select2-search__field {
      height:26px;line-height:26px;font-size:12px;
    }
    .select2-results__option[aria-selected] {font-size:12px;}
</style>
<body>
<div id="main" class="main" style="min-height: 342px;width: 97%;">
    <script src="__STATIC__/layer/layer.js" type="text/javascript"></script>

    <link rel="stylesheet" type="text/css" href="__CSS__/admin_table.css" media="all">
    <script type="text/javascript" src="__STATIC__/uploadify/jquery.uploadify.min.js"></script>
    <div class="jssearch fl cf search_list">
            <div class="input-list search-title-box">
              <label>搜索:</label>
            </div>
            <div class="input-list">
                <input type="text" readonly id="time-start" name="timestart" class="" value="{:I('get.timestart')}"
                       placeholder="开始时间"/>
                <div class="input-append date" id="datetimepicker" style="display:inline-block">
                    <input type="text" readonly id="time-end" name="timeend" class="" value="{:I('get.timeend')}"
                           placeholder="结束时间"/>
                    <span class="add-on"><i class="icon-th"></i></span>
                </div>
            </div>
            <div class="input-list input-list-game search_label_rehab" >
                <select id="game_name" name="game_id" class="select_gallery" >
                    <option value="">游戏名称</option>
                    <volist name=":getAllIosGame()" id="vo">
                        <option value="{$vo.id}" <?php echo $vo['id'] == I('game_id') ? 'selected':''; ?>  >{$vo.game_name}</option>
                    </volist>
                </select>   
            </div>
            <input type="hidden" name="" value="" class="sortBy">

            <div class="input-list search_item">
                <a class="sch-btn" href="javascript:;" id="search"
                   url="{:U('SuperStatistical/lists','model='.$model['name'] . '&row='.I('row'),false)}">搜索</a>
            </div>
      </div>
    <!-- 数据列表 -->
    <div class="data_list box_mt">
        <div class="">
            <table>
                <!-- 表头 -->
                <thead>
                <tr>
                    <th>游戏</th>
                    <th>已授权游戏数量</th>
                    <th>超级签被购买数量</th>
                    <th>推广超级签金额</th>
                    <th>官方超级签金额</th>
                </tr>
                </thead>
                <!-- 列表 -->
                <tbody>
                <volist name="data" id="vo">
                    <tr>
                        <td>{$vo.game_name}</td>
                        <td>{$vo.authorization_num}</td>
                        <td>{$vo.pay_game_supersign}</td>
                        <td>{$vo.promote_super_money}</td>
                        <td>{$vo.official_super_money}</td>
                    </tr>
                </volist>
                <tr>
                    <td>合计</td>
                    <td>{$num.authorization}</td>
                    <td>{$num.pay_num}</td>
                    <td>{$num.promote_super_money}</td>
                    <td>{$num.official_super_money}</td>
                </tr>
                </tbody>
            </table>
        </div>
    </div>
    <div class="page">
        <a class="sch-btn" href="{:U('Export/expUser',array_merge(array('id'=>22,'xlsname'=>'游戏授权数量余额统计'),I('get.')))}">导出</a>
        {$_page|default=''}
    </div>
</div>
</body>
<link href="__STATIC__/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
    <php>if(C('COLOR_STYLE')=='blue_color') echo '
        <link href="__STATIC__/datetimepicker/css/datetimepicker_blue.css" rel="stylesheet" type="text/css">
        ';
    </php>
    <link href="__STATIC__/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
    <script type="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
    <script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"
            charset="UTF-8"></script>
    <script src="__STATIC__/layer/layer.js" type="text/javascript"></script>

<script type="text/javascript">
    $(function(){
        $(".select_gallery").select2();
        $("#search").click(function(){
        var url = $(this).attr('url');
        var query  = $('.jssearch').find('input').serialize();
        query  += "&" + $('.jssearch').find('select').serialize();
        query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
        query = query.replace(/^&/g,'');
        if( url.indexOf('?')>0 ){
            url += '&' + query;
        }else{
            url += '?' + query;
        }
        var start = $("#time_start").val();
        var end =   $("#time_end").val();
        if(start !='' && end != ''){
            if (Date.parse(start) > Date.parse(end)){
                layer.msg('开始时间必须小于等于结束时间');
                return false;
            }
        }
        window.location.href = url;
    });
        $('#time-start').datetimepicker({
                format: 'yyyy-mm-dd',
                language: "zh-CN",
                showMeridian:true,
                pickDate:true,
                minView: 2,
                autoclose: true,
                pickTime:true,
                todayBtn:true,
            }).on('change',function(ev){
                var val = new Date($.trim($(this).val())).getTime();
                var end = new Date($.trim($('#time-end').val())).getTime();
                if (val>end) {
                    layer.msg('开始时间大于结束时间!');$(this).val('');
                }
                return false;
            });

            $("#time-end").datetimepicker({
                format:"yyyy-mm-dd",
                language: "zh-CN",
                showMeridian:true,
                minView:2,
                autoclose:true,
                todayBtn:true,
            }).on('change',function(ev){
                var val = new Date($.trim($(this).val())).getTime();
                var start = new Date($.trim($('#time-start').val())).getTime();
                if (val<start) {
                    layer.msg('开始时间大于结束时间!');$(this).val('');
                }
                return false;
            });
        var promote_id = "{:I('promote_id')}";
         $("#promote_level").change(function(){
            $.ajax({
                 url:"{:U('Ajax/getPromotersByLevel')}",
                 type:"get",
                 data:{level:$("#promote_level option:selected").val()},
                 dataType:'json',
                 success:function(response){
                    str = '<option value="">请选择推广员</option><option value="0"'+(promote_id && 0 == promote_id?'selected':'')+'>{:C(\'OFFICIEL_CHANNEL\')}</option><option value="UC"'+(promote_id && 'UC' == promote_id?'selected':'')+'>UC渠道</option>';
                    //  $.each(response.data, function(index, item){
                    //      console.log(item.id);
                    //     str += '<option value="'+item.id+' '+(promote_id && item.id == promote_id?'selected':'')+'">'+item.nickname+'</option>';
                    //  });
                    data = response.data;
                     for (var i in data){
                         str += "<option value='"+data[i].id+"' "+(promote_id && data[i].id == promote_id?'selected':'')+">"+data[i].nickname+"</option>"
                     }
                     $("#promote_id").empty();
                     $("#promote_id").append(str);
                     $("#promote_id").select2();
                 }
             })
         });
         $("#promote_level").change();
    })
</script>
</html>