From 8b79f1bda77052c403ce6fdb6fc31b163d0e58d2 Mon Sep 17 00:00:00 2001 From: shenyifei Date: Tue, 13 Jan 2026 16:02:37 +0800 Subject: [PATCH] =?UTF-8?q?refactor(payment):=20=E9=87=8D=E6=9E=84?= =?UTF-8?q?=E6=94=AF=E4=BB=98=E7=9B=B8=E5=85=B3=E7=BB=84=E4=BB=B6=E5=92=8C?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E5=AE=9A=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 更新公司支付账户模态框中的账户列表过滤逻辑 - 修改经销商支付账户列表中账户ID参数为可选类型 - 优化经销商搜索组件的状态管理和副作用处理 - 在支付记录列表中使用账户类别映射替代硬编码值枚举 - 为支付任务支付组件添加支付时间日期选择器 - 扩展对账单相关组件导出并新增发票选择功能 - 更新对账单发票列表的数据结构和初始化逻辑 - 在对账单列表中调整完成状态检查和发票上传按钮显示条件 - 重构对账单支付列表的列配置和表单字段定义 - 更新对账单搜索组件的状态管理逻辑 - 本地化文件中更新对账单相关字段标签和占位符文本 - 服务类型定义中更新账户类别和类型的枚举值 - 添加类型修复脚本用于处理数字数组类型转换问题 - 新增对账单发票表单项和模态框组件实现 --- packages/app-operation/package.json | 3 +- .../Company/CompanyPaymentAccountModal.tsx | 15 +- .../Dealer/DealerPaymentAccountList.tsx | 2 +- .../src/components/Dealer/DealerSearch.tsx | 15 +- .../src/components/Dealer/DealerSelect.tsx | 1 + .../PaymentRecord/PaymentRecordList.tsx | 13 +- .../components/PaymentTask/PaymentTaskPay.tsx | 29 +- .../ReconciliationInvoiceFormItem.tsx | 66 + .../ReconciliationInvoiceList.tsx | 14 +- .../ReconciliationInvoiceModal.tsx | 331 + .../ReconciliationInvoiceSearch.tsx | 79 + .../ReconciliationInvoiceSelect.tsx | 57 + .../Reconciliation/ReconciliationList.tsx | 22 +- .../ReconciliationPaymentList.tsx | 287 +- .../Reconciliation/ReconciliationSearch.tsx | 8 +- .../src/components/Reconciliation/index.ts | 6 + packages/app-operation/src/locales/zh-CN.ts | 55 +- .../src/services/business/typings.d.ts | 30 +- scripts/fix-types.js | 64 + swagger/business.json | 26837 +++++++++++++++- 20 files changed, 27783 insertions(+), 151 deletions(-) create mode 100644 packages/app-operation/src/components/Reconciliation/ReconciliationInvoiceFormItem.tsx create mode 100644 packages/app-operation/src/components/Reconciliation/ReconciliationInvoiceModal.tsx create mode 100644 packages/app-operation/src/components/Reconciliation/ReconciliationInvoiceSearch.tsx create mode 100644 packages/app-operation/src/components/Reconciliation/ReconciliationInvoiceSelect.tsx create mode 100644 scripts/fix-types.js diff --git a/packages/app-operation/package.json b/packages/app-operation/package.json index 53c7925..3c0c492 100644 --- a/packages/app-operation/package.json +++ b/packages/app-operation/package.json @@ -5,9 +5,10 @@ "scripts": { "build": "max build", "dev": "max dev", + "fix-types": "node ../../scripts/fix-types.js", "format": "prettier --cache --write ./src/pages ./src/services ./src/components ./src/constants ./src/models ./src/utils ./src/access.ts ./src/app.tsx", "postinstall": "max setup", - "openapi": "max openapi && prettier --cache --write ./src/services", + "openapi": "max openapi && prettier --cache --write ./src/services && npm run fix-types", "setup": "max setup", "start": "npm run dev" } diff --git a/packages/app-operation/src/components/Company/CompanyPaymentAccountModal.tsx b/packages/app-operation/src/components/Company/CompanyPaymentAccountModal.tsx index cf0ef9e..f641c46 100644 --- a/packages/app-operation/src/components/Company/CompanyPaymentAccountModal.tsx +++ b/packages/app-operation/src/components/Company/CompanyPaymentAccountModal.tsx @@ -1,3 +1,4 @@ +import { SelectModal } from '@/components'; import { business } from '@/services'; import { formatParam } from '@/utils/formatParam'; import { pagination } from '@/utils/pagination'; @@ -7,7 +8,6 @@ import { LightFilter, ProColumns, } from '@ant-design/pro-components'; -import { SelectModal } from '@/components'; import { Alert, ModalProps, Row, Tag } from 'antd'; import React, { useEffect, useRef, useState } from 'react'; @@ -282,8 +282,14 @@ export default function CompanyPaymentAccountModal( <> {tips && } - {accountList.map( - (item: BusinessAPI.CompanyPaymentAccountVO) => { + {accountList + .filter((item: BusinessAPI.CompanyPaymentAccountVO) => { + if (params.companyId) { + return item.companyId === params.companyId; + } + return true; + }) + .map((item: BusinessAPI.CompanyPaymentAccountVO) => { return ( ); - }, - )} + })} ); diff --git a/packages/app-operation/src/components/Dealer/DealerPaymentAccountList.tsx b/packages/app-operation/src/components/Dealer/DealerPaymentAccountList.tsx index 6a8bf76..a2bc741 100644 --- a/packages/app-operation/src/components/Dealer/DealerPaymentAccountList.tsx +++ b/packages/app-operation/src/components/Dealer/DealerPaymentAccountList.tsx @@ -14,7 +14,7 @@ import React from 'react'; interface IDealerPaymentAccountListProps { ghost?: boolean; dealerVO?: BusinessAPI.DealerVO; - accountId: BusinessAPI.DealerPaymentAccountVO['accountId']; + accountId?: BusinessAPI.DealerPaymentAccountVO['accountId']; search?: boolean; onValueChange?: () => void; mode?: ModeType; diff --git a/packages/app-operation/src/components/Dealer/DealerSearch.tsx b/packages/app-operation/src/components/Dealer/DealerSearch.tsx index 1f16a92..1c529a9 100644 --- a/packages/app-operation/src/components/Dealer/DealerSearch.tsx +++ b/packages/app-operation/src/components/Dealer/DealerSearch.tsx @@ -4,7 +4,7 @@ import { ProFormSelect, ProFormSelectProps, } from '@ant-design/pro-components'; -import { useState } from 'react'; +import { useEffect, useState } from 'react'; export interface IDealerSearchProps extends ProFormSelectProps { form: FormInstance; @@ -17,8 +17,11 @@ export default function DealerSearch(props: IDealerSearchProps) { const { form, selectedList, onFinish, params, ...rest } = props; const [showDealerModal, setShowDealerModal] = useState(false); - const [dealerList, setDealerList] = - useState<(BusinessAPI.DealerVO | undefined)[]>(); + const [dealerList, setDealerList] = useState(); + + useEffect(() => { + setDealerList(selectedList); + }, [selectedList]); return ( <> @@ -31,11 +34,6 @@ export default function DealerSearch(props: IDealerSearchProps) { }, placeholder: '请选择经销商', options: dealerList?.map((dealerVO?: BusinessAPI.DealerVO) => { - console.log( - 'dealerVO', - dealerVO, - `${dealerVO?.dealerType === 'MARKET' ? '市场' : '超市'} | ${dealerVO?.shortName}`, - ); return { value: dealerVO?.dealerId, label: `${dealerVO?.dealerType === 'MARKET' ? '市场' : '超市'} | ${dealerVO?.shortName}`, @@ -50,6 +48,7 @@ export default function DealerSearch(props: IDealerSearchProps) { onCancel={() => setShowDealerModal(false)} selectedList={selectedList} onFinish={async (dealerVOList) => { + console.log('dealerVOList', dealerVOList); if (dealerVOList.length > 0) { const dealerVO = dealerVOList[0]; form.setFieldsValue({ diff --git a/packages/app-operation/src/components/Dealer/DealerSelect.tsx b/packages/app-operation/src/components/Dealer/DealerSelect.tsx index a538219..1297c03 100644 --- a/packages/app-operation/src/components/Dealer/DealerSelect.tsx +++ b/packages/app-operation/src/components/Dealer/DealerSelect.tsx @@ -16,6 +16,7 @@ export default function DealerSelect(props: IUserSelectProps) { return ( {({ dealerVO, canChangeDealer }, form) => { + console.log('dealerVO', dealerVO); return ( - {/* 模块2:瓜农车次列表 */} {({ orderSupplierVOList }) => { @@ -307,7 +308,6 @@ export default function PaymentTaskPay(props: IPaymentTaskPayProps) { ); }} - {/* 模块3:本次付款 */} - {/* 收款人 */} - {/* 选择付款账户 */} - - {/* 上传付款凭证 */} + + ,{/* 上传付款凭证 */} - {/* 付款备注 */} {({ remark }, form) => { diff --git a/packages/app-operation/src/components/Reconciliation/ReconciliationInvoiceFormItem.tsx b/packages/app-operation/src/components/Reconciliation/ReconciliationInvoiceFormItem.tsx new file mode 100644 index 0000000..0ec3d68 --- /dev/null +++ b/packages/app-operation/src/components/Reconciliation/ReconciliationInvoiceFormItem.tsx @@ -0,0 +1,66 @@ +import { ReconciliationInvoiceModal } from '@/components'; +import { ProFormSelect } from '@ant-design/pro-components'; +import { ProFieldFCRenderProps } from '@ant-design/pro-provider'; +import { useState } from 'react'; + +export interface IReconciliationInvoiceFormItemProps extends Omit< + ProFieldFCRenderProps, + 'value' | 'onChange' +> { + value?: BusinessAPI.ReconciliationInvoiceVO['reconciliationInvoiceId']; + onChange?: ( + value?: BusinessAPI.ReconciliationInvoiceVO['reconciliationInvoiceId'], + ) => void; +} + +export default function ReconciliationInvoiceFormItem( + props: IReconciliationInvoiceFormItemProps, +) { + const { value, onChange } = props; + + const [showReconciliationInvoiceModal, setShowReconciliationInvoiceModal] = + useState(false); + const [reconciliationInvoiceList, setReconciliationInvoiceList] = + useState<(BusinessAPI.ReconciliationInvoiceVO | undefined)[]>(); + + return ( + <> + { + onChange?.(undefined); + }, + onClick: () => { + setShowReconciliationInvoiceModal(true); + }, + value: value, + placeholder: '请选择对账开票', + options: reconciliationInvoiceList?.map( + (reconciliationInvoiceVO?: BusinessAPI.ReconciliationInvoiceVO) => { + return { + value: reconciliationInvoiceVO?.reconciliationInvoiceId, + label: reconciliationInvoiceVO?.invoiceSn, + }; + }, + ), + }} + /> + setShowReconciliationInvoiceModal(false)} + onCancel={() => setShowReconciliationInvoiceModal(false)} + onFinish={async (reconciliationInvoiceVOList) => { + if (reconciliationInvoiceVOList.length > 0) { + const reconciliationInvoiceVO = reconciliationInvoiceVOList[0]; + onChange?.(reconciliationInvoiceVO?.reconciliationInvoiceId); + setReconciliationInvoiceList(reconciliationInvoiceVOList); + setShowReconciliationInvoiceModal(false); + } + }} + type={'radio'} + /> + + ); +} diff --git a/packages/app-operation/src/components/Reconciliation/ReconciliationInvoiceList.tsx b/packages/app-operation/src/components/Reconciliation/ReconciliationInvoiceList.tsx index e4ec38f..d6a4a7b 100644 --- a/packages/app-operation/src/components/Reconciliation/ReconciliationInvoiceList.tsx +++ b/packages/app-operation/src/components/Reconciliation/ReconciliationInvoiceList.tsx @@ -23,7 +23,8 @@ import React from 'react'; interface IReconciliationInvoiceListProps { ghost?: boolean; - reconciliationId?: BusinessAPI.ReconciliationInvoiceVO['reconciliationId']; + reconciliationId?: BusinessAPI.ReconciliationVO['reconciliationId']; + reconciliationVO?: BusinessAPI.ReconciliationVO; dealerId?: BusinessAPI.ReconciliationInvoiceVO['dealerId']; search?: boolean; onValueChange?: () => void; @@ -37,6 +38,7 @@ export default function ReconciliationInvoiceList( const { ghost = false, reconciliationId, + reconciliationVO, dealerId, search = true, mode = 'page', @@ -337,6 +339,16 @@ export default function ReconciliationInvoiceList( formType: 'drawer', formContext, trigger, + initValues: { + ...(reconciliationVO && { + reconciliationId: reconciliationVO.reconciliationId, + reconciliationVO: reconciliationVO, + canChangeReconciliation: false, + dealerId: reconciliationVO.dealerId, + dealerVO: reconciliationVO.dealerVO, + canChangeDealer: false, + }), + }, }} update={false} destroy={false} diff --git a/packages/app-operation/src/components/Reconciliation/ReconciliationInvoiceModal.tsx b/packages/app-operation/src/components/Reconciliation/ReconciliationInvoiceModal.tsx new file mode 100644 index 0000000..a412a74 --- /dev/null +++ b/packages/app-operation/src/components/Reconciliation/ReconciliationInvoiceModal.tsx @@ -0,0 +1,331 @@ +import { SelectModal } from '@/components'; +import { business } from '@/services'; +import { formatCurrency } from '@/utils/format'; +import { formatParam } from '@/utils/formatParam'; +import { pagination } from '@/utils/pagination'; +import { useIntl } from '@@/exports'; +import { + ActionType, + LightFilter, + ProColumns, +} from '@ant-design/pro-components'; +import { Alert, ModalProps, Row, Space, Tag } from 'antd'; +import React, { useEffect, useRef, useState } from 'react'; + +export interface IReconciliationInvoiceModalProps extends ModalProps { + title: string; + selectedList?: BusinessAPI.ReconciliationInvoiceVO[]; + onFinish: ( + reconciliationInvoiceVOList: BusinessAPI.ReconciliationInvoiceVO[], + ) => void; + type: 'checkbox' | 'radio' | undefined; + params?: BusinessAPI.ReconciliationInvoicePageQry; + num?: number; + tips?: string; + extraFilter?: React.ReactNode[]; + extraColumns?: ProColumns[]; +} + +export default function ReconciliationInvoiceModal( + props: IReconciliationInvoiceModalProps, +) { + const { + title, + onFinish, + type, + selectedList, + params: initParams, + num = 10, + tips, + extraFilter = [], + extraColumns: initExtraColumns = [], + ...rest + } = props; + const actionRef = useRef(); + const sessionKey = `reconciliationInvoiceList`; + const [params, setParams] = + useState(initParams || {}); + + useEffect(() => { + if (initParams) { + setParams({ + ...params, + ...initParams, + }); + } + }, [initParams]); + + const intl = useIntl(); + const intlPrefix = 'reconciliationInvoice'; + + const columns: ProColumns[] = [ + { + title: intl.formatMessage({ + id: intlPrefix + '.column.invoiceSn', + }), + dataIndex: 'invoiceSn', + key: 'invoiceSn', + renderText: (text: string) => {text}, + }, + { + title: intl.formatMessage({ id: intlPrefix + '.column.dealer' }), + dataIndex: 'dealerVO', + key: 'dealerId', + search: false, + render: (_, record) => + record.dealerVO?.shortName || record.dealerVO?.fullName, + }, + { + title: intl.formatMessage({ id: intlPrefix + '.column.company' }), + dataIndex: 'companyVO', + key: 'companyId', + search: false, + render: (_, record) => + record.companyVO?.shortName || record.companyVO?.fullName, + }, + { + title: intl.formatMessage({ + id: intlPrefix + '.column.invoiceAmount', + }), + dataIndex: 'invoiceAmount', + key: 'invoiceAmount', + valueType: 'money', + search: false, + render: (_, record) => ( + + ¥{formatCurrency(record.invoiceAmount)} + + ), + }, + { + title: intl.formatMessage({ id: intlPrefix + '.column.invoiceDate' }), + dataIndex: 'invoiceDate', + key: 'invoiceDate', + valueType: 'dateTime', + search: false, + }, + ...(initExtraColumns || []), + ]; + + function setReconciliationInvoiceVOStorage( + reconciliationInvoiceVO: BusinessAPI.ReconciliationInvoiceVO, + ) { + const localReconciliationInvoiceList = localStorage.getItem(sessionKey); + const reconciliationInvoiceList = localReconciliationInvoiceList + ? JSON.parse(localReconciliationInvoiceList) + : []; + reconciliationInvoiceList.forEach( + (item: BusinessAPI.ReconciliationInvoiceVO, index: number) => { + if ( + item.reconciliationInvoiceId === + reconciliationInvoiceVO.reconciliationInvoiceId + ) { + reconciliationInvoiceList.splice(index, 1); + } + }, + ); + if (reconciliationInvoiceList.length < 5) { + reconciliationInvoiceList.unshift(reconciliationInvoiceVO); + localStorage.setItem( + sessionKey, + JSON.stringify(reconciliationInvoiceList), + ); + } else { + reconciliationInvoiceList.pop(); + reconciliationInvoiceList.unshift(reconciliationInvoiceVO); + localStorage.setItem( + sessionKey, + JSON.stringify(reconciliationInvoiceList), + ); + } + } + + return ( + + rowKey={'reconciliationInvoiceId'} + modalProps={{ + title: title || '选择对账开票', + ...rest, + destroyOnHidden: true, + afterOpenChange: (open) => { + if (!open) { + setParams({ + ...initParams, + }); + } + }, + }} + selectedList={selectedList} + tableProps={{ + rowKey: 'reconciliationInvoiceId', + columns: columns, + columnsState: { + persistenceType: 'sessionStorage', + persistenceKey: 'reconciliationInvoiceModalColumnStateKey', + }, + params: { + ...params, + }, + request: async (params, sorter, filter) => { + const { data, success, totalCount } = + await business.reconciliationInvoice.pageReconciliationInvoice({ + reconciliationInvoicePageQry: formatParam( + params, + sorter, + filter, + ), + }); + + return { + data: data || [], + total: totalCount, + success, + }; + }, + pagination: { + ...pagination(), + position: ['bottomRight'], + }, + tableAlertRender: ({ selectedRowKeys, selectedRows }) => { + // selectedRows 和 selectedList 组合在一起,去重 + const selectedRowsMap = new Map< + string, + BusinessAPI.ReconciliationInvoiceVO + >(); + selectedRows.forEach((item: BusinessAPI.ReconciliationInvoiceVO) => { + if (item) { + if (!selectedRowsMap.has(item.reconciliationInvoiceId)) { + selectedRowsMap.set(item.reconciliationInvoiceId, item); + } + } + }); + selectedList?.forEach((item: BusinessAPI.ReconciliationInvoiceVO) => { + if (!selectedRowsMap.has(item.reconciliationInvoiceId)) { + selectedRowsMap.set(item.reconciliationInvoiceId, item); + } + }); + let selectedTempList: BusinessAPI.ReconciliationInvoiceVO[] = []; + selectedRowsMap.forEach( + (item: BusinessAPI.ReconciliationInvoiceVO) => { + if (selectedRowKeys.includes(item.reconciliationInvoiceId)) { + selectedTempList.push(item); + } + }, + ); + return ( + + 已选 {selectedRowKeys.length} 项 + + {selectedTempList?.map( + (item: BusinessAPI.ReconciliationInvoiceVO) => { + return ( + item && ( + + {item.invoiceSn} + + ) + ); + }, + )} + + + ); + }, + ...(tips && { + tableExtraRender: () => { + return tips && ; + }, + }), + ...(type === 'radio' && { + tableExtraRender: () => { + const localReconciliationInvoiceList = + localStorage.getItem(sessionKey); + if (localReconciliationInvoiceList) { + const reconciliationInvoiceList = JSON.parse( + localReconciliationInvoiceList, + ); + return ( + <> + {tips && } + + {reconciliationInvoiceList.map( + (item: BusinessAPI.ReconciliationInvoiceVO) => { + return ( + { + const { data: reconciliationInvoiceVO } = + await business.reconciliationInvoice.showReconciliationInvoice( + { + reconciliationInvoiceShowQry: { + reconciliationInvoiceId: + item.reconciliationInvoiceId, + }, + }, + ); + + if (reconciliationInvoiceVO) { + onFinish([reconciliationInvoiceVO]); + setReconciliationInvoiceVOStorage( + reconciliationInvoiceVO, + ); + } + }} + key={item.reconciliationInvoiceId} + > + {item.invoiceSn} + + ); + }, + )} + + + ); + } + }, + }), + actionRef: actionRef, + toolbar: { + actions: [], + filter: ( + { + setParams({ + ...initParams, + ...values, + }); + }} + > + {extraFilter} + + ), + search: { + placeholder: '请输入发票编码', + onSearch: async (value: string) => { + setParams({ + ...params, + invoiceSn: value, + }); + }, + }, + }, + }} + onFinish={(reconciliationInvoiceVOList) => { + if (type === 'radio') { + if (reconciliationInvoiceVOList.length > 0) { + setReconciliationInvoiceVOStorage(reconciliationInvoiceVOList[0]); + } + } + + onFinish(reconciliationInvoiceVOList); + }} + num={num} + type={type} + /> + ); +} diff --git a/packages/app-operation/src/components/Reconciliation/ReconciliationInvoiceSearch.tsx b/packages/app-operation/src/components/Reconciliation/ReconciliationInvoiceSearch.tsx new file mode 100644 index 0000000..7c8f557 --- /dev/null +++ b/packages/app-operation/src/components/Reconciliation/ReconciliationInvoiceSearch.tsx @@ -0,0 +1,79 @@ +import { + IReconciliationInvoiceModalProps, + ReconciliationInvoiceModal, +} from '@/components'; +import { + FormInstance, + ProFormSelect, + ProFormSelectProps, +} from '@ant-design/pro-components'; +import { useState } from 'react'; + +export interface IReconciliationInvoiceSearchProps extends ProFormSelectProps { + form: FormInstance; + selectedList?: IReconciliationInvoiceModalProps['selectedList']; + onFinish?: ( + reconciliationInvoiceVOList: BusinessAPI.ReconciliationInvoiceVO[], + ) => void; + params: BusinessAPI.ReconciliationInvoicePageQry; +} + +export default function ReconciliationInvoiceSearch( + props: IReconciliationInvoiceSearchProps, +) { + const { form, selectedList, onFinish, params, ...rest } = props; + + const [showReconciliationInvoiceModal, setShowReconciliationInvoiceModal] = + useState(false); + const [reconciliationInvoiceList, setReconciliationInvoiceList] = + useState<(BusinessAPI.ReconciliationInvoiceVO | undefined)[]>(); + + return ( + <> + { + setShowReconciliationInvoiceModal(true); + }, + placeholder: '请选择对账开票', + options: reconciliationInvoiceList?.map( + (reconciliationInvoiceVO?: BusinessAPI.ReconciliationInvoiceVO) => { + return { + value: reconciliationInvoiceVO?.reconciliationInvoiceId, + label: reconciliationInvoiceVO?.invoiceSn, + }; + }, + ), + }} + /> + setShowReconciliationInvoiceModal(false)} + onCancel={() => setShowReconciliationInvoiceModal(false)} + selectedList={selectedList} + onFinish={async (reconciliationInvoiceVOList) => { + if (reconciliationInvoiceVOList.length > 0) { + const reconciliationInvoiceVO = reconciliationInvoiceVOList[0]; + form.setFieldsValue({ + reconciliationInvoiceId: + reconciliationInvoiceVO?.reconciliationInvoiceId, + reconciliationInvoiceVO: reconciliationInvoiceVO, + }); + form.validateFields([ + 'reconciliationInvoiceId', + 'reconciliationInvoiceVO', + ]); + setReconciliationInvoiceList(reconciliationInvoiceVOList); + setShowReconciliationInvoiceModal(false); + onFinish?.(reconciliationInvoiceVOList); + } + }} + type={'radio'} + params={params} + /> + + ); +} diff --git a/packages/app-operation/src/components/Reconciliation/ReconciliationInvoiceSelect.tsx b/packages/app-operation/src/components/Reconciliation/ReconciliationInvoiceSelect.tsx new file mode 100644 index 0000000..fd7cfe2 --- /dev/null +++ b/packages/app-operation/src/components/Reconciliation/ReconciliationInvoiceSelect.tsx @@ -0,0 +1,57 @@ +import { ReconciliationInvoiceSearch } from '@/components'; +import { useIntl } from '@@/exports'; +import { + ProFormDependency, + ProFormSelectProps, +} from '@ant-design/pro-components'; + +export type IReconciliationInvoiceSelectProps = { + onFinish?: ( + reconciliationInvoiceVOList: BusinessAPI.ReconciliationInvoiceVO[], + ) => void; + params: BusinessAPI.ReconciliationInvoicePageQry; +} & ProFormSelectProps; + +export default function ReconciliationInvoiceSelect( + props: IReconciliationInvoiceSelectProps, +) { + const intl = useIntl(); + + return ( + + {({ reconciliationInvoiceVO, canChangeReconciliationInvoice }, form) => { + return ( + + ); + }} + + ); +} diff --git a/packages/app-operation/src/components/Reconciliation/ReconciliationList.tsx b/packages/app-operation/src/components/Reconciliation/ReconciliationList.tsx index 9961863..3b9c121 100644 --- a/packages/app-operation/src/components/Reconciliation/ReconciliationList.tsx +++ b/packages/app-operation/src/components/Reconciliation/ReconciliationList.tsx @@ -1,9 +1,11 @@ import { BizContainer, BizValueType, + ButtonAccess, ModeType, ReconciliationComplete, ReconciliationCreate, + ReconciliationInvoiceList, } from '@/components'; import { business } from '@/services'; import { formatCurrency } from '@/utils/format'; @@ -279,7 +281,7 @@ export default function ReconciliationList( }, columns, options: (record, actionRef) => [ - record.state && ( + record.state === 'PENDING' && ( ), + record.state === 'RECONCILED' && ( + ( + + 上传发票 + + )} + /> + ), ], }} create={false} diff --git a/packages/app-operation/src/components/Reconciliation/ReconciliationPaymentList.tsx b/packages/app-operation/src/components/Reconciliation/ReconciliationPaymentList.tsx index 0508cd1..b7e8f9f 100644 --- a/packages/app-operation/src/components/Reconciliation/ReconciliationPaymentList.tsx +++ b/packages/app-operation/src/components/Reconciliation/ReconciliationPaymentList.tsx @@ -1,8 +1,24 @@ -import { BizContainer, BizValueType, ModeType } from '@/components'; +import { + BizContainer, + BizValueType, + CompanyPaymentAccountSelect, + DealerSelect, + ModeType, + ProFormUploadMaterial, + ReconciliationInvoiceSelect, + ReconciliationSelect, +} from '@/components'; import { business } from '@/services'; import { formatCurrency } from '@/utils/format'; import { useIntl } from '@@/exports'; -import { ProColumns } from '@ant-design/pro-components'; +import { + ProColumns, + ProFormDateTimePicker, + ProFormDependency, + ProFormMoney, + ProFormSelect, + ProFormText, +} from '@ant-design/pro-components'; import { ProDescriptionsItemProps } from '@ant-design/pro-descriptions'; import React from 'react'; @@ -32,39 +48,27 @@ export default function ReconciliationPaymentList( const intlPrefix = 'reconciliationPayment'; // 账户类别映射 - const accountCategoryMap: Record = { - 1: { - label: intl.formatMessage({ - id: intlPrefix + '.accountCategory.corporate', - }), - color: 'processing', + const accountCategoryMap: Record = { + COMPANY_ACCOUNT: { + text: intl.formatMessage({ id: intlPrefix + '.accountCategory.company' }), }, - 2: { - label: intl.formatMessage({ - id: intlPrefix + '.accountCategory.private', - }), - color: 'warning', + PRIVATE_ACCOUNT: { + text: intl.formatMessage({ id: intlPrefix + '.accountCategory.private' }), }, }; // 账户类型映射 - const accountTypeMap: Record = { - 1: { - label: intl.formatMessage({ - id: intlPrefix + '.accountType.bankCard', - }), - color: 'default', - }, - 2: { - label: intl.formatMessage({ - id: intlPrefix + '.accountType.alipay', - }), + const accountTypeMap: Record = { + BANK_CARD: { + text: intl.formatMessage({ id: intlPrefix + '.accountType.bankCard' }), color: 'blue', }, - 3: { - label: intl.formatMessage({ - id: intlPrefix + '.accountType.wechat', - }), + ALIPAY: { + text: intl.formatMessage({ id: intlPrefix + '.accountType.alipay' }), + color: 'cyan', + }, + WECHAT: { + text: intl.formatMessage({ id: intlPrefix + '.accountType.wechat' }), color: 'green', }, }; @@ -87,98 +91,46 @@ export default function ReconciliationPaymentList( key: 'companyId', valueType: 'company', }, - { - title: intl.formatMessage({ id: intlPrefix + '.column.accountCategory' }), - dataIndex: 'accountCategory', - key: 'accountCategory', - valueType: 'select', - valueEnum: { - 1: { - text: accountCategoryMap[1].label, - status: accountCategoryMap[1].color as any, - }, - 2: { - text: accountCategoryMap[2].label, - status: accountCategoryMap[2].color as any, - }, - }, - search: false, - }, { title: intl.formatMessage({ id: intlPrefix + '.column.accountType' }), dataIndex: 'accountType', key: 'accountType', valueType: 'select', - valueEnum: { - 1: { - text: accountTypeMap[1].label, - status: accountTypeMap[1].color as any, - }, - 2: { - text: accountTypeMap[2].label, - status: accountTypeMap[2].color as any, - }, - 3: { - text: accountTypeMap[3].label, - status: accountTypeMap[3].color as any, - }, - }, - search: false, + valueEnum: accountTypeMap, }, { - title: intl.formatMessage({ id: intlPrefix + '.column.bankName' }), - dataIndex: 'bankName', - key: 'bankName', - ellipsis: true, - search: false, - }, - { - title: intl.formatMessage({ id: intlPrefix + '.column.branchName' }), - dataIndex: 'branchName', - key: 'branchName', - ellipsis: true, - search: false, + title: intl.formatMessage({ id: intlPrefix + '.column.accountCategory' }), + dataIndex: 'accountCategory', + key: 'accountCategory', + valueType: 'select', + valueEnum: accountCategoryMap, }, { title: intl.formatMessage({ id: intlPrefix + '.column.accountName' }), dataIndex: 'accountName', key: 'accountName', - ellipsis: true, }, { title: intl.formatMessage({ id: intlPrefix + '.column.accountNumber' }), dataIndex: 'accountNumber', key: 'accountNumber', ellipsis: true, - search: false, }, { - title: intl.formatMessage({ id: intlPrefix + '.column.returnAmount' }), - dataIndex: 'returnAmount', - key: 'returnAmount', + title: intl.formatMessage({ id: intlPrefix + '.column.paidAmount' }), + dataIndex: 'paidAmount', + key: 'paidAmount', valueType: 'money', search: false, - render: (_, record) => ( - - ¥{formatCurrency(record.returnAmount)} - - ), + renderText: (value: number) => formatCurrency(value), }, { - title: intl.formatMessage({ id: intlPrefix + '.column.returnAt' }), - dataIndex: 'returnAt', - key: 'returnAt', + title: intl.formatMessage({ id: intlPrefix + '.column.paidAt' }), + dataIndex: 'paidAt', + key: 'paidAt', valueType: 'dateTime', search: false, }, - { - title: intl.formatMessage({ id: intlPrefix + '.column.remark' }), - dataIndex: 'remark', - key: 'remark', - valueType: 'remark', - ellipsis: true, - search: false, - }, ]; const detailColumns: ProDescriptionsItemProps< @@ -189,6 +141,149 @@ export default function ReconciliationPaymentList( BizValueType >[]; + // 定义创建表单字段 + const formContext = [ + , + + {({ dealerId }) => { + return ( + + ); + }} + , + + {({ reconciliationId }) => { + return ( + + ); + }} + , + { + const { data } = await business.company.listCompany({ + companyListQry: { + ...params, + }, + }); + return ( + data?.map((item) => ({ + label: item.fullName, + value: item.companyId, + })) || [] + ); + }} + />, +