zjf
2023-02-24 3f9bad03f4fbca2d5c5be86e904ae832475634d8
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
49
50
51
52
53
54
55
56
57
58
59
60
61
// import {
//   crmMessagNumAPI
// } from '@/api/clients/message'
 
/**
 * 消息记录
 */
const app = {
  state: {
    // 待办事项消息
    messageNum: {
      todayCustomer: 0,
      followLeads: 0,
      followCustomer: 0,
      checkContract: 0,
      checkReceivables: 0,
      remindReceivablesPlan: 0,
      endContract: 0,
      totalNum: 0
    }
  },
 
  mutations: {
    /**
     * 更改待办事项
     */
    SET_MESSAGENUM: (state, messageNum) => {
      let totalNum = 0
      for (const key in messageNum) {
        if (key !== 'totalNum') {
          totalNum += (messageNum[key] || 0)
        }
      }
      messageNum.totalNum = totalNum
      state.messageNum = messageNum
    }
  },
 
  actions: {
    // 登录
    // GetMessageNum({
    //   state,
    //   commit
    // }) {
    //   return new Promise((resolve, reject) => {
    //     crmMessagNumAPI()
    //       .then(response => {
    //         commit('SET_MESSAGENUM', response.data)
    //         commit('SET_CRMROUTERSNUM', state.messageNum.totalNum)
    //         resolve(response)
    //       })
    //       .catch(error => {
    //         reject(error)
    //       })
    //   })
    // }
 
  }
}
 
export default app