<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>

<div class="content_wrapper">
    <aside>
        <section>
        <div class="container-fluid">
            <div class="row">
                <div class="col-sm-12">
                    <form class="form-inline" role="form" method="POST" action="#tradeplus/index" 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="remain_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="remain_etime" />
                        </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="row">
                        <div class="col-sm-12">
                            <div class="table-responsive">
                                <table id="example" class="table table-striped table-bordered table-hover" cellspacing="0" width="100%">
                                    <thead>
                                    <tr>
                                        <th>日期</th>
                                        <th>分组</th>
                                        <th>DAU</th>
                                        <th>渗透率</th>
                                        <th>DEU</th>
                                        <th>展示数</th>
                                        <th>点击数</th>
                                        <th>点击率</th>
                                        <th>平均eCPM</th>
                                        <th>变现总收入</th>
                                        <th>变现arpu</th>
                                        <th>DEU人均次数</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <?php
                                    if(is_array($list)){
                                        foreach ($list as $key => $val) {
                                            if(empty($val['dau'])){
                                                $val['dau'] = 1;
                                            }
                                    ?>
                                            <tr>
                                                <td><?php echo $val['day'];?></td>
                                                <td><?php echo isset($groups[$val['groupid']]) ? $groups[$val['groupid']] : '-';?></td>
                                                <td><?php echo $val['dau'];?></td>
                                                <td><?php echo sprintf('%.2f', $val['deu'] / $val['dau']);?></td>
                                                <td><?php echo $val['deu'];?></td>
                                                <td><?php echo $val['impression'];?></td>
                                                <td><?php echo $val['click'];?></td>
                                                <td><?php echo sprintf('%.2f', $val['click']/$val['dau']);?></td>
                                                <td><?php echo $val['ecpm'];?></td>
                                                <td><?php echo $val['revenue'];?></td>
                                                <td><?php echo sprintf('%.2f', $val['revenue']/$val['dau']);?></td>
                                                <td><?php echo sprintf('%.2f', $val['deu']/$val['dau']);?></td>
                                            </tr>
                                    <?php } } else{?>
                                        <tr>
                                            <td colspan="10">暂无数据</td>
                                        </tr>
                                    <?php } ?>
                                    </tbody>

                                    </tbody>
                                </table>
                            </div>

                            <nav>
                                <ul class="pagination">
                                    <li class="disabled"><a href="#">共<span class="pagetotal"><?php echo $total;?></span>条</a></li>
                                    <?php echo $pageurl;?>
                                </ul>
                            </nav>

                        </div>
                    </div>

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

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