@extends('vip.layouts')
@section('seo_title')
    {{ trans('menu.Rechargedrawals') }}
@endsection
@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="created_at">
        @{{#if((new Date().getTime()-new Date(d.created_at))>24*60*60*1000){ }}
            @{{d.created_at}}
            <div style="color: red;">红包已超过24小时</div>
        @{{#}else{ }}
        @{{d.created_at}}
        @{{#} }}
    </script>


    <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">

                        <div class="layui-inline">
                            <label class="layui-form-label">红包订单号</label>
                            <div class="layui-input-inline">
                                <input type="text" name="lm_order_id"  id="lm_order_id"  lay-verify="" autocomplete="off" class="layui-input" eventType=event-query  value="{{ $lm_order_id }}">
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label">红包发起者</label>
                            <div class="layui-input-inline">
                                <input type="text" name="account"  id="account"  lay-verify="" autocomplete="off" class="layui-input" eventType=event-query  value="{{ $account }}">
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label">时间范围:</label>
                            <div class="layui-input-inline">
                                <input type="text" name="start_time" eventType="event-query" placeholder="开始时间"  value="{{ $start_time }}" autocomplete="off" class="layui-input test-item">
                            </div>
                            <div class="layui-input-inline">
                                <input type="text" name="end_time" eventType="event-query" placeholder="结束时间" value="{{ $end_time }}" autocomplete="off" class="layui-input test-item">
                            </div>
                        </div>

                        <div class="layui-inline" style="width: 300px">
                            <label class="layui-form-label">红包类型</label>
                            <div class="layui-input-inline"  style="width: 200px">
                                <select name="type" id="form_group" lay-verify="" autocomplete="off" class="layui-input" eventType=event-query>
                                    <option value="-1">请选择红包类型</option>
                                    <option value="0" @if($type=='0')selected="selected" @endif>拼手气红包</option>
                                    <option value="1" @if($type=='1')selected="selected" @endif>普通红包</option>
                                    
                                </select>
                            </div>
                        </div>



                        <div class="layui-inline">
                            <a class="layui-btn layui-btn-sm lay-btn-diy"  eventType=event-query-submit  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;" type="" href="" >重置</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 href="#" class="layui-btn layui-btn-sm">一键退还</a> -->
                            @if(checkRriv('/admin/Refund/delete'))<a href="javascript:;" class="layui-btn layui-btn-sm  layui-btn-danger backwater">一键退还</a>@endif
                            
                        </div>
                        <!--<div class="layui-inline">
                            <a href="/admin/redbag/addRedBag" class="layui-btn layui-btn-sm ">添加红包</a>
                        </div>
                        <div class="layui-inline">
                            <a href="/admin/redbag/giveDemo" class="layui-btn layui-btn-sm ">导出红包示例</a>
                        </div>-->
                    </div>
                </div>
            </form>
        </div>
    </div>

    @push('dataTableJS')

    $('.backwater').on('click',function(){
    var checkStatus = table.checkStatus('{{ $dataId }}')
        ,data = checkStatus.data;
//var arr=JSON.stringify(data);
    var return_point = $('#return_point').val();
    var s_time= $('#form_star_time').val();
    var e_time=$('#form_end_time').val();
    /*var game=$('#form_gametype').val()*/
    var url='/admin/Refund/delete?star_time='+s_time+'&end_time='+e_time;/*+'&game='+game*/
    if(data.length!==0){
        layer.open({
            type: 1,
            btn: ['确定', '取消'],
            btnAlign: 'c',
            id: 'box',
            content: '<p style="height: 40px;line-height: 40px;font-size: 20px;text-align: center">确定提交</p>',  //这里content是一个DOM，注意：最好该元素要存放在body最外层，否则可能被其它的相对元素所影响
            yes: function (index, layero) {
            layer.close(index);
        var msgIndex = parent.layer.msg('数据处理中...', {
            icon: 16,
            shade: 0.71
        });
            $.ajax({
                type:'post',
                url:url,
                data:{data:data,return_point:return_point},
                dataType:'json',
                success:function(json){
                layer.close(msgIndex);
                layer.msg(json.msg)
                reloadDataTable();
            },
            error:function(){
                console.log('链接失败');
            }
            })

        }
        });


    }else{
    layer.msg('请选择条目数')
}

})

        //	$('.lay-btn-diy').on('click', function(){
        //		var type = $(this).data('type');
        //		active[type] ? active[type].call(this) : '';
        //	});

        //重置表单
        $('.reset').on('click',function(){
        $('input').val('');
        $('#name').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
