优化提现成功后没有及时刷新交易记录

This commit is contained in:
2025-10-27 21:26:02 +08:00
parent f5df67cbd5
commit f74851dbe0
3 changed files with 54 additions and 5 deletions

View File

@@ -57,6 +57,13 @@ const Withdrawal: React.FC = () => {
const [mapErrorCodes, setMapErrorCodes] = useState({});
const [withdrawSuccess, setWithdrawSuccess] = useState(false);
const [inputValueObj, setInputValueObj] = useState({
integer: "0",
decimal: "00"
})
useDidShow(() => {
load_wallet_data();
getWithdrawErrorCodes();
@@ -75,6 +82,13 @@ const Withdrawal: React.FC = () => {
}
}, [show_withdraw_popup]);
useEffect(() => {
const value = Number(inputValue).toFixed(2).split(".")
const integer = value[0]
const decimal = value[1]
setInputValueObj({ integer, decimal })
}, [inputValue])
const validateWithdrawAmount = (amount: string) => {
if (Number(amount) > Number(walletInfo.balance)) {
setShowTips(true);
@@ -197,6 +211,7 @@ const Withdrawal: React.FC = () => {
setInputValue("0.00");
// 重新加载数据
load_wallet_data();
setWithdrawSuccess(true);
},
fail: (res) => {
console.log("微信转账失败:", res);
@@ -211,7 +226,7 @@ const Withdrawal: React.FC = () => {
cancelText: "忘记密码",
confirmText: "重试",
cancelColor: "#000",
confirmColor: "#fff",
confirmColor: "#000",
}).then((res) => {
if (res.confirm) {
set_show_withdraw_popup(true);
@@ -266,6 +281,11 @@ const Withdrawal: React.FC = () => {
<View
className="detail-navigator-back"
onClick={() => {
const pages = Taro.getCurrentPages()
const prevPage = pages[pages.length - 2]
prevPage.setData({
updateList: withdrawSuccess
})
Taro.navigateBack();
}}
>
@@ -363,7 +383,12 @@ const Withdrawal: React.FC = () => {
onTouchMove={handlePopupClick}
onTouchEnd={handlePopupClick}
>
<View className="popup_text">{`¥${inputValue}`}</View>
<View className="popup_text">
<Text>¥</Text>
<Text className="integer">{inputValueObj.integer}</Text>
<Text>.</Text>
<Text>{inputValueObj.decimal}</Text>
</View>
<View className="password_container">
{password.map((item, index) => (
<View key={index} className="password_item">