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

    <script type="text/html" id="sendStatus">

        @{{#if(d.status==0){ }}
        <p style="color:#168073;">待审核</p>
        @{{#}else{ }}
        @{{#if(d.status==1){ }}
        <p style="color:green;">成功</p>
        @{{#}else{ }}
        <p style="color:red;">未通过</p>
        @{{#} }}
        @{{#} }}

    </script>

    <script type="text/html" id="sendmoney">
        @{{#if(d.status==0){ }}
        <a class="layui-btn layui-btn-xs lay-btn-diy" href="/admin/Lottery_money_log/EditSend?id=@{{d.id}}&action=1">通过</a>

        <a class="layui-btn layui-btn-xs layui-btn-danger" href="/admin/Lottery_money_log/EditSend?id=@{{d.id}}&action=2">驳回</a>

        @{{#}else{ }}
        @{{#if(d.status==1){ }}
        <span style="color:green;margin-right: 10px">成功</span>
        @{{#}else{ }}
        <span style="color:red;margin-right: 10px">失败</span>
        @{{#} }}
        <a href="/admin/Lottery_money_log/Sendview?id=@{{d.id}}">查看</a>
        @{{#} }}

    </script>

    <div class="layui-row">

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

            <form class="layui-form rewrite" eventType="eventForm"  action="">
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">{{ trans('lottery_money_log.account_name') }}:</label>
                        <div class="layui-input-inline">
                            <input type="text" name="account_name" eventType="event-query"  value="{{ $account_name }}" autocomplete="off" class="layui-input">
                        </div>
                        <label class="layui-form-label">活动名称:</label>
                        <div class="layui-input-inline">
                            <input type="text" name="lottery_money_name" eventType="event-query" placeholder="输入活动名称"  value="{{ $lottery_money_name }}" autocomplete="off" class="layui-input">
                        </div>

                        <label class="layui-form-label">时间范围:</label>
                        <div class="layui-input-inline">
                            <input type="text" name="lottery_start_time" eventType="event-query" placeholder="开始时间"  value="{{ $lottery_start_time }}" autocomplete="off" class="layui-input test-item">
                        </div>
                        <div class="layui-input-inline">
                            <input type="text" name="lottery_end_time" eventType="event-query" placeholder="结束时间" value="{{ $lottery_end_time }}" autocomplete="off" class="layui-input test-item">
                        </div>
                        <label class="layui-form-label">金额范围:</label>
                        <div class="layui-input-inline">
                            <input type="text" name="money_start" eventType="event-query" placeholder="金额范围"  value="{{ $money_start }}" autocomplete="off" class="layui-input">
                        </div>
                        <div class="layui-input-inline">
                            <input type="text" name="money_end" eventType="event-query" placeholder="金额范围" value="{{ $money_end }}" autocomplete="off" class="layui-input">
                        </div>
                        <label class="layui-form-label">审核员:</label>
                        <div class="layui-input-inline">
                            <input type="text" name="operator" eventType="event-query" placeholder="输入审核员"  value="{{ $operator }}" autocomplete="off" class="layui-input">
                        </div>
                        <div class="layui-inline" style="width: 360px">
                            <label class="layui-form-label">活动类型:</label>
                            <div class="layui-input-inline"  style="width: 200px">
                                <select name="lottery_money_type" autocomplete="off" class="layui-input" eventType=event-query>
                                    <option value="">请选择活动类型</option>
                                    <option value="first_save" @if(isset($lottery_money_type) && $lottery_money_type=='first_save') selected="true" @endif>首冲彩金</option>
                                    <option value="upgrade" @if(isset($lottery_money_type) && $lottery_money_type=='upgrade') selected="true" @endif>晋级彩金</option>
                                </select>
                            </div>
                        </div>
                        <div class="layui-inline" style="width: 360px">
                            <label class="layui-form-label">审核状态:</label>
                            <div class="layui-input-inline"  style="width: 200px">
                                <select name="status" autocomplete="off" class="layui-input" eventType=event-query>
                                    <option value="">请选择状态</option>
                                    <option value="0" @if(isset($status) && $status=='0') selected="true" @endif>待审核</option>
                                    <option value="1" @if(isset($status) && $status=='1') selected="true" @endif>审核通过</option>
                                    <option value="2" @if(isset($status) && $status=='2') selected="true" @endif>审核未通过</option>
                                </select>
                            </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;"><i class="layui-icon">ဂ</i></a>
                        </div>

                    </div>
                </div>
            </form>
        </div>
    </div>
    @push('dataTableJS')
        /*var active = {
        reload: function(){
        //执行重载
        table.reload('{{ $dataId }}', {
        page: {
        curr: 1 //重新从第 1 页开始
        }
        ,where: {
        loginname:$("#loginname").val(),
        ip:$('#ip').val(),
        operation:$('#operation').val(),
        star_time:$('#star_time').val(),
        end_time:$('#end_time').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('');
        //	  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) : '';
        //    });


        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/Lottery_money_log/Countmoney',
        data: {where:res.extras},
        dataType: 'json',
        //async: false,
        success: function (data) {
        var data=data.data;

        for(var i in data){
        data[i]=parseFloat(data[i]);
        }

        <!-- str+='<p>总金额：<span class="blue">'+data.totalMoney+'</span> ,'; -->
        str+='<p>成功的彩金总金额：<span class="green">'+data.money+'</span> </p>';

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

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


        }
    @endpush

    @include('vip.datatable')
@endsection
