@extends('base.base')
@section('base')
    <!-- 内容区域 -->
    <div class="main-panel">
        <div class="content-wrapper">
            <div class="page-header">
                <h3 class="page-title">
                    <span class="page-title-icon bg-gradient-primary text-white mr-2">
                        <i class="mdi mdi-wrench"></i>
                    </span>
                    三方数据统计
                </h3>
                <nav aria-label="breadcrumb">
                    <ol class="breadcrumb">
                        <li class="breadcrumb-item"><a href="#">三方数据统计</a></li>
                        <li class="breadcrumb-item active" aria-current="page">三方数据统计</li>
                    </ol>
                </nav>
            </div>
            <div class="row">
                <div class="col-lg-12 grid-margin stretch-card">
                    <div class="card">
                        <div class="card-body">
                            <form class="well form-inline margin-top-20" method="get"
                                  action='/admin/global/platform_record'>

                                <spen style="padding-left: 10px">选择时间：</spen>
                                <input type="date" step="01" name="date" class="form-control" id="start_time"
                                       value="{{$date}}"/>&nbsp;&nbsp;

                                <input type="submit" class="btn btn-sm btn-gradient-dark btn-icon-text" value="搜索"/>&nbsp;&nbsp;

                            </form>

                            <h4>当前选择日期所在月统计数据</h4>
                            <table class="table table-bordered">
                                <thead>
                                <tr>
                                    <th>月份</th>
                                    <th>渠道</th>
                                    <th>总下注</th>
                                    <th>用户赢</th>
                                    <th>平台输赢（下注-用户赢）</th>

                                </tr>
                                </thead>
                                <tbody>
                                @foreach($monthData as $mitem)
                                    <tr>
                                        <td>{{date('Ym',strtotime($date))}}</td>
                                        <td>{{ $mitem->platform }}</td>
                                        <td>{{ $mitem->month_bet/100 }}</td>
                                        <td>{{ $mitem->month_win/100 }}</td>
                                        <td>{{ ($mitem->month_bet-$mitem->month_win)/100 }}</td>

                                    </tr>
                                @endforeach
                                </tbody>
                            </table>


                            <br/>
                            <hr/>
                            <br/>

                            <table class="table table-bordered">
                                <thead>
                                <tr>
                                    <th>日期</th>
                                    <th>渠道</th>
                                    <th>总下注</th>
                                    <th>用户赢</th>
                                    <th>平台输赢（下注-用户赢）</th>
                                    <th>当天下注</th>
                                    <th>当天用户赢</th>
                                    <th>当天平台输赢</th>
                                    <th>当天游戏用户数</th>
                                    <th></th>
                                </tr>
                                </thead>
                                <tbody>
                                @foreach($list as $item)
                                    <tr>
                                        <td>{{ $item->ldate }}</td>
                                        <td>{{ $item->platform }}</td>
                                        <td>{{ $item->all_bet/100 }}</td>
                                        <td>{{ $item->all_win/100 }}</td>
                                        <td>{{ ($item->all_bet-$item->all_win)/100 }}</td>
                                        <td>{{ $item->current_bet/100 }}</td>
                                        <td>{{ $item->current_win/100 }}</td>
                                        <td>{{ ($item->current_bet-$item->current_win)/100 }}</td>
                                        <td>{{ $item->current_play }}</td>
                                        <td>
                                            <button class="btn btn-sm btn-gradient-danger"
                                                    onclick="show_sub_log('{{$item->lid}}')">查看
                                            </button>
                                        </td>
                                    </tr>
                                @endforeach
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
        </div>

    </div>

    <script>

        function show_sub_log(lid) {
            var page = layer.open({
                type: 2,
                title: '子游戏记录',
                shadeClose: true,
                shade: 0.8,
                area: ['60%', '70%'],
                content: '/admin/global/sub_detail/' + lid,
            });
        }

    </script>

@endsection
