|
@@ -5,6 +5,7 @@ import RaiseCard from '../../components/RaiseCard'
|
5
|
5
|
import Statement from '../../components/Statement'
|
6
|
6
|
import ConsultantItem from '../../components/ConsultantItem/index'
|
7
|
7
|
import ready from '@/utils/ready'
|
|
8
|
+import dayjs from 'dayjs'
|
8
|
9
|
import { connect } from '@tarojs/redux'
|
9
|
10
|
import * as houseActions from '@/actions/house'
|
10
|
11
|
import NextStep from './NextStep'
|
|
@@ -35,7 +36,6 @@ const saveRaiseRecord = (record, raise) => {
|
35
|
36
|
buildingId: raise.buildingId,
|
36
|
37
|
}
|
37
|
38
|
|
38
|
|
-
|
39
|
39
|
return fetch({ url: `${apis.API_SAVE_RAISE_RECORD}`, method: 'POST', payload })
|
40
|
40
|
}
|
41
|
41
|
|
|
@@ -102,6 +102,16 @@ export default class raiseMoney extends Component {
|
102
|
102
|
|
103
|
103
|
this.setState({ raiseProfile: res, payType, record: res.record || defaultRecord })
|
104
|
104
|
|
|
105
|
+ // 销售批次已被取消发布
|
|
106
|
+ if (res.status != 1) {
|
|
107
|
+ this.setState({ current: 4, failInfo: { title: '认筹失败', desc: '销售批次已被取消发布' } })
|
|
108
|
+ }
|
|
109
|
+
|
|
110
|
+ // 不在认筹时间内
|
|
111
|
+ if (!dayjs().isBefore(res.raiseEndTime) || !dayjs().isAfter(res.raiseStartTime)) {
|
|
112
|
+ this.setState({ current: 4, failInfo: { title: '认筹失败', desc: '不在认筹时间内' } })
|
|
113
|
+ }
|
|
114
|
+
|
105
|
115
|
// 请求置业顾问列表
|
106
|
116
|
if (!house.consultantList || !house.consultantList.length) {
|
107
|
117
|
this.props.dispatchGetConsultants({
|
|
@@ -119,7 +129,7 @@ export default class raiseMoney extends Component {
|
119
|
129
|
}).then((res2) => {
|
120
|
130
|
// 如果认筹必须预选
|
121
|
131
|
if (res.needPreselection && res2.length < 1) {
|
122
|
|
- this.setState({ current: 4, failInfo: { title: '认筹失败', desc: '请先预选房源' } })
|
|
132
|
+ this.setState({ current: 4, failInfo: { title: '认筹失败', desc: '需要先预选才能认筹' } })
|
123
|
133
|
}
|
124
|
134
|
})
|
125
|
135
|
})
|
|
@@ -162,7 +172,7 @@ export default class raiseMoney extends Component {
|
162
|
172
|
const isMulti = raiseProfile.houseLockingType != 'auto'
|
163
|
173
|
|
164
|
174
|
const url = pageType == 'all' ?
|
165
|
|
- `/onlineSelling/pages/houseCart/index?id=${raiseProfile.salesBatchId}&multi={isMulti}` :
|
|
175
|
+ `/onlineSelling/pages/houseCart/index?id=${raiseProfile.salesBatchId}&multi=${isMulti}` :
|
166
|
176
|
`/onlineSelling/pages/addHouse/index?id=${raiseProfile.salesBatchId}`
|
167
|
177
|
|
168
|
178
|
Taro.navigateTo({ url })
|
|
@@ -434,19 +444,33 @@ export default class raiseMoney extends Component {
|
434
|
444
|
}
|
435
|
445
|
|
436
|
446
|
checkRaise = () => {
|
437
|
|
- const { record } = this.state
|
|
447
|
+ const { record, raiseProfile, preselectList } = this.state
|
438
|
448
|
const { house } = this.props
|
439
|
449
|
|
440
|
|
- if (!house.raiseCart.length) {
|
|
450
|
+ // 当前选中房源
|
|
451
|
+ const houseList = house.raiseCart || []
|
|
452
|
+
|
|
453
|
+ if (!houseList.length) {
|
441
|
454
|
Taro.showToast({ title: '请选择房源', icon: 'none' })
|
442
|
455
|
return Promise.reject()
|
443
|
456
|
}
|
444
|
457
|
|
|
458
|
+ // 如果要求预选, 预先房源跟当前列表必须一致
|
|
459
|
+ if (raiseProfile.needPreselection) {
|
|
460
|
+ for (let i in houseList) {
|
|
461
|
+ const exists = preselectList.filter(x => x.houseId === houseList[i].houseId)[0]
|
|
462
|
+ if (!exists) {
|
|
463
|
+ Taro.showToast({ title: '需要先预选才能认筹', icon: 'none' })
|
|
464
|
+ return Promise.reject()
|
|
465
|
+ }
|
|
466
|
+ }
|
|
467
|
+ }
|
|
468
|
+
|
445
|
469
|
if (record.raiseRecordId) {
|
446
|
470
|
// 如果认筹单跟预选的房源不一致, 说明是新的认筹
|
447
|
471
|
let found = true
|
448
|
|
- for (let inx in house.raiseCart) {
|
449
|
|
- const has = (record.taHousingResourcesList || []).filter(x => x.houseId == house.raiseCart[inx].houseId)[0]
|
|
472
|
+ for (let inx in houseList) {
|
|
473
|
+ const has = (record.taHousingResourcesList || []).filter(x => x.houseId == houseList[inx].houseId)[0]
|
450
|
474
|
|
451
|
475
|
if (!has) {
|
452
|
476
|
found = false;
|
|
@@ -497,6 +521,8 @@ export default class raiseMoney extends Component {
|
497
|
521
|
title: '手机号格式不正确',
|
498
|
522
|
icon: 'none',
|
499
|
523
|
})
|
|
524
|
+
|
|
525
|
+ return Promise.reject()
|
500
|
526
|
}
|
501
|
527
|
|
502
|
528
|
// 验证码
|
|
@@ -528,6 +554,8 @@ export default class raiseMoney extends Component {
|
528
|
554
|
}, raiseProfile).then((res) => {
|
529
|
555
|
this.setState({ record: res })
|
530
|
556
|
resolve(res)
|
|
557
|
+ }).catch((err) => {
|
|
558
|
+ this.setState({ current: 4, failInfo: { title: '认筹失败', desc: err.message || err } })
|
531
|
559
|
})
|
532
|
560
|
})
|
533
|
561
|
}
|
|
@@ -579,7 +607,6 @@ export default class raiseMoney extends Component {
|
579
|
607
|
|
580
|
608
|
}
|
581
|
609
|
toRaiseProfile(id) {
|
582
|
|
-
|
583
|
610
|
Taro.navigateTo({
|
584
|
611
|
url: `/onlineSelling/pages/raiseProfile/index?id=${id}`
|
585
|
612
|
})
|
|
@@ -611,8 +638,10 @@ export default class raiseMoney extends Component {
|
611
|
638
|
}
|
612
|
639
|
|
613
|
640
|
<ContactConsultant buildingId={raiseProfile.buildingId} style=" position: absolute;bottom: 11vh;" />
|
614
|
|
-
|
615
|
|
- <View className="look-btn" onClick={() => this.toRaiseProfile(record.raiseRecordId)}>查看认筹单</View>
|
|
641
|
+ {
|
|
642
|
+ record.raiseRecordId &&
|
|
643
|
+ (<View className="look-btn" onClick={() => this.toRaiseProfile(record.raiseRecordId)}>查看认筹单</View>)
|
|
644
|
+ }
|
616
|
645
|
</View>
|
617
|
646
|
|
618
|
647
|
);
|