|
@@ -1,5 +1,6 @@
|
1
|
1
|
import Taro, { Component } from '@tarojs/taro';
|
2
|
2
|
import { AtTabs, AtTabsPane } from 'taro-ui'
|
|
3
|
+import ListView from '@components/ListView'
|
3
|
4
|
import "taro-ui/dist/style/components/tabs.scss"
|
4
|
5
|
import { savePoint, updatePoint } from '@services/common'
|
5
|
6
|
import { getCustomerDetail, getVisitRecord, getActivityList, getFollowRecord, addFollowRecord, commitCustomerInfo } from '@services/person'
|
|
@@ -31,7 +32,15 @@ export default class myCustomer extends Taro.Component {
|
31
|
32
|
followRecord: [],
|
32
|
33
|
visitRecord: [],
|
33
|
34
|
baseInfo: {}, // 完善信息弹框数据
|
34
|
|
-
|
|
35
|
+ hasMore: true,
|
|
36
|
+ isEmpty: false,
|
|
37
|
+ pageIndex: 1,
|
|
38
|
+ hasMore2: true,
|
|
39
|
+ isEmpty2: false,
|
|
40
|
+ pageIndex2: 1,
|
|
41
|
+ hasMore3: true,
|
|
42
|
+ isEmpty3: false,
|
|
43
|
+ pageIndex3: 1,
|
35
|
44
|
}
|
36
|
45
|
|
37
|
46
|
componentWillUnmount() {
|
|
@@ -45,52 +54,112 @@ export default class myCustomer extends Taro.Component {
|
45
|
54
|
current: value
|
46
|
55
|
})
|
47
|
56
|
if (value == 1) {
|
48
|
|
- this.queryVisitRecord();
|
|
57
|
+ this.queryVisitRecord(1);
|
49
|
58
|
} else if (value == 2) {
|
50
|
|
- this.queryActivityList();
|
|
59
|
+ this.queryActivityList(1);
|
51
|
60
|
} else if (value == 3) {
|
52
|
|
- this.queryFollowRecord();
|
|
61
|
+ this.queryFollowRecord(1);
|
53
|
62
|
}
|
54
|
63
|
}
|
|
64
|
+ // 访问记录上拉加载下拉刷新
|
|
65
|
+ onScrollToLower = async (fn) => {
|
|
66
|
+ const { pageIndex } = this.state;
|
|
67
|
+ this.queryVisitRecord(pageIndex + 1)
|
|
68
|
+ fn && fn();
|
|
69
|
+ }
|
|
70
|
+ onPullDownRefresh = (rest) => {
|
|
71
|
+ // debugger
|
|
72
|
+ if (this.refreshing) return
|
|
73
|
+ this.refreshing = true
|
|
74
|
+ this.queryVisitRecord(1)
|
|
75
|
+ rest && rest()
|
|
76
|
+ this.refreshing = false
|
|
77
|
+ }
|
|
78
|
+ // 活动信息上拉加载下拉刷新
|
|
79
|
+ onScrollToLower2 = async (fn) => {
|
|
80
|
+ const { pageIndex2 } = this.state;
|
|
81
|
+ this.queryActivityList(pageIndex2 + 1)
|
|
82
|
+ fn && fn();
|
|
83
|
+ }
|
|
84
|
+ onPullDownRefresh2 = (rest) => {
|
|
85
|
+ // debugger
|
|
86
|
+ if (this.refreshing) return
|
|
87
|
+ this.refreshing = true
|
|
88
|
+ this.queryActivityList(1)
|
|
89
|
+ rest && rest()
|
|
90
|
+ this.refreshing = false
|
|
91
|
+ }
|
|
92
|
+ // 跟进记录上拉加载下拉刷新
|
|
93
|
+ onScrollToLower3 = async (fn) => {
|
|
94
|
+ const { pageIndex3 } = this.state;
|
|
95
|
+ this.queryFollowRecord(pageIndex3 + 1)
|
|
96
|
+ fn && fn();
|
|
97
|
+ }
|
|
98
|
+ onPullDownRefresh3 = (rest) => {
|
|
99
|
+ // debugger
|
|
100
|
+ if (this.refreshing) return
|
|
101
|
+ this.refreshing = true
|
|
102
|
+ this.queryFollowRecord(1)
|
|
103
|
+ rest && rest()
|
|
104
|
+ this.refreshing = false
|
|
105
|
+ }
|
55
|
106
|
// 获取访问记录
|
56
|
|
- queryVisitRecord() {
|
|
107
|
+ queryVisitRecord(pageNumber) {
|
57
|
108
|
const { customerId } = this.$router.params
|
58
|
109
|
const payload = {
|
59
|
|
- pageNumber: '0',
|
|
110
|
+ pageNumber,
|
60
|
111
|
pageSize: '10',
|
61
|
112
|
customerId,
|
62
|
113
|
}
|
63
|
114
|
getVisitRecord(payload).then(res => {
|
|
115
|
+ const { records, list, total, current, pages } = res || {}
|
|
116
|
+ const _list = records || list || []
|
|
117
|
+ const newList = current <= 1 ? _list : this.state.visitRecord.concat(_list)
|
64
|
118
|
this.setState({
|
65
|
|
- visitRecord: res.records || []
|
|
119
|
+ visitRecord: newList,
|
|
120
|
+ isEmpty: total == 0,
|
|
121
|
+ hasMore: current < pages,
|
|
122
|
+ pageIndex: current >= pages ? pages : current
|
66
|
123
|
})
|
67
|
124
|
})
|
68
|
125
|
}
|
69
|
126
|
// 获取活动信息
|
70
|
|
- queryActivityList() {
|
|
127
|
+ queryActivityList(pageNumber) {
|
71
|
128
|
const { customerId } = this.$router.params
|
72
|
129
|
const payload = {
|
73
|
|
- pageNumber: '0',
|
|
130
|
+ pageNumber,
|
74
|
131
|
pageSize: '10',
|
75
|
132
|
customerId,
|
76
|
133
|
}
|
77
|
134
|
getActivityList(payload).then(res => {
|
|
135
|
+ const { records, list, total, current, pages } = res || {}
|
|
136
|
+ const _list = records || list || []
|
|
137
|
+ const newList = current <= 1 ? _list : this.state.activityList.concat(_list)
|
78
|
138
|
this.setState({
|
79
|
|
- activityList: res.records || []
|
|
139
|
+ activityList: newList,
|
|
140
|
+ isEmpty2: total == 0,
|
|
141
|
+ hasMore2: current < pages,
|
|
142
|
+ pageIndex2: current >= pages ? pages : current
|
80
|
143
|
})
|
81
|
144
|
})
|
82
|
145
|
}
|
83
|
146
|
// 获取跟进记录
|
84
|
|
- queryFollowRecord() {
|
|
147
|
+ queryFollowRecord(pageNumber) {
|
85
|
148
|
const { customerId } = this.$router.params
|
86
|
149
|
const payload = {
|
87
|
|
- pageNumber: '0',
|
88
|
|
- pageSize: '30',
|
|
150
|
+ pageNumber,
|
|
151
|
+ pageSize: '10',
|
89
|
152
|
customerId,
|
90
|
153
|
}
|
91
|
154
|
getFollowRecord(payload).then(res => {
|
|
155
|
+ const { records, list, total, current, pages } = res || {}
|
|
156
|
+ const _list = records || list || []
|
|
157
|
+ const newList = current <= 1 ? _list : this.state.followRecord.concat(_list)
|
92
|
158
|
this.setState({
|
93
|
|
- followRecord: res.records
|
|
159
|
+ followRecord: newList,
|
|
160
|
+ isEmpty3: total == 0,
|
|
161
|
+ hasMore3: current < pages,
|
|
162
|
+ pageIndex3: current >= pages ? pages : current
|
94
|
163
|
})
|
95
|
164
|
})
|
96
|
165
|
}
|
|
@@ -251,9 +320,6 @@ export default class myCustomer extends Taro.Component {
|
251
|
320
|
}
|
252
|
321
|
})
|
253
|
322
|
}
|
254
|
|
-
|
255
|
|
-
|
256
|
|
-
|
257
|
323
|
onChange = e => {
|
258
|
324
|
this.setState({
|
259
|
325
|
baseInfo: {
|
|
@@ -262,7 +328,6 @@ export default class myCustomer extends Taro.Component {
|
262
|
328
|
}
|
263
|
329
|
})
|
264
|
330
|
}
|
265
|
|
-
|
266
|
331
|
onBaseTextareaChange(e) {
|
267
|
332
|
this.setState({
|
268
|
333
|
baseInfo: {
|
|
@@ -371,7 +436,7 @@ export default class myCustomer extends Taro.Component {
|
371
|
436
|
render() {
|
372
|
437
|
|
373
|
438
|
const tabList = [{ title: '基本信息' }, { title: '访问记录' }, { title: '活动信息' }, { title: '跟进记录' }]
|
374
|
|
- const { customerDetail, visitRecord, activityList, followRecord, followVisible, baseVisible, } = this.state
|
|
439
|
+ const { customerDetail, visitRecord, activityList, followRecord, followVisible, baseVisible, isEmpty, hasMore, isEmpty2, hasMore2, isEmpty3, hasMore3 } = this.state
|
375
|
440
|
return (
|
376
|
441
|
<View>
|
377
|
442
|
{followVisible && this.renderFollowBox()}
|
|
@@ -404,69 +469,102 @@ export default class myCustomer extends Taro.Component {
|
404
|
469
|
</AtTabsPane>
|
405
|
470
|
<AtTabsPane current={this.state.current} index={1}>
|
406
|
471
|
<View className="tab-pane2 pane">
|
407
|
|
- {visitRecord.length && visitRecord.map(item => (
|
408
|
|
- <View className="record-item">
|
409
|
|
- <View className="title" >{item.activity}</View>
|
410
|
|
- <View className="time">{dayjs(item.visitTime).format('YYYY年MM月DD日 HH:mm:ss') || ' '}</View>
|
411
|
|
- </View>
|
412
|
|
- ))
|
413
|
|
- }
|
414
|
|
- {!visitRecord.length &&
|
415
|
|
- <View className="empty">
|
416
|
|
- <Image className="empty__img" mode="widthFix" src={emptyImg}></Image>
|
417
|
|
- <View className="empty__text">暂无访问记录~</View>
|
|
472
|
+ <ListView
|
|
473
|
+ className="wrap"
|
|
474
|
+ needInit
|
|
475
|
+ isEmpty={isEmpty}
|
|
476
|
+ emptyText="暂无访问记录~"
|
|
477
|
+ hasMore={hasMore}
|
|
478
|
+ onPullDownRefresh={fn => this.onPullDownRefresh(fn)}
|
|
479
|
+ onScrollToLower={fn => this.onScrollToLower(fn)}
|
|
480
|
+ >
|
|
481
|
+ <View className="list">
|
|
482
|
+ {visitRecord.length && visitRecord.map(item => (
|
|
483
|
+ <View className="record-item">
|
|
484
|
+ <View className="title" >{item.activity}</View>
|
|
485
|
+ <View className="time">{dayjs(item.visitTime).format('YYYY年MM月DD日 HH:mm:ss') || ' '}</View>
|
|
486
|
+ </View>
|
|
487
|
+ ))
|
|
488
|
+ }
|
|
489
|
+ {!visitRecord.length &&
|
|
490
|
+ <View className="empty">
|
|
491
|
+ {/* <Image className="empty__img" mode="widthFix" src={emptyImg}></Image>
|
|
492
|
+ <View className="empty__text">暂无访问记录~</View> */}
|
|
493
|
+ </View>
|
|
494
|
+ }
|
418
|
495
|
</View>
|
419
|
|
- }
|
420
|
|
-
|
|
496
|
+ </ListView>
|
421
|
497
|
</View>
|
422
|
498
|
</AtTabsPane>
|
423
|
499
|
<AtTabsPane current={this.state.current} index={2}>
|
424
|
500
|
<View className="tab-pane3 pane">
|
425
|
|
- {!activityList.length &&
|
426
|
|
- <View className="empty">
|
427
|
|
- <Image className="empty__img" mode="widthFix" src={emptyImg}></Image>
|
428
|
|
- <View className="empty__text">暂无活动信息~</View>
|
|
501
|
+ <ListView
|
|
502
|
+ className="wrap"
|
|
503
|
+ needInit
|
|
504
|
+ isEmpty={isEmpty2}
|
|
505
|
+ emptyText="暂无活动信息~"
|
|
506
|
+ hasMore={hasMore2}
|
|
507
|
+ onPullDownRefresh={fn => this.onPullDownRefresh2(fn)}
|
|
508
|
+ onScrollToLower={fn => this.onScrollToLower2(fn)}
|
|
509
|
+ >
|
|
510
|
+ <View className="list">
|
|
511
|
+ {!activityList.length &&
|
|
512
|
+ <View className="empty">
|
|
513
|
+ {/* <Image className="empty__img" mode="widthFix" src={emptyImg}></Image>
|
|
514
|
+ <View className="empty__text">暂无活动信息~</View> */}
|
|
515
|
+ </View>
|
|
516
|
+ }
|
|
517
|
+ {activityList.length &&
|
|
518
|
+ activityList.map(item => (
|
|
519
|
+ <ActivityItem
|
|
520
|
+ data={item}
|
|
521
|
+ key={item.id}
|
|
522
|
+ onClick={this.handleItemClick}>
|
|
523
|
+ </ActivityItem>
|
|
524
|
+ ))
|
|
525
|
+ }
|
429
|
526
|
</View>
|
430
|
|
- }
|
431
|
|
- {activityList.length &&
|
432
|
|
- activityList.map(item => (
|
433
|
|
- <ActivityItem
|
434
|
|
- data={item}
|
435
|
|
- key={item.id}
|
436
|
|
- onClick={this.handleItemClick}>
|
437
|
|
- </ActivityItem>
|
438
|
|
- ))
|
439
|
|
- }
|
|
527
|
+ </ListView>
|
440
|
528
|
</View>
|
441
|
529
|
</AtTabsPane>
|
442
|
530
|
<AtTabsPane current={this.state.current} index={3}>
|
443
|
|
- <View style="padding:10px 20px 120px 20px">
|
444
|
|
- {followRecord.length && followRecord.map(item => (
|
445
|
|
- <View>
|
446
|
|
- <View style=" display:flex;justify-content: space-between;align-items: center;color: #333;font-size: 16px; margin-bottom:20rpx;">
|
447
|
|
- <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>
|
448
|
|
- <View classNam="time" style=" font-size: 26rpx;color: #999;">{dayjs(item.createDate).format('YYYY年MM月DD日 HH:mm:ss') || ' '}</View>
|
449
|
|
- </View>
|
450
|
|
- {
|
451
|
|
- item.recordContent &&
|
452
|
|
- <View style="font-size:28rpx;color:#666;padding-left:32rpx;margin-bottom:20rpx;">
|
453
|
|
- {item.recordContent}
|
|
531
|
+ <View style="padding:10px 20px 20px 20px">
|
|
532
|
+ <ListView
|
|
533
|
+ className="wrap"
|
|
534
|
+ needInit
|
|
535
|
+ style="height:40vh"
|
|
536
|
+ isEmpty={isEmpty3}
|
|
537
|
+ emptyText="暂无跟进记录~"
|
|
538
|
+ hasMore={hasMore3}
|
|
539
|
+ onPullDownRefresh={fn => this.onPullDownRefresh3(fn)}
|
|
540
|
+ onScrollToLower={fn => this.onScrollToLower3(fn)} >
|
|
541
|
+ <View className="list">
|
|
542
|
+ {followRecord.length && followRecord.map(item => (
|
|
543
|
+ <View>
|
|
544
|
+ <View style=" display:flex;justify-content: space-between;align-items: center;color: #333;font-size: 16px; margin-bottom:20rpx;">
|
|
545
|
+ <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>
|
|
546
|
+ <View classNam="time" style=" font-size: 26rpx;color: #999;">{dayjs(item.createDate).format('YYYY年MM月DD日 HH:mm:ss') || ' '}</View>
|
|
547
|
+ </View>
|
|
548
|
+ {
|
|
549
|
+ item.recordContent &&
|
|
550
|
+ <View style="font-size:28rpx;color:#666;padding-left:32rpx;margin-bottom:20rpx;">
|
|
551
|
+ {item.recordContent}
|
|
552
|
+ </View>
|
|
553
|
+ }
|
|
554
|
+
|
|
555
|
+ </View>
|
|
556
|
+ ))
|
|
557
|
+ }
|
|
558
|
+ {!followRecord.length &&
|
|
559
|
+ <View className="empty">
|
|
560
|
+ {/* <Image className="empty__img" mode="widthFix" src={emptyImg}></Image>
|
|
561
|
+ <View className="empty__text">暂无跟进记录~</View> */}
|
454
|
562
|
</View>
|
455
|
563
|
}
|
456
|
|
-
|
457
|
|
- </View>
|
458
|
|
- ))
|
459
|
|
- }
|
460
|
|
- {!followRecord.length &&
|
461
|
|
- <View className="empty">
|
462
|
|
- <Image className="empty__img" mode="widthFix" src={emptyImg}></Image>
|
463
|
|
- <View className="empty__text">暂无跟进记录~</View>
|
464
|
564
|
</View>
|
465
|
|
- }
|
466
|
|
-
|
|
565
|
+ </ListView>
|
467
|
566
|
<View className="btn" onClick={this.addFollow}>添加跟进</View>
|
468
|
567
|
</View>
|
469
|
|
-
|
470
|
568
|
</AtTabsPane>
|
471
|
569
|
</AtTabs>
|
472
|
570
|
</View>
|