فهرست منبع

修改 资金信息 持仓市值

huangbin 4 سال پیش
والد
کامیت
7e4f69bea9

+ 12 - 4
src/services/bus/holdPosition.ts

@@ -1,6 +1,7 @@
 import { BuyOrSell } from "@/common/constants/enumCommon";
 import { QueryTradePositionRsp } from "../go/ermcp/order/interface";
 import { getQuoteDayInfoByCodeFindPrice } from "./goods";
+import { getMarketTradePropertyByGoodsId } from "./market";
 
 
 // 持仓盈亏
@@ -28,11 +29,18 @@ export const useProfitloss = (record: QueryTradePositionRsp, goodscode?: string)
 export const useHolderprice = (record: QueryTradePositionRsp) => {
     // 最新价
     const lastPrice = getQuoteDayInfoByCodeFindPrice(record.goodscode);
-    if (lastPrice !== '--') {
-        const { decimalplace, agreeunit, curpositionqty } = record;
-        return (+lastPrice * curpositionqty * agreeunit).toFixed(decimalplace);
+    const tradeproperty = getMarketTradePropertyByGoodsId(record.goodsid)
+    if (tradeproperty === 2) {
+        // 交易属性 - 1:收益权(可做空) 2:所有权(不可做空) 3:期权 4:现货 5:参考行情 6:通道交易 7:币交易 8:场外期权
+        if (lastPrice !== '--') {
+            const { decimalplace, agreeunit, curpositionqty } = record;
+            return (+lastPrice * curpositionqty * agreeunit).toFixed(decimalplace);
+        } else {
+            return lastPrice
+        }
     } else {
-        return lastPrice
+        return 0
     }
+
 }
 

+ 6 - 1
src/views/order/funding_information/components/funding_information_funding_summary/index.vue

@@ -39,6 +39,10 @@
       <template #accountname="{ record }">
         <span>{{ hazardRates(record) }}</span>
       </template>
+      <!-- 持仓市值 -->
+      <template #curamount="{ record }">
+        <span>{{ handleHoldPrice(record.accountid) }}</span>
+      </template>
       <!-- 净值 -->
       <template #netWorth="{ record }">
         <span>{{ netWorth(record) }}</span>
@@ -87,7 +91,7 @@ export default defineComponent({
   setup() {
     // 表格列表数据
     const { loading, tableList, queryTable } = queryTableList<Taaccount>();
-    const { handleProfitloss, hazardRates, netWorth, canUseMoney, getHoldsList } = useHazardRates();
+    const { handleProfitloss, hazardRates, netWorth, canUseMoney, getHoldsList, handleHoldPrice } = useHazardRates();
     // 获取列表数据
     const queryTableAction = () => {
       const param: GetTaAccountsReq = {
@@ -159,6 +163,7 @@ export default defineComponent({
       openComponentAction, // 控制异步组件
       btnList, // 表格按钮
       handleQuotePriceColor,
+      handleHoldPrice,
     };
   },
 });

+ 1 - 1
src/views/order/funding_information/components/funding_information_funding_summary/setup.ts

@@ -247,6 +247,6 @@ export const useHazardRates = () => {
         return result.toFixed(decimalplace)
     }
 
-    return { handleProfitloss, hazardRates, netWorth, canUseMoney, getHoldsList }
+    return { handleProfitloss, hazardRates, netWorth, canUseMoney, getHoldsList, handleHoldPrice }
 }