<link rel="stylesheet" href="<?php echo base_url();?>public/js/vendor/bootstrap-datepicker/css/bootstrap-datepicker.standalone.min.css">
<script src="<?php echo base_url();?>public/js/vendor/bootstrap-datepicker/js/bootstrap-datepicker.min.js"></script>
<script src="<?php echo base_url();?>public/js/vendor/bootstrap-datepicker/locales/bootstrap-datepicker.zh-CN.min.js"></script>
<link rel="stylesheet" href="<?php echo base_url();?>public/plugins/datatables/jquery.dataTables.min.css">
<link rel="stylesheet" href="<?php echo base_url();?>public/plugins/datatables/extensions/Responsive/css/dataTables.responsive.css">

<div class="content_wrapper">
    <div class="container-fluid">

        <aside>
            <section>
                <div class="container-fluid">
                    <div class="row">
                        <div class="col-sm-12">
                            <form class="form-inline" role="form" method="POST" action="#user/manyDaysLog" name="stanpform">
                                <span class="gap"></span>
                                <div class="form-group">
                                    <label>开始时间</label>
                                    <input type="text" class="form-control datetimepicker" value="<?php if($stime) echo $stime;?>" placeholder="开始时间" name="stime" />
                                </div>
                                <span class="gap"></span>
                                <div class="form-group">
                                    <label>结束时间</label>
                                    <input type="text" class="form-control datetimepicker" value="<?php if($etime) echo $etime;?>" placeholder="结束时间" name="etime" />
                                </div>
                                <span class="gap"></span>
                                <div class="form-group">
                                    <label>uid</label>
                                    <input type="text" class="form-control" value="<?php echo $uid;?>" placeholder="uid" name="uid" />
                                </div>
                                <span class="gap"></span>
                                <div class="form-group">
                                    <label>类型</label>
                                    <select name="rid" class="form-control">
                                        <option value="1" <?php if($rid == 1) echo 'selected'; ?>>老虎机-摇奖</option>
                                        <option value="30" <?php if($rid == 30) echo 'selected'; ?>>卡组-收集满</option>
                                        <option value="217" <?php if($rid == 217) echo 'selected'; ?>>通行证</option>
                                        <option value="112" <?php if($rid == 112) echo 'selected'; ?>>宠物升级</option>
                                    </select>
                                </div>
                                <button type="submit" class="btn btn-primary">查询</button>
                            </form>
                        </div>
                    </div>
                </div>
            </section>
        </aside>

        <div class="row">
            <div class="col-sm-12">
                <aside>
                    <header><i class="fa fa-fw fa-file"></i>用户流水</header>
                    <section>
                        <div class="container-fluid">
                            <div class="table-responsive">
                                <table id="exchangeTable" class="table table-striped table-bordered table-hover" cellspacing="0" width="100%">
                                    <thead>
                                    <tr>
                                        <th>类型</th>
                                        <th>rid</th>
                                        <th>数量</th>
                                        <th>增减</th>
                                        <th>来源</th>
                                        <th>最终值</th>
                                        <th>时间</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    </tbody>
                                </table>
                            </div>

                        </div>
                    </section>
                </aside>
            </div>
        </div>




    </div>
</div>

<script src="<?php echo base_url();?>public/plugins/datatables/jquery.dataTables.min.js"></script>
<script src="<?php echo base_url();?>public/plugins/datatables/extensions/Responsive/js/dataTables.responsive.min.js"></script>
<script type="text/javascript" src="<?php echo base_url();?>public/js/highcharts/highcharts.js"></script>
<script type="text/javascript" src="<?php echo base_url();?>public/js/highcharts/modules/exporting.js"></script>
<script type="text/javascript">
    $(function () {
        //查询
        //jquery data table 初始化
        var exchangeTable = $("#exchangeTable").DataTable({
            "paging": true,
            "select": true,
            "processing": true,
            "serverSide": true,
            "language": {
                'lengthMenu': '每页显示 _MENU_ 记录',
                'zeroRecords': '没有数据',
                'info': ' 第_PAGE_ 页/ _PAGES_页，共 _TOTAL_ 条',
                'infoEmpty': '没有符合条件的记录',
                'search': '查找',
                'infoFiltered': '(从  _MAX_ 条记录中过滤)',
                'paginate': { "first":  "首页 ", "last": "末页", "next": "下一页","previous": "上一页"}

            },
            "ajax": {
                url: rootPath + "user/getmanyDaysLog?uid=<?php echo $uid;?><?php echo '&rid='.$rid;?><?php echo '&stime='.$stime;?><?php echo '&etime='.$etime;?>",
                type:"post",
                //增加参数查询参数
                data:function(data){
                    console.log(data);
                }
            },
            "lengthChange": true,
            "searching": false,
            "ordering": false,
            "info": true,
            "autoWidth": false,
            "columns": [
                {"data": "type"},
                {"data": "rid"},
                {"data": "num"},
                {"data": "crease"},
                {"data": "reason"},
                {"data": "last_num"},
                {"data": "time"},
            ]
        });

        //当点击search按钮时按条件重新加载数据
        $("#searchBtn").click(function(){
            if($("#exchangeForm").valid()) {
                exchangeTable.ajax.reload();
            }
        });
    });


</script>
<script type="text/javascript">
    //选择日期
    $('.datetimepicker').datepicker({
        language:'zh-CN',
        format:'yyyy-mm-dd',
        zIndexOffset:906  //控制z-index
    });


</script>