修复钱包相关功能

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 src/config/env.ts
.vscode .vscode
*.http *.http
env.ts

View File

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

View File

@@ -303,7 +303,18 @@
flex-direction: column; flex-direction: column;
align-items: flex-end; align-items: flex-end;
gap: 4px; 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 { .transaction_amount {
font-size: 12px; font-size: 12px;
@@ -311,6 +322,7 @@
color: #000; color: #000;
line-height: 1.5; line-height: 1.5;
text-align: right; text-align: right;
margin-left: 3px;
} }
.balance_info { .balance_info {

View File

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