<script type="text/html" template lay-done="layui.data.sendParams(d);">
    <div class="layui-form coreshop-form" lay-filter="LAY-app-CoreCmsGoods-editForm" id="LAY-app-CoreCmsGoods-editForm">
        <input type="hidden" name="id" id="id" value="{{d.params.data.id || '' }}" />
        <div class="layui-form-item">
            <label for="id" class="layui-form-label">商品ID</label>
            <div class="layui-input-inline">
                <input name="id" id="id" lay-verType="tips" lay-verify="required|number" class="layui-input" value="{{d.params.data.id || '' }}" lay-reqText="请输入【商品ID】并为数字" />
            </div>
        </div>

        <div class="layui-form-item">
            <label for="bn" class="layui-form-label">商品编码</label>
            <div class="layui-input-inline">
                <input name="bn" id="bn" lay-verType="tips" lay-verify="required|verifybn" class="layui-input" lay-reqText="请输入【商品编码】" value="{{d.params.data.bn || '' }}" />
            </div>
        </div>

        <div class="layui-form-item">
            <label for="name" class="layui-form-label">商品名称</label>
            <div class="layui-input-inline">
                <input name="name" id="name" lay-verType="tips" lay-verify="required|verifyname" class="layui-input" lay-reqText="请输入【商品名称】" value="{{d.params.data.name || '' }}" />
            </div>
        </div>

        <div class="layui-form-item">
            <label for="brief" class="layui-form-label">商品简介</label>
            <div class="layui-input-inline">
                <input name="brief" id="brief" lay-verType="tips" lay-verify="required|verifybrief" class="layui-input" lay-reqText="请输入【商品简介】" value="{{d.params.data.brief || '' }}" />
            </div>
        </div>

        <div class="layui-form-item">
            <label for="price" class="layui-form-label">商品价格</label>
            <div class="layui-input-inline">
                <input name="price" id="price" lay-verType="tips" lay-verify="required" class="layui-input" lay-reqText="请输入【商品价格】" value="{{d.params.data.price || '' }}" />
            </div>
        </div>

        <div class="layui-form-item">
            <label for="costprice" class="layui-form-label">成本价</label>
            <div class="layui-input-inline">
                <input name="costprice" id="costprice" lay-verType="tips" lay-verify="required" class="layui-input" lay-reqText="请输入【成本价】" value="{{d.params.data.costprice || '' }}" />
            </div>
        </div>

        <div class="layui-form-item">
            <label for="mktprice" class="layui-form-label">市场价</label>
            <div class="layui-input-inline">
                <input name="mktprice" id="mktprice" lay-verType="tips" lay-verify="required" class="layui-input" lay-reqText="请输入【市场价】" value="{{d.params.data.mktprice || '' }}" />
            </div>
        </div>

        <div class="layui-form-item">
            <label for="imageIds" class="layui-form-label">默认图片 图片id</label>
            <div class="layui-input-inline">
                <input name="imageIds" id="imageIds" lay-verType="tips" lay-verify="required|verifyimageIds" class="layui-input" lay-reqText="请输入【默认图片 图片id】" value="{{d.params.data.imageIds || '' }}" />
            </div>
        </div>

        <div class="layui-form-item">
            <label for="goodsCategoryId" class="layui-form-label">商品分类ID 关联category.id</label>
            <div class="layui-input-inline">
                <input name="goodsCategoryId" id="goodsCategoryId" lay-verType="tips" lay-verify="required|number" class="layui-input" value="{{d.params.data.goodsCategoryId || '' }}" lay-reqText="请输入【商品分类ID 关联category.id】并为数字" />
            </div>
        </div>

        <div class="layui-form-item">
            <label for="goodsTypeId" class="layui-form-label">商品类别ID 关联goods_type.id</label>
            <div class="layui-input-inline">
                <input name="goodsTypeId" id="goodsTypeId" lay-verType="tips" lay-verify="required|number" class="layui-input" value="{{d.params.data.goodsTypeId || '' }}" lay-reqText="请输入【商品类别ID 关联goods_type.id】并为数字" />
            </div>
        </div>

        <div class="layui-form-item">
            <label for="brandId" class="layui-form-label">品牌ID 关联brand.id</label>
            <div class="layui-input-inline">
                <input name="brandId" id="brandId" lay-verType="tips" lay-verify="required|number" class="layui-input" value="{{d.params.data.brandId || '' }}" lay-reqText="请输入【品牌ID 关联brand.id】并为数字" />
            </div>
        </div>

        <div class="layui-form-item">
            <label for="isNomalVirtual" class="layui-form-label">是否虚拟商品</label>
            <div class="layui-input-inline">
                <input type="checkbox" lay-filter="switch" name="isNomalVirtual" id="isNomalVirtual" {{ d.params.data.isNomalVirtual ? 'checked' : '' }} lay-skin="switch" lay-text="开启|关闭">
            </div>
            <div class="layui-inline">
                <div class="layui-form-mid layui-word-aux"></div>
            </div>
        </div>

        <div class="layui-form-item">
            <label for="isMarketable" class="layui-form-label">是否上架</label>
            <div class="layui-input-inline">
                <input type="checkbox" lay-filter="switch" name="isMarketable" id="isMarketable" {{ d.params.data.isMarketable ? 'checked' : '' }} lay-skin="switch" lay-text="开启|关闭">
            </div>
            <div class="layui-inline">
                <div class="layui-form-mid layui-word-aux"></div>
            </div>
        </div>

        <div class="layui-form-item">
            <label for="stock" class="layui-form-label">库存</label>
            <div class="layui-input-inline">
                <input name="stock" id="stock" lay-verType="tips" lay-verify="required|number" class="layui-input" value="{{d.params.data.stock || '' }}" lay-reqText="请输入【库存】并为数字" />
            </div>
        </div>

        <div class="layui-form-item">
            <label for="freezeStock" class="layui-form-label">冻结库存</label>
            <div class="layui-input-inline">
                <input name="freezeStock" id="freezeStock" lay-verType="tips" lay-verify="required|number" class="layui-input" value="{{d.params.data.freezeStock || '' }}" lay-reqText="请输入【冻结库存】并为数字" />
            </div>
        </div>

        <div class="layui-form-item">
            <label for="weight" class="layui-form-label">重量</label>
            <div class="layui-input-inline">
                <input name="weight" id="weight" lay-verType="tips" lay-verify="required" class="layui-input" lay-reqText="请输入【重量】" value="{{d.params.data.weight || '' }}" />
            </div>
        </div>

        <div class="layui-form-item">
            <label for="unit" class="layui-form-label">商品单位</label>
            <div class="layui-input-inline">
                <input name="unit" id="unit" lay-verType="tips" lay-verify="required|verifyunit" class="layui-input" lay-reqText="请输入【商品单位】" value="{{d.params.data.unit || '' }}" />
            </div>
        </div>

        <div class="layui-form-item">
            <label for="intro" class="layui-form-label">商品详情</label>
            <div class="layui-input-inline">
                <input name="intro" id="intro" lay-verType="tips" lay-verify="required" class="layui-input" lay-reqText="请输入【商品详情】" value="{{d.params.data.intro || '' }}" />
            </div>
        </div>

        <div class="layui-form-item">
            <label for="spes_desc" class="layui-form-label">商品规格序列号存储</label>
            <div class="layui-input-inline">
                <input name="spes_desc" id="spes_desc" lay-verType="tips" lay-verify="required" class="layui-input" lay-reqText="请输入【商品规格序列号存储】" value="{{d.params.data.spes_desc || '' }}" />
            </div>
        </div>

        <div class="layui-form-item">
            <label for="parameters" class="layui-form-label">参数序列化</label>
            <div class="layui-input-inline">
                <input name="parameters" id="parameters" lay-verType="tips" lay-verify="required" class="layui-input" lay-reqText="请输入【参数序列化】" value="{{d.params.data.parameters || '' }}" />
            </div>
        </div>

        <div class="layui-form-item">
            <label for="commentsCount" class="layui-form-label">评论次数</label>
            <div class="layui-input-inline">
                <input name="commentsCount" id="commentsCount" lay-verType="tips" lay-verify="required|number" class="layui-input" value="{{d.params.data.commentsCount || '' }}" lay-reqText="请输入【评论次数】并为数字" />
            </div>
        </div>

        <div class="layui-form-item">
            <label for="viewCount" class="layui-form-label">浏览次数</label>
            <div class="layui-input-inline">
                <input name="viewCount" id="viewCount" lay-verType="tips" lay-verify="required|number" class="layui-input" value="{{d.params.data.viewCount || '' }}" lay-reqText="请输入【浏览次数】并为数字" />
            </div>
        </div>

        <div class="layui-form-item">
            <label for="buyCount" class="layui-form-label">购买次数</label>
            <div class="layui-input-inline">
                <input name="buyCount" id="buyCount" lay-verType="tips" lay-verify="required|number" class="layui-input" value="{{d.params.data.buyCount || '' }}" lay-reqText="请输入【购买次数】并为数字" />
            </div>
        </div>

        <div class="layui-form-item">
            <label for="uptime" class="layui-form-label">上架时间</label>
            <div class="layui-input-inline">
                <input name="uptime" id="editTime-CoreCmsGoods-uptime" type="text" lay-verType="tips" lay-verify="required|datetime" class="layui-input" lay-reqText="请输入【上架时间】" value="{{d.params.data.uptime || '' }}" />
            </div>
        </div>

        <div class="layui-form-item">
            <label for="downtime" class="layui-form-label">下架时间</label>
            <div class="layui-input-inline">
                <input name="downtime" id="editTime-CoreCmsGoods-downtime" type="text" lay-verType="tips" lay-verify="required|datetime" class="layui-input" lay-reqText="请输入【下架时间】" value="{{d.params.data.downtime || '' }}" />
            </div>
        </div>

        <div class="layui-form-item">
            <label for="sort" class="layui-form-label">商品排序</label>
            <div class="layui-input-inline">
                <input name="sort" id="sort" lay-verType="tips" lay-verify="required|number" class="layui-input" value="{{d.params.data.sort || '' }}" lay-reqText="请输入【商品排序】并为数字" />
            </div>
        </div>

        <div class="layui-form-item">
            <label for="labelIds" class="layui-form-label">标签id逗号分隔</label>
            <div class="layui-input-inline">
                <input name="labelIds" id="labelIds" lay-verType="tips" lay-verify="required|verifylabelIds" class="layui-input" lay-reqText="请输入【标签id逗号分隔】" value="{{d.params.data.labelIds || '' }}" />
            </div>
        </div>

        <div class="layui-form-item">
            <label for="newSpec" class="layui-form-label">自定义规格名称</label>
            <div class="layui-input-inline">
                <input name="newSpec" id="newSpec" lay-verType="tips" lay-verify="required" class="layui-input" lay-reqText="请输入【自定义规格名称】" value="{{d.params.data.newSpec || '' }}" />
            </div>
        </div>

        <div class="layui-form-item">
            <label for="createTime" class="layui-form-label">创建时间</label>
            <div class="layui-input-inline">
                <input name="createTime" id="editTime-CoreCmsGoods-createTime" type="text" lay-verType="tips" lay-verify="required|datetime" class="layui-input" lay-reqText="请输入【创建时间】" value="{{d.params.data.createTime || '' }}" />
            </div>
        </div>

        <div class="layui-form-item">
            <label for="updateTime" class="layui-form-label">更新时间</label>
            <div class="layui-input-inline">
                <input name="updateTime" id="editTime-CoreCmsGoods-updateTime" type="text" lay-verType="tips" lay-verify="required|datetime" class="layui-input" lay-reqText="请输入【更新时间】" value="{{d.params.data.updateTime || '' }}" />
            </div>
        </div>

        <div class="layui-form-item">
            <label for="isRecommend" class="layui-form-label">是否推荐</label>
            <div class="layui-input-inline">
                <input type="checkbox" lay-filter="switch" name="isRecommend" id="isRecommend" {{ d.params.data.isRecommend ? 'checked' : '' }} lay-skin="switch" lay-text="开启|关闭">
            </div>
            <div class="layui-inline">
                <div class="layui-form-mid layui-word-aux"></div>
            </div>
        </div>

        <div class="layui-form-item">
            <label for="isHot" class="layui-form-label">是否热门</label>
            <div class="layui-input-inline">
                <input type="checkbox" lay-filter="switch" name="isHot" id="isHot" {{ d.params.data.isHot ? 'checked' : '' }} lay-skin="switch" lay-text="开启|关闭">
            </div>
            <div class="layui-inline">
                <div class="layui-form-mid layui-word-aux"></div>
            </div>
        </div>

        <div class="layui-form-item">
            <label for="isDel" class="layui-form-label">是否删除</label>
            <div class="layui-input-inline">
                <input type="checkbox" lay-filter="switch" name="isDel" id="isDel" {{ d.params.data.isDel ? 'checked' : '' }} lay-skin="switch" lay-text="开启|关闭">
            </div>
            <div class="layui-inline">
                <div class="layui-form-mid layui-word-aux"></div>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label"></label>
            <input type="button" class="layui-btn" lay-submit lay-filter="LAY-app-CoreCmsGoods-editForm-submit" id="LAY-app-CoreCmsGoods-editForm-submit" value="确认编辑">
        </div>
    </div>
