xiaoyong931011
2023-02-09 8d120580505ba97dd9c7bdef9122bf80559a558d
后台商品匹配运费模板
规格增加重量
2 files added
14 files modified
356 ■■■■ changed files
src/main/java/cc/mrbird/febs/mall/controller/AdminMallGoodsController.java 5 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/controller/ApiMallGoodsController.java 14 ●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/dto/AddMallGoodsDto.java 8 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/dto/AddMallGoodsSkuDto.java 2 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/dto/MailGoodsSkuDto.java 2 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/dto/MallGoodsUpdateDto.java 8 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/entity/MallGoods.java 2 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/entity/MallGoodsSku.java 2 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/service/IAdminMallGoodsService.java 2 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/service/IApiMallGoodsService.java 7 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/service/impl/AdminMallGoodsService.java 58 ●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallGoodsServiceImpl.java 38 ●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/vo/ApiMallCarriageRuleInfoVo.java 40 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/vo/ApiMallCarriageRuleVo.java 18 ●●●●● patch | view | raw | blame | history
src/main/resources/templates/febs/views/modules/goods/goodsAddNew.html 67 ●●●● patch | view | raw | blame | history
src/main/resources/templates/febs/views/modules/goods/goodsUpdateNew.html 83 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/controller/AdminMallGoodsController.java
@@ -245,5 +245,10 @@
        return adminMallGoodsService.carriageRuleUpdate(adminCarriageRuleUpdateDto);
    }
    @GetMapping(value = "/carriageRuleTree")
    public FebsResponse carriageRuleTree() {
        return new FebsResponse().success().data(adminMallGoodsService.findAllCarriageRuleTree());
    }
}
src/main/java/cc/mrbird/febs/mall/controller/ApiMallGoodsController.java
@@ -4,10 +4,7 @@
import cc.mrbird.febs.mall.dto.ApiMallGoodsCommentDto;
import cc.mrbird.febs.mall.dto.MallGoodsQueryDto;
import cc.mrbird.febs.mall.service.IApiMallGoodsService;
import cc.mrbird.febs.mall.vo.ApiMallGoodsDeliveryVo;
import cc.mrbird.febs.mall.vo.MallGoodsCommentVo;
import cc.mrbird.febs.mall.vo.MallGoodsDetailsVo;
import cc.mrbird.febs.mall.vo.MallGoodsListVo;
import cc.mrbird.febs.mall.vo.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
@@ -84,4 +81,13 @@
        return new FebsResponse().success().data(mallGoodsService.findDeliverySetting());
    }
    @ApiOperation(value = "获取运费模板信息", notes = "获取运费模板信息")
    @ApiResponses({
            @ApiResponse(code = 200, message = "success", response = ApiMallCarriageRuleVo.class)
    })
    @GetMapping(value = "/findMallCarriageRuleById/{id}")
    public FebsResponse findMallCarriageRuleById(@PathVariable("id") Long id) {
        return new FebsResponse().success().data(mallGoodsService.findMallCarriageRuleById(id));
    }
}
src/main/java/cc/mrbird/febs/mall/dto/AddMallGoodsDto.java
@@ -81,5 +81,13 @@
    private Integer hasCarriage;
    private BigDecimal carriage;
    //运费方式  (1:固定运费 2:运费模板)
    private Integer carriageType;
    //运费金额
    private BigDecimal carriageAmount;
    //运费模板ID
    private Long carriageRuleId;
    //重量
    private BigDecimal goodsWeight;
}
src/main/java/cc/mrbird/febs/mall/dto/AddMallGoodsSkuDto.java
@@ -24,5 +24,7 @@
    private String presentPrice;
    private BigDecimal costPrice;
    //重量
    private BigDecimal goodsWeight;
}
src/main/java/cc/mrbird/febs/mall/dto/MailGoodsSkuDto.java
@@ -32,5 +32,7 @@
    private Long goodsId;
    private String delLog;
    //重量
    private BigDecimal goodsWeight;
}
src/main/java/cc/mrbird/febs/mall/dto/MallGoodsUpdateDto.java
@@ -86,4 +86,12 @@
    private Integer hasCarriage;
    private BigDecimal carriage;
    //运费方式  (1:固定运费 2:运费模板)
    private Integer carriageType;
    //运费金额
    private BigDecimal carriageAmount;
    //运费模板ID
    private Long carriageRuleId;
    //重量
    private BigDecimal goodsWeight;
}
src/main/java/cc/mrbird/febs/mall/entity/MallGoods.java
@@ -122,5 +122,7 @@
    private BigDecimal carriageAmount;
    //运费模板ID
    private Long carriageRuleId;
    //重量
    private BigDecimal goodsWeight;
}
src/main/java/cc/mrbird/febs/mall/entity/MallGoodsSku.java
@@ -38,4 +38,6 @@
    @TableField(exist = false)
    private String styleName;
    //重量
    private BigDecimal goodsWeight;
}
src/main/java/cc/mrbird/febs/mall/service/IAdminMallGoodsService.java
@@ -51,4 +51,6 @@
    AdminMallCarriageRuleVo selectCarriageRuleByRuleId(long id);
    FebsResponse carriageRuleUpdate(AdminCarriageRuleUpdateDto adminCarriageRuleUpdateDto);
    List<MallCarriageRule> findAllCarriageRuleTree();
}
src/main/java/cc/mrbird/febs/mall/service/IApiMallGoodsService.java
@@ -3,10 +3,7 @@
import cc.mrbird.febs.mall.dto.ApiMallGoodsCommentDto;
import cc.mrbird.febs.mall.dto.MallGoodsQueryDto;
import cc.mrbird.febs.mall.entity.MallGoods;
import cc.mrbird.febs.mall.vo.ApiMallGoodsDeliveryVo;
import cc.mrbird.febs.mall.vo.MallGoodsCommentVo;
import cc.mrbird.febs.mall.vo.MallGoodsDetailsVo;
import cc.mrbird.febs.mall.vo.MallGoodsListVo;
import cc.mrbird.febs.mall.vo.*;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import org.apache.ibatis.annotations.Param;
@@ -26,4 +23,6 @@
    MallGoodsCommentVo findMallGoodsCommentLevelByGoodsId(Long id);
    List<MallGoodsListVo> findMallGoodsListNoPage(MallGoodsQueryDto queryDto);
    ApiMallCarriageRuleVo findMallCarriageRuleById(Long id);
}
src/main/java/cc/mrbird/febs/mall/service/impl/AdminMallGoodsService.java
@@ -69,6 +69,20 @@
        if (mallGoodsByGoodsNo > 0) {
            return new FebsResponse().fail().message("商品编号不能重复");
        }
        Integer carriageType = addMallGoodsDto.getCarriageType();
        if(1 == carriageType){
            if(ObjectUtil.isEmpty(addMallGoodsDto.getCarriageAmount())
                    || BigDecimal.ZERO.compareTo(addMallGoodsDto.getCarriageAmount()) >= 0){
                return new FebsResponse().fail().message("固定邮费不能小于零");
            }
        }else{
            Long carriageRuleId = addMallGoodsDto.getCarriageRuleId();
            MallCarriageRule mallCarriageRule = mallCarriageRuleMapper.selectById(carriageRuleId);
            if(ObjectUtil.isEmpty(mallCarriageRule)){
                return new FebsResponse().fail().message("邮费模板不能为空");
            }
        }
        // 付费商品
        if (addMallGoodsDto.getGoodsType() != 2) {
@@ -107,6 +121,10 @@
                    if (StrUtil.isEmpty(presentPrice)) {
                        return new FebsResponse().fail().message("商品规格现价不能为空");
                    }
                    BigDecimal goodsWeight = addSku.getGoodsWeight();
                    if(BigDecimal.ZERO.compareTo(goodsWeight) > 0){
                        return new FebsResponse().fail().message("重量不能小于零");
                    }
                }
            }
        }
