|
@@ -6,7 +6,7 @@ import Taro from '@tarojs/taro'
|
6
|
6
|
import './index.scss'
|
7
|
7
|
|
8
|
8
|
export default function EditUserDetailBasicInfo (props) {
|
9
|
|
- const { Data = {}, close = () => { } } = props
|
|
9
|
+ const { Data = {}, close = () => { }, CustomerId = null } = props
|
10
|
10
|
|
11
|
11
|
const [FormData, setFormData] = useState({ ...Data })
|
12
|
12
|
|
|
@@ -16,15 +16,16 @@ export default function EditUserDetailBasicInfo (props) {
|
16
|
16
|
const [CanSubmit, setCanSubmit] = useState(false)
|
17
|
17
|
|
18
|
18
|
useEffect(() => {
|
19
|
|
- if(CanSubmit) {
|
|
19
|
+ if (CanSubmit) {
|
20
|
20
|
setCanSubmit(false)
|
21
|
21
|
ToSubmit()
|
22
|
22
|
}
|
23
|
23
|
}, [CanSubmit])
|
24
|
24
|
|
25
|
25
|
const ToSubmit = () => {
|
26
|
|
- let params = {}
|
27
|
|
- fetch({ API_SAVE_CUSTOMER_INFO, method: 'post', payload: params }).then(() => {
|
|
26
|
+ let params = { ...FormData, customerId: CustomerId }
|
|
27
|
+ let url = Data.customerId ? `${API_SAVE_CUSTOMER_INFO}/${Data.customerId}` : API_SAVE_CUSTOMER_INFO
|
|
28
|
+ fetch({ url, method: Data.customerId ? 'put' : 'post', payload: params }).then(() => {
|
28
|
29
|
Taro.showToast({ title: '修改成功', icon: 'none', duration: 2000 })
|
29
|
30
|
close()
|
30
|
31
|
}).catch(() => {
|
|
@@ -36,9 +37,9 @@ export default function EditUserDetailBasicInfo (props) {
|
36
|
37
|
let resData = FormData
|
37
|
38
|
if (key === 'age') {
|
38
|
39
|
resData[key] = AgeRange[e.detail.value]
|
39
|
|
- } else if(key === 'householdIncome') {
|
|
40
|
+ } else if (key === 'householdIncome') {
|
40
|
41
|
resData[key] = IncomeRange[e.detail.value]
|
41
|
|
- } else if(key === 'estimatedPurchaseTime') {
|
|
42
|
+ } else if (key === 'estimatedPurchaseTime') {
|
42
|
43
|
resData[key] = BuyTimeRange[e.detail.value]
|
43
|
44
|
}
|
44
|
45
|
setFormData(resData)
|
|
@@ -51,7 +52,7 @@ export default function EditUserDetailBasicInfo (props) {
|
51
|
52
|
}
|
52
|
53
|
|
53
|
54
|
const Submit = () => {
|
54
|
|
- if(!CanSubmit) {
|
|
55
|
+ if (!CanSubmit) {
|
55
|
56
|
setCanSubmit(true)
|
56
|
57
|
}
|
57
|
58
|
}
|
|
@@ -64,35 +65,35 @@ export default function EditUserDetailBasicInfo (props) {
|
64
|
65
|
<text>姓名</text>
|
65
|
66
|
<view className='FormLine flex-h'>
|
66
|
67
|
<view className='flex-item'>
|
67
|
|
- <Input placeholder='请输入姓名' onInput={InputChange.bind(this, 'name')}></Input>
|
|
68
|
+ <Input placeholder='请输入姓名' value={FormData.name} onInput={InputChange.bind(this, 'name')}></Input>
|
68
|
69
|
</view>
|
69
|
70
|
</view>
|
70
|
71
|
|
71
|
72
|
<text>昵称</text>
|
72
|
73
|
<view className='FormLine flex-h'>
|
73
|
74
|
<view className='flex-item'>
|
74
|
|
- <Input placeholder='请输入昵称' onInput={InputChange.bind(this, 'nickname')}></Input>
|
|
75
|
+ <Input placeholder='请输入昵称' value={FormData.nickname} onInput={InputChange.bind(this, 'nickname')}></Input>
|
75
|
76
|
</view>
|
76
|
77
|
</view>
|
77
|
78
|
|
78
|
79
|
<text>手机号码</text>
|
79
|
80
|
<view className='FormLine flex-h'>
|
80
|
81
|
<view className='flex-item'>
|
81
|
|
- <Input placeholder='请输入手机号码' onInput={InputChange.bind(this, 'phone')}></Input>
|
|
82
|
+ <Input placeholder='请输入手机号码' value={FormData.phone} onInput={InputChange.bind(this, 'phone')}></Input>
|
82
|
83
|
</view>
|
83
|
84
|
</view>
|
84
|
85
|
|
85
|
86
|
<text>家庭住址</text>
|
86
|
87
|
<view className='FormLine flex-h'>
|
87
|
88
|
<view className='flex-item'>
|
88
|
|
- <Input placeholder='请输入家庭住址' onInput={InputChange.bind(this, 'homeAddress')}></Input>
|
|
89
|
+ <Input placeholder='请输入家庭住址' value={FormData.homeAddress} onInput={InputChange.bind(this, 'homeAddress')}></Input>
|
89
|
90
|
</view>
|
90
|
91
|
</view>
|
91
|
92
|
|
92
|
93
|
<text>工作地址</text>
|
93
|
94
|
<view className='FormLine flex-h'>
|
94
|
95
|
<view className='flex-item'>
|
95
|
|
- <Input placeholder='请输入工作地址' onInput={InputChange.bind(this, 'firmAddress')}></Input>
|
|
96
|
+ <Input placeholder='请输入工作地址' value={FormData.firmAddress} onInput={InputChange.bind(this, 'firmAddress')}></Input>
|
96
|
97
|
</view>
|
97
|
98
|
</view>
|
98
|
99
|
|
|
@@ -100,7 +101,7 @@ export default function EditUserDetailBasicInfo (props) {
|
100
|
101
|
<view className='FormLine flex-h'>
|
101
|
102
|
<view className='flex-item'>
|
102
|
103
|
<Picker onChange={PickerChange.bind(this, 'age')} value={null} range={AgeRange}>
|
103
|
|
- <text>请选择</text>
|
|
104
|
+ <text>{FormData.age || '请选择'}</text>
|
104
|
105
|
</Picker>
|
105
|
106
|
</view>
|
106
|
107
|
<text className='iconfont icon-jiantoudown'></text>
|
|
@@ -109,7 +110,7 @@ export default function EditUserDetailBasicInfo (props) {
|
109
|
110
|
<text>职业</text>
|
110
|
111
|
<view className='FormLine flex-h'>
|
111
|
112
|
<view className='flex-item'>
|
112
|
|
- <Input placeholder='请输入职业' onInput={InputChange.bind(this, 'career')}></Input>
|
|
113
|
+ <Input placeholder='请输入职业' value={FormData.career} onInput={InputChange.bind(this, 'career')}></Input>
|
113
|
114
|
</view>
|
114
|
115
|
</view>
|
115
|
116
|
|
|
@@ -117,7 +118,7 @@ export default function EditUserDetailBasicInfo (props) {
|
117
|
118
|
<view className='FormLine flex-h'>
|
118
|
119
|
<view className='flex-item'>
|
119
|
120
|
<Picker onChange={PickerChange.bind(this, 'householdIncome')} value={null} range={IncomeRange}>
|
120
|
|
- <text>请选择</text>
|
|
121
|
+ <text>{FormData.householdIncome || '请选择'}</text>
|
121
|
122
|
</Picker>
|
122
|
123
|
</view>
|
123
|
124
|
<text className='iconfont icon-jiantoudown'></text>
|
|
@@ -126,21 +127,21 @@ export default function EditUserDetailBasicInfo (props) {
|
126
|
127
|
<text>家庭成员数</text>
|
127
|
128
|
<view className='FormLine flex-h'>
|
128
|
129
|
<view className='flex-item'>
|
129
|
|
- <Input placeholder='请输入家庭成员数' onInput={InputChange.bind(this, 'familyNumber')}></Input>
|
|
130
|
+ <Input placeholder='请输入家庭成员数' value={FormData.familyNumber} onInput={InputChange.bind(this, 'familyNumber')}></Input>
|
130
|
131
|
</view>
|
131
|
132
|
</view>
|
132
|
133
|
|
133
|
134
|
<text>已有房产数</text>
|
134
|
135
|
<view className='FormLine flex-h'>
|
135
|
136
|
<view className='flex-item'>
|
136
|
|
- <Input placeholder='请输入已有房产数' onInput={InputChange.bind(this, 'houseNumber')}></Input>
|
|
137
|
+ <Input placeholder='请输入已有房产数' value={FormData.houseNumber} onInput={InputChange.bind(this, 'houseNumber')}></Input>
|
137
|
138
|
</view>
|
138
|
139
|
</view>
|
139
|
140
|
|
140
|
141
|
<text>已有车辆数</text>
|
141
|
142
|
<view className='FormLine flex-h'>
|
142
|
143
|
<view className='flex-item'>
|
143
|
|
- <Input placeholder='请输入已有车辆数' onInput={InputChange.bind(this, 'carNumber')}></Input>
|
|
144
|
+ <Input placeholder='请输入已有车辆数' value={FormData.carNumber} onInput={InputChange.bind(this, 'carNumber')}></Input>
|
144
|
145
|
</view>
|
145
|
146
|
</view>
|
146
|
147
|
|
|
@@ -148,7 +149,7 @@ export default function EditUserDetailBasicInfo (props) {
|
148
|
149
|
<view className='FormLine flex-h'>
|
149
|
150
|
<view className='flex-item'>
|
150
|
151
|
<Picker onChange={PickerChange.bind(this, 'estimatedPurchaseTime')} value={null} range={BuyTimeRange}>
|
151
|
|
- <text>请选择</text>
|
|
152
|
+ <text>{FormData.estimatedPurchaseTime || '请选择'}</text>
|
152
|
153
|
</Picker>
|
153
|
154
|
</view>
|
154
|
155
|
<text className='iconfont icon-jiantoudown'></text>
|
|
@@ -157,35 +158,35 @@ export default function EditUserDetailBasicInfo (props) {
|
157
|
158
|
<text>客户咨询重点</text>
|
158
|
159
|
<view className='FormLine flex-h'>
|
159
|
160
|
<view className='flex-item'>
|
160
|
|
- <Input placeholder='请填写 如:地段、交通、社区配套、户型、价格等' onInput={InputChange.bind(this, 'consultation')}></Input>
|
|
161
|
+ <Input value={FormData.consultation} placeholder='请填写 如:地段、交通、社区配套、户型、价格等' onInput={InputChange.bind(this, 'consultation')}></Input>
|
161
|
162
|
</view>
|
162
|
163
|
</view>
|
163
|
164
|
|
164
|
165
|
<text>购房动机</text>
|
165
|
166
|
<view className='FormLine flex-h'>
|
166
|
167
|
<view className='flex-item'>
|
167
|
|
- <Input placeholder='请填写 如结婚、养老、二孩、改善、学区、投资等' onInput={InputChange.bind(this, 'motivation')}></Input>
|
|
168
|
+ <Input value={FormData.motivation} placeholder='请填写 如结婚、养老、二孩、改善、学区、投资等' onInput={InputChange.bind(this, 'motivation')}></Input>
|
168
|
169
|
</view>
|
169
|
170
|
</view>
|
170
|
171
|
|
171
|
172
|
<text>客户抗性分析</text>
|
172
|
173
|
<view className='FormLine flex-h'>
|
173
|
174
|
<view className='flex-item'>
|
174
|
|
- <Input placeholder='请填写 如:地段、交通、社区配套、户型、价格等' onInput={InputChange.bind(this, 'resistanceAnalysis')}></Input>
|
|
175
|
+ <Input value={FormData.resistanceAnalysis} placeholder='请填写 如:地段、交通、社区配套、户型、价格等' onInput={InputChange.bind(this, 'resistanceAnalysis')}></Input>
|
175
|
176
|
</view>
|
176
|
177
|
</view>
|
177
|
178
|
|
178
|
179
|
<text>客户对项目认可点</text>
|
179
|
180
|
<view className='FormLine flex-h'>
|
180
|
181
|
<view className='flex-item'>
|
181
|
|
- <Input placeholder='请填写 如:地段、交通、社区配套、户型、价格等' onInput={InputChange.bind(this, 'approval')}></Input>
|
|
182
|
+ <Input value={FormData.approval} placeholder='请填写 如:地段、交通、社区配套、户型、价格等' onInput={InputChange.bind(this, 'approval')}></Input>
|
182
|
183
|
</view>
|
183
|
184
|
</view>
|
184
|
185
|
|
185
|
186
|
<text>备注</text>
|
186
|
187
|
<view className='FormLine flex-h'>
|
187
|
188
|
<view className='flex-item'>
|
188
|
|
- <Input placeholder='补充说明(选填)' onInput={InputChange.bind(this, 'remark')}></Input>
|
|
189
|
+ <Input value={FormData.remark} placeholder='补充说明(选填)' onInput={InputChange.bind(this, 'remark')}></Input>
|
189
|
190
|
</view>
|
190
|
191
|
</view>
|
191
|
192
|
|