feat: 优化资产详情页面,添加利润钱包数据获取逻辑,更新记录展示方式

This commit is contained in:
2026-01-19 04:10:10 +07:00
parent 321b6b2c9a
commit 2ec1ef000a
3 changed files with 61 additions and 106 deletions

View File

@@ -1,8 +1,11 @@
<script lang='ts' setup>
import { arrowDownCircleOutline, arrowUpCircleOutline, listOutline, walletOutline } from "ionicons/icons";
import { client, safeClient } from "@/api";
const walletStore = useWalletStore();
const balanceWallet = await walletStore.getWalletByType("balance");
const profitWallet = await walletStore.getWalletByType("profit");
const { data } = await safeClient(client.api.ledger.entries.get());
// 当前选中的标签
const selectedTab = ref<"all" | "income" | "investment">("all");
@@ -17,73 +20,6 @@ interface TransactionRecord {
description?: string;
}
// 模拟数据
const allRecords = ref<TransactionRecord[]>([
{
id: 1,
type: "income",
title: "投资收益",
amount: 1250.50,
time: "2026-01-18 14:30:20",
status: "success",
description: "稳健增长基金收益",
},
{
id: 2,
type: "investment",
title: "投资支出",
amount: -5000.00,
time: "2026-01-17 10:15:30",
status: "success",
description: "购买稳健增长基金",
},
{
id: 3,
type: "withdraw",
title: "提现",
amount: -1000.00,
time: "2026-01-16 16:45:10",
status: "success",
description: "提现至银行卡",
},
{
id: 4,
type: "recharge",
title: "充值",
amount: 3000.00,
time: "2026-01-15 09:20:00",
status: "success",
description: "银行卡充值",
},
{
id: 5,
type: "income",
title: "投资收益",
amount: 890.30,
time: "2026-01-14 14:30:20",
status: "success",
description: "价值投资基金收益",
},
{
id: 6,
type: "investment",
title: "投资支出",
amount: -3000.00,
time: "2026-01-13 11:20:45",
status: "success",
description: "购买均衡配置基金",
},
{
id: 7,
type: "income",
title: "投资收益",
amount: 456.80,
time: "2026-01-12 14:30:20",
status: "success",
description: "高收益债券收益",
},
]);
// 筛选后的记录
const filteredRecords = computed(() => {
if (selectedTab.value === "all") {
@@ -215,9 +151,16 @@ function formatAmount(amount: number) {
<!-- 记录列表 -->
<div class="records-list">
<div v-if="filteredRecords.length > 0" class="ion-padding-horizontal">
<div v-if="data?.data.length === 0" class="empty-state">
<empty title="暂无记录">
<template #icon>
<ion-icon :icon="listOutline" class="empty-icon" />
</template>
</empty>
</div>
<div v-else class="ion-padding-horizontal">
<div
v-for="record in filteredRecords"
v-for="record in data?.data"
:key="record.id"
class="record-item"
>
@@ -252,15 +195,6 @@ function formatAmount(amount: number) {
</div>
</div>
</div>
<!-- 空状态 -->
<div v-else class="empty-state">
<empty title="暂无记录">
<template #icon>
<ion-icon :icon="listOutline" class="empty-icon" />
</template>
</empty>
</div>
</div>
</ion-content>
</ion-page>