优化提现成功后没有及时刷新交易记录
This commit is contained in:
@@ -28,7 +28,7 @@ interface Transaction {
|
||||
interface WalletInfo {
|
||||
balance: number;
|
||||
frozen_balance?: number;
|
||||
total_balance: number;
|
||||
total_balance?: number;
|
||||
total_income?: number;
|
||||
total_withdraw?: number;
|
||||
}
|
||||
@@ -157,12 +157,32 @@ const WalletPage: React.FC = () => {
|
||||
useEffect(() => {
|
||||
load_transactions();
|
||||
}, [load_transactions_params]);
|
||||
|
||||
// 页面显示时加载数据
|
||||
useDidShow(() => {
|
||||
load_wallet_data();
|
||||
check_password_status();
|
||||
const currentPage = Taro.getCurrentInstance().page
|
||||
const updateList = currentPage.data.updateList
|
||||
|
||||
if (updateList) {
|
||||
set_transactions([])
|
||||
// 直接使用新参数调用加载方法
|
||||
const newParams = {
|
||||
...load_transactions_params,
|
||||
page: 1
|
||||
}
|
||||
set_load_transactions_params(newParams)
|
||||
load_transactions() // 立即调用
|
||||
|
||||
// 清除标记
|
||||
currentPage.setData({ updateList: null })
|
||||
}
|
||||
|
||||
load_wallet_data()
|
||||
check_password_status()
|
||||
});
|
||||
|
||||
|
||||
|
||||
const modify_load_transactions_params = () => {
|
||||
set_transactions([]);
|
||||
const { type, transaction_sub_type } = filterParams;
|
||||
|
||||
@@ -161,6 +161,10 @@
|
||||
font-size: 20px;
|
||||
line-height: 16px;
|
||||
margin: 20px 0;
|
||||
font-style: italic;
|
||||
.integer {
|
||||
font-size: 36px;
|
||||
}
|
||||
}
|
||||
|
||||
.password_container {
|
||||
|
||||
@@ -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">
|
||||
|
||||
Reference in New Issue
Block a user