@extends('vip.layouts')
@section('content')
    <link href={{ asset("baidu/themes/default/css/umeditor.css") }} type="text/css" rel="stylesheet">
    <form class="layui-form" action="/admin/money/changeWithDrawRule?idd={{isset($data['account_identity'])?$data['account_identity']:''}}" id="submitForm" name="submitForm" method="post" eventType=eventAjaxForm>
        {!! csrf_field() !!}


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

        <div class="layui-form-item">
            <label class="layui-form-label">开始时间</label>
            <div class="layui-input-block">
                <input type="text" class="layui-input" name="start_time" id="start_time" value="{{isset($data['start_time'])?date('Y-m-d',
                $data['start_time']):''}}"/>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">结束时间</label>
            <div class="layui-input-block">
                <input type="text" class="layui-input" name="end_time" id="end_time" value="{{isset($data['end_time'])
                ?date('Y-m-d',$data['end_time']):''}}"/>
            </div>
        </div>

        <div class="layui-form-item single">
            <label class="layui-form-label">投注流水</label>
            <div class="layui-input-block">
                <input type="number" name="bettingMoney" required lay-verify="required" autocomplete="off" class="layui-input" disabled
                       value="{{isset($data['bettingMoney'])?$data['bettingMoney']:''}}">
            </div>
        </div>

        <div class="layui-form-item single">
            <label class="layui-form-label">目标流水</label>
            <div class="layui-input-block">
                <input type="number" name="needBettingMoney" required lay-verify="required" autocomplete="off" class="layui-input"
                       value="{{isset($data['needBettingMoney'])?$data['needBettingMoney']:''}}">
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block">
                @if(checkRriv('/admin/money/changeWithDrawRule'))
                    <button class="layui-btn" lay-submit lay-filter="submitForm">立即提交</button>@endif
                <button type="reset" class="layui-btn layui-btn-normal">重置</button>
            </div>
        </div>
    </form>
    <script type="text/javascript" src={{ asset("baidu/third-party/jquery.min.js") }}></script>
    <script type="text/javascript" charset="utf-8" src={{ asset("baidu/umeditor.config.js") }}></script>
    <script type="text/javascript" charset="utf-8" src={{ asset("baidu/umeditor.min.js") }}></script>
    <script type="text/javascript" src={{ asset("baidu/lang/zh-cn/zh-cn.js") }}></script>
    <script>
        //Demo
        layui.use(['form', 'layedit', 'laydate'], function () {
            var form = layui.form
                , layer = layui.layer
                , layedit = layui.layedit
                , laydate = layui.laydate;
            //执行一个laydate实例
            laydate.render({
                elem: '#start_time' //指定元素
            });
            laydate.render({
                elem: '#end_time' //指定元素
            });
            //图片上传接口
            layedit.set({
                uploadImage: {
                    url: '/admin/notice/upImg' //接口url
                    , type: 'post' //默认post
                }
            });
            //var um = UM.getEditor('myEditor');
            var um = UM.getEditor('myEditor', {
                initialFrameWidth: 1000,
                initialFrameHeight: 400
            });
            /*var editIndex = layedit.build('LAY_demo_editor');*/
            form.verify({
                title: function (value) {
                    if (value.length < 5) {
                        return '标题至少得5个字符啊';
                    }
                }
                , pass: [/(.+){6,12}$/, '密码必须6到12位']
                , content: function (value) {
                    layedit.sync(editIndex);
                }
            });
            form.on('select(testSelect)', function (data) {
                if (data.value == 20) {
                    $('.single').show();
                } else {
                    $('.single').hide();
                }

                if (data.value == 3) {
                    $('.dum').show();
                } else {
                    $('.dum').hide();
                }
            });

            //监听提交
            form.on('submit(submitForm)', function (data) {
                return true;
            });


        });

        //创建一个编辑器
        function cbFormSuccess(data) {
            layer.msg(data.msg);
            setTimeout(function () {
                parent.window.location.reload();
            }, 2500);
        }
    </script>
@endsection
