fix: close receipt delivery workflows
This commit is contained in:
@@ -0,0 +1,108 @@
|
||||
import { CheckCircle2 } from 'lucide-react';
|
||||
import type { RechargeOrder, TenantOption } from '@/api/adminApi';
|
||||
import { formatCents } from '@/utils/currency';
|
||||
import { formatDateTime } from '@/utils/dateTime';
|
||||
import { Button } from './Button';
|
||||
import { Modal } from './Modal';
|
||||
|
||||
type RechargeReceiptDialogProps = {
|
||||
open: boolean;
|
||||
record: RechargeOrder | null;
|
||||
tenant?: Pick<TenantOption, 'name' | 'code'>;
|
||||
onClose: () => void;
|
||||
};
|
||||
|
||||
export function formatReceiptAmount(moneyUnits: number) {
|
||||
return formatCents(Math.abs(moneyUnits)).replace(/\.?0+$/, '');
|
||||
}
|
||||
|
||||
export function RechargeReceiptDialog({
|
||||
open,
|
||||
record,
|
||||
tenant,
|
||||
onClose,
|
||||
}: RechargeReceiptDialogProps) {
|
||||
if (!record) return null;
|
||||
|
||||
const isCorrection = record.amountCents < 0;
|
||||
const balanceAfter = record.balanceAfterCents;
|
||||
const balanceBefore = balanceAfter === null || balanceAfter === undefined
|
||||
? null
|
||||
: balanceAfter - record.amountCents;
|
||||
const enterpriseName = record.tenant?.name ?? tenant?.name ?? record.tenantId;
|
||||
const enterpriseCode = record.tenant?.code ?? tenant?.code ?? '-';
|
||||
|
||||
return (
|
||||
<Modal
|
||||
footer={<Button onClick={onClose}>完成</Button>}
|
||||
onClose={onClose}
|
||||
open={open}
|
||||
title="账户充值回执"
|
||||
>
|
||||
<article className="recharge-receipt">
|
||||
<header className="recharge-receipt__header">
|
||||
<img
|
||||
alt="聆界短信服务平台"
|
||||
className="recharge-receipt__logo"
|
||||
src="/logo/logo1.png"
|
||||
/>
|
||||
<span className={isCorrection ? 'is-correction' : 'is-posted'}>
|
||||
<CheckCircle2 aria-hidden="true" size={16} />
|
||||
{isCorrection ? '已冲正' : '已入账'}
|
||||
</span>
|
||||
</header>
|
||||
|
||||
<section className="recharge-receipt__amount">
|
||||
<span>本次{isCorrection ? '冲正' : '充值'}金额</span>
|
||||
<strong>
|
||||
{isCorrection ? '−' : '+'}
|
||||
<small>¥</small>
|
||||
{formatReceiptAmount(record.amountCents)}
|
||||
</strong>
|
||||
</section>
|
||||
|
||||
<section className="recharge-receipt__enterprise">
|
||||
<span>入账企业</span>
|
||||
<strong>{enterpriseName}</strong>
|
||||
<small>企业编号:{enterpriseCode}</small>
|
||||
</section>
|
||||
|
||||
<dl className="recharge-receipt__details">
|
||||
<div>
|
||||
<dt>回执编号</dt>
|
||||
<dd>{record.orderNo}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>入账时间</dt>
|
||||
<dd>{formatDateTime(record.paidAt ?? record.createdAt)}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>入账前余额</dt>
|
||||
<dd>{balanceBefore === null ? '-' : `¥${formatCents(balanceBefore)}`}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>入账后余额</dt>
|
||||
<dd>{balanceAfter === null || balanceAfter === undefined ? '-' : `¥${formatCents(balanceAfter)}`}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>入账方式</dt>
|
||||
<dd>平台运营端 · 人工{isCorrection ? '冲正' : '充值'}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>交易状态</dt>
|
||||
<dd>{isCorrection ? '冲正完成' : '充值完成'}</dd>
|
||||
</div>
|
||||
</dl>
|
||||
|
||||
<section className="recharge-receipt__remark">
|
||||
<span>备注</span>
|
||||
<p>{record.remark || '无'}</p>
|
||||
</section>
|
||||
|
||||
<footer className="recharge-receipt__note">
|
||||
本回执由系统根据真实入账记录自动生成
|
||||
</footer>
|
||||
</article>
|
||||
</Modal>
|
||||
);
|
||||
}
|
||||
@@ -10,6 +10,7 @@ export { RiskAction } from './RiskAction';
|
||||
export { DeleteRiskAction } from './DeleteRiskAction';
|
||||
export { ManualRechargeDialog } from './ManualRechargeDialog';
|
||||
export type { ManualRechargeTarget } from './ManualRechargeDialog';
|
||||
export { RechargeReceiptDialog } from './RechargeReceiptDialog';
|
||||
export { Input } from './Input';
|
||||
export { Modal } from './Modal';
|
||||
export { InlineTextPreview, Pagination, QueryPanel } from './PagePrimitives';
|
||||
|
||||
Reference in New Issue
Block a user