Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 59748c7b7f | |||
| c3b77479a0 | |||
| 374ac1fd90 | |||
| 3f5356ad87 | |||
| c90775d09c |
@@ -73,7 +73,7 @@ interface CouponDataRow {
|
|||||||
started_at: string;
|
started_at: string;
|
||||||
claimed_count: number | null;
|
claimed_count: number | null;
|
||||||
trace_url: string | null;
|
trace_url: string | null;
|
||||||
ad_revenue_yuan: number; // 本次领券看的信息流广告预估收益(元)
|
ad_revenue_yuan: number | null; // 本次领券看的信息流广告预估收益(元);未填充为 null
|
||||||
}
|
}
|
||||||
interface CouponDataReport {
|
interface CouponDataReport {
|
||||||
date_from: string;
|
date_from: string;
|
||||||
@@ -124,9 +124,9 @@ const fmtSec = (ms: number | null | undefined): string =>
|
|||||||
const fmtPct = (v: number | null | undefined): string =>
|
const fmtPct = (v: number | null | undefined): string =>
|
||||||
v == null ? '-' : `${(v * 100).toFixed(1)}%`;
|
v == null ? '-' : `${(v * 100).toFixed(1)}%`;
|
||||||
|
|
||||||
// 元(小数)→ "¥0.0050";空值显示 -,真实 0 显示 ¥0.0000,以区分“零收益”和“无数据”。
|
// 元(小数)→ "¥0.0050";空值表示 eCPM 根本未填充,真实 0 仍显示 ¥0.0000。
|
||||||
const fmtYuan = (v: number | null | undefined): string =>
|
const fmtYuan = (v: number | null | undefined): string =>
|
||||||
v == null ? '-' : `¥${v.toFixed(4)}`;
|
v == null ? '未填充' : `¥${v.toFixed(4)}`;
|
||||||
|
|
||||||
// 一组按券行的 success_rate 算术平均(每张券等权;空值券跳过);无有效券 → null(显示 -)。
|
// 一组按券行的 success_rate 算术平均(每张券等权;空值券跳过);无有效券 → null(显示 -)。
|
||||||
// 汇总卡「分平台/合计点位成功率」据此由按券明细上卷,口径与下方按券表一致。
|
// 汇总卡「分平台/合计点位成功率」据此由按券明细上卷,口径与下方按券表一致。
|
||||||
@@ -137,11 +137,6 @@ const slotRateMean = (rows: CouponSlotRow[]): number | null => {
|
|||||||
return rates.length ? rates.reduce((a, b) => a + b, 0) / rates.length : null;
|
return rates.length ? rates.reduce((a, b) => a + b, 0) / rates.length : null;
|
||||||
};
|
};
|
||||||
|
|
||||||
// 汇总卡成功率口径 tooltip 文案
|
|
||||||
const POINT_RATE_HINT =
|
|
||||||
'点位成功率(合计):当前区间内全部券成功率的算术平均(每张券等权);' +
|
|
||||||
'单券成功率=成功(含已领)÷尝试(不含跳过),源自领券每券记录。';
|
|
||||||
|
|
||||||
// 按券表:coupon_id 平台 → 中文
|
// 按券表:coupon_id 平台 → 中文
|
||||||
const SLOT_PLATFORM: Record<string, string> = {
|
const SLOT_PLATFORM: Record<string, string> = {
|
||||||
'meituan-waimai': '美团',
|
'meituan-waimai': '美团',
|
||||||
@@ -517,7 +512,7 @@ export default function CouponDataPage() {
|
|||||||
dataIndex: 'ad_revenue_yuan',
|
dataIndex: 'ad_revenue_yuan',
|
||||||
width: 100,
|
width: 100,
|
||||||
align: 'right',
|
align: 'right',
|
||||||
render: (v: number) => fmtYuan(v),
|
render: (v: number | null) => fmtYuan(v),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '美团耗时',
|
title: '美团耗时',
|
||||||
@@ -597,6 +592,10 @@ export default function CouponDataPage() {
|
|||||||
const successDenominator = summary ? Math.max(0, summary.started_count - abandonedCount) : 0;
|
const successDenominator = summary ? Math.max(0, summary.started_count - abandonedCount) : 0;
|
||||||
const couponSuccessRate =
|
const couponSuccessRate =
|
||||||
summary && successDenominator > 0 ? summary.completed_count / successDenominator : null;
|
summary && successDenominator > 0 ? summary.completed_count / successDenominator : null;
|
||||||
|
const validCouponSlots = couponSlots.filter((r) => r.success_rate != null);
|
||||||
|
const pointSuccessRate = slotRateMean(validCouponSlots);
|
||||||
|
const pointSucceededTotal = validCouponSlots.reduce((total, r) => total + r.succeeded, 0);
|
||||||
|
const pointTriedTotal = validCouponSlots.reduce((total, r) => total + r.tried, 0);
|
||||||
const items = data?.items ?? [];
|
const items = data?.items ?? [];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -714,8 +713,19 @@ export default function CouponDataPage() {
|
|||||||
<Statistic
|
<Statistic
|
||||||
title={
|
title={
|
||||||
<span>
|
<span>
|
||||||
领券成功率{' '}
|
领券完成率{' '}
|
||||||
<Tooltip title="领券完成数 ÷(领券发起数-中途退出数)">
|
<Tooltip
|
||||||
|
overlayStyle={{ maxWidth: 520 }}
|
||||||
|
title={
|
||||||
|
<div>
|
||||||
|
<div>计算逻辑:领券完成数 ÷(领券发起数-中途退出数)</div>
|
||||||
|
<div style={{ marginTop: 6 }}>
|
||||||
|
本期:{summary.completed_count} ÷({summary.started_count}-{abandonedCount})
|
||||||
|
= {fmtPct(couponSuccessRate)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
>
|
||||||
<InfoCircleOutlined style={{ color: '#999' }} />
|
<InfoCircleOutlined style={{ color: '#999' }} />
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
</span>
|
</span>
|
||||||
@@ -728,12 +738,33 @@ export default function CouponDataPage() {
|
|||||||
title={
|
title={
|
||||||
<span>
|
<span>
|
||||||
点位成功率{' '}
|
点位成功率{' '}
|
||||||
<Tooltip title={POINT_RATE_HINT}>
|
<Tooltip
|
||||||
|
overlayStyle={{ maxWidth: 560 }}
|
||||||
|
title={
|
||||||
|
<div>
|
||||||
|
<div>计算逻辑:全部单券成功率的算术平均,每张券等权。</div>
|
||||||
|
<div>单券成功率=成功数(含已领)÷ 尝试数(不含跳过)。</div>
|
||||||
|
<div style={{ marginTop: 6 }}>
|
||||||
|
本期共 {validCouponSlots.length} 张有效券:
|
||||||
|
</div>
|
||||||
|
{validCouponSlots.map((slot) => (
|
||||||
|
<div key={slot.coupon_id}>
|
||||||
|
{slot.coupon_name || slot.coupon_id}:{slot.succeeded} ÷ {slot.tried}=
|
||||||
|
{fmtPct(slot.success_rate)}
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
<div style={{ marginTop: 6 }}>
|
||||||
|
等权平均={fmtPct(pointSuccessRate)};累计成功/尝试=
|
||||||
|
{pointSucceededTotal}/{pointTriedTotal}(累计数仅辅助核对,不作为当前加权公式)。
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
>
|
||||||
<InfoCircleOutlined style={{ color: '#999' }} />
|
<InfoCircleOutlined style={{ color: '#999' }} />
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
</span>
|
</span>
|
||||||
}
|
}
|
||||||
value={fmtPct(slotRateMean(couponSlots))}
|
value={fmtPct(pointSuccessRate)}
|
||||||
/>
|
/>
|
||||||
</Col>
|
</Col>
|
||||||
<Col flex="1 1 0">
|
<Col flex="1 1 0">
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import type { Dayjs } from 'dayjs';
|
|||||||
import { api } from '@/lib/api';
|
import { api } from '@/lib/api';
|
||||||
import { canDo } from '@/lib/auth';
|
import { canDo } from '@/lib/auth';
|
||||||
import { formatWallTime } from '@/lib/format';
|
import { formatWallTime } from '@/lib/format';
|
||||||
|
import { refreshReviewBadge } from '@/lib/reviewBadge';
|
||||||
import { usePagedList } from '@/lib/usePagedList';
|
import { usePagedList } from '@/lib/usePagedList';
|
||||||
import type { Feedback, FeedbackSummary } from '@/lib/types';
|
import type { Feedback, FeedbackSummary } from '@/lib/types';
|
||||||
import FeedbackHandleDrawer from './FeedbackHandleDrawer';
|
import FeedbackHandleDrawer from './FeedbackHandleDrawer';
|
||||||
@@ -431,7 +432,11 @@ export default function FeedbacksPage() {
|
|||||||
feedback={drawerFb}
|
feedback={drawerFb}
|
||||||
open={drawerOpen}
|
open={drawerOpen}
|
||||||
onClose={() => setDrawerOpen(false)}
|
onClose={() => setDrawerOpen(false)}
|
||||||
onDone={() => { reload(); loadSummary(); }}
|
onDone={() => {
|
||||||
|
reload();
|
||||||
|
loadSummary();
|
||||||
|
refreshReviewBadge('/feedbacks');
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<UserRecordsDrawer<Feedback>
|
<UserRecordsDrawer<Feedback>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useRef, useState } from 'react';
|
||||||
import { usePathname, useRouter } from 'next/navigation';
|
import { usePathname, useRouter } from 'next/navigation';
|
||||||
import {
|
import {
|
||||||
BarChartOutlined,
|
BarChartOutlined,
|
||||||
@@ -25,7 +25,16 @@ import {
|
|||||||
import { Avatar, Dropdown, Layout, Tooltip } from 'antd';
|
import { Avatar, Dropdown, Layout, Tooltip } from 'antd';
|
||||||
import { api } from '@/lib/api';
|
import { api } from '@/lib/api';
|
||||||
import { clearAuth, getAdmin, getToken, setAuth } from '@/lib/auth';
|
import { clearAuth, getAdmin, getToken, setAuth } from '@/lib/auth';
|
||||||
import type { AdminInfo } from '@/lib/types';
|
import {
|
||||||
|
REVIEW_BADGE_REFRESH_EVENT,
|
||||||
|
type ReviewBadgeKey,
|
||||||
|
} from '@/lib/reviewBadge';
|
||||||
|
import type {
|
||||||
|
AdminInfo,
|
||||||
|
FeedbackSummary,
|
||||||
|
PriceReportSummary,
|
||||||
|
WithdrawSummary,
|
||||||
|
} from '@/lib/types';
|
||||||
|
|
||||||
const { Sider, Header, Content } = Layout;
|
const { Sider, Header, Content } = Layout;
|
||||||
|
|
||||||
@@ -96,6 +105,8 @@ export default function MainLayout({ children }: { children: React.ReactNode })
|
|||||||
const pathname = usePathname();
|
const pathname = usePathname();
|
||||||
const [admin, setAdmin] = useState<AdminInfo | null>(null);
|
const [admin, setAdmin] = useState<AdminInfo | null>(null);
|
||||||
const [collapsed, setCollapsed] = useState(false);
|
const [collapsed, setCollapsed] = useState(false);
|
||||||
|
const [pendingReviewCounts, setPendingReviewCounts] = useState<Partial<Record<ReviewBadgeKey, number>>>({});
|
||||||
|
const reviewRefreshVersion = useRef<Partial<Record<ReviewBadgeKey, number>>>({});
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const token = getToken();
|
const token = getToken();
|
||||||
@@ -114,6 +125,44 @@ export default function MainLayout({ children }: { children: React.ReactNode })
|
|||||||
.catch(() => {});
|
.catch(() => {});
|
||||||
}, [router]);
|
}, [router]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (!admin) return;
|
||||||
|
const canAccess = (page: string) =>
|
||||||
|
admin.role === 'super_admin' || !admin.pages || admin.pages.includes(page);
|
||||||
|
|
||||||
|
const refresh = async (key: ReviewBadgeKey) => {
|
||||||
|
if (!canAccess(key.slice(1))) return;
|
||||||
|
const version = (reviewRefreshVersion.current[key] ?? 0) + 1;
|
||||||
|
reviewRefreshVersion.current[key] = version;
|
||||||
|
let count: number;
|
||||||
|
if (key === '/withdraws') {
|
||||||
|
count = (await api.get<WithdrawSummary>('/admin/api/withdraws/summary')).data.reviewing_count;
|
||||||
|
} else if (key === '/price-reports') {
|
||||||
|
count = (await api.get<PriceReportSummary>('/admin/api/price-reports/summary')).data.pending;
|
||||||
|
} else {
|
||||||
|
count = (await api.get<FeedbackSummary>('/admin/api/feedbacks/summary')).data.pending;
|
||||||
|
}
|
||||||
|
if (reviewRefreshVersion.current[key] !== version) return;
|
||||||
|
setPendingReviewCounts((current) => ({ ...current, [key]: count }));
|
||||||
|
};
|
||||||
|
|
||||||
|
const refreshSafely = (key: ReviewBadgeKey) => refresh(key).catch(() => {});
|
||||||
|
void Promise.all([
|
||||||
|
refreshSafely('/withdraws'),
|
||||||
|
refreshSafely('/price-reports'),
|
||||||
|
refreshSafely('/feedbacks'),
|
||||||
|
]);
|
||||||
|
|
||||||
|
const onReviewCompleted = (event: Event) => {
|
||||||
|
const key = (event as CustomEvent<ReviewBadgeKey>).detail;
|
||||||
|
if (key) void refreshSafely(key);
|
||||||
|
};
|
||||||
|
window.addEventListener(REVIEW_BADGE_REFRESH_EVENT, onReviewCompleted);
|
||||||
|
return () => {
|
||||||
|
window.removeEventListener(REVIEW_BADGE_REFRESH_EVENT, onReviewCompleted);
|
||||||
|
};
|
||||||
|
}, [admin]);
|
||||||
|
|
||||||
if (!admin) return null; // 守卫期间不闪烁内容
|
if (!admin) return null; // 守卫期间不闪烁内容
|
||||||
|
|
||||||
// 选中态:取路径一级(/users/123 -> /users)
|
// 选中态:取路径一级(/users/123 -> /users)
|
||||||
@@ -132,6 +181,20 @@ export default function MainLayout({ children }: { children: React.ReactNode })
|
|||||||
hasChildren(group) ? group.children : [group],
|
hasChildren(group) ? group.children : [group],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const reviewBadge = (key: string) => {
|
||||||
|
const count = pendingReviewCounts[key as ReviewBadgeKey] ?? 0;
|
||||||
|
if (count <= 0) return null;
|
||||||
|
return (
|
||||||
|
<span
|
||||||
|
className="nav-review-badge"
|
||||||
|
aria-label={`${count} 条未审核`}
|
||||||
|
title={`${count} 条未审核`}
|
||||||
|
>
|
||||||
|
{count}
|
||||||
|
</span>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
const logout = () => {
|
const logout = () => {
|
||||||
clearAuth();
|
clearAuth();
|
||||||
router.replace('/login');
|
router.replace('/login');
|
||||||
@@ -166,6 +229,7 @@ export default function MainLayout({ children }: { children: React.ReactNode })
|
|||||||
aria-label={item.label}
|
aria-label={item.label}
|
||||||
>
|
>
|
||||||
{item.icon}
|
{item.icon}
|
||||||
|
{reviewBadge(item.key)}
|
||||||
</button>
|
</button>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
))
|
))
|
||||||
@@ -183,7 +247,8 @@ export default function MainLayout({ children }: { children: React.ReactNode })
|
|||||||
onClick={() => router.push(group.key)}
|
onClick={() => router.push(group.key)}
|
||||||
>
|
>
|
||||||
<span className="nav-primary-icon">{group.icon}</span>
|
<span className="nav-primary-icon">{group.icon}</span>
|
||||||
<span>{group.label}</span>
|
<span className="nav-item-label">{group.label}</span>
|
||||||
|
{reviewBadge(group.key)}
|
||||||
</button>
|
</button>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -202,7 +267,8 @@ export default function MainLayout({ children }: { children: React.ReactNode })
|
|||||||
onClick={() => router.push(child.key)}
|
onClick={() => router.push(child.key)}
|
||||||
>
|
>
|
||||||
<span className="nav-child-icon">{child.icon}</span>
|
<span className="nav-child-icon">{child.icon}</span>
|
||||||
<span>{child.label}</span>
|
<span className="nav-item-label">{child.label}</span>
|
||||||
|
{reviewBadge(child.key)}
|
||||||
</button>
|
</button>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
@@ -269,6 +335,29 @@ export default function MainLayout({ children }: { children: React.ReactNode })
|
|||||||
color: rgba(255, 255, 255, 0.72);
|
color: rgba(255, 255, 255, 0.72);
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
}
|
}
|
||||||
|
.nav-item-label {
|
||||||
|
min-width: 0;
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
.nav-review-badge {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
box-sizing: border-box;
|
||||||
|
flex: 0 0 auto;
|
||||||
|
min-width: 18px;
|
||||||
|
height: 18px;
|
||||||
|
padding: 0 5px;
|
||||||
|
border-radius: 9px;
|
||||||
|
background: #ff4d4f;
|
||||||
|
color: #fff;
|
||||||
|
font-size: 11px;
|
||||||
|
font-weight: 600;
|
||||||
|
line-height: 18px;
|
||||||
|
white-space: nowrap;
|
||||||
|
font-variant-numeric: tabular-nums;
|
||||||
|
box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08);
|
||||||
|
}
|
||||||
.nav-direct,
|
.nav-direct,
|
||||||
.nav-child,
|
.nav-child,
|
||||||
.nav-icon-button {
|
.nav-icon-button {
|
||||||
@@ -332,6 +421,7 @@ export default function MainLayout({ children }: { children: React.ReactNode })
|
|||||||
padding: 0 8px 14px;
|
padding: 0 8px 14px;
|
||||||
}
|
}
|
||||||
.nav-icon-button {
|
.nav-icon-button {
|
||||||
|
position: relative;
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
@@ -342,6 +432,11 @@ export default function MainLayout({ children }: { children: React.ReactNode })
|
|||||||
color: rgba(255, 255, 255, 0.72);
|
color: rgba(255, 255, 255, 0.72);
|
||||||
font-size: 17px;
|
font-size: 17px;
|
||||||
}
|
}
|
||||||
|
.nav-icon-button .nav-review-badge {
|
||||||
|
position: absolute;
|
||||||
|
top: 1px;
|
||||||
|
right: -6px;
|
||||||
|
}
|
||||||
.nav-icon-button:hover,
|
.nav-icon-button:hover,
|
||||||
.nav-icon-button.is-selected {
|
.nav-icon-button.is-selected {
|
||||||
background: #1677ff;
|
background: #1677ff;
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import dayjs from 'dayjs';
|
|||||||
import { api, errMsg } from '@/lib/api';
|
import { api, errMsg } from '@/lib/api';
|
||||||
import { canDo } from '@/lib/auth';
|
import { canDo } from '@/lib/auth';
|
||||||
import { mediaUrl } from '@/lib/media';
|
import { mediaUrl } from '@/lib/media';
|
||||||
|
import { refreshReviewBadge } from '@/lib/reviewBadge';
|
||||||
import { usePagedList } from '@/lib/usePagedList';
|
import { usePagedList } from '@/lib/usePagedList';
|
||||||
import type { PriceReport, PriceReportSummary } from '@/lib/types';
|
import type { PriceReport, PriceReportSummary } from '@/lib/types';
|
||||||
import UserRecordsDrawer from '@/components/UserRecordsDrawer';
|
import UserRecordsDrawer from '@/components/UserRecordsDrawer';
|
||||||
@@ -202,6 +203,7 @@ export default function PriceReportsPage() {
|
|||||||
onOk: async () => {
|
onOk: async () => {
|
||||||
try {
|
try {
|
||||||
await api.post(`/admin/api/price-reports/${r.id}/approve`);
|
await api.post(`/admin/api/price-reports/${r.id}/approve`);
|
||||||
|
refreshReviewBadge('/price-reports');
|
||||||
message.success('已通过,已发放 1000 金币');
|
message.success('已通过,已发放 1000 金币');
|
||||||
refreshAfterChange();
|
refreshAfterChange();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@@ -220,6 +222,7 @@ export default function PriceReportsPage() {
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
await api.post(`/admin/api/price-reports/${rejecting.id}/reject`, { reason });
|
await api.post(`/admin/api/price-reports/${rejecting.id}/reject`, { reason });
|
||||||
|
refreshReviewBadge('/price-reports');
|
||||||
message.success('已拒绝');
|
message.success('已拒绝');
|
||||||
setRejecting(null);
|
setRejecting(null);
|
||||||
setRejectReason('');
|
setRejectReason('');
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ import dayjs, { type Dayjs } from 'dayjs';
|
|||||||
import { api, errMsg } from '@/lib/api';
|
import { api, errMsg } from '@/lib/api';
|
||||||
import { canDo } from '@/lib/auth';
|
import { canDo } from '@/lib/auth';
|
||||||
import { formatUtcTime, utcDayjs, utcFromNow, yuan } from '@/lib/format';
|
import { formatUtcTime, utcDayjs, utcFromNow, yuan } from '@/lib/format';
|
||||||
|
import { refreshReviewBadge } from '@/lib/reviewBadge';
|
||||||
import { usePagedList } from '@/lib/usePagedList';
|
import { usePagedList } from '@/lib/usePagedList';
|
||||||
import type {
|
import type {
|
||||||
AuditLog,
|
AuditLog,
|
||||||
@@ -332,6 +333,7 @@ export default function WithdrawsPage() {
|
|||||||
onOk: async () => {
|
onOk: async () => {
|
||||||
try {
|
try {
|
||||||
await api.post(`/admin/api/withdraws/${o.out_bill_no}/approve`);
|
await api.post(`/admin/api/withdraws/${o.out_bill_no}/approve`);
|
||||||
|
refreshReviewBadge('/withdraws');
|
||||||
message.success('已通过审核并发起打款');
|
message.success('已通过审核并发起打款');
|
||||||
await refreshAfterChange(o.out_bill_no);
|
await refreshAfterChange(o.out_bill_no);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@@ -362,6 +364,7 @@ export default function WithdrawsPage() {
|
|||||||
await api.post(`/admin/api/withdraws/${targets[0].out_bill_no}/reject`, { reason: trimmed });
|
await api.post(`/admin/api/withdraws/${targets[0].out_bill_no}/reject`, { reason: trimmed });
|
||||||
message.success('已拒绝并退回余额');
|
message.success('已拒绝并退回余额');
|
||||||
}
|
}
|
||||||
|
refreshReviewBadge('/withdraws');
|
||||||
setRejecting(null);
|
setRejecting(null);
|
||||||
setBulkRejecting([]);
|
setBulkRejecting([]);
|
||||||
setRejectReason('');
|
setRejectReason('');
|
||||||
@@ -400,6 +403,7 @@ export default function WithdrawsPage() {
|
|||||||
const { data } = await api.post<WithdrawBulkResult>('/admin/api/withdraws/bulk/approve', {
|
const { data } = await api.post<WithdrawBulkResult>('/admin/api/withdraws/bulk/approve', {
|
||||||
out_bill_nos: selectedReviewing.map((item) => item.out_bill_no),
|
out_bill_nos: selectedReviewing.map((item) => item.out_bill_no),
|
||||||
});
|
});
|
||||||
|
refreshReviewBadge('/withdraws');
|
||||||
const text = bulkResultText('批量通过完成', data);
|
const text = bulkResultText('批量通过完成', data);
|
||||||
if (data.failed) message.warning(text);
|
if (data.failed) message.warning(text);
|
||||||
else message.success(text);
|
else message.success(text);
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
export type ReviewBadgeKey = '/withdraws' | '/price-reports' | '/feedbacks';
|
||||||
|
|
||||||
|
export const REVIEW_BADGE_REFRESH_EVENT = 'review-badge-refresh';
|
||||||
|
|
||||||
|
export function refreshReviewBadge(key: ReviewBadgeKey) {
|
||||||
|
if (typeof window === 'undefined') return;
|
||||||
|
window.dispatchEvent(
|
||||||
|
new CustomEvent<ReviewBadgeKey>(REVIEW_BADGE_REFRESH_EVENT, { detail: key }),
|
||||||
|
);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user