浏览代码

完善信息

许静 5 年前
父节点
当前提交
afd4d795ab

+ 112
- 49
src/pages/person/customerAnalysis/followUpCustomer/index.js 查看文件

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 ListView from '@components/ListView'
3
 import './index.scss'
4
 import './index.scss'
4
 import { savePoint, updatePoint } from '@services/common'
5
 import { savePoint, updatePoint } from '@services/common'
5
 import { connect } from '@tarojs/redux'
6
 import { connect } from '@tarojs/redux'
6
 import { View, Text, Picker } from '@tarojs/components';
7
 import { View, Text, Picker } from '@tarojs/components';
7
-import { queryCustomerList } from '@services/person'
8
+import { queryCustomerList, addFollowRecord } from '@services/person'
8
 const iconImg = require('@assets/person/icon.png')
9
 const iconImg = require('@assets/person/icon.png')
9
 
10
 
10
 @connect(({ user, city }) => ({ user, city }))
11
 @connect(({ user, city }) => ({ user, city }))
16
 
17
 
17
 
18
 
18
   state = {
19
   state = {
19
-    recordId: undefined, // 埋点ID
20
+
20
     customerList: [],
21
     customerList: [],
21
     inputValue: '',
22
     inputValue: '',
22
     screenVisible: false,
23
     screenVisible: false,
24
     statusIndex: -1,
25
     statusIndex: -1,
25
     startArrivalDate: '',
26
     startArrivalDate: '',
26
     endArrivalDate: '',
27
     endArrivalDate: '',
27
-    startReportDate : '',
28
+    startReportDate: '',
28
     endReportDate: '',
29
     endReportDate: '',
30
+    hasMore: true,
31
+    isEmpty: false,
32
+    recordId: undefined, // 埋点ID
33
+    pageIndex: 1
29
   }
34
   }
30
 
35
 
31
   componentWillUnmount() {
36
   componentWillUnmount() {
34
   }
39
   }
35
   componentDidShow() {
40
   componentDidShow() {
36
     Taro.showLoading()
41
     Taro.showLoading()
37
-    this.loadList()
42
+    this.loadList(1)
38
 
43
 
39
   }
44
   }
40
-  loadList() {
45
+
46
+  loadList = (page) => {
41
     const payload = {
47
     const payload = {
42
       type: 'follow',
48
       type: 'follow',
43
-      pageNumber: 0,
44
-      pageSize: 9999
49
+      pageNumber: page,
50
+      pageSize: 10
45
     }
51
     }
46
     queryCustomerList(payload.type, payload).then(res => {
52
     queryCustomerList(payload.type, payload).then(res => {
47
 
53
 
48
       this.setState({
54
       this.setState({
49
-        customerList: res.records || []
55
+        customerList: res.records || [],
56
+        isEmpty: res.total == 0,
57
+        hasMore: res.current < res.page,
58
+        pageIndex: res.current >= res.pages ? res.pages : res.current
50
       })
59
       })
51
       Taro.hideLoading()
60
       Taro.hideLoading()
52
     })
61
     })
53
   }
62
   }
54
 
63
 
64
+  onScrollToLower = async (fn) => {
65
+    const { pageIndex } = this.state;
66
+    this.loadList(pageIndex + 1)
67
+    fn && fn();
68
+  }
69
+  onPullDownRefresh = (rest) => {
70
+    // debugger
71
+    if (this.refreshing) return
72
+    this.refreshing = true
73
+    this.loadList(1)
74
+    rest && rest()
75
+    this.refreshing = false
76
+  }
77
+
55
 
78
 
56
   changeInput = e => {
79
   changeInput = e => {
57
     this.setState({
80
     this.setState({
58
       inputValue: e.detail.value
81
       inputValue: e.detail.value
59
     })
82
     })
60
   }
83
   }
84
+  // 查询
61
   searchBtn() {
85
   searchBtn() {
62
-    // const playload = {
63
-    //   inputValue: this.state.inputValue
64
-    // }
86
+
65
     this.filterCustomerList();
87
     this.filterCustomerList();
66
-   
88
+
67
   }
89
   }
68
-  filterCustomerList(){
90
+  // 筛查跟进客户
91
+  filterCustomerList() {
69
 
92
 
70
     const payload = {
93
     const payload = {
71
       type: 'follow',
94
       type: 'follow',
72
       pageNumber: 0,
95
       pageNumber: 0,
73
       pageSize: 9999,
96
       pageSize: 9999,
74
-      status:this.state.statusIndex!=0?this.state.statusIndex:'',
75
-      startArrivalDate:this.state.startArrivalDate,
97
+      name: this.state.inputValue,
98
+      status: (this.state.statusIndex == 0 || this.state.statusIndex == -1) ? '' : this.state.statusIndex,
99
+      startArrivalDate: this.state.startArrivalDate,
76
       endArrivalDate: this.state.endArrivalDate,
100
       endArrivalDate: this.state.endArrivalDate,
77
-      startReportDate : this.state.startReportDate,
101
+      startReportDate: this.state.startReportDate,
78
       endReportDate: this.state.endReportDate,
102
       endReportDate: this.state.endReportDate,
79
     }
103
     }
80
     queryCustomerList(payload.type, payload).then(res => {
104
     queryCustomerList(payload.type, payload).then(res => {
91
       screenVisible: false,
115
       screenVisible: false,
92
     })
116
     })
93
   }
117
   }
