From ada88d7b204e9376d5dab9b3de2dc6301a991c13 Mon Sep 17 00:00:00 2001 From: duanshuwen Date: Thu, 16 Jul 2026 09:04:04 +0800 Subject: [PATCH] feat(aigc): replace mock credit data with backend api fetch add getCreditLedgerPage API function to fetch credit ledger records remove local mock ledger data file update LedgerCard component to adapt to new API response structure rewrite points details page to use z-paging with empty and error handling --- .../components/LedgerCard/index.vue | 34 +++++++++++--- src/pages-aigc/pointsDetails/data/ledger.js | 42 ------------------ .../pointsDetails/pointsDetails.vue | 44 +++++++++++++------ src/request/api/AigcApi.js | 5 +++ 4 files changed, 63 insertions(+), 62 deletions(-) delete mode 100644 src/pages-aigc/pointsDetails/data/ledger.js diff --git a/src/pages-aigc/pointsDetails/components/LedgerCard/index.vue b/src/pages-aigc/pointsDetails/components/LedgerCard/index.vue index 32f71c0..c575321 100644 --- a/src/pages-aigc/pointsDetails/components/LedgerCard/index.vue +++ b/src/pages-aigc/pointsDetails/components/LedgerCard/index.vue @@ -1,15 +1,15 @@ @@ -23,7 +23,27 @@ const props = defineProps({ }, }); -const isPlus = computed(() => String(props.record.delta || "").startsWith("+")); +const changePoints = computed(() => { + const value = Number(props.record.changePoints); + return Number.isFinite(value) ? value : 0; +}); + +const changePointsText = computed(() => { + return changePoints.value > 0 ? `+${changePoints.value}` : String(changePoints.value); +}); + +const isPlus = computed(() => changePoints.value > 0); +const isMinus = computed(() => changePoints.value < 0); + +const statusText = computed(() => { + const statusName = props.record.statusName; + if (statusName !== undefined && statusName !== null && statusName !== "") { + return statusName; + } + + const status = props.record.status; + return status === undefined || status === null ? "" : String(status); +});