From 9e31244b9d3103f4f2273e21e63dd4387dbea479 Mon Sep 17 00:00:00 2001 From: zpc Date: Wed, 3 Sep 2025 03:35:41 +0800 Subject: [PATCH] 333 --- .../Entities/SQ/SQReservationParticipants.cs | 124 ++++++++++-------- .../SQ/SQReservationsController.cs | 44 +++++-- .../views/sq/sqreservations/index.html | 97 +++++++++++--- 3 files changed, 187 insertions(+), 78 deletions(-) diff --git a/CoreCms.Net.Model/Entities/SQ/SQReservationParticipants.cs b/CoreCms.Net.Model/Entities/SQ/SQReservationParticipants.cs index 95b5720..5df1f57 100644 --- a/CoreCms.Net.Model/Entities/SQ/SQReservationParticipants.cs +++ b/CoreCms.Net.Model/Entities/SQ/SQReservationParticipants.cs @@ -9,6 +9,7 @@ ***********************************************************************/ using SqlSugar; + using System.ComponentModel; using System.ComponentModel.DataAnnotations; @@ -25,92 +26,111 @@ namespace CoreCms.Net.Model.Entities public SQReservationParticipants() { } - + /// /// 参与记录ID /// [Display(Name = "参与记录ID")] - + [SugarColumn(IsPrimaryKey = true, IsIdentity = true)] - + [Required(ErrorMessage = "请输入{0}")] - - - - public System.Int32 id { get; set; } - - + + + + public System.Int32 id { get; set; } + + /// /// 预约ID /// [Display(Name = "预约ID")] - + [Required(ErrorMessage = "请输入{0}")] - - - - public System.Int32 reservation_id { get; set; } - - + + + + public System.Int32 reservation_id { get; set; } + + /// /// 参与者ID(关联用户表,暂时占位) /// [Display(Name = "参与者ID(关联用户表,暂时占位)")] - + [Required(ErrorMessage = "请输入{0}")] - - - - public System.Int32 user_id { get; set; } - - + + + + public System.Int32 user_id { get; set; } + + /// /// 角色:0=参与者,1=发起者 /// [Display(Name = "角色:0=参与者,1=发起者")] - + [Required(ErrorMessage = "请输入{0}")] - - - - public System.Int32 role { get; set; } - - + + + + public System.Int32 role { get; set; } + + /// /// 加入时间 /// [Display(Name = "加入时间")] - + [Required(ErrorMessage = "请输入{0}")] - - - - public System.DateTime join_time { get; set; } - - + + + + public System.DateTime join_time { get; set; } + + /// /// 退出时间 /// [Display(Name = "退出时间")] - - - - - - public System.DateTime? quit_time { get; set; } - - + + + + + + public System.DateTime? quit_time { get; set; } + + /// /// 状态,0正常,1已退出 /// [Display(Name = "状态,0正常,1已退出")] - + [Required(ErrorMessage = "请输入{0}")] - - - - public System.Int32 status { get; set; } - - + + + + public System.Int32 status { get; set; } + /// + /// 备注 + /// + [Display(Name = "备注")] + + [StringLength(maximumLength: 500, ErrorMessage = "{0}不能超过{1}字")] + public System.String remarks { get; set; } + + /// + /// 重要数据 + /// + [Display(Name = "重要数据")] + + [StringLength(maximumLength: 500, ErrorMessage = "{0}不能超过{1}字")] + public System.String important_data { get; set; } + + /// + /// 是否需要退款。0 无需退款,未交押金,1 交押金,待退款,2,交押金,退款中,3 退款成功,9退款失败 + /// + [Display(Name = "是否需要退款。0 无需退款,未交押金,1 交押金,待退款,2,交押金,退款中,3 退款成功,9退款失败")] + public System.Int32 is_refund { get; set; } } } diff --git a/CoreCms.Net.Web.Admin/Controllers/SQ/SQReservationsController.cs b/CoreCms.Net.Web.Admin/Controllers/SQ/SQReservationsController.cs index f1d68ba..2d8e510 100644 --- a/CoreCms.Net.Web.Admin/Controllers/SQ/SQReservationsController.cs +++ b/CoreCms.Net.Web.Admin/Controllers/SQ/SQReservationsController.cs @@ -316,7 +316,7 @@ ICoreCmsUserServices userServices } 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>(temp); if (userList != null && userList.Count > 0) { @@ -930,7 +930,7 @@ ICoreCmsUserServices userServices mySheet.SetColumnWidth(2, 10 * 256); var cell3 = headerRow.CreateCell(3); - cell3.SetCellValue("房间名称(冗余存储,比如 304号-大包,30元/小时)"); + cell3.SetCellValue("房间名称"); cell3.CellStyle = headerStyle; mySheet.SetColumnWidth(3, 10 * 256); @@ -955,12 +955,12 @@ ICoreCmsUserServices userServices mySheet.SetColumnWidth(7, 10 * 256); var cell8 = headerRow.CreateCell(8); - cell8.SetCellValue("玩法类型(如:补克)"); + cell8.SetCellValue("玩法类型"); cell8.CellStyle = headerStyle; mySheet.SetColumnWidth(8, 10 * 256); var cell9 = headerRow.CreateCell(9); - cell9.SetCellValue("具体规则(如:斗地主)"); + cell9.SetCellValue("具体规则"); cell9.CellStyle = headerStyle; mySheet.SetColumnWidth(9, 10 * 256); @@ -970,12 +970,12 @@ ICoreCmsUserServices userServices mySheet.SetColumnWidth(10, 10 * 256); var cell11 = headerRow.CreateCell(11); - cell11.SetCellValue("是否禁烟:0=不限制,1=禁烟,2=不禁烟"); + cell11.SetCellValue("是否禁烟"); cell11.CellStyle = headerStyle; mySheet.SetColumnWidth(11, 10 * 256); var cell12 = headerRow.CreateCell(12); - cell12.SetCellValue("性别限制:0=不限,1=男,2=女"); + cell12.SetCellValue("性别"); cell12.CellStyle = headerStyle; mySheet.SetColumnWidth(12, 10 * 256); @@ -990,17 +990,17 @@ ICoreCmsUserServices userServices mySheet.SetColumnWidth(14, 10 * 256); var cell15 = headerRow.CreateCell(15); - cell15.SetCellValue("最大年龄限制,0=不限"); + cell15.SetCellValue("最大年龄限制"); cell15.CellStyle = headerStyle; mySheet.SetColumnWidth(15, 10 * 256); var cell16 = headerRow.CreateCell(16); - cell16.SetCellValue("鸽子费(保证金)"); + cell16.SetCellValue("鸽子费"); cell16.CellStyle = headerStyle; mySheet.SetColumnWidth(16, 10 * 256); var cell17 = headerRow.CreateCell(17); - cell17.SetCellValue("状态:0=待开始,1=进行中,2=已结束,3=取消"); + cell17.SetCellValue("状态"); cell17.CellStyle = headerStyle; mySheet.SetColumnWidth(17, 10 * 256); @@ -1167,6 +1167,32 @@ ICoreCmsUserServices userServices #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 } } diff --git a/CoreCms.Net.Web.Admin/wwwroot/views/sq/sqreservations/index.html b/CoreCms.Net.Web.Admin/wwwroot/views/sq/sqreservations/index.html index 9e589ce..d20bb51 100644 --- a/CoreCms.Net.Web.Admin/wwwroot/views/sq/sqreservations/index.html +++ b/CoreCms.Net.Web.Admin/wwwroot/views/sq/sqreservations/index.html @@ -128,6 +128,7 @@ var debug = layui.setter.debug; var roomOptions; var dicOptions; + var coreHelper; layui.data.done = function (d) { //开启调试情况下获取接口赋值数据 if (debug) { console.log(d); } @@ -143,10 +144,9 @@ , form = layui.form , laydate = layui.laydate , setter = layui.setter - , coreHelper = layui.coreHelper , util = layui.util , view = layui.view; - + coreHelper = layui.coreHelper; var searchwhere; //监听搜索 form.on('submit(LAY-app-SQReservations-search)', @@ -206,20 +206,20 @@ if (!d.participants || d.participants.length === 0) { return '
暂无参与人员
'; } - + var html = '
'; var initiator = null; var participants = []; - + // 分离发起者和参与者 - d.participants.forEach(function(it) { + d.participants.forEach(function (it) { if (it.role == 1) { initiator = it; } else { participants.push(it); } }); - + // 显示发起者 if (initiator) { html += '
'; @@ -228,30 +228,30 @@ html += '' + (initiator.UserName || '用户' + initiator.user_id) + ''; html += '(ID: ' + initiator.user_id + ')'; html += '
'; - + // 显示发起时间 if (initiator.join_time) { html += '
'; html += '发起时间:' + initiator.join_time; html += '
'; } - + html += '
'; } - + // 显示参与者 if (participants.length > 0) { // 统计正常状态的参与者数量 - var normalParticipantsCount = participants.filter(function(it) { + var normalParticipantsCount = participants.filter(function (it) { return it.status == 0; }).length; - + html += '
'; html += '参与者'; html += '(' + normalParticipantsCount + '人)'; html += '
'; - - participants.forEach(function(it, index) { + + participants.forEach(function (it, index) { var statusText = ''; var statusColor = ''; if (it.status == 0) { @@ -261,7 +261,7 @@ statusText = '已退出'; statusColor = '#FF5722'; } - + html += '
'; html += '
'; html += '' + (it.UserName || '用户' + it.user_id) + ''; @@ -269,15 +269,19 @@ if (statusText) { html += '' + statusText + ''; } + // 当用户状态为正常时,显示强制退出按钮 + if (it.status == 0) { + html += '强制退出'; + } html += '
'; - + // 显示参与时间 if (it.join_time) { html += '
'; html += '参与时间:' + it.join_time; html += '
'; } - + // 显示退出时间(仅当状态为已退出时) if (it.status == 1 && it.quit_time) { html += '
'; @@ -285,10 +289,45 @@ html += '
'; } + // 显示鸽子费退款状态 + 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 += '
'; + html += '鸽子费:'; + html += '' + refundText + ''; + html += '
'; + } + html += '
'; }); } - + html += ''; return html; } @@ -661,4 +700,28 @@ 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 }); + } + }); + }); + } \ No newline at end of file