bindAccount.js
1.16 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
import { maskAccount } from '../../utils/mine-handler';
export default function() {
return {
namespaced: true,
state: {
alipayAccount: '',
certName: '',
nickName: '',
validStatus: 0
},
mutations: {
addUserAliPayAccount(state, data) {
let {
alipayAccount,
certName,
nickName,
validStatus
} = data;
state.alipayAccount = maskAccount(alipayAccount);
state.nickName = nickName || '';
state.certName = certName;
state.validStatus = validStatus;
}
},
actions: {
async fetchUserAliPayAccount({ commit }) {
const result = await this.$api.get('/api/ufo/home/getUserAliPayAccount');
console.log(result);
if (result.code === 200) {
commit('addUserAliPayAccount', result.data);
}
},
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;
},
},
};
}