@@ -114,9 +132,9 @@
        MallGoods mallGoods = MallGoodsConversion.INSTANCE.dtoToEntity(addMallGoodsDto);
        mallGoods.setIsSale(MallGoods.ISSALE_STATUS_DISABLED);
        if (mallGoods.getHasCarriage() == 2) {
            mallGoods.setCarriage(BigDecimal.ZERO);
        }
//        if (mallGoods.getHasCarriage() == 2) {
//            mallGoods.setCarriage(BigDecimal.ZERO);
//        }
        mallGoodsMapper.insert(mallGoods);
        String thumbs = addMallGoodsDto.getThumbs();
@@ -156,6 +174,7 @@
            sku.setSkuVolume(mallGoods.getVolume());
            sku.setStock(mallGoods.getStock());
            sku.setStyleId(style.getId());
            sku.setGoodsWeight(mallGoods.getGoodsWeight());
            mallGoodsSkuMapper.insert(sku);
            return new FebsResponse().success().message("添加成功");
        }
@@ -192,6 +211,7 @@
                mallGoodsSku.setStyleId(mallGoodsStyleSku.getId());
                mallGoodsSku.setCostPrice(addMallGoodsSkuDto.getCostPrice());
                mallGoodsSku.setGoodsId(mallGoods.getId());
                mallGoodsSku.setGoodsWeight(addMallGoodsSkuDto.getGoodsWeight());
                mallGoodsSkuMapper.insert(mallGoodsSku);
            }
        }
