possession.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. // 资产
  2. import {
  3. Api_getAccountInfo
  4. } from "@/api/index.js"
  5. const state = {
  6. contractAccount:{},
  7. bibiAccount:{},
  8. legalAccount:{},
  9. GiftMoneyAccount:{}
  10. }
  11. const mutations = {
  12. SET_CONTRACT: (state, contract) => {
  13. // 合约账户
  14. state.contractAccount = contract;
  15. },
  16. SET_BIBI: (state, bibi) => {
  17. // 币币账户
  18. state.bibiAccount = bibi;
  19. },
  20. SET_LEGAL: (state, legal) => {
  21. // 法币账户
  22. state.legalAccount = legal;
  23. },
  24. SET_GIFTMONEY: (state, GiftMoney) => {
  25. // 赠金账户
  26. state.GiftMoneyAccount = GiftMoney;
  27. },
  28. // SET_STOCKS_COLOR: (state, code) => {
  29. // state.stocksColor = code
  30. // },
  31. // SET_TOKEN: (state, token) => {
  32. // setToken(token)
  33. // state.token = token
  34. // }
  35. }
  36. const actions = {
  37. // setToken = (token) => {
  38. // console.log('token = ' , token)
  39. // }
  40. // 获取资产
  41. getPossession({
  42. commit
  43. }, data) {
  44. // commit('SET_TOKEN', token)
  45. return new Promise((resolve, reject) => {
  46. Api_getAccountInfo().then(res => {
  47. commit('SET_CONTRACT' , res.lever_wallet);
  48. commit('SET_BIBI' , res.change_wallet);
  49. commit('SET_LEGAL' , res.legal_wallet);
  50. commit('SET_GIFTMONEY' , res.micro_wallet);
  51. resolve()
  52. }).catch(err => {
  53. reject()
  54. }).finally(() => {
  55. })
  56. })
  57. },
  58. }
  59. export default {
  60. namespaced: true,
  61. state,
  62. mutations,
  63. actions
  64. }