商品 {index + 1}
{
try {
update(f => Model.removeLine(f, index));
} catch (err) {
error(err instanceof Error ? err.message : String(err));
}
}}
>
移除
工费附加项目(选填)
update(f => Model.addCharge(f, index, uuid))}
>
+ 添加附加项目
{line.charges.map((c, i) => (
updateCharge(i, charge => Model.changeChargeType(charge, type))}
/>
updateCharge(i, charge => ({ ...charge, customName }))}
/>
updateCharge(i, charge => Model.setChargeAmount(charge, value))}
/>
change(l => ({ ...l, charges: l.charges.filter((_, j) => j !== i) }))}
>
移除项目
{c.costRemoved && (
update(f => Model.restoreChargeCost(f, index, i))}>
恢复内部成本
)}
))}
内部成本 · 客户单据不显示
{line.legacy ? (
<>
change(l => {
const fresh = Model.newLine(
{
costParts: { material: '', labor: '', accessories: '0', other: '0' },
payer: l.payer,
unit: l.unit,
},
{ ...ctx, member: form.member },
);
return { ...l, legacy: false, purchase: fresh.purchase, pool: fresh.pool };
})
}
>
拆分这行成本
>
) : (
)}
);
}
export function EditFees({ store, state, update }: { store: FormStore; state: LedgerState; update: UpdateForm }) {
const { form, summary } = store,
presets = form.presets;
const hasLinkedCost = (kind: string) =>
form.feeRows.some(
row => row.funding && (row.key === Fees.presetKey(kind) || Fees.checkboxCategory(row.note) === categories[kind]),
);
return (
实际费用(内部)
update(f => Model.addManualFee(f, state, uuid))}>
+ 添加其他成本
update(f => ({ ...f, fees_date }))}
/>
{presets && (
{Model.presetCatalogView(form, state).map(item => (
{item.byQuantity && (
update(f => Model.setPresetQuantity(f, item.kind, q))}
/>
)}
))}
)}
{form.feeRows.map((row, i) => {
const edit = (key: 'note' | 'payer' | 'amount' | 'date', value: string) =>
update(f => Model.editFeeRow(f, i, key, value));
const ref = row.funding;
return (
{row.key.startsWith('manual:') && !row.automatic ? (
edit('note', v)}
/>
) : (
{row.note}
)}
{Model.feeSourceText(row)}
edit('amount', v)}
/>
edit('payer', v)}
/>
edit('date', v)}
/>
{!row.automatic && (
update(f => Model.removeFeeRow(f, i))}>
移除费用
)}
{ref && (
)}
);
})}
update(f => ({ ...f, credit_card_fee_payer: v }))}
/>
{summary.feesText}
);
}