Commit 38021383 by wzxjohn

fix: wrong loading state while top up

parent 34c94220
...@@ -168,6 +168,7 @@ const TopUp = () => { ...@@ -168,6 +168,7 @@ const TopUp = () => {
showError(t('管理员未开启在线充值!')); showError(t('管理员未开启在线充值!'));
return; return;
} }
setPayWay(payment);
setPaymentLoading(true); setPaymentLoading(true);
try { try {
await getAmount(); await getAmount();
...@@ -175,7 +176,6 @@ const TopUp = () => { ...@@ -175,7 +176,6 @@ const TopUp = () => {
showError(t('充值数量不能小于') + minTopUp); showError(t('充值数量不能小于') + minTopUp);
return; return;
} }
setPayWay(payment);
setOpen(true); setOpen(true);
} catch (error) { } catch (error) {
showError(t('获取金额失败')); showError(t('获取金额失败'));
...@@ -193,7 +193,6 @@ const TopUp = () => { ...@@ -193,7 +193,6 @@ const TopUp = () => {
return; return;
} }
setConfirmLoading(true); setConfirmLoading(true);
setOpen(false);
try { try {
const res = await API.post('/api/user/pay', { const res = await API.post('/api/user/pay', {
amount: parseInt(topUpCount), amount: parseInt(topUpCount),
...@@ -234,6 +233,7 @@ const TopUp = () => { ...@@ -234,6 +233,7 @@ const TopUp = () => {
console.log(err); console.log(err);
showError(t('支付请求失败')); showError(t('支付请求失败'));
} finally { } finally {
setOpen(false);
setConfirmLoading(false); setConfirmLoading(false);
} }
}; };
...@@ -255,7 +255,6 @@ const TopUp = () => { ...@@ -255,7 +255,6 @@ const TopUp = () => {
} catch (error) { } catch (error) {
showError(t('获取金额失败')); showError(t('获取金额失败'));
} finally { } finally {
setPayWay('')
setPaymentLoading(false); setPaymentLoading(false);
} }
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment