feat: 更新收益模块,重命名路径并添加收益概览、最近记录、收益来源和收益趋势组件

This commit is contained in:
2025-12-27 20:43:43 +07:00
parent 7ce5d428b1
commit 7da1d7b1cf
7 changed files with 3 additions and 5 deletions

View File

@@ -0,0 +1,45 @@
<script lang='ts' setup>
</script>
<template>
<div class="bg-text-900 rounded-xl p-7">
<div>
<div class="text-sm mb-2">
累计总收益
</div>
<div class="text-4xl font-bold">
{{ formatAmountWithSplit(190421321) }}
</div>
<div class="flex items-center gap-2 text-xs mt-1">
<div>昨日收益</div>
<div>+{{ formatAmountWithSplit(864314) }}</div>
</div>
</div>
<div class="h-px bg-text-800 my-5" />
<div class="flex justify-around">
<div class="flex-col-center">
<div class="text-base font-bold">
{{ formatAmountWithSplit(42523) }}
</div>
<div class="text-xs">
本月收益
</div>
</div>
<div class="h-auto w-px bg-text-800" />
<div class="flex-col-center">
<div class="text-base font-bold">
{{ formatAmountWithSplit(12345) }}
</div>
<div class="text-xs">
待确认收益
</div>
</div>
</div>
</div>
</template>
<style lang='css' scoped>
h4 {
font-size: var(--title-font-size);
}
</style>

View File

@@ -0,0 +1,110 @@
<script lang='ts' setup>
</script>
<template>
<ion-list>
<ion-list-header>
<ion-label>
<h4>最近记录</h4>
</ion-label>
<ion-button class="text-sm">
查看全部
</ion-button>
</ion-list-header>
<ion-item>
<div class="flex justify-between w-full items-center py-4">
<div class="flex flex-col gap-1">
<div class="flex items-center gap-2">
<div class="text-sm font-medium">
分红收益
</div>
<ion-badge class="text-xs p-1" color="success">
已完成
</ion-badge>
</div>
<div class="text-sm font-medium">
旧金山商业地产
</div>
<div class="text-xs text-text-400">
SF-002
</div>
</div>
<div class="text-right">
<div class="text-base font-semibold">
{{ formatAmountWithSplit(520.5) }}
</div>
<div class="text-xs text-text-400">
今天
</div>
</div>
</div>
</ion-item>
<ion-item>
<div class="flex justify-between w-full items-center py-4">
<div class="flex flex-col gap-1">
<div class="flex items-center gap-2">
<div class="text-sm font-medium">
分红收益
</div>
<ion-badge class="text-xs p-1" color="success">
已完成
</ion-badge>
</div>
<div class="text-sm font-medium">
旧金山商业地产
</div>
<div class="text-xs text-text-400">
SF-002
</div>
</div>
<div class="text-right">
<div class="text-base font-semibold">
{{ formatAmountWithSplit(520.5) }}
</div>
<div class="text-xs text-text-400">
今天
</div>
</div>
</div>
</ion-item>
<ion-item>
<div class="flex justify-between w-full items-center py-4">
<div class="flex flex-col gap-1">
<div class="flex items-center gap-2">
<div class="text-sm font-medium">
分红收益
</div>
<ion-badge class="text-xs p-1" color="success">
已完成
</ion-badge>
</div>
<div class="text-sm font-medium">
旧金山商业地产
</div>
<div class="text-xs text-text-400">
SF-002
</div>
</div>
<div class="text-right">
<div class="text-base font-semibold">
{{ formatAmountWithSplit(520.5) }}
</div>
<div class="text-xs text-text-400">
今天
</div>
</div>
</div>
</ion-item>
</ion-list>
</template>
<style lang='css' scoped>
h4 {
font-size: var(--title-font-size);
font-weight: bold;
}
ion-badge {
font-size: 10px;
}
</style>

View File

