Browse Source

Merge branch 'v3.5.1' of http://git.ycjcjy.com/zhiyuxing/miniapp-v3 into v3.5.1

周立森 5 years ago
parent
commit
1238693488

+ 2
- 2
config/dev.js View File

@@ -9,8 +9,8 @@ module.exports = {
9 9
     // WSS_HOST: '"wss://dev.jinchengjiaye.com"',
10 10
     // HOST: '"https://lt.pawoma.cn"',
11 11
     // WSS_HOST: '"wss://lt.pawoma.cn"',
12
-    HOST: '"http://192.168.0.218:8080"',
13
-    WSS_HOST: '"ws://192.168.0.218:8080"',
12
+    HOST: '"http://192.168.0.84:8080"',
13
+    WSS_HOST: '"ws://192.168.0.84:8080"',
14 14
   },
15 15
   weapp: {},
16 16
   h5: {}

+ 13
- 13
package.json View File

@@ -10,13 +10,13 @@
10 10
   "author": "pcli",
11 11
   "license": "MIT",
12 12
   "dependencies": {
13
-    "@tarojs/async-await": "1.3.8",
14
-    "@tarojs/cli": "1.3.8",
15
-    "@tarojs/components": "1.3.8",
16
-    "@tarojs/redux": "^1.3.8",
17
-    "@tarojs/router": "1.3.8",
18
-    "@tarojs/taro": "1.3.8",
19
-    "@tarojs/taro-weapp": "1.3.8",
13
+    "@tarojs/async-await": "1.3.25",
14
+    "@tarojs/cli": "1.3.25",
15
+    "@tarojs/components": "1.3.25",
16
+    "@tarojs/redux": "^1.3.25",
17
+    "@tarojs/router": "1.3.25",
18
+    "@tarojs/taro": "1.3.25",
19
+    "@tarojs/taro-weapp": "1.3.25",
20 20
     "dayjs": "^1.8.14",
21 21
     "min-ready": "^2.3.0",
22 22
     "nervjs": "^1.4.3",
@@ -27,12 +27,12 @@
27 27
     "taro-ui": "^2.2.1"
28 28
   },
