fix: 处理余额方面问题与banner页面不自动加载问题

This commit is contained in:
ZhuRui
2026-08-05 16:28:44 +08:00
parent b3458fd4b8
commit 8951733a2d
7 changed files with 47 additions and 78 deletions
+12 -13
View File
@@ -64,13 +64,24 @@ export function useBannerModel() {
{ delay: 300 },
);
// ===== 构建 API 查询参数 =====
const buildQueryParams = (): BannerListQueryParams => {
const params: BannerListQueryParams = {};
if (filterForm.title.trim()) {
params.title = filterForm.title.trim();
}
if (filterForm.status) {
params.status = filterForm.status;
}
return params;
};
// ===== 数据请求(API 返回全量,前端分页) =====
const {
data,
loading,
run: fetchList,
} = useRequest<TournamentAdminBannerListVO[]>(() => getBannerList(buildQueryParams()), {
refreshDeps: [],
formatResult: (res) => (res.code == 200 ? res.data : []),
});
@@ -111,18 +122,6 @@ export function useBannerModel() {
{ title: '状态', dataIndex: 'status', key: 'status', width: 100, align: 'center' as const },
];
// ===== 构建 API 查询参数 =====
const buildQueryParams = (): BannerListQueryParams => {
const params: BannerListQueryParams = {};
if (filterForm.title.trim()) {
params.title = filterForm.title.trim();
}
if (filterForm.status) {
params.status = filterForm.status;
}
return params;
};
// ===== 计算属性 =====
const hasFilter = computed(() => {
return debouncedTitle.value.trim() !== '' || filterForm.status !== '';
+3 -1
View File
@@ -9,6 +9,7 @@ import { buildMockWalletTransactionPage } from '@/config/mock/walletTransactions
import type {
WalletQueryParams,
WalletSummaryVO,
WalletSummaryPageData,
WalletTransactionQueryParams,
WalletTransactionVO,
PageData,
@@ -17,6 +18,7 @@ import type {
export type {
WalletSummaryVO,
WalletSummaryPageData,
WalletQueryParams,
WalletTransactionVO,
WalletTransactionQueryParams,
@@ -39,7 +41,7 @@ const delay = (ms: number) => new Promise<void>((r) => setTimeout(r, ms));
/** 钱包列表分页 */
export async function getWalletList(
params: WalletQueryParams,
): Promise<ApiResult<PageData<WalletSummaryVO>>> {
): Promise<ApiResult<WalletSummaryPageData>> {
if (USE_MOCK) {
await delay(MOCK_DELAY);
const page = Number(params.page) || 1;
@@ -102,15 +102,12 @@ export function useWalletModel() {
const listData = computed(() => (data.value as any)?.data);
const dataSource = computed(() => listData.value?.list || []);
// 汇总:从第一条记录提取
const summary = computed(() => {
const first = dataSource.value?.[0] as any;
return {
totalBalance: first?.totalAmount ?? '0.00',
frozenAmount: first?.totalFrozenAmount ?? '0.00',
totalWithdraw: first?.totalWithdrawalAmount ?? '0.00',
};
});
// 汇总:从 exData 派生(与 list 同级)
const summary = computed(() => ({
totalBalance: listData.value?.exData?.totalAmount ?? '0.00',
frozenAmount: listData.value?.exData?.totalFrozenAmount ?? '0.00',
totalWithdraw: listData.value?.exData?.totalWithdrawalAmount ?? '0.00',
}));
// 同步 total 到 pagination
useEffect(() => {
+1 -1
View File
@@ -31,7 +31,7 @@ function renderBodyCell({
}
if (column.key === 'action') {
// auditStatus=0(待审核)→ 显示「审核」,其他 → 显示「查看」
if (canAudit && record.auditStatus === 0) {
if (canAudit && record.auditStatus == 0) {
return (
<Button type="link" size="small" onClick={() => onAudit(record)}>