170 lines
7.7 KiB
Plaintext
170 lines
7.7 KiB
Plaintext
@model TradeViewModel
|
|
|
|
@{
|
|
if (Model.IsStructureTrade)
|
|
{
|
|
return;
|
|
}
|
|
var tradeModel = Model.Trade;
|
|
var IsGenerateConfirmDoc = false;
|
|
if (Model.IsGenerateConfirmDoc)
|
|
{
|
|
IsGenerateConfirmDoc = true;
|
|
}
|
|
else
|
|
{
|
|
IsGenerateConfirmDoc = tradeModel.TradeStatus == ConsTrade.确认成交;
|
|
}
|
|
|
|
|
|
var canEdit = tradeModel.SwapCanEdit() && CurUser.交易管理_交易编辑;
|
|
var canGenerate = CurUser.结算管理_交易确认书生成;
|
|
var canEditNotEditPower = ConsTrade.已拒绝 == tradeModel.TradeStatus && tradeModel.TraderId == CurUser.UserId;
|
|
var longShort = Model.Trade.StructureType == ClientMarginTypeEnum.多空组合.ToString();
|
|
var tradeStatusArr = new[] { ConsTrade.确认成交, ConsTrade.已平仓, ConsTrade.已执行, ConsTrade.已到期 };
|
|
var canBackTrade = CurUser.交易管理_交易回退 && tradeStatusArr.Contains(tradeModel.TradeStatus);
|
|
bool hasPosition = hasPosition = tradeModel.swap_positions.Any(x => !x.IsInitial&&x.PosiQuantity>0);
|
|
}
|
|
|
|
<div class="toolbarDiv">
|
|
|
|
@if (!Model.IsOnlyCloseButton)
|
|
{
|
|
if (canEdit || canEditNotEditPower)
|
|
{
|
|
@MyControls.Btn("修改", string.Format("editTrade('{0}')", tradeModel.EncryptId))
|
|
}
|
|
else if (tradeStatusArr.Contains(tradeModel.TradeStatus))
|
|
{
|
|
@MyControls.Btn("修改备注", string.Format("editTradeRemarkInfo('{0}','{1}')", tradeModel.EncryptId, tradeModel.TradeType))
|
|
}
|
|
|
|
if (tradeModel.CanDelete() && CurUser.交易管理_交易删除)
|
|
{
|
|
@MyControls.Btn("删除", "deletetrade('" + tradeModel.EncryptId + "');")
|
|
}
|
|
|
|
if (CurUser.结算管理_交易确认书查看)
|
|
{
|
|
@MyControls.Btn("文件管理", "contractManagement('" + tradeModel.TradeNumber + "')")
|
|
}
|
|
|
|
if (canBackTrade)
|
|
{
|
|
@MyControls.Btn("交易回退", "backTrade('" + tradeModel.EncryptId + "')")
|
|
}
|
|
|
|
if (CurUser.交易管理_交易操作历史)
|
|
{
|
|
<div class="d-inline-block">
|
|
<div class="dropdown">
|
|
<button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown">操作历史</button>
|
|
<div class="dropdown-menu">
|
|
<a href="javascript:;" class="dropdown-item" onclick="tradeOperationHistory('@(tradeModel.EncryptId)')">交易操作</a>
|
|
<a href="javascript:;" class="dropdown-item" onclick="tradeTrialHistory('@(tradeModel.ParentTradeId == 0 ? tradeModel.id : tradeModel.ParentTradeId)')">限额试算</a>
|
|
<a href="javascript:;" class="dropdown-item" onclick="SubmissionFieldsHistory('@(tradeModel.EncryptId)')">报送相关字段填写</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
}
|
|
@MyControls.Btn("报送相关字段填写", "SubmissionFields('" + tradeModel.EncryptId + "')")
|
|
}
|
|
else if (!string.IsNullOrWhiteSpace(Context.Request.Query["fromZiJinMingXi"]))
|
|
{
|
|
if (PS.Config.IsAutoGenerateContracts)
|
|
{
|
|
@MyControls.Btn("文件管理", "contractManagement('" + tradeModel.TradeNumber + "')")
|
|
}
|
|
else
|
|
{
|
|
@MyControls.Btn("文件管理", "fileManagement('" + tradeModel.TradeNumber + "');")
|
|
}
|
|
if (CurUser.交易管理_交易操作历史)
|
|
{
|
|
<div class="d-inline-block">
|
|
<div class="dropdown">
|
|
<button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown">操作历史</button>
|
|
<div class="dropdown-menu">
|
|
<a href="javascript:;" class="dropdown-item" onclick="tradeOperationHistory('@(tradeModel.EncryptId)')">交易操作</a>
|
|
@*<a href="javascript:;" class="dropdown-item" onclick="tradeTrialHistory('@(tradeModel.id)')">限额试算</a>*@
|
|
</div>
|
|
</div>
|
|
</div>
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (CurUser.交易管理_交易操作历史)
|
|
{
|
|
<div class="d-inline-block">
|
|
<div class="dropdown">
|
|
<button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown">操作历史</button>
|
|
<div class="dropdown-menu">
|
|
<a href="javascript:;" class="dropdown-item" onclick="tradeOperationHistory('@(tradeModel.EncryptId)')">交易操作</a>
|
|
@*<a href="javascript:;" class="dropdown-item" onclick="tradeTrialHistory('@(tradeModel.id)')">限额试算</a>*@
|
|
</div>
|
|
</div>
|
|
</div>
|
|
}
|
|
}
|
|
@if (tradeModel.TradeStatus == ConsTrade.审批中 && CurUser.交易管理_交易新增)
|
|
{
|
|
@MyControls.Btn("撤回", string.Format("traderevoke('{0}')", tradeModel.EncryptId))
|
|
}
|
|
else if (tradeModel.TradeStatus == ConsTrade.平仓待复核 && CurUser.交易管理_交易平仓)
|
|
{
|
|
@MyControls.Btn("撤回", string.Format("traderevoke('{0}')", tradeModel.EncryptId))
|
|
}
|
|
else if (tradeModel.TradeStatus == ConsTrade.互换待复核 && CurUser.交易管理_收益互换)
|
|
{
|
|
@MyControls.Btn("撤回", string.Format("traderevoke('{0}')", tradeModel.EncryptId))
|
|
}
|
|
|
|
<button class="btn btn-primary" type="button" onclick="closetradeWindow(@(!string.IsNullOrWhiteSpace(Context.Request.Query["abstract"])?1:0));">关闭</button>
|
|
|
|
<div style="display:inline-block;float:right;">
|
|
@if (!Model.IsOnlyCloseButton)
|
|
{
|
|
if (valuedateBLL.SystemDate.TradeTrial && (tradeModel.TradeStatus == ConsTrade.新增待确认 || tradeModel.TradeStatus == ConsTrade.修改待确认))
|
|
{
|
|
@MyControls.Btn("限额试算", "quotaTrial('" + tradeModel.id + "')")
|
|
}
|
|
if (tradeModel.CanConfirm() && CurUser.交易管理_交易新增)
|
|
{
|
|
@MyControls.Btn("确认交易", "confirmTrade('" + tradeModel.id + "')")
|
|
}
|
|
if (!longShort && hasPosition && tradeModel.TradeStatus == ConsTrade.提前终止拒绝 && CurUser.交易管理_交易平仓)
|
|
{
|
|
@MyControls.Btn("提前终止放弃", "terminationBackToConfirmed('" + tradeModel.EncryptId + "')")
|
|
}
|
|
if (!longShort && hasPosition && tradeModel.CanSwapTradeUnwind() && CurUser.交易管理_交易平仓)
|
|
{
|
|
@MyControls.Btn("平仓", string.Format("unWindSwapTrade('{0}')", tradeModel.EncryptId))
|
|
}
|
|
if (longShort && !hasPosition && tradeModel.CanSwapTradeUnwind() && CurUser.交易管理_交易平仓)
|
|
{
|
|
@MyControls.Btn("平仓", string.Format("unWindSwapLongShort('{0}')", tradeModel.EncryptId))
|
|
}
|
|
if (tradeModel.CanSwapTradeUnwind() && CurUser.交易管理_收益互换)
|
|
{
|
|
@MyControls.Btn("展期信息", string.Format("extensionTime('{0}')", tradeModel.EncryptId))
|
|
}
|
|
if (!longShort && hasPosition && tradeModel.CanSwapTradeUnwind() && CurUser.交易管理_收益互换)
|
|
{
|
|
@MyControls.Btn("收益结算", string.Format("unWindSwap('{0}')", tradeModel.EncryptId))
|
|
}
|
|
if (longShort && hasPosition && tradeModel.CanSwapTradeUnwind() && CurUser.交易管理_收益互换)
|
|
{
|
|
@MyControls.Btn("收益结算", string.Format("unWindLongShortSwap('{0}')", tradeModel.EncryptId))
|
|
}
|
|
@if (CurUser.交易管理_交易续作)
|
|
{
|
|
@MyControls.Btn("续作", string.Format("renewTrade('{0}')", tradeModel.EncryptId))
|
|
}
|
|
}
|
|
</div>
|
|
|
|
</div>
|
|
|
|
@Html.HiddenFor(model => tradeModel.id)
|