|
|
@@ -23,18 +23,6 @@
|
|
|
<template #createtime="{ record }">
|
|
|
<a>{{ formatTime(record.createtime) }}</a>
|
|
|
</template>
|
|
|
- <!-- 现价 -->
|
|
|
- <template #lastprice="{ record }">
|
|
|
- <a>{{ getLastprice(record) }}</a>
|
|
|
- </template>
|
|
|
- <!-- 持仓金额 -->
|
|
|
- <template #holderprice="{ record }">
|
|
|
- <a>{{ getHolderprice(record) }}</a>
|
|
|
- </template>
|
|
|
- <!-- 持仓盈亏 -->
|
|
|
- <template #profitloss="{ record }">
|
|
|
- <a>{{ getProfitloss(record) }}</a>
|
|
|
- </template>
|
|
|
</a-table>
|
|
|
<component :is="componentId"
|
|
|
v-if="componentId"
|
|
|
@@ -60,6 +48,8 @@ import { handleDeliveryRelation } from '@/common/setup/deliveryRelation';
|
|
|
import { TradeMode } from '@/common/constants/enumCommon';
|
|
|
import { BtnListType } from '@/common/components/btnList/interface';
|
|
|
import { columns } from './setup';
|
|
|
+import { queryTjmdTransferApply } from '@/services/go/Tjmd';
|
|
|
+import { QueryTjmdTransferApplyReq } from '@/services/go/Tjmd/interface';
|
|
|
|
|
|
export default defineComponent({
|
|
|
name: 'commodity_contract_bargain',
|
|
|
@@ -76,54 +66,18 @@ export default defineComponent({
|
|
|
// 交割商品
|
|
|
handleDeliveryRelation();
|
|
|
// 获取列表数据
|
|
|
- const queryTableAction = () => {
|
|
|
- queryTable(queryTradePosition).then((res) => {
|
|
|
- const goodsList = res.map((el) => {
|
|
|
- return el.goodscode;
|
|
|
- });
|
|
|
- // 行情订阅
|
|
|
- subscribeAction(goodsList);
|
|
|
- });
|
|
|
+ const queryTableAction = (applytype: 1 | 2) => {
|
|
|
+ const param: QueryTjmdTransferApplyReq = {
|
|
|
+ applytype,
|
|
|
+ };
|
|
|
+ queryTable(queryTjmdTransferApply, param);
|
|
|
};
|
|
|
// 表格通用逻辑
|
|
|
const param: ComposeOrderTableParam = {
|
|
|
- queryFn: queryTableAction,
|
|
|
+ queryFn: () => queryTableAction(1),
|
|
|
recordList: getRecordItemTab(),
|
|
|
};
|
|
|
- // 现价
|
|
|
- function getLastprice({ goodscode, decimalplace }: QueryTradePositionRsp) {
|
|
|
- const item = getQuoteDayInfoByCode(goodscode);
|
|
|
- let result = '';
|
|
|
- if (item) {
|
|
|
- const { last, presettle } = item;
|
|
|
- if (last) {
|
|
|
- result = last.toFixed(decimalplace); // 最新
|
|
|
- } else if (presettle) {
|
|
|
- result = presettle.toFixed(decimalplace); // 昨结
|
|
|
- }
|
|
|
- }
|
|
|
- return result;
|
|
|
- }
|
|
|
- // 持仓金额 = 数量 * 现价 * 合约单位
|
|
|
- function getHolderprice(record: QueryTradePositionRsp) {
|
|
|
- const price = getLastprice(record);
|
|
|
- if (price !== '--') {
|
|
|
- const { decimalplace, agreeunit, curpositionqty } = record;
|
|
|
- return (+price * curpositionqty * agreeunit).toFixed(decimalplace);
|
|
|
- } else {
|
|
|
- return price;
|
|
|
- }
|
|
|
- }
|
|
|
- /// 持仓盈亏 买方向 = (最新价 - 持仓均价) * 买期末头寸 * 合约单位;卖方向 = (持仓均价 - 最新价) * 卖期末头寸 * 合约单位
|
|
|
- function getProfitloss(record: QueryTradePositionRsp) {
|
|
|
- const price = getLastprice(record);
|
|
|
- if (price !== '--') {
|
|
|
- const { averageprice, decimalplace, agreeunit, curpositionqty } = record;
|
|
|
- return ((+price - averageprice) * curpositionqty * agreeunit).toFixed(decimalplace);
|
|
|
- } else {
|
|
|
- return price;
|
|
|
- }
|
|
|
- }
|
|
|
+
|
|
|
function handleBtnList(record: QueryTradePositionRsp, btnList: BtnListType[]) {
|
|
|
if (findGoodsTradeModeById(record.goodsid) === TradeMode.DiaoQi) {
|
|
|
return btnList.filter((e) => e.code === 'commodity_contract_summary_deal_closed');
|
|
|
@@ -138,9 +92,6 @@ export default defineComponent({
|
|
|
tableList,
|
|
|
formatTime,
|
|
|
expandIcon,
|
|
|
- getLastprice,
|
|
|
- getHolderprice,
|
|
|
- getProfitloss,
|
|
|
handleBtnList,
|
|
|
};
|
|
|
},
|