fix(pay): 修正用户余额更新失败的问题
解决用户充值时余额未正确更新的问题,调整了相关API的调用顺序并修复了用户ID获取逻辑,确保充值后用户余额能够及时更新。 更改包括: - 修正了`userRecharge`方法中用户余额更新的触发逻辑。 - 重构代码以正确获取并分配用户ID。- 添加错误处理机制以确保用户余额更新失败时能够给出提示。余额更新流程现在如下: 1. 用户提交充值请求。 2.服务器验证并处理充值请求。 3. 充值成功后,系统通过`addUserMoney`方法更新用户余额。 此修复确保了用户在充值后能看到准确的余额变化,避免了之前由于系统错误导致的余额未更新问题。master
parent
ef8aed4036
commit
21f4edd5b9
|
@ -2,8 +2,9 @@
|
|||
<el-card class="box-card">
|
||||
<ul class="msg-box">
|
||||
<li>
|
||||
<h4 style="margin-bottom: 15px;">充值说明</h4>
|
||||
<h1 style="margin-bottom: 15px;">充值说明</h1>
|
||||
<h4>你敢充钱,我就敢让你没钱</h4>
|
||||
<h4>子龙说你得有个小目标</h4>
|
||||
</li>
|
||||
<li>
|
||||
<h4 style="margin-bottom: 15px;">支付金额</h4>
|
||||
|
@ -35,14 +36,16 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import { userRecharge } from "@/api/system/user";
|
||||
import {addUserMoney, userRecharge} from "@/api/system/user";
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
amountVal: '',
|
||||
addSysUser: {},
|
||||
disabled: false,
|
||||
// 同步跳转页面地址
|
||||
returnUrl: 'http://172.13.1.1/money/money',
|
||||
returnUrl: 'http://localhost/money/money',
|
||||
//充值参数
|
||||
rechargeParams: {
|
||||
"totalAmt": '', //金额
|
||||
|
@ -101,6 +104,13 @@ export default {
|
|||
document.getElementById('payDiv').getElementsByTagName('form')[0].submit();
|
||||
}
|
||||
})
|
||||
this.addSysUser.userBalance = this.rechargeParams.totalAmt;
|
||||
let userId = localStorage.getItem('userId');
|
||||
this.addSysUser.userId = userId;
|
||||
addUserMoney(this.addSysUser).then(res => {
|
||||
}).catch(error => {
|
||||
console.error('Error updating user balance:', error);
|
||||
});
|
||||
}
|
||||
},
|
||||
// 获取当前日期的方法
|
||||
|
|
Loading…
Reference in New Issue