diff --git a/packages/app-operation/src/components/Order/OrderSupplierModal.tsx b/packages/app-operation/src/components/Order/OrderSupplierModal.tsx index 1c77d45..7d840bc 100644 --- a/packages/app-operation/src/components/Order/OrderSupplierModal.tsx +++ b/packages/app-operation/src/components/Order/OrderSupplierModal.tsx @@ -1,8 +1,10 @@ -import { OrderList } from '@/components'; +import { CompanyList, OrderList } from '@/components'; import { business } from '@/services'; +import { formatBankCard, formatIdCard, formatPhone } from '@/utils/format'; import { formatParam } from '@/utils/formatParam'; import { pagination } from '@/utils/pagination'; import { useIntl } from '@@/exports'; +import { EyeInvisibleOutlined, EyeTwoTone } from '@ant-design/icons'; import { ActionType, LightFilter, @@ -46,6 +48,10 @@ export default function OrderSupplierModal(props: IOrderSupplierModalProps) { initParams || {}, ); + const [showIdCard, setShowIdCard] = useState>({}); + const [showBankCard, setShowBankCard] = useState>({}); + const [showPhone, setShowPhone] = useState>({}); + useEffect(() => { if (initParams) { setParams({ @@ -85,32 +91,6 @@ export default function OrderSupplierModal(props: IOrderSupplierModalProps) { title: intl.formatMessage({ id: intlPrefix + '.column.name' }), dataIndex: 'name', key: 'name', - renderText: (text: string) => {text}, - }, - { - title: intl.formatMessage({ id: intlPrefix + '.column.idCard' }), - dataIndex: 'idCard', - key: 'idCard', - search: false, - ellipsis: true, - }, - { - title: intl.formatMessage({ id: intlPrefix + '.column.phone' }), - dataIndex: 'phone', - key: 'phone', - search: false, - }, - { - title: intl.formatMessage({ id: intlPrefix + '.column.bankName' }), - dataIndex: 'bankName', - key: 'bankName', - search: false, - }, - { - title: intl.formatMessage({ id: intlPrefix + '.column.bankCard' }), - dataIndex: 'bankCard', - key: 'bankCard', - search: false, }, { title: intl.formatMessage({ id: intlPrefix + '.column.invoiceAmount' }), @@ -126,6 +106,7 @@ export default function OrderSupplierModal(props: IOrderSupplierModalProps) { valueType: 'money', search: false, }, + // 剩余付款金额 { title: intl.formatMessage({ id: intlPrefix + '.column.remainingAmount', @@ -139,10 +120,127 @@ export default function OrderSupplierModal(props: IOrderSupplierModalProps) { }, }, { - title: intl.formatMessage({ id: intlPrefix + '.column.orderCompany' }), - dataIndex: ['orderCompany', 'shortName'], - key: 'orderCompany', + title: intl.formatMessage({ + id: intlPrefix + '.column.idCard', + }), + dataIndex: 'idCard', + key: 'idCard', search: false, + render: (_, record) => ( +
+ + {formatIdCard(record.idCard, showIdCard[record.orderSupplierId])} + + { + e.stopPropagation(); + setShowIdCard((prev) => ({ + ...prev, + [record.orderSupplierId]: !prev[record.orderSupplierId], + })); + }} + > + {showIdCard[record.orderSupplierId] ? ( + + ) : ( + + )} + +
+ ), + }, + { + title: intl.formatMessage({ id: intlPrefix + '.column.phone' }), + dataIndex: 'phone', + key: 'phone', + search: false, + render: (_, record) => ( +
+ + {formatPhone(record.phone, showPhone[record.orderSupplierId])} + + { + e.stopPropagation(); + setShowPhone((prev) => ({ + ...prev, + [record.orderSupplierId]: !prev[record.orderSupplierId], + })); + }} + > + {showPhone[record.orderSupplierId] ? ( + + ) : ( + + )} + +
+ ), + }, + { + title: intl.formatMessage({ id: intlPrefix + '.column.bankCard' }), + dataIndex: 'bankCard', + key: 'bankCard', + search: false, + render: (_, record) => ( +
+ + {formatBankCard( + record?.bankCard || '', + showBankCard[record.orderSupplierId], + )} + + { + e.stopPropagation(); + setShowBankCard((prev) => ({ + ...prev, + [record.orderSupplierId]: !prev[record.orderSupplierId], + })); + }} + > + {showBankCard[record.orderSupplierId] ? ( + + ) : ( + + )} + +
+ ), + }, + { + title: intl.formatMessage({ id: intlPrefix + '.column.orderCompany' }), + dataIndex: 'orderCompany', + valueType: 'select', + request: async (params) => { + const { data } = await business.company.listCompany({ + companyListQry: { + ...params, + }, + }); + + return ( + data?.map((item) => { + return { + label: item.fullName, + value: item.companyId, + }; + }) || [] + ); + }, + render: (_, record) => { + return ( + {record.orderCompany.fullName}} + /> + ); + }, }, { title: intl.formatMessage({ id: intlPrefix + '.column.isPaid' }), @@ -151,28 +249,19 @@ export default function OrderSupplierModal(props: IOrderSupplierModalProps) { valueType: 'select', valueEnum: { true: { - text: intl.formatMessage({ id: intlPrefix + '.column.isPaid.paid' }), - status: 'Success', + text: intl.formatMessage({ + id: intlPrefix + '.column.isPaid.paid', + }), + status: 'success', }, false: { text: intl.formatMessage({ id: intlPrefix + '.column.isPaid.unpaid', }), - status: 'Default', + status: 'processing', }, }, }, - // { - // title: intl.formatMessage({ id: intlPrefix + '.column.type' }), - // dataIndex: 'type', - // key: 'type', - // valueType: 'select', - // valueEnum: { - // FARMER: { text: intl.formatMessage({ id: intlPrefix + '.column.type.farmer' }), status: 'Default' }, - // STALL: { text: intl.formatMessage({ id: intlPrefix + '.column.type.stall' }), status: 'Processing' }, - // OTHER_STALL: { text: intl.formatMessage({ id: intlPrefix + '.column.type.otherStall' }), status: 'Warning' }, - // }, - // }, ...(initExtraColumns || []), ]; @@ -225,6 +314,7 @@ export default function OrderSupplierModal(props: IOrderSupplierModalProps) { }, params: { ...params, + poStates: ['COMPLETED'], }, request: async (params, sorter, filter) => { const { data, success, totalCount } = diff --git a/packages/app-operation/src/components/PaymentTask/PaymentTaskCreate.tsx b/packages/app-operation/src/components/PaymentTask/PaymentTaskCreate.tsx index 7437eda..5d2912f 100644 --- a/packages/app-operation/src/components/PaymentTask/PaymentTaskCreate.tsx +++ b/packages/app-operation/src/components/PaymentTask/PaymentTaskCreate.tsx @@ -3,6 +3,7 @@ import { ButtonAccess, InsertPosition, OrderSupplierInvoiceList, + SupplierFarmerList, } from '@/components'; import OrderSupplierModal from '@/components/Order/OrderSupplierModal'; import { business } from '@/services'; @@ -260,13 +261,75 @@ export default function PaymentTaskCreate(props: IPaymentTaskCreateProps) { rowKey="orderSupplierId" dataSource={selectedOrderSupplierList} columns={[ + { + title: '开票瓜农', + dataIndex: 'supplierInvoiceVO', + key: 'supplierName', + render: ( + supplierInvoiceVO: BusinessAPI.SupplierInvoiceVO, + ) => { + return ( + supplierInvoiceVO && ( + ( + {supplierInvoiceVO.supplierName} + )} + /> + ) + ); + }, + }, + { + title: '发票编码', + dataIndex: 'supplierInvoiceVO', + key: 'invoiceSn', + render: ( + supplierInvoiceVO: BusinessAPI.SupplierInvoiceVO, + ) => { + return {supplierInvoiceVO.invoiceSn}; + }, + }, + // 开票状态(自开票,代开票,未开票) + { + title: '开票状态', + key: 'invoiceStatus', + render: (record: BusinessAPI.OrderSupplierVO) => { + let invoiceStatus = 'NOT_INVOICE'; + if (record.invoiceUpload && record.invoiceId) { + if ( + record.supplierId === + record.supplierInvoiceVO?.supplierId + ) { + invoiceStatus = 'SELF'; + } + if ( + record.supplierId !== + record.supplierInvoiceVO?.supplierId + ) { + invoiceStatus = 'AGENT'; + } + } else { + invoiceStatus = 'NOT_INVOICE'; + } + + switch (invoiceStatus) { + case 'SELF': + return '自开票'; + case 'AGENT': + return '代开票'; + case 'NOT_INVOICE': + return '未开票'; + default: + } + }, + }, { title: '操作', key: 'action', - render: ( - _: any, - record: BusinessAPI.OrderSupplierVO, - ) => ( + render: (record: BusinessAPI.OrderSupplierVO) => (