import { enumToProTableEnumValue } from '@/utils'; import { PAYEE_OPTIONS } from '../Order/constant'; export type InvoiceItem = { id: number; //id invoiceStatus: string; //发票类型:专票/普票 invoiceNumber: string; //发票号码 status: string; //状态 purchaser: string; //购买方 payee: string; //收款单位 contacts: string; //联系人 sale: string; //销售 money: number; //金额 invoicingTime: string; //开票日期 collectionTime: string; //收款时间 notes: string; //备注 }; export const INVOICE_STATUS = { UNVERIFIED: '未核销', VERIFIED: '已核销', ABNORMAL: '异常', PARTIAL_VERIFICATION: '部分核销', }; export const BANKSTATEMENT_STATUS = { VERIFIED: '已核销', ABNORMAL: '异常', }; export const INVOICE_COLUMNS = [ { dataIndex: 'invoiceId', title: 'id', valueType: 'text', hideInTable: true, hideInSearch: true, readonly: true, width: 100, }, { dataIndex: 'invoiceNumber', title: '发票号码', valueType: 'text', width: 100, }, { dataIndex: 'mainOrderId', title: '主订单id', valueType: 'text', width: 160, hideInTable: true, }, { dataIndex: 'invoiceStatus', title: '发票类型', valueType: 'select', width: 100, valueEnum: enumToProTableEnumValue({ SPECIALLY_INVOICED: '专票', COMMON_INVOICED: '普票', }), }, { title: '状态', dataIndex: 'statusText', valueType: 'text', width: 180, readonly: true, hideInSearch: true, }, { title: '状态', dataIndex: 'writeOffIdIsNull', valueType: 'select', width: 100, valueEnum: { true: { text: '未核销', status: false, }, false: { text: '已核销', status: true, }, }, hideInTable: true, }, { title: '订单状态', dataIndex: 'orderTypeText', readonly: true, valueType: 'text', hideInSearch: true, width: 180, }, { title: '绑定流水号', dataIndex: 'serialNumbersTextByOrder', readonly: true, hideInSearch: true, valueType: 'text', width: 180, }, { title: '金额', dataIndex: 'money', hideInTable: true, valueType: 'money', width: 180, }, { title: '是否预付款', dataIndex: 'orderIsPrePay', valueType: 'select', valueEnum: { true: { text: '是', status: true, }, false: { text: '否', status: false, }, }, hideInTable: true, width: 180, }, { title: '绑定流水号', dataIndex: 'serialNumberLike', hideInTable: true, valueType: 'text', width: 180, }, { title: '购买方', dataIndex: 'purchaser', valueType: 'text', width: 180, }, { title: '收款单位', dataIndex: 'payee', valueType: 'text', width: 180, valueEnum: enumToProTableEnumValue(PAYEE_OPTIONS), }, { title: '联系人', dataIndex: 'contacts', valueType: 'text', width: 100, }, { title: '来源', dataIndex: 'createByName', valueType: 'text', width: 100, }, { title: '销售', dataIndex: 'sale', valueType: 'text', width: 100, }, { title: '金额', dataIndex: 'money', valueType: 'money', hideInSearch: true, width: 100, }, { title: '开具类型', dataIndex: 'invoicingTypeText', valueType: 'invoicingTypeText', hideInSearch: true, readonly: true, width: 100, }, { title: '开票日期', dataIndex: 'invoicingTime', valueType: 'date', width: 150, hideInSearch: true, }, { title: '开票日期', valueType: 'dateRange', width: 150, hideInTable: true, search: { transform: (value) => { if (value) { return { invoicingBeginTime: value[0], invoicingEndTime: value[1], }; } }, }, }, { title: '收款时间', dataIndex: 'collectionTime', valueType: 'date', hideInSearch: true, width: 200, }, { title: '收款时间', valueType: 'dateRange', hideInTable: true, width: 200, search: { transform: (value) => { if (value) { return { collectionBeginTime: value[0], collectionEndTime: value[1], }; } }, }, }, { title: '备注', dataIndex: 'notes', valueType: 'text', hideInSearch: true, width: 250, }, ]; const convertToObjectWithTextAndStatus = (obj) => { const newObj = {}; for (const [key, value] of Object.entries(obj)) { newObj[key] = { text: value, status: key }; } return newObj; }; export const BANK_STATEMENT_COLUMNS = [ { dataIndex: 'id', title: '编号', valueType: 'text', width: 160, copyable: true, // hideInTable: true, // hideInSearch: true, editable: false, }, { dataIndex: 'statusText', title: '状态', hideInSearch: true, valueType: 'text', width: 100, }, { dataIndex: 'writeOffIdIsNull', title: '状态', hideInTable: true, valueType: 'select', valueEnum: { true: { text: '未核销', status: false, }, false: { text: '已核销', status: true, }, }, width: 100, }, { dataIndex: 'serialNumber', title: '流水号', valueType: 'text', width: 100, }, { dataIndex: 'collectionDatetime', title: '收款时间', valueType: 'date', width: 100, hideInSearch: true, }, { dataIndex: 'collectionDatetimeSearch', title: '收款时间', valueType: 'dateRange', width: 100, hideInTable: true, search: { transform: (value) => { if (value) { return { collectionDatetimeBegin: value[0], collectionDatetimeEnd: value[1], }; } }, }, }, { dataIndex: 'payeeText', title: '收款方', valueType: 'text', width: 100, hideInSearch: true, }, { title: '收款方', width: 80, dataIndex: 'payee', hideInTable: true, valueEnum: convertToObjectWithTextAndStatus(PAYEE_OPTIONS), }, { dataIndex: 'payer', title: '付款方', valueType: 'text', width: 100, }, { dataIndex: 'amount', title: '金额', valueType: 'text', width: 100, hideInSearch: true, }, { dataIndex: 'amount', title: '金额', valueType: 'money', width: 100, hideInTable: true, }, { dataIndex: 'remark', title: '备注', valueType: 'text', width: 100, hideInSearch: true, }, { dataIndex: 'remarkNote', title: '附言', valueType: 'text', width: 100, hideInSearch: true, }, ];