后台增加商品类目可以配置服务类目

This commit is contained in:
cb 2025-06-18 15:33:49 +08:00
parent d3dcb97911
commit 7afe847942
5 changed files with 70 additions and 4 deletions

View File

@ -181,6 +181,25 @@ public class GoodsCategoryController extends BaseController {
return goodsCategoryService.selectCategoryTree(new GoodsCategory());
}
/**
* 选择服务类目树
*/
@GetMapping("/selectServiceCategoryTree")
public String selectServiceCategoryTree(ModelMap mmap) {
return PREFIX + "/serviceTree";
}
/**
* 获取服务类目树数据
*/
@GetMapping("/serviceTreeData")
@ResponseBody
public List<Ztree> serviceTreeData() {
GoodsCategory category = new GoodsCategory();
category.setType(1); // 1表示服务类
return goodsCategoryService.selectCategoryTree(category);
}
/**
* 商品类别表
*/

View File

@ -145,9 +145,7 @@
formatter: function (value, row, index) {
if (row.parentId !== 0) {
var actions = [];
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.editTab(\'' + row.deptGoodsCategoryId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
// actions.push('<a class="btn btn-info btn-xs ' + addFlag + '" href="javascript:void(0)" onclick="$.operate.add(\'' + row.deptGoodsCategoryId + '\')"><i class="fa fa-plus"></i>新增</a> ');
// actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="remove(\'' + row.deptGoodsCategoryId + '\')"><i class="fa fa-trash"></i>删除</a>');
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.deptGoodsCategoryId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
return actions.join('');
} else {
return "";

View File

@ -11,6 +11,7 @@
<div class="main-content">
<form class="form-horizontal" id="form-deptGoodsCategory-edit" th:object="${deptGoodsCategory}">
<input id="deptGoodsCategoryId" name="deptGoodsCategoryId" type="hidden" th:field="*{deptGoodsCategoryId}"/>
<input id="type" name="type" type="hidden" th:field="*{type}"/>
<div class="row">
<div class="col-sm-6">
@ -23,6 +24,19 @@
</div>
</div>
</div>
<div class="col-sm-6" th:if="*{type != 1}">
<div class="form-group">
<label class="col-sm-6 control-label">服务类目:</label>
<div class="col-sm-6">
<div class="input-group">
<input class="form-control" type="text" onclick="selectServiceCategoryTree()" id="treeName" readonly="true" th:value="*{serviceCategoryName}">
<input type="hidden" id="treeId" name="serviceCategoryId" th:value="*{serviceCategoryId}">
<input type="hidden" id="serviceCategoryName" name="serviceCategoryName" th:value="*{serviceCategoryName}">
<span class="input-group-addon"><i class="fa fa-search"></i></span>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-6">
@ -375,6 +389,26 @@
}
});
/*选择服务类目树*/
function selectServiceCategoryTree() {
var treeId = $("#treeId").val();
var options = {
title: '服务类目选择',
width: "380",
url: ctx + "goods/category/selectServiceCategoryTree",
callBack: doSubmit
};
$.modal.openOptions(options);
}
function doSubmit(index, layero) {
var body = $.modal.getChildFrame(index);
$("#treeId").val(body.find('#treeId').val());
$("#treeName").val(body.find('#treeName').val());
$("#serviceCategoryName").val(body.find('#treeName').val());
$.modal.close(index);
}
</script>
</body>
</html>

View File

@ -108,4 +108,10 @@ public class DeptGoodsCategory extends GoodsCategory {
private Long customerId;
private Integer isSetting;
@Excel(name = "服务类目ID", cellType = Excel.ColumnType.NUMERIC)
private Long serviceCategoryId; // 服务类目ID
@Excel(name = "服务类目名称", cellType = Excel.ColumnType.STRING)
private String serviceCategoryName; // 服务类目名称
}

View File

@ -23,6 +23,8 @@
<result property="deptMoney" column="dept_money"/>
<result property="retainRate" column="retain_rate"/>
<result property="retainMoney" column="retain_money"/>
<result property="serviceCategoryId" column="service_category_id"/>
<result property="serviceCategoryName" column="service_category_name"/>
<!-- pc扣点部分 start-->
<result property="pcOneRate" column="pc_one_rate"/>
<result property="pcTwoRate" column="pc_two_rate"/>
@ -45,7 +47,7 @@
SELECT dept_goods_category_id, dept_id, goods_category_id, category_sort, is_hot, cover, hot_name,
simple_goods_category_name, is_sure, is_cert, one_rate, two_rate, three_rate, dept_rate,
pc_one_rate, pc_two_rate, pc_three_rate, pc_dept_rate, pc_dept_money, pc_retain_rate, pc_retain_money,
dept_money, retain_rate, retain_money, create_by, create_time, remark
dept_money, retain_rate, retain_money, create_by, create_time, remark, service_category_id, service_category_name
FROM dept_goods_category
</sql>
@ -55,6 +57,7 @@
dgc.is_hot, dgc.cover, dgc.hot_name, dgc.is_sure, dgc.is_cert, dgc.dept_rate, dgc.dept_money,
dgc.retain_rate, dgc.retain_money, dgc.simple_goods_category_name,
dgc.pc_one_rate, dgc.pc_two_rate, dgc.pc_three_rate, dgc.pc_dept_rate, dgc.pc_dept_money, dgc.pc_retain_rate, dgc.pc_retain_money,
dgc.service_category_id, dgc.service_category_name,
gc.goods_category_name, gc.level, gc.parent_category_id, gc.type, gc.status
FROM dept_goods_category dgc LEFT JOIN goods_category gc ON dgc.goods_category_id = gc.goods_category_id
</sql>
@ -92,6 +95,8 @@
<if test="deptMoney != null">dept_money = #{deptMoney},</if>
<if test="retainRate != null and retainRate != ''">retain_rate = #{retainRate},</if>
<if test="retainMoney != null">retain_money = #{retainMoney},</if>
<if test="serviceCategoryId != null">service_category_id = #{serviceCategoryId},</if>
<if test="serviceCategoryName != null and serviceCategoryName != ''">service_category_name = #{serviceCategoryName},</if>
<if test="pcDeptRate != null and pcDeptRate != ''">pc_dept_rate = #{pcDeptRate},</if>
<if test="pcDeptMoney != null">pc_dept_money = #{pcDeptMoney},</if>
@ -133,6 +138,8 @@
<if test="deptMoney != null and deptMoney != ''">dept_money,</if>
<if test="retainRate != null and retainRate != ''">retain_rate,</if>
<if test="retainMoney != null and retainMoney != ''">retain_money,</if>
<if test="serviceCategoryId != null">service_category_id,</if>
<if test="serviceCategoryName != null and serviceCategoryName != ''">service_category_name,</if>
<if test="pcDeptRate != null and pcDeptRate != ''">pc_dept_rate,</if>
<if test="pcDeptMoney != null and pcDeptMoney != ''">pc_dept_money,</if>
@ -158,6 +165,8 @@
<if test="deptMoney != null and deptMoney != ''">#{deptMoney},</if>
<if test="retainRate != null and retainRate != ''">#{retainRate},</if>
<if test="retainMoney != null and retainMoney != ''">#{retainMoney},</if>
<if test="serviceCategoryId != null">#{serviceCategoryId},</if>
<if test="serviceCategoryName != null and serviceCategoryName != ''">#{serviceCategoryName},</if>
<if test="pcDeptRate != null and pcDeptRate != ''">#{pcDeptRate},</if>
<if test="pcDeptMoney != null and pcDeptMoney != ''">#{pcDeptMoney},</if>