feat: 修改委托后展示最新风险,四所持仓卡增加张数
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -873,6 +873,13 @@ function submitTpslEntrust(){
|
||||
alert(data.msg || '已提交');
|
||||
closeTpslEntrustModal();
|
||||
if(data.exchange_tpsl) paintExchangeTpslRow(orderId, data.exchange_tpsl);
|
||||
paintPlanTpslDisplay(orderId, data);
|
||||
paintLatestRiskDisplay(orderId, data);
|
||||
const rrEl = document.getElementById(`order-rr-${orderId}`);
|
||||
if(rrEl){
|
||||
const rr = data.display_rr_ratio != null && data.display_rr_ratio !== "" ? data.display_rr_ratio : data.planned_rr;
|
||||
rrEl.innerText = formatRrRatio(rr);
|
||||
}
|
||||
refreshPriceSnapshotConditional();
|
||||
}).catch(()=>alert('委托请求失败'));
|
||||
}
|
||||
@@ -944,6 +951,25 @@ function paintPlanTpslDisplay(orderId, snap){
|
||||
else if(tpDisp) card.setAttribute("data-plan-tp", tpDisp);
|
||||
}
|
||||
}
|
||||
function paintLatestRiskDisplay(orderId, snap){
|
||||
const wrap = document.getElementById(`order-latest-risk-wrap-${orderId}`);
|
||||
if(!wrap) return;
|
||||
const v = snap && snap.latest_risk_amount;
|
||||
const n = v != null && v !== "" ? Number(v) : NaN;
|
||||
if(Number.isFinite(n)){
|
||||
wrap.style.display = "inline-flex";
|
||||
wrap.textContent = `最新风险: ${n.toFixed(2)}U`;
|
||||
} else {
|
||||
wrap.style.display = "none";
|
||||
}
|
||||
}
|
||||
function paintContractsDisplay(orderId, snap){
|
||||
const el = document.getElementById(`order-contracts-${orderId}`);
|
||||
if(!el || !snap) return;
|
||||
const v = snap.contracts != null && snap.contracts !== "" ? snap.contracts : snap.order_amount;
|
||||
const n = v != null && v !== "" ? Number(v) : NaN;
|
||||
el.innerText = Number.isFinite(n) ? String(parseFloat(n.toFixed(4))) : "—";
|
||||
}
|
||||
|
||||
function paintPriceTrend(el, key, value){
|
||||
if(!el) return;
|
||||
@@ -1027,8 +1053,11 @@ function refreshPriceSnapshot(){
|
||||
}
|
||||
const rrEl = document.getElementById(`order-rr-${o.id}`);
|
||||
if(rrEl){
|
||||
rrEl.innerText = formatRrRatio(o.rr_ratio);
|
||||
const rr = o.display_rr_ratio != null && o.display_rr_ratio !== "" ? o.display_rr_ratio : o.rr_ratio;
|
||||
rrEl.innerText = formatRrRatio(rr);
|
||||
}
|
||||
paintLatestRiskDisplay(o.id, o);
|
||||
paintContractsDisplay(o.id, o);
|
||||
paintBreakevenBadge(o.id, o.sl_breakeven_secured);
|
||||
if(o.exchange_tpsl) paintExchangeTpslRow(o.id, o.exchange_tpsl);
|
||||
paintPlanTpslDisplay(o.id, o);
|
||||
|
||||
Reference in New Issue
Block a user