2020-11-30 20:42:24 +08:00
|
|
|
<template>
|
|
|
|
<el-row class="wrapper">
|
2022-10-27 23:22:46 +08:00
|
|
|
<el-col v-if="bankAccount">
|
|
|
|
<el-col>
|
|
|
|
<h1>账户信息</h1>
|
|
|
|
</el-col>
|
|
|
|
<el-col class="bank-account-item">
|
|
|
|
<span style="font-size: 24px;"> 账号:</span> <span style="color: red;">{{ bankAccount.bankAccount }}</span>
|
|
|
|
</el-col>
|
|
|
|
<el-col class="bank-account-item">
|
2022-11-01 22:48:32 +08:00
|
|
|
<span style="font-size: 24px;"> 余额:</span> <span style="color: red;">{{ bankAccount.accountBalance }}</span>
|
|
|
|
<span
|
|
|
|
style="font-size: 24px;">巴旦木</span>
|
2022-10-27 23:22:46 +08:00
|
|
|
</el-col>
|
|
|
|
<el-col>
|
2022-11-01 22:48:32 +08:00
|
|
|
<records :records="records" :bankAccount="bankAccount.bankAccount" @currentChange="handleCurrentChange"
|
|
|
|
@searchTransactionRecord="searchTransactionRecord"></records>
|
2022-10-27 23:22:46 +08:00
|
|
|
</el-col>
|
2020-11-30 20:42:24 +08:00
|
|
|
</el-col>
|
2022-10-27 23:22:46 +08:00
|
|
|
<el-col v-else style="text-align: center;margin-top: 10vh;">
|
2022-11-01 22:48:32 +08:00
|
|
|
<p style="font-size: 24px;line-height: 48px;">
|
|
|
|
<code>钱包</code> 是社区非常重要的组成部分<br/>
|
|
|
|
开通钱包账号后可激活 <code>每日一题</code> , <code>赞赏</code> 等功能
|
|
|
|
</p>
|
|
|
|
<el-button type="primary" @click="createBankAccount">现在开通</el-button>
|
2021-12-28 22:25:54 +08:00
|
|
|
</el-col>
|
2020-11-30 20:42:24 +08:00
|
|
|
</el-row>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import {mapState} from 'vuex';
|
2021-12-28 23:20:30 +08:00
|
|
|
import Records from "../components/common/bank/account/records";
|
2020-11-30 20:42:24 +08:00
|
|
|
|
|
|
|
export default {
|
|
|
|
name: "wallet",
|
2021-12-28 23:20:30 +08:00
|
|
|
components: {Records},
|
2022-11-01 22:48:32 +08:00
|
|
|
fetch() {
|
|
|
|
let {store, error} = this.$nuxt.context
|
2020-11-30 20:42:24 +08:00
|
|
|
return Promise.all([
|
|
|
|
store
|
2022-10-27 23:22:46 +08:00
|
|
|
.dispatch('wallet/fetchDetail')
|
2021-12-28 22:25:54 +08:00
|
|
|
.catch(err => error({statusCode: 404})),
|
|
|
|
store
|
2022-10-27 23:22:46 +08:00
|
|
|
.dispatch('wallet/fetchTransactionRecordList')
|
2020-11-30 20:42:24 +08:00
|
|
|
.catch(err => error({statusCode: 404}))
|
|
|
|
])
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
...mapState({
|
|
|
|
bankAccount: state => state.wallet.detail.data,
|
2021-12-28 23:20:30 +08:00
|
|
|
records: state => state.wallet.list.data
|
2020-11-30 20:42:24 +08:00
|
|
|
})
|
|
|
|
},
|
|
|
|
data() {
|
2022-11-01 22:48:32 +08:00
|
|
|
return {}
|
2021-12-28 22:25:54 +08:00
|
|
|
},
|
|
|
|
methods: {
|
2021-12-28 23:20:30 +08:00
|
|
|
handleCurrentChange(search) {
|
2021-12-28 22:25:54 +08:00
|
|
|
let _ts = this;
|
|
|
|
_ts.$store.dispatch('wallet/fetchTransactionRecordList', {
|
2022-10-27 23:22:46 +08:00
|
|
|
idUser: _ts.$store.state.auth.user.idUser,
|
2021-12-28 23:20:30 +08:00
|
|
|
startDate: search.startDate,
|
|
|
|
endDate: search.endDate,
|
|
|
|
page: search.page
|
2021-12-28 22:25:54 +08:00
|
|
|
})
|
|
|
|
},
|
|
|
|
searchTransactionRecord(dates) {
|
|
|
|
let _ts = this
|
|
|
|
let startDate = dates[0]
|
|
|
|
let endDate = dates[1]
|
|
|
|
_ts.$store.dispatch('wallet/fetchTransactionRecordList', {
|
2022-10-27 23:22:46 +08:00
|
|
|
idUser: _ts.$store.state.auth.user.idUser,
|
2021-12-28 22:25:54 +08:00
|
|
|
startDate: startDate,
|
|
|
|
endDate: endDate
|
|
|
|
})
|
2022-11-01 22:48:32 +08:00
|
|
|
},
|
|
|
|
createBankAccount() {
|
|
|
|
let _ts = this
|
|
|
|
_ts.$axios.$post('/api/wallet/create').then(function (res) {
|
|
|
|
if (res) {
|
|
|
|
_ts.$fetch()
|
|
|
|
}
|
|
|
|
})
|
2020-11-30 20:42:24 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
mounted() {
|
|
|
|
this.$store.commit('setActiveMenu', 'wallet');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
.bank-account-item {
|
|
|
|
font-size: 32px;
|
|
|
|
padding-left: 15vw;
|
|
|
|
}
|
2022-11-01 22:48:32 +08:00
|
|
|
code {
|
|
|
|
color: red;
|
|
|
|
font-weight: bold;
|
|
|
|
}
|
2020-11-30 20:42:24 +08:00
|
|
|
</style>
|