{layout name="layout"}
<div class="row">
    <div class="col-sm-6 col-md-3">
        <div class="card bg-primary">
            <div class="card-body clearfix">
                <div class="pull-right">
                    <p class="h6 text-white m-t-0">今日充值</p>
                    <p class="h3 text-white m-b-0 fa-1-5x"><?=$today_user_recharge_sum?></p>
                </div>
                <div class="pull-left"> <span class="img-avatar img-avatar-48 bg-translucent"><i class="mdi mdi-currency-cny fa-1-5x"></i></span> </div>
            </div>
        </div>
    </div>

    <div class="col-sm-6 col-md-3">
        <div class="card bg-purple">
            <div class="card-body clearfix">
                <div class="pull-right">
                    <p class="h6 text-white m-t-0">7日内充值</p>
                    <p class="h3 text-white m-b-0 fa-1-5x"><?=$day7_user_recharge_sum?></p>
                </div>
                <div class="pull-left"> <span class="img-avatar img-avatar-48 bg-translucent"><i
                            class="mdi mdi-account fa-1-5x"></i></span> </div>
            </div>
        </div>
    </div>

    <div class="col-sm-6 col-md-3">
        <div class="card bg-success">
            <div class="card-body clearfix">
                <div class="pull-right">
                    <p class="h6 text-white m-t-0">总充值</p>
                    <p class="h3 text-white m-b-0 fa-1-5x"><?=$recharge_total?></p>
                </div>
                <div class="pull-left"> <span class="img-avatar img-avatar-48 bg-translucent"><i
                            class="mdi mdi-arrow-down-bold fa-1-5x"></i></span> </div>
            </div>
        </div>
    </div>

    <div class="col-sm-6 col-md-3">
        <div class="card bg-danger">
            <div class="card-body clearfix">
                <div class="pull-right">
                    <p class="h6 text-white m-t-0">总提现</p>
                    <p class="h3 text-white m-b-0 fa-1-5x"><?=$withdrawl_total?></p>
                </div>
                <div class="pull-left"> <span class="img-avatar img-avatar-48 bg-translucent"><i
                            class="mdi mdi-arrow-up-bold fa-1-5x"></i></span> </div>
            </div>
        </div>
    </div>
</div>

<div class="row">

    <div class="col-md-6">
        <div class="card">
            <div class="card-body">
                <canvas class="js-money-chartjs"></canvas>
            </div>
        </div>
    </div>

    <div class="col-md-6">
        <div class="card">
            <div class="card-body">
                <canvas class="js-role_buy_lines"></canvas>
            </div>
        </div>
    </div>

</div>

<div class="row">

    <div class="col-md-6">
        <div class="card">
            <div class="card-header">
                <h4>用户统计</h4>
                <div class="btn-group pull-right" role="group" style="display:flex;align-items: center;">
                    <button class="btn btn-xs" onclick="location.reload();"><i class="mdi mdi-refresh"></i></button>
                </div>
            </div>
            <div class="card-body">
                <table class="table table-hover">
                    <colgroup>
                        <col width="50%">
                        <col>
                    </colgroup>
                    <tbody>
                        <tr>
                            <td>渠道商数</td>
                            <td>
                                <?php
                                    echo \app\model\User::where('group_id',1)->count('id');
                                ?>
                            </td>
                        </tr>
                        <tr>
                            <td>用户余额总和</td>
                            <td>{$user_money_total}</td>
                        </tr>
                        <tr>
                            <td>用户积分总和</td>
                            <td>{$user_score_total}</td>
                        </tr>
                        <tr>
                            <td>调研币总和</td>
                            <td><?php echo \app\model\User::sum('currency1');?></td>
                        </tr>
                        <tr>
                            <td>待分配总和</td>
                            <td><?php echo \app\model\User::sum('currency7');?></td>
                        </tr>
                    </tbody>
                </table>
            </div>
        </div>
    </div>

    <div class="col-md-6">
        <div class="card">
            <div class="card-header">
                <h4>系统信息</h4>
            </div>
            <div class="card-body">
                <table class="table table-hover">
                    <colgroup>
                        <col width="50%">
                        <col>
                    </colgroup>
                    <tbody>
                        <tr>
                            <td>问卷成交个数</td>
                            <td>
                                <?php $system_question_total = cache('system_question_total');echo $system_question_total;?>
                            </td>
                        </tr>
                        <tr>
                            <td>预计支出泡沫</td>
                            <td>
                                <?php $system_question_cha_total = 0;echo $system_question_cha_total;?>
                            </td>
                        </tr>
                        <tr>
                            <td>总沉淀金额</td>
                            <td>
                                <?php 
                                    $system_role_buy_amount_total = cache('system_role_buy_amount_total');
                                    $system_role_buy_reward_total = cache('system_role_buy_reward_total');
                                    $system_role_buy_residual_total = $system_role_buy_amount_total - $system_role_buy_reward_total;
                                    echo $system_role_buy_residual_total;
                                ?>

                            </td>
                        </tr>
                        <tr>
                            <td>实际泡沫</td>
                            <td>
                                <?php
                                    $cha = $system_question_cha_total - $system_role_buy_residual_total;
                                    if($cha>0){
                                        echo '<span class="text-danger">'.$cha.'</span>';
                                    }else{
                                        echo '<span class="text-success">'.$cha.'</span>';
                                    }
                                ?>
                            </td>
                        </tr>
                        <tr>
                            <td>&nbsp;</td>
                            <td></td>
                        </tr>
                        <tr>
                            <td>&nbsp;</td>
                            <td></td>
                        </tr>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>