Commit f18a0db9 authored by Bill's avatar Bill

fix: 修改首页,结算开票

parent 2ab6242a
......@@ -34,14 +34,14 @@ const memberCenterRoute = {
path: '/memberCenter/channelAbility',
redirect: '/memberCenter/channelAbility/infoManage'
},
{
path: `/memberCenter/home`,
name: 'home',
icon: 'home',
key: 'home',
// component: '@/pages/index',
component: '@/pages/home',
},
// {
// path: `/memberCenter/home`,
// name: 'home',
// icon: 'home',
// key: 'home',
// // component: '@/pages/index',
// component: '@/pages/home',
// },
...asyncRoutes,
{
path: '/memberCenter/noAuth',
......
......@@ -60,6 +60,7 @@ const SettlementList = () => {
setActiveData({
id: record.id,
type: record.invoiceStatus,
settlementOrderType: record.settlementOrderType,
// payRoleId: record.payRoleId,
// payMemberId: record.payMemberId
})
......
......@@ -27,6 +27,7 @@ interface Iprops {
width: number,
type: number, // 0 -> 开票, 1-> 查看
id: string, // 开票管理id,
settlementOrderType: 1 | 2 | 3 | 4 | 5, // 1-生产通知单,2-物流单,3-订单,4-积分订单,5-退货申请单
// payRoleId: number,
// payMemberId: number,
onCancel: () => void,
......@@ -53,8 +54,8 @@ const columns = [
]
const InvoiceDrawer: React.FC<Iprops> = (props) => {
const { visible, title, onCancel, width, type, id} = props;
const [invoiceInfo, setInvoiceInfo] = useState<InvoiceInfoProps>(null);
const { visible, title, onCancel, width, type, id, settlementOrderType} = props;
const [invoiceInfo, setInvoiceInfo] = useState<any[]>([]);
const [submitLoading, setSubmitLoading] = useState<boolean>(false)
const handleSubmit = () => {
// // 如果当前type==0为开票, 1为查看,那么直接关闭
......@@ -74,9 +75,33 @@ const InvoiceDrawer: React.FC<Iprops> = (props) => {
})
return;
}
const { kindName, typeName, ...rest } = invoiceInfo
const proveList = value.list.map((item, key) => { return {number: item.number, remark: item.remark, invoiceDate: item.invoiceDate.format('YYYY-MM-DD')} })
if(settlementOrderType === 5) {
const postDataList = {
receiptInvoiceId: parseInt(id),
addList: invoiceInfo.map((_item) => {
const { kindName, typeName, ...rest } = _item;
return {
...rest,
kind: kindName == '增值税普通发票' ? 1 : 2,
type: typeName == '企业' ? 1 : 2,
proveList: []
}
})
}
PublicApi.postSettleAccountsMemberSettlementInvoiceByReturn(postDataList)
.then(({code, data}) => {
if(code === 1000) {
setSubmitLoading(false)
props.refresh();
onCancel();
}
})
return ;
}
const { kindName, typeName, ...rest } = invoiceInfo[0]
const postData = {
...rest,
proveList: proveList,
......@@ -99,17 +124,26 @@ const InvoiceDrawer: React.FC<Iprops> = (props) => {
useEffect(() => {
if(props.visible) {
if(settlementOrderType === 5) {
PublicApi.getSettleAccountsMemberSettlementGetReturnInvoiceProveDetail({id: id})
.then(({code, data}) => {
if (code === 1000) {
console.log(data);
setInvoiceInfo(data)
}
})
return ;
}
///settle/accounts/member/settlement/getInvoiceProveDetail
PublicApi.getSettleAccountsMemberSettlementGetInvoiceProveDetail({id: id})
.then((data) => {
if(data.code === 1000) {
setInvoiceInfo(data.data)
setInvoiceInfo([data.data])
}
})
}
}, [id, visible])
const tableList = invoiceInfo?.proveList?.map((item, key) => ({...item, id: key}));
}, [id, visible, settlementOrderType])
// const tableList = invoiceInfo?.proveList?.map((item, key) => ({...item, id: key}));
const renderFooter = () => {
if(type === TypeEnum.view) {
......@@ -139,43 +173,55 @@ const InvoiceDrawer: React.FC<Iprops> = (props) => {
footer={renderFooter()}
>
<div style={{display: 'flex', flexDirection: 'column'}}>
<InvoiceInfo infos={invoiceInfo} />
{
type === TypeEnum.edit
? (
<>
<div className={styles.formHeader}>
<div className={styles.invoiceNum}>发票号码</div>
<div className={styles.invoiceDate}>开票日期</div>
<div>备注</div>
</div>
{/* getPopupContainer={triggerNode => { console.log(triggerNode, triggerNode.parentElement); return triggerNode.parentNode}} */}
<SchemaForm onSubmit={handleForm} actions={formActions} components={{ InvoiceArray, Input, DatePicker }}>
<Field
name="list"
type="array"
x-component="InvoiceArray"
>
<Field type="object">
<Field name="number" x-component="Input" x-rules={[{required: true, message: '请填写发票号'}]} />
<Field name="invoiceDate" x-component-props={{
getPopupContainer: (triggernode) => triggernode.parentElement
}} x-component="DatePicker" x-rules={[{required: true, message: '请选择发票日期'}]} />
<Field name="remark" x-component="Input" x-component-props={{style: {width: '240px'}}} />
</Field>
</Field>
</SchemaForm>
</>
invoiceInfo.map((item, unique) => {
const infos = item;
const tableList = item?.proveList?.map((item, key) => ({...item, id: key}));
return (
<div key={unique}>
<InvoiceInfo infos={infos} />
{
type === TypeEnum.edit
? (
<>
<div className={styles.formHeader}>
<div className={styles.invoiceNum}>发票号码<span style={{color: "#ff4d4f"}}>*</span></div>
<div className={styles.invoiceDate}>开票日期<span style={{color: "#ff4d4f"}}>*</span></div>
<div>备注</div>
</div>
{/* getPopupContainer={triggerNode => { console.log(triggerNode, triggerNode.parentElement); return triggerNode.parentNode}} */}
<SchemaForm onSubmit={handleForm} actions={formActions} components={{ InvoiceArray, Input, DatePicker }} name={`form-${unique}`}>
{/* <Field name="infoId" x-component="Input" display={false} default={unique} /> */}
<Field
name="list"
type="array"
x-component="InvoiceArray"
>
<Field type="object">
<Field name="number" x-component="Input" x-rules={[{required: true, message: '请填写发票号'}]} />
<Field name="invoiceDate" x-component-props={{
getPopupContainer: (triggernode) => triggernode.parentElement
}} x-component="DatePicker" x-rules={[{required: true, message: '请选择发票日期'}]} />
<Field name="remark" x-component="Input" x-component-props={{style: {width: '240px'}}} />
</Field>
</Field>
</SchemaForm>
</>
)
: (
<Table
columns={columns}
dataSource={tableList}
rowKey={record => record.id}
/>
)
}
</div>
)
: (
<Table
columns={columns}
dataSource={tableList}
rowKey={record => record.id}
/>
)
})
}
</div>
</Drawer>
)
......
......@@ -15,11 +15,13 @@ const RecentVisit: React.FC<Iprops> = () => {
<div className={styles.body}>
{
Object.keys(recentVisit).map((item) => {
const menuName = item.split(".");
const length = menuName.length
return (
<Tooltip key={item} placement="top" title={ menu_zh[item] }>
<Tooltip key={item} placement="top" title={ menuName[length - 1] }>
<div className={styles.item}>
<Link key={item} to={recentVisit[item]} >
{ menu_zh[item] }
{ menuName[length - 1] }
</Link>
</div>
</Tooltip>
......
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