29 29
   "devDependencies": {
30
-    "@tarojs/plugin-babel": "1.3.8",
31
-    "@tarojs/plugin-csso": "1.3.8",
32
-    "@tarojs/plugin-less": "1.3.8",
33
-    "@tarojs/plugin-sass": "1.3.8",
34
-    "@tarojs/plugin-uglifyjs": "1.3.8",
35
-    "@tarojs/webpack-runner": "1.3.8",
30
+    "@tarojs/plugin-babel": "1.3.25",
31
+    "@tarojs/plugin-csso": "1.3.25",
32
+    "@tarojs/plugin-less": "1.3.25",
33
+    "@tarojs/plugin-sass": "1.3.25",
34
+    "@tarojs/plugin-uglifyjs": "1.3.25",
35
+    "@tarojs/webpack-runner": "1.3.25",
36 36
     "@types/react": "^16.4.6",
37 37
     "@types/webpack-env": "^1.13.6",
38 38
     "babel-eslint": "^8.2.3",

+ 62
- 7
src/components/charts/Line.js View File

@@ -35,6 +35,7 @@ export default class LineChart extends Component {
35 35
 
36 36
   // 禁止 props 变更时渲染
37 37
   shouldComponentUpdate(nextProps) {
38
+    console.log('------------>', this.props, nextProps)
38 39
     if (nextProps.source && nextProps.source.length) {
39 40
       this.refreshChart(this.props.source)
40 41
     }
@@ -42,7 +43,7 @@ export default class LineChart extends Component {
42 43
     return false
43 44
   }
44 45
 
45
-  handleEcComponent (ref) {
46
+  handleEcComponent(ref) {
46 47
     this.ecComponent = ref
47 48
   }
48 49
 
@@ -51,27 +52,81 @@ export default class LineChart extends Component {
51 52
   }
52 53
 
53 54
   createOptions(source = []) {
55
+    const colorWithOpacity = op => `rgba(187,156,121, ${op})`
56
+
54 57
     const defaultOpt = {
55
-      color: ['#BB9C79', '#666666'],
56
-      xAxis: { type: 'category' },
57
-      yAxis: { type: 'value' },
58
+      color: [colorWithOpacity(1)],
59
+      xAxis: {
60
+        type: 'category',
61
+        boundaryGap: false,
62
+        axisLabel: {
63
+          textStyle: {
64
+            color: '#666'
65
+          }
66
+        }
67
+
68
+      },
69
+      yAxis: {
70
+        type: 'value',
71
+        axisLabel: {
72
+          textStyle: {
73
+            color: '#666'
74
+          }
75
+        }
76
+      },
77
+      grid: {
78
+        left: '10%',
79
+        right: '8%',
80
+        bottom: '10%',
81
+        top: '6%',
82
+      },
58 83
       series: [],
59 84
     }
60 85
 
86
+    // 数据展示只展示 5 个
87
+    const endValue = source.length - 1 > 0 ? source.length - 1 : 0
88
+    const startValue = endValue - 5 > 0 ? endValue - 5 : 0
89
+
61 90
     return {
62 91
       ...defaultOpt,
63 92
       dataset: { source },
93
+      dataZoom: [{ type: 'inside', startValue, endValue }],
64 94
       series: [{
65 95
         type: 'line',
66
-        areaStyle: {},
67 96
         dimensions: ['name', 'value'],
97
+        symbolSize: 6,
98
+        smooth: true,
99
+        label: {
100
+          show: true,
101
+          formatter: '{@value}人'
102
+        },
103
+        lineStyle: {
104
+          shadowColor: colorWithOpacity(0.5),
105
+          shadowBlur: 5,
106
+          shadowOffsetY: 7
107
+        },
108
+        areaStyle: {
109
+          color: {
110
+            type: 'linear',
111
+            x: 0,
112
+            y: 0,
113
+            x2: 0,
114
+            y2: 1,
115
+            colorStops: [{
116
+              offset: 0, color: colorWithOpacity(0.2) // 0% 处的颜色
117
+            }, {
118
+              offset: 1, color: colorWithOpacity(0) // 100% 处的颜色
119
+            }],
120
+            global: false,
121
+          }
122
+        },
68 123
       }],
69 124
     }
70 125
   }
71 126
 
72
-  refreshChart(source) {    
127
+  refreshChart(source) {
73 128
     const options = this.createOptions(source)
74
-
129
+    console.log(source,"source")
75 130
     if (!this.echart) {
76 131
       if (this.ecComponent) {
77 132
         const initFunc = initChart(this.handleChart.bind(this), options)

+ 3
- 3
src/components/charts/style.scss View File

@@ -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;

+ 3256
- 13
src/components/ec-canvas/echarts.js
File diff suppressed because it is too large
View File


+ 2
- 0
src/constants/api.js View File

@@ -175,3 +175,5 @@ export const API_VISIT_RECORD = resolvePath('taPersonVisitRecord')
175 175
 export const API_ACTIVITY_LIST_CUSTOMER = resolvePath('customer/activity/list')
176 176
 export const API_FOLLOW_LIST = resolvePath('taCustomerFollowUpRecord')
177 177
 export const API_SEX_INFO = resolvePath('genderStatistic')
178
+export const API_ECHERTS_DAILY = resolvePath('customerStatisticDaily')
179
+export const API_ECHERTS_MONTH = resolvePath('customerStatisticMonthly')

+ 98
- 36
src/pages/person/customerAnalysis/analysis.js View File

@@ -6,7 +6,7 @@ import { AtTabs, AtTabsPane, AtProgress } from 'taro-ui'
6 6
 import "taro-ui/dist/style/components/tabs.scss"
7 7
 import "taro-ui/dist/style/components/progress.scss";
8 8
 import { savePoint, updatePoint } from '@services/common'
9
-import { querySexInfo } from '@services/person'
9
+import { querySexInfo, getEchartDailyInfo, getEchartMonthInfo } from '@services/person'
10 10
 import { connect } from '@tarojs/redux'
11 11
 import LineChart from "../../../components/charts/Line";
12 12
 
@@ -22,14 +22,15 @@ export default class analysis extends Taro.Component {
22 22
     current: 0,
23 23
     recordId: undefined, // 埋点ID
24 24
     sexInfo: [],
25
+    checkedWhich: 0,
25 26
     chartInfo: [
26
-      { name: '周一', value: '26' },
27
-      { name: '周二', value: '84' },
28
-      { name: '周三', value: '107' },
29
-      { name: '周四', value: '93' },
30
-      { name: '周五', value: '127' },
31
-      { name: '周六', value: '64' },
32
-      { name: '周日', value: '94' },
27
+      // { name: '周一', value: '26' },
28
+      // { name: '周二', value: '84' },
29
+      // { name: '周三', value: '107' },
30
+      // { name: '周四', value: '93' },
31
+      // { name: '周五', value: '127' },
32
+      // { name: '周六', value: '64' },
33
+      // { name: '周日', value: '94' },
33 34
     ]
34 35
   }
35 36
 
@@ -71,65 +72,126 @@ export default class analysis extends Taro.Component {
71 72
         sexInfo: res || []
72 73
       })
73 74
     })
74
-    const chartData = [
75
-      { value: 335, name: '直接访问' },
76
-      { value: 310, name: '邮件营销' },
77
-      { value: 234, name: '联盟广告' },
78
-      { value: 135, name: '视频广告' },
79
-      { value: 1548, name: '搜索引擎' }
80
-    ];
75
+    getEchartDailyInfo('new').then(res => {
76
+      let arr = []
77
+      res.map((item, index) => {
78
+        arr.push({ value: item.customerNum, name: item.day })
79
+      })
80
+      console.log(arr, "88888888888888888888888888888888888")
81
+      this.setState({
82
+        chartInfo: arr || []
83
+      })
84
+    })
85
+  }
86
+  changeDailyMonth(inx) {
87
+    const { current } = this.state
88
+    const params = current == 0 ? 'new' : current == 1 ? 'follow' : 'visite'
89
+    if (inx == 0) {
90
+      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
+        console.log(arr, "88888888888888888888888888888888888")
98
+        this.setState({
99
+          chartInfo: arr || []
100
+        })
101
+      })
102
+    } else {
103
+      getEchartMonthInfo(params).then(res => {
104
+
105
+        this.setState({
106
+        })
107
+      })
108
+    }
109
+    this.setState({
110
+      checkedWhich: inx
111
+    })
81 112
 
82 113
   }
83 114
 
84 115
   render() {
85 116
 
86 117
     const tabList = [{ title: '新增客户' }, { title: '跟进客户' }, { title: '到访客户' }]
87
-    const { sexInfo, chartInfo } = this.state
118
+    const dailyMonth = ['日', '月']
119
+    const { sexInfo, chartInfo, checkedWhich, current } = this.state
88 120
 
89 121
     return (
90 122
       <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} >
123
+        <AtTabs className="tab-bar" current={current} tabList={tabList} onClick={this.handleClick.bind(this)}>
124
+          <AtTabsPane current={current} index={0} >
93 125
             <View>
94
-              <View style="width:90vw;height:600rpx">
126
+              <View style="height:'40rpx;position: relative;">
127
+                <View className="daily-month" >
128
+                  {
129
+                    dailyMonth.map((item, index) => (
130
+                      <View key={index + 'daily'} className={checkedWhich == index ? 'checked' : 'item'} onClick={this.changeDailyMonth.bind(this, index)}>
131
+                        {item}
132
+                      </View>))
133
+                  }
134
+                </View>
135
+              </View>
136
+              <View style="width:100vw;height:530rpx">
95 137
                 <LineChart source={chartInfo} />
96 138
               </View>
97
-
98 139
               <View style="height:20rpx;background:#f5f5f5;"> </View>
99 140
               <View style="padding: 40rpx;">
100 141
                 <View style="font-size: 36rpx;color: #666;margin-bottom:20rpx;">性别</View>
101
-                {
102
-                  sexInfo.map((item, index) => (
103
-                    <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>
104
-                  ))
142
+                {sexInfo.map((item, index) => (
143
+                  <View key={index + 'sex1'} 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>
144
+                ))
105 145
                 }
106 146
               </View>
107 147
             </View>
108 148
           </AtTabsPane>
109
-          <AtTabsPane current={this.state.current} index={1}>
149
+          <AtTabsPane current={current} index={1}>
110 150
             <View>
111
-              <LineChart />
151
+              <View style="height:'40rpx;position: relative;">
152
+                <View className="daily-month" >
153
+                  {
154
+                    dailyMonth.map((item, index) => (
155
+                      <View key={index + 'month'} className={checkedWhich == index ? 'checked' : 'item'} onClick={this.changeDailyMonth.bind(this, index)}>
156
+                        {item}
157
+                      </View>))
158
+                  }
159
+                </View>
160
+              </View>
161
+              <View style="width:100vw;height:520rpx">
162
+                <LineChart source={chartInfo} />
163
+              </View>
112 164
               <View style="height:20rpx;background:#f5f5f5;"> </View>
113 165
               <View style="padding: 40rpx;">
114 166
                 <View style="font-size: 36rpx;color: #666;margin-bottom:20rpx;">性别</View>
115
-                {
116
-                  sexInfo.map((item, index) => (
117
-                    <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>
118
-                  ))
167
+                {sexInfo.map((item, index) => (
168
+                  <View key={index + 'sex2'} 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>
169
+                ))
119 170
                 }
120 171
               </View>
121 172
             </View>
122 173
           </AtTabsPane>
123
-          <AtTabsPane current={this.state.current} index={2}>
174
+          <AtTabsPane current={current} index={2}>
124 175
             <View>
125
-              <LineChart />
176
+              <View style="height:'40rpx;position: relative;">
177
+                <View className="daily-month" >
178
+                  {
179
+                    dailyMonth.map((item, index) => (
180
+                      <View key={index + 'day'} className={checkedWhich == index ? 'checked' : 'item'} onClick={this.changeDailyMonth.bind(this, index)}>
181
+                        {item}
182
+                      </View>))
183
+                  }
184
+                </View>
185
+              </View>
186
+              <View style="width:100vw;height:520rpx">
187
+                <LineChart source={chartInfo} />
188
+              </View>
126 189
               <View style="height:20rpx;background:#f5f5f5;"> </View>
127 190
               <View style="padding: 40rpx;">
128 191
                 <View style="font-size: 36rpx;color: #666;margin-bottom:20rpx;">性别</View>
129
-                {
130
-                  sexInfo.map((item, index) => (
131
-                    <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>
132
-                  ))
192
+                {sexInfo.map((item, index) => (
193
+                  <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>
194
+                ))
133 195
                 }
134 196
               </View>
135 197
             </View>

+ 31
- 0
src/pages/person/customerAnalysis/index.scss View File

@@ -5,7 +5,38 @@
5 5
   position: relative;
6 6
   height:100vh;
7 7
 }
8
+.daily-month{
9
+  display: flex;
10
+  align-items: center;
11
+  text-align: right;
12
+  padding: 0 25px;
13
+  position: absolute;
14
+  right: 0;
15
+  .item{
16
+    width:76px;
17
+    height:40px;
18
+    line-height: 40px;
19
+    background:rgba(245,245,245,1);
20
+    border-radius:4px;
21
+    color:#999990;
22
+    font-size: 28px;
23
+    text-align: center;
24
+    margin: 0 15px;
8 25
 
26
+  }
27
+  .checked{
28
+    width:76px;
29
+    height:40px;
30
+    line-height: 40px;
31
+    background:rgba(240,233,226,1);
32
+    border-radius:4px;
33
+    color:#957C60;
34
+    font-size: 28px;
35
+    margin: 0 15px;
36
+    text-align: center;
37
+  
38
+  }
39
+}
9 40
 .tab-box{
10 41
   .at-tabs__header{
11 42
     width: 86%;

+ 9
- 0
src/pages/person/customerAnalysis/myCustomer.js View File

@@ -214,6 +214,7 @@ export default class myCustomer extends Taro.Component {
214 214
       followVisible: true,
215 215
     })
216 216
   }
217
+  addFollowRecord
217 218
   followSaveBtn() {
218 219
     const { customerId } = this.$router.params
219 220
     const params = {
@@ -293,6 +294,14 @@ export default class myCustomer extends Taro.Component {
293 294
       this.setState({
294 295
         customerDetail: res || {}
295 296
       })
297
+      const params = {
298
+        recordType: '添加跟进',
299
+        customerSex: this.state.customerDetail.sex,
300
+        customerId,
301
+      }
302
+      addFollowRecord(params).then(res => {
303
+        this.queryFollowRecord(1)
304
+      })
296 305
     })
297 306
     this.setState({
298 307
       baseVisible: false,

+ 6
- 6
src/pages/person/menus.js View File

@@ -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
   ]

+ 12
- 0
src/services/person.js View File

@@ -7,6 +7,8 @@ import {
7 7
   API_ACTIVITY_LIST_CUSTOMER,
8 8
   API_FOLLOW_LIST,
9 9
   API_SEX_INFO,
10
+  API_ECHERTS_DAILY,
11
+  API_ECHERTS_MONTH
10 12
 } from '@constants/api'
11 13
 
12 14
 
@@ -15,6 +17,16 @@ import {
15 17
  * @param {*} type
16 18
  */
17 19
 export const querySexInfo = (type, payload) => fetch({ url: `${API_SEX_INFO}/${type}`, payload })
20
+/**
21
+ * 获取客户图表日数据
22
+ * @param {*} type
23
+ */
24
+export const getEchartDailyInfo = (type, payload) => fetch({ url: `${API_ECHERTS_DAILY}/${type}`, payload })
25
+/**
26
+ * 获取客户图表月数据
27
+ * @param {*} type
28
+ */
29
+export const getEchartMonthInfo = (type, payload) => fetch({ url: `${API_ECHERTS_MONTH}/${type}`, payload })
18 30
 
19 31
 /**
20 32
  * 获取我的客户数据