xujing 5 лет назад
Родитель
Сommit
4cd7540a18
1 измененных файлов: 47 добавлений и 43 удалений
  1. 47
    43
      src/onlineSelling/pages/houseCart/index.js

+ 47
- 43
src/onlineSelling/pages/houseCart/index.js Просмотреть файл

@@ -23,7 +23,7 @@ const getRaiseProfile = ({ salesBatchId, raiseRecordId, personId }) => {
23 23
 
24 24
 @connect(
25 25
   ({ user, house }) => ({ ...user, house }),
26
-  {...houseActions}
26
+  { ...houseActions }
27 27
 )
28 28
 export default class extends Component {
29 29
   config = {
@@ -39,7 +39,7 @@ export default class extends Component {
39 39
     multiSelect: true,  // 是否多选, 自动锁房是单选
40 40
   }
41 41
 
42
-  componentWillMount () {
42
+  componentWillMount() {
43 43
     ready.queue(() => {
44 44
       const { userInfo, house } = this.props
45 45
       const { id: salesBatchId, multi } = this.$router.params
@@ -68,7 +68,7 @@ export default class extends Component {
68 68
       this.setState({ multiSelect: multi !== 'false' })
69 69
     })
70 70
   }
71
-  
71
+
72 72
   groupHouseList(houseList = []) {
73 73
     // 先按照楼层分组
74 74
     const floorList = houseList.reduce((list, room) => {
@@ -211,28 +211,32 @@ export default class extends Component {
211 211
       </View>
212 212
     );
213 213
   }
214
-
214
+  handleRoomClick = room => {
215
+    Taro.navigateTo({
216
+      url: `/onlineSelling/pages/detail/index?id=${room.houseId}`
217
+    })
218
+  }
215 219
   renderHouses() {
216 220
     const { houseList, dataType, chooseList } = this.state
217 221
     const hasData = houseList && houseList.length
218 222
 
219 223
     return hasData && (
220 224
       <ScrollView className="body" scrollY>
221
-      {
222
-        houseList.map((item) => {
223
-          return (
224
-            <HouseGrid
225
-              key={item.unitId}
226
-              dataset={item}
227
-              showAction
228
-              showDataType={dataType}
229
-              chooseList={chooseList}
230
-              onRoomClick={this.handleRoomClick}
231
-              onActionClick={this.add2Cart}
232
-            />
233
-          )
234
-        })
235
-      }
225
+        {
226
+          houseList.map((item) => {
227
+            return (
228
+              <HouseGrid
229
+                key={item.unitId}
230
+                dataset={item}
231
+                showAction
232
+                showDataType={dataType}
233
+                chooseList={chooseList}
234
+                onRoomClick={this.handleRoomClick}
235
+                onActionClick={this.add2Cart}
236
+              />
237
+            )
238
+          })
239
+        }
236 240
       </ScrollView>
237 241
     )
238 242
   }
@@ -249,31 +253,31 @@ export default class extends Component {
249 253
 
250 254
     return (
251 255
       <View className="footer">
252
-      {
253
-        choosed && (
254
-          <View className="shoping-cart collapse">
255
-            <View className={`title ${opened}`} onClick={this.trigCartPannel}>
256
-              <Text>{title}</Text>
257
-              {collapsed?<Text className="at-icon at-icon-chevron-up"></Text> :<Text className="at-icon at-icon-chevron-down"></Text> }           
258
-            </View>
259
-
260
-            <View className={`choose-list ${opened}`}>
261
-              {chooseList.map((house, index) => {
262
-                const name = [house.termName, house.blockName, house.unitName, house.floorName, house.roomName].join('')
263
-
264
-                return (
265
-                  <View key={`cart-item-${index}`} className="choose-item" onClick={() => this.subChooseList(house)}>
266
-                    <View className="choose-item-body">{name}</View>
267
-                    <View className="choose-item-action">
268
-                      <Text className="at-icon at-icon-subtract-circle"></Text>
256
+        {
257
+          choosed && (
258
+            <View className="shoping-cart collapse">
259
+              <View className={`title ${opened}`} onClick={this.trigCartPannel}>
260
+                <Text>{title}</Text>
261
+                {collapsed ? <Text className="at-icon at-icon-chevron-up"></Text> : <Text className="at-icon at-icon-chevron-down"></Text>}
262
+              </View>
263
+
264
+              <View className={`choose-list ${opened}`}>
265
+                {chooseList.map((house, index) => {
266
+                  const name = [house.termName, house.blockName, house.unitName, house.floorName, house.roomName].join('')
267
+
268
+                  return (
269
+                    <View key={`cart-item-${index}`} className="choose-item" onClick={() => this.subChooseList(house)}>
270
+                      <View className="choose-item-body">{name}</View>
271
+                      <View className="choose-item-action">
272
+                        <Text className="at-icon at-icon-subtract-circle"></Text>
273
+                      </View>
269 274
                     </View>
270
-                  </View>
271
-                )
272
-              })}
273
-            </View>          
274
-          </View>
275
-        )
276
-      }
275
+                  )
276
+                })}
277
+              </View>
278
+            </View>
279
+          )
280
+        }
277 281
         <Button className={`btn ${nodata}`} onClick={this.handleSubmit}>{btnText}</Button>
278 282
       </View>
279 283
     )