xiaoyong931011
2022-06-22 6de066700687dc54f680ef60a5285581d4fb44a1
20220528
6 files modified
100 ■■■■■ changed files
src/main/java/cc/mrbird/febs/mall/controller/AdminMallGoodsController.java 18 ●●●●● 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 22 ●●●●● patch | view | raw | blame | history
src/main/resources/templates/febs/views/modules/goods/goodsAddNew.html 13 ●●●●● patch | view | raw | blame | history
src/main/resources/templates/febs/views/modules/goods/goodsList.html 28 ●●●●● patch | view | raw | blame | history
src/main/resources/templates/febs/views/modules/goods/goodsUpdateNew.html 14 ●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/controller/AdminMallGoodsController.java
@@ -99,6 +99,24 @@
    }
    /**
     * 商品-热卖
     */
    @GetMapping("goodsHot/{id}")
    @ControllerEndpoint(operation = " 商品-热卖", exceptionMessage = "设置失败")
    public FebsResponse goodsHot(@NotNull(message = "{required}") @PathVariable Long id) {
        return adminMallGoodsService.goodsHot(id);
    }
    /**
     * 商品-取消热卖
     */
    @GetMapping("goodsNotHot/{id}")
    @ControllerEndpoint(operation = " 商品-取消热卖", exceptionMessage = "设置失败")
    public FebsResponse goodsNotHot(@NotNull(message = "{required}") @PathVariable Long id) {
        return adminMallGoodsService.goodsNotHot(id);
    }
    /**
     * 商品-上架
     */
    @GetMapping("upMallGoods/{id}")
