li.shaoyi vor 4 Jahren
Ursprung
Commit
6c4fd0dcdd

+ 45 - 0
src/common/components/capitalInfo/index.less

@@ -0,0 +1,45 @@
+.capital-info {
+    line-height: 1;
+    color      : #fff;
+    background : @m-grey6;
+
+    &__header {
+        display: flex;
+        padding: 10px 8px;
+
+        &-content {
+            flex: 1;
+
+            span:last-child {
+                color: #FFC017;
+            }
+        }
+
+        &-icon {
+            color      : @m-black3;
+            cursor     : pointer;
+            margin-left: 8px;
+        }
+    }
+
+    &__table {
+        width     : 100%;
+        text-align: left;
+
+        tbody {
+            td {
+                border : 1px solid #343D45;
+                padding: 8px;
+
+                &:first-child {
+                    color      : #7A8A94;
+                    border-left: 0;
+                }
+
+                &:last-child {
+                    border-right: 0;
+                }
+            }
+        }
+    }
+}

+ 68 - 163
src/common/components/capitalInfo/index.vue

@@ -1,180 +1,85 @@
 <template>
   <div class="capital-info">
     <!-- 资金信息 -->
-    <a-select class="capitalSelect" style="width: 180px" @change="accountChange" v-model:value="selectedAccountId">
-      <a-select-option v-for="item in getAllTaAccount()" :value="item.accountid" :key="item.accountid">{{item.accountid}}</a-select-option>
-    </a-select>
-    <div class="numBlocks">
-      <div class="capitalItem">
-        <div class="firstLine">
-          <div>余额</div>
-          <div>
-            <i class="iconfont icon-zhengyan" @click="showAction"></i>
-          </div>
+    <template v-if="tradeAccount">
+      <div class="capital-info__header">
+        <div class="capital-info__header-content">
+          <span>{{tradeAccount.accountid}}</span>
+          <span>({{getPayCurrencyTypeEnumItemName(tradeAccount.currencyid)}})</span>
         </div>
-        <div class="numBar">{{showValue(data.currentbalance)}}</div>
-      </div>
-      <!-- <div class="capitalItem">
-        <div class="firstLine">
-          <div>占用</div>
-        </div>
-        <div class="numBar green">128,000.00</div>
-      </div> -->
-      <div class="capitalItem">
-        <div class="firstLine">
-          <div>冻结</div>
-        </div>
-        <div class="numBar red">{{showValue(data.freeze)}}</div>
-      </div>
-      <div class="capitalItem">
-        <div class="firstLine">
-          <div>可用</div>
+        <div class="capital-info__header-icon">
+          <i class="iconfont icon-zhengyan" @click="showAction"></i>
         </div>
-        <div class="numBar blue">{{showValue(data.canUse)}}</div>
       </div>
-    </div>
+      <table class="capital-info__table">
+        <colgroup>
+          <col width="64px" />
+          <col width="auto" />
+        </colgroup>
+        <tbody>
+          <tr>
+            <td>权益</td>
+            <td>{{showValue(tradeAccount.equity.toFixed(2))}}</td>
+          </tr>
+          <tr>
+            <td>余额</td>
+            <td>{{showValue(tradeAccount.currentbalance.toFixed(2))}}</td>
+          </tr>
+          <tr>
+            <td>可用</td>
+            <td>{{showValue(tradeAccount.availableBalance.toFixed(2))}}</td>
+          </tr>
+          <tr>
+            <td>占用</td>
+            <td>{{showValue(tradeAccount.usedmargin.toFixed(2))}}</td>
+          </tr>
+          <tr>
+            <td>冻结</td>
+            <td>{{showValue(tradeAccount.freezeAmount.toFixed(2))}}</td>
+          </tr>
+          <tr>
+            <td>浮盈</td>
+            <td :class="tradeAccount.positionProfitAndLoss > 0 ? 'up-quote-color' : 'down-quote-color'">{{showValue(tradeAccount.positionProfitAndLoss.toFixed(2))}}</td>
+          </tr>
+          <tr>
+            <td>风险率</td>
+            <td>{{showValue((tradeAccount.hazardRatio * 100).toFixed(2)+'%')}}</td>
+          </tr>
+        </tbody>
+      </table>
+    </template>
   </div>
 </template>
 
 <script lang="ts">
