瀏覽代碼

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

xujing 5 年之前
父節點
當前提交
8b9ccba28e

+ 11
- 0
src/onlineSelling/pages/detail/index.js 查看文件

140
 
140
 
141
   toRaiseMoney() {
141
   toRaiseMoney() {
142
     const detail = this.state.houseDetail || {}
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
     this.props.dispatchAddCart(detail)
154
     this.props.dispatchAddCart(detail)
144
     Taro.navigateTo({ url: `/onlineSelling/pages/raiseMoney/index?houseId=${detail.houseId}&salesBatchId=${detail.salesBatchId}` })
155
     Taro.navigateTo({ url: `/onlineSelling/pages/raiseMoney/index?houseId=${detail.houseId}&salesBatchId=${detail.salesBatchId}` })
145
   }
156
   }

+ 1
- 0
src/onlineSelling/pages/houseCart/index.js 查看文件

45
       const { id: salesBatchId, multi } = this.$router.params
45
       const { id: salesBatchId, multi } = this.$router.params
46
 
46
 
47
       const params = {
47
       const params = {
48
+        source: 'raiseChoose',
48
         salesBatchId,
49
         salesBatchId,
49
         pageNum: 1,
50
         pageNum: 1,
50
         pageSize: 9999,
51
         pageSize: 9999,

+ 39
- 10
src/onlineSelling/pages/raiseMoney/index.js 查看文件

5
 import Statement from '../../components/Statement'
5
 import Statement from '../../components/Statement'
6
 import ConsultantItem from '../../components/ConsultantItem/index'
6
 import ConsultantItem from '../../components/ConsultantItem/index'
7
 import ready from '@/utils/ready'
7
 import ready from '@/utils/ready'
8
+import dayjs from 'dayjs'
8
 import { connect } from '@tarojs/redux'
9
 import { connect } from '@tarojs/redux'
9
 import * as houseActions from '@/actions/house'
10
 import * as houseActions from '@/actions/house'
10
 import NextStep from './NextStep'
11
 import NextStep from './NextStep'
35
     buildingId: raise.buildingId,
36
     buildingId: raise.buildingId,
36
   }
37
   }
37
 
38
 
38
-
39
   return fetch({ url: `${apis.API_SAVE_RAISE_RECORD}`, method: 'POST', payload })
39
   return fetch({ url: `${apis.API_SAVE_RAISE_RECORD}`, method: 'POST', payload })
40
 }
40
 }
41
 
41
 
102
 
102
 
103
       this.setState({ raiseProfile: res, payType, record: res.record || defaultRecord })
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
       if (!house.consultantList || !house.consultantList.length) {
116
       if (!house.consultantList || !house.consultantList.length) {
107
         this.props.dispatchGetConsultants({
117
         this.props.dispatchGetConsultants({
119
       }).then((res2) => {
129
       }).then((res2) => {
120
         // 如果认筹必须预选
130
         // 如果认筹必须预选
121
         if (res.needPreselection && res2.length < 1) {
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
     const isMulti = raiseProfile.houseLockingType != 'auto'
172
     const isMulti = raiseProfile.houseLockingType != 'auto'
163
 
173
 
164
     const url = pageType == 'all' ?
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
       `/onlineSelling/pages/addHouse/index?id=${raiseProfile.salesBatchId}`
176
       `/onlineSelling/pages/addHouse/index?id=${raiseProfile.salesBatchId}`
167
 
177
 
168
     Taro.navigateTo({ url })
178
     Taro.navigateTo({ url })
434
   }
444
   }
435
 
445
 
436
   checkRaise = () => {
446
   checkRaise = () => {
437
-    const { record } = this.state
447
+    const { record, raiseProfile, preselectList } = this.state
438
     const { house } = this.props
448
     const { house } = this.props
439
 
449
 
440
-    if (!house.raiseCart.length) {
450
+    // 当前选中房源
451
+    const houseList = house.raiseCart || []
452
+
453
+    if (!houseList.length) {
441
       Taro.showToast({ title: '请选择房源', icon: 'none' })
454
       Taro.showToast({ title: '请选择房源', icon: 'none' })
442
       return Promise.reject()
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
     if (record.raiseRecordId) {
469
     if (record.raiseRecordId) {
446
       // 如果认筹单跟预选的房源不一致, 说明是新的认筹
470
       // 如果认筹单跟预选的房源不一致, 说明是新的认筹
447
       let found = true
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
         if (!has) {
475
         if (!has) {
452
           found = false;
476
           found = false;
497
         title: '手机号格式不正确',
521
         title: '手机号格式不正确',
498
         icon: 'none',
522
         icon: 'none',
499
       })
523
       })
524
+
525
+      return Promise.reject()
500
     }
526
     }
501
 
527
 
502
     // 验证码
528
     // 验证码
528
       }, raiseProfile).then((res) => {
554
       }, raiseProfile).then((res) => {
529
         this.setState({ record: res })
555
         this.setState({ record: res })
530
         resolve(res)
556
         resolve(res)
557
+      }).catch((err) => {
558
+        this.setState({ current: 4, failInfo: { title: '认筹失败', desc: err.message || err } }) 
531
       })
559
       })
532
     })
560
     })