118
+  // 显示筛查弹框
94
   screenShow() {
119
   screenShow() {
95
     this.setState({
120
     this.setState({
96
       screenVisible: true,
121
       screenVisible: true,
97
     })
122
     })
98
   }
123
   }
124
+  // 选择状态
99
   chooseStatus(item, inx) {
125
   chooseStatus(item, inx) {
100
     this.setState({
126
     this.setState({
101
       statusIndex: inx,
127
       statusIndex: inx,
102
     })
128
     })
103
-    console.log(item, inx, "eeeeeeeeeeee")
104
   }
129
   }
130
+  // 到访开始时间
105
   onVisitDateChange = e => {
131
   onVisitDateChange = e => {
106
     this.setState({
132
     this.setState({
107
       startArrivalDate: e.detail.value
133
       startArrivalDate: e.detail.value
108
     })
134
     })
109
   }
135
   }
136
+  // 到访结束时间
110
   onVisitDateChange2 = e => {
137
   onVisitDateChange2 = e => {
111
     this.setState({
138
     this.setState({
112
       endArrivalDate: e.detail.value
139
       endArrivalDate: e.detail.value
113
     })
140
     })
114
   }
141
   }
142
+  // 报备开始时间
115
   onReportDateChange = e => {
143
   onReportDateChange = e => {
116
     this.setState({
144
     this.setState({
117
-      startReportDate : e.detail.value
145
+      startReportDate: e.detail.value
118
     })
146
     })
119
   }
147
   }
148
+  // 报备结束时间
120
   onReportDateChange2 = e => {
149
   onReportDateChange2 = e => {
121
     this.setState({
150
     this.setState({
122
       endReportDate: e.detail.value
151
       endReportDate: e.detail.value
123
     })
152
     })
124
   }
153
   }
125
- 
154
+  // 取消筛查
126
   cancelBtn() {
155
   cancelBtn() {
127
     this.setState({
156
     this.setState({
128
       screenVisible: false,
157
       screenVisible: false,
129
       statusIndex: -1,
158
       statusIndex: -1,
130
       startArrivalDate: '',
159
       startArrivalDate: '',
131
       endArrivalDate: '',
160
       endArrivalDate: '',
132
-      startReportDate : '',
161
+      startReportDate: '',
133
       endReportDate: '',
162
       endReportDate: '',
134
     })
163
     })
135
   }
164
   }
165
+  // 跳转我的客户详情
136
   toMyCustomer(customerId) {
166
   toMyCustomer(customerId) {
137
     Taro.navigateTo({
167
     Taro.navigateTo({
138
-      url: `/pages/person/customerAnalysis/myCustomer?customerId=`+customerId
168
+      url: `/pages/person/customerAnalysis/myCustomer?customerId=` + customerId
169
+    })
170
+  }
171
+  // 拨打电话
172
+  handleTelClick(item, e) {
173
+    e.stopPropagation()
174
+    Taro.makePhoneCall({
175
+      phoneNumber: item.phone
176
+    })
177
+    const params = {
178
+      recordType: '拨打电话',
179
+      customerSex: item.sex,
180
+      customerId: item.customerId,
181
+    }
182
+    addFollowRecord(params).then(res => {
183
+
184
+    })
185
+    this.setState({
186
+      followVisible: false,
139
     })
187
     })
140
   }
188
   }
