feat: 添加账单页面及相关组件,优化充值记录显示和国际化支持
This commit is contained in:
@@ -3,6 +3,11 @@ export enum PaymentChannelEnum {
|
||||
CRYPTO = "crypto",
|
||||
}
|
||||
|
||||
export enum DepositTypeEnum {
|
||||
FIAT = "fiat",
|
||||
CRYPTO = "crypto",
|
||||
}
|
||||
|
||||
export enum AssetCodeEnum {
|
||||
USDT = "USDT",
|
||||
OPTS = "OPTS",
|
||||
|
||||
@@ -3,11 +3,6 @@ import type { client } from ".";
|
||||
import type { AssetCodeEnum, PaymentChannelEnum, WithdrawMethodEnum } from "./enum";
|
||||
import type { authClient } from "@/auth";
|
||||
|
||||
export type DepositFiatBody = Parameters<typeof client.api.deposit.fiat.post>[0] & {
|
||||
paymentChannel: PaymentChannelEnum;
|
||||
assetCode: AssetCodeEnum;
|
||||
};
|
||||
|
||||
export type TreatyQuery<T> = T extends (...args: any[]) => any
|
||||
? NonNullable<NonNullable<Parameters<T>[0]>["query"]>
|
||||
: never;
|
||||
@@ -25,6 +20,8 @@ export type WithdrawBody = Omit<Parameters<typeof client.api.withdraw.post>[0],
|
||||
withdrawMethod: WithdrawMethodEnum;
|
||||
};
|
||||
|
||||
export type DepositFiatBody = TreatyBody<typeof client.api.deposit.fiat.post>;
|
||||
|
||||
export type UserProfileData = Treaty.Data<typeof client.api.user.profile.get>;
|
||||
|
||||
export type UpdateUserProfileBody = TreatyBody<typeof client.api.user.profile.put>;
|
||||
@@ -58,3 +55,7 @@ export type PhoneNumberVerifyClient = TreatyBody<typeof authClient.phoneNumber.v
|
||||
export type UsernameClient = TreatyBody<typeof authClient.signIn.username>;
|
||||
|
||||
export type EmailVerifyClient = TreatyBody<typeof authClient.emailOtp.verifyEmail>;
|
||||
|
||||
export type UserDepositOrderData = Treaty.Data<typeof client.api.deposit.orders.get>["data"][number];
|
||||
|
||||
export type UserDepositOrderBody = TreatyQuery<typeof client.api.deposit.orders.get>;
|
||||
|
||||
@@ -23,6 +23,14 @@
|
||||
"note": "Please make sure to enter the correct amount. After submission, the funds will be credited to your account after review in the background.",
|
||||
"submit": "Submit",
|
||||
"submitSuccess": "Submission successful!"
|
||||
},
|
||||
"status": {
|
||||
"pending": "Pending",
|
||||
"confirming": "Confirming",
|
||||
"approved": "Approved",
|
||||
"completed": "Completed",
|
||||
"rejected": "Rejected",
|
||||
"cancelled": "Cancelled"
|
||||
}
|
||||
},
|
||||
"withdraw": {
|
||||
|
||||
@@ -23,6 +23,14 @@
|
||||
"note": "请确保输入正确的金额。提交后,资金将在后台审核后计入您的账户。",
|
||||
"submit": "提交",
|
||||
"submitSuccess": "提交成功!"
|
||||
},
|
||||
"status": {
|
||||
"pending": "等待确认",
|
||||
"confirming": "链上确认中",
|
||||
"approved": "审核通过",
|
||||
"completed": "已到账",
|
||||
"rejected": "审核拒绝",
|
||||
"cancelled": "已取消"
|
||||
}
|
||||
},
|
||||
"withdraw": {
|
||||
|
||||
@@ -55,6 +55,11 @@ const routes: Array<RouteRecordRaw> = [
|
||||
component: () => import("@/views/withdraw/index.vue"),
|
||||
meta: { requiresAuth: true },
|
||||
},
|
||||
{
|
||||
path: "/wallet/bill",
|
||||
component: () => import("@/views/wallet/bill.vue"),
|
||||
meta: { requiresAuth: true },
|
||||
},
|
||||
{
|
||||
path: "/user/settings",
|
||||
component: () => import("@/views/user-settings/outlet.vue"),
|
||||
|
||||
@@ -7,7 +7,7 @@ const { type = "primary", size = "medium", round = false } = defineProps<{
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="ui-tag rounded-md" :class="[type, size, { 'rounded-full': round }]">
|
||||
<div class="ui-tag rounded-md inline-block" :class="[type, size, { 'rounded-full': round }]">
|
||||
<slot />
|
||||
</div>
|
||||
</template>
|
||||
@@ -19,13 +19,13 @@ const { type = "primary", size = "medium", round = false } = defineProps<{
|
||||
@apply px-3 py-1 text-xs;
|
||||
}
|
||||
.ui-tag.primary {
|
||||
@apply bg-(--ion-color-primary) text-white;
|
||||
@apply bg-(--ion-color-dark) text-white;
|
||||
}
|
||||
.ui-tag.secondary {
|
||||
@apply bg-(--ion-color-secondary) text-white;
|
||||
@apply bg-(--ion-color-medium-shade) text-white;
|
||||
}
|
||||
.ui-tag.tertiary {
|
||||
@apply bg-(--ion-color-tertiary) text-white;
|
||||
@apply bg-(--ion-color-medium-tint) text-white;
|
||||
}
|
||||
.ui-tag.success {
|
||||
@apply bg-(--ion-color-success) text-white;
|
||||
|
||||
@@ -6,16 +6,16 @@ const { t } = useI18n();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<IonPage>
|
||||
<IonHeader class="ion-no-border">
|
||||
<ion-page>
|
||||
<ion-header class="ion-no-border">
|
||||
<ion-toolbar class="ui-toolbar">
|
||||
<IonTitle>{{ t('tabs.trade') }}</IonTitle>
|
||||
<ion-title>{{ t('tabs.trade') }}</ion-title>
|
||||
</ion-toolbar>
|
||||
</IonHeader>
|
||||
<IonContent :fullscreen="true">
|
||||
</ion-header>
|
||||
<ion-content :fullscreen="true">
|
||||
<!-- <OperationWrapper v-model="current" /> -->
|
||||
</IonContent>
|
||||
</IonPage>
|
||||
</ion-content>
|
||||
</ion-page>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<script lang='ts' setup>
|
||||
import { eyeOffOutline, eyeOutline } from "ionicons/icons";
|
||||
import IcBaselineBlurCircular from "~icons/ic/baseline-blur-circular";
|
||||
import IcRoundArrowCircleDown from "~icons/ic/round-arrow-circle-down";
|
||||
import IcRoundArrowCircleUp from "~icons/ic/round-arrow-circle-up";
|
||||
import RechargeChannel from "./recharge-channel.vue";
|
||||
@@ -20,6 +21,9 @@ function onCloseModal() {
|
||||
function handleWithdraw() {
|
||||
router.push("/withdraw/index");
|
||||
}
|
||||
function handleBill() {
|
||||
router.push("/wallet/bill");
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
walletStore.updateBalances();
|
||||
@@ -42,7 +46,7 @@ onMounted(() => {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex gap-10 w-full">
|
||||
<div class="flex gap-5 w-full">
|
||||
<ion-button id="open-recharge-modal" expand="full" color="success" shape="round" class="w-full min-h-10 h-10">
|
||||
<IcRoundArrowCircleDown slot="start" />
|
||||
{{ t("wallet.recharge") }}
|
||||
@@ -52,6 +56,11 @@ onMounted(() => {
|
||||
<IcRoundArrowCircleUp slot="start" />
|
||||
{{ t("wallet.withdraw") }}
|
||||
</ion-button>
|
||||
|
||||
<ion-button expand="full" color="success" shape="round" class="w-full min-h-10 h-10" @click="handleBill">
|
||||
<IcBaselineBlurCircular slot="start" />
|
||||
账单
|
||||
</ion-button>
|
||||
<!-- <div id="open-recharge-modal" class="flex-col-center">
|
||||
<ion-ripple-effect />
|
||||
<ion-button shape="round" color="success" size="large">
|
||||
|
||||
27
src/views/wallet/bill.vue
Normal file
27
src/views/wallet/bill.vue
Normal file
@@ -0,0 +1,27 @@
|
||||
<script lang='ts' setup>
|
||||
import FaitDeposit from "./components/fait-deposit.vue";
|
||||
|
||||
const activeTab = ref("deposit");
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<ion-page>
|
||||
<ion-header class="ion-no-border">
|
||||
<ion-toolbar class="ui-toolbar">
|
||||
<ion-back-button slot="start" text="" />
|
||||
<ion-title>账单</ion-title>
|
||||
</ion-toolbar>
|
||||
<ion-toolbar class="ui-toolbar">
|
||||
<ui-tabs v-model="activeTab" size="small" class="px-2">
|
||||
<ui-tab-pane name="deposit" title="充值记录" />
|
||||
<ui-tab-pane name="withdraw" title="提现记录" />
|
||||
</ui-tabs>
|
||||
</ion-toolbar>
|
||||
</ion-header>
|
||||
<ion-content :fullscreen="true" class="ion-padding-horizontal">
|
||||
<FaitDeposit v-if="activeTab === 'deposit'" />
|
||||
</ion-content>
|
||||
</ion-page>
|
||||
</template>
|
||||
|
||||
<style lang='css' scoped></style>
|
||||
115
src/views/wallet/components/fait-deposit.vue
Normal file
115
src/views/wallet/components/fait-deposit.vue
Normal file
@@ -0,0 +1,115 @@
|
||||
<script lang='ts' setup>
|
||||
import type { InfiniteScrollCustomEvent, RefresherCustomEvent } from "@ionic/vue";
|
||||
import type { UserDepositOrderBody, UserDepositOrderData } from "@/api/types";
|
||||
import CryptocurrencyColorAppc from "~icons/cryptocurrency-color/appc";
|
||||
import CryptocurrencyColorNuls from "~icons/cryptocurrency-color/nuls";
|
||||
import { client, safeClient } from "@/api";
|
||||
import { DepositTypeEnum } from "@/api/enum";
|
||||
|
||||
const [query] = useResetRef<UserDepositOrderBody>({
|
||||
limit: 20,
|
||||
offset: 0,
|
||||
});
|
||||
|
||||
const billData = ref<UserDepositOrderData[]>([]);
|
||||
const isFinished = ref(false);
|
||||
|
||||
async function fetchRwaData() {
|
||||
const { data } = await safeClient(() => client.api.deposit.orders.get({
|
||||
query: query.value,
|
||||
}));
|
||||
billData.value.push(...(data.value?.data || []));
|
||||
isFinished.value = (data.value?.data.length || 0) < query.value.limit!;
|
||||
}
|
||||
function resetRwaData() {
|
||||
query.value.offset = 0;
|
||||
billData.value = [];
|
||||
isFinished.value = false;
|
||||
}
|
||||
async function handleRefresh(event: RefresherCustomEvent) {
|
||||
resetRwaData();
|
||||
await fetchRwaData();
|
||||
setTimeout(() => {
|
||||
event.target.complete();
|
||||
}, 500);
|
||||
}
|
||||
|
||||
async function handleInfinite(event: InfiniteScrollCustomEvent) {
|
||||
if (isFinished.value) {
|
||||
event.target.complete();
|
||||
event.target.disabled = true;
|
||||
return;
|
||||
}
|
||||
query.value.offset! += query.value.limit!;
|
||||
await fetchRwaData();
|
||||
setTimeout(() => {
|
||||
event.target.complete();
|
||||
}, 500);
|
||||
}
|
||||
|
||||
onBeforeMount(() => {
|
||||
fetchRwaData();
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<ion-refresher slot="fixed" @ion-refresh="handleRefresh($event)">
|
||||
<ion-refresher-content />
|
||||
</ion-refresher>
|
||||
|
||||
<div class="space-y-3 antialiased my-3">
|
||||
<div v-for="item in billData" :key="item.id">
|
||||
<ion-grid>
|
||||
<ion-row class="ion-align-items-center py-3">
|
||||
<ion-col size="12" class="flex items-center mb-4">
|
||||
<div class="mr-3">
|
||||
<CryptocurrencyColorNuls class="text-md" />
|
||||
</div>
|
||||
<div class="text-xs font-semibold">
|
||||
{{ item.assetCode }}
|
||||
<ui-tag type="primary" size="small">
|
||||
{{ $t(`recharge.status.${item.status}`) }}
|
||||
</ui-tag>
|
||||
</div>
|
||||
</ion-col>
|
||||
<ion-col size="3" class="flex flex-col">
|
||||
<div class="text-xs text-primary">
|
||||
金额
|
||||
</div>
|
||||
<div class="text-sm font-bold">
|
||||
{{ Number(item.amount).toFixed(2) }}
|
||||
</div>
|
||||
</ion-col>
|
||||
<ion-col size="3" class="flex flex-col">
|
||||
<div class="text-xs text-primary">
|
||||
充值方式
|
||||
</div>
|
||||
<div class="text-xs font-bold">
|
||||
{{ item.depositType }}
|
||||
</div>
|
||||
</ion-col>
|
||||
<ion-col size="6" class="flex flex-col">
|
||||
<div class="text-xs text-primary text-right">
|
||||
创建时间
|
||||
</div>
|
||||
<div class="text-xs font-bold text-right">
|
||||
{{ useDateFormat(item.createdAt, 'MM/DD HH:mm') }}
|
||||
</div>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
</ion-grid>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<ion-infinite-scroll threshold="100px" @ion-infinite="handleInfinite">
|
||||
<ion-infinite-scroll-content
|
||||
loading-spinner="bubbles"
|
||||
/>
|
||||
</ion-infinite-scroll>
|
||||
</template>
|
||||
|
||||
<style lang='css' scoped>
|
||||
ion-row {
|
||||
border-bottom: 1px solid var(--ion-background-color-step-150);
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user