@@ -293,6 +313,19 @@
        if (mallGoodsByGoodsNo > 0) {
            return new FebsResponse().fail().message("商品编号不能重复");
        }
        Integer carriageType = mallGoodsUpdateDto.getCarriageType();
        if(1 == carriageType){
            if(ObjectUtil.isEmpty(mallGoodsUpdateDto.getCarriageAmount())
            || BigDecimal.ZERO.compareTo(mallGoodsUpdateDto.getCarriageAmount()) > 0){
                return new FebsResponse().fail().message("固定邮费不能小于零");
            }
        }else{
            Long carriageRuleId = mallGoodsUpdateDto.getCarriageRuleId();
            MallCarriageRule mallCarriageRule = mallCarriageRuleMapper.selectById(carriageRuleId);
            if(ObjectUtil.isEmpty(mallCarriageRule)){
                return new FebsResponse().fail().message("邮费模板不能为空");
            }
        }
        if (mallGoodsUpdateDto.getGoodsType() != 2) {
            Long categoryId = mallGoodsUpdateDto.getCategoryId();
@@ -330,6 +363,10 @@
                    if (presentPrice.compareTo(BigDecimal.ZERO) < 0) {
                        return new FebsResponse().fail().message("商品规格现价不能小于0");
                    }
                    BigDecimal goodsWeight = addSku.getGoodsWeight();
                    if(BigDecimal.ZERO.compareTo(goodsWeight) > 0){
                        return new FebsResponse().fail().message("重量不能小于零");
                    }
                }
            }
@@ -345,9 +382,9 @@
        }
        BeanUtil.copyProperties(mallGoodsUpdateDto, mallGoods);
        if (mallGoods.getHasCarriage() == 2) {
            mallGoods.setCarriage(BigDecimal.ZERO);
        }
//        if (mallGoods.getHasCarriage() == 2) {
//            mallGoods.setCarriage(BigDecimal.ZERO);
//        }
        mallGoodsMapper.updateById(mallGoods);
@@ -389,6 +426,7 @@
            sku.setSkuVolume(mallGoods.getVolume());
            sku.setStock(mallGoods.getStock());
            sku.setStyleId(style.getId());
            sku.setGoodsWeight(mallGoods.getGoodsWeight());
            mallGoodsSkuMapper.insert(sku);
            return new FebsResponse().success().message("添加成功");
        }
