KKSU
2024-06-04 068fe86cffc98f31a0b83bee34fa2dce6b23b736
src/main/resources/templates/febs/views/modules/goods/goodsAddNew.html
@@ -18,13 +18,13 @@
                                            <div class="layui-col-lg6">
                                                <label class="layui-form-label febs-form-item-require">商品名称:</label>
                                                <div class="layui-input-block">
                                                    <input type="text" name="goodsName" lay-verify="required" placeholder="" autocomplete="off" class="layui-input">
                                                    <input type="text" name="goodsName" lay-verify="required" placeholder="50个以内的字符" autocomplete="off" class="layui-input">
                                                </div>
                                            </div>
                                            <div class="layui-col-lg6">
                                                <label class="layui-form-label febs-form-item-require">商品编号:</label>
                                                <div class="layui-input-block">
                                                    <input type="text" name="goodsNo" lay-verify="required" placeholder="" autocomplete="off" class="layui-input">
                                                    <input type="text" name="goodsNo" lay-verify="required" placeholder="30个以内的字符" autocomplete="off" class="layui-input">
                                                </div>
                                            </div>
                                        </div>
@@ -47,7 +47,7 @@
                                            <div class="layui-col-lg3">
                                                <label class="layui-form-label febs-form-item-require">序号:</label>
                                                <div class="layui-input-block">
                                                    <input type="number" name="orderNumber" lay-verify="required" placeholder="" autocomplete="off" class="layui-input">
                                                    <input type="number" name="orderNumber" lay-verify="required" placeholder="纯数字" autocomplete="off" class="layui-input">
                                                </div>
                                            </div>
                                        </div>
@@ -56,13 +56,14 @@
                                            <div class="layui-col-lg6">
                                                <label class="layui-form-label febs-form-item-require">单位:</label>
                                                <div class="layui-input-block">
                                                    <input type="text" name="unit"  lay-verify="required" placeholder="" autocomplete="off" class="layui-input">
                                                    <input type="text" name="unit"  lay-verify="required" placeholder="10个以内的字符" autocomplete="off" class="layui-input">
                                                    <div class="layui-form-mid layui-word-aux">例如:个、克。</div>
                                                </div>
                                            </div>
                                            <div class="layui-col-lg6">
                                                <label class="layui-form-label febs-form-item-require">重量:</label>
                                                <div class="layui-input-block">
                                                    <input type="text" name="goodsWeight"  lay-verify="required" placeholder="" autocomplete="off" class="layui-input">
                                                    <input type="text" name="goodsWeight"  lay-verify="required" placeholder="纯数字" autocomplete="off" class="layui-input">
                                                    <div class="layui-form-mid layui-word-aux">默认单位:克。请填写数字。如:1千克,则填入1000。</div>
                                                </div>
@@ -72,13 +73,13 @@
                                            <div class="layui-col-lg6">
                                                <label class="layui-form-label febs-form-item-require">库存:</label>
                                                <div class="layui-input-block">
                                                    <input type="text" name="stock"  lay-verify="required" placeholder="" autocomplete="off" class="layui-input">
                                                    <input type="text" name="stock"  lay-verify="required" placeholder="纯数字" autocomplete="off" class="layui-input">
                                                </div>
                                            </div>
                                            <div class="layui-col-lg6">
                                                <label class="layui-form-label febs-form-item-require">销量:</label>
                                                <div class="layui-input-block">
                                                    <input type="text" name="volume"  lay-verify="required" placeholder="" autocomplete="off" class="layui-input">
                                                    <input type="text" name="volume"  lay-verify="required" placeholder="纯数字" autocomplete="off" class="layui-input">
                                                </div>
                                            </div>
                                        </div>
@@ -87,7 +88,7 @@
                                            <label class="layui-form-label">商品介绍:</label>
                                            <div class="layui-input-block">
                                                <label>
                                                    <textarea name="goodsIntrodution" rows="5" autocomplete="off" class="layui-textarea" ></textarea>
                                                    <textarea name="goodsIntrodution" rows="5" autocomplete="off" class="layui-textarea" placeholder="1000个以内的字符" ></textarea>
                                                </label>
                                            </div>
                                        </div>
@@ -103,20 +104,20 @@
                                            </div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">推销员返积分比例(%)</label>
                                            <div class="layui-input-block">
                                                <input type="text" name="staticMulti" placeholder="请输入推销员返积分比例" autocomplete="off" class="layui-input">
                                            </div>
                                        </div>
