Преглед на файлове

Merge branch 'dev' of http://git.ycjcjy.com/zhiyuxing/miniapp-v3 into dev

xujing преди 5 години
родител
ревизия
5f75bc45c8
променени са 1 файла, в които са добавени 59 реда и са изтрити 19 реда
  1. 59
    19
      src/onlineSelling/pages/raiseMoney/index.js

+ 59
- 19
src/onlineSelling/pages/raiseMoney/index.js Целия файл

@@ -10,7 +10,7 @@ import * as houseActions from '@/actions/house'
10 10
 import NextStep from './NextStep'
11 11
 import { fetch, apis } from '@/utils/request'
12 12
 import Captcha from './Captcha'
13
-import { raiseOrder, cancelOrder } from '@/services/project'
13
+import { raiseOrder, cancelOrder, queryPreselectionRecord } from '@/services/project'
14 14
 import { getCodeMessage } from '@/services/getCode'
15 15
 import { checkIDCard, isEmpty } from '@/utils/tools'
16 16
 import ContactConsultant from '../../components/ContactConsultant'
@@ -45,14 +45,15 @@ export default class raiseMoney extends Component {
45 45
     navigationBarTitleText: '认筹确认'
46 46
   }
47 47
   state = {
48
-    current: 3,
48
+    current: 0,
49 49
     inputName: '',
50
-    raiseProfile: undefined,
51
-    record: {},
52
-    protocolCountdown: 5, // 单位 s
53
-    captchaCountdown: 60, // 单位 s
54
-    raiseIdRecord:'',
55
-    payType: '', // 缴费方式
50
+    raiseProfile: undefined,  // 认筹主记录
51
+    record: {},               // 认筹单
52
+    preselectList: [],        // 我的预选 - 当前批次
53
+    protocolCountdown: 10,    // 单位 s
54
+    captchaCountdown: 60,     // 单位 s
55
+    payType: '',              // 缴费方式
56
+    failInfo: undefined,      // 操作失败 - 对象 { title, desc }
56 57
     payTypeList: [
57 58
       { label: '线上缴费', value: 'onLine' },
58 59
       { label: '线下缴费', value: 'offLine' },
@@ -109,6 +110,31 @@ export default class raiseMoney extends Component {
109 110
           pageNumber: 1,
110 111
         })
111 112
       }
113
+
114
+      this.getMyPreselection({
115
+        personId,
116
+        pageNumber: 1,
117
+        pageSize: 999,
118
+        salesBatchId: res.salesBatchId,
119
+      }).then((res2) => {
120
+        // 如果认筹必须预选
121
+        if (res.needPreselection && res2.length < 1) {
122
+          this.setState({ current: 4, failInfo: { title: '认筹失败', desc: '请先预选房源' } })  
123
+        }
124
+      })
125
+    })
126
+  }
127
+
128
+  // 我的预选
129
+  getMyPreselection = (params) => {
130
+    return new Promise((resolve, reject) => {
131
+      queryPreselectionRecord(params).then((res) => {
132
+        this.setState({ preselectList: res.records })
133
+        resolve(res.records)        
134
+      }).catch(() => {
135
+        resolve([])
136
+        // reject()
137
+      })
112 138
     })
113 139
   }
114 140
 
@@ -172,7 +198,7 @@ export default class raiseMoney extends Component {
172 198
   }
173 199
   renderHouse() {
174 200
     const { house: { raiseCart } } = this.props
175
-    const { raiseProfile } = this.state
201
+    const { raiseProfile = {} } = this.state
176 202
     const disabled = raiseProfile.houseLockingType === 'auto'
177 203
 
178 204
     return (
@@ -502,7 +528,7 @@ export default class raiseMoney extends Component {
502 528
   }
503 529
 
504 530
   makePay = () => {
505
-    const { payType } = this.state
531
+    const { payType, record = {} } = this.state
506 532
     if (!payType) {
507 533
       Taro.showToast({
508 534
         title: '请确定支付方式',
@@ -516,7 +542,7 @@ export default class raiseMoney extends Component {
516 542
     }
517 543
 
518 544
     const params = {
519
-      targetId: this.$router.params.raiseRecordId || this.state.raiseIdRecord,
545
+      targetId: this.$router.params.raiseRecordId || record.raiseRecordId,
520 546
       targetType: 'house'
521 547
     }
522 548
 
@@ -554,15 +580,31 @@ export default class raiseMoney extends Component {
554 580
     })
555 581
   }
556 582
   renderResult() {
557
-    const { raiseProfile = {} } = this.state
583
+    const { raiseProfile = {}, failInfo } = this.state
584
+    const isOk = !failInfo
585
+    const showIcon = isOk ? require('../../assets/success2.png') : require('../../assets/fail2.png')
586
+    const showTitle = isOk ? '提交成功' : failInfo.title
587
+
558 588
     return (
559 589
       <View className="result">
560
-        <Image className="result-img" src={require('../../assets/success2.png')}></Image>
590
+        <Image className="result-img" src={showIcon}></Image>
561 591
 
562
-        <View className="status">提交成功</View>
592
+        <View className="status">{showTitle}</View>
593
+
594
+        {
595
+          isOk &&
596
+          (
597
+            <Block>
598
+              <View className="tip" style="margin-bottom:10rpx">详情请查看认筹单</View>
599
+              <View className="tip">支付结果请留意微信支付通知</View>
600
+            </Block>
601
+          )
602
+        }
603
+
604
+        {
605
+          !isOk && (<View className="tip">{(failInfo || {}).desc}</View>)
606
+        }
563 607
 
564
-        <View className="tip" style="margin-bottom:10rpx">详情请查看认筹单</View>
565
-        <View className="tip">支付结果请留意微信支付通知</View>
566 608
         <ContactConsultant buildingId={raiseProfile.buildingId} style=" position: absolute;bottom: 11vh;" />
567 609
 
568 610
         <View className="look-btn" onClick={() => this.toRaiseProfile(raiseProfile.raiseId)}>查看认筹单</View>
@@ -587,9 +629,7 @@ export default class raiseMoney extends Component {
587 629
         this.makeRaiseRecord().then((res) => {
588 630
           console.log(res, "res")
589 631
           this.setState({
590
-            current: current + 1,
591
-            raiseIdRecord: res.raiseRecordId
592
-
632
+            current: current + 1
593 633
           })
594 634
         })
595 635
         return;