@extends('vip.layouts')
@section('content')

  <form class="layui-form" action="{{ url()->full() }}" id="submitForm" name="submitForm" method="post" eventType=eventAjaxForm>
    {!! csrf_field() !!}
    <div class="layui-form-item">
      <label class="layui-form-label">收款人</label>
      <div class="layui-input-block">
        <input type="text" name="infoname" required  lay-verify="required" autocomplete="off" class="layui-input" value="{{isset($data['infoname'])?$data['infoname']:''}}">
      </div>
    </div>

    <div class="layui-form-item">
      <label class="layui-form-label">二维码</label>
      <div class="layui-input-block">
        <input type="text" name="bank_num" required  lay-verify="required" autocomplete="off" class="layui-input" value="{{isset($data['bank_num'])?$data['bank_num']:''}}">
      </div>
    </div>

    <div class="layui-form-item">
      <label class="layui-form-label">收款账号</label>
      <div class="layui-input-block">
        <input type="text" name="bank" required  lay-verify="required" autocomplete="off" class="layui-input" value="{{isset($data['bank'])?$data['bank']:''}}">
      </div>
    </div>

    <div class="layui-form-item">
      <label class="layui-form-label">描述</label>
      <div class="layui-input-block">
        <input type="text" name="remark" required  lay-verify="required" autocomplete="off" class="layui-input" value="{{isset($data['remark'])?$data['remark']:''}}">
      </div>
    </div>

    <div class="layui-form-item">
      <label class="layui-form-label">所属会员组</label>
      <div class="layui-input-block">
        @foreach($group as $k=>$v )
          <input type="checkbox" name="groups[{{$v['group_code']}}]" autocomplete="off" class="layui-input" title="{{$v['group_name']}}"
                 @if(isset($data['groups'])&&in_array($v['group_code'],explode(',',$data['groups']))) checked @endif>
        @endforeach
      </div>
    </div>

    <div class="layui-form-item">
      <label class="layui-form-label">排序</label>
      <div class="layui-input-block">
        <input type="text" name="sort" required  lay-verify="required" autocomplete="off" class="layui-input" value="{{isset($data['sort'])?$data['sort']:''}}">
      </div>
    </div>


    <div class="layui-form-item">
      <label class="layui-form-label">是否禁用</label>
      <div class="layui-input-block">
        <input type="radio" name="status" value="1" title="启用" @if($data['status']==1) checked @endif>
        <input type="radio" name="status" value="0" title="禁用" @if($data['status']==0) checked @endif>
      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label">类型</label>
      <div class="layui-input-block">
        <select name="type" lay-verify="required">
          <option value="">请选择类型</option>
          <option value="2" @if($data['type']==2) selected @endif>微信扫码</option>
          <option value="3" @if($data['type']==3) selected @endif>支付宝扫码</option>
          <option value="4" @if($data['type']==4) selected @endif>QQ扫码</option>
          <option value="5" @if($data['type']==5) selected @endif>银联扫码</option>
          <option value="6" @if($data['type']==6) selected @endif>京东扫码</option>
          <option value="7" @if($data['type']==7) selected @endif>一码多扫</option>
        </select>
      </div>
    </div>
    <div class="layui-form-item">
      <div class="layui-input-block">
        <button class="layui-btn" lay-submit lay-filter="submitForm">立即提交</button>
      </div>
    </div>
  </form>

  <script>
      //Demo
      layui.use(['form'], function(){
          var form = layui.form;

          //监听提交
          form.on('submit(submitForm)', function(data){
              return true;
          });
      });
      function cbFormSuccess(data){
          layer.msg(data.msg);
          setTimeout(function(){
              window.location.href='/admin/Payment/index';
          },2500);
      }
  </script>
@endsection
