@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;
        }

        .money_color{
            color:red;
        }

        .money_green{
            color: green;
        }
    </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="sub_time" placeholder=" - " lay-verify=""
                                   autocomplete="off" class="layui-input test-item" eventType=event-query
                                   value="{{ $start_time }}">
                        </div>
                    </div>~
                    <div class="layui-inline">
                        <div class="layui-input-inline">
                            <input type="text" name="end_time" id="sub_time" placeholder=" - " lay-verify=""
                                   autocomplete="off" class="layui-input test-item" eventType=event-query
                                   value="{{ $end_time }}">
                        </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>
                    </div>
                </div>
            </form>
        </div>
    </div>
    @push('dataTableJS')
        $('.layui-table-page').after('<div id="statistics" class="statistics"></div>');

        function dataTableLoadFinished(res,curr,count)
        {
            console.log('res：',res);
            console.log('curr：',curr);
            console.log('count：',count);
            console.log('length：',res.data.length);
            console.log('length：',res.data);

            var str = '';
            var suc_in_money = 0;
            var suc_out_money = 0;
            var profit_money = 0;
            for(var i = 0; i < res.data.length; i++)
            {
                suc_in_money += parseFloat(res.data[i]['suc_in_money']);
                suc_out_money += parseFloat(res.data[i]['suc_out_money']);
                profit_money += parseFloat(res.data[i]['profit_money']);
            }

            $('#statistics').html('');

            str = '<p>当前成功转入总金额：<span class="green">'+ suc_in_money.toFixed(2) +'</span>，当前成功转出总金额：<span class="green">'+ suc_out_money.toFixed(2) +'</span> </p>';
            str += '<p>当前总盈利金额：<span class="green">'+ profit_money.toFixed(2) +'</span>。（如果为正数，表示赢钱，如果为负数，则为输钱）</p>';

            $('#statistics').html(str);
        }
    @endpush
    @include('vip.datatable')
    <script>
    </script>
@endsection