<!--                                        <div class="layui-form-item">-->
<!--                                            <label class="layui-form-label">推销员返积分比例(%)</label>-->
<!--                                            <div class="layui-input-block">-->
<!--                                                <input type="text" name="staticMulti" placeholder="请输入推销员返积分比例" autocomplete="off" class="layui-input">-->
<!--                                            </div>-->
<!--                                        </div>-->
                                        <div class="layui-form-item febs-hide tc-set">
                                            <label class="layui-form-label">静态占比(%)</label>
                                            <div class="layui-input-block">
                                                <input type="text" name="staticProp" placeholder="请输入静态占比" autocomplete="off" class="layui-input">
                                                <div class="layui-form-mid layui-word-aux">所有套餐静态占比相加应等于100%</div>
                                            </div>
                                        </div>
<!--                                        <div class="layui-form-item febs-hide tc-set">-->
<!--                                            <label class="layui-form-label">静态占比(%)</label>-->
<!--                                            <div class="layui-input-block">-->
<!--                                                <input type="text" name="staticProp" placeholder="请输入静态占比" autocomplete="off" class="layui-input">-->
<!--                                                <div class="layui-form-mid layui-word-aux">所有套餐静态占比相加应等于100%</div>-->
<!--                                            </div>-->
<!--                                        </div>-->
                                    </div>
                                    <div class="layui-tab-item">
@@ -164,7 +165,7 @@
                                            <label class="layui-form-label">商品参数:</label>
                                            <div class="layui-input-block">
                                                <label>
                                                    <textarea name="goodsParameter" rows="5" autocomplete="off" class="layui-textarea" ></textarea>
                                                    <textarea name="goodsParameter" rows="5" autocomplete="off" class="layui-textarea" placeholder="1000个以内的字符"></textarea>
                                                </label>
                                            </div>
                                        </div>
@@ -197,13 +198,13 @@
                                            <div class="layui-col-lg6">
                                                <label class="layui-form-label febs-form-item-require">原价:</label>
                                                <div class="layui-input-block">
                                                    <input type="text" name="originalPrice" lay-verify="required" placeholder="" autocomplete="off" class="layui-input">
                                                    <input type="text" name="originalPrice" lay-verify="required" placeholder="纯数字" autocomplete="off" class="layui-input">
                                                </div>
                                            </div>
                                            <div class="layui-col-lg6">
                                                <label class="layui-form-label febs-form-item-require">现价:</label>
                                                <div class="layui-input-block">
                                                    <input type="text" name="presentPrice" lay-verify="required" placeholder="" autocomplete="off" class="layui-input">
                                                    <input type="text" name="presentPrice" lay-verify="required" placeholder="纯数字" autocomplete="off" class="layui-input">
                                                </div>
                                            </div>
                                        </div>
@@ -235,7 +236,7 @@
                                            <div class="layui-col-lg6">
                                                <label class="layui-form-label febs-form-item-require">成本价:</label>
                                                <div class="layui-input-block">
                                                    <input type="text" name="costPrice" lay-verify="required" placeholder="" autocomplete="off" class="layui-input">
                                                    <input type="text" name="costPrice" lay-verify="required" placeholder="纯数字" autocomplete="off" class="layui-input">
                                                </div>
                                            </div>
                                        </div>
@@ -252,7 +253,7 @@
                                            <div class="layui-col-lg6">
                                                <label class="layui-form-label">固定运费:</label>
                                                <div class="layui-input-block">
                                                    <input id="carriageAmountDefault" type="text" name="carriageAmount" placeholder="" autocomplete="off" class="layui-input">
                                                    <input id="carriageAmountDefault" type="text" name="carriageAmount" placeholder="纯数字" autocomplete="off" class="layui-input">
                                                    <div class="layui-form-mid layui-word-aux">远费设置为0元,商品将显示为免运费。</div>
                                                </div>
                                            </div>
@@ -267,15 +268,15 @@
                                            </div>
                                        </div>
                                        <blockquote class="layui-elem-quote blue-border">优惠卷设置</blockquote>
                                        <div class="layui-form-item coupon-rule">
                                            <div class="layui-col-lg6">
                                                <label class="layui-form-label">优惠卷:</label>
                                                <div class="layui-input-block">
                                                    <div id="coupon-rule"></div>
                                                </div>
                                            </div>
                                        </div>
