321
This commit is contained in:
parent
b86ae43a30
commit
31876fa46f
|
|
@ -1,4 +1,4 @@
|
|||
using AutoMapper;
|
||||
using AutoMapper;
|
||||
|
||||
using CoreCms.Net.Model.Entities;
|
||||
|
||||
|
|
@ -458,4 +458,98 @@ namespace CoreCms.Net.Model.ViewModels.SQ
|
|||
|
||||
#endregion
|
||||
|
||||
#region 鸽子费审核相关DTO
|
||||
|
||||
/// <summary>
|
||||
/// 鸽子费审核列表项 DTO
|
||||
/// </summary>
|
||||
public class PigeonFeeAuditListDto
|
||||
{
|
||||
/// <summary>
|
||||
/// 参与者ID
|
||||
/// </summary>
|
||||
public int participant_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 预约ID
|
||||
/// </summary>
|
||||
public int reservation_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 预约标题
|
||||
/// </summary>
|
||||
public string reservation_title { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 用户ID
|
||||
/// </summary>
|
||||
public int user_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 用户昵称
|
||||
/// </summary>
|
||||
public string nick_name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 手机号
|
||||
/// </summary>
|
||||
public string mobile { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 鸽子费金额
|
||||
/// </summary>
|
||||
public decimal deposit_fee { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 预约开始时间
|
||||
/// </summary>
|
||||
public DateTime start_time { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 预约结束时间
|
||||
/// </summary>
|
||||
public DateTime end_time { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 标记时间(发起者签到时间)
|
||||
/// </summary>
|
||||
public DateTime? mark_time { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 赴约状态:0=未处理,1=已赴约,2=未赴约待审核,3=未赴约已审核
|
||||
/// </summary>
|
||||
public int is_arrive { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 房间名称
|
||||
/// </summary>
|
||||
public string room_name { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 鸽子费审核请求 DTO
|
||||
/// </summary>
|
||||
public class PigeonFeeAuditRequestDto
|
||||
{
|
||||
/// <summary>
|
||||
/// 参与者ID
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "请输入参与者ID")]
|
||||
public int participant_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 预约ID
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "请输入预约ID")]
|
||||
public int reservation_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 原因(审核未通过时使用)
|
||||
/// </summary>
|
||||
[StringLength(255, ErrorMessage = "原因不能超过255字")]
|
||||
public string reason { get; set; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/***********************************************************************
|
||||
/***********************************************************************
|
||||
* Project: CoreCms
|
||||
* ProjectName: 核心内容管理系统
|
||||
* Web: https://www.corecms.net
|
||||
|
|
@ -35,6 +35,7 @@ using CoreCms.Net.Services;
|
|||
using System.Collections.Generic;
|
||||
using AutoMapper;
|
||||
using CoreCms.Net.Model.ViewModels.SQ;
|
||||
using CoreCms.Net.IRepository.UnitOfWork;
|
||||
|
||||
namespace CoreCms.Net.Web.Admin.Controllers
|
||||
{
|
||||
|
|
@ -56,19 +57,24 @@ namespace CoreCms.Net.Web.Admin.Controllers
|
|||
private readonly ISQReservationParticipantsServices _SQReservationParticipantsServices;
|
||||
private readonly IMapper _mapper;
|
||||
private readonly ICoreCmsUserServices _userServices;
|
||||
private readonly ISQEarningsServices _sQEarningsServices;
|
||||
private readonly ISQMessageServices _sQMessageServices;
|
||||
private readonly IUnitOfWork _unitOfWork;
|
||||
|
||||
/// <summary>
|
||||
/// 构造函数
|
||||
///</summary>
|
||||
public SQReservationsController(IWebHostEnvironment webHostEnvironment
|
||||
, ISQReservationsServices SQReservationsServices
|
||||
, ISQRoomsServices SQRoomsServices
|
||||
, ISysDictionaryServices sysDictionaryServices
|
||||
, ISQRoomsServices SQRoomsServices
|
||||
, ISysDictionaryServices sysDictionaryServices
|
||||
, ISysDictionaryDataServices sysDictionaryDataServices
|
||||
, ISQReservationParticipantsServices sQReservationParticipantsServices
|
||||
, IMapper mapper
|
||||
,
|
||||
ICoreCmsUserServices userServices
|
||||
|
||||
, ICoreCmsUserServices userServices
|
||||
, ISQEarningsServices sQEarningsServices
|
||||
, ISQMessageServices sQMessageServices
|
||||
, IUnitOfWork unitOfWork
|
||||
)
|
||||
{
|
||||
_webHostEnvironment = webHostEnvironment;
|
||||
|
|
@ -79,6 +85,9 @@ ICoreCmsUserServices userServices
|
|||
_SQReservationParticipantsServices = sQReservationParticipantsServices;
|
||||
_mapper = mapper;
|
||||
_userServices = userServices;
|
||||
_sQEarningsServices = sQEarningsServices;
|
||||
_sQMessageServices = sQMessageServices;
|
||||
_unitOfWork = unitOfWork;
|
||||
}
|
||||
|
||||
#region 获取列表============================================================
|
||||
|
|
@ -1566,5 +1575,339 @@ ICoreCmsUserServices userServices
|
|||
#endregion
|
||||
|
||||
|
||||
#region 鸽子费审核功能======================================================
|
||||
|
||||
/// <summary>
|
||||
/// 获取鸽子费待审核列表
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Description("获取鸽子费待审核列表")]
|
||||
public async Task<AdminUiCallBack> GetPigeonFeeAuditList()
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
var pageCurrent = Request.Form["page"].FirstOrDefault().ObjectToInt(1);
|
||||
var pageSize = Request.Form["limit"].FirstOrDefault().ObjectToInt(30);
|
||||
|
||||
// 筛选条件
|
||||
var reservationId = Request.Form["reservation_id"].FirstOrDefault().ObjectToInt(0);
|
||||
var userId = Request.Form["user_id"].FirstOrDefault().ObjectToInt(0);
|
||||
var keyword = Request.Form["keyword"].FirstOrDefault(); // 用户昵称或手机号
|
||||
|
||||
// 预约时间筛选
|
||||
var startTimeBegin = Request.Form["start_time_begin"].FirstOrDefault();
|
||||
var startTimeEnd = Request.Form["start_time_end"].FirstOrDefault();
|
||||
|
||||
// 标记时间筛选
|
||||
var markTimeBegin = Request.Form["mark_time_begin"].FirstOrDefault();
|
||||
var markTimeEnd = Request.Form["mark_time_end"].FirstOrDefault();
|
||||
|
||||
// 构建SQL查询 - 查询 is_arrive=2(未赴约待审核)且 status=0(未退出)且预约有鸽子费的参与者
|
||||
var sql = @"
|
||||
SELECT
|
||||
p.id AS participant_id,
|
||||
p.reservation_id,
|
||||
r.title AS reservation_title,
|
||||
p.user_id,
|
||||
u.nickName AS nick_name,
|
||||
u.mobile,
|
||||
ISNULL(r.deposit_fee, 0) AS deposit_fee,
|
||||
r.start_time,
|
||||
r.end_time,
|
||||
r.room_name,
|
||||
(SELECT TOP 1 check_reservation FROM SQReservationParticipants WHERE reservation_id = p.reservation_id AND role = 1) AS mark_time,
|
||||
p.is_arrive
|
||||
FROM SQReservationParticipants p
|
||||
INNER JOIN SQReservations r ON p.reservation_id = r.id
|
||||
INNER JOIN CoreCmsUser u ON p.user_id = u.id
|
||||
WHERE p.is_arrive = 2
|
||||
AND p.status = 0
|
||||
AND ISNULL(r.deposit_fee, 0) > 0";
|
||||
|
||||
// 添加筛选条件
|
||||
if (reservationId > 0)
|
||||
{
|
||||
sql += $" AND p.reservation_id = {reservationId}";
|
||||
}
|
||||
if (userId > 0)
|
||||
{
|
||||
sql += $" AND p.user_id = {userId}";
|
||||
}
|
||||
if (!string.IsNullOrEmpty(keyword))
|
||||
{
|
||||
sql += $" AND (u.nickName LIKE '%{keyword}%' OR u.mobile LIKE '%{keyword}%')";
|
||||
}
|
||||
if (!string.IsNullOrEmpty(startTimeBegin))
|
||||
{
|
||||
var dt = startTimeBegin.ObjectToDate();
|
||||
sql += $" AND r.start_time >= '{dt:yyyy-MM-dd HH:mm:ss}'";
|
||||
}
|
||||
if (!string.IsNullOrEmpty(startTimeEnd))
|
||||
{
|
||||
var dt = startTimeEnd.ObjectToDate();
|
||||
sql += $" AND r.start_time <= '{dt:yyyy-MM-dd HH:mm:ss}'";
|
||||
}
|
||||
if (!string.IsNullOrEmpty(markTimeBegin))
|
||||
{
|
||||
var dt = markTimeBegin.ObjectToDate();
|
||||
sql += $" AND (SELECT TOP 1 check_reservation FROM SQReservationParticipants WHERE reservation_id = p.reservation_id AND role = 1) >= '{dt:yyyy-MM-dd HH:mm:ss}'";
|
||||
}
|
||||
if (!string.IsNullOrEmpty(markTimeEnd))
|
||||
{
|
||||
var dt = markTimeEnd.ObjectToDate();
|
||||
sql += $" AND (SELECT TOP 1 check_reservation FROM SQReservationParticipants WHERE reservation_id = p.reservation_id AND role = 1) <= '{dt:yyyy-MM-dd HH:mm:ss}'";
|
||||
}
|
||||
|
||||
// 获取总数
|
||||
var countSql = $"SELECT COUNT(1) FROM ({sql}) AS t";
|
||||
var totalCount = await _unitOfWork.GetDbClient().Ado.GetIntAsync(countSql);
|
||||
|
||||
// 分页排序
|
||||
sql += $" ORDER BY (SELECT TOP 1 check_reservation FROM SQReservationParticipants WHERE reservation_id = p.reservation_id AND role = 1) DESC";
|
||||
sql += $" OFFSET {(pageCurrent - 1) * pageSize} ROWS FETCH NEXT {pageSize} ROWS ONLY";
|
||||
|
||||
var list = await _unitOfWork.GetDbClient().Ado.SqlQueryAsync<PigeonFeeAuditListDto>(sql);
|
||||
|
||||
jm.data = list;
|
||||
jm.code = 0;
|
||||
jm.count = totalCount;
|
||||
jm.msg = "数据调用成功!";
|
||||
return jm;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 审核通过 - 扣除鸽子费并分配给已赴约用户
|
||||
/// </summary>
|
||||
/// <param name="request">审核请求参数</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Description("鸽子费审核通过")]
|
||||
public async Task<AdminUiCallBack> ApprovePigeonFee([FromBody] PigeonFeeAuditRequestDto request)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
if (request == null || request.participant_id <= 0 || request.reservation_id <= 0)
|
||||
{
|
||||
jm.msg = "参数错误";
|
||||
return jm;
|
||||
}
|
||||
|
||||
// 获取当前登录管理员ID
|
||||
var operatorId = HttpContext.User.Claims.FirstOrDefault(c => c.Type == "id")?.Value.ObjectToInt(0) ?? 0;
|
||||
|
||||
// 查询参与者信息
|
||||
var participant = await _SQReservationParticipantsServices.QueryByClauseAsync(
|
||||
p => p.id == request.participant_id && p.reservation_id == request.reservation_id);
|
||||
if (participant == null)
|
||||
{
|
||||
jm.msg = "参与者记录不存在";
|
||||
return jm;
|
||||
}
|
||||
|
||||
// 检查状态是否为待审核
|
||||
if (participant.is_arrive != 2)
|
||||
{
|
||||
jm.msg = "该用户不是待审核状态";
|
||||
return jm;
|
||||
}
|
||||
|
||||
// 查询预约信息
|
||||
var reservation = await _SQReservationsServices.QueryByClauseAsync(r => r.id == request.reservation_id);
|
||||
if (reservation == null)
|
||||
{
|
||||
jm.msg = "预约不存在";
|
||||
return jm;
|
||||
}
|
||||
|
||||
// 获取鸽子费金额
|
||||
var depositFee = reservation.deposit_fee ?? 0;
|
||||
if (depositFee <= 0)
|
||||
{
|
||||
jm.msg = "该预约没有鸽子费";
|
||||
return jm;
|
||||
}
|
||||
|
||||
// 获取未赴约用户信息(用于消息通知)
|
||||
var absentUser = await _userServices.QueryByIdAsync(participant.user_id);
|
||||
var absentUserName = absentUser?.nickName ?? $"用户{participant.user_id}";
|
||||
|
||||
// 获取发起者签到时间
|
||||
var initiatorParticipant = await _SQReservationParticipantsServices.QueryByClauseAsync(
|
||||
p => p.reservation_id == request.reservation_id && p.role == 1);
|
||||
var checkTime = initiatorParticipant?.check_reservation;
|
||||
|
||||
// 查询符合条件的已赴约用户(排除发起者和未赴约用户本人)
|
||||
// 条件:is_arrive=1, status=0, join_time < 签到时间, role != 1(排除发起者)
|
||||
var eligibleParticipantsSql = $@"
|
||||
SELECT p.*, u.nickName, u.mobile
|
||||
FROM SQReservationParticipants p
|
||||
INNER JOIN CoreCmsUser u ON p.user_id = u.id
|
||||
WHERE p.reservation_id = {request.reservation_id}
|
||||
AND p.is_arrive = 1
|
||||
AND p.status = 0
|
||||
AND p.role != 1";
|
||||
|
||||
// 如果有签到时间,则只选择签到之前加入的参与者
|
||||
if (checkTime.HasValue)
|
||||
{
|
||||
eligibleParticipantsSql += $" AND p.join_time < '{checkTime.Value:yyyy-MM-dd HH:mm:ss}'";
|
||||
}
|
||||
|
||||
var eligibleParticipants = await _unitOfWork.GetDbClient().Ado.SqlQueryAsync<dynamic>(eligibleParticipantsSql);
|
||||
var participantCount = eligibleParticipants?.Count ?? 0;
|
||||
|
||||
try
|
||||
{
|
||||
_unitOfWork.BeginTran();
|
||||
|
||||
// 1. 更新未赴约用户状态为已审核
|
||||
await _SQReservationParticipantsServices.UpdateAsync(
|
||||
it => new SQReservationParticipants
|
||||
{
|
||||
is_arrive = 3 // 未赴约,已审核
|
||||
},
|
||||
it => it.id == request.participant_id);
|
||||
|
||||
// 2. 如果有符合条件的已赴约用户,分配鸽子费
|
||||
if (participantCount > 0)
|
||||
{
|
||||
// 计算每人分得金额(保留两位小数,四舍五入)
|
||||
var amountPerPerson = Math.Round(depositFee / participantCount, 2, MidpointRounding.AwayFromZero);
|
||||
|
||||
foreach (var ep in eligibleParticipants)
|
||||
{
|
||||
int epUserId = (int)ep.user_id;
|
||||
string epNickName = ep.nickName ?? $"用户{epUserId}";
|
||||
|
||||
// 为每个用户创建收益记录
|
||||
var earningsResult = await _sQEarningsServices.AddEarningsAsync(
|
||||
userId: epUserId,
|
||||
reservationId: request.reservation_id,
|
||||
roomId: reservation.room_id,
|
||||
roomNumber: reservation.room_id.ToString(),
|
||||
roomName: reservation.room_name,
|
||||
roomFee: 0, // 鸽子费不涉及房费
|
||||
earnings: amountPerPerson,
|
||||
type: 2, // 鸽子费类型
|
||||
remark: "未赴约用户鸽子费分配",
|
||||
operatorId: operatorId);
|
||||
|
||||
// 发送消息给分到钱的用户
|
||||
await _sQMessageServices.SendSystemNoticeAsync(
|
||||
epUserId,
|
||||
"鸽子费分配通知",
|
||||
$"{absentUserName} 未能按时参加预约,您收到鸽子费{amountPerPerson}元",
|
||||
relatedType: 1, // 组局
|
||||
relatedId: request.reservation_id);
|
||||
}
|
||||
}
|
||||
|
||||
// 3. 发送消息给未赴约用户
|
||||
await _sQMessageServices.SendSystemNoticeAsync(
|
||||
participant.user_id,
|
||||
"鸽子费扣除通知",
|
||||
$"您未按时参加预约,鸽子费已扣除{depositFee}元。",
|
||||
relatedType: 1, // 组局
|
||||
relatedId: request.reservation_id);
|
||||
|
||||
_unitOfWork.CommitTran();
|
||||
|
||||
jm.code = 0;
|
||||
jm.msg = participantCount > 0
|
||||
? $"审核通过,鸽子费{depositFee}元已分配给{participantCount}位已赴约用户"
|
||||
: "审核通过,但没有符合条件的已赴约用户分配鸽子费";
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_unitOfWork.RollbackTran();
|
||||
jm.msg = "审核失败:" + ex.Message;
|
||||
}
|
||||
|
||||
return jm;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 审核未通过 - 退还鸽子费
|
||||
/// </summary>
|
||||
/// <param name="request">审核请求参数</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Description("鸽子费审核未通过")]
|
||||
public async Task<AdminUiCallBack> RejectPigeonFee([FromBody] PigeonFeeAuditRequestDto request)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
if (request == null || request.participant_id <= 0 || request.reservation_id <= 0)
|
||||
{
|
||||
jm.msg = "参数错误";
|
||||
return jm;
|
||||
}
|
||||
|
||||
// 查询参与者信息
|
||||
var participant = await _SQReservationParticipantsServices.QueryByClauseAsync(
|
||||
p => p.id == request.participant_id && p.reservation_id == request.reservation_id);
|
||||
if (participant == null)
|
||||
{
|
||||
jm.msg = "参与者记录不存在";
|
||||
return jm;
|
||||
}
|
||||
|
||||
// 检查状态是否为待审核
|
||||
if (participant.is_arrive != 2)
|
||||
{
|
||||
jm.msg = "该用户不是待审核状态";
|
||||
return jm;
|
||||
}
|
||||
|
||||
// 查询预约信息
|
||||
var reservation = await _SQReservationsServices.QueryByClauseAsync(r => r.id == request.reservation_id);
|
||||
if (reservation == null)
|
||||
{
|
||||
jm.msg = "预约不存在";
|
||||
return jm;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
_unitOfWork.BeginTran();
|
||||
|
||||
// 1. 更新参与者状态
|
||||
// is_arrive = 1(已赴约)
|
||||
// status = 0(正常,未退出)
|
||||
// is_refund = 3(发起退款,由退款任务处理)
|
||||
await _SQReservationParticipantsServices.UpdateAsync(
|
||||
it => new SQReservationParticipants
|
||||
{
|
||||
is_arrive = 1, // 已赴约
|
||||
status = 0, // 正常
|
||||
is_refund = 3 // 发起退款
|
||||
},
|
||||
it => it.id == request.participant_id);
|
||||
|
||||
// 2. 发送消息给用户
|
||||
await _sQMessageServices.SendSystemNoticeAsync(
|
||||
participant.user_id,
|
||||
"鸽子费审核结果",
|
||||
"您的鸽子费已原路退回。",
|
||||
relatedType: 1, // 组局
|
||||
relatedId: request.reservation_id);
|
||||
|
||||
_unitOfWork.CommitTran();
|
||||
|
||||
jm.code = 0;
|
||||
jm.msg = "审核未通过,鸽子费将原路退回";
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_unitOfWork.RollbackTran();
|
||||
jm.msg = "审核失败:" + ex.Message;
|
||||
}
|
||||
|
||||
return jm;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4125,7 +4125,7 @@
|
|||
预约表
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:CoreCms.Net.Web.Admin.Controllers.SQReservationsController.#ctor(Microsoft.AspNetCore.Hosting.IWebHostEnvironment,CoreCms.Net.IServices.ISQReservationsServices,CoreCms.Net.IServices.ISQRoomsServices,CoreCms.Net.IServices.ISysDictionaryServices,CoreCms.Net.IServices.ISysDictionaryDataServices,CoreCms.Net.IServices.ISQReservationParticipantsServices,AutoMapper.IMapper,CoreCms.Net.IServices.ICoreCmsUserServices)">
|
||||
<member name="M:CoreCms.Net.Web.Admin.Controllers.SQReservationsController.#ctor(Microsoft.AspNetCore.Hosting.IWebHostEnvironment,CoreCms.Net.IServices.ISQReservationsServices,CoreCms.Net.IServices.ISQRoomsServices,CoreCms.Net.IServices.ISysDictionaryServices,CoreCms.Net.IServices.ISysDictionaryDataServices,CoreCms.Net.IServices.ISQReservationParticipantsServices,AutoMapper.IMapper,CoreCms.Net.IServices.ICoreCmsUserServices,CoreCms.Net.IServices.ISQEarningsServices,CoreCms.Net.IServices.ISQMessageServices,CoreCms.Net.IRepository.UnitOfWork.IUnitOfWork)">
|
||||
<summary>
|
||||
构造函数
|
||||
</summary>
|
||||
|
|
@ -4235,6 +4235,26 @@
|
|||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:CoreCms.Net.Web.Admin.Controllers.SQReservationsController.GetPigeonFeeAuditList">
|
||||
<summary>
|
||||
获取鸽子费待审核列表
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:CoreCms.Net.Web.Admin.Controllers.SQReservationsController.ApprovePigeonFee(CoreCms.Net.Model.ViewModels.SQ.PigeonFeeAuditRequestDto)">
|
||||
<summary>
|
||||
审核通过 - 扣除鸽子费并分配给已赴约用户
|
||||
</summary>
|
||||
<param name="request">审核请求参数</param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:CoreCms.Net.Web.Admin.Controllers.SQReservationsController.RejectPigeonFee(CoreCms.Net.Model.ViewModels.SQ.PigeonFeeAuditRequestDto)">
|
||||
<summary>
|
||||
审核未通过 - 退还鸽子费
|
||||
</summary>
|
||||
<param name="request">审核请求参数</param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:CoreCms.Net.Web.Admin.Controllers.SQRoomPricingController">
|
||||
<summary>
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,259 @@
|
|||
<title>鸽子费审核</title>
|
||||
|
||||
<!--当前位置开始-->
|
||||
<div class="layui-card layadmin-header">
|
||||
<div class="layui-breadcrumb" lay-filter="breadcrumb">
|
||||
<script type="text/html" template lay-done="layui.data.updateMainBreadcrumb();">
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
<!--当前位置结束-->
|
||||
<div style="font-size: 14px;color: #999;margin-left: 10px;">
|
||||
审核未按时赴约用户的鸽子费处理,审核通过则扣除并分配给已赴约用户,审核未通过则退还鸽子费
|
||||
</div>
|
||||
<style>
|
||||
/* 重写样式 */
|
||||
.audit-btn-approve { background-color: #009688; }
|
||||
.audit-btn-reject { background-color: #FF5722; }
|
||||
</style>
|
||||
|
||||
<div class="table-body">
|
||||
<table id="LAY-app-PigeonFeeAudit-tableBox" lay-filter="LAY-app-PigeonFeeAudit-tableBox"></table>
|
||||
</div>
|
||||
|
||||
<script type="text/html" id="LAY-app-PigeonFeeAudit-toolbar">
|
||||
<div class="layui-form coreshop-toolbar-search-form">
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label" for="reservation_id">预约ID</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="reservation_id" placeholder="请输入预约ID" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label" for="user_id">用户ID</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="user_id" placeholder="请输入用户ID" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label" for="keyword">用户信息</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="keyword" placeholder="昵称/手机号" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label" for="start_time_begin">预约时间</label>
|
||||
<div class="layui-input-inline" style="width: 260px;">
|
||||
<input type="text" name="start_time_begin" id="searchTime-PigeonFeeAudit-start_time" placeholder="请选择预约时间范围" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label" for="mark_time_begin">标记时间</label>
|
||||
<div class="layui-input-inline" style="width: 260px;">
|
||||
<input type="text" name="mark_time_begin" id="searchTime-PigeonFeeAudit-mark_time" placeholder="请选择标记时间范围" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<button class="layui-btn layui-btn-sm" lay-submit lay-filter="LAY-app-PigeonFeeAudit-search"><i class="layui-icon layui-icon-search"></i>筛选</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="LAY-app-PigeonFeeAudit-pagebar">
|
||||
<div class="layui-btn-container">
|
||||
<span style="color: #666; font-size: 13px;">提示:审核通过将扣除鸽子费并分配给已赴约用户,审核未通过将退还鸽子费</span>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="LAY-app-PigeonFeeAudit-tableBox-bar">
|
||||
<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="approve">审核通过</a>
|
||||
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="reject">审核未通过</a>
|
||||
</script>
|
||||
|
||||
<script>
|
||||
var debug = layui.setter.debug;
|
||||
var coreHelper;
|
||||
|
||||
layui.use(['index', 'table', 'laydate', 'util', 'coredropdown', 'coreHelper'],
|
||||
function () {
|
||||
var $ = layui.$
|
||||
, admin = layui.admin
|
||||
, table = layui.table
|
||||
, form = layui.form
|
||||
, laydate = layui.laydate
|
||||
, setter = layui.setter
|
||||
, util = layui.util
|
||||
, view = layui.view;
|
||||
coreHelper = layui.coreHelper;
|
||||
|
||||
var searchwhere;
|
||||
|
||||
// 监听搜索
|
||||
form.on('submit(LAY-app-PigeonFeeAudit-search)',
|
||||
function (data) {
|
||||
var field = data.field;
|
||||
searchwhere = field;
|
||||
// 执行重载
|
||||
table.reloadData('LAY-app-PigeonFeeAudit-tableBox', { where: field });
|
||||
});
|
||||
|
||||
// 数据绑定
|
||||
table.render({
|
||||
elem: '#LAY-app-PigeonFeeAudit-tableBox',
|
||||
url: layui.setter.apiUrl + 'Api/SQReservations/GetPigeonFeeAuditList',
|
||||
method: 'POST',
|
||||
toolbar: '#LAY-app-PigeonFeeAudit-toolbar',
|
||||
pagebar: '#LAY-app-PigeonFeeAudit-pagebar',
|
||||
className: 'pagebarbox',
|
||||
defaultToolbar: ['filter', 'print', 'exports'],
|
||||
height: 'full-127',
|
||||
page: true,
|
||||
limit: 30,
|
||||
limits: [10, 15, 20, 25, 30, 50, 100, 200],
|
||||
text: { none: '暂无待审核的鸽子费记录' },
|
||||
cols: [
|
||||
[
|
||||
{ field: 'participant_id', title: '参与者ID', width: 90, sort: false },
|
||||
{ field: 'reservation_id', title: '预约ID', width: 80, sort: false },
|
||||
{
|
||||
field: 'reservation_title', title: '预约标题', width: 150, sort: false, templet: function (d) {
|
||||
return d.reservation_title || '-';
|
||||
}
|
||||
},
|
||||
{ field: 'user_id', title: '用户ID', width: 80, sort: false },
|
||||
{
|
||||
field: 'nick_name', title: '用户昵称', width: 120, sort: false, templet: function (d) {
|
||||
return d.nick_name || '-';
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'mobile', title: '手机号', width: 120, sort: false, templet: function (d) {
|
||||
return d.mobile || '-';
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'deposit_fee', title: '鸽子费金额', width: 100, sort: false, templet: function (d) {
|
||||
return '<span style="color: #FF5722; font-weight: bold;">¥' + (d.deposit_fee || 0) + '</span>';
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'room_name', title: '房间', width: 120, sort: false, templet: function (d) {
|
||||
return d.room_name || '-';
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '预约时间', width: 170, sort: false, templet: function (d) {
|
||||
var startTime = d.start_time || '';
|
||||
var endTime = d.end_time || '';
|
||||
return '开始: ' + startTime + '<br/>结束: ' + endTime;
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'mark_time', title: '标记时间', width: 160, sort: false, templet: function (d) {
|
||||
return d.mark_time || '-';
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'is_arrive', title: '状态', width: 100, sort: false, templet: function (d) {
|
||||
if (d.is_arrive === 2) {
|
||||
return '<span class="layui-badge layui-bg-orange">待审核</span>';
|
||||
} else if (d.is_arrive === 3) {
|
||||
return '<span class="layui-badge layui-bg-green">已审核</span>';
|
||||
} else {
|
||||
return '<span class="layui-badge">' + d.is_arrive + '</span>';
|
||||
}
|
||||
}
|
||||
},
|
||||
{ title: '操作', fixed: 'right', width: 180, align: 'center', toolbar: '#LAY-app-PigeonFeeAudit-tableBox-bar' }
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 初始化日期选择器 - 预约时间
|
||||
laydate.render({
|
||||
elem: '#searchTime-PigeonFeeAudit-start_time',
|
||||
type: 'datetime',
|
||||
range: '到',
|
||||
done: function (value, date, endDate) {
|
||||
if (value) {
|
||||
var dates = value.split(' 到 ');
|
||||
$('input[name="start_time_begin"]').val(dates[0] || '');
|
||||
$('input[name="start_time_end"]').val(dates[1] || '');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// 初始化日期选择器 - 标记时间
|
||||
laydate.render({
|
||||
elem: '#searchTime-PigeonFeeAudit-mark_time',
|
||||
type: 'datetime',
|
||||
range: '到',
|
||||
done: function (value, date, endDate) {
|
||||
if (value) {
|
||||
var dates = value.split(' 到 ');
|
||||
$('input[name="mark_time_begin"]').val(dates[0] || '');
|
||||
$('input[name="mark_time_end"]').val(dates[1] || '');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// 隐藏的结束时间字段
|
||||
if (!$('input[name="start_time_end"]').length) {
|
||||
$('<input type="hidden" name="start_time_end">').appendTo('.coreshop-toolbar-search-form');
|
||||
}
|
||||
if (!$('input[name="mark_time_end"]').length) {
|
||||
$('<input type="hidden" name="mark_time_end">').appendTo('.coreshop-toolbar-search-form');
|
||||
}
|
||||
|
||||
// 监听行工具事件
|
||||
table.on('tool(LAY-app-PigeonFeeAudit-tableBox)', function (obj) {
|
||||
var data = obj.data;
|
||||
if (debug) { console.log(data); }
|
||||
|
||||
if (obj.event === 'approve') {
|
||||
// 审核通过
|
||||
layer.confirm('确定要审核通过吗?<br/><br/>审核通过后将扣除该用户的鸽子费(¥' + data.deposit_fee + '),并分配给已赴约的用户。', {
|
||||
title: '审核通过确认',
|
||||
icon: 3,
|
||||
btn: ['确定', '取消']
|
||||
}, function (index) {
|
||||
layer.close(index);
|
||||
coreHelper.Post('Api/SQReservations/ApprovePigeonFee', {
|
||||
participant_id: data.participant_id,
|
||||
reservation_id: data.reservation_id
|
||||
}, function (e) {
|
||||
if (e.code === 0) {
|
||||
layer.msg(e.msg, { icon: 1, time: 2000 });
|
||||
table.reloadData('LAY-app-PigeonFeeAudit-tableBox');
|
||||
} else {
|
||||
layer.msg(e.msg, { icon: 5, time: 2000 });
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
else if (obj.event === 'reject') {
|
||||
// 审核未通过
|
||||
layer.confirm('确定要审核未通过吗?<br/><br/>审核未通过后将退还该用户的鸽子费(¥' + data.deposit_fee + ')。', {
|
||||
title: '审核未通过确认',
|
||||
icon: 3,
|
||||
btn: ['确定', '取消']
|
||||
}, function (index) {
|
||||
layer.close(index);
|
||||
coreHelper.Post('Api/SQReservations/RejectPigeonFee', {
|
||||
participant_id: data.participant_id,
|
||||
reservation_id: data.reservation_id
|
||||
}, function (e) {
|
||||
if (e.code === 0) {
|
||||
layer.msg(e.msg, { icon: 1, time: 2000 });
|
||||
table.reloadData('LAY-app-PigeonFeeAudit-tableBox');
|
||||
} else {
|
||||
layer.msg(e.msg, { icon: 5, time: 2000 });
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
|
@ -160,7 +160,6 @@
|
|||
|
||||
### 5.1 页面路径
|
||||
- **建议路径**:`/views/sq/sqreservations/pigeon-fee-audit.html`
|
||||
- **或**:在现有的预约管理页面中新增一个标签页
|
||||
|
||||
### 5.2 功能按钮
|
||||
- **审核通过**:点击后弹出确认框,确认后执行审核通过流程
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit a58b4e431b60ff83fa9e66cb4d014417e5c423d9
|
||||
Subproject commit 316d1e2b5d7013d0b9f7507ac2f15ead5ff4d703
|
||||
Loading…
Reference in New Issue
Block a user