Commit a90b1bd7 authored by 前端-黄佳鑫's avatar 前端-黄佳鑫
parents e4b07d88 69fc7fbf
......@@ -70,21 +70,15 @@ const SettlementList = () => {
const handleShow = async (record: GetSettleAccountsMemberSettlementPageReceiptInvoiceResponseDetail) => {
(document.body.parentNode as HTMLBodyElement).style.overflowY = "hidden";
setVisible(true)
setActiveData(record)
// setActiveData({
// id: record.id,
// type: record.invoiceStatus,
// settlementOrderType: record.settlementOrderType || 5,
// // payRoleId: record.payRoleId,
// // payMemberId: record.payMemberId
// })
const hide = message.loading('正在加载中', 0);
/** 退货类型 */
const service = record.settlementOrderType === 5
? getSettleAccountsMemberSettlementGetReturnInvoiceProveDetail
: getSettleAccountsMemberSettlementGetInvoiceProveDetail
const { code, data, message: msg } = await service({ id: record.id.toString() });
hide()
if (code !== 1000) {
message.error(msg);
return
......@@ -94,9 +88,11 @@ const SettlementList = () => {
message.error("无发票信息");
return
}
setVisible(true)
setInvoiceInfo(data);
return;
}
setVisible(true)
setInvoiceInfo([(data as GetSettleAccountsMemberSettlementGetInvoiceProveDetailResponse)]);
}
......@@ -117,10 +113,6 @@ const SettlementList = () => {
let res = {}
keys.forEach((item) => {
const array = value[item];
// res[item] = array.map((_row) => {
// const { invoiceDate, ...rest } = _row;
// return { invoiceDate: invoiceDate.format('YYYY-MM-DD'), ...rest}
// })
res[item] = array
})
/** 退货类型 */
......@@ -314,7 +306,7 @@ const SettlementList = () => {
/>
</Card>
<InvoiceDrawerInfo
mode={activeData.invoiceStatus === 1 ? 'edit' : 'view'}
mode={activeData?.invoiceStatus === 0 ? 'edit' : 'view'}
visible={visible}
invoiceInfoData={invoiceInfo}
onCancel={handleOnCancel}
......
......@@ -6,22 +6,27 @@ import { getIntl } from 'umi';
const intl = getIntl()
interface Iprops {
infos: {
typeName: string,
kindName: string,
invoiceTitle: string,
taxNo: string,
bankOfDeposit: string,
account: string,
address: string,
tel: string,
originalProveList?: {
number: number,
invoiceDate: string,
invoiceAmount: string,
remark: string
}[]
props: {
'x-component-props': {
infos: {
typeName: string,
kindName: string,
invoiceTitle: string,
taxNo: string,
bankOfDeposit: string,
account: string,
address: string,
tel: string,
originalProveList?: {
number: number,
invoiceDate: string,
invoiceAmount: string,
remark: string
}[]
}
}
}
}
const infoList = [
......@@ -35,7 +40,9 @@ const infoList = [
{ title: intl.formatMessage({ id: 'balance.components.invoiceCreate.invoiceInfo.infoList.tel' }), dataIndex: 'tel' }
]
const InvoiceInfo: React.FC<Iprops> & { isVirtualFieldComponent: boolean } = (props) => {
const { infos } = props;
console.log(props);
const xComponentProps = props.props['x-component-props']
const { infos } = xComponentProps;
return (
<>
......
......@@ -5,11 +5,13 @@ import {
SchemaMarkupField as Field
} from '@formily/antd'
import { Button, Drawer } from 'antd';
import React from 'react';
import React, { useEffect, useState } from 'react';
import ArrayList from './arrayList';
import { Input, DatePicker } from '@formily/antd-components';
import styles from './invoiceDrawerInfo.less';
import InvoiceInfo from './invoice'
import { getIntl } from 'umi'
const intl = getIntl();
const formActions = createFormActions();
interface Iprops {
......@@ -20,8 +22,16 @@ interface Iprops {
invoiceInfoData: any
}
type ProveListType = {
number: string,
invoiceDate: string,
invoiceAmount: number
remark: string,
}
const InvoiceDrawerInfo: React.FC<Iprops> = (props: Iprops) => {
const { visible, onCancel, invoiceInfoData, onSubmit } = props;
const { visible, onCancel, invoiceInfoData, onSubmit, mode } = props;
const [initialValue, setInitialValue] = useState<{ [key: string]: ProveListType}>({});
const handleCancel = () => {
onCancel?.()
......@@ -31,10 +41,10 @@ const InvoiceDrawerInfo: React.FC<Iprops> = (props: Iprops) => {
return (
<div style={{textAlign: 'right'}}>
<Button onClick={handleCancel} style={{ marginRight: 8 }}>
取消
{intl.formatMessage({ id: 'balance.components.invoiceCreate.invoiceDrawer.renderFooter.button.1' })}
</Button>
<Button onClick={() => formActions.submit()} type="primary">
确认
{intl.formatMessage({ id: 'balance.components.invoiceCreate.invoiceDrawer.renderFooter.button.2' })}
</Button>
</div>
)
......@@ -45,23 +55,45 @@ const InvoiceDrawerInfo: React.FC<Iprops> = (props: Iprops) => {
onSubmit?.(values)
}
useEffect(() => {
if (mode === 'view' && invoiceInfoData) {
const data = {};
invoiceInfoData?.forEach((_item, index) => {
const { proveList } = _item;
data[`list-${index}`] = proveList
})
setInitialValue(data);
}
}, [mode, invoiceInfoData])
return (
<Drawer
visible={visible}
width={800}
title="开具发票"
onClose={handleCancel}
footer={renderFooter()}
>
<SchemaForm
value={initialValue}
onSubmit={handleSubmit}
components={{ ArrayCustom: ArrayList, Input: Input, DatePicker }}
components={{ ArrayCustom: ArrayList, Input: Input, DatePicker, InvoiceInfo }}
actions={formActions}
editable={mode === 'edit'}
>
{
invoiceInfoData?.map((_item, key) => {
return (
<div key={key}>
<InvoiceInfo infos={_item} />
<div key={key} style={{display: 'flex', flexDirection: 'column'}}>
<Field
type="object"
x-component='InvoiceInfo'
x-component-props={
{
infos: _item
}
}
/>
<Field
name={`list-${key}`}
type="array"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment