许静 5 years ago
parent
commit
71d606d1c6
1 changed files with 4 additions and 13 deletions
  1. 4
    13
      src/pages/person/customerAnalysis/analysis.js

+ 4
- 13
src/pages/person/customerAnalysis/analysis.js View File

1
 import Taro, { Component } from '@tarojs/taro';
1
 import Taro, { Component } from '@tarojs/taro';
2
 import Authorize from '@components/authorize'
2
 import Authorize from '@components/authorize'
3
 import { View } from "@tarojs/components";
3
 import { View } from "@tarojs/components";
4
+import dayjs from 'dayjs'
4
 import './index.scss'
5
 import './index.scss'
5
 import { AtTabs, AtTabsPane, AtProgress } from 'taro-ui'
6
 import { AtTabs, AtTabsPane, AtProgress } from 'taro-ui'
6
 import "taro-ui/dist/style/components/tabs.scss"
7
 import "taro-ui/dist/style/components/tabs.scss"
73
       })
74
       })
74
     })
75
     })
75
     getEchartDailyInfo('new').then(res => {
76
     getEchartDailyInfo('new').then(res => {
76
-      let arr = []
77
-      res.map((item, index) => {
78
-        arr.push({ value: item.customerNum, name: item.day })
79
-      })
77
+
80
 
78
 
81
       this.setState({
79
       this.setState({
82
-        chartInfo: arr || []
80
+        chartInfo: res.map(x => ({ name: `${dayjs(x.day).format('MM月DD日')}`, value: x.customerNum }))
83
       })
81
       })
84
     })
82
     })
85
   }
83
   }
88
     const params = current == 0 ? 'new' : current == 1 ? 'follow' : 'visite'
86
     const params = current == 0 ? 'new' : current == 1 ? 'follow' : 'visite'
89
     if (inx == 0) {
87
     if (inx == 0) {
90
       getEchartDailyInfo(params).then(res => {
88
       getEchartDailyInfo(params).then(res => {
91
-
92
-
93
-        let arr = []
94
-        res.map((item, index) => {
95
-          arr.push({ value: item.customerNum, name: item.day })
96
-        })
97
         this.setState({
89
         this.setState({
98
-          chartInfo: arr || []
90
+          chartInfo: res.map(x => ({ name: `${dayjs(x.day).format('MM月DD日')}`, value: x.customerNum }))
99
         })
91
         })
100
       })
92
       })
101
     } else {
93
     } else {
108
     this.setState({
100
     this.setState({
109
       checkedWhich: inx
101
       checkedWhich: inx
110
     })
102
     })
111
-
112
   }
103
   }
113
 
104
 
114
   render() {
105
   render() {