diff --git a/YLErpWeb/Views/SwapTrade2/tradeEndConfirmList.cshtml b/YLErpWeb/Views/SwapTrade2/tradeEndConfirmList.cshtml index 28fd4d8a..e9290c4e 100644 --- a/YLErpWeb/Views/SwapTrade2/tradeEndConfirmList.cshtml +++ b/YLErpWeb/Views/SwapTrade2/tradeEndConfirmList.cshtml @@ -31,6 +31,7 @@ + }
diff --git a/YLErpWeb/wwwroot/Scripts/app/swaptrade/tradeEndConfirmList.js b/YLErpWeb/wwwroot/Scripts/app/swaptrade/tradeEndConfirmList.js index f6ee26e4..e329f789 100644 --- a/YLErpWeb/wwwroot/Scripts/app/swaptrade/tradeEndConfirmList.js +++ b/YLErpWeb/wwwroot/Scripts/app/swaptrade/tradeEndConfirmList.js @@ -26,6 +26,11 @@ function showToolName(cellValue, options, rowObject) { //var disabled = pageData.canGenerate == true ? "" : "disabled"; //html += "" // .template(rowObject.swap_flow_event.EncryptId, rowObject.swap_flow_event.PayDate, "修改支付日期", disabled); + if (rowObject.ContractDocUrl && pageData.canSendEmail) { + html += + "" + .template(rowObject.swap_flow_event.EncryptId, rowObject.trade.StructureType, "发送Email"); + } return html; } diff --git a/YLErpWeb/wwwroot/Scripts/app/swaptrade/tradeEndConfirmSendEmail.js b/YLErpWeb/wwwroot/Scripts/app/swaptrade/tradeEndConfirmSendEmail.js new file mode 100644 index 00000000..afcab928 --- /dev/null +++ b/YLErpWeb/wwwroot/Scripts/app/swaptrade/tradeEndConfirmSendEmail.js @@ -0,0 +1,40 @@ +// 结算确认书:单行发送邮件(复用 /swaptrade2/BatchSendSettleEmail 服务端代理 → bond-oms Java 发信) +// 单独成文件,降低与 tradeEndConfirmList.js 的并发修改冲突;核心发送逻辑与网格渲染解耦,便于单测。 + +// 纯函数:根据加密平仓流水ID构造请求负载(不依赖 $.ajax / DOM),便于单元验证。 +function buildSettleEmailSendPayload(encryptId) { + return { url: "/swaptrade2/BatchSendSettleEmail", swapFlowEventIds: encryptId }; +} + +// 单行发送结算确认书邮件;encryptId 为空、或与批量 SendEmailEitherReport 一致地跳过"多空组合"时早退。 +function sendSettleEmail(encryptId, structureType) { + if (!encryptId) { + main.message("缺少平仓流水ID"); + return; + } + if (structureType === "多空组合") { + main.message("多空组合不支持发送结算确认书"); + return; + } + var payload = buildSettleEmailSendPayload(encryptId); + $.ajax({ + type: "post", + url: payload.url, + data: { swapFlowEventIds: payload.swapFlowEventIds }, + dataType: "json", + success: function (res) { + if (res && res.success) { + main.message(res.msg || "发送成功"); + SearchClick(); + } else { + main.message((res && (res.msg || res.message)) || "发送失败"); + } + }, + error: function (xhr) { + main.message("发送请求失败(HTTP " + xhr.status + "),请检查服务"); + console.error("[单行发送结算确认书] 请求失败:", xhr); + }, + beforeSend: function () { main.waitMe(true); }, + complete: function () { main.waitMe(false); } + }); +}