533
   }
561
   }
579
 
607
 
580
   }
608
   }
581
   toRaiseProfile(id) {
609
   toRaiseProfile(id) {
582
-
583
     Taro.navigateTo({
610
     Taro.navigateTo({
584
       url: `/onlineSelling/pages/raiseProfile/index?id=${id}`
611
       url: `/onlineSelling/pages/raiseProfile/index?id=${id}`
585
     })
612
     })
611
         }
638
         }
612
 
639
 
613
         <ContactConsultant buildingId={raiseProfile.buildingId} style=" position: absolute;bottom: 11vh;" />
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
       </View>
645
       </View>
617
 
646
 
618
     );
647
     );

+ 14
- 4
src/onlineSelling/pages/records/index.js 查看文件

62
       const { userInfo: { person: { personId } }, house } = this.props
62
       const { userInfo: { person: { personId } }, house } = this.props
63
       const params = {
63
       const params = {
64
         personId,
64
         personId,
65
-        salesBatchId,
65
+        // salesBatchId,
66
         pageNumber: 1,
66
         pageNumber: 1,
67
         pageSize: 999,
67
         pageSize: 999,
68
       }
68
       }
139
       return;
139
       return;
140
     }
140
     }
141
 
141
 
142
-    debugger
143
     const houseList = recordList.map(x => x.housingInfo).filter(x => chooseList.indexOf(x.houseId) > -1)
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
     this.props.dispatchFlush2Cart(houseList);
153
     this.props.dispatchFlush2Cart(houseList);
145
 
154
 
146
     Taro.navigateTo({
155
     Taro.navigateTo({
256
       }
265
       }
257
     })
266
     })
258
   }
267
   }
268
+
259
   loadAparamentType(salesBatchId) {
269
   loadAparamentType(salesBatchId) {
260
     queryApartmentType({ salesBatchId: salesBatchId }).then(res => {
270
     queryApartmentType({ salesBatchId: salesBatchId }).then(res => {
261
       res.unshift({ apartmentName: '请选择', apartmentId: '' })
271
       res.unshift({ apartmentName: '请选择', apartmentId: '' })
264
       })
274
       })
265
     })
275
     })
266
   }
276
   }
267
-  handleApartmentChange = e => {
268
 
277
 
278
+  handleApartmentChange = e => {
269
     const { apartmentList } = this.state
279
     const { apartmentList } = this.state
270
 
280
 
271
     this.setState({
281
     this.setState({
343
         buildingId,
353
         buildingId,
344
         salesBatchId,
354
         salesBatchId,
345
         houseLockingStatus,
355
         houseLockingStatus,
346
-
347
       }
356
       }
357
+
348
       this.getRaise(params)
358
       this.getRaise(params)
349
     }
359
     }
350
 
360