Commit 2828487e authored by 卢均锐's avatar 卢均锐

fix: 对账单请款核销逻辑修改

parent d76dae0e
......@@ -214,9 +214,9 @@ const Add = () => {
const _i = _tabelSource.findIndex((item) => item.billId === writeOffData.billId);
let _item = { ..._tabelSource[_i] };
_item.writeOffRecords = rows;
const _currentMoney = rows.map((item) => item.currentMoney).reduce((p, r) => p + r, 0)
_item.writeOffAmount = _currentMoney;
_item.applyPayment = _item.reconciliationAmount - _currentMoney;
const _writeOffAmount = rows.map((item) => item?.writeOffAmount ?? 0).reduce((p, r) => p + r, 0)
_item.writeOffAmount = _writeOffAmount;
_item.applyPayment = _item.reconciliationAmount - _writeOffAmount;
_tabelSource[_i] = _item;
setTabelSource(_tabelSource);
setWriteOffDrawer(false);
......
......@@ -40,7 +40,7 @@ const WriteOffDrawer: React.FC<WriteOffDrawerProps> = (props: WriteOffDrawerProp
let _dataSource = [...tabelSource];
const _i = _dataSource.findIndex((item) => item.id === record.id);
let _item = { ..._dataSource[_i] };
_item.currentMoney = Number(_val);
_item.writeOffAmount = _item.currentMoney = Number(_val);
_dataSource[_i] = _item;
setTabelSource(_dataSource);
}
......@@ -112,15 +112,18 @@ const WriteOffDrawer: React.FC<WriteOffDrawerProps> = (props: WriteOffDrawerProp
const editColumns: ColumnType<any>[] = columns.concat([{
title: '本次核销金额',
key: 'canWriteAmount',
dataIndex: 'canWriteAmount',
key: 'currentMoney',
dataIndex: 'currentMoney',
render: (text: any, record: any) => (
<Form.Item
name={`canWriteAmount_${record.id}_${record.applyRowId}`}
name={`currentMoney_${record.id}_${record.applyRowId}`}
style={{ margin: 0 }}
rules={[
{
validator: (_, value) => {
if (!value && value !== 0) {
return Promise.resolve()
}
if (!reg.test(value)) {
return Promise.reject(new Error('本次核销金额需要大于0'))
}
......
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