@@ -450,6 +488,7 @@
                        mallGoodsSku.setStyleId(addMallGoodsSkuDto.getStyleId());
                        mallGoodsSku.setGoodsId(mallGoods.getId());
                        mallGoodsSku.setCostPrice(addMallGoodsSkuDto.getCostPrice());
                        mallGoodsSku.setGoodsWeight(addMallGoodsSkuDto.getGoodsWeight());
                        mallGoodsSkuMapper.updateById(mallGoodsSku);
                    } else {
                        //新增商品规格
@@ -464,6 +503,7 @@
                        mallGoodsSku.setStyleId(mallGoodsStyleSku.getId());
                        mallGoodsSku.setCostPrice(addMallGoodsSkuDto.getCostPrice());
                        mallGoodsSku.setGoodsId(mallGoods.getId());
                        mallGoodsSku.setGoodsWeight(addMallGoodsSkuDto.getGoodsWeight());
                        mallGoodsSkuMapper.insert(mallGoodsSku);
                    }
                }
@@ -711,4 +751,10 @@
        return new FebsResponse().success().message("操作成功");
    }
    @Override
    public List<MallCarriageRule> findAllCarriageRuleTree() {
        List<MallCarriageRule> mallCarriageRules = mallCarriageRuleMapper.selectList(new QueryWrapper<>());
        return mallCarriageRules;
    }
}
src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallGoodsServiceImpl.java
@@ -7,13 +7,8 @@
import cc.mrbird.febs.mall.conversion.MallMemberConversion;
import cc.mrbird.febs.mall.dto.ApiMallGoodsCommentDto;
import cc.mrbird.febs.mall.dto.MallGoodsQueryDto;
import cc.mrbird.febs.mall.entity.DataDictionaryCustom;
import cc.mrbird.febs.mall.entity.MallGoods;
import cc.mrbird.febs.mall.entity.MallGoodsComment;
import cc.mrbird.febs.mall.mapper.DataDictionaryCustomMapper;
import cc.mrbird.febs.mall.mapper.MallGoodsCommentMapper;
import cc.mrbird.febs.mall.mapper.MallGoodsImagesMapper;
import cc.mrbird.febs.mall.mapper.MallGoodsMapper;
import cc.mrbird.febs.mall.entity.*;
import cc.mrbird.febs.mall.mapper.*;
import cc.mrbird.febs.mall.service.IApiMallGoodsService;
import cc.mrbird.febs.mall.vo.*;
import cn.hutool.core.collection.CollUtil;
@@ -45,6 +40,8 @@
    private final MallGoodsImagesMapper goodsImagesMapper;
    private final MallGoodsCommentMapper mallGoodsCommentMapper;
    private final DataDictionaryCustomMapper dataDictionaryCustomMapper;
    private final MallCarriageRuleMapper mallCarriageRuleMapper;
    private final MallCarriageRuleInfoMapper mallCarriageRuleInfoMapper;
    @Override
