@extends('vip.layouts')
@section('content')
    <style>
        body{overflow-y: scroll;}
        .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;
        }

        .red{
            color: red;
        }
        .blue{
            color: #1E9FFF;
        }
        .green{
            color: green;
        }
        .yellow{
            color: #ffca10;
        }
    </style>

    <div class="layui-row">

        <div class="layui-col-xs12">

            <form class="layui-form rewrite" action="" eventType=eventForm>
                <div class="layui-form-item">

                    <div class="layui-inline">

                        <label class="layui-form-label">{{ trans('user.startime') }}</label>
                        <div class="layui-input-inline">
                            <input type="text" name="startime" id="startime" placeholder=" - "
                                   lay-verify="" autocomplete="off" class="layui-input test-item">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">{{ trans('user.endtime') }}</label>
                        <div class="layui-input-inline">
                            <input type="text" name="endtime" id="endtime" placeholder=" - " lay-verify=""
                                   autocomplete="off" class="layui-input test-item">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">{{ trans('user.trade_type') }}</label>
                        <div class="layui-input-inline">
                            <select name="trade_type" id="trade_type" lay-verify="" autocomplete="off" class="layui-input">
                                <option value="">{{ trans('user.select_trade_type') }}</option>
                                @foreach(trans('status.money_details.trade_type') as $k=>$v):
                                <option value="{{$k}}">{{$v}}</option>
                                @endforeach
                            </select>
                        </div>
                    </div>

                    <div class="layui-inline">
                        <a class="layui-btn layui-btn-sm lay-btn-diy" data-type="reload"
                           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;"><i class="layui-icon">ဂ</i></a>
                    </div>

                    <!-- <div class="layui-inline"><a href="javascript:delWin('/admin/user/delete?id=');"
                                                 class="layui-btn layui-btn-sm  layui-btn-danger">删除</a></div> -->
                </div>
            </form>
        </div>
    </div>
    <script>
        $(function () {
            $('body').on('click', 'a[eventtype="event-delete"]', function () {
                var span = $(this).prev();
                var id = span.attr('data-id');
                // openWin('/admin/system/AddMenu','{{ trans("menu.menu_edit")}}','600px','500px',id);
            })
        })
    </script>
    @push('dataTableJS')
        var active = {
			reload: function(){
			//执行重载
			table.reload('{{ $dataId }}', {
				page: {
				curr: 1 //重新从第 1 页开始
				}
				,where: {
					startime:$('#startime').val(),
					endtime:$('#endtime').val(),
					trade_type:$('#trade_type').val(),
					sureblur:$('.layui-form-switch').text(),
				}
			});
			}
        };
        $('.lay-btn-diy').on('click', function(){
			var type = $(this).data('type');
			active[type] ? active[type].call(this) : '';
        });

        //重置表单
        $('.reset').on('click',function(){
			$('input').val('');
			$('#trade_type').val('');
			var type = $(this).data('type');
			active[type] ? active[type].call(this) : '';
        });

        //刷新表单
        $('.set').on('click',function(){
        var type = $(this).data('type');
        active[type] ? active[type].call(this) : '';
        });

    @endpush

    @include('vip.datatable')
@endsection
<!-- <script type="text/javascript">


function dataTableLoadFinished(res,curr,count){
    var str='';
    if(document.getElementById("statistics")){

    }else{
    $('.layui-table-page').after('<div id="statistics"></div>');
    }
    $.ajax({
        type: 'get',
        url: '/admin/user/userCashCount',
        data: {where:res.extras},
        dataType: 'json',
        async: false,
        success: function (data) {
        var curpage_cash = $('#curpage_cash').val();
        curpage_cash = (curpage_cash==undefined)?0:curpage_cash;
        var data=data.data;
        str+='<p>本页会员总余额：<span class="blue">'+curpage_cash+'</span>,所有会员总余额：<span class="green">'+data.allcash+'</span>所有正常会员总余额：<span class="red">'+data.normalcash+'</span>,所有停用会员总余额；<span class="yellow">'+data.stopcash+'</span></p>'
        str+='<p>所有异常会员总余额：<span class="blue">'+data.speccash+'</span></p>'
        $('#statistics').html(str);
        }
    });
var height1=$('.layui-table-view').height();
var height2=$('#statistics').height();

$('.layui-table-view').css({height:(height1+height2)});

}
</script> -->