@@ -0,0 +1,95 @@
<script lang='ts' setup>
</script>
<template>
<div>
<h4>收益来源</h4>
<div class="card">
<div class="flex justify-between items-center mb-2">
<div class="flex items-center gap-2">
<div class="w-2 h-2 bg-green-700 rounded-full" />
<div class="text-sm font-semibold">
分红收益
</div>
</div>
<div class="text-base font-semibold">
{{ formatAmountWithSplit(85321.32) }}
</div>
</div>
<div class="flex justify-between items-center mb-2">
<div class="flex items-center gap-2">
<div class="w-2 h-2 " />
<div class="text-xs">
125
</div>
</div>
<div class="text-xs text-text-200">
69.42%
</div>
</div>
</div>
<div class="card">
<div class="flex justify-between items-center mb-2">
<div class="flex items-center gap-2">
<div class="w-2 h-2 bg-gray-700 rounded-full" />
<div class="text-sm font-semibold">
资产收益
</div>
</div>
<div class="text-base font-semibold">
{{ formatAmountWithSplit(32642.6) }}
</div>
</div>
<div class="flex justify-between items-center mb-2">
<div class="flex items-center gap-2">
<div class="w-2 h-2 " />
<div class="text-xs">
45
</div>
</div>
<div class="text-xs text-text-200">
25.54%
</div>
</div>
</div>
<div class="card">
<div class="flex justify-between items-center mb-2">
<div class="flex items-center gap-2">
<div class="w-2 h-2 bg-yellow-500 rounded-full" />
<div class="text-sm font-semibold">
交易收益
</div>
</div>
<div class="text-base font-semibold">
{{ formatAmountWithSplit(8110.4) }}
</div>
</div>
<div class="flex justify-between items-center mb-2">
<div class="flex items-center gap-2">
<div class="w-2 h-2 " />
<div class="text-xs">
89
</div>
</div>
<div class="text-xs text-text-200">
5.04%
</div>
</div>
</div>
</div>
</template>
<style lang='css' scoped>
@reference "tailwindcss";
h4 {
font-size: var(--title-font-size);
}
.card {
@apply bg-(--ion-text-color-step-950) rounded-xl p-3 mt-3;
}
</style>

View File

@@ -0,0 +1,63 @@
<script lang='ts' setup>
const tradingViewInst = useTemplateRef<HTMLDivElement>("tradingViewInst");
useTradingView(tradingViewInst, {
type: "Area",
data: [
{
time: "2023-01-01",
value: 1000,
},
{
time: "2023-02-01",
value: 1200,
},
{
time: "2023-03-01",
value: 900,
},
{
time: "2023-04-01",
value: 1400,
},
{
time: "2023-05-01",
value: 1300,
},
{
time: "2023-06-01",
value: 1500,
},
{
time: "2023-07-01",
value: 1700,
},
{
time: "2023-08-01",
value: 1600,
},
],
weightChartOptions: {
height: 150,
rightPriceScale: {
visible: false,
},
leftPriceScale: {
visible: false,
},
},
});
</script>
<template>
<div>
<h4>收益趋势</h4>
<div ref="tradingViewInst" />
</div>
</template>
<style lang='css' scoped>
h4 {
font-size: var(--title-font-size);
}
</style>

View File

@@ -0,0 +1,63 @@
<script lang='ts' setup>
import type { RefresherCustomEvent } from "@ionic/vue";
import { mockClient } from "@/api";
import Overview from "./components/overview.vue";
import Recent from "./components/recent.vue";
import RevenueSource from "./components/revenue-source.vue";
import Trend from "./components/trend.vue";
const { t } = useI18n();
const { vibrate } = useHaptics();
// 收益数据
const loading = ref(true);
const { data } = await mockClient("income/total");
async function loadIncomeData() {
loading.value = true;
useTimeoutFn(() => {
loading.value = false;
}, 800);
}
async function handleRefresh(event: RefresherCustomEvent) {
vibrate();
useTimeoutFn(() => {
event.target.complete();
}, 800);
}
onMounted(() => {
loadIncomeData();
});
</script>
<template>
<ion-page>
<ion-header class="ion-no-border">
<ion-toolbar class="ui-toolbar">
<ui-back-button slot="start" />
<ion-title>{{ t("income.title") }}</ion-title>
</ion-toolbar>
</ion-header>
<ion-content :fullscreen="true" class="ion-padding">
<ion-refresher slot="fixed" @ion-refresh="handleRefresh($event)">
<ion-refresher-content />
</ion-refresher>
<div class="container">
<Overview />
<Trend />
<RevenueSource />
<Recent />
</div>
</ion-content>
</ion-page>
</template>
<style lang='css' scoped>
.container {
--title-font-size: 16px;
}
</style>