Administrator
2025-05-22 9bb4c9aeeb6165c08e6be165640f177f2c193627
feat(mall): 添加微信小店功能

- 在商品添加和编辑页面增加微信小店相关字段
- 实现微信小店商品的展示和跳转逻辑
- 添加微信小店相关的数据结构和接口定义
10 files modified
118 ■■■■ changed files
src/main/java/cc/mrbird/febs/mall/dto/AddMallGoodsDto.java 4 ●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/dto/MallGoodsUpdateDto.java 4 ●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/entity/MallGoods.java 5 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/service/impl/AdminMallGoodsService.java 14 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/vo/MallGoodsDetailsVo.java 8 ●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/vo/MallGoodsListVo.java 6 ●●●●● patch | view | raw | blame | history
src/main/resources/mapper/modules/MallGoodsMapper.xml 4 ●●●● patch | view | raw | blame | history
src/main/resources/templates/febs/views/modules/goods/goodsAddNew.html 46 ●●●●● patch | view | raw | blame | history
src/main/resources/templates/febs/views/modules/goods/goodsList.html 4 ●●● patch | view | raw | blame | history
src/main/resources/templates/febs/views/modules/goods/goodsUpdateNew.html 23 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/dto/AddMallGoodsDto.java
@@ -10,6 +10,10 @@
@ApiModel(value = "AddMallGoodsDto", description = "参数接收类")
public class AddMallGoodsDto {
    private String storeAppId;
    private String storeGoodsId;
    private String goodsNo;
    private String goodsName;
src/main/java/cc/mrbird/febs/mall/dto/MallGoodsUpdateDto.java
@@ -11,6 +11,10 @@
@ApiModel(value = "MallGoodsUpdateDto", description = "参数接收类")
public class MallGoodsUpdateDto {
    private String storeAppId;
    private String storeGoodsId;
    private Long id;
    private String goodsNo;
src/main/java/cc/mrbird/febs/mall/entity/MallGoods.java
@@ -16,6 +16,11 @@
@TableName("mall_goods")
public class MallGoods extends BaseEntity {
    private String storeAppId;
    private String storeGoodsId;
    private String goodsNo;
    private String goodsName;
src/main/java/cc/mrbird/febs/mall/service/impl/AdminMallGoodsService.java
@@ -73,6 +73,12 @@
            return new FebsResponse().fail().message("商品编号不能重复");
        }
        Integer carriageType = addMallGoodsDto.getCarriageType();
        if (addMallGoodsDto.getIsNormal() == 3) {
            String storeAppId = addMallGoodsDto.getStoreAppId();
            if (ObjectUtil.isEmpty(storeAppId)) {
                return new FebsResponse().fail().message("微信小店APP_ID不能为空");
            }
        }
        if (addMallGoodsDto.getGoodsType() == 1) {
            if (1 == carriageType) {
                if (ObjectUtil.isEmpty(addMallGoodsDto.getCarriageAmount())
@@ -370,6 +376,14 @@
            }
        }
        if (mallGoodsUpdateDto.getIsNormal() == 3) {
            String storeAppId = mallGoodsUpdateDto.getStoreAppId();
            if (ObjectUtil.isEmpty(storeAppId)) {
                return new FebsResponse().fail().message("微信小店APP_ID不能为空");
            }
        }
        if (mallGoodsUpdateDto.getGoodsType() != 2) {
            Long categoryId = mallGoodsUpdateDto.getCategoryId();
            if (ObjectUtil.isEmpty(categoryId)) {
src/main/java/cc/mrbird/febs/mall/vo/MallGoodsDetailsVo.java
@@ -18,6 +18,12 @@
    @ApiModelProperty(value = "id")
    private Long id;
    @ApiModelProperty(value = "小店APP_ID")
    private String storeAppId;
    @ApiModelProperty(value = "小店商品ID")
    private String storeGoodsId;
    @ApiModelProperty(value = "商品主图")
    private String thumb;
@@ -66,7 +72,7 @@
    @ApiModelProperty(value = "运费")
    private BigDecimal carriage;
    @ApiModelProperty(value = "1-普通商品 2-套餐")
    @ApiModelProperty(value = "1-普通商品 2-套餐 3-微信小店")
    private Integer isNormal;
    @ApiModelProperty(value = "轮播图")
src/main/java/cc/mrbird/febs/mall/vo/MallGoodsListVo.java
@@ -17,6 +17,12 @@
    @ApiModelProperty(value = "id")
    private Long id;
    @ApiModelProperty(value = "小店APP_ID")
    private String storeAppId;
    @ApiModelProperty(value = "小店商品ID")
    private String storeGoodsId;
    @ApiModelProperty(value = "规格ID")
    private Long skuId;
src/main/resources/mapper/modules/MallGoodsMapper.xml
@@ -5,6 +5,8 @@
    <resultMap id="MallGoodsMap" type="cc.mrbird.febs.mall.entity.MallGoods">
        <id property="id" column="id" />
        <result property="goodsNo" column="goods_no" />
        <result property="storeAppId" column="store_app_id" />
        <result property="storeGoodsId" column="store_goods_id" />
        <result property="goodsName" column="goods_name" />
        <result property="goodsIntrodution" column="goods_introdution" />
        <result property="unit" column="unit" />
@@ -342,6 +344,8 @@
        select
        a.id,
        a.goods_name,
        a.store_app_id,
        a.store_goods_id,
        a.goods_introdution goodsIntroduction,
        a.thumb,
        a.unit,
src/main/resources/templates/febs/views/modules/goods/goodsAddNew.html
@@ -98,7 +98,7 @@
                                            <div class="layui-input-block">
                                                <select name="isNormal" class="goods-type" lay-filter="goods-type-select">
                                                    <option value="1">普通商品区</option>
<!--                                                    <option value="2">套餐区</option>-->
                                                    <option value="3">微信小店</option>
                                                </select>
                                            </div>
                                        </div>
@@ -110,15 +110,23 @@
<!--                                            </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">折扣积分=售价*积分折扣(%)*积分换算比例</div>-->
<!--                                                <div class="layui-form-mid layui-word-aux">不允许使用积分设置成:0%</div>-->
<!--                                                <div class="layui-form-mid layui-word-aux">全部使用积分设置成:大于等于100%</div>-->
<!--                                            </div>-->
<!--                                        </div>-->
                                        <blockquote class="layui-elem-quote blue-border febs-hide tc-set">微信小店设置</blockquote>
                                        <div class="layui-form-item febs-hide tc-set">
                                            <div class="layui-col-lg6">
                                                <label class="layui-form-label">APP_ID:</label>
                                                <div class="layui-input-block">
                                                    <input type="text" name="storeAppId" placeholder="请输入" autocomplete="off" class="layui-input">
                                                </div>
                                            </div>
                                            <div class="layui-col-lg6">
                                                <label class="layui-form-label">商品ID:</label>
                                                <div class="layui-input-block">
                                                    <input type="text" name="storeGoodsId" placeholder="请输入" autocomplete="off" class="layui-input">
                                                    <div class="layui-form-mid layui-word-aux">不填写商品ID,则跳转到微信小店首页。</div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="layui-tab-item">
@@ -826,14 +834,14 @@
            return false;
        });
        // form.on('select(goods-type-select)', function(data){
        //     $('.tc-set').each(function() {
        //         if (data.value == 2) {
        //             $(this).show();
        //         } else {
        //             $(this).hide();
        //         }
        //     })
        // });
        form.on('select(goods-type-select)', function(data){
            $('.tc-set').each(function() {
                if (data.value == 3) {
                    $(this).show();
                } else {
                    $(this).hide();
                }
            })
        });
    });
</script>
src/main/resources/templates/febs/views/modules/goods/goodsList.html
@@ -82,8 +82,10 @@
<script type="text/html" id="goodsTypeFormat">
    {{# if(d.isNormal == 1) { }}
        <span>普通商品</span>
    {{# }else if(d.isNormal == 3) { }}
        <span>微信小店</span>
    {{# } else { }}
        <span>套餐</span>
        <span>普通商品</span>
    {{# } }}
</script>
<style>
src/main/resources/templates/febs/views/modules/goods/goodsUpdateNew.html
@@ -107,8 +107,25 @@
                                                <select name="isNormal" class="goods-type"
                                                        lay-filter="goods-type-select">
                                                    <option value="1">普通商品区</option>
                                                    <option value="3">微信小店</option>
<!--                                                    <option value="2">套餐区</option>-->
                                                </select>
                                            </div>
                                        </div>
                                        <blockquote class="layui-elem-quote blue-border febs-hide tc-set">微信小店设置</blockquote>
                                        <div class="layui-form-item febs-hide tc-set">
                                            <div class="layui-col-lg6">
                                                <label class="layui-form-label">APP_ID:</label>
                                                <div class="layui-input-block">
                                                    <input type="text" name="storeAppId" placeholder="请输入" autocomplete="off" class="layui-input">
                                                </div>
                                            </div>
                                            <div class="layui-col-lg6">
                                                <label class="layui-form-label">商品ID:</label>
                                                <div class="layui-input-block">
                                                    <input type="text" name="storeGoodsId" placeholder="请输入" autocomplete="off" class="layui-input">
                                                    <div class="layui-form-mid layui-word-aux">不填写商品ID,则跳转到微信小店首页。</div>
                                                </div>
                                            </div>
                                        </div>
@@ -849,6 +866,8 @@
            var thumbs = images.join(",");
            form.val("goods-update-form", {
                "id": goodsInfo.id,
                "storeAppId": goodsInfo.storeAppId,
                "storeGoodsId": goodsInfo.storeGoodsId,
                "goodsName": goodsInfo.goodsName,
                "goodsNo": goodsInfo.goodsNo,
                "unit": goodsInfo.unit,
@@ -886,7 +905,7 @@
            couponRule.setValue(goodsInfo.couponIds);
            if (goodsInfo.isNormal == 2) {
            if (goodsInfo.isNormal == 3) {
                $(".tc-set").show();
            }
@@ -981,7 +1000,7 @@
        form.on('select(goods-type-select)', function (data) {
            $('.tc-set').each(function () {
                if (data.value == 2) {
                if (data.value == 3) {
                    $(this).show();
                } else {
                    $(this).hide();