|
@@ -2,12 +2,13 @@ import Taro, { Component } from '@tarojs/taro';
|
2
|
2
|
import { AtTabs, AtTabsPane } from 'taro-ui'
|
3
|
3
|
import "taro-ui/dist/style/components/tabs.scss"
|
4
|
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
|
6
|
import { connect } from '@tarojs/redux'
|
7
|
7
|
import './index.scss'
|
8
|
8
|
import ActivityItem from './item'
|
9
|
9
|
import dayjs from 'dayjs'
|
10
|
10
|
const iconImg = require('@assets/person/icon.png')
|
|
11
|
+import emptyImg from '@assets/empty.png'
|
11
|
12
|
|
12
|
13
|
@connect(({ user, city }) => ({ user, city }))
|
13
|
14
|
export default class myCustomer extends Taro.Component {
|
|
@@ -22,12 +23,14 @@ export default class myCustomer extends Taro.Component {
|
22
|
23
|
activityList: [],
|
23
|
24
|
followVisible: false,
|
24
|
25
|
baseVisible: false,
|
25
|
|
- message: '', //跟进内容
|
|
26
|
+ followValue: '', //跟进内容
|
26
|
27
|
desc: '', //客户描述
|
27
|
|
- selectorChecked: '',
|
28
|
|
- selector: ['美国', '中国', '巴西', '日本'],
|
|
28
|
+ selector: ['高层', '别墅', '公寓'],
|
|
29
|
+ sexSelector: ['男', '女'],
|
29
|
30
|
customerDetail: {},
|
30
|
|
- followRecord: []
|
|
31
|
+ followRecord: [],
|
|
32
|
+ visitRecord: [],
|
|
33
|
+ baseInfo: {}, // 完善信息弹框数据
|
31
|
34
|
|
32
|
35
|
}
|
33
|
36
|
|
|
@@ -38,52 +41,60 @@ export default class myCustomer extends Taro.Component {
|
38
|
41
|
}
|
39
|
42
|
|
40
|
43
|
handleClick(value) {
|
|
44
|
+ this.setState({
|
|
45
|
+ current: value
|
|
46
|
+ })
|
41
|
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
|
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
|
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
|
97
|
componentDidShow() {
|
86
|
|
-
|
87
|
98
|
this.loadList()
|
88
|
99
|
}
|
89
|
100
|
loadList() {
|
|
@@ -125,23 +136,35 @@ export default class myCustomer extends Taro.Component {
|
125
|
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
|
150
|
this.setState({
|
130
|
151
|
followVisible: false,
|
|
152
|
+ followValue: '',
|
131
|
153
|
})
|
132
|
154
|
}
|
133
|
|
- cancelBtn() {
|
|
155
|
+ followCancelBtn() {
|
134
|
156
|
this.setState({
|
135
|
157
|
followVisible: false,
|
|
158
|
+ followValue: '',
|
136
|
159
|
})
|
137
|
160
|
}
|
138
|
161
|
onTextareaChange(e) {
|
139
|
162
|
this.setState({
|
140
|
|
- message: e.target.value
|
|
163
|
+ followValue: e.target.value
|
141
|
164
|
})
|
142
|
165
|
}
|
143
|
166
|
renderFollowBox() {
|
144
|
|
- const { message } = this.state
|
|
167
|
+ const { followValue } = this.state
|
145
|
168
|
return (
|
146
|
169
|
<View className="mask">
|
147
|
170
|
<View className="content">
|
|
@@ -151,17 +174,17 @@ export default class myCustomer extends Taro.Component {
|
151
|
174
|
</View>
|
152
|
175
|
<Textarea
|
153
|
176
|
className="textarea"
|
154
|
|
- value={message}
|
|
177
|
+ value={followValue}
|
155
|
178
|
onInput={this.onTextareaChange}
|
156
|
179
|
maxLength={150}
|
157
|
180
|
placeholder='不超过150字'
|
158
|
181
|
/>
|
159
|
182
|
</View>
|
160
|
183
|
<View className="bottom-btn">
|
161
|
|
- <View className="save" onClick={this.saveBtn}>
|
|
184
|
+ <View className="save" onClick={this.followSaveBtn}>
|
162
|
185
|
保存
|
163
|
186
|
</View>
|
164
|
|
- <View className="cancel" onClick={this.cancelBtn}>
|
|
187
|
+ <View className="cancel" onClick={this.followCancelBtn}>
|
165
|
188
|
取消
|
166
|
189
|
</View>
|
167
|
190
|
</View>
|
|
@@ -172,6 +195,7 @@ export default class myCustomer extends Taro.Component {
|
172
|
195
|
perfectInformation() {
|
173
|
196
|
this.setState({
|
174
|
197
|
baseVisible: true,
|
|
198
|
+ baseInfo: this.state.customerDetail,
|
175
|
199
|
})
|
176
|
200
|
}
|
177
|
201
|
baseSaveBtn() {
|
|
@@ -184,26 +208,88 @@ export default class myCustomer extends Taro.Component {
|
184
|
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
|
219
|
onBaseTextareaChange(e) {
|
188
|
220
|
this.setState({
|
189
|
|
- desc: e.target.value
|
|
221
|
+ baseInfo: {
|
|
222
|
+ ...baseInfo,
|
|
223
|
+ describe: e.target.value
|
|
224
|
+ }
|
190
|
225
|
})
|
191
|
226
|
}
|
192
|
227
|
onChange = e => {
|
193
|
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
|
262
|
renderBaseBox() {
|
198
|
|
- const { desc, selector, selectorChecked } = this.state
|
|
263
|
+ const { baseInfo, desc, selector, selectorChecked, sexSelector, sexSelectorChecked } = this.state
|
199
|
264
|
return (
|
200
|
265
|
<View className="mask">
|
201
|
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
|
288
|
<View className="con-item">
|
203
|
289
|
<View style="font-size:14px;color:#666">
|
204
|
290
|
物业类型:
|
205
|
291
|
</View>
|
206
|
|
- <Input className="input" value={desc} onInput={this.onBaseTextareaChange} placeholder='' />
|
|
292
|
+ <Input className="input" value={baseInfo.realtyManageType} onInput={this.onManageTypeChange} placeholder='' />
|
207
|
293
|
</View>
|
208
|
294
|
<View className="con-item">
|
209
|
295
|
<View style="font-size:14px;color:#666">
|
|
@@ -213,7 +299,7 @@ export default class myCustomer extends Taro.Component {
|
213
|
299
|
<View>
|
214
|
300
|
<Picker mode='selector' range={selector} onChange={this.onChange}>
|
215
|
301
|
<View className='picker'>
|
216
|
|
- 当前选择:{selectorChecked}
|
|
302
|
+ {baseInfo.demandType || ''}
|
217
|
303
|
</View>
|
218
|
304
|
</Picker>
|
219
|
305
|
</View>
|
|
@@ -224,7 +310,7 @@ export default class myCustomer extends Taro.Component {
|
224
|
310
|
<View style="font-size:14px;color:#666">
|
225
|
311
|
价格区间:
|
226
|
312
|
</View>
|
227
|
|
- <Input className="input" value={desc} onInput={this.onBaseTextareaChange} placeholder='' />
|
|
313
|
+ <Input className="input" value={baseInfo.priceRange} onInput={this.onPriceRangeChange} placeholder='' />
|
228
|
314
|
</View>
|
229
|
315
|
<View style="display:flex;justify-content: space-between;">
|
230
|
316
|
<View style="font-size:14px;color:#666">
|
|
@@ -232,10 +318,10 @@ export default class myCustomer extends Taro.Component {
|
232
|
318
|
</View>
|
233
|
319
|
<Textarea
|
234
|
320
|
className="textarea"
|
235
|
|
- value={desc}
|
|
321
|
+ value={baseInfo.describe}
|
236
|
322
|
onInput={this.onBaseTextareaChange}
|
237
|
323
|
maxLength={150}
|
238
|
|
- placeholder='不超过150字'
|
|
324
|
+ placeholder=''
|
239
|
325
|
/>
|
240
|
326
|
</View>
|
241
|
327
|
<View className="bottom-btn">
|
|
@@ -255,7 +341,7 @@ export default class myCustomer extends Taro.Component {
|
255
|
341
|
render() {
|
256
|
342
|
|
257
|
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
|
345
|
return (
|
260
|
346
|
<View>
|
261
|
347
|
{followVisible && this.renderFollowBox()}
|
|
@@ -272,7 +358,7 @@ export default class myCustomer extends Taro.Component {
|
272
|
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
|
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
|
362
|
</View>
|
277
|
363
|
<AtTabs className="my-tab" current={this.state.current} tabList={tabList} onClick={this.handleClick.bind(this)}>
|
278
|
364
|
<AtTabsPane current={this.state.current} index={0} >
|
|
@@ -288,19 +374,31 @@ export default class myCustomer extends Taro.Component {
|
288
|
374
|
</AtTabsPane>
|
289
|
375
|
<AtTabsPane current={this.state.current} index={1}>
|
290
|
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
|
391
|
</View>
|
300
|
392
|
</AtTabsPane>
|
301
|
393
|
<AtTabsPane current={this.state.current} index={2}>
|
302
|
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
|
402
|
activityList.map(item => (
|
305
|
403
|
<ActivityItem
|
306
|
404
|
data={item}
|
|
@@ -313,13 +411,29 @@ export default class myCustomer extends Taro.Component {
|
313
|
411
|
</AtTabsPane>
|
314
|
412
|
<AtTabsPane current={this.state.current} index={3}>
|
315
|
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
|
437
|
<View className="btn" onClick={this.addFollow}>添加跟进</View>
|
324
|
438
|
</View>
|
325
|
439
|
|