feat: 添加 SubscribeRwa 组件,优化 RWA 申购功能并更新相关类型定义

This commit is contained in:
2025-12-19 22:02:52 +07:00
parent b91f371115
commit c3321bfbf1
6 changed files with 96 additions and 12 deletions

View File

@@ -0,0 +1,45 @@
<script lang='ts' setup>
const props = defineProps<{
unitPrice: number;
}>();
const walletStore = useWalletStore();
const { balances } = storeToRefs(walletStore);
const currentUSDTBalance = computed(() => balances.value[0].available);
const maxSubscribeNumber = computed(() => {
return Math.floor(Number(currentUSDTBalance.value) / props.unitPrice);
});
</script>
<template>
<ion-content class="ion-padding" :scroll-y="false">
<div class="space-y-5 mt-3">
<div>申购RWA</div>
<ion-input :placeholder="`最大可申购数量: ${maxSubscribeNumber}`" type="number" :max="maxSubscribeNumber" />
<div class="mt-4 text-sm color-(--ion-text-color-secondary)">
单价: ${{ unitPrice }}
</div>
<div class="mt-4 text-sm color-(--ion-text-color-secondary)">
可用余额: ${{ Number(currentUSDTBalance) }}
</div>
<ion-button expand="block" class="mt-6 ui-button" color="primary">
确认申购
</ion-button>
</div>
</ion-content>
</template>
<style scoped>
@reference "tailwindcss";
ion-input {
@apply rounded-lg;
--padding-start: 16px;
--padding-end: 16px;
border: 1px solid var(--ion-color-light-shade);
}
</style>