feat: allow repeated bill generation and editable deposit deductions
This commit is contained in:
@@ -356,14 +356,13 @@ const BillsPage: React.FC = () => {
|
||||
name="billingMonth"
|
||||
label="账单月份"
|
||||
rules={[{ required: true, message: '请选择账单月份' }]}
|
||||
extra="只能选择已结束月份,每个月只能生成一次账单"
|
||||
extra="选择任意账单月份;重复生成时无变化不生成,有变化则生成差额账单"
|
||||
>
|
||||
<DatePicker
|
||||
style={{ width: '100%' }}
|
||||
picker="month"
|
||||
placeholder="选择月份"
|
||||
format="YYYY-MM"
|
||||
disabledDate={(current) => !!current && !current.endOf('month').isBefore(dayjs(), 'day')}
|
||||
/>
|
||||
</Form.Item>
|
||||
</Form>
|
||||
|
||||
@@ -120,6 +120,7 @@ const DepositsPage: React.FC = () => {
|
||||
const values = await refundForm.validateFields();
|
||||
await api.put(`/deposits/${refundModal.id}/refund`, {
|
||||
refundDate: values.refundDate.format('YYYY-MM-DD'),
|
||||
deductionAmount: values.deductionAmount || 0,
|
||||
notes: values.notes,
|
||||
});
|
||||
message.success('退还操作完成');
|
||||
@@ -210,7 +211,13 @@ const DepositsPage: React.FC = () => {
|
||||
type="primary"
|
||||
onClick={() => {
|
||||
setRefundModal(record);
|
||||
refundForm.setFieldsValue({ refundDate: dayjs() });
|
||||
refundForm.setFieldsValue({
|
||||
refundDate: dayjs(),
|
||||
deductionAmount: Math.min(
|
||||
moneyNumber(record.amount),
|
||||
moneyNumber(record.personalExpenseAmount),
|
||||
),
|
||||
});
|
||||
}}
|
||||
>
|
||||
退还
|
||||
@@ -361,33 +368,24 @@ const DepositsPage: React.FC = () => {
|
||||
<strong>¥{moneyNumber(refundModal?.personalExpenseAmount).toFixed(2)}</strong>
|
||||
</div>
|
||||
<div style={{ marginTop: 4 }}>
|
||||
自动扣除:{' '}
|
||||
<strong style={{ color: '#fa8c16' }}>
|
||||
¥
|
||||
{Math.min(
|
||||
moneyNumber(refundModal?.amount),
|
||||
moneyNumber(refundModal?.personalExpenseAmount),
|
||||
).toFixed(2)}
|
||||
</strong>
|
||||
</div>
|
||||
<div style={{ marginTop: 4 }}>
|
||||
实际退还:{' '}
|
||||
<strong style={{ color: '#52c41a' }}>
|
||||
¥
|
||||
{Math.max(
|
||||
0,
|
||||
moneyNumber(refundModal?.amount) -
|
||||
Math.min(
|
||||
moneyNumber(refundModal?.amount),
|
||||
moneyNumber(refundModal?.personalExpenseAmount),
|
||||
),
|
||||
).toFixed(2)}
|
||||
</strong>
|
||||
下方扣除金额会自动填入个人附加费,可手动调整
|
||||
</div>
|
||||
</div>
|
||||
<Form.Item name="refundDate" label="退还日期" rules={[{ required: true }]}>
|
||||
<DatePicker style={{ width: '100%' }} placeholder="选择退还日期" format="YYYY-MM-DD" />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
name="deductionAmount"
|
||||
label="扣除金额(元)"
|
||||
extra="默认填入未出账个人附加费,不能超过当前可用押金"
|
||||
>
|
||||
<InputNumber
|
||||
min={0}
|
||||
max={moneyNumber(refundModal?.amount)}
|
||||
precision={2}
|
||||
style={{ width: '100%' }}
|
||||
/>
|
||||
</Form.Item>
|
||||
<Form.Item name="notes" label="备注">
|
||||
<Input.TextArea rows={2} />
|
||||
</Form.Item>
|
||||
|
||||
Reference in New Issue
Block a user