xiaoyong931011
2021-09-27 ad04c582fbda7f095866d37993143880b57af7a4
src/main/resources/templates/febs/views/modules/goods/goodsAddNew.html
@@ -23,12 +23,8 @@
                                <div class="layui-col-lg6">
                                    <label class="layui-form-label febs-form-item-require">所属分类:</label>
                                    <div class="layui-input-block">
                                        <select name="categoryId"
                                                value="categoryId"
                                                lay-verify="required"
                                                xm-select-direction="down"
                                                xm-select="user-add-goods"
                                                xm-select-skin="default">
                                        <select name="categoryId" class="categary-update-category" >
                                            <option value="">请选择</option>
                                        </select>
                                    </div>
                                </div>
@@ -72,7 +68,7 @@
                            </div>
                            <div id="attrWrap"></div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">缩略图:</label>
                                <label class="layui-form-label febs-form-item-require">缩略图:</label>
                                <div class="layui-input-block">
                                    <div class="layui-upload">
                                        <button type="button" class="layui-btn layui-btn-normal layui-btn-xs" id="test2">上传</button>
@@ -85,12 +81,12 @@
                            <div class="layui-form-item febs-hide">
                                <label class="layui-form-label">缩略图链接:</label>
                                <div class="layui-input-block">
                                    <input type="text" id="thumb" name="thumb" autocomplete="off" class="layui-input" readonly>
                                    <input type="text" id="thumb" lay-verify="required" name="thumb" autocomplete="off" class="layui-input" readonly>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">轮播图:</label>
                                <label class="layui-form-label febs-form-item-require">轮播图:</label>
                                <div class="layui-input-block">
                                    <div class="layui-upload">
                                        <button type="button" class="layui-btn layui-btn-normal layui-btn-xs" id="thumbsBanner">上传</button>
@@ -103,14 +99,14 @@
                            <div class="layui-form-item febs-hide">
                                <label class="layui-form-label">缩略图链接:</label>
                                <div class="layui-input-block">
                                    <input type="text" id="thumbs" name="thumbs" autocomplete="off" class="layui-input" readonly>
                                    <input type="text" id="thumbs" lay-verify="required" name="thumbs" autocomplete="off" class="layui-input" readonly>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">商品详情:</label>
                                <label class="layui-form-label febs-form-item-require">商品详情:</label>
                                <div class="layui-input-block">
                                    <textarea id="lay_edit" lay-verify="goodsDetails" name = "goodsDetails" class="layui-textarea"></textarea>
                                    <textarea id="lay_edit" lay-verify="required" name = "goodsDetails" class="layui-textarea"></textarea>
                                </div>
                            </div>
                            <div class="layui-row layui-col-space10 layui-form-item">
@@ -158,32 +154,20 @@
        formSelects.render();
        formSelects.config('user-add-goods', {
            searchUrl: ctx + 'admin/goodsCategory/categorys',
            response: {
                statusCode: 200
            },
            beforeSuccess: function (id, url, searchVal, result) {
                var data = result.data;
                var tranData = [];
                for (var i = 0; i < data.length; i++) {
                    tranData.push({
                        name: data[i].name,
                        value: data[i].id
                    })
                }
                result.data = tranData;
                console.log(result);
                return result;
            },
            success: function () {
                formSelects.value('user-add-goods', result.id);
            },
            error: function (id, url, searchVal, err) {
                console.error(err);
                febs.alert.error('获取分类列表失败');
        //(下拉框)
        $.get(ctx + 'admin/goodsCategory/categorys/tree', function (data) {
            for (var k in data)
            {
                $(".categary-update-category").append("<option value='" + data[k].parentId + "'>" + data[k].name + "</option>");
            }
            layui.use('form', function () {
                var form = layui.form;
                // $("#categarySelect").val(member.parentId)
                form.render();
            });
        });
        //多图片上传
        upload.render({
            elem: '#thumbsBanner'
@@ -334,6 +318,10 @@
                    presentPrice: $("input[name='presentPrice" + i + "']").val()
                })
            }
            // if(skuArr.length < 0){
            //     febs.alert.warn("请填写商品规格");
            //     return false;
            // }
            // console.log(skuArrs)
            data.field.addMallGoodsSkuDtos = skuArrs;
            // console.log(data.field)