@extends('vip.layouts')
@section('content')
<style>
    .layui-form-item{
        width: 805px;
        border-right: 0;
        overflow: hidden;
        margin-bottom: 20px;
    }
    .layui-input-inline{
        /*border-right:black 1px solid;*/
        width: 200px;
        overflow: hidden;
        padding-top: 5px;
    }
    .layui-input-inline input{
        text-align: center;
        width: 80%;
        height: 80%;
    }
</style>

        <div class="layui-form-item">
            <div class="layui-input-inline">
                <label class="layui-form-label">代理等级</label>
            </div>
            <div class="layui-input-inline">
                <label class="layui-form-label">流水分成(%)</label>
            </div>
            {{--<div class="layui-input-inline">--}}
                {{--<label class="layui-form-label">盈利分成(%)</label>--}}
            {{--</div>--}}
            <div class="layui-input-inline">
                <label class="layui-form-label">设置</label>
            </div>
        </div>
@foreach($data as $v)
        <div class="layui-form-item">
            <form lay-filter="submitForm" method="post" action="{{ url()->full() }}" eventType=eventAjaxForm>
                {!! csrf_field() !!}
                <input  type="hidden" name="id" value="{{$v['id']}}">
                <div class="layui-input-inline">
                    <label class="layui-form-label">{{$v['grade_name']}}</label>
                </div>
                <div class="layui-input-inline">
                    <label class="layui-form-label">
                    <input type="text" name="water_ratio" value="{{$v['water_ratio']}}">
                    </label>
                </div>
                {{--<div class="layui-input-inline">--}}
                    {{--<label class="layui-form-label">--}}
                    {{--<input  type="text" name="profit_ratio" value="{{$v['profit_ratio']}}">--}}
                    {{--</label>--}}
                {{--</div>--}}
                <div class="layui-input-inline" style="text-align: center">
                    <label class="layui-form-label">
                        <button  class="layui-btn sub" lay-filter="go">设置</button>
                    </label>
                </div>
            </form>
        </div>
        @endforeach
    <script>
        //Demo
        layui.use(['form'], function () {
            var form = layui.form;

            //监听提交
            form.on('submit(go)', function (data) {
                layer.alert(data.msg);
                return true; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
            });
        });
        function cbFormSuccess(data) {
            layer.alert(data.msg,{},function () {
                window.location.reload();
            });
        }

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