189
+
141
   renderScreenBox() {
190
   renderScreenBox() {
142
-    const { statusList, statusIndex, startArrivalDate, endArrivalDate, startReportDate , endReportDate } = this.state
191
+    const { statusList, statusIndex, startArrivalDate, endArrivalDate, startReportDate, endReportDate } = this.state
143
     return (
192
     return (
144
       <View className="mask">
193
       <View className="mask">
145
         <View className="content">
194
         <View className="content">
159
                 {!startArrivalDate && <Text className="placeholder">起始时间</Text>}
208
                 {!startArrivalDate && <Text className="placeholder">起始时间</Text>}
160
               </View>
209
               </View>
161
             </Picker>-<Picker mode='date' onChange={this.onVisitDateChange2}>
210
             </Picker>-<Picker mode='date' onChange={this.onVisitDateChange2}>
162
-              <View className='picker'> 
211
+              <View className='picker'>
163
                 {endArrivalDate}
212
                 {endArrivalDate}
164
                 {!endArrivalDate && <Text className="placeholder">结束时间</Text>}
213
                 {!endArrivalDate && <Text className="placeholder">结束时间</Text>}
165
               </View>
214
               </View>
169
             报备时间:
218
             报备时间:
170
               <Picker mode='date' onChange={this.onReportDateChange}>
219
               <Picker mode='date' onChange={this.onReportDateChange}>
171
               <View className='picker'>
220
               <View className='picker'>
172
-                {startReportDate }
173
-                {!startReportDate  && <Text className="placeholder">起始时间</Text>}
221
+                {startReportDate}
222
+                {!startReportDate && <Text className="placeholder">起始时间</Text>}
174
               </View>
223
               </View>
175
             </Picker>-<Picker mode='date' onChange={this.onReportDateChange2}>
224
             </Picker>-<Picker mode='date' onChange={this.onReportDateChange2}>
176
               <View className='picker'>
225
               <View className='picker'>
195
   }
244
   }
196
 
245
 
197
   render() {
246
   render() {
198
-    const { customerList, screenVisible } = this.state
247
+    const { customerList, screenVisible, isEmpty, hasMore } = this.state
199
 
248
 
200
     return (
249
     return (
201
       <View>
250
       <View>
208
           <Button className="btn" onClick={this.searchBtn} >搜索</Button>
257
           <Button className="btn" onClick={this.searchBtn} >搜索</Button>
209
         </View>
258
         </View>
210
         <View style="padding:10px">
259
         <View style="padding:10px">
211
-          {
212
-            !customerList.length &&
213
-            <View style="margin:50px auto;text-align:center;font-size:14px;color:#888">暂无跟进客户~</View>
214
-          }
215
-          {
216
-            customerList.length &&
217
-            customerList.map((item, index) => (
218
-              <View class="item" key={index + 'customerList'} onClick={this.toMyCustomer.bind(this,item.customerId)}>
219
-                <Image src={item.picture || require('@assets/default-avatar.png')} className='img'></Image>
220
-                <View className="name">
221
-                  {item.name}
222
-                  {
223
-                    item.sex == '1' && <View style={`margin-left:10px;background-image: url(${iconImg});background-size: 100%;background-position: 0px -20px;width: 18px;height: 18px;`}></View>
224
-                  }
225
-                  {
226
-                    item.sex == '2' && <View style={`margin-left:10px;background-image: url(${iconImg});background-size: 100%;background-position: 0px 0px;width: 18px;height: 18px;`}></View>
227
-                  }
228
-                </View>
229
-                <View className="phone">{item.phone}<View style={`background-image: url(${iconImg});background-size: 100%;background-position: 0px -44px;width: 22px;height: 22px;`}></View> </View>
230
-                <View className="status">报备</View>
231
-              </View>
232
-            ))
233
-          }
260
+          <ListView
261
+            className="wrap"
262
+            needInit
263
+            isEmpty={isEmpty}
264
+            emptyText="暂无活动~"
265
+            hasMore={hasMore}
266
+            onPullDownRefresh={fn => this.onPullDownRefresh(fn)}
267
+            onScrollToLower={fn => this.onScrollToLower(fn)}
268
+          >
269
+            <View className="list">
270
+              {
271
+                !customerList.length &&
272
+                <View style="margin:50px auto;text-align:center;font-size:14px;color:#888">暂无跟进客户~</View>
273
+              }
274
+              {
275
+                customerList.length &&
276
+                customerList.map((item, index) => (
277
+                  <View class="item" key={index + 'customerList'} onClick={this.toMyCustomer.bind(this, item.customerId)}>
278
+                    <Image src={item.picture || require('@assets/default-avatar.png')} className='img'></Image>
279
+                    <View className="name">
280
+                      {item.name}
281
+                      {
282
+                        item.sex == '1' && <View style={`margin-left:20rpx;background-image: url(${iconImg});background-size: 100%;background-position: 0rpx -40rpx;width: 36rpx;height: 36rpx;`}></View>
283
+                      }
284
+                      {
285
+                        item.sex == '2' && <View style={`margin-left:20rpx;background-image: url(${iconImg});background-size: 100%;background-position: 0rpx 0px;width: 36rpx;height: 36rpx;`}></View>
286
+                      }
287
+                    </View>
288
+                    <View className="phone" onClick={this.handleTelClick.bind(this, item)}>{item.phone}<View style={`background-image: url(${iconImg});background-size: 100%;background-position: 0rpx -88rpx;width: 44rpx;height: 44rpx;margin-left:10rpx`}></View> </View>
289
+                    <View className="status">报备</View>
290
+                  </View>
291
+                ))
292
+              }
293
+            </View>
294
+          </ListView>
295
+
296
+
234
         </View>
297
         </View>
235
       </View>
298
       </View>
236
     )
299
     )

+ 35
- 17
src/pages/person/customerAnalysis/index.scss 查看文件

84
     }
84
     }
85
   }
85
   }
86
 }
86
 }
87
-
87
+.empty{
88
+  width:100%;
89
+  height:40vh;
90
+  display: flex;
91
+  flex-direction: column;
92
+  justify-content: center;
93
+  align-items: center;
94
+  &__img{
95
+    width:300px;
96
+  }
97
+  &__text{
98
+    font-size:30px;
99
+    color: $text-color-light;
100
+    margin-top: 20px;
101
+  }
102
+}
88
 
103
 
89
 .user_con{
104
 .user_con{
90
   margin: 0 20px 40px 20px;
105
   margin: 0 20px 40px 20px;
127
     position: absolute;
142
     position: absolute;
128
     bottom:76px;
143
     bottom:76px;
129
     left:320px;
144
     left:320px;
145
+    display: flex;
146
+    align-items: center;
130
   }
147
   }
