From 967b87fc831034d4dc44a9fbbcb4bb3e543429df Mon Sep 17 00:00:00 2001 From: Seven Date: Sun, 18 Jan 2026 02:19:37 +0700 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E9=92=B1=E5=8C=85?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=EF=BC=8C=E5=88=9B=E5=BB=BA=E9=92=B1=E5=8C=85?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E7=AE=A1=E7=90=86=EF=BC=8C=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E8=B5=84=E6=96=99=E9=A1=B5=E9=9D=A2=EF=BC=8C?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=A0=B7=E5=BC=8F=E5=92=8C=E4=BA=A4=E4=BA=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- auto-imports.d.ts | 5 ++ src/store/wallet.ts | 25 ++++++ src/views/profile/index.ts | 55 ++++++++++++ src/views/profile/index.vue | 171 ++++++++++++------------------------ 4 files changed, 140 insertions(+), 116 deletions(-) create mode 100644 src/store/wallet.ts create mode 100644 src/views/profile/index.ts diff --git a/auto-imports.d.ts b/auto-imports.d.ts index 8195e98..c215e2f 100644 --- a/auto-imports.d.ts +++ b/auto-imports.d.ts @@ -296,6 +296,7 @@ declare global { const useVibrate: typeof import('@vueuse/core').useVibrate const useVirtualList: typeof import('@vueuse/core').useVirtualList const useWakeLock: typeof import('@vueuse/core').useWakeLock + const useWalletStore: typeof import('./src/store/wallet').useWalletStore const useWebNotification: typeof import('@vueuse/core').useWebNotification const useWebSocket: typeof import('@vueuse/core').useWebSocket const useWebWorker: typeof import('@vueuse/core').useWebWorker @@ -328,6 +329,9 @@ declare global { // @ts-ignore export type { Language } from './src/composables/useLanguage' import('./src/composables/useLanguage') + // @ts-ignore + export type { Wallet } from './src/store/wallet' + import('./src/store/wallet') } // for vue template auto import @@ -624,6 +628,7 @@ declare module 'vue' { readonly useVibrate: UnwrapRef readonly useVirtualList: UnwrapRef readonly useWakeLock: UnwrapRef + readonly useWalletStore: UnwrapRef readonly useWebNotification: UnwrapRef readonly useWebSocket: UnwrapRef readonly useWebWorker: UnwrapRef diff --git a/src/store/wallet.ts b/src/store/wallet.ts new file mode 100644 index 0000000..c6c15da --- /dev/null +++ b/src/store/wallet.ts @@ -0,0 +1,25 @@ +import type { Treaty } from "@elysiajs/eden"; +import { client, safeClient } from "@/api"; + +export type Wallet = Treaty.Data[number]; + +export const useWalletStore = defineStore("wallet", () => { + const wallets = ref([]); + const balanceWallet = ref(null); + + async function syncWallets() { + const { data } = await safeClient(client.api.wallet.wallets.get(), { silent: true }); + wallets.value = data.value || []; + } + async function syncBalanceWallet() { + const { data } = await safeClient(client.api.wallet.wallet_by_code({ walletTypeCode: "balance" }).get(), { silent: true }); + balanceWallet.value = data.value || null; + } + + return { + wallets, + balanceWallet, + syncWallets, + syncBalanceWallet, + }; +}); diff --git a/src/views/profile/index.ts b/src/views/profile/index.ts new file mode 100644 index 0000000..af1f1a9 --- /dev/null +++ b/src/views/profile/index.ts @@ -0,0 +1,55 @@ +import { cardOutline, chatbubblesOutline, listOutline, locationOutline, lockClosedOutline, settingsOutline, shieldCheckmarkOutline } from "ionicons/icons"; + +export const myApps = [ + { + id: "real_name", + name: "实名认证", + icon: shieldCheckmarkOutline, + color: "#c32120", + path: "/real-name", + }, + { + id: "address", + name: "收货地址", + icon: locationOutline, + color: "#c32120", + path: "/address", + }, + { + id: "payment", + name: "收款方式", + icon: cardOutline, + color: "#c32120", + path: "/payment", + }, + { + id: "customer_service", + name: "在线客服", + icon: chatbubblesOutline, + color: "#c32120", + path: "/customer-service", + }, + { + id: "settings", + name: "个人设置", + icon: settingsOutline, + color: "#c32120", + path: "/settings", + }, + { + id: "security", + name: "安全中心", + icon: lockClosedOutline, + color: "#c32120", + path: "/security", + }, + { + id: "asset_details", + name: "资产明细", + icon: listOutline, + color: "#c32120", + path: "/asset-details", + }, +] as const; + +export type MyApp = (typeof myApps)[number]; diff --git a/src/views/profile/index.vue b/src/views/profile/index.vue index 02b0f26..22a8180 100644 --- a/src/views/profile/index.vue +++ b/src/views/profile/index.vue @@ -1,108 +1,47 @@ @@ -118,14 +57,14 @@ function handleLogout() { 用户头像
-
- {{ userInfo.name }} +
+ {{ userProfile?.nickname }}
-
- 手机号:{{ userInfo.phone }} +
+ 手机号:{{ userProfile?.user.username }}
-
- 邀请码:{{ userInfo.inviteCode }} +
+ 邀请码:{{ userProfile?.inviteCode }}
@@ -136,7 +75,7 @@ function handleLogout() {
- +
我的钱包
@@ -144,20 +83,20 @@ function handleLogout() {
-
+
收益钱包
-
- ¥{{ wallet.profitBalance.toFixed(2) }} +
+ ¥{{ balanceWallet?.available }}
-
+
账户余额
-
- ¥{{ wallet.accountBalance.toFixed(2) }} +
+ ¥{{ balanceWallet?.available }}
@@ -189,7 +128,7 @@ function handleLogout() {
- +
我的应用
@@ -200,7 +139,7 @@ function handleLogout() { v-for="app in myApps" :key="app.id" class="flex flex-col items-center gap-2 cursor-pointer transition-transform active:scale-95" - @click="handleAppClick(app)" + @click="$router.push(app.path)" >
.card { - background: linear-gradient(180deg, #eef9ff, #ffffff 15%); + background: linear-gradient(180deg, #ffeef1, #ffffff 15%); } .recharge-btn { - --background: linear-gradient(135deg, #1778ac 0%, #265166 100%); - --background-activated: linear-gradient(135deg, #1778ac 0%, #265166 100%); + --background: linear-gradient(135deg, #c41e3a 0%, #8b1a2e 100%); + --background-activated: linear-gradient(135deg, #8b1a2e 0%, #c41e3a 100%); --border-radius: 12px; - --box-shadow: 0 2px 8px rgba(30, 124, 196, 0.3); + --box-shadow: 0 2px 8px rgba(196, 30, 58, 0.3); font-weight: 600; font-size: 14px; height: 44px; @@ -241,8 +180,8 @@ function handleLogout() { } .withdraw-btn { - --border-color: #1972a2; - --color: #1e6ac4; + --border-color: #c41e3a; + --color: #c41e3a; --border-radius: 12px; --border-width: 2px; font-weight: 600; @@ -255,6 +194,6 @@ function handleLogout() { font-weight: 600; } .app-item { - background: #3f8bba; + background: linear-gradient(135deg, rgb(249 103 102 / 93%), rgb(195, 33, 32)); }