Administrator
2026-06-14 d41b06249ea93d81d0e933ecffe54c9d740266ef
fix(goods): 修复商品添加和更新页面中的组件方法调用问题

- 在商品添加页面中为 couponRule 和 carriageRule 的 getValue 方法添加空值检查
- 在商品更新页面中为 setValue 方法调用添加存在性验证
- 防止因组件未初始化导致的方法调用错误
- 确保 carriageRuleId 在赋值前进行安全检查
2 files modified
22 ■■■■■ changed files
src/main/resources/templates/febs/views/modules/goods/goodsAddNew.html 7 ●●●●● patch | view | raw | blame | history
src/main/resources/templates/febs/views/modules/goods/goodsUpdateNew.html 15 ●●●●● patch | view | raw | blame | history
src/main/resources/templates/febs/views/modules/goods/goodsAddNew.html
@@ -789,8 +789,8 @@
        form.on('submit(goods-add-form-submit)', function (data) {
            data.field.goodsType = 1;
            let couponRuleList = couponRule.getValue();
            if (couponRuleList.length > 0) {
            let couponRuleList = couponRule.getValue ? couponRule.getValue() : [];
            if (couponRuleList && couponRuleList.length > 0) {
                var couponIds = [];
                layui.each(couponRuleList, function (key, item) {
                    couponIds.push(item.id)
@@ -799,7 +799,8 @@
            }
            data.field.addMallGoodsSkuDtos = tableSkuData;
            data.field.categoryId = category.getValue('valueStr');
            data.field.carriageRuleId = carriageRule.getValue('valueStr');
            var carriageRuleId = carriageRule.getValue ? carriageRule.getValue('valueStr') : '';
            data.field.carriageRuleId = carriageRuleId;
            // let content = layedit.getContent();
            // alert(content);
            // data.field.goodsDetails = content;
src/main/resources/templates/febs/views/modules/goods/goodsUpdateNew.html
@@ -856,9 +856,13 @@
            var arrCarriageRule = [];
            arrCarriageRule.push(goodsInfo.carriageRuleId)
            carriageRule.setValue(arrCarriageRule);
            if (carriageRule.setValue) {
                carriageRule.setValue(arrCarriageRule);
            }
            couponRule.setValue(goodsInfo.couponIds);
            if (couponRule.setValue) {
                couponRule.setValue(goodsInfo.couponIds);
            }
            if (goodsInfo.isNormal == 2) {
                $(".tc-set").show();
@@ -915,8 +919,8 @@
        }
        form.on('submit(goods-update-form-submit)', function (data) {
            let couponRuleList = couponRule.getValue();
            if (couponRuleList.length > 0) {
            let couponRuleList = couponRule.getValue ? couponRule.getValue() : [];
            if (couponRuleList && couponRuleList.length > 0) {
                var couponIds = [];
                layui.each(couponRuleList, function (key, item) {
                    couponIds.push(item.id)
@@ -927,7 +931,8 @@
            data.field.mailGoodsSkuDto = tableSkuData;
            data.field.delSkuId=delSku;
            data.field.categoryId = category.getValue('valueStr');
            data.field.carriageRuleId = carriageRule.getValue('valueStr');
            var carriageRuleId = carriageRule.getValue ? carriageRule.getValue('valueStr') : '';
            data.field.carriageRuleId = carriageRuleId;
            // data.field.goodsDetails = editor.getHtml();
            data.field.goodsDetails = editor.txt.html();
            $.ajax({