@extends('vip.layouts')
@section('seo_title')
    银行卡信息
@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/BankInfo/infos?account=@{{d.account}}&startime=&endtime=">@{{ d.account}}</a>
	</script>
 <script type="text/html" id="closeTool">
  <!-- 这里的 checked 的状态只是演示 -->
  @if(checkRriv('/admin/BankInfo/GameClose'))<input type="checkbox" name="status" value="@{{d.bank_number}}" lay-skin="switch" lay-text="开启|禁用" lay-filter="openStatus"  @{{ d.status == '1' ? 'checked' : '' }}>@endif
</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">

                        <label class="layui-form-label">{{ trans('bank_info.account') }}</label>
						<div class="layui-input-inline">
							<input type="text" name="account" id="form_account" lay-verify="required" autocomplete="off" class="layui-input" eventType=event-query  value="{{ $account }}">
						</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('bank_info.bank_name') }}</label>
						<div class="layui-input-inline">
							<input type="text" name="bank_name" id="form_bank_name" lay-verify="required" autocomplete="off" class="layui-input" eventType=event-query  value="{{ $bank_name }}">
						</div>
                    </div>
                    <div class="layui-inline">
						<label class="layui-form-label">{{ trans('bank_info.bank_number') }}</label>
						<div class="layui-input-inline">
							<input type="text" name="bank_number"  id="form_bank_number"  lay-verify="" autocomplete="off" class="layui-input" eventType=event-query  value="{{ $bank_number }}">
						</div>
                    </div>
                    <div class="layui-inline">
						<label class="layui-form-label">{{ trans('bank_info.bank_address') }}</label>
						<div class="layui-input-inline">
							<input type="text" name="bank_address"  id="form_bank_address"  lay-verify="" autocomplete="off" class="layui-input" eventType=event-query  value="{{ $bank_address }}">
						</div>
                    </div>
                    <div class="layui-inline">
						<label class="layui-form-label">{{ trans('bank_info.account_name') }}</label>
						<div class="layui-input-inline">
							<input type="text" name="account_name"  id="form_account_name"  lay-verify="" autocomplete="off" class="layui-input" eventType=event-query  value="{{ $account_name }}">
						</div>

					</div>

					<div class="layui-inline">

						<label class="layui-form-label">{{ trans('bank_info.startime') }}</label>
						<div class="layui-input-inline">
							<input type="text" name="startime"  id="form_startime" placeholder=" - "  lay-verify="" autocomplete="off" class="layui-input test-item"
                             eventType=event-query  value="{{ $startime }}">
						</div>
                    </div>
                    <div class="layui-inline">
						<label class="layui-form-label">{{ trans('bank_info.endtime') }}</label>
						<div class="layui-input-inline">
							<input type="text" name="endtime"  id="form_endtime" placeholder=" - "  lay-verify="" autocomplete="off" class="layui-input test-item"
                             eventType=event-query  value="{{ $endtime }}">
						</div>
                    </div>
                    <div class="layui-inline">
						<label class="layui-form-label">{{ trans('bank_info.status') }}</label>
						<div class="layui-input-inline" style="width: 200px">
							<select name="status"  id="form_status"  lay-verify="" autocomplete="off" class="layui-input"  eventType=event-query>
								<option value="">{{ trans('bank_info.select_status') }}</option>
								@foreach(trans('status.account_bank.status') as $k=>$v):
									@if($status==$k))
										<option value="{{$k}}" selected="selected">{{$v}}</option>
									@else
										<option value="{{$k}}">{{$v}}</option>
									@endif
								@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;" 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"><a href="javascript:delWin('/admin/BankInfo/delete?id=');" class="layui-btn layui-btn-sm  layui-btn-danger">删除</a></div> -->
                </div>
            </form>
        </div>
    </div>
@push('dataTableJS')
/*var active = {
    reload: function(){
      //执行重载
      table.reload('{{ $dataId }}', {
        page: {
          curr: 1 //重新从第 1 页开始
        }
        ,where: {
            account:$("#form_account").val(),
            bank_name:$('#form_bank_name').val(),
            bank_number:$('#form_bank_number').val(),
            bank_address:$('#form_bank_address').val(),
            account_name:$('#form_account_name').val(),
            startime:$('#form_startime').val(),
            endtime:$('#form_endtime').val(),
            status:$('#form_status').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('');
	  $('#form_status').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) : '';
    });


form.on('switch(openStatus)', function(obj){
        var status = 0;
        if(obj.elem.checked==true){
            status =1;
        }
        setcolumn('/admin/BankInfo/GameClose',this.name,status,this.value,obj);
        //layer.tips(msg, obj.othis);
    });

    function setcolumn(url,column,value,id,obj){
        $.ajax({
            url: url+'?'+column+'='+value+'&bank_number='+id,
            dataType: 'json',
            type: 'get',
            success:function(data){
                layer.msg(data.msg);
                if(data.status!=1){
                    if(value==1){
                        obj.othis[0].setAttribute("class", "layui-unselect layui-form-switch");
                        obj.othis[0].innerHTML='<em>开启</em><i></i>';
                    }else{
                        obj.othis[0].setAttribute("class",'layui-unselect layui-form-switch layui-form-onswitch');
                        obj.othis[0].innerHTML='<em>禁用</em><i></i>';
                    }
                }
            },
            error:function(){
            }

        });
    }

@endpush
    @include('vip.datatable')
@endsection
