diff --git a/src/Oms.Application/Dtos/Channels/SalesProductPublishSyncStatusOutput.cs b/src/Oms.Application/Dtos/Channels/SalesProductPublishSyncStatusOutput.cs index a5043d2..2fb18b4 100644 --- a/src/Oms.Application/Dtos/Channels/SalesProductPublishSyncStatusOutput.cs +++ b/src/Oms.Application/Dtos/Channels/SalesProductPublishSyncStatusOutput.cs @@ -20,6 +20,9 @@ public class SalesProductPublishSyncStatusOutput /// 线上快照内容哈希。 public string? OnlineContentHash { get; set; } + /// 是否已启用价格发布审批定义(前端发布弹窗文案切换用)。 + public bool ApprovalRequired { get; set; } + /// 是否存在在途价格审批(Pending)。 public bool ApprovalPending { get; set; } diff --git a/src/Oms.Application/Services/Channels/SalesProductService.cs b/src/Oms.Application/Services/Channels/SalesProductService.cs index e4fc840..f923a0d 100644 --- a/src/Oms.Application/Services/Channels/SalesProductService.cs +++ b/src/Oms.Application/Services/Channels/SalesProductService.cs @@ -38,6 +38,8 @@ public partial class SalesProductService : ApplicationService LazyServiceProvider.GetRequiredService(); private IApprovalTaskRepository ApprovalTaskRepository => LazyServiceProvider.GetRequiredService(); + private IApprovalDefinitionRepository ApprovalDefinitionRepository => + LazyServiceProvider.GetRequiredService(); /// /// 查询销售产品列表。 @@ -438,7 +440,8 @@ public partial class SalesProductService : ApplicationService ? OmsDocHelper.HashSalesProductPriceSnapshotForSync(currentSnapshot) : OmsDocHelper.HashSalesProductRulesSnapshotForSync(currentSnapshot)); - // 价格:在途审批,或最近一次失败终态(驳回/撤回/执行失败)供重新提交引导 + // 价格:是否启用审批定义 + 在途/失败终态 + var approvalRequired = false; var approvalPending = false; var approvalFailed = false; int? approvalInstanceId = null; @@ -447,6 +450,10 @@ public partial class SalesProductService : ApplicationService string? approvalComment = null; if (normalized == PriceOperatorType) { + var enabledDef = await ApprovalDefinitionRepository.FirstOrDefaultAsync(x => + x.OperationCode == ApprovalCodes.SalesProductPublishPrice && x.IsEnabled); + approvalRequired = enabledDef != null; + var approvalState = await ResolvePricePublishApprovalStateAsync(salesProductId); approvalPending = approvalState.Pending; approvalFailed = approvalState.Failed; @@ -501,6 +508,7 @@ public partial class SalesProductService : ApplicationService OnlinePublishTime = onlinePublishTime, PendingContentHash = currentHash, OnlineContentHash = onlineContentHash, + ApprovalRequired = approvalRequired, ApprovalPending = approvalPending, ApprovalFailed = approvalFailed, ApprovalInstanceId = approvalInstanceId,