This commit is contained in:
zpc 2025-09-03 03:35:41 +08:00
parent 612359f92a
commit 9e31244b9d
3 changed files with 187 additions and 78 deletions

View File

@ -9,6 +9,7 @@
***********************************************************************/ ***********************************************************************/
using SqlSugar; using SqlSugar;
using System.ComponentModel; using System.ComponentModel;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
@ -25,92 +26,111 @@ namespace CoreCms.Net.Model.Entities
public SQReservationParticipants() public SQReservationParticipants()
{ {
} }
/// <summary> /// <summary>
/// 参与记录ID /// 参与记录ID
/// </summary> /// </summary>
[Display(Name = "参与记录ID")] [Display(Name = "参与记录ID")]
[SugarColumn(IsPrimaryKey = true, IsIdentity = true)] [SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
[Required(ErrorMessage = "请输入{0}")] [Required(ErrorMessage = "请输入{0}")]
public System.Int32 id { get; set; } public System.Int32 id { get; set; }
/// <summary> /// <summary>
/// 预约ID /// 预约ID
/// </summary> /// </summary>
[Display(Name = "预约ID")] [Display(Name = "预约ID")]
[Required(ErrorMessage = "请输入{0}")] [Required(ErrorMessage = "请输入{0}")]
public System.Int32 reservation_id { get; set; } public System.Int32 reservation_id { get; set; }
/// <summary> /// <summary>
/// 参与者ID关联用户表暂时占位 /// 参与者ID关联用户表暂时占位
/// </summary> /// </summary>
[Display(Name = "参与者ID关联用户表暂时占位")] [Display(Name = "参与者ID关联用户表暂时占位")]
[Required(ErrorMessage = "请输入{0}")] [Required(ErrorMessage = "请输入{0}")]
public System.Int32 user_id { get; set; } public System.Int32 user_id { get; set; }
/// <summary> /// <summary>
/// 角色0=参与者1=发起者 /// 角色0=参与者1=发起者
/// </summary> /// </summary>
[Display(Name = "角色0=参与者1=发起者")] [Display(Name = "角色0=参与者1=发起者")]
[Required(ErrorMessage = "请输入{0}")] [Required(ErrorMessage = "请输入{0}")]
public System.Int32 role { get; set; } public System.Int32 role { get; set; }
/// <summary> /// <summary>
/// 加入时间 /// 加入时间
/// </summary> /// </summary>
[Display(Name = "加入时间")] [Display(Name = "加入时间")]
[Required(ErrorMessage = "请输入{0}")] [Required(ErrorMessage = "请输入{0}")]
public System.DateTime join_time { get; set; } public System.DateTime join_time { get; set; }
/// <summary> /// <summary>
/// 退出时间 /// 退出时间
/// </summary> /// </summary>
[Display(Name = "退出时间")] [Display(Name = "退出时间")]
public System.DateTime? quit_time { get; set; } public System.DateTime? quit_time { get; set; }
/// <summary> /// <summary>
/// 状态0正常1已退出 /// 状态0正常1已退出
/// </summary> /// </summary>
[Display(Name = "状态0正常1已退出")] [Display(Name = "状态0正常1已退出")]
[Required(ErrorMessage = "请输入{0}")] [Required(ErrorMessage = "请输入{0}")]
public System.Int32 status { get; set; } public System.Int32 status { get; set; }
/// <summary>
/// 备注
/// </summary>
[Display(Name = "备注")]
[StringLength(maximumLength: 500, ErrorMessage = "{0}不能超过{1}字")]
public System.String remarks { get; set; }
/// <summary>
/// 重要数据
/// </summary>
[Display(Name = "重要数据")]
[StringLength(maximumLength: 500, ErrorMessage = "{0}不能超过{1}字")]
public System.String important_data { get; set; }
/// <summary>
/// 是否需要退款。0 无需退款未交押金1 交押金,待退款2,交押金,退款中3 退款成功9退款失败
/// </summary>
[Display(Name = "是否需要退款。0 无需退款未交押金1 交押金,待退款2,交押金,退款中3 退款成功9退款失败")]
public System.Int32 is_refund { get; set; }
} }
} }

View File