131
   }
148
   }
132
   .my-tab{
149
   .my-tab{
185
 
202
 
186
     }
203
     }
187
     .tab-pane2{
204
     .tab-pane2{
188
-      padding: 0 40px;
189
-      .date{
190
-        font-size: 26px;
191
-        color: #999;
192
-        margin-top: 30px;
193
-      }
205
+      padding: 10px 0;
194
       .record-item{
206
       .record-item{
195
-        font-size: 30px;
196
-        margin-top: 20px;
197
-        color: #333;
198
-        display: flex;
199
-        align-items: center;
200
-        justify-content: space-between;
207
+        padding:0 30px;
208
+        background:rgba(255,255,255,1);
209
+        box-shadow:0px 1px 0px 0px rgba(0,0,0,0.08);
210
+        .title{
211
+          font-size: 30px;
212
+          color: #333;
213
+          margin-top: 20px;
214
+        }
201
         .time{
215
         .time{
202
           font-size: 26px;
216
           font-size: 26px;
203
           color: #999;
217
           color: #999;
218
+          text-align: right;
219
+          line-height: 46px;
204
         }
220
         }
205
       }
221
       }
206
     }
222
     }
240
     background:rgba(0,0,0,0.22);
256
     background:rgba(0,0,0,0.22);
241
     .base-con{
257
     .base-con{
242
       width: 94%;
258
       width: 94%;
243
-      height:610px;
259
+      height:740px;
244
       position: absolute;
260
       position: absolute;
245
       left: 3%;
261
       left: 3%;
246
       top: 50%;
262
       top: 50%;
247
       background-color: #fff;
263
       background-color: #fff;
248
       padding: 40px;
264
       padding: 40px;
249
-      margin-top: -305px;
265
+      margin-top: -370px;
250
       border-radius:12px;
266
       border-radius:12px;
251
       .con-item{
267
       .con-item{
252
         display: flex;
268
         display: flex;
275
         align-items: center;
291
         align-items: center;
276
         justify-content: space-between;
292
         justify-content: space-between;
277
         width:456px;
293
         width:456px;
294
+        padding: 16px;
295
+        background-color: #f4f4f4;
278
       }
296
       }
279
       .right-icon{
297
       .right-icon{
280
-        width:20px;
281
-        height:20px;
298
+        width:18px;
299
+        height:18px;
282
         border-top: 2px solid #999;
300
         border-top: 2px solid #999;
283
         border-right: 2px solid #999;
301
         border-right: 2px solid #999;
284
         transform:rotate(45deg);
302
         transform:rotate(45deg);

+ 191
- 77
src/pages/person/customerAnalysis/myCustomer.js 查看文件

2
 import { AtTabs, AtTabsPane } from 'taro-ui'
2
 import { AtTabs, AtTabsPane } from 'taro-ui'
3
 import "taro-ui/dist/style/components/tabs.scss"
3
 import "taro-ui/dist/style/components/tabs.scss"
4
 import { savePoint, updatePoint } from '@services/common'
4
 import { savePoint, updatePoint } from '@services/common'
5
-import { getCustomerDetail, getVisitRecord, getActivityList, getFollowRecord } from '@services/person'
5
+import { getCustomerDetail, getVisitRecord, getActivityList, getFollowRecord, addFollowRecord } from '@services/person'
6
 import { connect } from '@tarojs/redux'
6
 import { connect } from '@tarojs/redux'
7
 import './index.scss'
7
 import './index.scss'
8
 import ActivityItem from './item'
8
 import ActivityItem from './item'
9
 import dayjs from 'dayjs'
9
 import dayjs from 'dayjs'
10
 const iconImg = require('@assets/person/icon.png')
10
 const iconImg = require('@assets/person/icon.png')
11
+import emptyImg from '@assets/empty.png'
11
 
12
 
12
 @connect(({ user, city }) => ({ user, city }))
13
 @connect(({ user, city }) => ({ user, city }))
13
 export default class myCustomer extends Taro.Component {
14
 export default class myCustomer extends Taro.Component {
22
     activityList: [],
23
     activityList: [],
23
     followVisible: false,
24
     followVisible: false,
24
     baseVisible: false,
25
     baseVisible: false,
25
-    message: '', //跟进内容
26
+    followValue: '', //跟进内容
26
     desc: '', //客户描述
27
     desc: '', //客户描述
27
-    selectorChecked: '',
28
-    selector: ['美国', '中国', '巴西', '日本'],
28
+    selector: ['高层', '别墅', '公寓'],
29
+    sexSelector: ['男', '女'],
29
     customerDetail: {},
30
     customerDetail: {},
30
-    followRecord: []
31
+    followRecord: [],
32
+    visitRecord: [],
33
+    baseInfo: {}, // 完善信息弹框数据
31
 
34
 
32
   }
35
   }
33
 
36
 
38
   }
41
   }
39
 
42
 
40
   handleClick(value) {
43
   handleClick(value) {
44
+    this.setState({
45
+      current: value
46
+    })
41
     if (value == 1) {
47
     if (value == 1) {
42
-      const { customerId } = this.$router.params
43
-      const payload = {
44
-        pageNumber: '0',
45
-        pageSize: '10',
46
-        customerId,
47
-      }
48
-      getVisitRecord(payload).then(res => {
49
-        // this.setState({
50
-        //   customerDetail: res || {}
51
-        // })
52
-      })
48
+      this.queryVisitRecord();
53
     } else if (value == 2) {
49
     } else if (value == 2) {
54
-      const { customerId } = this.$router.params
55
-      const payload = {
56
-        pageNumber: '0',
57
-        pageSize: '10',
58
-        customerId,
59
-      }
60
-      getActivityList(payload).then(res => {
61
-        this.setState({
62
-          activityList: res.records || []
63
-        })
64
-      })
50
+      this.queryActivityList();
65
     } else if (value == 3) {
51
     } else if (value == 3) {
66
-      const { customerId } = this.$router.params
67
-      const payload = {
68
-        pageNumber: '0',
69
-        pageSize: '10',
70
-        customerId,
71
-      }
72
-      getFollowRecord(payload).then(res => {
73
-        console.log(res.records,"res")
74
-        this.setState({
75
-          followRecord: res.records 
76
-        }, console.log(this.state.followRecord, "followRecord")
77
-        )
52
+      this.queryFollowRecord();
53
+    }
54
+  }
55
+  // 获取访问记录
56
+  queryVisitRecord() {
57
+    const { customerId } = this.$router.params
58
+    const payload = {
59
+      pageNumber: '0',
60
+      pageSize: '10',
61
+      customerId,
62
+    }
63
+    getVisitRecord(payload).then(res => {
64
+      this.setState({
65
+        visitRecord: res.records || []
78
       })
66
       })
67
+    })
68
+  }
69
+  // 获取活动信息
70
+  queryActivityList() {
71
+    const { customerId } = this.$router.params
72
+    const payload = {
73
+      pageNumber: '0',
74
+      pageSize: '10',
75
+      customerId,
79
     }
76
     }
80
-    this.setState({
81
-      current: value
82
-    }, )
77
+    getActivityList(payload).then(res => {
78
+      this.setState({
79
+        activityList: res.records || []
80
+      })
81
+    })
82
+  }
83
+  // 获取跟进记录
84
+  queryFollowRecord() {
85
+    const { customerId } = this.$router.params
86
+    const payload = {
87
+      pageNumber: '0',
88
+      pageSize: '30',
89
+      customerId,
90
+    }
91
+    getFollowRecord(payload).then(res => {
92
+      this.setState({
93
+        followRecord: res.records
94
+      })
95
+    })
83
   }
96
   }
84
-
85
   componentDidShow() {
97
   componentDidShow() {
86
-
87
     this.loadList()
98
     this.loadList()
88
   }
99
   }
89
   loadList() {
100
   loadList() {
125
       followVisible: true,
136
       followVisible: true,
126
     })
137
     })
