|
|
@@ -2,7 +2,7 @@
|
|
|
<!-- 成交记录 - 商品合约 - 历史记录-->
|
|
|
<div class="topTableHeight">
|
|
|
<a-table
|
|
|
- :columns="columns"
|
|
|
+ :columns="tabColumns"
|
|
|
class="srcollYTable"
|
|
|
:scroll="{ x: '100%', y: 'calc(100vh - 405px)' }"
|
|
|
:pagination="false"
|
|
|
@@ -12,78 +12,110 @@
|
|
|
rowKey="key"
|
|
|
:data-source="tableList"
|
|
|
>
|
|
|
- <!-- 类型 -->
|
|
|
- <template #buildtype="{ record }">
|
|
|
- <a>{{ getBuyOrSellTypeName(record.buyorsell) }}</a>
|
|
|
+ <template #createtime="{ record }">
|
|
|
+ <a>{{ formatTime(record.createtime) }}</a>
|
|
|
</template>
|
|
|
- <!-- 状态 -->
|
|
|
- <template #orderstatus="{ record }">
|
|
|
- <a>{{ getOrderStatusName(record.orderstatus) }}</a>
|
|
|
+ <!-- 现价 -->
|
|
|
+ <template #lastprice="{ record }">
|
|
|
+ <a>{{ getLastprice(record) }}</a>
|
|
|
</template>
|
|
|
-
|
|
|
- <template #ordertime="{ text }">
|
|
|
- <a>{{ formatTime(text) }}</a>
|
|
|
+ <!-- 均价 -->
|
|
|
+ <template #averageprice="{ text }">
|
|
|
+ <a>{{ text ? text : 0 }}</a>
|
|
|
+ </template>
|
|
|
+ <!-- 持仓盈亏 -->
|
|
|
+ <template #profitloss="{ record }">
|
|
|
+ <span>{{ record.averageprice ? useProfitloss(record) : '--' }}</span>
|
|
|
+ </template>
|
|
|
+ <template #buyorsell="{ record }">
|
|
|
+ <span>{{ getBuyOrSellName(record.buyorsell) }}</span>
|
|
|
+ </template>
|
|
|
+ <template #marketamount="{ record, text }">
|
|
|
+ <span>{{ isDiaoQi(record) ? '--' : text }}</span>
|
|
|
</template>
|
|
|
</a-table>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts">
|
|
|
-import { BtnListType } from '@/common/components/btnList/interface';
|
|
|
-import { enumOrderComponents } from '@/common/constants/enumOrderComponents';
|
|
|
-import { getBuyOrSellTypeName, getOrderStatusName } from '@/common/constants/enumsName';
|
|
|
-import { defineComponent, queryTableList } from '@/common/export/commonTable';
|
|
|
+import { TradeMode } from '@/common/constants/enumCommon';
|
|
|
+import { EnumRouterName } from '@/common/constants/enumRouterName';
|
|
|
+import { getBuyOrSellName } from '@/common/constants/enumsName';
|
|
|
+import { ComposeTableParam, defineComponent, queryTableList } from '@/common/export/commonTable';
|
|
|
import { formatTime } from '@/common/methods';
|
|
|
-import { getRecordItemTab } from '@/common/setup/order/orderData';
|
|
|
+import { handleSubcriteQuote } from '@/common/setup/table/tableQuote';
|
|
|
+import { findGoodsTradeModeById, getQuoteDayInfoByCodeFindPrice } from '@/services/bus/goods';
|
|
|
+import { useProfitloss } from '@/services/bus/holdPosition';
|
|
|
+import { queryHisTradeDetail } from '@/services/go/ermcp/order';
|
|
|
+import { QueryTradePositionRsp } from '@/services/go/ermcp/order/interface';
|
|
|
+import { QueryQuoteGoodsListRsp } from '@/services/go/Tjmd/interface';
|
|
|
+import { handleComposeTable } from '@/views/market/spot_trade/setup';
|
|
|
+import { getSwapList } from '@/views/market/spot_trade/spot_trade_order_transaction/spot_trade_order_transaction_swap/setup';
|
|
|
+import { findGoodsCode, tabColumns } from '@/views/order/commodity_contract/components/commodity_contract_summary/setup';
|
|
|
+import { ref } from 'vue';
|
|
|
import { expandIcon } from '@/common/setup/table/clolumn';
|
|
|
-import { handleComposeOrderTable } from '@/common/setup/table/compose';
|
|
|
-import { ComposeOrderTableParam } from '@/common/setup/table/interface';
|
|
|
-import { queryTradeOrderDetail } from '@/services/go/ermcp/order';
|
|
|
-import { QueryTradeOrderDetailRsp } from '@/services/go/ermcp/order/interface';
|
|
|
-import { WrPerformancePlan } from '@/services/go/wrtrade/interface';
|
|
|
-import Bus from '@/utils/eventBus/index';
|
|
|
|
|
|
export default defineComponent({
|
|
|
- name: enumOrderComponents.commodity_contract_commission,
|
|
|
- setup() {
|
|
|
- // 表格列表数据
|
|
|
- const { loading, tableList, queryTable } = queryTableList<QueryTradeOrderDetailRsp>();
|
|
|
- // 获取列表数据
|
|
|
- const queryTableAction = () => {
|
|
|
- queryTable(queryTradeOrderDetail, {});
|
|
|
- };
|
|
|
- // 表格通用逻辑
|
|
|
- const param: ComposeOrderTableParam = {
|
|
|
- queryFn: queryTableAction,
|
|
|
- tableName: 'table_pcweb_spot_trade_bottom_commodity_contract_commission',
|
|
|
- recordList: getRecordItemTab(),
|
|
|
- };
|
|
|
- function filterBtnList(list: BtnListType[], record: QueryTradeOrderDetailRsp) {
|
|
|
- //委托状态 - 1:委托请求 2:待冻结 3:委托成功 4:委托失败 5:配对成功 6:已撤 7:已成 8:成交失败 9:委托拒绝 1number;
|
|
|
- const arr = [3, 7];
|
|
|
- if (!arr.includes(record.orderstatus)) {
|
|
|
- return list.filter((e) => e.code !== 'commodity_contract_commission_cancel_order');
|
|
|
- } else {
|
|
|
- return list;
|
|
|
- }
|
|
|
- }
|
|
|
- // 挂牌
|
|
|
- Bus.$on('spotTrade', () => {
|
|
|
- queryTableAction();
|
|
|
+ name: EnumRouterName.search_document_records_contract_summary,
|
|
|
+ setup() {
|
|
|
+ // 表格列表数据
|
|
|
+ const { loading, tableList, queryTable } = queryTableList<QueryTradePositionRsp>();
|
|
|
+ const { subscribeAction } = handleSubcriteQuote();
|
|
|
+ const swapList = ref<QueryQuoteGoodsListRsp[]>([]);
|
|
|
+ // 获取列表数据
|
|
|
+ const queryTableAction = () => {
|
|
|
+ Promise.all([queryTable(queryHisTradeDetail, {}), getSwapList()]).then((res) => {
|
|
|
+ swapList.value = res[1];
|
|
|
+ tableList.value = res[0];
|
|
|
+ const goodsSet = new Set<string>();
|
|
|
+ res[0].forEach((el) => {
|
|
|
+ // 商品掉期取参考行情最新价,挂牌点选取自己行情的最新价
|
|
|
+ const goodscode = findGoodsCode(el.goodsid, el.goodscode, swapList.value);
|
|
|
+ if (goodscode) {
|
|
|
+ goodsSet.add(goodscode);
|
|
|
+ }
|
|
|
});
|
|
|
- return {
|
|
|
- ...handleComposeOrderTable<WrPerformancePlan>(param),
|
|
|
- loading,
|
|
|
- tableList,
|
|
|
- formatTime,
|
|
|
- expandIcon,
|
|
|
- getBuyOrSellTypeName,
|
|
|
- getOrderStatusName,
|
|
|
- filterBtnList,
|
|
|
- };
|
|
|
- },
|
|
|
+ // 行情订阅
|
|
|
+ subscribeAction([...goodsSet]);
|
|
|
+ });
|
|
|
+ };
|
|
|
+ // 现价
|
|
|
+ function getLastprice(record: QueryTradePositionRsp) {
|
|
|
+ let result: number | string = '--';
|
|
|
+ const goodscode = findGoodsCode(record.goodsid, record.goodscode, swapList.value);
|
|
|
+ if (goodscode) {
|
|
|
+ result = getQuoteDayInfoByCodeFindPrice(goodscode);
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ function isDiaoQi(record: QueryTradePositionRsp) {
|
|
|
+ return findGoodsTradeModeById(record.goodsid) === TradeMode.DiaoQi;
|
|
|
+ }
|
|
|
+ // 表格通用逻辑
|
|
|
+ const param: ComposeTableParam = {
|
|
|
+ queryFn: queryTableAction,
|
|
|
+ menuType: EnumRouterName.warehouse_pre_sale_price,
|
|
|
+ tableName: 'table_pcweb_spot_trade_warehouse_sale_price',
|
|
|
+ tableFilterKey: [],
|
|
|
+ isDetail: false,
|
|
|
+ };
|
|
|
+
|
|
|
+ return {
|
|
|
+ ...handleComposeTable<QueryTradePositionRsp>(param),
|
|
|
+ loading,
|
|
|
+ tableList,
|
|
|
+ tabColumns,
|
|
|
+ formatTime,
|
|
|
+ getLastprice,
|
|
|
+ useProfitloss,
|
|
|
+ findGoodsCode,
|
|
|
+ swapList,
|
|
|
+ getBuyOrSellName,
|
|
|
+ isDiaoQi,
|
|
|
+ expandIcon,
|
|
|
+ };
|
|
|
+ },
|
|
|
});
|
|
|
</script>
|
|
|
-
|
|
|
<style lang="less">
|
|
|
-</style>;
|
|
|
+</style>
|