feat: 添加法币充值和提现功能的国际化支持,更新相关组件文本

This commit is contained in:
2025-12-15 00:50:44 +07:00
parent f30fda5002
commit 3111b922fa
5 changed files with 102 additions and 27 deletions

View File

@@ -6,6 +6,41 @@
"transfer": "Transfer", "transfer": "Transfer",
"balance": "Balance" "balance": "Balance"
}, },
"recharge": {
"channel": {
"chainRecharge": "Chain recharge",
"chainRechargeDesc": "Transfer crypto from on-chain wallet or exchange.",
"fiatCurrency": "Fiat currency",
"fiatCurrencyDesc": "Transfer fiat currency through bank or other financial institutions."
},
"fiat": {
"title": "Fiat Recharge",
"bankAccount": "Recharge bank card account",
"chooseCurrency": "Choose Currency",
"amount": "Amount",
"enterAmount": "Enter the amount",
"validAmountError": "Please enter a valid amount.",
"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!"
}
},
"withdraw": {
"title": "Withdraw",
"chooseCurrency": "Choose Currency",
"chooseMethod": "Choose Withdraw Method",
"amount": "Amount",
"enterAmountMax": "Enter the amount (Max: {{amount}})",
"validAmountError": "Please enter a valid amount.",
"bankAccountId": "Bank Account ID",
"enterBankAccountId": "Enter the bank account ID",
"validBankAccountError": "Please enter a valid bank account ID.",
"chooseChain": "Choose Chain",
"cryptoAddress": "Crypto Address",
"enterCryptoAddress": "Enter the crypto address",
"validCryptoAddressError": "Please enter a valid crypto address.",
"submit": "Submit"
},
"asset": { "asset": {
"issue": { "issue": {
"issuingAsset": "Issuing Asset", "issuingAsset": "Issuing Asset",

View File

@@ -6,6 +6,41 @@
"transfer": "转账", "transfer": "转账",
"balance": "余额" "balance": "余额"
}, },
"recharge": {
"channel": {
"chainRecharge": "链上充值",
"chainRechargeDesc": "从链上钱包或交易所转入加密货币",
"fiatCurrency": "法币充值",
"fiatCurrencyDesc": "通过银行或其他金融机构转入法币"
},
"fiat": {
"title": "法币充值",
"bankAccount": "充值银行卡账户",
"chooseCurrency": "选择货币",
"amount": "金额",
"enterAmount": "请输入金额",
"validAmountError": "请输入有效的金额。",
"note": "请确保输入正确的金额。提交后,资金将在后台审核后计入您的账户。",
"submit": "提交",
"submitSuccess": "提交成功!"
}
},
"withdraw": {
"title": "提现",
"chooseCurrency": "选择货币",
"chooseMethod": "选择提现方式",
"amount": "金额",
"enterAmountMax": "请输入金额(最大:{amount}",
"validAmountError": "请输入有效的金额。",
"bankAccountId": "银行账户ID",
"enterBankAccountId": "请输入银行账户ID",
"validBankAccountError": "请输入有效的银行账户ID。",
"chooseChain": "选择链",
"cryptoAddress": "加密货币地址",
"enterCryptoAddress": "请输入加密货币地址",
"validCryptoAddressError": "请输入有效的加密货币地址。",
"submit": "提交"
},
"asset": { "asset": {
"issue": { "issue": {
"issuingAsset": "发行资产", "issuingAsset": "发行资产",

View File

@@ -4,6 +4,8 @@ import { toastController } from "@ionic/vue";
import { client } from "@/api"; import { client } from "@/api";
import { AssetCodeEnum, PaymentChannelEnum } from "@/api/enum"; import { AssetCodeEnum, PaymentChannelEnum } from "@/api/enum";
const { t } = useI18n();
const form = ref<DepositFiatBody>({ const form = ref<DepositFiatBody>({
amount: "", amount: "",
assetCode: AssetCodeEnum.USDT, assetCode: AssetCodeEnum.USDT,
@@ -32,7 +34,7 @@ async function onSubmit() {
const { data, status } = await client.api.deposit.fiat.post(form.value); const { data, status } = await client.api.deposit.fiat.post(form.value);
if (status === 200) { if (status === 200) {
const toast = await toastController.create({ const toast = await toastController.create({
message: "Submission successful!", message: t("recharge.fiat.submitSuccess"),
duration: 1500, duration: 1500,
position: "bottom", position: "bottom",
}); });
@@ -49,13 +51,13 @@ async function onSubmit() {
<ion-buttons slot="start"> <ion-buttons slot="start">
<ion-back-button /> <ion-back-button />
</ion-buttons> </ion-buttons>
<ion-title>Fiat Recharge</ion-title> <ion-title>{{ t("recharge.fiat.title") }}</ion-title>
</ion-toolbar> </ion-toolbar>
</IonHeader> </IonHeader>
<IonContent :fullscreen="true" class="ion-padding"> <IonContent :fullscreen="true" class="ion-padding">
<div class="flex flex-col gap-5"> <div class="flex flex-col gap-5">
<ui-input-label <ui-input-label
label="Recharge bank card account" :label="t('recharge.fiat.bankAccount')"
model-value="74321329321312" model-value="74321329321312"
type="number" type="number"
readonly readonly
@@ -64,7 +66,7 @@ async function onSubmit() {
<ion-radio-group v-model="form.assetCode"> <ion-radio-group v-model="form.assetCode">
<ion-label class="text-sm"> <ion-label class="text-sm">
Choose Currency {{ t("recharge.fiat.chooseCurrency") }}
</ion-label> </ion-label>
<ion-item v-for="item in AssetCodeEnum" :key="item"> <ion-item v-for="item in AssetCodeEnum" :key="item">
<ion-radio :value="item" justify="space-between"> <ion-radio :value="item" justify="space-between">
@@ -82,19 +84,19 @@ async function onSubmit() {
<ui-input-label <ui-input-label
ref="inputInstance" ref="inputInstance"
v-model="form.amount" v-model="form.amount"
label="Amount" :label="t('recharge.fiat.amount')"
placeholder="Enter the amount" :placeholder="t('recharge.fiat.enterAmount')"
type="number" type="number"
inputmode="numeric" inputmode="numeric"
error-text="Please enter a valid amount." :error-text="t('recharge.fiat.validAmountError')"
@ion-input="validate($event.target.value as string)" @ion-input="validate($event.target.value as string)"
@ion-blur="markTouched" @ion-blur="markTouched"
/> />
<ion-note>Please make sure to enter the correct amount. After submission, the funds will be credited to your account after review in the background.</ion-note> <ion-note>{{ t("recharge.fiat.note") }}</ion-note>
<ion-button expand="block" @click="onSubmit"> <ion-button expand="block" @click="onSubmit">
Submit {{ t("recharge.fiat.submit") }}
</ion-button> </ion-button>
</div> </div>
</IonContent> </IonContent>

View File

@@ -3,6 +3,7 @@ const emit = defineEmits<{
(e: "close"): void; (e: "close"): void;
}>(); }>();
const { t } = useI18n();
const router = useRouter(); const router = useRouter();
async function handleFiatRecharge() { async function handleFiatRecharge() {
@@ -16,9 +17,9 @@ async function handleFiatRecharge() {
<div class="flex items-center gap-2.5"> <div class="flex items-center gap-2.5">
<i-ic-baseline-downloading class="text-2xl" /> <i-ic-baseline-downloading class="text-2xl" />
<ion-label class="flex-1"> <ion-label class="flex-1">
<h2>Chain recharge</h2> <h2>{{ t("recharge.channel.chainRecharge") }}</h2>
<p class="w-[80%] text-sm"> <p class="w-[80%] text-sm">
Transfer crypto from on-chain wallet or exchange. {{ t("recharge.channel.chainRechargeDesc") }}
</p> </p>
</ion-label> </ion-label>
<i-ic-round-arrow-forward-ios class="ml-auto text-text-400" /> <i-ic-round-arrow-forward-ios class="ml-auto text-text-400" />
@@ -27,9 +28,9 @@ async function handleFiatRecharge() {
<div class="flex items-center gap-2.5" @click="handleFiatRecharge"> <div class="flex items-center gap-2.5" @click="handleFiatRecharge">
<i-ic-baseline-data-saver-off class="text-2xl" /> <i-ic-baseline-data-saver-off class="text-2xl" />
<ion-label class="flex-1"> <ion-label class="flex-1">
<h2>Fiat currency</h2> <h2>{{ t("recharge.channel.fiatCurrency") }}</h2>
<p class="w-[80%] text-sm"> <p class="w-[80%] text-sm">
Transfer fiat currency through bank or other financial institutions. {{ t("recharge.channel.fiatCurrencyDesc") }}
</p> </p>
</ion-label> </ion-label>
<i-ic-round-arrow-forward-ios class="ml-auto text-text-400" /> <i-ic-round-arrow-forward-ios class="ml-auto text-text-400" />

View File

@@ -4,6 +4,8 @@ import { toastController } from "@ionic/vue";
import { client, safeClient } from "@/api"; import { client, safeClient } from "@/api";
import { AssetCodeEnum, ChainEnum, WithdrawMethodEnum } from "@/api/enum"; import { AssetCodeEnum, ChainEnum, WithdrawMethodEnum } from "@/api/enum";
const { t } = useI18n();
const amountInputInst = useTemplateRef<InputInstance>("amountInputInst"); const amountInputInst = useTemplateRef<InputInstance>("amountInputInst");
const [form, resetForm] = useResetRef<WithdrawBody>({ const [form, resetForm] = useResetRef<WithdrawBody>({
assetCode: AssetCodeEnum.USDT, assetCode: AssetCodeEnum.USDT,
@@ -51,14 +53,14 @@ async function onSubmit() {
<ion-buttons slot="start"> <ion-buttons slot="start">
<ion-back-button /> <ion-back-button />
</ion-buttons> </ion-buttons>
<ion-title>Withdraw</ion-title> <ion-title>{{ t("withdraw.title") }}</ion-title>
</ion-toolbar> </ion-toolbar>
</IonHeader> </IonHeader>
<IonContent :fullscreen="true" class="ion-padding"> <IonContent :fullscreen="true" class="ion-padding">
<div class="flex flex-col gap-5"> <div class="flex flex-col gap-5">
<ion-radio-group v-model="form.assetCode" @ion-change="handleCurrentChange"> <ion-radio-group v-model="form.assetCode" @ion-change="handleCurrentChange">
<ion-label class="text-sm"> <ion-label class="text-sm">
Choose Currency {{ t("withdraw.chooseCurrency") }}
</ion-label> </ion-label>
<ion-item v-for="item in AssetCodeEnum" :key="item"> <ion-item v-for="item in AssetCodeEnum" :key="item">
<ion-radio :value="item" justify="space-between"> <ion-radio :value="item" justify="space-between">
@@ -69,7 +71,7 @@ async function onSubmit() {
<ion-radio-group v-model="form.withdrawMethod"> <ion-radio-group v-model="form.withdrawMethod">
<ion-label class="text-sm"> <ion-label class="text-sm">
Choose Withdraw Method {{ t("withdraw.chooseMethod") }}
</ion-label> </ion-label>
<ion-item v-for="item in WithdrawMethodEnum" :key="item"> <ion-item v-for="item in WithdrawMethodEnum" :key="item">
<ion-radio :value="item" justify="space-between"> <ion-radio :value="item" justify="space-between">
@@ -81,11 +83,11 @@ async function onSubmit() {
<ui-input-label <ui-input-label
ref="amountInputInst" ref="amountInputInst"
v-model="form.amount" v-model="form.amount"
label="Amount" :label="t('withdraw.amount')"
:placeholder="`Enter the amount (Max: ${maxAmount})`" :placeholder="t('withdraw.enterAmountMax', { amount: maxAmount })"
type="number" type="number"
inputmode="numeric" inputmode="numeric"
error-text="Please enter a valid amount." :error-text="t('withdraw.validAmountError')"
:max="maxAmount" :max="maxAmount"
@ion-input="validate($event.target.value as string)" @ion-input="validate($event.target.value as string)"
@ion-blur="markTouched" @ion-blur="markTouched"
@@ -94,16 +96,16 @@ async function onSubmit() {
<ui-input-label <ui-input-label
v-if="form.withdrawMethod === WithdrawMethodEnum.BANK" v-if="form.withdrawMethod === WithdrawMethodEnum.BANK"
v-model="form.bankAccountId" v-model="form.bankAccountId"
label="Bank Account ID" :label="t('withdraw.bankAccountId')"
placeholder="Enter the bank account ID" :placeholder="t('withdraw.enterBankAccountId')"
type="text" type="text"
inputmode="text" inputmode="text"
error-text="Please enter a valid bank account ID." :error-text="t('withdraw.validBankAccountError')"
/> />
<template v-else-if="form.withdrawMethod === WithdrawMethodEnum.CRYPTO"> <template v-else-if="form.withdrawMethod === WithdrawMethodEnum.CRYPTO">
<ion-radio-group v-model="form.chain"> <ion-radio-group v-model="form.chain">
<ion-label class="text-sm"> <ion-label class="text-sm">
Choose Chain {{ t("withdraw.chooseChain") }}
</ion-label> </ion-label>
<ion-item v-for="item in ChainEnum" :key="item"> <ion-item v-for="item in ChainEnum" :key="item">
<ion-radio :value="item" justify="space-between"> <ion-radio :value="item" justify="space-between">
@@ -113,16 +115,16 @@ async function onSubmit() {
</ion-radio-group> </ion-radio-group>
<ui-input-label <ui-input-label
v-model="form.toAddress" v-model="form.toAddress"
label="Crypto Address" :label="t('withdraw.cryptoAddress')"
placeholder="Enter the crypto address" :placeholder="t('withdraw.enterCryptoAddress')"
type="text" type="text"
inputmode="text" inputmode="text"
error-text="Please enter a valid crypto address." :error-text="t('withdraw.validCryptoAddressError')"
/> />
</template> </template>
<ion-button expand="block" @click="onSubmit"> <ion-button expand="block" @click="onSubmit">
Submit {{ t("withdraw.submit") }}
</ion-button> </ion-button>
</div> </div>
</IonContent> </IonContent>