admin/src/Oms.Application/Dtos/Orders/OrderPayDtos.cs
zzh 223d32f62a
All checks were successful
Build and Deploy / deploy (push) Successful in 1m3s
feat: 订单支付时选券,新增支付预览接口并按所选券扣款核销
- 新增 GET /order/pay-preview:返回会员折/券互斥后的应付拆解与本单可选券
- POST /order/pay 支持 couponInstanceId(null 沿用已绑定券,0 不用券,>0 指定券),按试算应付扣款并核销券、释放被替换券的锁定
- 被当前订单锁定的券视为可用,修复入库/编辑重算营销金额时误报券被占用

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-19 14:01:00 +08:00

82 lines
2.2 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using Oms.Application.Dtos.Marketing;
namespace Oms.Application.Dtos.Orders;
/// <summary>
/// 订单支付入参(支付时选券)。
/// </summary>
public class OrderPayInput : OrderActionInput
{
/// <summary>
/// 选用的优惠券实例 Id:null 沿用订单已绑定的券(不可用则不使用);0 不使用券;大于 0 使用指定券。
/// </summary>
public int? CouponInstanceId { get; set; }
}
/// <summary>
/// 订单支付预览入参。
/// </summary>
public class OrderPayPreviewInput
{
/// <summary>
/// 订单主键。
/// </summary>
public int Id { get; set; }
/// <summary>
/// 试算用券:null 自动推荐(优先已绑定券,否则选优惠最大且优于会员折的券);0 不使用券;大于 0 使用指定券。
/// </summary>
public int? CouponInstanceId { get; set; }
}
/// <summary>
/// 订单支付预览:应付拆解与可选券。
/// </summary>
public class OrderPayPreviewOutput
{
/// <summary>
/// 订单主键。
/// </summary>
public int Id { get; set; }
/// <summary>
/// 应收小计(折前)。
/// </summary>
public decimal ReceivableSubtotal { get; set; }
/// <summary>
/// 基础运费(券门槛与抵扣口径)。
/// </summary>
public decimal BaseFreightAmount { get; set; }
/// <summary>
/// 会员折扣金额(与券互斥,用券时为 0)。
/// </summary>
public decimal LevelDiscountAmount { get; set; }
/// <summary>
/// 优惠券抵扣金额。
/// </summary>
public decimal CouponDiscountAmount { get; set; }
/// <summary>
/// 实际应付金额(支付扣款金额)。
/// </summary>
public decimal PayableAmount { get; set; }
/// <summary>
/// 会员等级名称。
/// </summary>
public string? MemberLevelName { get; set; }
/// <summary>
/// 本次试算实际生效的券实例 Id;为空表示未用券。
/// </summary>
public int? AppliedCouponInstanceId { get; set; }
/// <summary>
/// 当前客户可选券(CanUse=false 时附不可用原因,含「优惠不高于会员折扣」)。
/// </summary>
public List<CouponAvailableOutput> AvailableCoupons { get; set; } = [];
}