张延森 5 年之前
父節點
當前提交
5bbbed9ab1

+ 14
- 1
src/actions/house.js 查看文件

@@ -1,6 +1,12 @@
1 1
 import { createAction, createActionNormal } from '@/utils/redux'
2 2
 import { API_CARDS_LIST } from '@/constants/api'
3
-import { ADD_CART, SUB_CART, ADD_CONSULTANT, CHOOSE_CONSULTANT } from '@/constants/house'
3
+import {
4
+  ADD_CART,
5
+  SUB_CART,
6
+  ADD_CONSULTANT,
7
+  CHOOSE_CONSULTANT,
8
+  MY_PRESELECT_RECORD,
9
+} from '@/constants/house'
4 10
 
5 11
 // 加入临时车
6 12
 export const dispatchAddCart = payload => createActionNormal({ type: ADD_CART, payload })
@@ -15,3 +21,10 @@ export const dispatchGetConsultants = payload => createAction({
15 21
 
16 22
 // 临时选择置业
17 23
 export const dispatchChooseConsultant = payload => createActionNormal({ type: CHOOSE_CONSULTANT, payload })
24
+
25
+// 获取预选记录
26
+export const dispatchGetMySelection = payload = createAction({
27
+  type: MY_PRESELECT_RECORD,
28
+  url: API_PRESELECTION_RECORD,
29
+  payload,
30
+})

+ 3
- 0
src/constants/house.js 查看文件

@@ -10,3 +10,6 @@ export const ADD_CONSULTANT = 'ADD_CONSULTANT'
10 10
 
11 11
 // 临时选择置业
12 12
 export const CHOOSE_CONSULTANT = 'CHOOSE_CONSULTANT'
13
+
14
+// 获取预选记录
15
+export const MY_PRESELECT_RECORD = 'MY_PRESELECT_RECORD'

+ 36
- 57
src/onlineSelling/pages/addHouse/index.js 查看文件

@@ -3,83 +3,61 @@ import { View, ScrollView, Block } from '@tarojs/components'
3 3
 import './index.scss'
4 4
 import Blank from '../../components/Blank'
5 5
 import HouseCard from '../../components/HouseCard'
6
+import ready from '@/utils/ready'
7
+import { connect } from '@tarojs/redux'
8
+import * as houseActions from '@/actions/house'
6 9
 
10
+@connect(
11
+  ({ user, house }) => ({ ...user, house }),
12
+  {...houseActions}
13
+)
7 14
 export default class extends Component {
8 15
   config = {
9
-    navigationBarTitleText: '添加其他房源',
16
+    navigationBarTitleText: '添加预选房源',
10 17
   }
11 18
 
12
-  state = {
19
+  state = {}
13 20
 
14
-    houseList: [
15
-      {
16
-        apartmentName: 'A户型',
17
-        blockName: "1栋",
18
-        buildingId: "9f021a59b2a714822894c23ccca8c2db",
19
-        buildingImgList: null,
20
-        buildingName: "万科安平园舍",
21
-        createDate: "2020-02-27T16:31:56",
22
-        floorName: "1楼",
23
-        houseId: "820",
24
-        preselectionRecordId: 205,
25
-        price: "111.00000000",
26
-        roomName: "1户",
27
-        saleBatchStatus: "1",
28
-        status: 1,
29
-        termname: "1期",
30
-        unitName: "2单元",
31
-        area1: '290',
32
-        area2: '270',
33
-        code: '2-09876545456'
34
-      }, {
35
-        apartmentName: 'B户型',
36
-        blockName: "1栋",
37
-        buildingId: "9f021a59b2a714822894c23ccca8c2db",
38
-        buildingImgList: null,
39
-        buildingName: "凤翔新城",
40
-        createDate: "2020-02-27T16:31:56",
41
-        floorName: "1楼",
42
-        houseId: "820",
43
-        preselectionRecordId: 206,
44
-        price: "111.00000000",
45
-        roomName: "1户",
46
-        saleBatchStatus: "1",
47
-        status: 1,
48
-        termname: "1期",
49
-        unitName: "2单元",
50
-        area1: '290',
51
-        area2: '270',
52
-        code: '2-09876545333'
53
-      },
54
-    ],
55
-  }
21
+  componentWillMount() {
22
+    ready.queue(() => {
23
+      const { userInfo, house } = this.props
24
+      const { salesBatchId } = this.$router.params
56 25
 
57
-  componentWillMount() { }
26
+      if (!house.mySelectHouses || !house.mySelectHouses.length) {
27
+        this.props.dispatchGetMySelection({
28
+          salesBatchId,
29
+          personId: userInfo.person.personId,
30
+        })
31
+      }
32
+    })
33
+  }
58 34
 
35
+  handleCheckboxChange = (e) => {
36
+    console.log('------------->', e)
37
+  }
59 38
 
60 39
   renderHead() {
61
-
62 40
     return (
63 41
       <View className="head">仅展示符合认筹条件的已预选房源,左侧勾选</View>
64
-
65
-
66 42
     );
67 43
   }
68 44
 
69 45
   renderHouses() {
70
-    const { houseList } = this.state
71
-    const hasData = houseList && houseList.length
46
+    const { house } = this.props
47
+    const hasData = house.mySelectHouses && house.mySelectHouses.length
72 48
 
73 49
     return hasData && (
74 50
       <Block>
75 51
         <ScrollView scrollY className="container">
76
-          <CheckboxGroup onChange={this.CheckboxChange}>
52
+          <CheckboxGroup onChange={this.handleCheckboxChange}>
77 53
             {
78
-              houseList.map((item) => {
54
+              house.mySelectHouses.map((item) => {
55
+                const checked = !!house.raiseCart.filter(x => x.houseId === item.houseId)[0]
56
+
79 57
                 return (
80
-                  <Label class="checkbox" >
81
-                    <Checkbox value={item.houseId} checked={item.checked} >
82
-                      <View className="carditem" key={item.preselectionRecordId} >
58
+                  <Label class="checkbox" key={item.houseId}>
59
+                    <Checkbox value={item.houseId} checked={checked} >
60
+                      <View className="carditem" >
83 61
                         <HouseCard summary={item} />
84 62
                       </View>
85 63
                     </Checkbox>
@@ -96,9 +74,10 @@ export default class extends Component {
96 74
 
97 75
 
98 76
   renderBlank() {
99
-    const { houseList } = this.state
77
+    const { house } = this.props
78
+    const hasData = house.mySelectHouses && house.mySelectHouses.length
100 79
 
101
-    return !(houseList && houseList.length) && (
80
+    return !hasData && (
102 81
       <Blank tips="没有符合认筹条件的预选房源" />
103 82
     )
104 83
   }

+ 22
- 23
src/onlineSelling/pages/raiseMoney/index.js 查看文件

@@ -42,10 +42,12 @@ export default class raiseMoney extends Component {
42 42
     navigationBarTitleText: '认筹确认'
43 43
   }
44 44
   state = {
45
-    current: 2,
45
+    current: 0,
46 46
     inputName: '',
47 47
     raiseProfile: undefined,
48 48
     record: {},
49
+    protocolCountdown: 10, // 单位 s
50
+    captchaCountdown: 60, // 单位 s
49 51
   }
50 52
 
51 53
   captchaLock = false
@@ -59,15 +61,7 @@ export default class raiseMoney extends Component {
59 61
         raiseRecordId,  // 认筹单ID, // 从认筹列表进入
60 62
       } = this.$router.params
61 63
 
62
-      if (houseId) {
63
-        this.loadHouseInfo(houseId, salesBatchId)
64
-      }
65
-
66
-      if (raiseRecordId) {
67
-        this.loadRaiseRecord(raiseRecordId)
68
-      }
69
-
70
-      if (!houseId && !raiseRecordId) {
64
+      if (!salesBatchId && !raiseRecordId) {
71 65
         Taro.showToast({
72 66
           title: '错误, 请返回上一步',
73 67
           icon: 'none',
@@ -75,18 +69,20 @@ export default class raiseMoney extends Component {
75 69
         return;
76 70
       }
77 71
 
72
+      this.loadInfo(houseId, salesBatchId, raiseRecordId)
73
+
78 74
       if (this.$router.params.type == 'pay') {
79 75
         this.setState({ current: 3 })
80 76
       }
81 77
     })
82 78
   }
83 79
 
84
-  loadHouseInfo = (houseId, salesBatchId) => {
80
+  loadInfo = (houseId, salesBatchId, raiseRecordId) => {
85 81
     const { userInfo, house } = this.props
86 82
     const { personId, nickname, idcard, tel, phone } = userInfo.person
87 83
 
88 84
     // 请求认筹信息
89
-    getRaiseProfile({ salesBatchId, personId }).then(res => {
85
+    getRaiseProfile({ salesBatchId, raiseRecordId, personId }).then(res => {
90 86
       this.setState({ raiseProfile: res, record: res.record || { personId, name: nickname, idcard, tel: tel || phone } })
91 87
 
92 88
       // 请求置业顾问列表
@@ -100,10 +96,6 @@ export default class raiseMoney extends Component {
100 96
     })
101 97
   }
102 98
 
103
-  loadRaiseRecord = (raiseRecordId) => {
104
-
105
-  }
106
-
107 99
   handleCancel = (house) => {
108 100
     Taro.showModal({
109 101
       title: '提示',
@@ -116,6 +108,14 @@ export default class raiseMoney extends Component {
116 108
     })
117 109
   }
118 110
 
111
+  gotoHouseSelect = (pageType) => {
112
+    const url = pageType == 'all' ?
113
+      `/onlineSelling/pages/houseCart/index` :
114
+      `/onlineSelling/pages/addHouse/index`
115
+
116
+    Taro.navigateTo({ url })
117
+  }
118
+
119 119
   renderTop() {
120 120
     const tabList = [
121 121
       { title: '确认房源', value: 0 },
@@ -157,8 +157,8 @@ export default class raiseMoney extends Component {
157 157
           )
158 158
           )
159 159
         }
160
-        <View className="addhouse">从<Text style="color:#BB9C79">预选记录</Text>中添加其他房源</View>
161
-        <View className="addhouse">从<Text style="color:#F3B82E">房源列表</Text>中添加其他房源</View>
160
+        <View className="addhouse">从 <Text style="color:#F3B82E" onClick={this.gotoHouseSelect.bind(this, 'all')}>房源列表</Text> 中添加其他房源</View>
161
+        <View className="addhouse">从 <Text style="color:#BB9C79" onClick={this.gotoHouseSelect.bind(this, 'select')}>预选记录</Text> 中添加其他房源</View>
162 162
         <Statement style="margin-top:80rpx" />
163 163
       </ScrollView>
164 164
     )
@@ -244,7 +244,6 @@ export default class raiseMoney extends Component {
244 244
   }
245 245
 
246 246
   tochooseConsultant() {
247
-    console.log('--------------------------------------')
248 247
     Taro.navigateTo({
249 248
       url: '/onlineSelling/pages/chooseConsultant/index'
250 249
     })
@@ -256,7 +255,7 @@ export default class raiseMoney extends Component {
256 255
   }
257 256
 
258 257
   renderProfile() {
259
-    const { record } = this.state
258
+    const { record, captchaCountdown } = this.state
260 259
     const consultant = this.getConsultant()
261 260
     const disabled = !!record.raiseRecordId
262 261
 
@@ -292,7 +291,7 @@ export default class raiseMoney extends Component {
292 291
               验证码
293 292
             </View>
294 293
             <Input className='inputCode' placeholder-style="color:#999" type='text' disabled={disabled}  onInput={this.handleInput.bind(this, 'captcha')} placeholder='请填写验证码' />
295
-            <Captcha countdown={5} require={this.prepareGetCaptcha.bind(this)} onClick={this.handleCaptcha} />
294
+            <Captcha countdown={captchaCountdown} require={this.prepareGetCaptcha.bind(this)} onClick={this.handleCaptcha} />
296 295
           </View>
297 296
           <View className="profile-flex" style="margin-top:20rpx">
298 297
             <View className="title">我的置业顾问信息</View>
@@ -454,13 +453,13 @@ export default class raiseMoney extends Component {
454 453
   }
455 454
 
456 455
   renderBottomBtn() {
457
-    const { current } = this.state
456
+    const { current, protocolCountdown } = this.state
458 457
     return (
459 458
       <View className="bottom-btn">
460 459
         {current == 1 && <View style="font-size:24rpx;color:#999;line-height:70rpx">请仔细阅读选房协议直到结尾才能进入下一步</View>}
461 460
         {current != 4 &&
462 461
           <NextStep
463
-            countdown={current == 1 ? 2 : 0}
462
+            countdown={current == 1 ? protocolCountdown : 0}
464 463
             onClick={() => this.nextStep(current)}
465 464
             text={current == 3 ? '现在缴费' : '下一步'}
466 465
           />

+ 10
- 0
src/reducers/house.js 查看文件

@@ -7,6 +7,7 @@
7 7
    SUB_CART,
8 8
    ADD_CONSULTANT,
9 9
    CHOOSE_CONSULTANT,
10
+   MY_PRESELECT_RECORD,
10 11
  } from '@/constants/house'
11 12
 
12 13
 const INITIAL_STATE = {
@@ -16,7 +17,11 @@ const INITIAL_STATE = {
16 17
   // 置业顾问列表
17 18
   consultantList: [],
18 19
 
20
+  // 认筹选中置业
19 21
   chooseConsultant: undefined,
22
+
23
+  // 预选房源列表
24
+  mySelectHouses: [],
20 25
 }
21 26
 
22 27
 export default function(state = INITIAL_STATE, action) {
@@ -49,6 +54,11 @@ export default function(state = INITIAL_STATE, action) {
49 54
         chooseConsultant: payload,
50 55
       };
51 56
 
57
+    case MY_PRESELECT_RECORD:
58
+      return {
59
+        ...state,
60
+        mySelectHouses: payload,
61
+      };
52 62
     default:
53 63
       return state;
54 64
   }