| | |
| | | } |
| | | |
| | | /** |
| | | * 商品-热卖 |
| | | */ |
| | | @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}") |
| | |
| | | |
| | | private Long categoryId; |
| | | |
| | | /** |
| | | * 是否热卖 1:是 2:否 |
| | | */ |
| | | public static final Integer ISHOT_STATE_YES = 1; |
| | | public static final Integer ISHOT_STATE_NO = 2; |
| | | private Integer isHot; |
| | | |
| | | /** |
| | |
| | | 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(); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | </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"> |
| | |
| | | <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> |
| | |
| | | $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 () { |
| | |
| | | }, 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'}, |
| | |
| | | } |
| | | }) |
| | | |
| | | form.on('switch(isHotSwitch)', function (data) { |
| | | if (data.elem.checked) { |
| | | goodsHot(data.value); |
| | | } else { |
| | | goodsNotHot(data.value); |
| | | } |
| | | }) |
| | | |
| | | // 获取查询参数 |
| | | function getQueryParams() { |
| | | return { |
| | |
| | | </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> |
| | |
| | | "unit": goodsInfo.unit, |
| | | "stock": goodsInfo.stock, |
| | | "volume": goodsInfo.volume, |
| | | "isHot": goodsInfo.isHot, |
| | | "goodsParameter": goodsInfo.goodsParameter, |
| | | "goodsIntrodution": goodsInfo.goodsIntrodution, |
| | | "isNormal": goodsInfo.isNormal, |