-import { defineComponent, ref, reactive } from 'vue';
-import { getAllTaAccount, getCanUseMoney, getFreeze, getSelectedAccount, setSelectedAccount } from '@/services/bus/account';
-import { AccountListItem } from '@/services/dataCenter/interafce/account';
-import Bus from '@/utils/eventBus/index';
-import { getTaAccount } from '@/services/go/TaAccount';
+import { defineComponent, ref } from 'vue';
+import { useTradeAccount } from '@/hooks/account'
+import { getPayCurrencyTypeEnumItemName } from '@/common/constants/enumsName';
 
 export default defineComponent({
-    name: 'capital-info',
-    setup(props, context) {
-        const selectedAccount = getSelectedAccount();
-        const selectedAccountId = ref<number>(selectedAccount.accountid);
-        const data = reactive(getMoney(selectedAccount));
-        const show = ref<boolean>(true);
-        function showAction() {
-            show.value = !show.value;
-        }
-        function showValue(value: number) {
-            return show.value ? value : '******';
-        }
-        function getMoney(value: AccountListItem) {
-            const { currentbalance } = value;
-            return { currentbalance, freeze: getFreeze(value, true), canUse: getCanUseMoney(value) };
-        }
-        function accountChange(id: number) {
-            const item = getAllTaAccount().find((e) => e.accountid === id) as AccountListItem;
-            Object.assign(data, getMoney(item));
-            setSelectedAccount(item);
-            // 通知资金账户变化
-            Bus.$emit('taAccountChangedNtf');
-        }
-        // 资金变化,重新加载数据
-        Bus.$on('moneyChangedNtf_UI', () => {
-            getTaAccount().then(() => {
-                accountChange(selectedAccountId.value);
-            });
-        });
-        return {
-            getAllTaAccount,
-            selectedAccountId,
-            accountChange,
-            data,
-            show,
-            showValue,
-            showAction,
-        };
-    },
+  name: 'capital-info',
+  setup() {
+    const { tradeAccount } = useTradeAccount();
+    const show = ref<boolean>(true);
+
+    function showAction() {
+      show.value = !show.value;
+    }
+
+    function showValue(value: number) {
+      return show.value ? value : '******';
+    }
+    return {
+      show,
+      showValue,
+      showAction,
+      tradeAccount,
+      getPayCurrencyTypeEnumItemName,
+    };
+  },
 });
 </script>
 
 <style lang="less">
-.capital-info {
-    width: 100%;
-    height: 100%;
-    background: @m-grey6;
-    .ant-select.capitalSelect {
-        .ant-select-selector {
-            width: 180px;
-            height: 40px;
-            line-height: 40px;
-            background: @m-grey6;
-            border: 1px solid @m-blue0;
-            .ant-select-selection-item {
-                font-size: 14px;
-                color: @m-white0;
-                line-height: 40px;
-            }
-        }
-    }
-    .numBlocks {
-        padding: 10px 12px 18px 12px;
-    }
-    .capitalItem {
-        width: 100%;
-        padding-top: 10px;
-        font-size: 14px;
-        color: @m-grey1;
-        .firstLine {
-            width: 100%;
-            .inlineflex;
-            justify-content: space-between;
-            height: 18px;
-            line-height: 18px;
-            .iconfont {
-                font-size: 18px;
-                color: @m-black3;
-            }
-        }
-        .numBar {
-            width: 100%;
-            margin-top: 12px;
-            height: 16px;
-            line-height: 16px;
-            font-size: 16px;
-            text-align: left;
-            color: @m-white0;
-            margin-bottom: 8px;
-        }
-        .green {
-            color: @m-green0;
-        }
-        .red {
-            color: @m-red1;
-        }
-        .blue {
-            color: @m-blue0;
-        }
-    }
-    .capitalCollapse {
-        height: 100%;
-        background: transparent;
-        .ant-collapse-item {
-            height: 100%;
-            border: 0;
-            .ant-collapse-header {
-                width: 100%;
-                padding: 0 25px 0 12px;
-                height: 40px;
-                line-height: 40px;
-                border: 1px solid @m-blue0;
-                border-left: 0;
-                font-size: 14px;
-                font-family: Adobe Heiti Std;
-                color: @m-white0;
-                .ellipse;
-                .ant-collapse-arrow {
-                    right: 10px;
-                }
-            }
-            .ant-collapse-content {
-                height: calc(100% - 60px);
-                overflow: auto;
-                .ant-collapse-content-box {
-                    padding: 10px 12px;
-                    .flex();
-                    flex-direction: column;
-                }
-            }
-        }
-    }
-}
+@import './index.less';
 </style>;

