<script type="text/html" template lay-done="layui.data.done(d);">
    <div class="layui-form coreshop-form layui-form-pane" lay-filter="LAY-app-CoreCmsDistributionGrade-createForm" id="LAY-app-CoreCmsDistributionGrade-createForm">

        <div class="layui-form-item">
            <label for="name" class="layui-form-label  layui-form-required">等级名称</label>
            <div class="layui-input-block">
                <input name="name" lay-verify="required|verifyname" class="layui-input" lay-reqText="请输入等级名称" placeholder="请输入等级名称" />
            </div>
        </div>

        <div class="layui-form-item" pane>
            <label for="isDefault" class="layui-form-label  layui-form-required">是否默认等级</label>
            <div class="layui-input-inline layui-inline-2">
                <input type="checkbox" lay-filter="switch" name="isDefault" lay-skin="switch" lay-text="开启|关闭">
            </div>
            <div class="layui-form-mid layui-word-aux">当前等级是否默认分销商等级</div>
        </div>

        <div class="layui-form-item" pane>
            <label for="isAutoUpGrade" class="layui-form-label  layui-form-required">是否自动升级</label>
            <div class="layui-input-inline layui-inline-2">
                <input type="checkbox" lay-filter="switch" name="isAutoUpGrade" lay-skin="switch" lay-text="开启|关闭" checked="checked">
            </div>
            <div class="layui-form-mid layui-word-aux">开启后，可根据升级条件自动升级</div>
        </div>

        <div class="layui-form-item">
            <label for="sortId" class="layui-form-label  layui-form-required">等级排序</label>
            <div class="layui-input-inline layui-inline-2">
                <input type="number" min="0" max="999999" name="sortId" lay-verify="required|number" class="layui-input" value="1" placeholder="请输入等级排序" lay-reqText="请输入等级排序并为数字" />
            </div>
            <div class="layui-form-mid layui-word-aux">数字越大，等级越高</div>
        </div>

        <div class="layui-form-item layui-form-text">
            <label for="description" class="layui-form-label  layui-form-required">等级说明</label>
            <div class="layui-input-block">
                <textarea name="description" lay-verify="required|verifydescription" class="layui-textarea" lay-reqText="请输入等级说明" placeholder="请输入等级说明" />
            </div>
        </div>

        <div class="layui-form-item text-right">
            <input type="button" class="layui-btn" lay-submit lay-filter="LAY-app-CoreCmsDistributionGrade-createForm-submit" id="LAY-app-CoreCmsDistributionGrade-createForm-submit" value="确认添加">
        </div>
    </div>
</script>
<script>
    var debug = layui.setter.debug;
    layui.data.done = function (d) {
        //开启调试情况下获取接口赋值数据
        if (debug) { console.log(d.params.data); }
        layui.use(['admin', 'form', 'laydate', 'upload', 'coreHelper', 'cropperImg'],
            function () {
                var $ = layui.$
                    , form = layui.form
                    , admin = layui.admin
                    , laydate = layui.laydate
                    , upload = layui.upload
                    , cropperImg = layui.cropperImg
                    , coreHelper = layui.coreHelper;

                form.verify({

                    verifyname: [/^.{0,25}$/, '等级名称最大只允许输入25位字符'],
                    verifydescription: [/^.{0,250}$/, '等级说明最大只允许输入250位字符'],
                });
                //重载form
                form.render(null, 'LAY-app-CoreCmsDistributionGrade-createForm');
            })
    };
</script>