127
   }
138
   }
128
-  saveBtn() {
139
+  followSaveBtn() {
140
+    const { customerId } = this.$router.params
141
+    const params = {
142
+      recordType: '添加跟进',
143
+      recordContent: this.state.followValue,
144
+      customerSex: this.state.customerDetail.sex,
145
+      customerId,
146
+    }
147
+    addFollowRecord(params).then(res => {
148
+      this.queryFollowRecord()
149
+    })
129
     this.setState({
150
     this.setState({
130
       followVisible: false,
151
       followVisible: false,
152
+      followValue: '',
131
     })
153
     })
132
   }
154
   }
133
-  cancelBtn() {
155
+  followCancelBtn() {
134
     this.setState({
156
     this.setState({
135
       followVisible: false,
157
       followVisible: false,
158
+      followValue: '',
136
     })
159
     })
137
   }
160
   }
138
   onTextareaChange(e) {
161
   onTextareaChange(e) {
139
     this.setState({
162
     this.setState({
140
-      message: e.target.value
163
+      followValue: e.target.value
141
     })
164
     })
142
   }
165
   }
143
   renderFollowBox() {
166
   renderFollowBox() {
144
-    const { message } = this.state
167
+    const { followValue } = this.state
145
     return (
168
     return (
146
       <View className="mask">
169
       <View className="mask">
147
         <View className="content">
170
         <View className="content">
151
             </View>
174
             </View>
152
             <Textarea
175
             <Textarea
153
               className="textarea"
176
               className="textarea"
154
-              value={message}
177
+              value={followValue}
155
               onInput={this.onTextareaChange}
178
               onInput={this.onTextareaChange}
156
               maxLength={150}
179
               maxLength={150}
157
               placeholder='不超过150字'
180
               placeholder='不超过150字'
158
             />
181
             />
159
           </View>
182
           </View>
160
           <View className="bottom-btn">
183
           <View className="bottom-btn">
161
-            <View className="save" onClick={this.saveBtn}>
184
+            <View className="save" onClick={this.followSaveBtn}>
162
               保存
185
               保存
163
             </View>
186
             </View>
164
-            <View className="cancel" onClick={this.cancelBtn}>
187
+            <View className="cancel" onClick={this.followCancelBtn}>
165
               取消
188
               取消
166
           </View>
189
           </View>
167
           </View>
190
           </View>
172
   perfectInformation() {
195
   perfectInformation() {
173
     this.setState({
196
     this.setState({
174
       baseVisible: true,
197
       baseVisible: true,
198
+      baseInfo: this.state.customerDetail,
175
     })
199
     })
176
   }
200
   }
177
   baseSaveBtn() {
201
   baseSaveBtn() {
184
       baseVisible: false,
208
       baseVisible: false,
185
     })
209
     })
186
   }
210
   }
