From ccbd86bc5f747b748b5bde257a789d748b8cefbb Mon Sep 17 00:00:00 2001
From: Administrator <15274802129@163.com>
Date: Thu, 11 Sep 2025 17:41:35 +0800
Subject: [PATCH] ``` refactor(service): 在设置活动类别名称前增加非空检查在AdminHappyActivityServiceImpl.java中,对happyActivity的categoryId进行了非空检查,并且确认categoryMap中包含该categoryId后,再设置其categoryName。这样可以避免因为空值或不存在的键导致的潜在异常。 ```
---
src/main/resources/templates/febs/views/modules/leader/leaderList.html | 145 +++++++++++++++++++++++++++++++++++++++++-------
1 files changed, 124 insertions(+), 21 deletions(-)
diff --git a/src/main/resources/templates/febs/views/modules/leader/leaderList.html b/src/main/resources/templates/febs/views/modules/leader/leaderList.html
index 715d263..577c563 100644
--- a/src/main/resources/templates/febs/views/modules/leader/leaderList.html
+++ b/src/main/resources/templates/febs/views/modules/leader/leaderList.html
@@ -1,4 +1,4 @@
-<div class="layui-fluid layui-anim febs-anim" id="febs-leader" lay-title="团长列表">
+<div class="layui-fluid layui-anim febs-anim" id="febs-leader" lay-title="自提点列表">
<div class="layui-row febs-container">
<div class="layui-col-md12">
<div class="layui-card">
@@ -8,6 +8,7 @@
<div class="layui-col-md10">
<div class="layui-form-item">
<div class="layui-inline">
+ <label class="layui-form-label layui-form-label-sm">名称</label>
<div class="layui-input-inline">
<input type="text" placeholder="名称" name="name" autocomplete="off" class="layui-input">
</div>
@@ -62,6 +63,25 @@
<a lay-event="edit" shiro:hasPermission="user:update"><i
class="layui-icon febs-edit-area febs-blue"></i></a>
</script>
+<script type="text/html" id="onlineStateSwitch">
+ {{# if(d.onlineState === 1) { }}
+ <input type="checkbox" value={{d.id}} lay-text="在线|离线" checked lay-skin="switch" lay-filter="onlineStateSwitch">
+ {{# } else { }}
+ <input type="checkbox" value={{d.id}} lay-text="在线|离线" lay-skin="switch" lay-filter="onlineStateSwitch">
+ {{# } }}
+</script>
+<script type="text/html" id="profitSwitch">
+ {{# if(d.profitSwitch === 1) { }}
+ <input type="checkbox" value={{d.id}} lay-text="开启|关闭" checked lay-skin="switch" lay-filter="profitSwitch">
+ {{# } else { }}
+ <input type="checkbox" value={{d.id}} lay-text="开启|关闭" lay-skin="switch" lay-filter="profitSwitch">
+ {{# } }}
+</script>
+<script type="text/html" id="leaderToolbar">
+ <div class="layui-btn-container">
+ <button class="layui-btn layui-btn-normal layui-btn-xs" type="button" shiro:hasPermission="addLeader:add" lay-event="leaderAdd">新增自提点</button>
+ </div>
+</script>
<!-- 表格操作栏 end -->
<script data-th-inline="none" type="text/javascript">
// 引入组件并初始化
@@ -80,7 +100,7 @@
form.render();
// 表格初始化
- initTable();
+ initLeaderTable();
// 初始化表格操作栏各个按钮功能
table.on('tool(leaderTable)', function (obj) {
@@ -110,8 +130,20 @@
}
});
}
+ if (layEvent === 'fenceAdd') {
+ febs.modal.open('设置配送范围', 'modules/leader/fenceAdd/' + data.id, {
+ btn: ['提交', '取消'],
+ area:['100%','100%'],
+ yes: function (index, layero) {
+ $('#user-addLeaderFence').find('#submit').trigger('click');
+ },
+ btn2: function () {
+ layer.closeAll();
+ }
+ });
+ }
if (layEvent === 'leaderCancel') {
- febs.modal.confirm('取消', '确认取消该团长?', function () {
+ febs.modal.confirm('拉黑', '团长被拉黑,将无法再次申请团长', function () {
leaderCancel(data.id);
});
}
@@ -130,6 +162,25 @@
content: '<div style="text-align:center"><img src="' + $(t).attr('src') + '" /></div>'
});
}
+ });
+
+ table.on('toolbar(leaderTable)', function(obj){
+ var data = obj.data,
+ layEvent = obj.event;
+
+ if (layEvent === 'leaderAdd') {
+ febs.modal.open( '新增', 'modules/leader/addLeader/', {
+ btn: ['提交', '取消'],
+ area:['100%','100%'],
+ yes: function (index, layero) {
+ $('#user-addLeader').find('#submit').trigger('click');
+ },
+ btn2: function () {
+ layer.closeAll();
+ }
+ });
+ }
+
});
function leaderCancel(id) {
@@ -153,18 +204,43 @@
});
- function initTable() {
+ function initLeaderTable() {
tableIns = febs.table.init({
elem: $view.find('table'),
id: 'leaderTable',
url: ctx + 'admin/leader/leaderList',
+ toolbar:"#leaderToolbar",
+ defaultToolbar:[],
cols: [[
+ {type: 'numbers', title: '', width: 80},
+ {title: '操作',
+ templet: function (d) {
+ if (d.state === 3) {
+ return ''
+ + '<button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="leaderUpdate" shiro:hasPermission="user:update">审核</button>'
+ }else if(d.state === 1) {
+ return ''
+ + '<button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="leaderUpdate" shiro:hasPermission="user:update">修改</button>'
+ // + '<button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="fenceAdd" shiro:hasPermission="user:update">设置配送范围</button>'
+ // + '<button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="leaderCancel" shiro:hasPermission="user:update">拉黑</button>'
+ // + '<button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="leaderGoodsUpdate" shiro:hasPermission="user:update">团长商品设置</button>'
+ }else{
+ return '';
+ }
+ },minWidth: 200,align:'center'},
+ {field: 'onlineState', title: '在线状态', templet: '#onlineStateSwitch', minWidth: 100,align:'center'},
{field: 'name', title: '姓名', minWidth: 150,align:'left'},
{field: 'phone', title: '电话', minWidth: 150,align:'left'},
{field: 'addressPic', title: '自提点照片',
templet: function (d) {
return '<a lay-event="seeImgThumb"><img id="seeImgThumb'+d.id+'" src="'+d.addressPic+'" alt=""></a>';
}, minWidth: 150,align:'center'},
+ {field: 'addressArea', title: '自提点名称', minWidth: 150,align:'left'},
+ {field: 'detailAddress', title: '自提点地址', minWidth: 150,align:'left'},
+ // {field: 'totalProfit', title: '收益', minWidth: 150,align:'left'},
+ // {field: 'profitSwitch', title: '是否返利', templet: '#profitSwitch', minWidth: 100,align:'center'},
+ // {field: 'bonusPercent', title: '返利比例', minWidth: 150,align:'left'},
+ // {field: 'phone', title: '电话', minWidth: 150,align:'left'},
{field: 'state', title: '状态',
templet: function (d) {
if (d.state === 1) {
@@ -174,36 +250,63 @@
}else if (d.state === 3) {
return '<span style="color:blue;">待审核</span>'
}else if (d.state === 4) {
- return '<span style="color:blue;">已取消</span>'
+ return '<span style="color:blue;">已取消资格</span>'
}else{
return ''
}
}, minWidth: 80,align:'center'},
- {title: '操作',
- templet: function (d) {
- if (d.state === 3) {
- return ''
- + '<button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="leaderUpdate" shiro:hasPermission="user:update">审核</button>'
- }else if(d.state === 1) {
- return ''
- + '<button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="leaderCancel" shiro:hasPermission="user:update">取消</button>'
- // + '<button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="leaderGoodsUpdate" shiro:hasPermission="user:update">团长商品设置</button>'
- }else{
- return '';
- }
- },minWidth: 160,align:'center'}
]]
});
}
- form.on('switch(startOrCloseSwitch)', function (data) {
+
+
+ form.on('switch(onlineStateSwitch)', function (data) {
if (data.elem.checked) {
- startAct(data.value);
+ startOnline(data.value);
} else {
- closeAct(data.value);
+ closeOnline(data.value);
}
+ $query.click();
})
+ function startOnline(id) {
+ febs.get(ctx + 'admin/leader/startOnline/' + id, null, function () {
+ febs.alert.success('在线成功');
+ $query.click();
+ });
+ }
+
+ function closeOnline(id) {
+ febs.get(ctx + 'admin/leader/closeOnline/' + id, null, function () {
+ febs.alert.success('离线成功');
+ $query.click();
+ });
+ }
+
+ form.on('switch(profitSwitch)', function (data) {
+ if (data.elem.checked) {
+ startProfit(data.value);
+ } else {
+ closeProfit(data.value);
+ }
+ $query.click();
+ })
+
+ function startProfit(id) {
+ febs.get(ctx + 'admin/leader/startProfit/' + id, null, function () {
+ febs.alert.success('开启成功');
+ $query.click();
+ });
+ }
+
+ function closeProfit(id) {
+ febs.get(ctx + 'admin/leader/closeProfit/' + id, null, function () {
+ febs.alert.success('关闭成功');
+ $query.click();
+ });
+ }
+
// 获取查询参数
function getQueryParams() {
return {
--
Gitblit v1.9.1