@extends('vip.layouts')
@section('seo_title')
    {{ trans('menu.backwater') }}
@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="userdetail">
	  <a href="/admin/Returnmanage/index?account_name=@{{d.account_name}}&game_name=@{{d.game_name}}&star_time=&end_time=">@{{ d.account_name}}</a>
	</script>
    <script type="text/html" id="gameType">
       @if(!empty($gametype)){{ trans('common.'.$gametype)}}@else加拿大28&&幸运28 @endif
    </script>
<div class="layui-row">

    <div class="layui-col-xs12">
        <div class="layui-inline">
        </div>
		<form class="layui-form rewrite" action="" eventType=eventForm>
            <div class="layui-form-item">
                <div class="layui-inline">
					<label class="layui-form-label">{{ trans('money.account_name') }}</label>
					<div class="layui-input-inline">
						<input type="text" name="account_name" id="form_account_name" lay-verify="required" autocomplete="off" class="layui-input" eventType=event-query value="{{$account_name}}">
					</div>
					<div class="layui-input-inline checkbox">
						<input type="checkbox" name="sureblur" id="form_sureblur" lay-skin="switch" lay-text="精确|模糊" checked eventType=event-query>
					</div>
                </div>
                <div class="layui-inline">
					<label class="layui-form-label">{{ trans('money.game') }}</label>
					<div class="layui-input-inline" style="width: 200px">
						<select name="gametype"  id="form_gametype"  lay-verify="" autocomplete="off" class="layui-input"  eventType=event-query>
							<option value="">加拿大28&&幸运28</option>
							@foreach(trans('money.gametype') as $k=>$v):
								@if($gametype==$k)
									<option value="{{$k}}" selected>{{$v}}</option>
								@else
									<option value="{{$k}}">{{$v}}</option>
								@endif
							@endforeach
						</select>
					</div>
				</div>

				<div class="layui-inline">
					<label class="layui-form-label">{{ trans('gamemenu.star_time') }}</label>
					<div class="layui-input-inline">
						<input type="text" name="star_time" id="form_star_time" placeholder=" - " lay-verify="" autocomplete="off"  value="{{$star_time}}" class="layui-input test-item" eventType=event-query>
					</div>
				</div>
				<div class="layui-inline">
					<label class="layui-form-label">{{ trans('gamemenu.end_time') }}</label>
					<div class="layui-input-inline">
						<input type="text" name="end_time" id="form_end_time" placeholder=" - " lay-verify="" autocomplete="off" value="{{$end_time}}" class="layui-input test-item" eventType=event-query>
					</div>
				</div>
					<!--
					<label class="layui-form-label">{{ trans('money.lossmoney_area') }}</label>
                    <div class="layui-input-inline" style="width: 100px;">
                        <input type="text" name="lossmoney_small" id="lossmoney_small" placeholder="￥0" autocomplete="off" class="layui-input">
                    </div>
					<div class="layui-form-mid">-</div>
                    <div class="layui-input-inline" style="width: 100px;">
                        <input type="text" name="lossmoney_big" id="lossmoney_big" placeholder="￥100" autocomplete="off" class="layui-input">
                    </div>-->
                <div class="layui-inline">
					<label class="layui-form-label">{{ trans('money.return_point') }}</label>
					<div class="layui-input-inline">
						<input type="text" name="return_point" id="form_return_point" lay-verify="required" autocomplete="off" class="layui-input" value="{{$return_point}}" eventType=event-query>
					</div>
                </div>

                <div class="layui-inline">
					<label class="layui-form-label">{{ trans('money.total_money') }}</label>
					<div class="layui-input-inline">
						<input type="text" name="total_money" id="form_total_money" lay-verify="required" autocomplete="off" class="layui-input" eventType=event-query value="{{$total_money}}">
					</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;" eventType=event-query-submit>提交</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">
                @if(checkRriv('/admin/Returnmanage/delete'))<a href="javascript:;" class="layui-btn layui-btn-sm  layui-btn-danger backwater">一键回水</a>@endif
               </div>
            </div>

        </form>
    </div>
    </div>
@push('dataTableJS')
/*var active = {
    reload: function(){
      //执行重载
      table.reload('{{ $dataId }}', {
        page: {
          curr: 1 //重新从第 1 页开始
        }
        ,where: {
            account_name:$("#account_name").val(),
            gametype:$('#gametype').val(),
            lossmoney_small:$('#lossmoney_small').val(),
            lossmoney_big:$('#lossmoney_big').val(),
			sureblur:$('.layui-form-switch').text(),
			star_time:$('#star_time').val(),
            end_time:$('#end_time').val(),
            return_point:$("#return_point").val(),
            total_money:$("#total_money").val(),
        }
      });
    }
  };*/

$('.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/Returnmanage/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('');
      $('#gametype').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
