修复钱包相关功能

This commit is contained in:
张成
2025-10-18 17:24:39 +08:00
parent 0737b12b0e
commit de52dc4762
4 changed files with 35 additions and 11 deletions

1
.gitignore vendored
View File

@@ -8,3 +8,4 @@ node_modules/
src/config/env.ts
.vscode
*.http
env.ts

View File

@@ -62,7 +62,7 @@ const SetTransactionPassword: React.FC = () => {
const { new_password, confirm_password, sms_code } = formData;
if (handleType === "set") {
setValid(
!sms_code && new_password.length === 6 && confirm_password.length === 6
!!sms_code && new_password.length === 6 && confirm_password.length === 6
);
} else {
setValid(new_password.length === 6 && confirm_password.length === 6);

View File

@@ -303,7 +303,18 @@
flex-direction: column;
align-items: flex-end;
gap: 4px;
width: 68px;
width: 100px;
.type_text_tag{
font-size: 8px;
font-weight: normal;
color: #FF9500;
border-radius: 999px !important;
padding: 4px;
background-color: rgba(#FF9500, 0.1);
border: solid 1px #FF9500;
}
.transaction_amount {
font-size: 12px;
@@ -311,6 +322,7 @@
color: #000;
line-height: 1.5;
text-align: right;
margin-left: 3px;
}
.balance_info {

View File

@@ -20,13 +20,16 @@ interface Transaction {
create_time: string;
last_modify_time: string;
related_id: number;
type_text: string | null;
total_balance_after:string;
}
// 钱包信息类型
interface WalletInfo {
balance: number;
frozen_balance?: number;
total_balance?: number;
total_balance: number;
total_income?: number;
total_withdraw?: number;
}
@@ -292,7 +295,7 @@ const WalletPage: React.FC = () => {
}
if (wallet_info.balance <= 0) {
Taro.showToast({
title: "额不足",
title: "可提现金额不足",
icon: "error",
duration: 2000,
});
@@ -473,14 +476,14 @@ const WalletPage: React.FC = () => {
<Text className="currency_symbol">¥</Text>
<View className="amount_group">
<Text className="main_amount">
{Math.floor(wallet_info.balance)}
{(wallet_info.total_balance)?.toFixed(2)}
</Text>
<Text className="decimal_amount">
{/* <Text className="decimal_amount">
.
{((wallet_info.balance % 1) * 100)
.toFixed(0)
.padStart(2, "0")}
</Text>
</Text> */}
</View>
</View>
<Button className="withdraw_btn" onClick={handle_withdraw}>
@@ -580,11 +583,19 @@ const WalletPage: React.FC = () => {
</View>
</View>
<View className="transaction_right">
<View>
<Text className="type_text_tag">
{transaction.type_text}
</Text>
<Text className="transaction_amount">
{get_amount_display(transaction)}
</Text>
</View>
<Text className="balance_info">
¥{format_amount(wallet_info.balance)}
¥{format_amount(transaction.total_balance_after)}
</Text>
</View>
</View>