许静 5 лет назад
Родитель
Сommit
3c0cf3fd0d

+ 41
- 19
src/components/charts/Line.js Просмотреть файл

@@ -54,9 +54,31 @@ export default class LineChart extends Component {
54 54
     const colorWithOpacity = op => `rgba(187,156,121, ${op})`
55 55
 
56 56
     const defaultOpt = {
57
-      color: [ colorWithOpacity(1) ],
58
-      xAxis: { type: 'category', boundaryGap: false },
59
-      yAxis: { type: 'value' },
57
+      color: [colorWithOpacity(1)],
58
+      xAxis: {
59
+        type: 'category',
60
+        boundaryGap: false,
61
+        axisLabel: {
62
+          textStyle: {
63
+            color: '#666'
64
+          }
65
+        }
66
+
67
+      },
68
+      yAxis: {
69
+        type: 'value',
70
+        axisLabel: {
71
+          textStyle: {
72
+            color: '#666'
73
+          }
74
+        }
75
+      },
76
+      grid: {
77
+        left: '10%',
78
+        right: '8%',
79
+        bottom: '10%',
80
+        top: '6%',
81
+      },
60 82
       series: [],
61 83
     }
62 84
 
@@ -74,27 +96,27 @@ export default class LineChart extends Component {
74 96
         symbolSize: 6,
75 97
         smooth: true,
76 98
         label: {
77
-            show: true,
78
-            formatter: '{@value}人'
99
+          show: true,
100
+          formatter: '{@value}人'
79 101
         },
80 102
         lineStyle: {
81
-            shadowColor: colorWithOpacity(0.5),
82
-            shadowBlur: 5,
83
-            shadowOffsetY: 7
103
+          shadowColor: colorWithOpacity(0.5),
104
+          shadowBlur: 5,
105
+          shadowOffsetY: 7
84 106
         },
85 107
         areaStyle: {
86 108
           color: {
87
-              type: 'linear',
88
-              x: 0,
89
-              y: 0,
90
-              x2: 0,
91
-              y2: 1,
92
-              colorStops: [{
93
-                  offset: 0, color: colorWithOpacity(0.2) // 0% 处的颜色
94
-              }, {
95
-                  offset: 1, color: colorWithOpacity(0) // 100% 处的颜色
96
-              }],
97
-              global: false,
109
+            type: 'linear',
110
+            x: 0,
111
+            y: 0,
112
+            x2: 0,
113
+            y2: 1,
114
+            colorStops: [{
115
+              offset: 0, color: colorWithOpacity(0.2) // 0% 处的颜色
116
+            }, {
117
+              offset: 1, color: colorWithOpacity(0) // 100% 处的颜色
118
+            }],
119
+            global: false,
98 120
           }
99 121
         },
100 122
       }],

+ 3
- 3
src/components/charts/style.scss Просмотреть файл

@@ -1,11 +1,11 @@
1 1
 .map-container {
2 2
   position: absolute;
3
-  top: 0;
3
+  top: 80px;
4 4
   bottom: 0;
5 5
   left: 1vw;
6 6
   right: 0;
7
-  width:98vw;
8
-  height:600px;
7
+  width:100vw;
8
+  height:400px;
9 9
   display: flex;
10 10
   flex-direction: column;
11 11
   align-items: center;

+ 70
- 25
src/pages/person/customerAnalysis/analysis.js Просмотреть файл

@@ -79,67 +79,112 @@ export default class analysis extends Taro.Component {
79 79
       })
80 80
     })
81 81
   }
82
+  changeDailyMonth(inx) {
83
+    const { current } = this.state
84
+    const params = current == 0 ? 'new' : current == 1 ? 'follow' : 'visite'
85
+    if (inx == 0) {
86
+      getEchartDailyInfo(params).then(res => {
87
+        console.log(res, "res")
88
+        // let arr = []
89
+        // data.map((item, index) => {
90
+        //   arr.push({ img: item, sort: index })
91
+        // })
92
+        this.setState({
93
+        })
94
+      })
95
+    } else {
96
+      getEchartMonthInfo(params).then(res => {
97
+        console.log(res, "res")
98
+        this.setState({
99
+        })
100
+      })
101
+    }
102
+    this.setState({
103
+      checkedWhich: inx
104
+    })
105
+
106
+  }
82 107
 