@ -316,7 +316,7 @@ ICoreCmsUserServices userServices
} }
foreach (var item in pageList) foreach (var item in pageList)
{ {
var temp = participants.Where(it => it.reservation_id == item.id).OrderBy(it=>it.role).ThenBy(it=>it.status).ToList(); var temp = participants.Where(it => it.reservation_id == item.id).OrderBy(it => it.role).ThenBy(it => it.status).ToList();
var dto = _mapper.Map<List<SQReservationParticipantsDto>>(temp); var dto = _mapper.Map<List<SQReservationParticipantsDto>>(temp);
if (userList != null && userList.Count > 0) if (userList != null && userList.Count > 0)
{ {
@ -930,7 +930,7 @@ ICoreCmsUserServices userServices
mySheet.SetColumnWidth(2, 10 * 256); mySheet.SetColumnWidth(2, 10 * 256);
var cell3 = headerRow.CreateCell(3); var cell3 = headerRow.CreateCell(3);
cell3.SetCellValue("房间名称(冗余存储,比如 304号-大包30元/小时)"); cell3.SetCellValue("房间名称");
cell3.CellStyle = headerStyle; cell3.CellStyle = headerStyle;
mySheet.SetColumnWidth(3, 10 * 256); mySheet.SetColumnWidth(3, 10 * 256);
@ -955,12 +955,12 @@ ICoreCmsUserServices userServices
mySheet.SetColumnWidth(7, 10 * 256); mySheet.SetColumnWidth(7, 10 * 256);
var cell8 = headerRow.CreateCell(8); var cell8 = headerRow.CreateCell(8);
cell8.SetCellValue("玩法类型(如:补克)"); cell8.SetCellValue("玩法类型");
cell8.CellStyle = headerStyle; cell8.CellStyle = headerStyle;
mySheet.SetColumnWidth(8, 10 * 256); mySheet.SetColumnWidth(8, 10 * 256);
var cell9 = headerRow.CreateCell(9); var cell9 = headerRow.CreateCell(9);
cell9.SetCellValue("具体规则(如:斗地主)"); cell9.SetCellValue("具体规则");
cell9.CellStyle = headerStyle; cell9.CellStyle = headerStyle;
mySheet.SetColumnWidth(9, 10 * 256); mySheet.SetColumnWidth(9, 10 * 256);
@ -970,12 +970,12 @@ ICoreCmsUserServices userServices
mySheet.SetColumnWidth(10, 10 * 256); mySheet.SetColumnWidth(10, 10 * 256);
var cell11 = headerRow.CreateCell(11); var cell11 = headerRow.CreateCell(11);
cell11.SetCellValue("是否禁烟0=不限制1=禁烟2=不禁烟"); cell11.SetCellValue("是否禁烟");
cell11.CellStyle = headerStyle; cell11.CellStyle = headerStyle;
mySheet.SetColumnWidth(11, 10 * 256); mySheet.SetColumnWidth(11, 10 * 256);
var cell12 = headerRow.CreateCell(12); var cell12 = headerRow.CreateCell(12);
cell12.SetCellValue("性别限制0=不限1=男2=女"); cell12.SetCellValue("性别");
cell12.CellStyle = headerStyle; cell12.CellStyle = headerStyle;
mySheet.SetColumnWidth(12, 10 * 256); mySheet.SetColumnWidth(12, 10 * 256);
@ -990,17 +990,17 @@ ICoreCmsUserServices userServices
mySheet.SetColumnWidth(14, 10 * 256); mySheet.SetColumnWidth(14, 10 * 256);
var cell15 = headerRow.CreateCell(15); var cell15 = headerRow.CreateCell(15);
cell15.SetCellValue("最大年龄限制0=不限"); cell15.SetCellValue("最大年龄限制");
cell15.CellStyle = headerStyle; cell15.CellStyle = headerStyle;
mySheet.SetColumnWidth(15, 10 * 256); mySheet.SetColumnWidth(15, 10 * 256);
var cell16 = headerRow.CreateCell(16); var cell16 = headerRow.CreateCell(16);
cell16.SetCellValue("鸽子费(保证金)"); cell16.SetCellValue("鸽子费");
cell16.CellStyle = headerStyle; cell16.CellStyle = headerStyle;
mySheet.SetColumnWidth(16, 10 * 256); mySheet.SetColumnWidth(16, 10 * 256);
var cell17 = headerRow.CreateCell(17); var cell17 = headerRow.CreateCell(17);
cell17.SetCellValue("状态0=待开始1=进行中2=已结束3=取消"); cell17.SetCellValue("状态");
cell17.CellStyle = headerStyle; cell17.CellStyle = headerStyle;
mySheet.SetColumnWidth(17, 10 * 256); mySheet.SetColumnWidth(17, 10 * 256);
@ -1167,6 +1167,32 @@ ICoreCmsUserServices userServices
#endregion #endregion
#region 退======================================================
[HttpPost]
[Description("强制退出参与者")]
public AdminUiCallBack ForceExitParticipant([FromBody] FMIntId entity)
{
var jm = new AdminUiCallBack();
if (entity.id > 0)
{
var re = _SQReservationParticipantsServices.QueryById(entity.id);
if (re != null)
{
re.status = 1;
re.remarks = $"后台于{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}强制退出!";
if (re.is_refund == 1)
{
re.is_refund = 2;
}
_SQReservationParticipantsServices.Update(re);
jm.msg = "强制退出成功";
jm.code = 0;
}
}
return jm;
}
#endregion
} }
} }

