diff --git a/pages/wallet.vue b/pages/wallet.vue
index 791269c..b723fc8 100644
--- a/pages/wallet.vue
+++ b/pages/wallet.vue
@@ -7,14 +7,29 @@
账号: {{ bankAccount.bankAccount }}
- 余额: {{ bankAccount.accountBalance }} 巴旦木
+ 余额: {{ bankAccount.accountBalance }} 巴旦木
交易记录
+
+
+
+
-
- 开户银行: {{scope.row.formBankAccountInfo.bankName}}
-
-
- 银行账号: {{scope.row.formBankAccountInfo.bankAccount}}
-
-
- 所属用户: {{scope.row.formBankAccountInfo.accountOwnerName}}
-
+
+ 开户银行: {{ scope.row.formBankAccountInfo.bankName }}
+
+
+ 银行账号: {{ scope.row.formBankAccountInfo.bankAccount }}
+
+
+ 所属用户: {{ scope.row.formBankAccountInfo.accountOwnerName }}
+
{{ scope.row.formBankAccount }}
@@ -47,13 +62,13 @@
placement="right"
trigger="hover">
- 开户银行: {{scope.row.toBankAccountInfo.bankName}}
+ 开户银行: {{ scope.row.toBankAccountInfo.bankName }}
- 银行账号: {{scope.row.toBankAccountInfo.bankAccount}}
+ 银行账号: {{ scope.row.toBankAccountInfo.bankAccount }}
- 所属用户: {{scope.row.toBankAccountInfo.accountOwnerName}}
+ 所属用户: {{ scope.row.toBankAccountInfo.accountOwnerName }}
{{ scope.row.toBankAccount }}
@@ -80,6 +95,18 @@
+
+
+
+
@@ -92,21 +119,109 @@ export default {
return Promise.all([
store
.dispatch('wallet/fetchDetail', {idUser: store.state.oauth.idUser})
+ .catch(err => error({statusCode: 404})),
+ store
+ .dispatch('wallet/fetchTransactionRecordList', {idUser: store.state.oauth.idUser})
.catch(err => error({statusCode: 404}))
])
},
computed: {
...mapState({
bankAccount: state => state.wallet.detail.data,
- transactionRecords: state => state.wallet.detail.data.transactionRecords,
+ records: state => state.wallet.list.data.records,
+ pagination: state => state.wallet.list.data.pagination
})
},
data() {
return {
+ pickerOptions: {
+ shortcuts: [{
+ text: '本月',
+ onClick(picker) {
+ const end = new Date();
+ const start = new Date();
+ start.setDate(1);
+ picker.$emit('pick', [start, end]);
+ }
+ }, {
+ text: '最近 30 天',
+ onClick(picker) {
+ const end = new Date();
+ const start = new Date();
+ start.setMonth(start.getMonth() - 1);
+ picker.$emit('pick', [start, end]);
+ }
+ }, {
+ text: '最近三个月',
+ onClick(picker) {
+ const end = new Date();
+ const start = new Date();
+ start.setMonth(start.getMonth() - 3);
+ picker.$emit('pick', [start, end]);
+ }
+ }, {
+ text: '最近六个月',
+ onClick(picker) {
+ const end = new Date();
+ const start = new Date();
+ start.setMonth(start.getMonth() - 6);
+ picker.$emit('pick', [start, end]);
+ }
+ }, {
+ text: '今年至今',
+ onClick(picker) {
+ const end = new Date();
+ const start = new Date(new Date().getFullYear(), 0);
+ picker.$emit('pick', [start, end]);
+ }
+ }]
+ },
+ searchDate: []
+ }
+ },
+ methods: {
+ handleSizeChange(pageSize) {
+ let _ts = this;
+ let startDate = _ts.searchDate[0]
+ let endDate = _ts.searchDate[1]
+ _ts.$store.dispatch('wallet/fetchTransactionRecordList', {
+ idUser: _ts.$store.state.oauth.idUser,
+ startDate: startDate,
+ endDate: endDate,
+ page: _ts.pagination.currentPage,
+ rows: pageSize
+ })
+ },
+ handleCurrentChange(page) {
+ let _ts = this;
+ let startDate = _ts.searchDate[0]
+ let endDate = _ts.searchDate[1]
+ _ts.$store.dispatch('wallet/fetchTransactionRecordList', {
+ idUser: _ts.$store.state.oauth.idUser,
+ startDate: startDate,
+ endDate: endDate,
+ page: page,
+ rows: _ts.pagination.pageSize
+ })
+ },
+ searchTransactionRecord(dates) {
+ let _ts = this
+ let startDate = dates[0]
+ let endDate = dates[1]
+ _ts.$store.dispatch('wallet/fetchTransactionRecordList', {
+ idUser: _ts.$store.state.oauth.idUser,
+ startDate: startDate,
+ endDate: endDate
+ })
}
},
mounted() {
this.$store.commit('setActiveMenu', 'wallet');
+ const end = new Date();
+ const start = new Date();
+ start.setMonth(start.getMonth() - 1);
+ let searchDate = [start, end]
+ this.searchDate = searchDate
}
}
diff --git a/store/wallet.js b/store/wallet.js
index f387564..030f444 100644
--- a/store/wallet.js
+++ b/store/wallet.js
@@ -22,10 +22,10 @@ export const state = () => {
export const mutations = {
// 消费记录列表
- updateListFetching(state, action) {
+ updateTransactionRecordListFetching(state, action) {
state.list.fetching = action
},
- updateListData(state, action) {
+ updateTransactionRecordListData(state, action) {
state.list.data = action
},
// 账户详情
@@ -39,15 +39,10 @@ export const mutations = {
export const actions = {
// 获取账户详情
- fetchDetail({ commit }, params = {}) {
+ fetchDetail({commit}, params = {}) {
commit('updateDetailFetching', true)
- console.log(params)
return this.$axios
- .$get(`${WALLET_API_PATH}/${params.idUser}`, {
- params: {
- type: 3
- }
- })
+ .$get(`${WALLET_API_PATH}/${params.idUser}`)
.then(response => {
return new Promise(resolve => {
commit('updateDetailData', response)
@@ -62,5 +57,31 @@ export const actions = {
commit('updateDetailFetching', false)
return Promise.reject(error)
})
+ },
+ // 获取账户详情
+ fetchTransactionRecordList({commit}, params = {}) {
+ commit('updateTransactionRecordListFetching', true)
+ return this.$axios
+ .$get(`${WALLET_API_PATH}/transaction-records`, {
+ params: {
+ idUser: params.idUser,
+ startDate: params.startDate,
+ endDate: params.endDate
+ }
+ })
+ .then(response => {
+ return new Promise(resolve => {
+ commit('updateTransactionRecordListData', response)
+ commit('updateTransactionRecordListFetching', false)
+ resolve(response)
+ // delay(() => {
+ // resolve(response)
+ // })
+ })
+ })
+ .catch(error => {
+ commit('updateTransactionRecordListFetching', false)
+ return Promise.reject(error)
+ })
}
}