Files
zszq-trs/YLErpWeb/Views/trade_cash/executionTradeCash.cshtml
T
2024-05-09 14:06:26 +08:00

225 lines
12 KiB
Plaintext

@model trade_cash
@{
Layout = "~/Views/Shared/_InfoLayout.cshtml";
bool isShowReCheckClose = ViewBag.IsShowReCheckClose;
bool isReCheckConfirm = ViewBag.IsReCheckConfirm;
bool isUseApproval = ViewBag.isUseApproval;
trade pairtrade = ViewBag.PairTrade;
trade trade = ViewBag.Trade;
var pageObj = new
{
isExpire = (bool)ViewBag.IsExpire,
valueDate = Model.ValueDate.ToString("yyyy-MM-dd"),
IsUsePremiumRate = trade.IsUsePremiumRate == true,
OriginalNotional = trade.OriginalNotional ?? 0,
Notional = trade.Notional,
StockEqvNotional = Model.StockEqvNotional,
OriginalStockEqvNotional = Model.OriginalStockEqvNotional,
ExerciseDate = trade.ExerciseDate?.ToString("yyyy-MM-dd") ?? "",
Model = Model,
isCustomTrade = trade.TradeType=="自定义交易"
};
}
@section CSS{
<style>
.formlabel {
float: left;
}
</style>
}
@section JS{
<script>
const page = @Json.Serialize(pageObj);
var g_isUseApproval = "@isUseApproval" == "True";
//otcformat禁止千分位分组
window.otcformat.options.disableGrouping = true;
</script>
<script src="~/Scripts/app/trade/executionTradeCash.js?v=@(HtmlUtil.JsVersion)"></script>
}
@using (Html.BeginForm("trade_cashEdit", "trade_cash", FormMethod.Post, new { id = "trade_cashEditForm", autocomplete = "off" }))
{
<div class="yc-panel">
<div class="row">
<!--目前框架新增和修改同一界面,造成的问题就是输入的字段新增和修改都一样-->
@if (Model != null)
{
<input type="hidden" value="@Model.id" name="id" id="id" />
<input type="hidden" value="@Model.TradeId" name="TradeId" id="TradeId" />
}
@Html.HiddenFor(model => model.EncryptId)
@Html.HiddenFor(model => model.TradeId)
@Html.HiddenFor(model => model.Trade_TradeType)
@Html.HiddenFor(model => model.IsExpire)
@Html.HiddenFor(model => model.IsUnwindStockEqvNotional)
@Html.HiddenFor(model => model.CallPut)
@Html.MyDropdownFor1(model => model.ExceciseType, GlobalData.GetSelectItems(new string[] { "现金" }), new { }, "", false)
@Html.MyTextFor(model => model.UnderlyingCode, new { disabled = "disabled" })
@Html.MyTextFor(model => model.UnderlyingName, new { disabled = "disabled" })
@Html.MyTextFor(model => model.TradeType, new { disabled = "disabled" })
@Html.MyTextFor(model => model.CallPutDesc, new { disabled = "disabled" })
@if (Model.Trade_TradeType == "结构化交易")
{
if (Model.IsMoneynessOption)
{
@Html.MyDecimalFor(model => model.InitialSpotPrice, new { disabled = "disabled" })
}
@Html.HiddenFor(model => model.Strike)
@Html.MyDecimalFor(model => model.StrikeString, new { disabled = "disabled" })
@Html.MyDecimalFor(model => model.StrikeTwoString, new { disabled = "disabled" })
}
else
{
<!--亚式期权特殊处理,亚式期权并且是浮动行权价则行权价字段可设置-->
if (Model.OptionType == "亚式期权" && Model.StrikeType == "Floating")
{
@Html.MyTextFor(model => model.Strike, new { onblur = "changeTradePrice(true, false)" })
}
else
{
if (Model.IsMoneynessOptionData)
{
@Html.MyDecimalFor(model => model.InitialSpotPrice, new { disabled = "disabled" })
@Html.MyDecimalFor(model => model.ValidStrike, new { disabled = "disabled" })
@Html.HiddenFor(model => model.Strike)
}
else
{
@Html.MyDecimalFor(model => model.Strike, new { disabled = "disabled" })
}
}
}
@if (!PS.Config.Is东兴)
{
<div class="form-group col-md-6">
<label class="formlabel" for="Notional">份额</label><input id="Notional" class="text-box" onkeyup="this.value=this.value.replace(/[^0-9.-]/g,'')" onblur="this.value=(/^(-?0|-?[1-9]\d*)(\.\d*)?$/.test(this.value) ? this.value : '')" data-val-required="请输入数值" type="text" value="@(Model.Notional.OtcFormatNotional())" name="Notional" disabled="disabled">
<span class="field-validation-valid" data-valmsg-for="Notional" data-valmsg-replace="true"></span>
</div>
if (pageObj.isExpire)
{
@Html.MyTextFor(model => model.UnwindType, new { disabled = "disabled" });
}
else
{
@Html.MyDropdownFor1(model => model.UnwindType, GlobalData.GetSelectItems(new List<string>() { "全部行权", "部分行权" }), new { onchange = "changeUnwindType()" }, "", false)
}
<div class="form-group col-md-6" @(trade.IsUsePremiumRate == true && Model.IsUnwindStockEqvNotional != true ? "" : "style=display:none;")>
<label class="formlabel" for="UnwindPercentRate">行权比例</label>
<input id="UnwindPercentRate" class="text-box" type="text" value="@Model.UnwindPercentRate" name="UnwindPercentRate" onblur="changeTradePrice(true, false)"><span onclick="exchangeToUnwindStockEqvNotional()">%</span>
<span class="field-validation-valid" data-valmsg-for="UnwindPercentRate" data-valmsg-replace="true"></span>
</div>
<div class="form-group col-md-6" @(trade.IsUsePremiumRate == true && Model.IsUnwindStockEqvNotional == true ? "" : "style=display:none;")>
<label class="formlabel" for="UnwindPercentRate">行权名义本金</label>
<input id="UnwindStockEqvNotional" class="text-box" type="text" value="@Model.UnwindStockEqvNotional" name="UnwindStockEqvNotional" onblur="changeTradePrice(true, false)"><span onclick="exchangeToUnwindPercentRate()">¥</span>
<span class="field-validation-valid" data-valmsg-for="UnwindStockEqvNotional" data-valmsg-replace="true"></span>
</div>
<div class="form-group col-md-6" @(trade.IsUsePremiumRate == true ? "style=display:none;" : "")>
<label class="formlabel" for="UnwindNotional">行权份额</label>
<input id="UnwindNotional" class="text-box" type="text" value="@Model.UnwindNotional" name="UnwindNotional" onblur="changeTradePrice(true, false)">
<span class="field-validation-valid" data-valmsg-for="UnwindNotional" data-valmsg-replace="true"></span>
</div>
}
@if (Model.OptionType == "亚式期权")
{
<div class="form-group col-md-6">
<label class="formlabel" for="SpotPrice">标的现价</label><input id="SpotPrice" readonly class="text-box valid" type="text" value="@Model.SpotPrice" name="SpotPrice" aria-invalid="false">
<span class="field-validation-valid" data-valmsg-for="SpotPrice" data-valmsg-replace="true"></span>
</div>
<div class="form-group col-md-6">
<label class="formlabel" for="FinalPrice">标的均价</label><input id="FinalPrice" class="text-box valid" type="text" value="@Model.FinalPrice" name="FinalPrice" onblur="changeTradePrice(true, false)" aria-invalid="false">
<span class="field-validation-valid" data-valmsg-for="FinalPrice" data-valmsg-replace="true"></span>
</div>
}
else
{
<div class="form-group col-md-6">
<label class="formlabel" for="FinalPrice">标的价格</label><input id="FinalPrice" class="text-box valid" type="text" value="@Model.FinalPrice" name="FinalPrice" onblur="changeTradePrice(true, false)" aria-invalid="false">
<span class="field-validation-valid" data-valmsg-for="FinalPrice" data-valmsg-replace="true"></span>
</div>
}
<div class="form-group col-md-6">
<label class="formlabel" for="UnwindPrice">行权收益</label>
<input id="UnwindPrice" class="text-box" data-val-required="请输入数值" type="text" value="@Model.UnwindPrice" onchange="changeUnwindPrice()" name="UnwindPrice" data-val="true" @(pageObj.isCustomTrade?"":"disabled")> <span style="color:red">*</span>
<span class="field-validation-valid" data-valmsg-for="UnwindPrice" data-valmsg-replace="true"></span>
</div>
@Html.MyDecimalFor(model => model.InitialAmount, new { disabled = "disabled" })
@Html.MyTextFor(model => model.ExerciseCostRatio, new { disabled = "disabled" })
@Html.MyTextFor(model => model.ExtraAmount, new { onchange = "changeExtraAmount()" })
@Html.MyDecimalFor(model => model.Amount, new { disabled = "disabled" })
<div class="form-group col-md-6">
<label class="formlabel" for="StockEqvNotional">名义本金</label>
<input readonly="readonly" id="StockEqvNotional" class="text-box" onkeyup="this.value=this.value.replace(/[^0-9.-]/g,'')" onblur="this.value=(/^(-?0|-?[1-9]\d*)(\.\d*)?$/.test(this.value) ? this.value : '')" data-val-required="请输入数值" type="text" value="@(trade.StockEqvNotional.OtcFormat(OtcFormatFlag.StockEqvNotional))" disabled="disabled">
</div>
@if (Model.DurationDays > 0)
{
@Html.MyDecimalFor(model => model.DurationDays, new { disabled = "disabled" })
}
@if (PS.Config.ErpElement.CanSetTradePremium)
{
@Html.MyDecimalFor(model => model.TradePremium, new { }, isPercent: true)
}
@if (pageObj.isExpire && !isReCheckConfirm)
{
<div class='form-group col-md-6'>
<label class='formlabel' for='TradeStatus'>交易状态</label>
<select id="TradeStatus" name="TradeStatus">
<option value="已到期">已到期</option>
<option value="已执行">已执行</option>
</select>
</div>
}
</div>
<hr />
<div class="form-buttons">
@if (isShowReCheckClose)
{
if (YLErp.PS.Config.ComponentVersion == YLErp.Configuration.ComponentVersion.Broker)
{
if (pairtrade != null)
{
<span title="配对交易编号: @pairtrade.TradeNumber">执行配对交易</span><input value="true" type="checkbox" id="IsUnwindPairTrade" name="IsUnwindPairTrade" />
}
}
//需要行权审核
@MyControls.Btn("行权审核提交", "applyExerciseRecheck()", "", "ExecBtnRecheck")
}
else
{
if (isReCheckConfirm)
{
if (isUseApproval)
{
@MyControls.Btn("审批通过", "submitApproval('pass')")
@MyControls.Btn("拒绝", "submitApproval('reject')")
}
else
{
@MyControls.Btn("复核", "savetrade_cash('复核')")
@MyControls.Btn("拒绝", "denyRecheck()")
}
}
else
{
if (YLErp.PS.Config.ComponentVersion == YLErp.Configuration.ComponentVersion.Broker)
{
if (pairtrade != null)
{
<span title="配对交易编号: @pairtrade.TradeNumber">执行配对交易</span><input value="true" type="checkbox" id="IsUnwindPairTrade" name="IsUnwindPairTrade" />
}
}
@MyControls.Btn("执行", "savetrade_cash()", "", "ExecBtn")
}
}
@MyControls.Btn("取消", "layer.closeMe()")
</div>
</div>
}