|
@@ -2,7 +2,7 @@ import Taro, { Component } from '@tarojs/taro';
|
2
|
2
|
import ListView from '@components/ListView'
|
3
|
3
|
import { connect } from '@tarojs/redux'
|
4
|
4
|
import './index.scss'
|
5
|
|
-import { getSharePersonInfoList,judgeBindCustomer } from '@services/person'
|
|
5
|
+import { getSharePersonInfoList, judgeBindCustomer, getConsulantVisitRecord } from '@services/person'
|
6
|
6
|
import { savePoint, updatePoint } from '@services/common'
|
7
|
7
|
import * as noticeType from '@constants/common.js'
|
8
|
8
|
import dayjs from 'dayjs';
|
|
@@ -53,15 +53,12 @@ export default class Person extends Component {
|
53
|
53
|
userId: person.userId,
|
54
|
54
|
targetId: targetId,
|
55
|
55
|
pageNumber,
|
56
|
|
- pageSize: 5
|
|
56
|
+ pageSize: 10
|
57
|
57
|
}
|
58
|
|
-
|
59
|
|
- getSharePersonInfoList(payload).then(res => {
|
60
|
|
-
|
|
58
|
+ getConsulantVisitRecord(payload).then(res => {
|
61
|
59
|
const { records, list, total, current, pages } = res || {}
|
62
|
60
|
const _list = records || list || []
|
63
|
61
|
const newList = current <= 1 ? _list : this.state.recordList.concat(_list)
|
64
|
|
- console.log(newList)
|
65
|
62
|
this.setState({
|
66
|
63
|
recordList: newList,
|
67
|
64
|
isEmpty: total == 0 || !res,
|
|
@@ -69,7 +66,9 @@ export default class Person extends Component {
|
69
|
66
|
pageIndex: current >= pages ? pages : current
|
70
|
67
|
})
|
71
|
68
|
Taro.hideLoading()
|
|
69
|
+
|
72
|
70
|
})
|
|
71
|
+
|
73
|
72
|
}
|
74
|
73
|
onScrollToLower = async (fn) => {
|
75
|
74
|
const { pageIndex } = this.state;
|
|
@@ -86,17 +85,17 @@ export default class Person extends Component {
|
86
|
85
|
}
|
87
|
86
|
handleChatClick(item, e) {
|
88
|
87
|
e.stopPropagation()
|
89
|
|
- const { userInfo: { person: { personId, nickname, name }}} = this.props
|
90
|
|
- const { userInfo: {miniApp:{tpls}}} = this.props
|
91
|
|
- const tplId=(tpls.filter(x => x.tplType == noticeType.TPL_NOTICE&&x.isSubscribe == true))[0].tplId
|
|
88
|
+ const { userInfo: { person: { personId, nickname, name } } } = this.props
|
|
89
|
+ const { userInfo: { miniApp: { tpls } } } = this.props
|
|
90
|
+ const tplId = (tpls.filter(x => x.tplType == noticeType.TPL_NOTICE && x.isSubscribe == true))[0].tplId
|
92
|
91
|
wx.requestSubscribeMessage({
|
93
|
92
|
tmplIds: [tplId],
|
94
|
|
- success (res) {
|
|
93
|
+ success(res) {
|
95
|
94
|
Taro.navigateTo({
|
96
|
95
|
url: `/pages/im/index?sendId=${personId}&sendName=${encodeURIComponent(name || nickname)}&receiverId=${item.personId}&receiverName=${encodeURIComponent(item.name || item.nickname)}`
|
97
|
96
|
})
|
98
|
97
|
},
|
99
|
|
- fail(res){
|
|
98
|
+ fail(res) {
|
100
|
99
|
Taro.navigateTo({
|
101
|
100
|
url: `/pages/im/index?sendId=${personId}&sendName=${encodeURIComponent(name || nickname)}&receiverId=${item.personId}&receiverName=${encodeURIComponent(item.name || item.nickname)}`
|
102
|
101
|
})
|
|
@@ -104,34 +103,27 @@ export default class Person extends Component {
|
104
|
103
|
})
|
105
|
104
|
}
|
106
|
105
|
|
107
|
|
- goCustomerDetail(customerId,e){
|
108
|
|
- e.stopPropagation()
|
109
|
|
- const { userInfo: { person: { personId }}} = this.props
|
110
|
|
- const payload = {
|
111
|
|
- personId: personId,
|
112
|
|
- customerId: customerId
|
|
106
|
+ goCustomerDetail(item) {
|
|
107
|
+ console.log(item, "item")
|
|
108
|
+
|
|
109
|
+ if (item.myCustomer == 1) {
|
|
110
|
+ Taro.navigateTo({
|
|
111
|
+ url: `/pages/person/customerAnalysis/myCustomer?
|
|
112
|
+ =` + item.customerId
|
|
113
|
+ })
|
|
114
|
+ } else {
|
|
115
|
+ Taro.showToast({
|
|
116
|
+ title: 'TA不是你的客户,无法查看详细信息',
|
|
117
|
+ duration: 2000,
|
|
118
|
+ icon: 'none',
|
|
119
|
+ })
|
113
|
120
|
}
|
114
|
|
- judgeBindCustomer(payload).then(res=>{
|
115
|
|
- if(res.data){
|
116
|
|
- Taro.navigateTo({
|
117
|
|
- url: `/pages/person/customerAnalysis/myCustomer?
|
118
|
|
- =` + customerId
|
119
|
|
- })
|
120
|
|
- }else{
|
121
|
|
- Taro.showToast({
|
122
|
|
- title: 'TA不是你的客户,无法查看详细信息',
|
123
|
|
- duration: 3000,
|
124
|
|
- icon: 'none',
|
125
|
|
- })
|
126
|
|
- }
|
127
|
|
- })
|
128
|
|
-
|
|
121
|
+
|
129
|
122
|
}
|
130
|
123
|
|
131
|
124
|
render() {
|
132
|
125
|
const { isEmpty, hasMore, recordList } = this.state
|
133
|
126
|
return (
|
134
|
|
-
|
135
|
127
|
<Block>
|
136
|
128
|
<ListView
|
137
|
129
|
className="wrap"
|
|
@@ -145,16 +137,16 @@ export default class Person extends Component {
|
145
|
137
|
<View className='access-page'>
|
146
|
138
|
{
|
147
|
139
|
recordList.map(item => (
|
148
|
|
- <View className='item' key={String(item + 'more')}>
|
|
140
|
+ <View className='item' key={String(item + 'more')} onClick={this.goCustomerDetail.bind(this, item)} >
|
149
|
141
|
{item.myCustomer == 1 && <View className="tag">我的客户</View>}
|
150
|
142
|
<Image className="touxiang" src={item.avatarurl || require('@assets/default-avatar.png')}></Image>
|
151
|
143
|
<View className="info-top">
|
152
|
|
- <View onClick={this.goCustomerDetail.bind(this,item.customerId)} className="name">{item.userName || item.nickname || ' '}</View>
|
|
144
|
+ <View className="name">{item.userName || item.nickname || ' '}</View>
|
153
|
145
|
<View style="display: flex;align-items: center;" onClick={this.handleChatClick.bind(this, item)}><Image className="goutong-icon" src={require('@assets/person/zixun.png')}></Image><Text className="goutong">在线沟通</Text></View>
|
154
|
146
|
</View>
|
155
|
147
|
<View className="activity-time">
|
156
|
148
|
{`${dayjs(item.visitTime).format('YYYY-MM-DD HH:mm:ss')}`}
|
157
|
|
- </View>
|
|
149
|
+ </View>
|
158
|
150
|
</View>
|
159
|
151
|
))
|
160
|
152
|
}
|