|
@@ -13,6 +13,7 @@ import { fetch, apis } from '@/utils/request'
|
13
|
13
|
import Captcha from './Captcha'
|
14
|
14
|
import { raiseOrder, cancelOrder, queryPreselectionRecord } from '@/services/project'
|
15
|
15
|
import { getCodeMessage, checkCaptcha } from '@/services/getCode'
|
|
16
|
+import { checkRaise } from '@/services/house'
|
16
|
17
|
import { checkIDCard, isEmpty } from '@/utils/tools'
|
17
|
18
|
import ContactConsultant from '../../components/ContactConsultant'
|
18
|
19
|
import RadioList from './RadioList'
|
|
@@ -218,8 +219,8 @@ export default class raiseMoney extends Component {
|
218
|
219
|
}
|
219
|
220
|
renderHouse() {
|
220
|
221
|
const { house: { raiseCart } } = this.props
|
221
|
|
- const { raiseProfile = {} } = this.state
|
222
|
|
- const disabled = raiseProfile.houseLockingType === 'auto'
|
|
222
|
+ const { raiseProfile = {}, record } = this.state
|
|
223
|
+ const disabled = raiseProfile.houseLockingType === 'auto' || !!record.raiseRecordId
|
223
|
224
|
|
224
|
225
|
return (
|
225
|
226
|
<ScrollView scrollY className="container">
|
|
@@ -451,8 +452,8 @@ export default class raiseMoney extends Component {
|
451
|
452
|
)
|
452
|
453
|
}
|
453
|
454
|
|
454
|
|
- checkRaise = () => {
|
455
|
|
- const { record, raiseProfile, preselectList } = this.state
|
|
455
|
+ validRaise = () => {
|
|
456
|
+ // const { record, raiseProfile, preselectList } = this.state
|
456
|
457
|
const { house } = this.props
|
457
|
458
|
|
458
|
459
|
// 当前选中房源
|
|
@@ -463,36 +464,40 @@ export default class raiseMoney extends Component {
|
463
|
464
|
return Promise.reject()
|
464
|
465
|
}
|
465
|
466
|
|
466
|
|
- // 如果要求预选, 预先房源跟当前列表必须一致
|
467
|
|
- if (raiseProfile.needPreselection) {
|
468
|
|
- for (let i in houseList) {
|
469
|
|
- const exists = preselectList.filter(x => x.houseId === houseList[i].houseId)[0]
|
470
|
|
- if (!exists) {
|
471
|
|
- Taro.showToast({ title: '需要先预选才能认筹', icon: 'none' })
|
472
|
|
- return Promise.reject()
|
473
|
|
- }
|
474
|
|
- }
|
475
|
|
- }
|
476
|
|
-
|
477
|
|
- if (record.raiseRecordId) {
|
478
|
|
- // 如果认筹单跟预选的房源不一致, 说明是新的认筹
|
479
|
|
- let found = true
|
480
|
|
- for (let inx in houseList) {
|
481
|
|
- const has = (record.taHousingResourcesList || []).filter(x => x.houseId == houseList[inx].houseId)[0]
|
482
|
|
-
|
483
|
|
- if (!has) {
|
484
|
|
- found = false;
|
485
|
|
- break;
|
486
|
|
- }
|
487
|
|
- }
|
488
|
|
-
|
489
|
|
- if (!found) {
|
490
|
|
- const defaultRecord = this.initRecord()
|
491
|
|
- this.setState({ record: defaultRecord })
|
492
|
|
- }
|
493
|
|
- }
|
|
467
|
+ return new Promise((resolve, reject) => {
|
|
468
|
+ checkRaise(houseList).then(resolve).catch(reject)
|
|
469
|
+ })
|
494
|
470
|
|
495
|
|
- return Promise.resolve()
|
|
471
|
+ // // 如果要求预选, 预先房源跟当前列表必须一致
|
|
472
|
+ // if (raiseProfile.needPreselection) {
|
|
473
|
+ // for (let i in houseList) {
|
|
474
|
+ // const exists = preselectList.filter(x => x.houseId === houseList[i].houseId)[0]
|
|
475
|
+ // if (!exists) {
|
|
476
|
+ // Taro.showToast({ title: '需要先预选才能认筹', icon: 'none' })
|
|
477
|
+ // return Promise.reject()
|
|
478
|
+ // }
|
|
479
|
+ // }
|
|
480
|
+ // }
|
|
481
|
+
|
|
482
|
+ // if (record.raiseRecordId) {
|
|
483
|
+ // // 如果认筹单跟预选的房源不一致, 说明是新的认筹
|
|
484
|
+ // let found = true
|
|
485
|
+ // for (let inx in houseList) {
|
|
486
|
+ // const has = (record.taHousingResourcesList || []).filter(x => x.houseId == houseList[inx].houseId)[0]
|
|
487
|
+
|
|
488
|
+ // if (!has) {
|
|
489
|
+ // found = false;
|
|
490
|
+ // break;
|
|
491
|
+ // }
|
|
492
|
+ // }
|
|
493
|
+
|
|
494
|
+ // if (!found) {
|
|
495
|
+ // const defaultRecord = this.initRecord()
|
|
496
|
+ // this.setState({ record: defaultRecord })
|
|
497
|
+ // }
|
|
498
|
+ // }
|
|
499
|
+
|
|
500
|
+ // return Promise.resolve()
|
496
|
501
|
}
|
497
|
502
|
|
498
|
503
|
makeRaiseRecord = () => {
|
|
@@ -615,8 +620,6 @@ export default class raiseMoney extends Component {
|
615
|
620
|
resolve()
|
616
|
621
|
},
|
617
|
622
|
fail(err) {
|
618
|
|
- console.log(err, "errrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr")
|
619
|
|
-
|
620
|
623
|
cancelOrder(params).then(res => { })
|
621
|
624
|
|
622
|
625
|
// 然后
|
|
@@ -683,56 +686,58 @@ export default class raiseMoney extends Component {
|
683
|
686
|
}
|
684
|
687
|
|
685
|
688
|
nextStep(current) {
|
686
|
|
- switch (current) {
|
687
|
|
- // 确认房源
|
688
|
|
- case 0:
|
689
|
|
- this.checkRaise().then(() => {
|
690
|
|
- this.setState({
|
691
|
|
- current: current + 1
|
692
|
|
- })
|
693
|
|
- })
|
694
|
|
- return;
|
695
|
|
-
|
696
|
|
- // 认筹确认
|
697
|
|
- case 2:
|
698
|
|
- this.makeRaiseRecord().then((res) => {
|
699
|
|
- const { userInfo: { miniApp: { tpls } } } = this.props
|
700
|
|
- const tplId = (tpls.filter(x => x.tplType == noticeType.TPL_HOUSE && x.isSubscribe == true)[0] || {}).tplId
|
701
|
|
- const that = this
|
702
|
|
- wx.requestSubscribeMessage({
|
703
|
|
- tmplIds: [tplId],
|
704
|
|
- success(res) {
|
705
|
|
- },
|
706
|
|
- fail(res) {
|
707
|
|
-
|
708
|
|
- },
|
709
|
|
- complete() {
|
710
|
|
- that.setState({
|
711
|
|
- current: current + 1
|
712
|
|
- })
|
713
|
|
- }
|
714
|
|
- })
|
715
|
|
- })
|
716
|
|
- return;
|
717
|
|
-
|
|
689
|
+ // 缴费的下一步
|
|
690
|
+ if (current > 3) {
|
|
691
|
+ this.setState({
|
|
692
|
+ current: current + 1
|
|
693
|
+ })
|
718
|
694
|
|
|
695
|
+ return;
|
|
696
|
+ }
|
719
|
697
|
|
720
|
|
- // 缴费
|
721
|
|
- case 3:
|
722
|
|
- this.makePay().then(() => {
|
|
698
|
+ this.validRaise().then(() => {
|
|
699
|
+
|
|
700
|
+ switch (current) {
|
|
701
|
+ // 认筹确认
|
|
702
|
+ case 2:
|
|
703
|
+ this.makeRaiseRecord().then((res) => {
|
|
704
|
+ const { userInfo: { miniApp: { tpls } } } = this.props
|
|
705
|
+ const tplId = (tpls.filter(x => x.tplType == noticeType.TPL_HOUSE && x.isSubscribe == true)[0] || {}).tplId
|
|
706
|
+ const that = this
|
|
707
|
+ wx.requestSubscribeMessage({
|
|
708
|
+ tmplIds: [tplId],
|
|
709
|
+ success(res) {
|
|
710
|
+ },
|
|
711
|
+ fail(res) {
|
|
712
|
+
|
|
713
|
+ },
|
|
714
|
+ complete() {
|
|
715
|
+ that.setState({
|
|
716
|
+ current: current + 1
|
|
717
|
+ })
|
|
718
|
+ }
|
|
719
|
+ })
|
|
720
|
+ })
|
|
721
|
+ return;
|
|
722
|
+
|
|
723
|
+ // 缴费
|
|
724
|
+ case 3:
|
|
725
|
+ this.makePay().then(() => {
|
|
726
|
+ this.setState({
|
|
727
|
+ current: current + 1
|
|
728
|
+ })
|
|
729
|
+ })
|
|
730
|
+ return;
|
|
731
|
+
|
|
732
|
+ //
|
|
733
|
+ default:
|
723
|
734
|
this.setState({
|
724
|
735
|
current: current + 1
|
725
|
736
|
})
|
726
|
|
- })
|
727
|
|
- return;
|
|
737
|
+ }
|
728
|
738
|
|
729
|
|
- //
|
730
|
|
- default:
|
731
|
|
- this.setState({
|
732
|
|
- current: current + 1
|
733
|
|
- })
|
|
739
|
+ })
|
734
|
740
|
|
735
|
|
- }
|
736
|
741
|
}
|
737
|
742
|
|
738
|
743
|
upStep(current) {
|