211
+  onPriceRangeChange(e) {
212
+    this.setState({
213
+      baseInfo: {
214
+        ...baseInfo,
215
+        priceRange: e.target.value
216
+      }
217
+    })
218
+  }
187
   onBaseTextareaChange(e) {
219
   onBaseTextareaChange(e) {
188
     this.setState({
220
     this.setState({
189
-      desc: e.target.value
221
+      baseInfo: {
222
+        ...baseInfo,
223
+        describe: e.target.value
224
+      }
190
     })
225
     })
191
   }
226
   }
192
   onChange = e => {
227
   onChange = e => {
193
     this.setState({
228
     this.setState({
194
-      selectorChecked: this.state.selector[e.detail.value]
229
+      baseInfo: {
230
+        ...baseInfo,
231
+        sex: this.state.selector[e.detail.value]
232
+      }
233
+    })
234
+  }
235
+  onSexChange = e => {
236
+    console, log(e, "eeeeeeeeeeeeeee")
237
+    this.setState({
238
+      baseInfo: {
239
+        ...baseInfo,
240
+        sex: this.state.sexSelector[e.detail.value]
241
+      }
242
+    })
243
+  }
244
+  // 拨打电话
245
+  handleTelClick(customer, e) {
246
+    e.stopPropagation()
247
+    Taro.makePhoneCall({
248
+      phoneNumber: customer.phone
249
+    })
250
+    const params = {
251
+      recordType: '拨打电话',
252
+      customerSex: customer.sex,
253
+      customerId: customer.customerId,
254
+    }
255
+    addFollowRecord(params).then(res => {
256
+      this.queryFollowRecord()
257
+    })
258
+    this.setState({
259
+      followVisible: false,
195
     })
260
     })
196
   }
261
   }
