bindAccount.js
1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import { maskAccount } from '../../utils/mine-handler';
export default function() {
return {
namespaced: true,
state: {
alipayAccount: '',
certName: '',
nickName: '',
validStatus: -1
},
mutations: {
addUserAliPayAccount(state, data) {
let {
alipayAccount,
certName,
nickName,
validStatus
} = data;
// state.alipayAccount = maskAccount(alipayAccount);
state.alipayAccount = alipayAccount || '';
state.nickName = nickName || '';
state.certName = certName || '';
state.validStatus = validStatus || 0;
}
},
actions: {
async fetchUserAliPayAccount({ commit }) {
const result = await this.$api.get('/api/ufo/home/getUserAliPayAccount');
if (result.code === 200) {
commit('addUserAliPayAccount', result.data);
} else {
commit('addUserAliPayAccount', {});
}
},
async bindAliPayAccount({ commit }, {account, name}) {
const result = await this.$api.get('/api/ufo/home/bindAliPayAccount', {
alipayAccount: account,
certName: name
});
// commit('addUserAliPayAccount', result.data);
return result;
},
},
};
}