+ 169 - 80
src/hooks/account/index.ts

@@ -4,88 +4,69 @@ import { QueryErmcpTradePositionRsp } from '@/services/go/ermcp/futures/interfac
 import { getQuoteDayInfoByCode } from "@/services/bus/goods";
 import { BuyOrSell } from '@/common/constants/enumCommon';
 import { getTaAccounts } from '@/services/go/TaAccount';
+import { Taaccount } from "@/services/go/TaAccount/interface";
 import { geLoginID_number } from '@/services/bus/login';
 import { Systemparam } from '@/services/go/useInfo/interface';
 import { getSelectedAccountId } from '@/services/bus/account';
 import { TradeAccount, TradePosition } from './interface'
 import APP from '@/services';
 
+// 加载状态
+const loading = ref<boolean>(false);
 // 资金账户列表
 const tradeAccountList: TradeAccount[] = reactive([]);
-// 期货持仓列表
+// 当前账户期货持仓列表
 const tradePositionList: TradePosition[] = reactive([]);
+// 当前资金账户信息
+const tradeAccount = ref<TradeAccount>();
 
 /**
- * 获取资金账户
+ * 资金账户
  */
-export function getTradeAccount() {
-    // 加载状态
-    const loading = ref<boolean>(false);
-
-    const initData = () => {
-        tradeAccountList.length = 0;
-        tradePositionList.length = 0;
-        loading.value = true;
-
-        // 系统参数
-        const systemParams = <Systemparam[]>APP.get('systemParams');
-        // 登录ID
-        const loginID = Number(geLoginID_number());
-
-        getTaAccounts({ loginID }).then(async (res) => {
-            for (let i = 0; i < res.length; i++) {
-                const account = res[i];
-                const positionList: TradePosition[] = [];
-
-                // 获取账户下的期货持仓列表
-                await queryErmcpTradePosition({ accountID: account.accountid }).then((res) => {
-                    res.forEach((item) => {
-                        positionList.push({
-                            ...item,
-                            ...calcPrice(item),
+export function useTradeAccount() {
+    const getTradeAccountList = () => {
+        if (!loading.value) {
+            tradeAccountList.length = 0;
+            loading.value = true;
+
+            // 登录ID
+            const loginID = Number(geLoginID_number());
+
+            getTaAccounts({ loginID }).then(async (res) => {
+                for (let i = 0; i < res.length; i++) {
+                    const account = res[i];
+                    const positionList: TradePosition[] = [];
+
+                    // 获取账户下的期货持仓列表
+                    await queryErmcpTradePosition({ accountID: account.accountid }).then((res) => {
+                        res.forEach((item) => {
+                            positionList.push({
+                                ...item,
+                                ...calcPositionValue(item),
+                            })
                         })
                     })
-                })
-
-                // *系统参数"113"(当日浮动盈利是否可用) 0:不可用 1:可用
-                const isAvailable = systemParams.find((e) => e.paramcode === '113')?.paramvalue === '1';
-
-                // 计算总浮动盈亏
-                const positionProfitAndLoss = computed(() => positionList.reduce((res, item) => res + item.positionProfitAndLoss.value, 0));
-
-                // 计算可用资金
-                const availableBalance = computed(() => {
-                    const { currentbalance, usedmargin, freezemargin, freezecharge, otherfreezemargin, outamountfreeze } = account;
-                    const freeze = currentbalance - usedmargin - freezemargin - otherfreezemargin - freezecharge - outamountfreeze;
-
-                    if (positionProfitAndLoss.value < 0 || (positionProfitAndLoss.value >= 0 && isAvailable)) {
-                        // 账户(总浮动盈亏为负) 或(总浮动盈亏为正 且 113 = 1)
-                        // 可用资金=总浮动盈亏+期末余额-占用-冻结-其它冻结-手续费冻结-出金冻结
-                        return positionProfitAndLoss.value + freeze;
-                    } else {
-                        // 可用资金=期末余额-占用-冻结-其它冻结-手续费冻结-出金冻结
-                        return freeze;
-                    }
-                });
-
-                tradeAccountList.push({
-                    ...account,
-                    availableBalance,
-                    positionProfitAndLoss,
-                    positionList,
-                })
-            }
 
-            getPositionList();
-            loading.value = false;
-        })
+                    tradeAccountList.push({
+                        positionList,
+                        ...account,
+                        ...calcCapitalValue(account, positionList),
+                    })
+                }
+
+                selectedTradeAccount();
+                loading.value = false;
+            })
+        }
     }
 
-    // 获取当前账户期货持仓列表
-    const getPositionList = () => {
-        const account = tradeAccountList.find((account) => account.accountid === getSelectedAccountId());
-        if (account) {
-            tradePositionList.push(...account.positionList);
+    // 设置选中当前账户
+    const selectedTradeAccount = () => {
+        tradePositionList.length = 0;
+        tradeAccount.value = tradeAccountList.find((account) => account.accountid === getSelectedAccountId());
+
+        if (tradeAccount.value) {
+            tradePositionList.push(...tradeAccount.value.positionList);
         }
     }
 
@@ -93,39 +74,40 @@ export function getTradeAccount() {
         loading,
         tradeAccountList,
         tradePositionList,
-        initData,
-        getPositionList,
+        tradeAccount,
+        getTradeAccountList,
+        selectedTradeAccount,
     }
 }
 
 /**
- * 计算价格
- * @param record 
+ * 计算持仓数据
+ * @param position 
  * @returns 
  */
-function calcPrice(record: QueryErmcpTradePositionRsp) {
+function calcPositionValue(position: QueryErmcpTradePositionRsp) {
+    // 获取对应的商品行情
+    const quote = getQuoteDayInfoByCode(position.goodscode);
+
     // 计算开仓均价
     const openAveragePrice = computed(() => {
-        const { opencost, curpositionqty, agreeunit } = record
+        const { opencost, curpositionqty, agreeunit } = position
         // 开仓成本 ÷ 期末头寸 ÷ 合约单位
         return opencost / curpositionqty / agreeunit;
     })
 
     // 计算持仓均价
     const positionAveragePrice = computed(() => {
-        const { positioncost, curpositionqty, agreeunit } = record
+        const { positioncost, curpositionqty, agreeunit } = position
         // 持仓成本 ÷ 期末头寸 ÷ 合约单位
         return positioncost / curpositionqty / agreeunit;
     })
 
-    // 计算浮动盈亏
+    // 计算浮动盈亏 - 对应市场收益权
     const positionProfitAndLoss = computed(() => {
-        const { goodscode, curpositionqty, agreeunit } = record
-        // 获取对应的商品行情
-        const quote = getQuoteDayInfoByCode(goodscode);
-
+        const { curpositionqty, agreeunit } = position
         if (quote?.last) {
-            if (record.buyorsell === BuyOrSell.buy) {
+            if (position.buyorsell === BuyOrSell.buy) {
                 // 买方向 = (最新价 - 持仓均价) * 买期末头寸 * 合约单位
                 return (quote.last - openAveragePrice.value) * curpositionqty * agreeunit
             } else {
@@ -133,12 +115,21 @@ function calcPrice(record: QueryErmcpTradePositionRsp) {
                 return (positionAveragePrice.value - quote.last) * curpositionqty * agreeunit
             }
         }
-        return record.positionpl
+        return position.positionpl
+    })
+
+    // 计算市值 - 对应市场所有权
+    const capitalization = computed(() => {
+        if (quote?.last) {
+            // 市值 = 最新价 * 持仓数量 * 合约单位
+            return quote.last * position.curpositionqty * position.agreeunit
+        }
+        return 0
     })
 
     // 计算盈亏比例
     const positionProfitAndLossRate = computed(() => {
-        const { opencost } = record
+        const { opencost } = position
         // 持仓盈亏 ÷ 开仓成本
         const result = positionProfitAndLoss.value / opencost * 100
         if (isNaN(result)) {
@@ -149,8 +140,106 @@ function calcPrice(record: QueryErmcpTradePositionRsp) {
 
     return {
         openAveragePrice,
+        capitalization,
         positionAveragePrice,
         positionProfitAndLoss,
         positionProfitAndLossRate,
     }
+}
+
+/**
+ * 计算资金数据
+ * @param account 
+ * @param positionList 
+ * @returns 
+ */
+function calcCapitalValue(account: Taaccount, positionList: TradePosition[]) {
+    // 系统参数
+    const systemParams = <Systemparam[]>APP.get('systemParams');
+
+    // 计算总浮动盈亏
+    const positionProfitAndLoss = computed(() => positionList.reduce((res, item) => res + item.positionProfitAndLoss.value, 0));
+
+    // 计算总市值
+    const marketCap = computed(() => positionList.reduce((res, item) => res + item.capitalization.value, 0));
+
+    // 计算可用资金
+    const availableBalance = computed(() => {
+        // *系统参数"113"(当日浮动盈利是否可用) 0:不可用 1:可用
+        const flag = systemParams.find((e) => e.paramcode === '113')?.paramvalue === '1';
+
+        const { currentbalance, usedmargin, freezemargin, freezecharge, otherfreezemargin, outamountfreeze } = account;
+        const freeze = currentbalance - usedmargin - freezemargin - otherfreezemargin - freezecharge - outamountfreeze;
+
+        if (positionProfitAndLoss.value < 0 || (positionProfitAndLoss.value >= 0 && flag)) {
+            // 账户(总浮动盈亏为负) 或(总浮动盈亏为正 且 113 = 1)
+            // 可用资金 = 总浮动盈亏 + 期末余额 - 占用 - 冻结 - 其它冻结 - 手续费冻结 - 出金冻结
+            return positionProfitAndLoss.value + freeze;
+        } else {
+            // 可用资金 = 期末余额 - 占用 - 冻结 - 其它冻结 - 手续费冻结 - 出金冻结
+            return freeze;
+        }
+    });
+
+    // 计算权益/净值
+    const equity = computed(() => {
+        // 根据系统参数“307 账户净值是否减冻结资金 - 0:不减 1:减“
+        const flag = systemParams.find((e) => e.paramcode === '307')?.paramvalue === '1';
+
+        const result = account.currentbalance + marketCap.value + positionProfitAndLoss.value;
+        if (flag) {
+            const { otherfreezemargin, outamountfreeze } = account;
+            // 净值 = 期末余额 + 市值(所有权) + 浮动盈亏(收益权) - 其它冻结 - 出金冻结
+            return result - otherfreezemargin - outamountfreeze;
+        } else {
+            // 净值 = 期末余额 + 市值(所有权) + 浮动盈亏(收益权)
+            return result;
+        }
+    })
+
+    // 计算冻结资金
+    const freezeAmount = computed(() => {
+        const { otherfreezemargin, outamountfreeze, freezecharge } = account;
+        // 冻结资金 = 手续费冻结 + 出金冻结 + 其他冻结保证金
+        return freezecharge + outamountfreeze + otherfreezemargin;
+    })
+
+    // 计算风险净值
+    const valueAtRisk = computed(() => {
+        // 根据系统参数“307 账户净值是否减冻结资金 - 0:不减 1:减“
+        const flag = systemParams.find((e) => e.paramcode === '087')?.paramvalue === '1';
+        const { otherfreezemargin, outamountfreeze } = account;
+
+        const result = account.currentbalance + positionProfitAndLoss.value - otherfreezemargin - outamountfreeze;
+        if (flag) {
+            // 风险净值 = 期末余额 + 市值(所有权) + 浮动盈亏(收益权) - 其他冻结-出金冻结
+            return result + marketCap.value;
+        } else {
+            // 风险净值 = 期末余额 + 浮动盈亏(收益权) - 其他冻结 - 出金冻结
+            return result;
+        }
+    })
+
+    // 计算风险率
+    const hazardRatio = computed(() => {
+        // 根据系统参数“132   风险率计算公式”:
+        const flag = systemParams.find((e) => e.paramcode === '132')?.paramvalue === '1';
+        const { usedmargin, mortgagecredit } = account;
+
+        if (flag) {
+            // 风险率 = 占用 / 风险净值
+            return usedmargin / valueAtRisk.value;
+        } else {
+            // 风险率 = (占用 - 授信金额) / (风险净值 - 授信金额)
+            return (usedmargin - mortgagecredit) / (valueAtRisk.value - mortgagecredit);
+        }
+    })
+
+    return {
+        equity,
+        positionProfitAndLoss,
+        availableBalance,
+        freezeAmount,
+        hazardRatio,
+    }
 }

+ 5 - 1
src/hooks/account/interface.ts

@@ -6,8 +6,11 @@ import { QueryErmcpTradePositionRsp } from '@/services/go/ermcp/futures/interfac
  * 交易账户
  */
 export interface TradeAccount extends Taaccount {
+    equity: ComputedRef<number>; // 当前权益/净值
     availableBalance: ComputedRef<number>; // 可用余额/可用资金
     positionProfitAndLoss: ComputedRef<number>; // 总浮动盈亏/总持仓盈亏
+    freezeAmount: ComputedRef<number>; // 冻结资金
+    hazardRatio: ComputedRef<number>; // 风险率
     positionList: TradePosition[]; // 期货持仓列表
 }
 
@@ -17,6 +20,7 @@ export interface TradeAccount extends Taaccount {
 export interface TradePosition extends QueryErmcpTradePositionRsp {
     openAveragePrice: ComputedRef<number>; // 开仓均价
     positionAveragePrice: ComputedRef<number>; // 持仓均价
-    positionProfitAndLoss: ComputedRef<number>; // 浮动盈亏/持仓盈亏
+    positionProfitAndLoss: ComputedRef<number>; // 浮动盈亏/持仓盈亏 - 对应市场收益权
+    capitalization: ComputedRef<number>; // 市值 - 对应市场所有权
     positionProfitAndLossRate: ComputedRef<number>; // 盈亏比例
 }

+ 62 - 64
src/layout/components/bottom.vue

@@ -5,8 +5,8 @@
       <firstMenu :list="orderList" :value="'title'" @selectMenu="selectMenu">
         <div class="right-menu-content">
           <!-- 资金信息 -->
-          <a-select class="capitalSelect" style="width: 180px" v-if="!isCapitalLeft" @change="accountChange" v-model:value="selectedAccountId">
-            <a-select-option v-for="item in getAllTaAccount()" :value="item.accountid" :key="item.accountid">{{item.accountid}}</a-select-option>
+          <a-select class="capitalSelect" style="width: 180px" @change="accountChange" v-model:value="selectedAccountId">
+            <a-select-option v-for="item in tradeAccountList" :value="item.accountid" :key="item.accountid">{{item.accountid}}</a-select-option>
           </a-select>
           <div class="conditionIcon icon iconfont icon-shouqi" @click="handleShowBottom"></div>
         </div>
@@ -18,7 +18,7 @@
   </section>
 </template>
 <script lang="ts">
-import { defineAsyncComponent, defineComponent, reactive, ref } from 'vue';
+import { defineAsyncComponent, defineComponent, ref } from 'vue';
 import CapitalInfo from '@/common/components/capitalInfo/index.vue';
 import firstMenu from '@/common/components/firstMenu/index.vue';
 import thirdMenu from '@/common/components/thirdMenu/index.vue';
@@ -27,66 +27,71 @@ import { OperationTabMenu } from '@/services/go/commonService/interface';
 import { handleOrderData } from '@/common/setup/order/orderData';
 import { enumOrderComponents } from '@/common/constants/enumOrderComponents';
 import { handleShowBottom, getShowBottomValue } from '@/common/config/constrolBottom';
-import { getAllTaAccount, getCanUseMoney, getFreeze, getSelectedAccount, setSelectedAccount } from '@/services/bus/account';
+import { getAllTaAccount, getSelectedAccount, setSelectedAccount } from '@/services/bus/account';
 import { AccountListItem } from '@/services/dataCenter/interafce/account';
-import { getTaAccount } from '@/services/go/TaAccount';
 import Bus from '@/utils/eventBus/index';
 import { isOemByEnum, OemType } from '@/common/config/projectName';
 import { initData } from '@/common/methods';
+import { useTradeAccount } from '@/hooks/account'
 
 export default defineComponent({
-    name: 'layout-top',
-    components: {
-        CapitalInfo,
-        firstMenu,
-        quoteTable,
-        thirdMenu,
-        futures_information: defineAsyncComponent(() => import('@/views/order/futures_information/index.vue')), // 期货订单
-        funding_information: defineAsyncComponent(() => import('@/views/order/funding_information/index.vue')), // 资金信息
-        [enumOrderComponents.spot_warrant]: defineAsyncComponent(() => import('@/views/order/spot_warran/index.vue')),
-        [enumOrderComponents.performance_information]: defineAsyncComponent(() => import('@/views/order/performance_information/index.vue')),
-        [enumOrderComponents.pre_sale_warehouse_receipt]: defineAsyncComponent(() => import('@/views/order/pre_sale_warehouse_receipt/index.vue')),
-        [enumOrderComponents.financing_manager]: defineAsyncComponent(() => import('@/views/order/financing_manager/index.vue')),
-        [enumOrderComponents.commodity_contract]: defineAsyncComponent(() => import('@/views/order/commodity_contract/index.vue')),
-    },
-    setup() {
-        const { orderList, componentId } = handleOrderData();
-        const selectedAccount = getSelectedAccount();
-        const selectedAccountId = ref<number>(selectedAccount.accountid);
-        function accountChange(id: number) {
-            const item = getAllTaAccount().find((e) => e.accountid === id) as AccountListItem;
-            setSelectedAccount(item);
-        }
-        // 资金变化,重新加载数据
-        Bus.$on('moneyChangedNtf_UI', () => {
-            getTaAccount().then(() => {
-                accountChange(selectedAccountId.value);
-            });
-        });
-        // 控制资金面板是否显示在左边
-        const isCapitalLeft = ref<boolean>(true);
-        initData(() => {
-            if (isOemByEnum(OemType.wrspot) || isOemByEnum(OemType.tian_jing_mai_dun)) {
-                isCapitalLeft.value = false;
-            }
-        });
-        // 切换组件
-        function selectMenu(value: OperationTabMenu) {
-            componentId.value = value.code;
-        }
-        return {
-            selectMenu,
-            componentId,
-            orderList,
-            isShowBottom: getShowBottomValue(),
-            getShowBottomValue,
-            handleShowBottom,
-            getAllTaAccount,
-            selectedAccountId,
-            accountChange,
-            isCapitalLeft,
-        };
-    },
+  name: 'layout-top',
+  components: {
+    CapitalInfo,
+    firstMenu,
+    quoteTable,
+    thirdMenu,
+    futures_information: defineAsyncComponent(() => import('@/views/order/futures_information/index.vue')), // 期货订单
+    funding_information: defineAsyncComponent(() => import('@/views/order/funding_information/index.vue')), // 资金信息
+    [enumOrderComponents.spot_warrant]: defineAsyncComponent(() => import('@/views/order/spot_warran/index.vue')),
+    [enumOrderComponents.performance_information]: defineAsyncComponent(() => import('@/views/order/performance_information/index.vue')),
+    [enumOrderComponents.pre_sale_warehouse_receipt]: defineAsyncComponent(() => import('@/views/order/pre_sale_warehouse_receipt/index.vue')),
+    [enumOrderComponents.financing_manager]: defineAsyncComponent(() => import('@/views/order/financing_manager/index.vue')),
+    [enumOrderComponents.commodity_contract]: defineAsyncComponent(() => import('@/views/order/commodity_contract/index.vue')),
+  },
+  setup() {
+    const { tradeAccountList, getTradeAccountList, selectedTradeAccount } = useTradeAccount();
+    const { orderList, componentId } = handleOrderData();
+    const selectedAccount = getSelectedAccount();
+    const selectedAccountId = ref<number>(selectedAccount.accountid);
+
+    function accountChange(id: number) {
+      const item = getAllTaAccount().find((e) => e.accountid === id) as AccountListItem;
+      setSelectedAccount(item);
+      selectedTradeAccount();
+    }
+
+    // 资金变化,重新加载数据
+    Bus.$on('moneyChangedNtf_UI', () => {
+      getTradeAccountList();
+    });
+
+    // 控制资金面板是否显示在左边
+    const isCapitalLeft = ref<boolean>(true);
+    initData(() => {
+      getTradeAccountList();
+      if (isOemByEnum(OemType.wrspot) || isOemByEnum(OemType.tian_jing_mai_dun)) {
+        isCapitalLeft.value = false;
+      }
+    });
+
+    // 切换组件
+    function selectMenu(value: OperationTabMenu) {
+      componentId.value = value.code;
+    }
+    return {
+      selectMenu,
+      componentId,
+      orderList,
+      tradeAccountList,
+      isShowBottom: getShowBottomValue(),
+      getShowBottomValue,
+      handleShowBottom,
+      selectedAccountId,
+      accountChange,
+      isCapitalLeft,
+    };
+  },
 });
 </script>
 <style lang="less">
@@ -111,19 +116,12 @@ export default defineComponent({
 .layout-bottom-hidden {
     height: 40px;
 }
-.main-all {
-    max-width: 100;
-}
-.main-some {
-    max-width: calc(100% - 160px);
-}
 .layout-bottom {
     display: flex;
     width: 100%;
     transition: height 0.5s;
     overflow: hidden;
     .capital-info-container {
-        width: 180px;
         border-right: 1px solid @m-black2;
     }
     main {

+ 1 - 0
src/services/bus/account.ts

@@ -1,3 +1,4 @@
+/* 待优化-------------------------------后期可能废除 */
 import APP from '@/services';
 import { getLoginData } from '@/services/bus/login';
 import { QueryQuoteDayRsp } from '@/services/go/quote/interface';

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

@@ -15,7 +15,7 @@ import { handleComposeOrderTable } from '@/common/setup/table/compose';
 import { ComposeOrderTableParam } from '@/common/setup/table/interface';
 import { Taaccount } from '@/services/go/TaAccount/interface';
 import { getColumns } from './setup';
-import { getTradeAccount } from '@/hooks/account'
+import { useTradeAccount } from '@/hooks/account'
 
 export default defineComponent({
   name: enumOrderComponents.funding_information_funding_summary,
@@ -23,11 +23,11 @@ export default defineComponent({
     BtnList,
   },
   setup() {
-    const { loading, tradeAccountList, initData } = getTradeAccount()
+    const { loading, tradeAccountList } = useTradeAccount();
 
     // 表格通用逻辑
     const param: ComposeOrderTableParam = {
-      queryFn: initData,
+      queryFn: () => { },
       recordList: getRecordItemTab(),
     };
 

+ 5 - 6
src/views/order/funding_information/components/funding_information_funding_summary/setup.tsx

@@ -5,7 +5,7 @@ import { QueryTradePositionRsp } from '@/services/go/ermcp/order/interface';
 import { Taaccount } from '@/services/go/TaAccount/interface';
 import { Systemparam } from '@/services/go/useInfo/interface';
 import { Ref } from 'vue';
-import { getCanUseMoney, getFreeze } from '@/services/bus/account';
+import { getFreeze } from '@/services/bus/account';
 import { getTaacountStatus, getPayCurrencyTypeEnumItemName } from '@/common/constants/enumsName';
 
 export function getColumns() {
@@ -23,7 +23,8 @@ export function getColumns() {
         },
         {
             title: '当前权益',
-            key: 'currentbalance',
+            key: 'equity',
+            customRender: ({ text }: { text: number }) => text.toFixed(2)
         },
         {
             title: '可用资金',
@@ -36,10 +37,8 @@ export function getColumns() {
         },
         {
             title: '冻结金额',
-            key: 'freezemargin',
-            customRender: ({ record }: { record: Taaccount }) => {
-                return getFreeze(record)
-            }
+            key: 'freezeAmount',
+            customRender: ({ text }: { text: number }) => text.toFixed(2)
         },
         {
             title: '持仓盈亏',

+ 3 - 3
src/views/order/futures_information/components/futures_information_position/index.vue

@@ -19,7 +19,7 @@ import { ComposeOrderTableParam } from '@/common/setup/table/interface';
 import { expandIcon } from '@/common/setup/table/clolumn';
 import { getRecordItemTab } from '@/common/setup/order/orderData';
 import { getColumns } from './columns';
-import { getTradeAccount } from '@/hooks/account'
+import { useTradeAccount } from '@/hooks/account'
 
 export default defineComponent({
   components: {
@@ -27,11 +27,11 @@ export default defineComponent({
     close: defineAsyncComponent(() => import('@/views/market/futures/compoments/futures-trade/index.vue')),
   },
   setup() {
-    const { loading, tradePositionList, initData } = getTradeAccount()
+    const { loading, tradePositionList } = useTradeAccount();
 
     // 表格通用逻辑
     const param: ComposeOrderTableParam = {
-      queryFn: initData,
+      queryFn: () => { },
       recordList: getRecordItemTab(),
     };