许静 5 år sedan
förälder
incheckning
71d606d1c6
1 ändrade filer med 4 tillägg och 13 borttagningar
  1. 4
    13
      src/pages/person/customerAnalysis/analysis.js

+ 4
- 13
src/pages/person/customerAnalysis/analysis.js Visa fil

@@ -1,6 +1,7 @@
1 1
 import Taro, { Component } from '@tarojs/taro';
2 2
 import Authorize from '@components/authorize'
3 3
 import { View } from "@tarojs/components";
4
+import dayjs from 'dayjs'
4 5
 import './index.scss'
5 6
 import { AtTabs, AtTabsPane, AtProgress } from 'taro-ui'
6 7
 import "taro-ui/dist/style/components/tabs.scss"
@@ -73,13 +74,10 @@ export default class analysis extends Taro.Component {
73 74
       })
74 75
     })
75 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 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,14 +86,8 @@ export default class analysis extends Taro.Component {
88 86
     const params = current == 0 ? 'new' : current == 1 ? 'follow' : 'visite'
89 87
     if (inx == 0) {
90 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 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 93
     } else {
@@ -108,7 +100,6 @@ export default class analysis extends Taro.Component {
108 100
     this.setState({
109 101
       checkedWhich: inx
110 102
     })
111
-
112 103
   }
113 104
 
114 105
   render() {