${mask name='edit'}
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>编辑品牌信息</title>
    <link rel="stylesheet" href="/content/lib/layui-v2.9.18/css/layui.css" media="all">
    <link rel="stylesheet" href="/content/lib/font-awesome-4.7.0/css/font-awesome.min.css" media="all">
    <link rel="stylesheet" href="/content/css/public.css" media="all">
    <style>
        .layui-btn:not(.layui-btn-lg ):not(.layui-btn-sm):not(.layui-btn-xs) {
            height: 34px;
            line-height: 34px;
            padding: 0 8px;
        }
        .layui-iconpicker-body.layui-iconpicker-body-page .hide {
            display: none;
        }
    </style>
</head>
<body  style="background-color: #FFF;">
    <div class="layuimini-main">
        <div class="layui-col-md12 top10">
            <form class="layui-form" action="">
                <div class="layui-form-item">
                    <input name="id" lay-verify="required" style="display: none;" lay-vertype="tips" class="layui-input" type="text" value="${model name='brand_config.id' value='[#value]'/}" />
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">品牌编号：</label>
                    <div class="layui-input-inline">
                        <input type="number" name="number" lay-verify="required|account" lay-min="1" autocomplete="off" class="layui-input account" placeholder="请输入品牌编号" value="${model name='brand_config.number' value='[#value]'/}" />
                    </div>
                    <label class="layui-form-label">品牌名称：</label>
                    <div class="layui-input-inline">
                        <input type="text" name="name" lay-verify="required|account" lay-min="1" autocomplete="off" class="layui-input account" placeholder="请输入品牌名称" value="${model name='brand_config.name' value='[#value]'/}" />
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">状态：</label>
                    <div class="layui-input-inline">
                        <input name="enable" value="true" title="启用" ${model name='brand_config.enable' value='['true':'checked']' /} type="radio">
                        <div class="layui-unselect layui-form-radio layui-form-radioed">
                            <i class="layui-anim layui-icon"></i><div>启用</div>
                        </div>
                        <input name="enable" value="false" title="停用" ${model name='brand_config.enable' value='['false':'checked']' /} type="radio">
                        <div class="layui-unselect layui-form-radio">
                            <i class="layui-anim layui-icon"></i><div>停用</div>
                        </div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">品牌描述：</label>
                    <div class="layui-input-block">
                        <textarea class="layui-textarea" cols="20" id="remarks" lay-verify="pass" lay-vertype="tips" name="remarks" rows="2" placeholder="请输入品牌描述">${model name='brand_config.remarks' value='[#value]'/}</textarea>
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-input-block">
                        <button class="layui-btn" lay-submit="" lay-filter="submitForm">立即提交</button>
                        <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                    </div>
                </div>
            </form>
        </div>
    </div>
    <script src="/content/lib/layui-v2.9.18/layui.js" charset="utf-8"></script>
    <script src="/content/js/lay-config.js" charset="utf-8"></script>
    <script>
        //关闭页面
        function CloseWin() {
            parent.location.reload(); // 父页面刷新
            var index = parent.layer.getFrameIndex(window.name); // 先得到当前iframe层的索引
            parent.layer.close(index); // 再执行关闭
        }
        layui.use(['jquery', 'form', 'layer'], function () {
            var $ = layui.jquery,
                form = layui.form,
                layer = layui.layer;

            // 监听提交
            form.on('submit(submitForm)', function (data) {
                $.ajax({
                    type: "POST",
                    url: "/brand/edit",
                    data: JSON.stringify(data.field),
                    async: false,
                    dataType: 'json',
                    contentType: 'application/json',
                    success: function (result) {
                        if (result.success) {
                            layer.msg(result.message, {
                                icon: 1  //1:勾 6：笑脸
                            });
                            setTimeout(CloseWin, 1000);
                        }
                        else {
                            layer.msg(result.message, {
                                icon: 5  //1:勾 6：笑脸
                            });
                        }
                    },
                    error: function (msg) {
                        layer.msg(result.message, {
                            icon: 5  //1:勾 6：笑脸
                        });
                    }
                });
                return false;
            });
            //验证输入大小
            form.verify({
                account: function (value, item) {
                    var min = item.getAttribute('lay-min');
                    if (value.length < min) {
                        return '输入内容不能小于' + min + '';
                    }
                }
            });
        });
    </script>
</body>
</html>
{/mask}