</script>
<script>
    layui.data.sendParams = function (d) {
        layui.use(['admin', 'form', 'laydate', 'coreHelper'],
            function () {
                var $ = layui.$
                    , form = layui.form
                    , admin = layui.admin
                    , laydate = layui.laydate
                    , coreHelper = layui.coreHelper;

                laydate.render({
                    elem: '#editTime-CoreCmsGoods-uptime',
                    type: 'datetime'
                });
                laydate.render({
                    elem: '#editTime-CoreCmsGoods-downtime',
                    type: 'datetime'
                });
                laydate.render({
                    elem: '#editTime-CoreCmsGoods-createTime',
                    type: 'datetime'
                });
                laydate.render({
                    elem: '#editTime-CoreCmsGoods-updateTime',
                    type: 'datetime'
                });
                form.verify({

		            verifybn: [/^[\S]{0,30}$/,'商品编码最大只允许输入30位字符，且不能出现空格'],
		            verifyname: [/^[\S]{0,200}$/,'商品名称最大只允许输入200位字符，且不能出现空格'],
		            verifybrief: [/^[\S]{0,255}$/,'商品简介最大只允许输入255位字符，且不能出现空格'],
		            verifyimageIds: [/^[\S]{0,255}$/,'默认图片 图片id最大只允许输入255位字符，且不能出现空格'],
		            verifyunit: [/^[\S]{0,20}$/,'商品单位最大只允许输入20位字符，且不能出现空格'],
		            verifylabelIds: [/^[\S]{0,50}$/,'标签id逗号分隔最大只允许输入50位字符，且不能出现空格'],
                });
                //重载form
                form.render(null, 'LAY-app-CoreCmsGoods-editForm');
            })
    };
</script>