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

    <form class="layui-form" action="{{ url()->full() }}" id="submitForm" name="submitForm" method="post"
          eventType="eventForm" lay-filter="submitForm">
        {!! csrf_field() !!}

        <div class="layui-form-item">
            <label class="layui-form-label">理&nbsp;&nbsp;由&nbsp;&nbsp;</label>
            <div class="layui-input-inline">
                <textarea name="reson">{{isset($data['reason'])?$data['reason']:''}}</textarea>
            </div>
        </div>

        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn sub" 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);
            var table = window.parent.tab;
                //执行重载
                table.reload({
                    page: {
                        curr: 1 //重新从第 1 页开始
                    }
                    , where: {
                        account: $("#account_name", parent.document).val(),
                        sureblur: $('.layui-form-switch', parent.document).text(),
                    }
                });
                var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                parent.layer.close(index); //再执行关闭
//            console.log( parent.getFrameIndex(window.name));
//            $('#content').html('');
//            layer.alert(data.msg, {}, function () {
//                var table = window.parent.tab;
//                //执行重载
//                table.reload({
//                    page: {
//                        curr: 1 //重新从第 1 页开始
//                    }
//                    , where: {
//                        account: $("#account_name", parent.document).val(),
//                        sureblur: $('.layui-form-switch', parent.document).text(),
//                    }
//                });
//                var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
//                parent.layer.close(index); //再执行关闭

//            });
        };


    </script>
@endsection
