@extends('vip.layouts')
@section('content')
    <style>
        .layui-laydate-range {
            width: auto;
        }

        .layui-form-switch em {
            width: auto;
        }

        .layui-form-switch {
            width: 44px;
            line-height: 23px;
        }

        .layui-form-item .checkbox {
            width: auto;
        }

        .statistics{
            margin: 0 auto;
            text-align: center;
            margin-bottom: 5px;
        }

        .red{
            color: red;
            font-weight: bold;
        }
    </style>
    <!---注单管理-->
    <div class="layui-row">
        <div class="layui-col-sm12 layui-col-md12 text" >
            <form class="layui-form rewrite" eventType=eventForm>
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">开始时间：</label>
                        <div class="layui-input-inline">
                            <input type="text" name="start_time" id="start_time"  lay-verify=""
                                   autocomplete="off" class="layui-input test-item" eventType=event-query
                                   value="{{ $start_time }}">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">结束时间：</label>
                        <div class="layui-input-inline">
                            <input type="text" name="end_time" id="end_time" placeholder=" - " lay-verify=""
                                   autocomplete="off" class="layui-input test-item" eventType=event-query
                                   value="{{ $end_time }}">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">本站用户名：</label>
                        <div class="layui-input-inline">
                            <input type="text" name="account_name" id="account_name" lay-verify="" autocomplete="off" eventType=event-query
                                   class="layui-input" value="{{ $account_name }}">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">真人用户名：</label>
                        <div class="layui-input-inline">
                            <input type="text" name="Accounts" id="Accounts" lay-verify="" autocomplete="off" eventType=event-query
                                   class="layui-input" value="{{ $Accounts }}">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <a class="layui-btn layui-btn-sm lay-btn-diy" data-type="reload"  eventType=event-query-submit
                           style="opacity: 1; pointer-events: auto;">提交</a>
                        <a class="layui-btn   layui-btn-sm  layui-btn-normal reset" data-type="reload"
                           style="opacity: 1; pointer-events: auto;">重置</a>
                        <a class="layui-btn layui-btn-sm layui-btn-green set" data-type="reload"
                           style="opacity: 1; pointer-events: auto;" href="javascript:window.location.reload()">
                            <i class="layui-icon">ဂ</i>
                        </a>
                        <a class="layui-btn layui-btn-sm" id="get_rec" data-type="reload" style="opacity: 1; pointer-events: auto;">获取最新流水</a>
                    </div>
                </div>
            </form>
        </div>
    </div>
    @push('dataTableJS')
        $('.layui-table-page').after('<div id="statistics" class="statistics"></div>');
        function dataTableLoadFinished(res,curr,count)
        {
            var str = '';
            var datau=res.data;
            var bettingamount = 0,winLoseamount = 0,validamount = 0,revenue = 0;
            for(var i = 0; i < datau.length; i++)
            {
                bettingamount += parseFloat(res.data[i]['AllBet']);
                winLoseamount += parseFloat(res.data[i]['Profit']);
                validamount += parseFloat(res.data[i]['CellScore']);
                revenue += parseFloat(res.data[i]['Revenue']);
            }
         /*   $('#statistics').html('');

            str = '<p>本页共'+ datau.length +'条注单；总投注金额：<span class="red">'+ bettingamount.toFixed(2) +'RMB</span>；总盈亏金额：<span class="red">'+ winLoseamount.toFixed(2) +'RMB</span>；总有效投注额：<span class="red">'+ validamount.toFixed(2) +'RMB</span>；总抽水金额：<span class="red">'+ revenue.toFixed(2) +'RMB</span></p>';

            $.ajax({
                type: 'get',
                url: '/admin/LcqpGame/allTotal',
                data: {where:res.extras},
                dataType: 'json',
                success: function (data) {
                    var data=data.data;
                    str += '<p>本类共' + data.co + '条注单；总投注金额：<span class="red">'+data.bettingamount.toFixed(2)+'RMB</span>；总盈亏金额：<span class="red">'+data.winLoseamount.toFixed(2)+'RMB</span>；总有效投注额：<span class="red">'+data.validamount.toFixed(2)+'RMB</span>；总抽水金额：<span class="red">'+data.revenue.toFixed(2)+'RMB</span></p>';

                    $('#statistics').html(str);
                }
            });     */


            }

    @endpush
    @include('vip.datatable')
    <script>
        $('#get_rec').on('click',function(){
            layer.confirm('开始获取并添加最新流水到本站？', {
                btn: ['确认', '取消'] //按钮
            }, function() {
                $.ajax({
                    type: 'get',
                    url: '/admin/HjGame/getBettingRecordByVendorNew',
                    data: {},
                    dataType: 'json',
                    success: function (data) {
                        layer.msg(data.msg);
                        setTimeout(function(){
                            window.location.reload();
                        },2500);
                    }
                });
            }, function() {
            });

        });
    </script>
@endsection
