|
@@ -5,7 +5,8 @@ import '@/assets/css/iconfont.css'
|
5
|
5
|
import { getCardList } from '@/services/card'
|
6
|
6
|
import { fetch } from '@/utils/request'
|
7
|
7
|
import Taro from '@tarojs/taro'
|
8
|
|
-import { API_SURE_CHIP, API_BUILDING_HOUSE_TYPE, API_SURE_SIGN, API_SURE_BUY } from '@/constants/api'
|
|
8
|
+import { formatDate } from "@/utils/chatDate";
|
|
9
|
+import { API_SURE_CHIP, API_BUILDING_HOUSE_TYPE, API_SURE_SIGN, API_SURE_BUY, API_CUSTOMER_DETAILINFO } from '@/constants/api'
|
9
|
10
|
import './index.scss'
|
10
|
11
|
|
11
|
12
|
export default withLayout((props) => {
|
|
@@ -13,13 +14,13 @@ export default withLayout((props) => {
|
13
|
14
|
const { router } = props
|
14
|
15
|
const { name, buildingId, type, id, channelId } = router.params
|
15
|
16
|
|
16
|
|
- const RenChouData = {
|
|
17
|
+ const [RenChouData, setRenChouData] = useState({
|
17
|
18
|
name,
|
18
|
19
|
realtyConsultant: '',
|
19
|
20
|
remark: '',
|
20
|
|
- }
|
|
21
|
+ })
|
21
|
22
|
|
22
|
|
- const QianYueData = {
|
|
23
|
+ const [QianYueData, setQianYueData] = useState({
|
23
|
24
|
name,
|
24
|
25
|
realtyConsultant: '',
|
25
|
26
|
remark: '',
|
|
@@ -29,7 +30,7 @@ export default withLayout((props) => {
|
29
|
30
|
houseType: '',
|
30
|
31
|
price: '',
|
31
|
32
|
successDate: '',
|
32
|
|
- }
|
|
33
|
+ })
|
33
|
34
|
|
34
|
35
|
const [FormData, setFormData] = useState({ ...RenChouData })
|
35
|
36
|
|
|
@@ -48,12 +49,6 @@ export default withLayout((props) => {
|
48
|
49
|
|
49
|
50
|
const [CurrentRoomTypeId, setCurrentRoomTypeId] = useState(null)
|
50
|
51
|
|
51
|
|
- useEffect(() => {
|
52
|
|
- if (channelId !== null && channelId !== 'null') {
|
53
|
|
-
|
54
|
|
- }
|
55
|
|
- }, [])
|
56
|
|
-
|
57
|
52
|
useEffect(() => {
|
58
|
53
|
if (buildingId) {
|
59
|
54
|
const params = {
|
|
@@ -68,6 +63,32 @@ export default withLayout((props) => {
|
68
|
63
|
}
|
69
|
64
|
}, [buildingId])
|
70
|
65
|
|
|
66
|
+ useEffect(() => {
|
|
67
|
+ fetch({ url: `${API_CUSTOMER_DETAILINFO}/${id}`, method: 'get' }).then((res) => {
|
|
68
|
+ if(CurrentStatusId - 0 === 3) {
|
|
69
|
+ setFormData({ ...FormData, ...res?.customerPreparatory })
|
|
70
|
+ }
|
|
71
|
+ setRenChouData({ ...RenChouData, ...res?.customerPreparatory })
|
|
72
|
+ if((res.customerSignatory || []).length) {
|
|
73
|
+ let customerSignatory = res.customerSignatory[0]
|
|
74
|
+ customerSignatory.dividendsPer = customerSignatory.dividendsName.substring(customerSignatory.dividendsName.indexOf('|') + 1, customerSignatory.dividendsName.indexOf('%'))
|
|
75
|
+ customerSignatory.dividendsName = customerSignatory.dividendsName.substring(0, customerSignatory.dividendsName.indexOf('|'))
|
|
76
|
+ setQianYueData({...QianYueData, ...customerSignatory})
|
|
77
|
+ HouseTypeList.map((item) => {
|
|
78
|
+ if(item.apartmentId === res.customerSignatory[0].houseType) {
|
|
79
|
+ setCurrentRoomTypeId(item.apartmentId)
|
|
80
|
+ }
|
|
81
|
+ })
|
|
82
|
+ setSuccessDate(res.customerSignatory[0].successDate.substring(0, 10))
|
|
83
|
+ }
|
|
84
|
+ ConsultantList.map((item) => {
|
|
85
|
+ if(item.id === res.customerPreparatory.realtyConsultant) {
|
|
86
|
+ setCurrnetConsultant(item)
|
|
87
|
+ }
|
|
88
|
+ })
|
|
89
|
+ })
|
|
90
|
+ }, [ConsultantList, HouseTypeList])
|
|
91
|
+
|
71
|
92
|
useEffect(() => {
|
72
|
93
|
if (CurrentStatusId - 0 !== 3 && buildingId) {
|
73
|
94
|
fetch({ url: `${API_BUILDING_HOUSE_TYPE}?buildingId=${buildingId}&pageSize=${500}`, method: 'get' }).then((res) => {
|
|
@@ -76,14 +97,18 @@ export default withLayout((props) => {
|
76
|
97
|
}
|
77
|
98
|
}, [CurrentStatusId, buildingId])
|
78
|
99
|
|
|
100
|
+ useEffect(() => {
|
|
101
|
+ console.log(FormData)
|
|
102
|
+ }, [FormData])
|
|
103
|
+
|
79
|
104
|
const CutStatus = (item) => {
|
80
|
105
|
return () => {
|
81
|
106
|
setCurrentStatusId(item.id)
|
82
|
|
- if (item.id === 3) {
|
|
107
|
+ if (item.id - 0 === 3) {
|
83
|
108
|
setFormData({ ...RenChouData })
|
84
|
|
- } else if (item.id === 4) {
|
|
109
|
+ } else if (item.id - 0 === 4) {
|
85
|
110
|
setFormData({ ...QianYueData })
|
86
|
|
- } else if (item.id === 5) {
|
|
111
|
+ } else if (item.id - 0 === 5) {
|
87
|
112
|
setFormData({ ...QianYueData })
|
88
|
113
|
}
|
89
|
114
|
}
|
|
@@ -101,12 +126,9 @@ export default withLayout((props) => {
|
101
|
126
|
const InputChange = (key, e) => {
|
102
|
127
|
let resData = { ...FormData }
|
103
|
128
|
resData[key] = e.detail.value
|
104
|
|
- console.log('---------resData---------', resData)
|
105
|
129
|
setFormData({ ...resData })
|
106
|
130
|
}
|
107
|
131
|
|
108
|
|
- console.log('---------FormData---------', FormData)
|
109
|
|
-
|
110
|
132
|
const PickerChange = (key, e) => {
|
111
|
133
|
let resData = { ...FormData }
|
112
|
134
|
if (key === 'realtyConsultant') {
|
|
@@ -134,7 +156,6 @@ export default withLayout((props) => {
|
134
|
156
|
}
|
135
|
157
|
|
136
|
158
|
const ToSubmit = () => {
|
137
|
|
- // if (!CheckForm()) return false
|
138
|
159
|
if (CurrentStatusId === 3) {
|
139
|
160
|
fetch({ url: API_SURE_CHIP, method: 'put', payload: { customerId: id, customerPreparatory: { ...FormData, channelId: channelId === 'null' || channelId === null ? '' : channelId } } }).then(() => {
|
140
|
161
|
Taro.showToast({ title: '修改成功', icon: 'none', duration: 2000 })
|
|
@@ -176,7 +197,7 @@ export default withLayout((props) => {
|
176
|
197
|
const SuccessDateChange = (e) => {
|
177
|
198
|
let resData = { ...FormData }
|
178
|
199
|
resData.successDate = new Date(e.detail.value)
|
179
|
|
- setFormData(resData.successDate)
|
|
200
|
+ setFormData(resData)
|
180
|
201
|
setSuccessDate(e.detail.value)
|
181
|
202
|
}
|
182
|
203
|
|
|
@@ -233,10 +254,10 @@ export default withLayout((props) => {
|
233
|
254
|
<text className='required'>业绩分成人|占比/%</text>
|
234
|
255
|
<view className='FormLine flex-h'>
|
235
|
256
|
<view className='flex-item'>
|
236
|
|
- <Input placeholder='请输入业绩分成人' onInput={InputChange.bind(this, 'dividendsName')}></Input>
|
|
257
|
+ <Input placeholder='请输入业绩分成人' value={FormData.dividendsName} onInput={InputChange.bind(this, 'dividendsName')}></Input>
|
237
|
258
|
</view>
|
238
|
259
|
<view className='flex-item'>
|
239
|
|
- <Input placeholder='请输入占比%' type='number' onInput={InputChange.bind(this, 'dividendsPer')}></Input>
|
|
260
|
+ <Input placeholder='请输入占比%' value={FormData.dividendsPer} type='number' onInput={InputChange.bind(this, 'dividendsPer')}></Input>
|
240
|
261
|
</view>
|
241
|
262
|
</view>
|
242
|
263
|
</Block>
|
|
@@ -272,7 +293,7 @@ export default withLayout((props) => {
|
272
|
293
|
<text className='required'>房号</text>
|
273
|
294
|
<view className='FormLine flex-h'>
|
274
|
295
|
<view className='flex-item'>
|
275
|
|
- <Input placeholder='请输入房号' onInput={InputChange.bind(this, 'houseInfo')}></Input>
|
|
296
|
+ <Input placeholder='请输入房号' value={FormData.houseInfo} onInput={InputChange.bind(this, 'houseInfo')}></Input>
|
276
|
297
|
</view>
|
277
|
298
|
</view>
|
278
|
299
|
</Block>
|
|
@@ -284,7 +305,7 @@ export default withLayout((props) => {
|
284
|
305
|
<text className='required'>签约日期</text>
|
285
|
306
|
<view className='FormLine flex-h'>
|
286
|
307
|
<view className='flex-item'>
|
287
|
|
- <Picker mode='date' value={null} onChange={SuccessDateChange}>{SuccessDate || '请选择开始日期'}</Picker>
|
|
308
|
+ <Picker mode='date' value={FormData.successDate} onChange={SuccessDateChange}>{SuccessDate || '请选择开始日期'}</Picker>
|
288
|
309
|
</view>
|
289
|
310
|
<text className='iconfont icon-jiantoudown'></text>
|
290
|
311
|
</view>
|
|
@@ -297,7 +318,7 @@ export default withLayout((props) => {
|
297
|
318
|
<text className='required'>成交金额</text>
|
298
|
319
|
<view className='FormLine flex-h'>
|
299
|
320
|
<view className='flex-item'>
|
300
|
|
- <Input placeholder='请输入金额' onInput={InputChange.bind(this, 'price')}></Input>
|
|
321
|
+ <Input placeholder='请输入金额' value={FormData.price} onInput={InputChange.bind(this, 'price')}></Input>
|
301
|
322
|
</view>
|
302
|
323
|
</view>
|
303
|
324
|
</Block>
|