|
@@ -3,36 +3,42 @@ import withLayout from '@/layout'
|
3
|
3
|
import { ScrollView, Input, Image, Block, Picker } from '@tarojs/components'
|
4
|
4
|
import '@/assets/css/iconfont.css'
|
5
|
5
|
import { getCardList } from '@/services/card'
|
|
6
|
+import { fetch } from '@/utils/request'
|
|
7
|
+import Taro from '@tarojs/taro'
|
|
8
|
+import { API_SURE_CHIP, API_BUILDING_HOUSE_TYPE, API_SURE_SIGN, API_SURE_BUY } from '@/constants/api'
|
6
|
9
|
import './index.scss'
|
7
|
10
|
|
8
|
11
|
export default withLayout((props) => {
|
9
|
12
|
|
10
|
13
|
const { router } = props
|
11
|
|
- const { name, buildingId, type } = router.params
|
|
14
|
+ const { name, buildingId, type, id, channelId } = router.params
|
12
|
15
|
|
13
|
16
|
const RenChouData = {
|
14
|
17
|
name,
|
15
|
18
|
realtyConsultant: '',
|
16
|
|
- remark: ''
|
|
19
|
+ remark: '',
|
17
|
20
|
}
|
18
|
21
|
|
19
|
22
|
const QianYueData = {
|
20
|
23
|
name,
|
21
|
24
|
realtyConsultant: '',
|
22
|
|
- remark: ''
|
23
|
|
- }
|
24
|
|
-
|
25
|
|
- const JieYongData = {
|
26
|
|
- name,
|
27
|
|
- realtyConsultant: '',
|
28
|
|
- remark: ''
|
|
25
|
+ remark: '',
|
|
26
|
+ dividendsName: '',
|
|
27
|
+ dividendsPer: '',
|
|
28
|
+ houseInfo: '',
|
|
29
|
+ houseType: '',
|
|
30
|
+ price: '',
|
|
31
|
+ successDate: '',
|
29
|
32
|
}
|
30
|
33
|
|
31
|
34
|
const [FormData, setFormData] = useState({ ...RenChouData })
|
32
|
35
|
|
33
|
36
|
const [ConsultantList, setConsultantList] = useState([])
|
|
37
|
+ const [HouseTypeList, setHouseTypeList] = useState([])
|
34
|
38
|
const [CurrnetConsultant, setCurrnetConsultant] = useState({})
|
35
|
39
|
|
|
40
|
+ const [SuccessDate, setSuccessDate] = useState(null)
|
|
41
|
+
|
36
|
42
|
const [StatusList] = useState([
|
37
|
43
|
{ name: '认筹', id: 3 },
|
38
|
44
|
{ name: '签约', id: 4 },
|
|
@@ -40,14 +46,14 @@ export default withLayout((props) => {
|
40
|
46
|
])
|
41
|
47
|
const [CurrentStatusId, setCurrentStatusId] = useState(3)
|
42
|
48
|
|
43
|
|
- const [RoomTypeList] = useState([
|
44
|
|
- { name: '二室一厅', id: 1 },
|
45
|
|
- { name: '三室二厅', id: 2 },
|
46
|
|
- { name: '三室一厅', id: 3 },
|
47
|
|
- { name: '四室二厅', id: 4 }
|
48
|
|
- ])
|
49
|
49
|
const [CurrentRoomTypeId, setCurrentRoomTypeId] = useState(null)
|
50
|
50
|
|
|
51
|
+ useEffect(() => {
|
|
52
|
+ if (channelId !== null && channelId !== 'null') {
|
|
53
|
+
|
|
54
|
+ }
|
|
55
|
+ }, [])
|
|
56
|
+
|
51
|
57
|
useEffect(() => {
|
52
|
58
|
if (buildingId) {
|
53
|
59
|
const params = {
|
|
@@ -62,32 +68,104 @@ export default withLayout((props) => {
|
62
|
68
|
}
|
63
|
69
|
}, [buildingId])
|
64
|
70
|
|
|
71
|
+ useEffect(() => {
|
|
72
|
+ if (CurrentStatusId - 0 !== 3) {
|
|
73
|
+ fetch({ url: `${API_BUILDING_HOUSE_TYPE}?buildingId=${buildingId}&pageSize=${500}`, method: 'get' }).then((res) => {
|
|
74
|
+ setHouseTypeList(res.records || [])
|
|
75
|
+ })
|
|
76
|
+ }
|
|
77
|
+ }, [CurrentStatusId])
|
|
78
|
+
|
65
|
79
|
const CutStatus = (item) => {
|
66
|
80
|
return () => {
|
67
|
81
|
setCurrentStatusId(item.id)
|
|
82
|
+ if (item.id === 3) {
|
|
83
|
+ setFormData({ ...RenChouData })
|
|
84
|
+ } else if (item.id === 4) {
|
|
85
|
+ setFormData({ ...QianYueData })
|
|
86
|
+ } else if (item.id === 5) {
|
|
87
|
+ setFormData({ ...QianYueData })
|
|
88
|
+ }
|
68
|
89
|
}
|
69
|
90
|
}
|
70
|
91
|
|
71
|
92
|
const CutRoomType = (item) => {
|
72
|
93
|
return () => {
|
73
|
|
- setCurrentRoomTypeId(item.id === CurrentRoomTypeId ? null : item.id)
|
|
94
|
+ let resData = { ...FormData }
|
|
95
|
+ resData.houseType = item.apartmentId
|
|
96
|
+ setFormData({ ...resData })
|
|
97
|
+ setCurrentRoomTypeId(item.apartmentId)
|
74
|
98
|
}
|
75
|
99
|
}
|
76
|
100
|
|
77
|
101
|
const InputChange = (key, e) => {
|
78
|
|
- let resData = FormData
|
|
102
|
+ let resData = { ...FormData }
|
79
|
103
|
resData[key] = e.detail.value
|
80
|
|
- setFormData(resData)
|
|
104
|
+ setFormData({ ...resData })
|
81
|
105
|
}
|
82
|
106
|
|
83
|
107
|
const PickerChange = (key, e) => {
|
84
|
|
- let resData = FormData
|
|
108
|
+ let resData = { ...FormData }
|
85
|
109
|
if (key === 'realtyConsultant') {
|
86
|
110
|
resData[key] = ConsultantList[e.detail.value].id
|
87
|
111
|
resData.realtyConsultantName = ConsultantList[e.detail.value].name
|
88
|
112
|
setCurrnetConsultant(ConsultantList[e.detail.value])
|
89
|
113
|
}
|
90
|
|
- setFormData(resData)
|
|
114
|
+ setFormData({ ...resData })
|
|
115
|
+ }
|
|
116
|
+
|
|
117
|
+ const CheckForm = () => {
|
|
118
|
+ if (CurrentStatusId === 3) { // 认筹
|
|
119
|
+ if (FormData.name === '') {
|
|
120
|
+ Taro.showToast({ title: '姓名不能为空', icon: 'none', duration: 2000 })
|
|
121
|
+ return false
|
|
122
|
+ }
|
|
123
|
+ if (FormData.realtyConsultant === '') {
|
|
124
|
+ Taro.showToast({ title: '请选择内场接待', icon: 'none', duration: 2000 })
|
|
125
|
+ return false
|
|
126
|
+ }
|
|
127
|
+ } else if (CurrentStatusId === 4) { // 签约
|
|
128
|
+
|
|
129
|
+ }
|
|
130
|
+ return true
|
|
131
|
+ }
|
|
132
|
+
|
|
133
|
+ const ToSubmit = () => {
|
|
134
|
+ // if (!CheckForm()) return false
|
|
135
|
+ if (CurrentStatusId === 3) {
|
|
136
|
+ fetch({ url: API_SURE_CHIP, method: 'put', payload: { customerId: id, customerPreparatory: { ...FormData, channelId: channelId === 'null' || channelId === null ? '' : channelId } } }).then(() => {
|
|
137
|
+ Taro.showToast({ title: '修改成功', icon: 'none', duration: 2000 })
|
|
138
|
+ })
|
|
139
|
+ } else if (CurrentStatusId === 4) {
|
|
140
|
+ let params = {}
|
|
141
|
+ for (let key in FormData) {
|
|
142
|
+ if (key !== 'dividendsName' && key !== 'dividendsPer') {
|
|
143
|
+ params[key] = { ...FormData }[key]
|
|
144
|
+ }
|
|
145
|
+ }
|
|
146
|
+ params.dividendsName = `${FormData.dividendsName}|${FormData.dividendsPer}%`
|
|
147
|
+ fetch({ url: API_SURE_SIGN, method: 'put', payload: { customerId: id, customerSignatory: { ...params, channelId: channelId === 'null' || channelId === null ? '' : channelId } } }).then(() => {
|
|
148
|
+ Taro.showToast({ title: '修改成功', icon: 'none', duration: 2000 })
|
|
149
|
+ })
|
|
150
|
+ } else if (CurrentStatusId === 5) {
|
|
151
|
+ let params = {}
|
|
152
|
+ for (let key in FormData) {
|
|
153
|
+ if (key !== 'dividendsName' && key !== 'dividendsPer') {
|
|
154
|
+ params[key] = { ...FormData }[key]
|
|
155
|
+ }
|
|
156
|
+ }
|
|
157
|
+ params.dividendsName = `${FormData.dividendsName}|${FormData.dividendsPer}%`
|
|
158
|
+ fetch({ url: API_SURE_BUY, method: 'put', payload: { customerId: id, customerSignatory: { ...params, channelId: channelId === 'null' || channelId === null ? '' : channelId } } }).then(() => {
|
|
159
|
+ Taro.showToast({ title: '修改成功', icon: 'none', duration: 2000 })
|
|
160
|
+ })
|
|
161
|
+ }
|
|
162
|
+ }
|
|
163
|
+
|
|
164
|
+ const SuccessDateChange = (e) => {
|
|
165
|
+ let resData = { ...FormData }
|
|
166
|
+ resData.successDate = new Date(e.detail.value)
|
|
167
|
+ setFormData(resData.successDate)
|
|
168
|
+ setSuccessDate(e.detail.value)
|
91
|
169
|
}
|
92
|
170
|
|
93
|
171
|
return (
|
|
@@ -102,7 +180,7 @@ export default withLayout((props) => {
|
102
|
180
|
<view className='CheckBoxList'>
|
103
|
181
|
{
|
104
|
182
|
StatusList.map((item, index) => (
|
105
|
|
- <view key={`StatusItem-${index}`} onClick={CutStatus(item)}>
|
|
183
|
+ <view key={`StatusItem-${index}`} onClick={CutStatus(item)} style={{ marginRight: index === 2 ? '0px' : '44rpx' }}>
|
106
|
184
|
<text>{item.name}</text>
|
107
|
185
|
{
|
108
|
186
|
CurrentStatusId === item.id &&
|
|
@@ -115,99 +193,114 @@ export default withLayout((props) => {
|
115
|
193
|
</view>
|
116
|
194
|
</view>
|
117
|
195
|
|
|
196
|
+ <text className='required'>客户姓名</text>
|
|
197
|
+ <view className='FormLine flex-h'>
|
|
198
|
+ <view className='flex-item'>
|
|
199
|
+ <Input placeholder='请输入姓名' disabled={CurrentStatusId === 5} value={FormData.name} onInput={InputChange.bind(this, 'name')}></Input>
|
|
200
|
+ </view>
|
|
201
|
+ </view>
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+ <text>归属渠道</text>
|
|
205
|
+ <view className='FormLine flex-h'>
|
|
206
|
+ <view className='flex-item'>
|
|
207
|
+ <Input placeholder='请输入渠道' disabled value={type === 'customer' ? '-' : ''}></Input>
|
|
208
|
+ </view>
|
|
209
|
+ </view>
|
|
210
|
+
|
|
211
|
+ <text className='required'>内场接待</text>
|
|
212
|
+ <view className='FormLine flex-h'>
|
|
213
|
+ <view className='flex-item'>
|
|
214
|
+ <Picker range-key='name' range={ConsultantList} value={0} onChange={PickerChange.bind(this, 'realtyConsultant')}>{CurrnetConsultant.name || '请选择'}</Picker>
|
|
215
|
+ </view>
|
|
216
|
+ </view>
|
|
217
|
+
|
118
|
218
|
{
|
119
|
|
- CurrentStatusId === 3 &&
|
|
219
|
+ (CurrentStatusId === 4 || CurrentStatusId === 5) &&
|
120
|
220
|
<Block>
|
121
|
|
- <text className='required'>客户姓名</text>
|
|
221
|
+ <text className='required'>业绩分成人|占比/%</text>
|
122
|
222
|
<view className='FormLine flex-h'>
|
123
|
223
|
<view className='flex-item'>
|
124
|
|
- <Input placeholder='请输入姓名' value={FormData.name} onInput={InputChange.bind(this, 'name')}></Input>
|
|
224
|
+ <Input placeholder='请输入业绩分成人' onInput={InputChange.bind(this, 'dividendsName')}></Input>
|
|
225
|
+ </view>
|
|
226
|
+ <view className='flex-item'>
|
|
227
|
+ <Input placeholder='请输入占比%' type='number' onInput={InputChange.bind(this, 'dividendsPer')}></Input>
|
125
|
228
|
</view>
|
126
|
229
|
</view>
|
127
|
230
|
</Block>
|
128
|
231
|
}
|
129
|
232
|
|
130
|
233
|
{
|
131
|
|
- CurrentStatusId === 3 &&
|
|
234
|
+ (CurrentStatusId === 4 || CurrentStatusId === 5) &&
|
132
|
235
|
<Block>
|
133
|
|
- <text>归属渠道</text>
|
|
236
|
+ <text className='required'>户型</text>
|
134
|
237
|
<view className='FormLine flex-h'>
|
135
|
238
|
<view className='flex-item'>
|
136
|
|
- <Input placeholder='请输入渠道' disabled value={type === 'customer' ? '-' : ''}></Input>
|
|
239
|
+ <view className='CheckBoxList'>
|
|
240
|
+ {
|
|
241
|
+ HouseTypeList.map((item, index) => (
|
|
242
|
+ <view key={`RoomTypeItem-${index}`} onClick={CutRoomType(item)}>
|
|
243
|
+ <text>{item.apartmentName}</text>
|
|
244
|
+ {
|
|
245
|
+ CurrentRoomTypeId === item.apartmentId &&
|
|
246
|
+ <Image mode='widthFix' src={require('@/assets/findHouse-icon1.png')}></Image>
|
|
247
|
+ }
|
|
248
|
+ </view>
|
|
249
|
+ ))
|
|
250
|
+ }
|
|
251
|
+ </view>
|
137
|
252
|
</view>
|
138
|
253
|
</view>
|
139
|
254
|
</Block>
|
140
|
255
|
}
|
141
|
256
|
|
142
|
257
|
{
|
143
|
|
- CurrentStatusId === 3 &&
|
|
258
|
+ (CurrentStatusId === 4 || CurrentStatusId === 5) &&
|
144
|
259
|
<Block>
|
145
|
|
- <text className='required'>内场接待</text>
|
|
260
|
+ <text className='required'>房号</text>
|
146
|
261
|
<view className='FormLine flex-h'>
|
147
|
262
|
<view className='flex-item'>
|
148
|
|
- <Picker range-key='name' range={ConsultantList} value={0} onChange={PickerChange.bind(this, 'realtyConsultant')}>{CurrnetConsultant.name || '请选择'}</Picker>
|
|
263
|
+ <Input placeholder='请输入房号' onInput={InputChange.bind(this, 'houseInfo')}></Input>
|
149
|
264
|
</view>
|
150
|
265
|
</view>
|
151
|
266
|
</Block>
|
152
|
267
|
}
|
153
|
268
|
|
154
|
|
- <text className='required'>业绩分成人|占比/%</text>
|
155
|
|
- <view className='FormLine flex-h'>
|
156
|
|
- <view className='flex-item'>
|
157
|
|
- <Input placeholder='请输入业绩分成人|占比/%'></Input>
|
158
|
|
- </view>
|
159
|
|
- </view>
|
160
|
|
-
|
161
|
|
- <text className='required'>户型</text>
|
162
|
|
- <view className='FormLine flex-h'>
|
163
|
|
- <view className='flex-item'>
|
164
|
|
- <view className='CheckBoxList'>
|
165
|
|
- {
|
166
|
|
- RoomTypeList.map((item, index) => (
|
167
|
|
- <view key={`RoomTypeItem-${index}`} onClick={CutRoomType(item)}>
|
168
|
|
- <text>{item.name}</text>
|
169
|
|
- {
|
170
|
|
- CurrentRoomTypeId === item.id &&
|
171
|
|
- <Image mode='widthFix' src={require('../../../assets/findHouse-icon1.png')}></Image>
|
172
|
|
- }
|
173
|
|
- </view>
|
174
|
|
- ))
|
175
|
|
- }
|
|
269
|
+ {
|
|
270
|
+ (CurrentStatusId === 4 || CurrentStatusId === 5) &&
|
|
271
|
+ <Block>
|
|
272
|
+ <text className='required'>签约日期</text>
|
|
273
|
+ <view className='FormLine flex-h'>
|
|
274
|
+ <view className='flex-item'>
|
|
275
|
+ <Picker mode='date' value={null} onChange={SuccessDateChange}>{SuccessDate || '请选择开始日期'}</Picker>
|
|
276
|
+ </view>
|
|
277
|
+ <text className='iconfont icon-jiantoudown'></text>
|
176
|
278
|
</view>
|
177
|
|
- </view>
|
178
|
|
- </view>
|
179
|
|
-
|
180
|
|
- <text className='required'>房号</text>
|
181
|
|
- <view className='FormLine flex-h'>
|
182
|
|
- <view className='flex-item'>
|
183
|
|
- <Input placeholder='请输入房号'></Input>
|
184
|
|
- </view>
|
185
|
|
- </view>
|
|
279
|
+ </Block>
|
|
280
|
+ }
|
186
|
281
|
|
187
|
|
- <text className='required'>签约日期</text>
|
188
|
|
- <view className='FormLine flex-h'>
|
189
|
|
- <view className='flex-item'>
|
190
|
|
- <text>请选择</text>
|
191
|
|
- </view>
|
192
|
|
- <text className='iconfont icon-jiantoudown'></text>
|
193
|
|
- </view>
|
|
282
|
+ {
|
|
283
|
+ (CurrentStatusId === 4 || CurrentStatusId === 5) &&
|
|
284
|
+ <Block>
|
|
285
|
+ <text className='required'>成交金额</text>
|
|
286
|
+ <view className='FormLine flex-h'>
|
|
287
|
+ <view className='flex-item'>
|
|
288
|
+ <Input placeholder='请输入金额' onInput={InputChange.bind(this, 'price')}></Input>
|
|
289
|
+ </view>
|
|
290
|
+ </view>
|
|
291
|
+ </Block>
|
|
292
|
+ }
|
194
|
293
|
|
195
|
|
- <text className='required'>成交金额</text>
|
196
|
|
- <view className='FormLine flex-h'>
|
197
|
|
- <view className='flex-item'>
|
198
|
|
- <Input placeholder='请输入金额'></Input>
|
199
|
|
- </view>
|
200
|
|
- </view>
|
201
|
294
|
|
202
|
295
|
<text>备注</text>
|
203
|
296
|
<view className='FormLine flex-h'>
|
204
|
297
|
<view className='flex-item'>
|
205
|
|
- <Input placeholder='补充说明(选填)'></Input>
|
|
298
|
+ <Input placeholder='补充说明(选填)' value={FormData.remark} onInput={InputChange.bind(this, 'remark')}></Input>
|
206
|
299
|
</view>
|
207
|
300
|
</view>
|
208
|
301
|
|
209
|
302
|
<view className='Btn'>
|
210
|
|
- <text>提交</text>
|
|
303
|
+ <text onClick={ToSubmit}>提交</text>
|
211
|
304
|
</view>
|
212
|
305
|
|
213
|
306
|
</view>
|