feat: 优化通知详情和列表组件的图标背景色,支持深色模式适配
This commit is contained in:
@@ -12,7 +12,8 @@ import { getCryptoIcon } from "@/config/crypto";
|
||||
const { t } = useI18n();
|
||||
const router = useRouter();
|
||||
const walletStore = useWalletStore();
|
||||
const { fundingBalances, tradingBalances } = storeToRefs(walletStore);
|
||||
const { USDTBalance } = storeToRefs(walletStore);
|
||||
await walletStore.syncUSDTBalance();
|
||||
const formRef = useTemplateRef<FormInstance>("formRef");
|
||||
|
||||
type AccountType = "funding" | "trading";
|
||||
@@ -31,17 +32,6 @@ const initialValues: TransferForm = {
|
||||
toAccount: "trading",
|
||||
};
|
||||
|
||||
// 可用余额
|
||||
const availableBalance = computed(() => {
|
||||
const form = formRef.value?.values as TransferForm | undefined;
|
||||
if (!form)
|
||||
return "0";
|
||||
|
||||
const balances = form.fromAccount === "funding" ? fundingBalances.value : tradingBalances.value;
|
||||
const balance = balances?.find(item => item.assetCode === form.assetCode);
|
||||
return balance ? balance.available : "0";
|
||||
});
|
||||
|
||||
// 验证规则
|
||||
const schema = computed(() => z.object({
|
||||
assetCode: z.string({ message: t("transfer.assetCodeRequired") }).min(1, t("transfer.assetCodeRequired")),
|
||||
@@ -49,7 +39,7 @@ const schema = computed(() => z.object({
|
||||
.string({ message: t("transfer.amountRequired") })
|
||||
.min(1, t("transfer.amountRequired"))
|
||||
.refine(value => Number(value) > 0, t("transfer.amountMinError"))
|
||||
.refine(value => Number(value) <= Number(availableBalance.value), t("transfer.amountMaxError", { amount: availableBalance.value })),
|
||||
.refine(value => Number(value) <= Number(USDTBalance.value?.available), t("transfer.amountMaxError", { amount: USDTBalance.value?.available })),
|
||||
fromAccount: z.string({ message: t("transfer.fromAccountRequired") }).min(1, t("transfer.fromAccountRequired")),
|
||||
toAccount: z.string({ message: t("transfer.toAccountRequired") }).min(1, t("transfer.toAccountRequired")),
|
||||
}));
|
||||
@@ -73,7 +63,7 @@ function setMaxAmount() {
|
||||
if (!form)
|
||||
return;
|
||||
|
||||
form.setFieldValue("amount", availableBalance.value);
|
||||
form.setFieldValue("amount", USDTBalance.value?.available || "0");
|
||||
}
|
||||
|
||||
// 提交划转
|
||||
@@ -229,7 +219,7 @@ function getAccountTypeName(type: AccountType) {
|
||||
<!-- 可用余额 -->
|
||||
<div class="flex items-center gap-2">
|
||||
<span class="text-sm text-(--ion-color-medium)">{{ t("transfer.available") }}</span>
|
||||
<span class="text-sm font-medium">{{ Number(availableBalance).toFixed(2) }}</span>
|
||||
<span class="text-sm font-medium">{{ Number(USDTBalance?.available).toFixed(2) }}</span>
|
||||
</div>
|
||||
|
||||
<!-- 提交按钮 -->
|
||||
|
||||
Reference in New Issue
Block a user