huangbin 4 vuotta sitten
vanhempi
commit
4da9331b1c

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

@@ -1,52 +1,59 @@
 <template>
   <!-- 资金汇总 -->
   <section>
-    <a-table :columns="tableColumns()"
-             class="srcollYTable expandLeftTable"
-             :scroll="{ x: '100%', y: '190px' }"
-             :pagination="false"
-             :loading="loading"
-             :expandedRowKeys="expandedRowKeys"
-             :customRow="Rowclick"
-             :expandIcon="expandIcon"
-             :expandIconAsCell="false"
-             rowKey="key"
-             :data-source="tableList">
+    <a-table
+      :columns="tableColumns()"
+      class="srcollYTable expandLeftTable"
+      :scroll="{ x: '100%', y: '190px' }"
+      :pagination="false"
+      :loading="loading"
+      :expandedRowKeys="expandedRowKeys"
+      :customRow="Rowclick"
+      :expandIcon="expandIcon"
+      :expandIconAsCell="false"
+      rowKey="key"
+      :data-source="tableList"
+    >
       <!-- 额外的展开行 -->
-      <template v-if="btnList.length"
-                #expandedRowRender="{ record }">
-        <BtnList :btnList="btnList"
-                 :record="record"
-                 class="btn-list-sticky"
-                 @click="openComponentAction" />
+      <template v-if="btnList.length" #expandedRowRender="{ record }">
+        <BtnList
+          :btnList="btnList"
+          :record="record"
+          class="btn-list-sticky"
+          @click="openComponentAction"
+        />
       </template>
-      <template #balance="{record}">
-        <span>{{canUseMoney(record)}}</span>
+      <template #balance="{ record }">
+        <span>{{ canUseMoney(record) }}</span>
       </template>
-      <template #freezemargin="{record}">
-        <span>{{getFreeze(record, true)}}</span>
+      <template #freezemargin="{ record }">
+        <span>{{ getFreeze(record, true) }}</span>
       </template>
       <!-- 浮动盈亏 -->
-      <template #closepl="{record}">
-        <span>{{handleProfitloss(record)}}</span>
+      <template #closepl="{ record }">
+        <span
+          :class="handleQuotePriceColor(+handleProfitloss(record), 0)"
+        >{{ handleProfitloss(record) }}</span>
       </template>
       <!-- 风险率 -->
-      <template #accountname="{record}">
-        <span>{{hazardRates(record)}}</span>
+      <template #accountname="{ record }">
+        <span>{{ hazardRates(record) }}</span>
       </template>
       <!-- 净值 -->
-      <template #netWorth="{record}">
-        <span>{{netWorth(record)}}</span>
+      <template #netWorth="{ record }">
+        <span>{{ netWorth(record) }}</span>
       </template>
-      <template #tradestatus="{text}">
-        <span>{{getTaacountStatus(text)}}</span>
+      <template #tradestatus="{ text }">
+        <span>{{ getTaacountStatus(text) }}</span>
       </template>
     </a-table>
-    <component :is="componentId"
-               v-if="componentId"
-               :selectedRow="selectedRow"
-               :canUseMoney="canUseMoney(selectedRow)"
-               @cancel="closeComponent"></component>
+    <component
+      :is="componentId"
+      v-if="componentId"
+      :selectedRow="selectedRow"
+      :canUseMoney="canUseMoney(selectedRow)"
+      @cancel="closeComponent"
+    ></component>
   </section>
 </template>
 
@@ -59,101 +66,101 @@ import { getRecordItemTab } from '@/common/setup/order/orderData';
 import { expandIcon } from '@/common/setup/table/clolumn';
 import { handleComposeOrderTable } from '@/common/setup/table/compose';
 import { ComposeOrderTableParam } from '@/common/setup/table/interface';
+import { handleQuotePriceColor } from '@/common/setup/table/tableQuote';
 import { getCanUseMoney, getFreeze } from '@/services/bus/account';
 import { geLoginID_number } from '@/services/bus/login';
