|
@@ -11,11 +11,14 @@ import Statement from '../../components/Statement'
|
11
|
11
|
import { transferImage } from '@/utils/tools'
|
12
|
12
|
import PickerComponent from '../../components/Picker'
|
13
|
13
|
import './index.scss'
|
|
14
|
+import * as houseActions from '@/actions/house'
|
|
15
|
+
|
|
16
|
+function noop(){}
|
14
|
17
|
|
15
|
18
|
@connect(
|
16
|
|
- ({ user, city }) => ({ ...user, ...city })
|
|
19
|
+ ({ user, city, house }) => ({ ...user, ...city, house }),
|
|
20
|
+ { ...houseActions }
|
17
|
21
|
)
|
18
|
|
-
|
19
|
22
|
export default class Records extends Component {
|
20
|
23
|
config = {
|
21
|
24
|
navigationBarTitleText: '选房记录'
|
|
@@ -48,26 +51,35 @@ export default class Records extends Component {
|
48
|
51
|
lockCustomer: [{ value: '不限', code: '' }, { value: '我自己', code: 'mine' }, { value: '其他人', code: 'other' }],
|
49
|
52
|
lockCustomerValue: '',
|
50
|
53
|
customerLocked: '',
|
|
54
|
+
|
|
55
|
+ chooseList: [], // 选中的房源ID列表
|
51
|
56
|
}
|
52
|
57
|
componentDidShow() {
|
53
|
58
|
ready.queue(() => {
|
54
|
59
|
|
55
|
|
- const { userInfo: { person: { personId } } } = this.props
|
|
60
|
+ const { id: salesBatchId } = this.$router.params
|
|
61
|
+ const { userInfo: { person: { personId } }, house } = this.props
|
56
|
62
|
const params = {
|
57
|
63
|
personId,
|
|
64
|
+ salesBatchId,
|
58
|
65
|
pageNumber: 1,
|
59
|
66
|
pageSize: 999,
|
60
|
67
|
}
|
61
|
68
|
this.getPreselection(params)
|
62
|
69
|
this.getRaise(params)
|
63
|
70
|
querySalesList().then(res => {
|
64
|
|
- res.unshift({ salesBatchName: '请选择', salesBatchId: '' })
|
|
71
|
+ res.unshift({ salesBatchName: '请选择', salesBatchId })
|
65
|
72
|
this.setState({
|
66
|
73
|
salesList: res || [],
|
67
|
|
-
|
68
|
74
|
})
|
69
|
75
|
})
|
70
|
76
|
this.loadBuildingList()
|
|
77
|
+
|
|
78
|
+ if (house.raiseCart.length) {
|
|
79
|
+ this.setState({ chooseList: house.raiseCart.map(x => x.houseId) })
|
|
80
|
+ }
|
|
81
|
+
|
|
82
|
+ this.setState({ salesBatchId })
|
71
|
83
|
})
|
72
|
84
|
}
|
73
|
85
|
getPreselection(params) {
|
|
@@ -111,12 +123,30 @@ export default class Records extends Component {
|
111
|
123
|
}
|
112
|
124
|
|
113
|
125
|
CheckboxChange = (e) => {
|
114
|
|
- e.stopPropagation()
|
115
|
|
- console.log('checkbox发生change事件,携带value值为:', e)
|
|
126
|
+ // 加了一个转整型的处理
|
|
127
|
+ // 因为所有的 houseId 都是整型
|
|
128
|
+ this.setState({ chooseList: e.detail.value.map(x => (x - 0)) })
|
|
129
|
+ }
|
|
130
|
+
|
|
131
|
+ handleSubmit = () => {
|
|
132
|
+ const { recordList, chooseList, salesBatchId } = this.state
|
|
133
|
+ if (!chooseList.length) {
|
|
134
|
+ Taro.showToast({ title: '请选择房源', icon: 'none' })
|
|
135
|
+ return;
|
|
136
|
+ }
|
|
137
|
+
|
|
138
|
+ debugger
|
|
139
|
+ const houseList = recordList.map(x => x.housingInfo).filter(x => chooseList.indexOf(x.houseId) > -1)
|
|
140
|
+ this.props.dispatchFlush2Cart(houseList);
|
|
141
|
+
|
|
142
|
+ Taro.navigateTo({
|
|
143
|
+ url: `/onlineSelling/pages/raiseMoney/index?salesBatchId=${salesBatchId}`
|
|
144
|
+ })
|
116
|
145
|
}
|
117
|
146
|
|
118
|
147
|
renderPreselection() {
|
119
|
|
- const { recordList, noRecord } = this.state
|
|
148
|
+ const { recordList, noRecord, chooseList } = this.state
|
|
149
|
+
|
120
|
150
|
return (
|
121
|
151
|
<Block>
|
122
|
152
|
<ScrollView scrollY className="container">
|
|
@@ -126,12 +156,13 @@ export default class Records extends Component {
|
126
|
156
|
<View>
|
127
|
157
|
{
|
128
|
158
|
recordList.map((item) => {
|
|
159
|
+ const checked = (chooseList || []).filter(x => x == item.houseId)[0]
|
|
160
|
+
|
129
|
161
|
return (
|
130
|
162
|
<Label class="checkbox" >
|
131
|
|
- <Checkbox value={item.houseId} checked={item.checked} >
|
|
163
|
+ <Checkbox value={item.houseId - 0} checked={checked} >
|
132
|
164
|
<View className="carditem" key={item.preselectionRecordId} >
|
133
|
|
-
|
134
|
|
- <HouseCard summary={item} />
|
|
165
|
+ <HouseCard summary={item} onClick={noop} />
|
135
|
166
|
</View>
|
136
|
167
|
</Checkbox>
|
137
|
168
|
</Label>
|
|
@@ -144,7 +175,7 @@ export default class Records extends Component {
|
144
|
175
|
<Statement />
|
145
|
176
|
</ScrollView >
|
146
|
177
|
|
147
|
|
- <View className="raise-box"> <View className="raise-btn">认筹房源</View></View>
|
|
178
|
+ <View className="raise-box"> <View className="raise-btn" onClick={this.handleSubmit}>认筹房源</View></View>
|
148
|
179
|
|
149
|
180
|
</Block>
|
150
|
181
|
)
|