83 108
   render() {
84 109
 
85 110
     const tabList = [{ title: '新增客户' }, { title: '跟进客户' }, { title: '到访客户' }]
86 111
     const dailyMonth = ['日', '月']
87
-    const { sexInfo, chartInfo, checkedWhich } = this.state
112
+    const { sexInfo, chartInfo, checkedWhich, current } = this.state
88 113
 
89 114
     return (
90 115
       <View>
91
-        <AtTabs className="tab-bar" current={this.state.current} tabList={tabList} onClick={this.handleClick.bind(this)}>
92
-          <AtTabsPane current={this.state.current} index={0} >
116
+        <AtTabs className="tab-bar" current={current} tabList={tabList} onClick={this.handleClick.bind(this)}>
117
+          <AtTabsPane current={current} index={0} >
93 118
             <View>
94
-              <View style="width:90vw;height:600rpx">
119
+              <View style="height:'40rpx;position: relative;">
95 120
                 <View className="daily-month" >
96 121
                   {
97 122
                     dailyMonth.map((item, index) => (
98
-                      <View className={checkedWhich == index ? 'checked' : 'item'}>
123
+                      <View className={checkedWhich == index ? 'checked' : 'item'} onClick={this.changeDailyMonth.bind(this, index)}>
99 124
                         {item}
100
-                      </View>
101
-                    ))
125
+                      </View>))
102 126
                   }
103
-
104 127
                 </View>
128
+              </View>
129
+              <View style="width:100vw;height:530rpx">
105 130
                 <LineChart source={chartInfo} />
106 131
               </View>
107
-
108 132
               <View style="height:20rpx;background:#f5f5f5;"> </View>
109 133
               <View style="padding: 40rpx;">
110 134
                 <View style="font-size: 36rpx;color: #666;margin-bottom:20rpx;">性别</View>
