feat: 完成营销中心优惠券后端模块
All checks were successful
Build and Deploy TenantApi + SkuWorker / build-and-deploy (push) Successful in 1m54s

This commit is contained in:
2026-02-28 11:14:55 +08:00
parent 04e76cd519
commit dda3f96d28
26 changed files with 11107 additions and 0 deletions

View File

@@ -0,0 +1,92 @@
namespace TakeoutSaaS.Application.App.Coupons.Dto;
/// <summary>
/// 优惠券模板详情 DTO。
/// </summary>
public sealed class CouponTemplateDetailDto
{
/// <summary>
/// 模板 ID。
/// </summary>
public long Id { get; init; }
/// <summary>
/// 券名称。
/// </summary>
public string Name { get; init; } = string.Empty;
/// <summary>
/// 券类型amount_off/discount/free_delivery
/// </summary>
public string CouponType { get; init; } = "amount_off";
/// <summary>
/// 面值或折扣值。
/// </summary>
public decimal Value { get; init; }
/// <summary>
/// 使用门槛。
/// </summary>
public decimal? MinimumSpend { get; init; }
/// <summary>
/// 发放总量。
/// </summary>
public int TotalQuantity { get; init; }
/// <summary>
/// 已领取数量。
/// </summary>
public int ClaimedQuantity { get; init; }
/// <summary>
/// 每人限领。
/// </summary>
public int? PerUserLimit { get; init; }
/// <summary>
/// 有效期类型fixed/days
/// </summary>
public string ValidityType { get; init; } = "fixed";
/// <summary>
/// 固定有效期开始。
/// </summary>
public DateTime? ValidFrom { get; init; }
/// <summary>
/// 固定有效期结束。
/// </summary>
public DateTime? ValidTo { get; init; }
/// <summary>
/// 领取后有效天数。
/// </summary>
public int? RelativeValidDays { get; init; }
/// <summary>
/// 渠道列表delivery/pickup/dine_in
/// </summary>
public IReadOnlyList<string> Channels { get; init; } = [];
/// <summary>
/// 门店范围模式all/stores
/// </summary>
public string StoreScopeMode { get; init; } = "stores";
/// <summary>
/// 门店范围 ID 列表。
/// </summary>
public IReadOnlyList<long> StoreIds { get; init; } = [];
/// <summary>
/// 编辑状态enabled/disabled
/// </summary>
public string Status { get; init; } = "enabled";
/// <summary>
/// 更新时间。
/// </summary>
public DateTime UpdatedAt { get; init; }
}

View File

@@ -0,0 +1,97 @@
namespace TakeoutSaaS.Application.App.Coupons.Dto;
/// <summary>
/// 优惠券模板列表项 DTO。
/// </summary>
public sealed class CouponTemplateListItemDto
{
/// <summary>
/// 模板 ID。
/// </summary>
public long Id { get; init; }
/// <summary>
/// 券名称。
/// </summary>
public string Name { get; init; } = string.Empty;
/// <summary>
/// 券类型amount_off/discount/free_delivery
/// </summary>
public string CouponType { get; init; } = "amount_off";
/// <summary>
/// 面值或折扣值。
/// </summary>
public decimal Value { get; init; }
/// <summary>
/// 使用门槛。
/// </summary>
public decimal? MinimumSpend { get; init; }
/// <summary>
/// 固定时间开始。
/// </summary>
public DateTime? ValidFrom { get; init; }
/// <summary>
/// 固定时间结束。
/// </summary>
public DateTime? ValidTo { get; init; }
/// <summary>
/// 领取后有效天数。
/// </summary>
public int? RelativeValidDays { get; init; }
/// <summary>
/// 发放总量。
/// </summary>
public int TotalQuantity { get; init; }
/// <summary>
/// 已领取数量。
/// </summary>
public int ClaimedQuantity { get; init; }
/// <summary>
/// 已核销数量。
/// </summary>
public int RedeemedQuantity { get; init; }
/// <summary>
/// 每人限领。
/// </summary>
public int? PerUserLimit { get; init; }
/// <summary>
/// 展示状态ongoing/upcoming/ended/disabled
/// </summary>
public string DisplayStatus { get; init; } = "ongoing";
/// <summary>
/// 是否弱化展示。
/// </summary>
public bool IsDimmed { get; init; }
/// <summary>
/// 门店范围模式all/stores
/// </summary>
public string StoreScopeMode { get; init; } = "stores";
/// <summary>
/// 门店范围 ID 列表。
/// </summary>
public IReadOnlyList<long> StoreIds { get; init; } = [];
/// <summary>
/// 渠道列表delivery/pickup/dine_in
/// </summary>
public IReadOnlyList<string> Channels { get; init; } = [];
/// <summary>
/// 更新时间。
/// </summary>
public DateTime UpdatedAt { get; init; }
}

View File

@@ -0,0 +1,32 @@
namespace TakeoutSaaS.Application.App.Coupons.Dto;
/// <summary>
/// 优惠券模板列表结果 DTO。
/// </summary>
public sealed class CouponTemplateListResultDto
{
/// <summary>
/// 列表数据。
/// </summary>
public IReadOnlyList<CouponTemplateListItemDto> Items { get; init; } = [];
/// <summary>
/// 总条数。
/// </summary>
public int TotalCount { get; init; }
/// <summary>
/// 页码。
/// </summary>
public int Page { get; init; }
/// <summary>
/// 每页条数。
/// </summary>
public int PageSize { get; init; }
/// <summary>
/// 统计信息。
/// </summary>
public CouponTemplateStatsDto Stats { get; init; } = new();
}

View File

@@ -0,0 +1,32 @@
namespace TakeoutSaaS.Application.App.Coupons.Dto;
/// <summary>
/// 优惠券统计 DTO。
/// </summary>
public sealed class CouponTemplateStatsDto
{
/// <summary>
/// 优惠券总数。
/// </summary>
public int TotalCount { get; init; }
/// <summary>
/// 进行中数量。
/// </summary>
public int OngoingCount { get; init; }
/// <summary>
/// 已领取总数。
/// </summary>
public int ClaimedCount { get; init; }
/// <summary>
/// 已核销总数。
/// </summary>
public int RedeemedCount { get; init; }
/// <summary>
/// 核销率(百分比)。
/// </summary>
public decimal RedeemRate { get; init; }
}