|
|
@@ -5,6 +5,14 @@
|
|
|
<template #buyorsell="{ value }">
|
|
|
{{ getBuyOrSellName(value) }}
|
|
|
</template>
|
|
|
+ <!-- 最新价 -->
|
|
|
+ <template #last="{ row }">
|
|
|
+ {{ last(row) }}
|
|
|
+ </template>
|
|
|
+ <!-- 浮动盈亏-->
|
|
|
+ <template #closepl="{ row }">
|
|
|
+ <span :class="lastColor(row.goodscode)">{{ closepl(row) }}</span>
|
|
|
+ </template>
|
|
|
<!-- 展开行 -->
|
|
|
<template #expand>
|
|
|
<div class="buttonbar">
|
|
|
@@ -20,12 +28,30 @@
|
|
|
<script lang="ts" setup>
|
|
|
import { shallowRef, defineAsyncComponent } from 'vue'
|
|
|
import { useRequest } from '@/hooks/request'
|
|
|
-import { getBuyOrSellName } from '@/constants/order'
|
|
|
+import { getBuyOrSellName, BuyOrSell } from '@/constants/order'
|
|
|
import { useComponent } from '@/hooks/component'
|
|
|
import { useComposeTable } from '@pc/components/base/table'
|
|
|
import { queryTradePosition } from '@/services/api/order'
|
|
|
+import { useFuturesStore } from '@/stores'
|
|
|
import AppTable from '@pc/components/base/table/index.vue'
|
|
|
|
|
|
+const futuresStore = useFuturesStore()
|
|
|
+
|
|
|
+const last = (goodsCode: string) => {
|
|
|
+ return futuresStore.getQuotePrice(goodsCode)
|
|
|
+}
|
|
|
+
|
|
|
+const lastColor = (goodsCode: string) => {
|
|
|
+ return futuresStore.getQuoteInfo(goodsCode).value?.lastColor
|
|
|
+}
|
|
|
+
|
|
|
+/// 计算参考损益
|
|
|
+const closepl = (item: Model.TradePositionRsp) => {
|
|
|
+ const { last = 0 } = futuresStore.getQuoteInfo(item.goodscode).value ?? {}
|
|
|
+ const { curpositionqty, curholderamount, agreeunit, buyorsell } = item
|
|
|
+ return (last * curpositionqty * agreeunit - curholderamount) * (buyorsell === BuyOrSell.Buy ? 1 : -1)
|
|
|
+}
|
|
|
+
|
|
|
const componentMap = new Map<string, unknown>([
|
|
|
['delivery', defineAsyncComponent(() => import('./components/delivery/index.vue'))],
|
|
|
['transfer', defineAsyncComponent(() => import('./components/transfer/index.vue'))],
|
|
|
@@ -54,11 +80,11 @@ const tableColumns = shallowRef<Model.TableColumn[]>([
|
|
|
{ prop: 'enableqty', label: '可用数量' },
|
|
|
{ prop: 'frozenqty', label: '冻结数量' },
|
|
|
{ prop: 'averageprice', label: '均价' },
|
|
|
- { prop: 'unknown', label: '现价' },
|
|
|
+ { prop: 'last', label: '现价' },
|
|
|
{ prop: 'curholderamount', label: '持仓金额' },
|
|
|
{ prop: 'usedmargin', label: '占用保证金' },
|
|
|
{ prop: 'marketamount', label: '市值' },
|
|
|
- { prop: 'unknown', label: '浮动盈亏' },
|
|
|
+ { prop: 'closepl', label: '浮动盈亏' },
|
|
|
])
|
|
|
|
|
|
</script>
|