feat: 更新 '@capp/eden' 依赖至 0.0.15,优化兑换和转账功能的 API 调用
This commit is contained in:
@@ -1,9 +1,8 @@
|
||||
<script lang='ts' setup>
|
||||
import type { Treaty } from "@elysiajs/eden";
|
||||
import type { client } from "@/api";
|
||||
import { alertController, toastController } from "@ionic/vue";
|
||||
import { checkmarkCircleOutline, documentTextOutline, keyOutline, swapHorizontalOutline, walletOutline } from "ionicons/icons";
|
||||
import { safeClient } from "@/api";
|
||||
import { client, safeClient } from "@/api";
|
||||
|
||||
type Wallet = Treaty.Data<typeof client.api.wallet.wallets.get>[number];
|
||||
|
||||
@@ -160,13 +159,12 @@ async function handleSubmit() {
|
||||
{
|
||||
text: "确认兑换",
|
||||
handler: async () => {
|
||||
// TODO: 调用兑换 API
|
||||
// const { error } = await safeClient(client.api.exchange.post({
|
||||
// fromWalletId: fromWallet.value.id,
|
||||
// toWalletId: toWallet.value.id,
|
||||
// amount,
|
||||
// transactionPassword: transactionPassword.value,
|
||||
// }));
|
||||
await safeClient(client.api.wallet_transfer.post({
|
||||
amount: amount.toString(),
|
||||
sourceWalletTypeCode: fromWallet.value?.walletType.code,
|
||||
targetWalletTypeCode: "balance",
|
||||
transactionPassword: transactionPassword.value,
|
||||
}));
|
||||
|
||||
await showToast("兑换成功");
|
||||
exchangeAmount.value = "";
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<script lang='ts' setup>
|
||||
import { alertController, toastController } from "@ionic/vue";
|
||||
import { cardOutline, checkmarkCircleOutline, documentTextOutline, logoAlipay, logoWechat, walletOutline } from "ionicons/icons";
|
||||
import { safeClient } from "@/api";
|
||||
|
||||
const walletStore = useWalletStore();
|
||||
const balanceWallet = await walletStore.getWalletByType("balance");
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
<script lang='ts' setup>
|
||||
import type { Treaty } from "@elysiajs/eden";
|
||||
import type { client } from "@/api";
|
||||
import { alertController, toastController } from "@ionic/vue";
|
||||
import { callOutline, checkmarkCircleOutline, documentTextOutline, keyOutline, personOutline, walletOutline } from "ionicons/icons";
|
||||
import { safeClient } from "@/api";
|
||||
import { client, safeClient } from "@/api";
|
||||
|
||||
type Wallet = Treaty.Data<typeof client.api.wallet.wallets.get>[number];
|
||||
|
||||
@@ -133,13 +132,12 @@ async function handleSubmit() {
|
||||
{
|
||||
text: "确认转账",
|
||||
handler: async () => {
|
||||
// TODO: 调用转账 API
|
||||
// const { error } = await safeClient(client.api.transfer.post({
|
||||
// walletId: selectedWallet.value.id,
|
||||
// amount,
|
||||
// recipientPhone: recipientPhone.value,
|
||||
// transactionPassword: transactionPassword.value,
|
||||
// }));
|
||||
await safeClient(client.api.transfer.post({
|
||||
walletTypeCode: selectedWallet.value?.walletType.code,
|
||||
amount: amount.toString(),
|
||||
targetUsername: recipientPhone.value,
|
||||
transactionPassword: transactionPassword.value,
|
||||
}));
|
||||
|
||||
await showToast("转账成功");
|
||||
transferAmount.value = "";
|
||||
|
||||
@@ -121,7 +121,6 @@ async function handleSubmit() {
|
||||
{
|
||||
text: "确认提现",
|
||||
handler: async () => {
|
||||
// TODO: 调用提现 API
|
||||
// const { error } = await safeClient(client.api.withdraw.post({
|
||||
// walletId: selectedWallet.value.id,
|
||||
// amount,
|
||||
|
||||
Reference in New Issue
Block a user