<!--                                        <blockquote class="layui-elem-quote blue-border">优惠卷设置</blockquote>-->
<!--                                        <div class="layui-form-item coupon-rule">-->
<!--                                            <div class="layui-col-lg6">-->
<!--                                                <label class="layui-form-label">优惠卷:</label>-->
<!--                                                <div class="layui-input-block">-->
<!--                                                    <div id="coupon-rule"></div>-->
<!--                                                </div>-->
<!--                                            </div>-->
<!--                                        </div>-->
                                        <blockquote class="layui-elem-quote blue-border">多规格设置</blockquote>
                                        <div class="layui-col-lg6">
@@ -290,7 +291,7 @@
                                                <div class="layui-col-lg6">
                                                    <label class="layui-form-label febs-form-item-require">样式:</label>
                                                    <div class="layui-input-block">
                                                        <input type="text" name="addMallGoodsSkuDtos" autocomplete="off" class="layui-input" id="attrName">
                                                        <input type="text" name="addMallGoodsSkuDtos" placeholder="30个以内的字符" autocomplete="off" class="layui-input" id="attrName">
                                                    </div>
                                                </div>
                                                <div class="layui-col-lg1">
@@ -375,7 +376,28 @@
            validate = layui.validate,
            element = layui.element;
        //验证输入数字
        form.verify({
            isNum: function(value, item){ //value:表单的值、item:表单的DOM对象
                if(!new RegExp("^[0-9]+$").test(value)){
                    return '该字段只能填写数字!';
                }
            }
        });
        // 验证汉字数量不超过100个
        form.verify({
            chineseCharCount: function(value, item){ //value:表单的值、item:表单的DOM对象
                // 使用正则表达式匹配汉字,并计算数量
                var chineseCharCount = (value.match(/[\u4e00-\u9fa5]/g) || []).length;
                if(chineseCharCount > 100){
                    return '汉字数量不能超过100个!';
                }
            }
        });
        form.render();
        const E = window.wangEditor;
        const editor = new E('#toolbar-container', '#text-container'); // 传入两个元素
        editor.config.showLinkImg = false;
@@ -503,32 +525,32 @@
            });
        })
        var couponRule = xmSelect.render({
            el: '#coupon-rule',
            language: 'zn',
            prop : {
                value : 'id',
                children : 'child'
            },
            iconfont: {
                parent: 'hidden',
            },
            // radio: true,
            clickClose: true,
            tree: {
                show: true,
                //非严格模式
                strict: false,
            },
            data: []
        })
        febs.get(ctx + 'admin/goods/couponTreeSet', null, function(res) {
            couponRule.update({
                data : res.data,
                autoRow: true,
            });
        })
        // var couponRule = xmSelect.render({
        //     el: '#coupon-rule',
        //     language: 'zn',
        //     prop : {
        //         value : 'id',
        //         children : 'child'
        //     },
        //     iconfont: {
        //         parent: 'hidden',
        //     },
        //     // radio: true,
        //     clickClose: true,
        //     tree: {
        //         show: true,
        //         //非严格模式
        //         strict: false,
        //     },
        //     data: []
        // })
        //
        // febs.get(ctx + 'admin/goods/couponTreeSet', null, function(res) {
        //     couponRule.update({
        //         data : res.data,
        //         autoRow: true,
        //     });
        // })
        var tableSkuData=[];
        var tableIns = table.render({
@@ -788,14 +810,14 @@
        form.on('submit(goods-add-form-submit)', function (data) {
            data.field.goodsType = 1;
            let couponRuleList = couponRule.getValue();
            if (couponRuleList.length > 0) {
                var couponIds = [];
                layui.each(couponRuleList, function (key, item) {
                    couponIds.push(item.id)
                });
                data.field.couponIds=couponIds;
            }
            // let couponRuleList = couponRule.getValue();
            // if (couponRuleList.length > 0) {
            //     var couponIds = [];
            //     layui.each(couponRuleList, function (key, item) {
            //         couponIds.push(item.id)
            //     });
            //     data.field.couponIds=couponIds;
            // }
            data.field.addMallGoodsSkuDtos = tableSkuData;
            data.field.categoryId = category.getValue('valueStr');
            data.field.carriageRuleId = carriageRule.getValue('valueStr');