Quellcode durchsuchen

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

xujing vor 5 Jahren
Ursprung
Commit
8b9ccba28e

+ 11
- 0
src/onlineSelling/pages/detail/index.js Datei anzeigen

@@ -140,6 +140,17 @@ export default class Index extends Component {
140 140
 
141 141
   toRaiseMoney() {
142 142
     const detail = this.state.houseDetail || {}
143
+
144
+    if (detail.status != 1 || detail.houseLockingStatus == 'locked') {
145
+      Taro.showToast({
146
+        url: '当前房源被锁定或未发布, 不能认筹',
147
+        icon: 'none',
148
+      })
149
+
150
+      return;
151
+    }
152
+
153
+
143 154
     this.props.dispatchAddCart(detail)
144 155
     Taro.navigateTo({ url: `/onlineSelling/pages/raiseMoney/index?houseId=${detail.houseId}&salesBatchId=${detail.salesBatchId}` })
145 156
   }

+ 1
- 0
src/onlineSelling/pages/houseCart/index.js Datei anzeigen

@@ -45,6 +45,7 @@ export default class extends Component {
45 45
       const { id: salesBatchId, multi } = this.$router.params
46 46
 
47 47
       const params = {
48
+        source: 'raiseChoose',
48 49
         salesBatchId,
49 50
         pageNum: 1,
50 51
         pageSize: 9999,

+ 39
- 10
src/onlineSelling/pages/raiseMoney/index.js Datei anzeigen

@@ -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
     );

+ 14
- 4
src/onlineSelling/pages/records/index.js Datei anzeigen

@@ -62,7 +62,7 @@ export default class Records extends Component {
62 62
       const { userInfo: { person: { personId } }, house } = this.props
63 63
       const params = {
64 64
         personId,
65
-        salesBatchId,
65
+        // salesBatchId,
66 66
         pageNumber: 1,
67 67
         pageSize: 999,
68 68
       }
@@ -139,8 +139,17 @@ export default class Records extends Component {
139 139
       return;
140 140
     }
141 141
 
142
-    debugger
143 142
     const houseList = recordList.map(x => x.housingInfo).filter(x => chooseList.indexOf(x.houseId) > -1)
143
+
144
+    // 选择房源必须同一批次
145
+    const checkHouse = houseList[0]
146
+    for (let inx in houseList) {
147
+      if (houseList[inx].salesBatchId != checkHouse.salesBatchId) {
148
+        Taro.showToast({ title: '所选房源不属于同一销售批次, 请筛选后重选', icon: 'none' })
149
+        return;
150
+      }
151
+    }
152
+
144 153
     this.props.dispatchFlush2Cart(houseList);
145 154
 
146 155
     Taro.navigateTo({
@@ -256,6 +265,7 @@ export default class Records extends Component {
256 265
       }
257 266
     })
258 267
   }
268
+
259 269
   loadAparamentType(salesBatchId) {
260 270
     queryApartmentType({ salesBatchId: salesBatchId }).then(res => {
261 271
       res.unshift({ apartmentName: '请选择', apartmentId: '' })
@@ -264,8 +274,8 @@ export default class Records extends Component {
264 274
       })
265 275
     })
266 276
   }
267
-  handleApartmentChange = e => {
268 277
 
278
+  handleApartmentChange = e => {
269 279
     const { apartmentList } = this.state
270 280
 
271 281
     this.setState({
@@ -343,8 +353,8 @@ export default class Records extends Component {
343 353
         buildingId,
344 354
         salesBatchId,
345 355
         houseLockingStatus,
346
-
347 356
       }
357
+
348 358
       this.getRaise(params)
349 359
     }
350 360