111
-                {
112
-                  sexInfo.map((item, index) => (
113
-                    <View key={index + 'sex3'} style="display: flex;align-items: center;"><View style="font-size: 32rpx;color: #666;min-width:80rpx">{item.genderType == 1 ? '男' : item.genderType == 2 ? '女' : '未知'}</View><AtProgress percent={(item.percentage * 100).toFixed(2)} strokeWidth={6} color={item.genderType == 1 ? '#BB9C79' : item.genderType == 2 ? '#F6B61D' : '#A2A2A2'} /></View>
114
-                  ))
135
+                {sexInfo.map((item, index) => (
136
+                  <View key={index + 'sex3'} style="display: flex;align-items: center;"><View style="font-size: 32rpx;color: #666;min-width:80rpx">{item.genderType == 1 ? '男' : item.genderType == 2 ? '女' : '未知'}</View><AtProgress percent={(item.percentage * 100).toFixed(2)} strokeWidth={6} color={item.genderType == 1 ? '#BB9C79' : item.genderType == 2 ? '#F6B61D' : '#A2A2A2'} /></View>
137
+                ))
115 138
                 }
116 139
               </View>
117 140
             </View>
118 141
           </AtTabsPane>
119
-          <AtTabsPane current={this.state.current} index={1}>
142
+          <AtTabsPane current={current} index={1}>
120 143
             <View>
121
-              <LineChart />
144
+              <View style="height:'40rpx;position: relative;">
145
+                <View className="daily-month" >
146
+                  {
147
+                    dailyMonth.map((item, index) => (
148
+                      <View className={checkedWhich == index ? 'checked' : 'item'} onClick={this.changeDailyMonth.bind(this, index)}>
149
+                        {item}
150
+                      </View>))
151
+                  }
152
+                </View>
153
+              </View>
154
+              <View style="width:100vw;height:520rpx">
155
+                <LineChart source={chartInfo} />
156
+              </View>
122 157
               <View style="height:20rpx;background:#f5f5f5;"> </View>
123 158
               <View style="padding: 40rpx;">
124 159
                 <View style="font-size: 36rpx;color: #666;margin-bottom:20rpx;">性别</View>
125
-                {
126
-                  sexInfo.map((item, index) => (
127
-                    <View key={index + 'sex3'} style="display: flex;align-items: center;"><View style="font-size: 32rpx;color: #666;min-width:80rpx">{item.genderType == 1 ? '男' : item.genderType == 2 ? '女' : '未知'}</View><AtProgress percent={(item.percentage * 100).toFixed(2)} strokeWidth={6} color={item.genderType == 1 ? '#BB9C79' : item.genderType == 2 ? '#F6B61D' : '#A2A2A2'} /></View>
128
-                  ))
160
+                {sexInfo.map((item, index) => (
161
+                  <View key={index + 'sex3'} style="display: flex;align-items: center;"><View style="font-size: 32rpx;color: #666;min-width:80rpx">{item.genderType == 1 ? '男' : item.genderType == 2 ? '女' : '未知'}</View><AtProgress percent={(item.percentage * 100).toFixed(2)} strokeWidth={6} color={item.genderType == 1 ? '#BB9C79' : item.genderType == 2 ? '#F6B61D' : '#A2A2A2'} /></View>
162
+                ))
129 163
                 }
130 164
               </View>
131 165
             </View>
132 166
           </AtTabsPane>
133
-          <AtTabsPane current={this.state.current} index={2}>
167
+          <AtTabsPane current={current} index={2}>
134 168
             <View>
135
-              <LineChart />
169
+              <View style="height:'40rpx;position: relative;">
170
+                <View className="daily-month" >
171
+                  {
172
+                    dailyMonth.map((item, index) => (
173
+                      <View className={checkedWhich == index ? 'checked' : 'item'} onClick={this.changeDailyMonth.bind(this, index)}>
174
+                        {item}
175
+                      </View>))
176
+                  }
177
+                </View>
178
+              </View>
179
+              <View style="width:100vw;height:520rpx">
180
+                <LineChart source={chartInfo} />
181
+              </View>
136 182
               <View style="height:20rpx;background:#f5f5f5;"> </View>
137 183
               <View style="padding: 40rpx;">
138 184
                 <View style="font-size: 36rpx;color: #666;margin-bottom:20rpx;">性别</View>
139
-                {
140
-                  sexInfo.map((item, index) => (
141
-                    <View key={index + 'sex3'} style="display: flex;align-items: center;"><View style="font-size: 32rpx;color: #666;min-width:80rpx">{item.genderType == 1 ? '男' : item.genderType == 2 ? '女' : '未知'}</View><AtProgress percent={(item.percentage * 100).toFixed(2)} strokeWidth={6} color={item.genderType == 1 ? '#BB9C79' : item.genderType == 2 ? '#F6B61D' : '#A2A2A2'} /></View>
142
-                  ))
185
+                {sexInfo.map((item, index) => (
186
+                  <View key={index + 'sex3'} style="display: flex;align-items: center;"><View style="font-size: 32rpx;color: #666;min-width:80rpx">{item.genderType == 1 ? '男' : item.genderType == 2 ? '女' : '未知'}</View><AtProgress percent={(item.percentage * 100).toFixed(2)} strokeWidth={6} color={item.genderType == 1 ? '#BB9C79' : item.genderType == 2 ? '#F6B61D' : '#A2A2A2'} /></View>
187
+                ))
143 188
                 }
144 189
               </View>
145 190
             </View>

+ 4
- 0
src/pages/person/customerAnalysis/index.scss Просмотреть файл

@@ -10,6 +10,8 @@
10 10
   align-items: center;
11 11
   text-align: right;
12 12
   padding: 0 25px;
13
+  position: absolute;
14
+  right: 0;
13 15
   .item{
14 16
     width:76px;
15 17
     height:40px;
@@ -20,6 +22,7 @@
20 22
     font-size: 28px;
21 23
     text-align: center;
22 24
     margin: 0 15px;
25
+
23 26
   }
24 27
   .checked{
25 28
     width:76px;
@@ -31,6 +34,7 @@
31 34
     font-size: 28px;
32 35
     margin: 0 15px;
33 36
     text-align: center;
37
+  
34 38
   }
35 39
 }
36 40
 .tab-box{

+ 6
- 6
src/pages/person/menus.js Просмотреть файл

@@ -45,7 +45,7 @@ const menus = [
45 45
       url: '/pages/person/customerAnalysis/index',
46 46
       icon: icons.homepage,
47 47
       extends: undefined,
48
-      userTypes: [ CONSULTANT],
48
+      userTypes: [CONSULTANT, CUSTOMER],
49 49
       style: '',
50 50
     },
51 51
     // {
@@ -60,7 +60,7 @@ const menus = [
60 60
       url: '/pages/agent/client/index',
61 61
       icon: icons.recommend,
62 62
       extends: undefined,
63
-      userTypes: [CUSTOMER,ESTATE_AGENT, CHANNEL_AGENT],
63
+      userTypes: [CUSTOMER, ESTATE_AGENT, CHANNEL_AGENT],
64 64
       style: '',
65 65
     },
66 66
     // {
@@ -151,16 +151,16 @@ const menus = [
151 151
       url: '/pages/agent/become/index',
152 152
       icon: icons.development,
153 153
       extends: undefined,
154
-      userTypes: [CUSTOMER,ESTATE_AGENT],
155
-      style: {color:'#888888'},
154
+      userTypes: [CUSTOMER, ESTATE_AGENT],
155
+      style: { color: '#888888' },
156 156
     },
157 157
     {
158 158
       name: '成为置业顾问',
159 159
       url: '',
160 160
       icon: icons.consultant,
161 161
       extends: undefined,
162
-      style: {color:'#888888'},
163
-      userTypes: [CUSTOMER,ESTATE_AGENT],
162
+      style: { color: '#888888' },
163
+      userTypes: [CUSTOMER, ESTATE_AGENT],
164 164
     },
165 165
 
166 166
   ]