142 lines
6.8 KiB
Plaintext
142 lines
6.8 KiB
Plaintext
@model margin_ratio
|
|
@{
|
|
ViewBag.Title = "预付金系数 | 编辑";
|
|
Layout = "~/Views/Shared/_InfoLayout.cshtml";
|
|
var pageObj = new
|
|
{
|
|
isNew = Model.id == 0
|
|
};
|
|
}
|
|
@section CSS{
|
|
<style>
|
|
.form-layout input, .form-layout select { width: 220px; }
|
|
.form-layout .form-label, .form-layout .formlabel { width: 140px; }
|
|
</style>
|
|
}
|
|
@section JS{
|
|
<script src="~/Scripts/app/tradeHelper.js?v=@HtmlUtil.JsVersion"></script>
|
|
<script type="text/javascript">
|
|
|
|
const PercentFields = {
|
|
NormalInitialMarginRatio: '初始预付金率', NormalMarginRatio1: '临时预付金率1', NormalMarginRatio2: '临时预付金率2', NormalMarginRatio3: '临时预付金率3',
|
|
RedeemRatio1: '个股预付金率', RedeemRatio2: '指数预付金率', GroupRatio: '组合预付金率', RedeemPriceLimit1: '个股触发追保跌幅', RedeemPriceLimit2: '指数触发追保跌幅'
|
|
};
|
|
|
|
$(function () {
|
|
$(".datepicker").datepicker({
|
|
changeMonth: true,
|
|
changeYear: true,
|
|
showButtonPanel: true,
|
|
showOtherMonths: true,
|
|
selectOtherMonths: true
|
|
});
|
|
|
|
for (const [k, v] of Object.entries(PercentFields)) {
|
|
FastVue.numberInput(document.getElementById(k), { append: '%' });
|
|
}
|
|
});
|
|
|
|
function savemargin_ratio() {
|
|
let errors = [];
|
|
let data = $("#form1").serializeObject();
|
|
for (let [k, v] of Object.entries(PercentFields)) {
|
|
if (!data[k]) {
|
|
throw '程序错误';
|
|
}
|
|
let number = parseFloat(data[k]);
|
|
if (isNaN(number)) {
|
|
errors.push(v + " 请输入正确的数值");
|
|
}
|
|
else if (number < 0) {
|
|
errors.push(v + " 不能小于0");
|
|
} else {
|
|
data[k] = data[k].endsWith('%') ? number / 100 : number;
|
|
}
|
|
}
|
|
if (!isNaN(data.ValueDate) || isNaN(Date.parse(data.ValueDate))) {
|
|
errors.push("请输入有效的日期");
|
|
}
|
|
if (errors.length) {
|
|
let error = errors.map(x => '<p>' + x + '</p>').join("");
|
|
main.message(error);
|
|
return;
|
|
}
|
|
main.post("/margin_ratio/margin_ratioEditJson", data).done(function (res) {
|
|
window.location.href = "/margin_ratio/margin_ratioview?enid=" + res.obj.EncryptId;
|
|
try { window.parent.reloadmargin_ratio(); } catch (e) { }
|
|
});
|
|
}
|
|
</script>
|
|
}
|
|
<form id="form1" method="post" onsubmit="return false;">
|
|
<div class="form-layout">
|
|
@Html.HiddenFor(model => model.EncryptId)
|
|
<input type="hidden" value="@Model.id" name="id" id="id" />
|
|
<div class="form-group">
|
|
<label class="formlabel">初始预付金率</label>
|
|
<input class="text-box" type="text" value="@(Model.NormalInitialMarginRatio.OtcFormatPercent())" name="NormalInitialMarginRatio" id="NormalInitialMarginRatio">
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="formlabel">临时预付金率1</label>
|
|
<input class="text-box" type="text" value="@(Model.NormalMarginRatio1.OtcFormatPercent())" name="NormalMarginRatio1" id="NormalMarginRatio1">
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="formlabel">临时预付金率2</label>
|
|
<input class="text-box" type="text" value="@(Model.NormalMarginRatio2.OtcFormatPercent())" name="NormalMarginRatio2" id="NormalMarginRatio2">
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="formlabel">临时预付金率3</label>
|
|
<input class="text-box" type="text" value="@(Model.NormalMarginRatio3.OtcFormatPercent())" name="NormalMarginRatio3" id="NormalMarginRatio3">
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="formlabel">个股预付金率</label>
|
|
<input class="text-box" type="text" value="@(Model.RedeemRatio1.OtcFormatPercent())" name="RedeemRatio1" id="RedeemRatio1">
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="formlabel">指数预付金率</label>
|
|
<input class="text-box" type="text" value="@(Model.RedeemRatio2.OtcFormatPercent())" name="RedeemRatio2" id="RedeemRatio2">
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="formlabel">个股触发追保跌幅</label>
|
|
<input class="text-box" type="text" value="@(Model.RedeemPriceLimit1.OtcFormatPercent())" name="RedeemPriceLimit1" id="RedeemPriceLimit1">
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="formlabel">指数触发追保跌幅</label>
|
|
<input class="text-box" type="text" value="@(Model.RedeemPriceLimit2.OtcFormatPercent())" name="RedeemPriceLimit2" id="RedeemPriceLimit2">
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="formlabel">组合预付金率</label>
|
|
<input class="text-box" type="text" value="@(Model.GroupRatio.OtcFormatPercent())" name="GroupRatio" id="GroupRatio">
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label class="formlabel">总持仓名义本金</label>
|
|
<input class="text-box" type="number" min="0" step="1" value="@(Model.StockEqvNotional)" name="StockEqvNotional" id="StockEqvNotional">
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label class="formlabel">单一标的持仓名义本金</label>
|
|
<input class="text-box" type="number" min="0" step="1" value="@(Model.SingleStockEqvNotional)" name="SingleStockEqvNotional" id="SingleStockEqvNotional">
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label class="formlabel">持仓标的分散程度</label>
|
|
<input class="text-box" type="number" min="0" step="1" value="@(Model.PositionUnderlyingAmount)" name="PositionUnderlyingAmount" id="PositionUnderlyingAmount">
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label class="formlabel">持仓标的分散程度(自动赎回)</label>
|
|
<input class="text-box" type="number" min="0" step="1" value="@(Model.RedeemPositionUnderlyingAmount)" name="RedeemPositionUnderlyingAmount" id="RedeemPositionUnderlyingAmount">
|
|
</div>
|
|
|
|
<div class='form-group'>
|
|
<label class='formlabel'>日期</label>
|
|
<input id='ValueDate' class='text-box datepicker' type='text' value='@(Model.ValueDate.OtcFormatDate())' name='ValueDate' /> <span style='color:red'>*</span>
|
|
</div>
|
|
</div>
|
|
<div class="form-buttons">
|
|
<button class="btn btn-primary " type="button" onclick="savemargin_ratio();">保存</button>
|
|
<button class="btn btn-primary " type="button" onclick="layer.closeMe();">关闭</button>
|
|
</div>
|
|
</form>
|