-import { queryTradePosition } from '@/services/go/ermcp/order';
-import { QueryTradePositionRsp } from '@/services/go/ermcp/order/interface';
 import { getTaAccounts } from '@/services/go/TaAccount';
 import { GetTaAccountsReq, Taaccount } from '@/services/go/TaAccount/interface';
 import Bus from '@/utils/eventBus/index';
 import { message } from 'ant-design-vue';
-import { defineAsyncComponent, ref } from 'vue';
+import { defineAsyncComponent } from 'vue';
 import { useSignBank } from './components/setup';
 import { tableColumns, useHazardRates } from './setup';
 
 export default defineComponent({
-    name: enumOrderComponents.funding_information_funding_summary,
-    components: {
-        BtnList,
-        funding_information_funding_summary_recharge: defineAsyncComponent(() => import('./components/funding_information_funding_summary_recharge/index.vue')),
-        funding_information_funding_summary_withdraw: defineAsyncComponent(() => import('./components/funding_information_funding_summary_withdraw/index.vue')),
-    },
-    setup() {
-        // 表格列表数据
-        const { loading, tableList, queryTable } = queryTableList<Taaccount>();
-        const { handleProfitloss, hazardRates, netWorth, canUseMoney, getHoldsList } = useHazardRates();
-        // 获取列表数据
-        const queryTableAction = () => {
-            const param: GetTaAccountsReq = {
-                loginID: Number(geLoginID_number()),
-            };
-            queryTable(getTaAccounts, param);
-            // 获取头寸
-            getHoldsList(loading)
-        };
+  name: enumOrderComponents.funding_information_funding_summary,
+  components: {
+    BtnList,
+    funding_information_funding_summary_recharge: defineAsyncComponent(() => import('./components/funding_information_funding_summary_recharge/index.vue')),
+    funding_information_funding_summary_withdraw: defineAsyncComponent(() => import('./components/funding_information_funding_summary_withdraw/index.vue')),
+  },
+  setup() {
+    // 表格列表数据
+    const { loading, tableList, queryTable } = queryTableList<Taaccount>();
+    const { handleProfitloss, hazardRates, netWorth, canUseMoney, getHoldsList } = useHazardRates();
+    // 获取列表数据
+    const queryTableAction = () => {
+      const param: GetTaAccountsReq = {
+        loginID: Number(geLoginID_number()),
+      };
+      queryTable(getTaAccounts, param);
+      // 获取头寸
+      getHoldsList(loading)
+    };
 
-        // 资金变化,重新加载数据
-        Bus.$on('moneyChangedNtf_UI', () => {
-            queryTableAction();
-        });
-        // 表格通用逻辑
-        const param: ComposeOrderTableParam = {
-            queryFn: queryTableAction,
-            tableName: 'table_pcweb_spot_trade_bottom_funding_info_summary',
-            recordList: getRecordItemTab(),
-        };
+    // 资金变化,重新加载数据
+    Bus.$on('moneyChangedNtf_UI', () => {
+      queryTableAction();
+    });
+    // 表格通用逻辑
+    const param: ComposeOrderTableParam = {
+      queryFn: queryTableAction,
+      tableName: 'table_pcweb_spot_trade_bottom_funding_info_summary',
+      recordList: getRecordItemTab(),
+    };
 
-        const {
-            contextMenu,
-            openContext,
-            closeContext, // 右键
-            columns,
-            registerColumn,
-            updateColumn, // 表头
-            expandedRowKeys,
-            selectedRow,
-            Rowclick, // 表格折腾面板数据与单击、双击事件
-            componentId,
-            closeComponent,
-            openComponent, // 控制异步组件
-            btnList, // 表格按钮
-        } = handleComposeOrderTable<Taaccount>(param);
-        // 签约银行
-        const { hasSignBank } = useSignBank();
-        function openComponentAction(item: BtnListType, record: Taaccount) {
-            if (hasSignBank()) {
-                openComponent(item, record);
-            } else {
-                message.error('请先签约银行!');
-            }
-        }
-        return {
-            loading,
-            tableList,
-            getCanUseMoney,
-            getFreeze,
-            expandIcon,
-            handleProfitloss,
-            hazardRates,
-            tableColumns,
-            getTaacountStatus,
-            netWorth,
-            canUseMoney,
-            contextMenu,
-            openContext,
-            closeContext, // 右键
-            columns,
-            registerColumn,
-            updateColumn, // 表头
-            expandedRowKeys,
-            selectedRow,
-            Rowclick, // 表格折腾面板数据与单击、双击事件
-            componentId,
-            closeComponent,
-            openComponentAction, // 控制异步组件
-            btnList, // 表格按钮
-        };
-    },
+    const {
+      contextMenu,
+      openContext,
+      closeContext, // 右键
+      columns,
+      registerColumn,
+      updateColumn, // 表头
+      expandedRowKeys,
+      selectedRow,
+      Rowclick, // 表格折腾面板数据与单击、双击事件
+      componentId,
+      closeComponent,
+      openComponent, // 控制异步组件
+      btnList, // 表格按钮
+    } = handleComposeOrderTable<Taaccount>(param);
+    // 签约银行
+    const { hasSignBank } = useSignBank();
+    function openComponentAction(item: BtnListType, record: Taaccount) {
+      if (hasSignBank()) {
+        openComponent(item, record);
+      } else {
+        message.error('请先签约银行!');
+      }
+    }
+    return {
+      loading,
+      tableList,
+      getCanUseMoney,
+      getFreeze,
+      expandIcon,
+      handleProfitloss,
+      hazardRates,
+      tableColumns,
+      getTaacountStatus,
+      netWorth,
+      canUseMoney,
+      contextMenu,
+      openContext,
+      closeContext, // 右键
+      columns,
+      registerColumn,
+      updateColumn, // 表头
+      expandedRowKeys,
+      selectedRow,
+      Rowclick, // 表格折腾面板数据与单击、双击事件
+      componentId,
+      closeComponent,
+      openComponentAction, // 控制异步组件
+      btnList, // 表格按钮
+      handleQuotePriceColor,
+    };
+  },
 });
 </script>
 

