Commit dcf870c6 authored by shenshaokai's avatar shenshaokai

fix: 供应商变更-发票信息是否默认修改

parent bc916ea7
......@@ -227,6 +227,20 @@ const Receipt: React.ForwardRefRenderFunction<RefHandle, IProps> = (props, ref)
setList(newList);
}
const updateIsDefault = (list, currentValue) => {
const findDefault = list.find(item => (item.id === currentValue.id && item.isDefault))
if (findDefault) {
return list.map(item => {
item.isDefault = false
if (item.id === currentValue.id) {
item.isDefault = true
}
return item;
})
}
return list
}
const invoiceModalConfirm = (value) => {
const index = list.findIndex(item => item.id === value.id);
if (index !== -1) {
......@@ -234,7 +248,7 @@ const Receipt: React.ForwardRefRenderFunction<RefHandle, IProps> = (props, ref)
} else {
list.push(value)
}
setList(list.slice());
setList(updateIsDefault(list, value));
invoiceModalRef?.current?.setVisible(false)
}
......
......@@ -420,7 +420,7 @@ const MemberArchiveInfo = () => {
if (deposit) {
Object.assign(params, { deposit })
}
Object.assign(params, { invoices: (invoiceRef.current?.getList() || []).map(item => ({ ...item, invoiceId: item.id })) })
Object.assign(params, { invoices: (invoiceRef.current?.getList() || []).map(item => ({ ...item, invoiceId: item.id, isDefault: item.isDefault ? 1 : 0 })) })
}
postMemberAbilityInfoDepositDetailUpdate(params).then((res) => {
......
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