|
|
@@ -102,23 +102,24 @@ const maxQty = computed(() => {
|
|
|
|
|
|
// 损益
|
|
|
const closepl = computed(() => {
|
|
|
- const { presettle = 0, last = 0 } = quote.value ?? {}
|
|
|
- const { agreeUnit } = props.selectedRow
|
|
|
+ const quote = futuresStore.getGoodsQuote(props.selectedRow.tHDetailEx.goodsID)
|
|
|
+ const { ask = 0, bid = 0, agreeunit = 0 } = quote.value ?? {}
|
|
|
+ const price = props.selectedRow.tHDetailEx.buyOrSell === BuyOrSell.Buy ? bid : ask // 根据方向取买卖价
|
|
|
+
|
|
|
const { holderQty, holderAmount, buyOrSell } = props.selectedRow.tHDetailEx
|
|
|
- const goods = futuresStore.getGoods(props.selectedRow.goodsCode)
|
|
|
- const { currencyid } = goods ?? {}
|
|
|
- const { currencyid: tacurrencyid } = accountStore.currentAccount
|
|
|
- const price = last || presettle // 没有最新价取昨结价
|
|
|
+ // const goods = futuresStore.getGoods(props.selectedRow.goodsCode)
|
|
|
+ // const { currencyid } = goods ?? {}
|
|
|
+ // const { currencyid: tacurrencyid } = accountStore.currentAccount
|
|
|
|
|
|
// 查找汇率
|
|
|
let exchangerate = 1
|
|
|
- if (currencyid !== tacurrencyid) {
|
|
|
- const currency = userStore.userData.exchangeRateConfigs.find((e) => e.descurrencyid === tacurrencyid && e.oricurrencyid === currencyid)
|
|
|
- exchangerate = currency?.exchangerate ?? 0
|
|
|
- }
|
|
|
+ // if (currencyid !== tacurrencyid) {
|
|
|
+ // const currency = userStore.userData.exchangeRateConfigs.find((e) => e.descurrencyid === tacurrencyid && e.oricurrencyid === currencyid)
|
|
|
+ // exchangerate = currency?.exchangerate ?? 1
|
|
|
+ // }
|
|
|
|
|
|
// 计算市值 = 现价 * 数量 * 合约单位
|
|
|
- const marketValue = price ? price * holderQty * agreeUnit * exchangerate : 0
|
|
|
+ const marketValue = price ? price * holderQty * agreeunit * exchangerate : 0
|
|
|
return price ? (marketValue - holderAmount) * (buyOrSell === BuyOrSell.Buy ? 1 : -1) : 0
|
|
|
})
|
|
|
|