|
|
@@ -45,7 +45,7 @@
|
|
|
</li>
|
|
|
<li>
|
|
|
<span>参考损益:</span>
|
|
|
- <span>--</span>
|
|
|
+ <span :class="handlePriceColor(closepl(item))">{{ formatDecimal(closepl(item)) }}</span>
|
|
|
</li>
|
|
|
</ul>
|
|
|
</div>
|
|
|
@@ -66,11 +66,11 @@ import { queryTradeHolderDetail } from '@/services/api/order'
|
|
|
import { ETradeMode } from '@/constants/client';
|
|
|
import { Button } from 'vant'
|
|
|
import { getBuyOrSellName } from '@/constants/order'
|
|
|
-import { formatDate, formatDecimal, handleRequestBigNumber } from '@/filters'
|
|
|
+import { formatDate, formatDecimal, handleRequestBigNumber, handlePriceColor } from '@/filters'
|
|
|
import { useHolderClose } from '@/business/trade'
|
|
|
import { dialog, fullloading } from '@/utils/vant'
|
|
|
import { useFuturesStore } from '@/stores'
|
|
|
-
|
|
|
+import { BuyOrSell } from '@/constants/order'
|
|
|
import quoteSocket from '@/services/websocket/quote'
|
|
|
import AppModal from '@/components/base/modal/index.vue'
|
|
|
import AppPullRefresh from '@mobile/components/base/pull-refresh/index.vue'
|
|
|
@@ -91,6 +91,17 @@ const props = defineProps({
|
|
|
required: true,
|
|
|
}
|
|
|
})
|
|
|
+/// 当前行情
|
|
|
+const quote = futuresStore.getGoodsQuote(props.selectedRow.goodscode)
|
|
|
+// 损益
|
|
|
+const closepl = (row: Model.TradeHolderDetailRsp) => {
|
|
|
+ const { presettle = 0, last = 0 } = quote.value ?? {}
|
|
|
+ const { holderqty, holderamount, agreeunit, buyorsell } = row
|
|
|
+ const price = last || presettle // 没有最新价取昨结价
|
|
|
+ // 计算市值 = 现价 * 数量 * 合约单位
|
|
|
+ const marketValue = price ? price * holderqty * agreeunit : 0
|
|
|
+ return price ? (marketValue - holderamount) * (buyorsell === BuyOrSell.Buy ? 1 : -1) : 0
|
|
|
+}
|
|
|
|
|
|
const { loading, pageIndex, pageCount, run } = useRequest(queryTradeHolderDetail, {
|
|
|
params: {
|