+ 5 - 4
src/views/order/swap_the_order/components/swap_commodity_contract_summary/index.vue

@@ -37,7 +37,7 @@
           </template>
           <!-- 持仓盈亏 -->
           <template #profitloss="{ record }">
-            <span>{{ getDetailProfitloss(record) }}</span>
+            <span :class="handleQuotePriceColor(+getDetailProfitloss(record), 0)">{{ getDetailProfitloss(record) }}</span>
           </template>
           <!-- 市值 -->
           <template #marketamount="{ record }">
@@ -93,9 +93,9 @@ import { getRecordItemTab } from '@/common/setup/order/orderData';
 import { expandIcon } from '@/common/setup/table/clolumn';
 import { handleComposeOrderTable } from '@/common/setup/table/compose';
 import { ComposeOrderTableParam } from '@/common/setup/table/interface';
-import { handleNoneValue, handleSubcriteQuote } from '@/common/setup/table/tableQuote';
+import { handleNoneValue, handleQuotePriceColor, handleSubcriteQuote } from '@/common/setup/table/tableQuote';
 import { getQuoteDayInfoByCodeFindPrice } from '@/services/bus/goods';
-import { useProfitloss, useHolderprice } from '@/services/bus/holdPosition';
+import { useHolderprice, useProfitloss } from '@/services/bus/holdPosition';
 import { queryTradePosition } from '@/services/go/ermcp/order';
 import { QueryTradePositionRsp } from '@/services/go/ermcp/order/interface';
 import { QueryQuoteGoodsListRsp } from '@/services/go/Tjmd/interface';
@@ -104,6 +104,7 @@ import { isInvestment } from '@/views/market/spot_trade/spot_trade_order_transac
 import { ref } from 'vue';
 import { findGoodsCode, getSwapList, getTableColums, useDetail } from './setup';
 
+
 export default defineComponent({
   name: enumOrderComponents.commodity_contract_summary,
   components: {
@@ -180,7 +181,7 @@ export default defineComponent({
       detailLoading,
       getDetailColums,
       detailTableList,
-      getDetailProfitloss, getDetailMarketAmount
+      getDetailProfitloss, getDetailMarketAmount,handleQuotePriceColor
     };
   },
 });