许静 5 vuotta sitten
vanhempi
commit
3bd2aacc0c

+ 2
- 2
config/dev.js Näytä tiedosto

@@ -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: {}

+ 39
- 5
src/components/charts/Line.js Näytä tiedosto

@@ -42,7 +42,7 @@ export default class LineChart extends Component {
42 42
     return false
43 43
   }
44 44
 
45
-  handleEcComponent (ref) {
45
+  handleEcComponent(ref) {
46 46
     this.ecComponent = ref
47 47
   }
48 48
 
@@ -52,24 +52,58 @@ export default class LineChart extends Component {
52 52
 
53 53
   createOptions(source = []) {
54 54
     const defaultOpt = {
55
-      color: ['#BB9C79', '#666666'],
56
-      xAxis: { type: 'category' },
57
-      yAxis: { type: 'value' },
55
+      color: ['#BB9C79'],
56
+      xAxis: {
57
+        type: 'category',
58
+        axisLine: {
59
+          lineStyle: {
60
+            color: '#DEDEDE'
61
+          }
62
+        },
63
+        axisLabel: {
64
+          textStyle: {
65
+            color: '#666'
66
+          }
67
+        }
68
+      },
69
+      yAxis: {
70
+        type: 'value',
71
+        axisLine: {
72
+          lineStyle: {
73
+            color: '#DEDEDE'
74
+          }
75
+        },
76
+        axisLabel: {
77
+          textStyle: {
78
+            color: '#666'
79
+          }
80
+        }
81
+      },
82
+
58 83
       series: [],
59 84
     }
60 85
 
61 86
     return {
62 87
       ...defaultOpt,
63 88
       dataset: { source },
89
+
64 90
       series: [{
65 91
         type: 'line',
92
+        smooth: true,
66 93
         areaStyle: {},
94
+        symbolSize: 6,
67 95
         dimensions: ['name', 'value'],
96
+        label: {
97
+          normal: {
98
+            show: true,
99
+            position: 'top'
100
+          }
101
+        },
68 102
       }],
69 103
     }
70 104
   }
71 105
 
72
-  refreshChart(source) {    
106
+  refreshChart(source) {
73 107
     const options = this.createOptions(source)
74 108
 
75 109
     if (!this.echart) {

+ 2
- 0
src/constants/api.js Näytä tiedosto

@@ -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')

+ 20
- 10
src/pages/person/customerAnalysis/analysis.js Näytä tiedosto

@@ -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,6 +22,7 @@ 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 27
       { name: '周一', value: '26' },
27 28
       { name: '周二', value: '84' },
@@ -71,20 +72,19 @@ 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
-    ];
81
-
75
+    getEchartDailyInfo('new').then(res => {
76
+      console.log(res, "res")
77
+      this.setState({
78
+        // sexInfo: res || []
79
+      })
80
+    })
82 81
   }
83 82
 
84 83
   render() {
85 84
 
86 85
     const tabList = [{ title: '新增客户' }, { title: '跟进客户' }, { title: '到访客户' }]
87
-    const { sexInfo, chartInfo } = this.state
86
+    const dailyMonth = ['日', '月']
87
+    const { sexInfo, chartInfo, checkedWhich } = this.state
88 88
 
89 89
     return (
90 90
       <View>
@@ -92,6 +92,16 @@ export default class analysis extends Taro.Component {
92 92
           <AtTabsPane current={this.state.current} index={0} >
93 93
             <View>
94 94
               <View style="width:90vw;height:600rpx">
95
+                <View className="daily-month" >
96
+                  {
97
+                    dailyMonth.map((item, index) => (
98
+                      <View className={checkedWhich == index ? 'checked' : 'item'}>
99
+                        {item}
100
+                      </View>
101
+                    ))
102
+                  }
103
+
104
+                </View>
95 105
                 <LineChart source={chartInfo} />
96 106
               </View>
97 107
 

+ 28
- 1
src/pages/person/customerAnalysis/index.scss Näytä tiedosto

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

+ 9
- 0
src/pages/person/customerAnalysis/myCustomer.js Näytä tiedosto

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

+ 12
- 0
src/services/person.js Näytä tiedosto

@@ -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
  * 获取我的客户数据