197
   renderBaseBox() {
262
   renderBaseBox() {
198
-    const { desc, selector, selectorChecked } = this.state
263
+    const { baseInfo, desc, selector, selectorChecked, sexSelector, sexSelectorChecked } = this.state
199
     return (
264
     return (
200
       <View className="mask">
265
       <View className="mask">
201
         <View className="base-con">
266
         <View className="base-con">
267
+          <View className="con-item">
268
+            <View style="font-size:14px;color:#666">
269
+              姓名:
270
+            </View>
271
+            <Input className="input" value={baseInfo.name} onInput={this.onNameChange} placeholder='' />
272
+          </View>
273
+          <View className="con-item">
274
+            <View style="font-size:14px;color:#666">
275
+              性别:
276
+            </View>
277
+            <View className="con-picker" >
278
+              <View>
279
+                <Picker mode='selector' range={sexSelector} onChange={this.onSexChange}>
280
+                  <View className='picker'>
281
+                    {baseInfo.sex == '1' ? '男' : baseInfo.sex == '1' ? '女' : ''}
282
+                  </View>
283
+                </Picker>
284
+              </View>
285
+              <View className="right-icon"></View>
286
+            </View>
287
+          </View>
202
           <View className="con-item">
288
           <View className="con-item">
203
             <View style="font-size:14px;color:#666">
289
             <View style="font-size:14px;color:#666">
204
               物业类型:
290
               物业类型:
205
             </View>
291
             </View>
206
-            <Input className="input" value={desc} onInput={this.onBaseTextareaChange} placeholder='' />
292
+            <Input className="input" value={baseInfo.realtyManageType} onInput={this.onManageTypeChange} placeholder='' />
207
           </View>
293
           </View>
208
           <View className="con-item">
294
           <View className="con-item">
209
             <View style="font-size:14px;color:#666">
295
             <View style="font-size:14px;color:#666">
213
               <View>
299
               <View>
214
                 <Picker mode='selector' range={selector} onChange={this.onChange}>
300
                 <Picker mode='selector' range={selector} onChange={this.onChange}>
215
                   <View className='picker'>
301
                   <View className='picker'>
216
-                    当前选择:{selectorChecked}
302
+                    {baseInfo.demandType || ''}
217
                   </View>
303
                   </View>
218
                 </Picker>
304
                 </Picker>
219
               </View>
305
               </View>
224
             <View style="font-size:14px;color:#666">
310
             <View style="font-size:14px;color:#666">
225
               价格区间:
311
               价格区间:
226
             </View>
312
             </View>
227
-            <Input className="input" value={desc} onInput={this.onBaseTextareaChange} placeholder='' />
313
+            <Input className="input" value={baseInfo.priceRange} onInput={this.onPriceRangeChange} placeholder='' />
228
           </View>
314
           </View>
229
           <View style="display:flex;justify-content: space-between;">
315
           <View style="display:flex;justify-content: space-between;">
230
             <View style="font-size:14px;color:#666">
316
             <View style="font-size:14px;color:#666">
232
             </View>
318
             </View>
233
             <Textarea
319
             <Textarea
234
               className="textarea"
320
               className="textarea"
235
-              value={desc}
321
+              value={baseInfo.describe}
236
               onInput={this.onBaseTextareaChange}
322
               onInput={this.onBaseTextareaChange}
237
               maxLength={150}
323
               maxLength={150}
238
-              placeholder='不超过150字'
324
+              placeholder=''
239
             />
325
             />
240
           </View>
326
           </View>
241
           <View className="bottom-btn">
327
           <View className="bottom-btn">
255
   render() {
341
   render() {
256
 
342
 
257
     const tabList = [{ title: '基本信息' }, { title: '访问记录' }, { title: '活动信息' }, { title: '跟进记录' }]
343
     const tabList = [{ title: '基本信息' }, { title: '访问记录' }, { title: '活动信息' }, { title: '跟进记录' }]
258
-    const { customerDetail, activityList, followRecord, followVisible, baseVisible } = this.state
344
+    const { customerDetail, visitRecord, activityList, followRecord, followVisible, baseVisible, } = this.state
259
     return (
345
     return (
260
       <View>
346
       <View>
261
         {followVisible && this.renderFollowBox()}
347
         {followVisible && this.renderFollowBox()}
272
               customerDetail.sex == '2' && <View style={`margin-left:10px;background-image: url(${iconImg});background-size: 100%;background-position: 0px 0px;width: 18px;height: 18px;`}></View>
358
               customerDetail.sex == '2' && <View style={`margin-left:10px;background-image: url(${iconImg});background-size: 100%;background-position: 0px 0px;width: 18px;height: 18px;`}></View>
273
             }
359
             }
274
           </View>
360
           </View>
275
-          <View className='user__left__phone'>{customerDetail.phone}</View>
361
+          <View onClick={this.handleTelClick.bind(this, customerDetail)} className='user__left__phone'>{customerDetail.phone}<View style={`background-image: url(${iconImg});background-size: 100%;background-position: 0rpx -88rpx;width: 44rpx;height: 44rpx;margin-left:10rpx`}></View></View>
276
         </View>
362
         </View>
277
         <AtTabs className="my-tab" current={this.state.current} tabList={tabList} onClick={this.handleClick.bind(this)}>
363
         <AtTabs className="my-tab" current={this.state.current} tabList={tabList} onClick={this.handleClick.bind(this)}>
278
           <AtTabsPane current={this.state.current} index={0} >
364
           <AtTabsPane current={this.state.current} index={0} >
288
           </AtTabsPane>
374
           </AtTabsPane>
289
           <AtTabsPane current={this.state.current} index={1}>
375
           <AtTabsPane current={this.state.current} index={1}>
290
             <View className="tab-pane2 pane">
376
             <View className="tab-pane2 pane">
291
-              <View className="date">2019年11月11日</View>
292
-              <View className="record-item"><View >查看项目详情:银城悦见山</View><View className="time">12:30:00</View> </View>
293
-              <View className="record-item"><View >查看项目详情:银城悦见山</View><View className="time">12:30:00</View> </View>
294
-              <View className="record-item"><View >查看项目详情:银城悦见山</View><View className="time">12:30:00</View> </View>
295
-              <View className="date">2019年11月11日</View>
296
-              <View className="record-item"><View >查看项目详情:银城悦见山</View><View className="time">12:30:00</View> </View>
297
-              <View className="record-item"><View >查看项目详情:银城悦见山</View><View className="time">12:30:00</View> </View>
298
-              <View className="record-item"><View >查看项目详情:银城悦见山</View><View className="time">12:30:00</View> </View>
377
+              {visitRecord.length && visitRecord.map(item => (
378
+                <View className="record-item">
379
+                  <View className="title" >{item.activity}</View>
380
+                  <View className="time">{dayjs(item.visitTime).format('YYYY年MM月DD日 HH:mm:ss') || ''}</View>
381
+                </View>
382
+              ))
383
+              }
384
+              {!visitRecord.length &&
385
+                <View className="empty">
386
+                  <Image className="empty__img" mode="widthFix" src={emptyImg}></Image>
387
+                  <View className="empty__text">暂无访问记录~</View>
388
+                </View>
389
+              }
390
+
299
             </View>
391
             </View>
300
           </AtTabsPane>
392
           </AtTabsPane>
301
           <AtTabsPane current={this.state.current} index={2}>
393
           <AtTabsPane current={this.state.current} index={2}>
302
             <View className="tab-pane3 pane">
394
             <View className="tab-pane3 pane">
303
-              {activityList.length > 0 &&
395
+              {!activityList.length &&
396
+                <View className="empty">
397
+                  <Image className="empty__img" mode="widthFix" src={emptyImg}></Image>
398
+                  <View className="empty__text">暂无活动信息~</View>
399
+                </View>
400
+              }
401
+              {activityList.length &&
304
                 activityList.map(item => (
402
                 activityList.map(item => (
305
                   <ActivityItem
403
                   <ActivityItem
306
                     data={item}
404
                     data={item}
313
           </AtTabsPane>
411
           </AtTabsPane>
314
           <AtTabsPane current={this.state.current} index={3}>
412
           <AtTabsPane current={this.state.current} index={3}>
315
             <View style="padding:10px 20px 120px 20px">
413
             <View style="padding:10px 20px 120px 20px">
316
-              {/* {followRecord.map(item => {
317
-                <View style=" display: flex;justify-content: space-between;align-items: center;color: #333;font-size: 16px;"> */}
318
-                  {/* <View style=" display: flex;align-items: center;"><View style="width:8px;height:8px;margin-right:10px;display:inline-block;background:rgba(246,182,29,1);border-radius: 50%;"></View>{item.recordType}</View>
319
-                    <View classNam="time" style=" font-size: 13px;color: #999;">{dayjs(item.createDate).format('YYYY-MM-DD') || ''}</View> */}
320
-                {/* </View>
321
-              })
322
-              } */}
414
+              {followRecord.length && followRecord.map(item => (
415
+                <View>
416
+                  <View style=" display:flex;justify-content: space-between;align-items: center;color: #333;font-size: 16px; margin-bottom:20rpx;">
417
+                    <View style=" display: flex;align-items: center;"><View style="width:8px;height:8px;margin-right:20rpx;display:inline-block;background:rgba(246,182,29,1);border-radius: 50%;"></View>{item.recordType}</View>
418
+                    <View classNam="time" style=" font-size: 26rpx;color: #999;">{dayjs(item.createDate).format('YYYY年MM月DD日 HH:mm:ss') || ''}</View>
419
+                  </View>
420
+                  {
421
+                    item.recordContent &&
422
+                    <View style="font-size:28rpx;color:#666;padding-left:32rpx;margin-bottom:20rpx;">
423
+                      {item.recordContent}
424
+                    </View>
425
+                  }
426
+
427
+                </View>
428
+              ))
429
+              }
430
+              {!followRecord.length &&
431
+                <View className="empty">
432
+                  <Image className="empty__img" mode="widthFix" src={emptyImg}></Image>
433
+                  <View className="empty__text">暂无跟进记录~</View>
434
+                </View>
435
+              }
436
+
323
               <View className="btn" onClick={this.addFollow}>添加跟进</View>
437
               <View className="btn" onClick={this.addFollow}>添加跟进</View>
324
             </View>
438
             </View>
325
 
439
 

+ 10
- 5
src/services/person.js 查看文件

19
  * 获取客户列表
19
  * 获取客户列表
20
  * @param {*} type  
20
  * @param {*} type  
21
  */
21
  */
22
-export const  queryCustomerList = (type, payload) => fetch({ url: `${API_CUSTOMER_LIST}/${type}`, payload })
22
+export const queryCustomerList = (type, payload) => fetch({ url: `${API_CUSTOMER_LIST}/${type}`, payload })
23
 /**
23
 /**
24
  * 获取客户列表
24
  * 获取客户列表
25
  * @param {*} customerId  
25
  * @param {*} customerId  
26
  */
26
  */
27
-export const  getCustomerDetail = (customerId, payload) => fetch({ url: `${API_CUSTOMER_DETAIL}/${customerId}`, payload })
27
+export const getCustomerDetail = (customerId, payload) => fetch({ url: `${API_CUSTOMER_DETAIL}/${customerId}`, payload })
28
 /**
28
 /**
29
  * 获取访问记录
29
  * 获取访问记录
30
  * @param {*} payload  
30
  * @param {*} payload  
31
  */
31
  */
32
-export const  getVisitRecord = ( payload) => fetch({ url: API_VISIT_RECORD, payload })
32
+export const getVisitRecord = (payload) => fetch({ url: API_VISIT_RECORD, payload })
33
 /**
33
 /**
34
  * 获取活动信息
34
  * 获取活动信息
35
  * @param {*} payload  
35
  * @param {*} payload  
36
  */
36
  */
37
-export const  getActivityList = ( payload) => fetch({ url: API_ACTIVITY_LIST_CUSTOMER, payload })
37
+export const getActivityList = (payload) => fetch({ url: API_ACTIVITY_LIST_CUSTOMER, payload })
38
 /**
38
 /**
39
  * 获取跟进记录
39
  * 获取跟进记录
40
  * @param {*} payload  
40
  * @param {*} payload  
41
  */
41
  */
42
-export const  getFollowRecord = ( payload) => fetch({ url: API_FOLLOW_LIST, payload })
42
+export const getFollowRecord = (payload) => fetch({ url: API_FOLLOW_LIST, payload })
43
+/**
44
+ * 添加跟进记录
45
+ * @param {*} payload  
46
+ */
47
+export const addFollowRecord = (payload) => fetch({ url: API_FOLLOW_LIST, payload, method: 'POST' })
43
 
48
 
44
 
49
 
45
 
50