View File

@ -128,6 +128,7 @@
var debug = layui.setter.debug; var debug = layui.setter.debug;
var roomOptions; var roomOptions;
var dicOptions; var dicOptions;
var coreHelper;
layui.data.done = function (d) { layui.data.done = function (d) {
//开启调试情况下获取接口赋值数据 //开启调试情况下获取接口赋值数据
if (debug) { console.log(d); } if (debug) { console.log(d); }
@ -143,10 +144,9 @@
, form = layui.form , form = layui.form
, laydate = layui.laydate , laydate = layui.laydate
, setter = layui.setter , setter = layui.setter
, coreHelper = layui.coreHelper
, util = layui.util , util = layui.util
, view = layui.view; , view = layui.view;
coreHelper = layui.coreHelper;
var searchwhere; var searchwhere;
//监听搜索 //监听搜索
form.on('submit(LAY-app-SQReservations-search)', form.on('submit(LAY-app-SQReservations-search)',
@ -206,20 +206,20 @@
if (!d.participants || d.participants.length === 0) { if (!d.participants || d.participants.length === 0) {
return '<div style="color: #999; font-style: italic;">暂无参与人员</div>'; return '<div style="color: #999; font-style: italic;">暂无参与人员</div>';
} }
var html = '<div style="line-height: 1.6;line-height: 1.6;overflow: auto;height: 100%;width: 100%;">'; var html = '<div style="line-height: 1.6;line-height: 1.6;overflow: auto;height: 100%;width: 100%;">';
var initiator = null; var initiator = null;
var participants = []; var participants = [];
// 分离发起者和参与者 // 分离发起者和参与者
d.participants.forEach(function(it) { d.participants.forEach(function (it) {
if (it.role == 1) { if (it.role == 1) {
initiator = it; initiator = it;
} else { } else {
participants.push(it); participants.push(it);
} }
}); });
// 显示发起者 // 显示发起者
if (initiator) { if (initiator) {
html += '<div style="margin-bottom: 8px; border-left: 2px solid #5FB878; padding-left: 8px;">'; html += '<div style="margin-bottom: 8px; border-left: 2px solid #5FB878; padding-left: 8px;">';
@ -228,30 +228,30 @@
html += '<span style="font-weight: bold;">' + (initiator.UserName || '用户' + initiator.user_id) + '</span>'; html += '<span style="font-weight: bold;">' + (initiator.UserName || '用户' + initiator.user_id) + '</span>';
html += '<span style="color: #999; font-size: 12px; margin-left: 5px;">(ID: ' + initiator.user_id + ')</span>'; html += '<span style="color: #999; font-size: 12px; margin-left: 5px;">(ID: ' + initiator.user_id + ')</span>';
html += '</div>'; html += '</div>';
// 显示发起时间 // 显示发起时间
if (initiator.join_time) { if (initiator.join_time) {
html += '<div style="color: #666; font-size: 11px;">'; html += '<div style="color: #666; font-size: 11px;">';
html += '<span style="color: #999;">发起时间:</span>' + initiator.join_time; html += '<span style="color: #999;">发起时间:</span>' + initiator.join_time;
html += '</div>'; html += '</div>';
} }
html += '</div>'; html += '</div>';
} }
// 显示参与者 // 显示参与者
if (participants.length > 0) { if (participants.length > 0) {
// 统计正常状态的参与者数量 // 统计正常状态的参与者数量
var normalParticipantsCount = participants.filter(function(it) { var normalParticipantsCount = participants.filter(function (it) {
return it.status == 0; return it.status == 0;
}).length; }).length;
html += '<div style="margin-bottom: 5px;">'; html += '<div style="margin-bottom: 5px;">';
html += '<span style="background: #1E9FFF; color: white; padding: 2px 6px; border-radius: 3px; font-size: 12px; margin-right: 5px;">参与者</span>'; html += '<span style="background: #1E9FFF; color: white; padding: 2px 6px; border-radius: 3px; font-size: 12px; margin-right: 5px;">参与者</span>';
html += '<span style="color: #666; font-size: 12px;">(' + normalParticipantsCount + '人)</span>'; html += '<span style="color: #666; font-size: 12px;">(' + normalParticipantsCount + '人)</span>';
html += '</div>'; html += '</div>';
participants.forEach(function(it, index) { participants.forEach(function (it, index) {
var statusText = ''; var statusText = '';
var statusColor = ''; var statusColor = '';
if (it.status == 0) { if (it.status == 0) {
@ -261,7 +261,7 @@
statusText = '已退出'; statusText = '已退出';
statusColor = '#FF5722'; statusColor = '#FF5722';
} }
html += '<div style="margin-left: 15px; margin-bottom: 8px; font-size: 12px; border-left: 2px solid #E6E6E6; padding-left: 8px;">'; html += '<div style="margin-left: 15px; margin-bottom: 8px; font-size: 12px; border-left: 2px solid #E6E6E6; padding-left: 8px;">';
html += '<div style="margin-bottom: 3px;">'; html += '<div style="margin-bottom: 3px;">';
html += '<span style="color: #333; font-weight: 500;">' + (it.UserName || '用户' + it.user_id) + '</span>'; html += '<span style="color: #333; font-weight: 500;">' + (it.UserName || '用户' + it.user_id) + '</span>';
@ -269,15 +269,19 @@
if (statusText) { if (statusText) {
html += '<span style="background: ' + statusColor + '; color: white; padding: 1px 4px; border-radius: 2px; font-size: 10px; margin-left: 5px;">' + statusText + '</span>'; html += '<span style="background: ' + statusColor + '; color: white; padding: 1px 4px; border-radius: 2px; font-size: 10px; margin-left: 5px;">' + statusText + '</span>';
} }
// 当用户状态为正常时,显示强制退出按钮
if (it.status == 0) {
html += '<span style="background: #FF5722; color: white; padding: 1px 4px; border-radius: 2px; font-size: 10px; margin-left: 5px; cursor: pointer;" onclick="forceExitParticipant(' + JSON.stringify(it).replace(/"/g, '&quot;') + ', ' + it.id + ')">强制退出</span>';
}
html += '</div>'; html += '</div>';
// 显示参与时间 // 显示参与时间
if (it.join_time) { if (it.join_time) {
html += '<div style="color: #666; font-size: 11px; margin-bottom: 2px;">'; html += '<div style="color: #666; font-size: 11px; margin-bottom: 2px;">';
html += '<span style="color: #999;">参与时间:</span>' + it.join_time; html += '<span style="color: #999;">参与时间:</span>' + it.join_time;
html += '</div>'; html += '</div>';
} }
// 显示退出时间(仅当状态为已退出时) // 显示退出时间(仅当状态为已退出时)
if (it.status == 1 && it.quit_time) { if (it.status == 1 && it.quit_time) {
html += '<div style="color: #666; font-size: 11px;">'; html += '<div style="color: #666; font-size: 11px;">';
@ -285,10 +289,45 @@
html += '</div>'; html += '</div>';
} }
// 显示鸽子费退款状态
if (it.is_refund !== undefined && it.is_refund !== null) {
var refundText = '';
var refundColor = '';
switch (it.is_refund) {
case 0:
refundText = '无需退款';
refundColor = '#999';
break;
case 1:
refundText = '已付鸽子费';
refundColor = '#1E9FFF';
break;
case 2:
refundText = '退款中';
refundColor = '#FFB800';
break;
case 3:
refundText = '退款成功';
refundColor = '#5FB878';
break;
case 9:
refundText = '退款失败';
refundColor = '#FF5722';
break;
default:
refundText = '未知状态';
refundColor = '#999';
}
html += '<div style="color: #666; font-size: 11px; margin-top: 2px;">';
html += '<span style="color: #999;">鸽子费:</span>';
html += '<span style="background: ' + refundColor + '; color: white; padding: 1px 4px; border-radius: 2px; font-size: 10px;">' + refundText + '</span>';
html += '</div>';
}
html += '</div>'; html += '</div>';
}); });
} }
html += '</div>'; html += '</div>';
return html; return html;
} }
@ -661,4 +700,28 @@
form.render(); form.render();
}); });
}; };
// 强制退出参与者函数
function forceExitParticipant(participant, reservationId) {
layer.confirm('确定要强制退出该参与者吗?如果用户已付鸽子费,会自动退还!', {
icon: 3,
title: '确认操作'
}, function (index) {
// 关闭确认框
layer.close(index);
// 调用API强制退出参与者
coreHelper.Post("Api/SQReservations/ForceExitParticipant", {
id: reservationId,
}, function (e) {
if (e.code === 0) {
layer.msg('强制退出成功', { icon: 1 });
// 重新加载表格数据
layui.table.reloadData('LAY-app-SQReservations-tableBox');
} else {
layer.msg(e.msg || '操作失败', { icon: 2 });
}
});
});
}
</script> </script>