|
@@ -9,6 +9,17 @@ import { queryHouseList } from '@/services/project'
|
9
|
9
|
import ready from '@/utils/ready'
|
10
|
10
|
import { connect } from '@tarojs/redux'
|
11
|
11
|
import * as houseActions from '@/actions/house'
|
|
12
|
+import { fetch, apis } from '@/utils/request'
|
|
13
|
+
|
|
14
|
+const getRaiseProfile = ({ salesBatchId, raiseRecordId, personId }) => {
|
|
15
|
+ const queryString = [
|
|
16
|
+ `${raiseRecordId ? 'raiseRecordId=' + raiseRecordId : ''}`,
|
|
17
|
+ `${salesBatchId ? 'salesBatchId=' + salesBatchId : ''}`,
|
|
18
|
+ `${personId ? 'personId=' + personId : ''}`,
|
|
19
|
+ ].filter(Boolean).join('&')
|
|
20
|
+
|
|
21
|
+ return fetch({ url: `${apis.API_RAISE_PROFILE}?${queryString}` })
|
|
22
|
+}
|
12
|
23
|
|
13
|
24
|
@connect(
|
14
|
25
|
({ user, house }) => ({ ...user, house }),
|
|
@@ -24,19 +35,21 @@ export default class extends Component {
|
24
|
35
|
dataType: 1, // maybe need change 1 预选, 2 认筹
|
25
|
36
|
houseList: [],
|
26
|
37
|
chooseList: [], // 已经选择的房源列表
|
27
|
|
- collapsed: true, // 已选列表默认关闭, true 关闭, false 开启
|
|
38
|
+ collapsed: true, // 已选列表默认关闭, true 关闭, false 开启
|
|
39
|
+ multiSelect: true, // 是否多选, 自动锁房是单选
|
28
|
40
|
}
|
29
|
41
|
|
30
|
42
|
componentWillMount () {
|
31
|
43
|
ready.queue(() => {
|
32
|
44
|
const { userInfo, house } = this.props
|
33
|
|
- const { id: salesBatchId } = this.$router.params
|
|
45
|
+ const { id: salesBatchId, multi } = this.$router.params
|
34
|
46
|
|
35
|
47
|
const params = {
|
36
|
48
|
salesBatchId,
|
37
|
49
|
pageNum: 1,
|
38
|
50
|
pageSize: 9999,
|
39
|
51
|
}
|
|
52
|
+
|
40
|
53
|
queryHouseList(params).then(res => {
|
41
|
54
|
this.setState({
|
42
|
55
|
houseList: this.groupHouseList(res) || [],
|
|
@@ -44,9 +57,14 @@ export default class extends Component {
|
44
|
57
|
})
|
45
|
58
|
})
|
46
|
59
|
|
|
60
|
+ // 获取认筹信息
|
|
61
|
+ // getRaiseProfile(salesBatchId, undefined, userInfo.person.personId)
|
|
62
|
+
|
47
|
63
|
if (house.raiseCart && house.raiseCart.length) {
|
48
|
64
|
this.setState({ chooseList: house.raiseCart })
|
49
|
65
|
}
|
|
66
|
+
|
|
67
|
+ this.setState({ multiSelect: multi !== 'false' })
|
50
|
68
|
})
|
51
|
69
|
}
|
52
|
70
|
|
|
@@ -119,14 +137,18 @@ export default class extends Component {
|
119
|
137
|
return;
|
120
|
138
|
}
|
121
|
139
|
|
122
|
|
- const { chooseList } = this.state
|
|
140
|
+ const { chooseList, multiSelect } = this.state
|
123
|
141
|
const checked = (chooseList || []).filter(x => x.houseId == room.houseId)[0]
|
124
|
142
|
|
125
|
143
|
if (checked) {
|
126
|
144
|
this.setState({ chooseList: chooseList.filter(x => x.houseId != room.houseId) })
|
127
|
145
|
} else {
|
128
|
|
- this.setState({ chooseList: chooseList.concat(room) })
|
129
|
|
- }
|
|
146
|
+ if (multiSelect) {
|
|
147
|
+ this.setState({ chooseList: chooseList.concat(room) })
|
|
148
|
+ } else {
|
|
149
|
+ this.setState({ chooseList: [room] })
|
|
150
|
+ }
|
|
151
|
+ }
|
130
|
152
|
}
|
131
|
153
|
|
132
|
154
|
// 确认选择
|
|
@@ -150,12 +172,15 @@ export default class extends Component {
|
150
|
172
|
|
151
|
173
|
// 取消选择
|
152
|
174
|
subChooseList = (house) => {
|
|
175
|
+ const name = [house.termName, house.blockName, house.unitName, house.floorName, house.roomName].join('')
|
|
176
|
+ const { chooseList } = this.state
|
|
177
|
+
|
153
|
178
|
Taro.showModal({
|
154
|
179
|
title: '取消选择',
|
155
|
|
- content: `确认取消 ${house.name} ?`,
|
|
180
|
+ content: `确认取消 ${name} ?`,
|
156
|
181
|
success: (res) => {
|
157
|
182
|
if (res.confirm) {
|
158
|
|
- // TODO: 取消房源选择
|
|
183
|
+ this.setState({ chooseList: chooseList.filter(x => x.houseId != house.houseId) })
|
159
|
184
|
}
|
160
|
185
|
}
|
161
|
186
|
})
|