src/main/java/cc/mrbird/febs/mall/entity/MallGoods.java
@@ -47,6 +47,11 @@
    private Long categoryId;
    /**
     * 是否热卖  1:是  2:否
     */
    public static final Integer ISHOT_STATE_YES = 1;
    public static final Integer ISHOT_STATE_NO = 2;
    private Integer isHot;
    /**
src/main/java/cc/mrbird/febs/mall/service/impl/AdminMallGoodsService.java
@@ -473,5 +473,27 @@
        return mallGoodsMapper.getAllGoodsTree();
    }
    @Override
    public FebsResponse goodsHot(Long id) {
        MallGoods mallGoods = mallGoodsMapper.selectById(id);
        if (ObjectUtil.isEmpty(mallGoods)) {
            return new FebsResponse().fail().message("商品不存在,请刷新当前页面");
        }
        mallGoods.setIsHot(MallGoods.ISHOT_STATE_YES);
        mallGoodsMapper.updateById(mallGoods);
        return new FebsResponse().success();
    }
    @Override
    public FebsResponse goodsNotHot(Long id) {
        MallGoods mallGoods = mallGoodsMapper.selectById(id);
        if (ObjectUtil.isEmpty(mallGoods)) {
            return new FebsResponse().fail().message("商品不存在,请刷新当前页面");
        }
        mallGoods.setIsHot(MallGoods.ISHOT_STATE_NO);
        mallGoodsMapper.updateById(mallGoods);
        return new FebsResponse().success();
    }
}
src/main/resources/templates/febs/views/modules/goods/goodsAddNew.html
@@ -28,16 +28,21 @@
                                                </div>
                                            </div>
                                        </div>
                                        <div class="layui-row layui-col-space10 layui-form-item">
                                        <div class="layui-form-item">
                                            <div class="layui-col-lg6">
                                                <label class="layui-form-label febs-form-item-require">商品分类:</label>
                                                <div class="layui-input-block">
<!--                                                    <select name="categoryId" class="categary-addPeoduct" >-->
<!--                                                        <option value="">请选择</option>-->
<!--                                                    </select>-->
                                                    <div id="goods-category"></div>
                                                </div>
                                            </div>
                                            <div class="layui-col-lg6">
                                                <label class="layui-form-label">是否主推:</label>
                                                <div class="layui-input-block">
                                                    <input type="radio" name="isHot" value="1" title="是" />
                                                    <input type="radio" name="isHot" value="2" title="否" checked />
                                                </div>
                                            </div>
                                        </div>
                                        <div class="layui-form-item">
src/main/resources/templates/febs/views/modules/goods/goodsList.html
@@ -60,6 +60,13 @@
    <input type="checkbox" value={{d.id}} lay-text="上架|下架" lay-skin="switch" lay-filter="upOrDownSwitch">
    {{# } }}
</script>
<script type="text/html" id="isHotSwitch">
    {{# if(d.isHot === 1) { }}
    <input type="checkbox" value={{d.id}} lay-text="是|否" checked lay-skin="switch" lay-filter="isHotSwitch">
    {{# } else { }}
    <input type="checkbox" value={{d.id}} lay-text="是|否" lay-skin="switch" lay-filter="isHotSwitch">
    {{# } }}
</script>
<script type="text/html" id="isSkuFormat">
    {{# if(d.isSku === 1) { }}
        <span>是</span>
@@ -170,6 +177,18 @@
                $query.click();
            });
        }
        function goodsHot(id) {
            febs.get(ctx + 'admin/goods/goodsHot/' + id, null, function () {
                febs.alert.success('设置成功');
                $query.click();
            });
        }
        function goodsNotHot(id) {
            febs.get(ctx + 'admin/goods/goodsNotHot/' + id, null, function () {
                febs.alert.success('设置成功');
                $query.click();
            });
        }
        // 查询按钮
        $query.on('click', function () {
@@ -211,6 +230,7 @@
                        }, minWidth: 150,align:'center'},
                    {field: 'categaryName', title: '分类', minWidth: 150,align:'left'},
                    {field: 'isSale', title: '是否上架', templet: '#upOrDownSwitch', minWidth: 130,align:'center'},
                    {field: 'isHot', title: '是否主推', templet: '#isHotSwitch', minWidth: 130,align:'center'},
                    {templet:"#goodsTypeFormat",  title: '商品类型', minWidth: 150,align:'left'},
                    {templet:"#isSkuFormat", title: '是否多规格', minWidth: 150,align:'left'},
                    {field: 'presentPrice', title: '现价', minWidth: 150,align:'left'},
@@ -243,6 +263,14 @@
            }
        })
        form.on('switch(isHotSwitch)', function (data) {
            if (data.elem.checked) {
                goodsHot(data.value);
            } else {
                goodsNotHot(data.value);
            }
        })
        // 获取查询参数
        function getQueryParams() {
            return {
src/main/resources/templates/febs/views/modules/goods/goodsUpdateNew.html
@@ -32,14 +32,19 @@
                                                </div>
                                            </div>
                                        </div>
                                        <div class="layui-row layui-col-space10 layui-form-item">
                                        <div class="layui-form-item">
                                            <div class="layui-col-lg6">
                                                <label class="layui-form-label febs-form-item-require">商品分类:</label>
                                                <div class="layui-input-block">
<!--                                                    <select name="categoryId" class="categary-addPeoduct">-->
<!--                                                        <option value="">请选择</option>-->
<!--                                                    </select>-->
                                                    <div id="goods-category"></div>
                                                </div>
                                            </div>
                                            <div class="layui-col-lg6">
                                                <label class="layui-form-label">是否主推:</label>
                                                <div class="layui-input-block">
                                                    <input type="radio" name="isHot" value="1" title="是"  />
                                                    <input type="radio" name="isHot" value="2" title="否"  checked />
                                                </div>
                                            </div>
                                        </div>
@@ -636,6 +641,7 @@
                "unit": goodsInfo.unit,
                "stock": goodsInfo.stock,
                "volume": goodsInfo.volume,
                "isHot": goodsInfo.isHot,
                "goodsParameter": goodsInfo.goodsParameter,
                "goodsIntrodution": goodsInfo.goodsIntrodution,
                "isNormal": goodsInfo.isNormal,