@@ -59,6 +56,33 @@
    }
    @Override
    public ApiMallCarriageRuleVo findMallCarriageRuleById(Long id) {
        ApiMallCarriageRuleVo apiMallCarriageRuleVo = new ApiMallCarriageRuleVo();
        MallCarriageRule mallCarriageRule = mallCarriageRuleMapper.selectById(id);
        if(ObjectUtil.isEmpty(mallCarriageRule)){
            throw new FebsException("商品不存在");
        }
        apiMallCarriageRuleVo.setName(mallCarriageRule.getName());
        List<MallCarriageRuleInfo> mallCarriageRuleInfos = mallCarriageRuleInfoMapper.selectMallCarriageRuleInfoByRuleIdAndAreaAddress(id, null);
        if(CollUtil.isNotEmpty(mallCarriageRuleInfos)){
            List<ApiMallCarriageRuleInfoVo> apiMallCarriageRuleInfoVos = new ArrayList<>();
            for(MallCarriageRuleInfo mallCarriageRuleInfo : mallCarriageRuleInfos){
                ApiMallCarriageRuleInfoVo apiMallCarriageRuleInfoVo = new ApiMallCarriageRuleInfoVo();
                apiMallCarriageRuleInfoVo.setAreaAddress(mallCarriageRuleInfo.getAreaAddress());
                apiMallCarriageRuleInfoVo.setBasicPrice(mallCarriageRuleInfo.getBasicPrice());
                apiMallCarriageRuleInfoVo.setBasicCnt(mallCarriageRuleInfo.getBasicCnt());
                apiMallCarriageRuleInfoVo.setMoreCnt(mallCarriageRuleInfo.getMoreCnt());
                apiMallCarriageRuleInfoVo.setMorePrice(mallCarriageRuleInfo.getMorePrice());
                apiMallCarriageRuleInfoVos.add(apiMallCarriageRuleInfoVo);
            }
            apiMallCarriageRuleVo.setApiMallCarriageRuleInfoVos(apiMallCarriageRuleInfoVos);
        }
        return apiMallCarriageRuleVo;
    }
    @Override
    public MallGoodsDetailsVo findMallGoodsDetailsById(Long id) {
        MallGoods mallGoods = this.baseMapper.selectGoodsDetailById(id);
        if (mallGoods == null) {
src/main/java/cc/mrbird/febs/mall/vo/ApiMallCarriageRuleInfoVo.java
New file
@@ -0,0 +1,40 @@
package cc.mrbird.febs.mall.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
@Data
@ApiModel(value = "ApiMallCarriageRuleInfoVo", description = "运费模板详情返回参数类")
public class ApiMallCarriageRuleInfoVo {
    //计价方式(1:按件算 2:按重量算)
    @ApiModelProperty(value = "计价方式(1:按件算 2:按重量算)")
    private Integer valuationType;
    //计价单位(件,KG)
    @ApiModelProperty(value = "计价单位(件,KG)")
    private String valuationUnit;
    //指定区域(没有指定区域,则为默认)
    @ApiModelProperty(value = "指定区域(没有指定区域,则为默认)")
    private String areaAddress;
    //基本数量
    @ApiModelProperty(value = "基本数量")
    private BigDecimal basicCnt;
    //基本价格
    @ApiModelProperty(value = "基本价格")
    private BigDecimal basicPrice;
    //超出的部分的基数数量
    @ApiModelProperty(value = "超出的部分的基数数量")
    private BigDecimal moreCnt;
    //超出的部分的基数的价格
    @ApiModelProperty(value = "超出的部分的基数的价格")
    private BigDecimal morePrice;
}
src/main/java/cc/mrbird/febs/mall/vo/ApiMallCarriageRuleVo.java
New file
@@ -0,0 +1,18 @@
package cc.mrbird.febs.mall.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
@Data
@ApiModel(value = "ApiMallCarriageRuleVo", description = "运费模板返回参数类")
public class ApiMallCarriageRuleVo {
    @ApiModelProperty(value = "名称")
    private String name;
    @ApiModelProperty(value = "运费模板详情")
    private List<ApiMallCarriageRuleInfoVo> apiMallCarriageRuleInfoVos;
}
src/main/resources/templates/febs/views/modules/goods/goodsAddNew.html
@@ -52,6 +52,12 @@
                                                    <input type="text" name="unit"  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="goodsWeight"  lay-verify="required" placeholder="" autocomplete="off" class="layui-input">
                                                </div>
                                            </div>
                                        </div>
                                        <div class="layui-form-item">
                                            <div class="layui-col-lg6">
@@ -190,19 +196,31 @@
                                                <input type="text" name="costPrice" lay-verify="required" placeholder="" autocomplete="off" class="layui-input">
                                            </div>
                                        </div>
                                        <blockquote class="layui-elem-quote blue-border">运费设置</blockquote>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">设置运费:</label>
                                            <label class="layui-form-label">运费:</label>
                                            <div class="layui-input-block">
                                                <input type="radio" name="hasCarriage" value="1" title="开启" lay-filter="hasCarriage" />
                                                <input type="radio" name="hasCarriage" value="2" title="关闭" lay-filter="hasCarriage" checked />
                                                <input type="radio" name="carriageType" value="1" title="固定运费" lay-filter="hasCarriage" />
                                                <input type="radio" name="carriageType" value="2" title="使用邮费模板" lay-filter="hasCarriage" checked/>
                                            </div>
                                        </div>
                                        <div class="layui-form-item carriage-input febs-hide">
                                            <label class="layui-form-label">运费:</label>
                                            <div class="layui-input-block">
                                                <input type="text" name="carriage" placeholder="" autocomplete="off" class="layui-input">
                                        <div class="layui-form-item carriage-input  febs-hide">
                                            <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">
                                                    <div class="layui-form-mid layui-word-aux">远费设置为0元,前台商品将显示为免运费。</div>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="layui-form-item carriage-rule">
                                            <div class="layui-col-lg6">
                                                <label class="layui-form-label febs-form-item-require">邮费模板:</label>
                                                <div class="layui-input-block">
                                                    <div id="carriage-rule"></div>
                                                </div>
                                            </div>
                                        </div>
@@ -352,6 +370,33 @@
            });
        })
        var carriageRule = xmSelect.render({
            el: '#carriage-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/carriageRuleTree', null, function(res) {
            carriageRule.update({
                data : res.data,
                autoRow: true,
            });
        })
        var tableSkuData=[];
        var tableIns = table.render({
            elem: '#multiSku'
@@ -363,6 +408,7 @@
                ,{field: 'index', title: '序号', width:70}
                ,{field: 'styleName', title: '样式', edit:'text'}
                ,{field: 'skuName', title: '规格', edit:'text'}
                ,{field: 'goodsWeight', title: '重量', edit:'text'}
                ,{field: 'presentPrice', title: '现价', edit:'text'}
                ,{field: 'originalPrice', title: '原价', edit:'text'}
                ,{field: 'costPrice', title: '成本价', edit:'text'}
@@ -416,8 +462,12 @@
        form.on('radio(hasCarriage)', function(data){
            if (data.value == 2) {
                $('.carriage-input').hide();
                $('.carriage-rule').show();
                // document.getElementById('carriageAmountDefault').value = 0;
            } else {
                $('.carriage-input').show();
                $('.carriage-rule').hide();
                // document.getElementById('carriageAmountDefault').value = 0;
            }
        });
@@ -597,6 +647,7 @@
            data.field.goodsType = 1;
            data.field.addMallGoodsSkuDtos = tableSkuData;
            data.field.categoryId = category.getValue('valueStr');
            data.field.carriageRuleId = carriageRule.getValue('valueStr');
            data.field.goodsDetails = editor.getHtml();
            $.ajax({
                'url':ctx + 'admin/goods/addMallGoods',
src/main/resources/templates/febs/views/modules/goods/goodsUpdateNew.html
@@ -57,6 +57,12 @@
                                                           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="goodsWeight"  lay-verify="required" placeholder="" autocomplete="off" class="layui-input">
                                                </div>
                                            </div>
                                        </div>
                                        <div class="layui-form-item">
                                            <div class="layui-col-lg6">
@@ -216,18 +222,31 @@
                                            </div>
                                        </div>
                                        <blockquote class="layui-elem-quote blue-border">运费设置</blockquote>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">设置运费:</label>
                                            <label class="layui-form-label">运费:</label>
                                            <div class="layui-input-block">
                                                <input type="radio" name="hasCarriage" value="1" title="开启" lay-filter="hasCarriage" />
                                                <input type="radio" name="hasCarriage" value="2" title="关闭" lay-filter="hasCarriage" checked />
                                                <input type="radio" name="carriageType" value="1" title="固定运费" lay-filter="hasCarriage" />
                                                <input type="radio" name="carriageType" value="2" title="使用邮费模板" lay-filter="hasCarriage" checked/>
                                            </div>
                                        </div>
                                        <div class="layui-form-item carriage-input febs-hide">
                                            <label class="layui-form-label">运费:</label>
                                            <div class="layui-input-block">
                                                <input type="text" name="carriage" placeholder="" autocomplete="off" class="layui-input">
                                        <div class="layui-form-item carriage-input  febs-hide">
                                            <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">
                                                    <div class="layui-form-mid layui-word-aux">远费设置为0元,商品将显示为免运费。</div>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="layui-form-item carriage-rule">
                                            <div class="layui-col-lg6">
                                                <label class="layui-form-label febs-form-item-require">邮费模板:</label>
                                                <div class="layui-input-block">
                                                    <div id="carriage-rule"></div>
                                                </div>
                                            </div>
                                        </div>
@@ -380,6 +399,35 @@
                autoRow: true,
            });
            // initValue();
        })
        var carriageRule = xmSelect.render({
            el: '#carriage-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/carriageRuleTree', null, function(res) {
            carriageRule.update({
                data : res.data,
                autoRow: true,
            });
            initValue();
        })
@@ -394,6 +442,7 @@
                , {field: 'index', title: '序号', width: 70}
                , {field: 'styleName', title: '样式', edit: 'text'}
                , {field: 'skuName', title: '规格', edit: 'text'}
                , {field: 'goodsWeight', title: '重量', edit:'text'}
                , {field: 'presentPrice', title: '现价', edit: 'text'}
                , {field: 'originalPrice', title: '原价', edit: 'text'}
                , {field: 'costPrice', title: '成本价', edit: 'text'}
@@ -455,8 +504,11 @@
        form.on('radio(hasCarriage)', function(data){
            if (data.value == 2) {
                $('.carriage-input').hide();
                $('.carriage-rule').show();
            } else {
                $('.carriage-input').show();
                $('.carriage-rule').hide();
                document.getElementById('carriageAmountDefault').value = 0;
            }
        });
@@ -652,6 +704,9 @@
                "costPrice": goodsInfo.costPrice,
                "isSku": goodsInfo.isSku,
                "thumb": goodsInfo.thumb,
                "carriageType": goodsInfo.carriageType,
                "carriageAmount": goodsInfo.carriageAmount,
                "goodsWeight": goodsInfo.goodsWeight,
                "thumbs": thumbs
            });
@@ -659,8 +714,21 @@
            arr.push(goodsInfo.categoryId)
            category.setValue(arr);
            var arrCarriageRule = [];
            arrCarriageRule.push(goodsInfo.carriageRuleId)
            carriageRule.setValue(arrCarriageRule);
            if (goodsInfo.isNormal == 2) {
                $(".tc-set").show();
            }
            if (goodsInfo.carriageType == 2) {
                $('.carriage-input').hide();
                $('.carriage-rule').show();
            } else {
                $('.carriage-input').show();
                $('.carriage-rule').hide();
                document.getElementById('carriageAmountDefault').value = goodsInfo.carriageAmount;
            }
            if (goodsInfo.isSku == 1) {
@@ -706,6 +774,7 @@
            data.field.mailGoodsSkuDto = tableSkuData;
            data.field.delSkuId=delSku;
            data.field.categoryId = category.getValue('valueStr');
            data.field.carriageRuleId = carriageRule.getValue('valueStr');
            data.field.goodsDetails = editor.getHtml();
            $.ajax({
                'url': ctx + 'admin/goods/updateMallGoods',