|
@@ -5,7 +5,9 @@ import '@/assets/css/iconfont.css'
|
5
|
5
|
import { Image, Textarea } from '@tarojs/components'
|
6
|
6
|
import { fetch } from '@/utils/request'
|
7
|
7
|
import { API_GET_CUSTOMER_INFO, API_FOLLOW_LIST } from '@/constants/api'
|
|
8
|
+import { getCustomerDetail, addFollowRecord } from '@/services/person'
|
8
|
9
|
import { getImgURL } from '@/utils/image'
|
|
10
|
+import { BIZ_STATUS } from '@/constants/user'
|
9
|
11
|
import './index.scss'
|
10
|
12
|
import UserDetailBasicInfo from '../components/UserDetailBasicInfo/index'
|
11
|
13
|
import UserDetailViewRecord from '../components/UserDetailViewRecord/index'
|
|
@@ -13,9 +15,10 @@ import UserDetailActivityInfo from '../components/UserDetailActivityInfo/index'
|
13
|
15
|
import UserDetailFollowRecord from '../components/UserDetailFollowRecord/index'
|
14
|
16
|
|
15
|
17
|
export default withLayout((props) => {
|
|
18
|
+ const { router, person } = props
|
|
19
|
+ const { id : CustomerId, } = router.params
|
16
|
20
|
|
17
|
|
- const { name, sex, phone, avatarurl, status } = props.router.params
|
18
|
|
- const [CustomerId] = useState(props.router.params.id)
|
|
21
|
+ const [custBaseInfo, setCustBaseInfo] = useState({})
|
19
|
22
|
const [CustomerInfo, setCustomerInfo] = useState({})
|
20
|
23
|
const [ShowAddFollow, setShowAddFollow] = useState(false)
|
21
|
24
|
const [MenuList] = useState([
|
|
@@ -28,12 +31,6 @@ export default withLayout((props) => {
|
28
|
31
|
const [FollowContent, setFollowContent] = useState('')
|
29
|
32
|
const [FollowAddCounts, setFollowAddCounts] = useState(0)
|
30
|
33
|
|
31
|
|
- useEffect(() => {
|
32
|
|
- if (CustomerId) {
|
33
|
|
- UpdateCustomerInfo()
|
34
|
|
- }
|
35
|
|
- }, [CustomerId])
|
36
|
|
-
|
37
|
34
|
const UpdateCustomerInfo = () => {
|
38
|
35
|
fetch({ url: `${API_GET_CUSTOMER_INFO}${CustomerId}` }).then((res) => {
|
39
|
36
|
if (res) {
|
|
@@ -57,7 +54,13 @@ export default withLayout((props) => {
|
57
|
54
|
}
|
58
|
55
|
|
59
|
56
|
const SaveFollow = () => {
|
60
|
|
- fetch({ url: API_FOLLOW_LIST, method: 'post', payload: { recordType: '添加跟进', recordContent: FollowContent, customerSex: CustomerInfo.sex, customerId: CustomerId } }).then((res) => {
|
|
57
|
+ const payload = {
|
|
58
|
+ recordType: '添加跟进',
|
|
59
|
+ recordContent: FollowContent,
|
|
60
|
+ customerSex: CustomerInfo.sex,
|
|
61
|
+ customerId: CustomerId,
|
|
62
|
+ }
|
|
63
|
+ addFollowRecord(payload).then((res) => {
|
61
|
64
|
Taro.showToast({
|
62
|
65
|
title: '添加跟进成功',
|
63
|
66
|
icon: 'none'
|
|
@@ -80,6 +83,15 @@ export default withLayout((props) => {
|
80
|
83
|
setFollowContent('')
|
81
|
84
|
}
|
82
|
85
|
|
|
86
|
+ useEffect(() => {
|
|
87
|
+ if (CustomerId) {
|
|
88
|
+ UpdateCustomerInfo()
|
|
89
|
+
|
|
90
|
+ getCustomerDetail(CustomerId).then((res) => setCustBaseInfo(res || {}))
|
|
91
|
+ }
|
|
92
|
+ }, [CustomerId])
|
|
93
|
+
|
|
94
|
+
|
83
|
95
|
return (
|
84
|
96
|
<view className='Page customerDetail flex-v'>
|
85
|
97
|
|
|
@@ -89,20 +101,20 @@ export default withLayout((props) => {
|
89
|
101
|
<view className='centerLabel'>
|
90
|
102
|
<view className='flex-h'>
|
91
|
103
|
<view className='Icon'>
|
92
|
|
- <Image mode='aspectFill' src={getImgURL(CustomerInfo.avatarurl || avatarurl)}></Image>
|
|
104
|
+ <Image mode='aspectFill' src={getImgURL(custBaseInfo.avatarurl)}></Image>
|
93
|
105
|
</view>
|
94
|
106
|
<view className='flex-item'>
|
95
|
107
|
<view>
|
96
|
|
- <text>{CustomerInfo.name || name}</text>
|
97
|
|
- <text className={CustomerInfo.sex - 0 === 1 || sex - 0 === 1 ? 'iconfont icon-nanxing' : 'iconfont icon-nvxing'}></text>
|
|
108
|
+ <text>{custBaseInfo.name}</text>
|
|
109
|
+ <text className={custBaseInfo.sex - 0 === 1 ? 'iconfont icon-nanxing' : 'iconfont icon-nvxing'}></text>
|
98
|
110
|
</view>
|
99
|
|
- <text>{CustomerInfo.phone || phone}</text>
|
|
111
|
+ <text>{custBaseInfo.phone}</text>
|
100
|
112
|
</view>
|
101
|
113
|
<text className='iconfont icon-liaotian'></text>
|
102
|
|
- <text className='iconfont icon-dianhua' onClick={() => { Taro.makePhoneCall({ phoneNumber: CustomerInfo.phone || phone }) }}></text>
|
|
114
|
+ <text className='iconfont icon-dianhua' onClick={() => { Taro.makePhoneCall({ phoneNumber: custBaseInfo.phone }) }}></text>
|
103
|
115
|
</view>
|
104
|
116
|
</view>
|
105
|
|
- <text className='Status'>{status - 0 === 1 || status - 0 === 0 ? '已报备' : status - 0 === 2 ? '已到访' : status - 0 === 3 ? '已认筹' : '已签约'}</text>
|
|
117
|
+ <text className='Status'>{BIZ_STATUS[custBaseInfo.status] || '报备'}</text>
|
106
|
118
|
<text className='Tips'>NEW</text>
|
107
|
119
|
<text className='Tips'>NEW</text>
|
108
|
120
|
</view>
|