资金申请增加渠道筛选合计与审核留痕
This commit is contained in:
@@ -72,6 +72,7 @@ export default function FinancePanel() {
|
||||
const [keywordInput, setKeywordInput] = useState('')
|
||||
const [keyword, setKeyword] = useState('')
|
||||
const [createdRange, setCreatedRange] = useState<[string, string] | null>(null)
|
||||
const [accountChannel, setAccountChannel] = useState('')
|
||||
const [page, setPage] = useState(1)
|
||||
const [pageSize, setPageSize] = useState(ADMIN_DEFAULT_PAGE_SIZE)
|
||||
const [savingConfig, setSavingConfig] = useState(false)
|
||||
@@ -114,6 +115,7 @@ export default function FinancePanel() {
|
||||
pageSize,
|
||||
createdRange ? createdRange[0] : '',
|
||||
createdRange ? createdRange[1] : '',
|
||||
accountChannel,
|
||||
],
|
||||
queryFn: () =>
|
||||
fetchAdminWorkerFinanceRequests({
|
||||
@@ -286,7 +288,9 @@ export default function FinancePanel() {
|
||||
<div className="cell-stack">
|
||||
<Typography.Text>{formatAdminDateTime(row.createdAt)}</Typography.Text>
|
||||
<Typography.Text type="secondary">
|
||||
{row.reviewedAt ? `审核:${formatAdminDateTime(row.reviewedAt)}` : '待审核'}
|
||||
{row.reviewedAt
|
||||
? `审核:${formatAdminDateTime(row.reviewedAt)}${resolveFinanceReviewer(row) ? `(${resolveFinanceReviewer(row)})` : ''}`
|
||||
: '待审核'}
|
||||
</Typography.Text>
|
||||
</div>
|
||||
),
|
||||
@@ -472,6 +476,19 @@ export default function FinancePanel() {
|
||||
setPage(1)
|
||||
}}
|
||||
/>
|
||||
<Select
|
||||
value={accountChannel}
|
||||
style={{ width: 130 }}
|
||||
options={[
|
||||
{ value: '', label: '全部渠道' },
|
||||
{ value: 'alipay', label: '支付宝' },
|
||||
{ value: 'wechat', label: '微信' },
|
||||
]}
|
||||
onChange={(nextChannel) => {
|
||||
setAccountChannel(nextChannel)
|
||||
setPage(1)
|
||||
}}
|
||||
/>
|
||||
<AdminRangePicker
|
||||
value={createdRange ? [dayjs(createdRange[0]), dayjs(createdRange[1])] : null}
|
||||
onChange={(dates) => {
|
||||
@@ -494,6 +511,11 @@ export default function FinancePanel() {
|
||||
</Space>
|
||||
}
|
||||
>
|
||||
<FinanceSummaryBar
|
||||
channels={financeRequestsQuery.data?.data.summary?.channels}
|
||||
totalCount={financeRequestsQuery.data?.data.summary?.totalCount}
|
||||
totalAmount={financeRequestsQuery.data?.data.summary?.totalAmount}
|
||||
/>
|
||||
<Table<WorkerFinanceRequest>
|
||||
rowKey="requestId"
|
||||
loading={financeRequestsQuery.isLoading}
|
||||
@@ -776,3 +798,49 @@ function maskFinanceAccount(value: string) {
|
||||
if (text.length <= 8) return text
|
||||
return `${text.slice(0, 4)} **** ${text.slice(-4)}`
|
||||
}
|
||||
|
||||
type FinanceSummaryChannel = { channel: string; count: number; amount: number }
|
||||
|
||||
/** 当前筛选条件下的渠道合计条:支付宝 / 微信 / 其他分列展示笔数与金额。 */
|
||||
function FinanceSummaryBar({
|
||||
channels,
|
||||
totalCount,
|
||||
totalAmount,
|
||||
}: {
|
||||
channels?: FinanceSummaryChannel[]
|
||||
totalCount?: number
|
||||
totalAmount?: number
|
||||
}) {
|
||||
const items = channels || []
|
||||
const alipay = items.find((item) => item.channel === 'alipay')
|
||||
const wechat = items.find((item) => item.channel === 'wechat')
|
||||
const others = items.filter((item) => item.channel !== 'alipay' && item.channel !== 'wechat')
|
||||
const otherCount = others.reduce((sum, item) => sum + item.count, 0)
|
||||
const otherAmount = others.reduce((sum, item) => sum + item.amount, 0)
|
||||
|
||||
return (
|
||||
<Space size={24} wrap style={{ marginBottom: 12 }}>
|
||||
<span className="finance-summary-item">
|
||||
支付宝 <strong>{alipay ? alipay.count : 0}</strong> 笔 /{' '}
|
||||
<strong>{formatMoney(alipay ? alipay.amount : 0)}</strong>
|
||||
</span>
|
||||
<span className="finance-summary-item">
|
||||
微信 <strong>{wechat ? wechat.count : 0}</strong> 笔 /{' '}
|
||||
<strong>{formatMoney(wechat ? wechat.amount : 0)}</strong>
|
||||
</span>
|
||||
<span className="finance-summary-item">
|
||||
其他 <strong>{otherCount}</strong> 笔 / <strong>{formatMoney(otherAmount)}</strong>
|
||||
</span>
|
||||
<span className="finance-summary-item">
|
||||
合计 <strong>{totalCount || 0}</strong> 笔 /{' '}
|
||||
<strong>{formatMoney(totalAmount || 0)}</strong>
|
||||
</span>
|
||||
<Typography.Text type="secondary">按当前筛选条件(含时间区间)统计</Typography.Text>
|
||||
</Space>
|
||||
)
|
||||
}
|
||||
|
||||
function resolveFinanceReviewer(request: WorkerFinanceRequest): string {
|
||||
const review = asRecord(asRecord(request.payload).review)
|
||||
return String(review.by || '').trim()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user