Merge remote-tracking branch 'origin/master'

master
chaiyapeng 2024-08-23 22:12:34 +08:00
commit f6a22b33b8
1 changed files with 10 additions and 30 deletions

View File

@ -1,47 +1,27 @@
<template>
<div>
<el-table
:data="listDate"
style="width: 100%">
<el-table-column
label="用户余额"
width="180">
<template slot-scope="scope">
<span style="margin-left: 10px">{{ scope.row.userBalance }}</span>
</template>
</el-table-column>
</el-table>
<span style="text-align: center">账户余额: {{ balance }}</span>
</div>
</template>
<script>
import { userBalance } from "@/api/system/user"; // API
import { getToken } from "@/utils/auth"; // Token
import {userBalance} from "@/api/system/user";
export default {
data() {
return {
listDate: [],
userId: null
balance: null, //
};
},
created() {
this.userId = getToken(); // Token ID
if (this.userId) {
this.fetchUserBalance(this.userId); //
}
},
methods: {
async fetchUserBalance(userId) {
async created() {
try {
const userId = 1; // ID
const response = await userBalance(userId);
this.listDate = [{ paymentAmount: response.data.userBalance }];
this.balance = response.data.balance; //
} catch (error) {
console.error('Error fetching user balance:', error);
}
},
}
};
</script>