import { WrOrderDetail } from "@/services/go/wrtrade/interface"; export const useOrderWarrant = (hasWR: 0 | 1) => { const tableColumns = [ { key: '0th', dataIndex: 'wrtradeorderid', title: '挂牌单号', align: 'center', slots: { customRender: 'wrtradeorderid', }, width: 180, }, { key: '6th', dataIndex: 'wrtradetype', title: '挂牌类型', align: 'center', slots: { customRender: 'wrtradetype', }, width: 120, }, { key: '7th', dataIndex: 'deliverygoodsname', title: '品种', align: 'center', slots: { customRender: 'deliverygoodsname', }, width: 120, }, { key: '8th', dataIndex: 'wrtypename', title: '商品', align: 'center', slots: { customRender: 'wrtypename', }, width: 250, }, { key: '9th', dataIndex: 'warehousename', title: '仓库', align: 'center', slots: { customRender: 'warehousename', }, width: 120, }, { key: '5th', dataIndex: 'wrpricetype', title: '挂牌方式', align: 'center', slots: { customRender: 'wrpricetype', }, width: 250, }, { key: '101th', dataIndex: 'goodscode', title: '期货合约', align: 'center', slots: { customRender: 'goodscode', }, width: 200, }, { key: '10th', dataIndex: 'futushow', title: '价格/基差', align: 'center', slots: { customRender: 'futushow', }, width: 200, }, { key: '1th', dataIndex: 'orderqty', title: '挂牌数量', align: 'center', slots: { customRender: 'orderqty', }, width: 120, }, { key: '2th', dataIndex: 'tradeqty', title: '成交数量', align: 'center', slots: { customRender: 'tradeqty', }, width: 120, }, { key: '3th', dataIndex: 'ordertime', title: '挂牌时间', align: 'center', slots: { customRender: 'ordertime', }, width: 250, }, { key: '4th', dataIndex: 'wrtradeorderstatus', title: '状态', align: 'center', slots: { customRender: 'wrtradeorderstatus', }, width: 120, }, ]; if (!hasWR) { // 无仓单 需要交收月 const obj = { key: '42th', dataIndex: 'deliverymonth', title: '交收月', align: 'center', slots: { customRender: 'deliverymonth', }, width: 120, } tableColumns.splice(6, 0, obj) } // 挂牌方式 function getWrPriceType({ wrpricetype, isspecified, canbargain }: WrOrderDetail) { let result = '--' if (isspecified) { if (canbargain) { result = '贸易圈-可议价' } else { result = '贸易圈' } } else { if (wrpricetype === 1) { result = '一口价' } else { result = '浮动价' } } return result } // 是否显示 议价单 按钮 function isShowBarginBtn({ isspecified, canbargain }: WrOrderDetail) { return isspecified && canbargain } // 显示价格 或者基差 function showPriceOrMove({ wrpricetype, fixedprice, pricemove }: WrOrderDetail) { const result = wrpricetype === 1 ? fixedprice : pricemove return result ? result : '--' } return { tableColumns, getWrPriceType, isShowBarginBtn, showPriceOrMove } }