优化提现成功后没有及时刷新交易记录
This commit is contained in:
@@ -28,7 +28,7 @@ interface Transaction {
|
|||||||
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;
|
||||||
}
|
}
|
||||||
@@ -157,12 +157,32 @@ const WalletPage: React.FC = () => {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
load_transactions();
|
load_transactions();
|
||||||
}, [load_transactions_params]);
|
}, [load_transactions_params]);
|
||||||
|
|
||||||
// 页面显示时加载数据
|
// 页面显示时加载数据
|
||||||
useDidShow(() => {
|
useDidShow(() => {
|
||||||
load_wallet_data();
|
const currentPage = Taro.getCurrentInstance().page
|
||||||
check_password_status();
|
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 = () => {
|
const modify_load_transactions_params = () => {
|
||||||
set_transactions([]);
|
set_transactions([]);
|
||||||
const { type, transaction_sub_type } = filterParams;
|
const { type, transaction_sub_type } = filterParams;
|
||||||
|
|||||||
@@ -161,6 +161,10 @@
|
|||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
line-height: 16px;
|
line-height: 16px;
|
||||||
margin: 20px 0;
|
margin: 20px 0;
|
||||||
|
font-style: italic;
|
||||||
|
.integer {
|
||||||
|
font-size: 36px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.password_container {
|
.password_container {
|
||||||
|
|||||||
@@ -57,6 +57,13 @@ const Withdrawal: React.FC = () => {
|
|||||||
|
|
||||||
const [mapErrorCodes, setMapErrorCodes] = useState({});
|
const [mapErrorCodes, setMapErrorCodes] = useState({});
|
||||||
|
|
||||||
|
const [withdrawSuccess, setWithdrawSuccess] = useState(false);
|
||||||
|
|
||||||
|
const [inputValueObj, setInputValueObj] = useState({
|
||||||
|
integer: "0",
|
||||||
|
decimal: "00"
|
||||||
|
})
|
||||||
|
|
||||||
useDidShow(() => {
|
useDidShow(() => {
|
||||||
load_wallet_data();
|
load_wallet_data();
|
||||||
getWithdrawErrorCodes();
|
getWithdrawErrorCodes();
|
||||||
@@ -75,6 +82,13 @@ const Withdrawal: React.FC = () => {
|
|||||||
}
|
}
|
||||||
}, [show_withdraw_popup]);
|
}, [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) => {
|
const validateWithdrawAmount = (amount: string) => {
|
||||||
if (Number(amount) > Number(walletInfo.balance)) {
|
if (Number(amount) > Number(walletInfo.balance)) {
|
||||||
setShowTips(true);
|
setShowTips(true);
|
||||||
@@ -197,6 +211,7 @@ const Withdrawal: React.FC = () => {
|
|||||||
setInputValue("0.00");
|
setInputValue("0.00");
|
||||||
// 重新加载数据
|
// 重新加载数据
|
||||||
load_wallet_data();
|
load_wallet_data();
|
||||||
|
setWithdrawSuccess(true);
|
||||||
},
|
},
|
||||||
fail: (res) => {
|
fail: (res) => {
|
||||||
console.log("微信转账失败:", res);
|
console.log("微信转账失败:", res);
|
||||||
@@ -211,7 +226,7 @@ const Withdrawal: React.FC = () => {
|
|||||||
cancelText: "忘记密码",
|
cancelText: "忘记密码",
|
||||||
confirmText: "重试",
|
confirmText: "重试",
|
||||||
cancelColor: "#000",
|
cancelColor: "#000",
|
||||||
confirmColor: "#fff",
|
confirmColor: "#000",
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
if (res.confirm) {
|
if (res.confirm) {
|
||||||
set_show_withdraw_popup(true);
|
set_show_withdraw_popup(true);
|
||||||
@@ -266,6 +281,11 @@ const Withdrawal: React.FC = () => {
|
|||||||
<View
|
<View
|
||||||
className="detail-navigator-back"
|
className="detail-navigator-back"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
|
const pages = Taro.getCurrentPages()
|
||||||
|
const prevPage = pages[pages.length - 2]
|
||||||
|
prevPage.setData({
|
||||||
|
updateList: withdrawSuccess
|
||||||
|
})
|
||||||
Taro.navigateBack();
|
Taro.navigateBack();
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
@@ -363,7 +383,12 @@ const Withdrawal: React.FC = () => {
|
|||||||
onTouchMove={handlePopupClick}
|
onTouchMove={handlePopupClick}
|
||||||
onTouchEnd={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">
|
<View className="password_container">
|
||||||
{password.map((item, index) => (
|
{password.map((item, index) => (
|
||||||
<View key={index} className="password_item">
|
<View key={index} className="password_item">
|
||||||
|
|||||||
Reference in New Issue
Block a user