张延森 5 years ago
parent
commit
be0f1a45c5

+ 1
- 1
src/onlineSelling/components/HouseGrid/Floor.js View File

12
         {roomList.map((room) => {
12
         {roomList.map((room) => {
13
           return (
13
           return (
14
             <View className="item" key={room.houseId} >
14
             <View className="item" key={room.houseId} >
15
-              <Room dataset={room} onClick={props.onRoomClick}/>
15
+              <Room dataset={room} onClick={props.onRoomClick} onActionClick={props.onActionClick}/>
16
             </View>
16
             </View>
17
           )
17
           )
18
         })}
18
         })}

+ 1
- 1
src/onlineSelling/components/HouseGrid/Unit.js View File

29
         </View>
29
         </View>
30
         <View className="body" >
30
         <View className="body" >
31
           {!noshow && floorList.map((floor) => {
31
           {!noshow && floorList.map((floor) => {
32
-            return <Floor key={floor.floorId} dataset={floor} onRoomClick={this.props.onRoomClick} />
32
+            return <Floor key={floor.floorId} dataset={floor} onRoomClick={this.props.onRoomClick} onActionClick={this.props.onActionClick} />
33
           })}
33
           })}
34
         </View>
34
         </View>
35
       </View>
35
       </View>

+ 3
- 2
src/onlineSelling/components/HouseGrid/index.js View File

3
 
3
 
4
 export default (props) => {
4
 export default (props) => {
5
   const unitList = (props.dataset || {}).unitList || []
5
   const unitList = (props.dataset || {}).unitList || []
6
-  const onRoomClick = props.onRoomClick || (() => {})
6
+  const handleRoomClick = props.onRoomClick || (() => {})
7
+  const handleActionClick = props.onActionClick || (() => {})
7
 
8
 
8
   return (
9
   return (
9
     <Block>
10
     <Block>
10
       {
11
       {
11
-        unitList.map((unit) => (<Unit key={unit.unitId} dataset={unit} onRoomClick={onRoomClick} />))
12
+        unitList.map((unit) => (<Unit key={unit.unitId} dataset={unit} onRoomClick={handleRoomClick} onActionClick={handleActionClick} />))
12
       }
13
       }
13
     </Block>
14
     </Block>
14
   )
15
   )

+ 63
- 25
src/onlineSelling/pages/houseCart/index.js View File

2
 import { View, ScrollView } from '@tarojs/components'
2
 import { View, ScrollView } from '@tarojs/components'
3
 
3
 
4
 import './index.scss'
4
 import './index.scss'
5
+import Blank from '../../components/Blank'
6
+import HouseGrid from '../../components/HouseGrid'
5
 
7
 
6
 export default class extends Component {
8
 export default class extends Component {
7
   config = {
9
   config = {
10
 
12
 
11
   state = {
13
   state = {
12
     dataType: 1, // maybe need change  1 预选, 2 认筹
14
     dataType: 1, // maybe need change  1 预选, 2 认筹
15
+    houseList: [ { name: '1期1栋1单元1楼101户' } ],
13
     chooseList: [ { name: '1期1栋1单元1楼101户' }, { name: '1期1栋1单元1楼102户' } ], // 已经选择的房源列表
16
     chooseList: [ { name: '1期1栋1单元1楼101户' }, { name: '1期1栋1单元1楼102户' } ], // 已经选择的房源列表
14
     collapsed: true, // 已选列表默认关闭, true 关闭, false 开启 
17
     collapsed: true, // 已选列表默认关闭, true 关闭, false 开启 
15
   }
18
   }
22
     this.setState({ dataType })
25
     this.setState({ dataType })
23
   }
26
   }
24
 
27
 
28
+  // 添加到选择列表
29
+  // 注意, 不是确认选择
30
+  add2Cart = (room) => {
31
+
32
+  }
33
+
25
   // 确认选择
34
   // 确认选择
26
   handleSubmit = () => {
35
   handleSubmit = () => {
27
 
36
 
47
   }
56
   }
48
 
57
 
49
   renderHead() {
58
   renderHead() {
50
-    const { dataType } = this.state
59
+    const { dataType, houseList } = this.state
60
+    const hasData = houseList && houseList.length
51
 
61
 
52
     return (
62
     return (
53
       <View className="head">
63
       <View className="head">
54
         <View className="tips">仅显示符合认筹条件的房源。点击房源卡片查看房源详情,不要在房源详情页做操作。请在当前页面选择提交认筹。</View>
64
         <View className="tips">仅显示符合认筹条件的房源。点击房源卡片查看房源详情,不要在房源详情页做操作。请在当前页面选择提交认筹。</View>
55
-        <View className="actions">
56
-          <View className={`action ${dataType === 1 ? 'active' : ''}`} onClick={() => this.changeShowData(1)}>预选热度图</View>
57
-          <View className={`action ${dataType === 2 ? 'active' : ''}`} onClick={() => this.changeShowData(2)}>认筹热度图</View>
58
-        </View>
65
+        {
66
+          hasData && (
67
+            <View className="actions">
68
+              <View className={`action ${dataType === 1 ? 'active' : ''}`} onClick={() => this.changeShowData(1)}>预选热度图</View>
69
+              <View className={`action ${dataType === 2 ? 'active' : ''}`} onClick={() => this.changeShowData(2)}>认筹热度图</View>
70
+            </View>
71
+          )
72
+        }
59
       </View>
73
       </View>
60
     );
74
     );
61
   }
75
   }
62
 
76
 
63
   renderHouses() {
77
   renderHouses() {
64
-    return (
65
-      <ScrollView className="body" scrollY>
78
+    const { houseList } = this.state
79
+    const hasData = houseList && houseList.length
66
 
80
 
81
+    return hasData && (
82
+      <ScrollView className="body" scrollY>
83
+      {
84
+        houseList.map((item) => {
85
+          return <HouseGrid key={item.unitId} dataset={item} onRoomClick={this.handleRoomClick} onActionClick={this.add2Cart} />
86
+        })
87
+      }
67
       </ScrollView>
88
       </ScrollView>
68
     )
89
     )
69
   }
90
   }
70
 
91
 
71
   renderAction() {
92
   renderAction() {
72
-    const { chooseList, collapsed } = this.state;
93
+    const { chooseList, collapsed, houseList } = this.state;
73
     const title = collapsed ? `已选择: ${chooseList[0].name} 等 ${chooseList.length} 个房源` : '已选列表'
94
     const title = collapsed ? `已选择: ${chooseList[0].name} 等 ${chooseList.length} 个房源` : '已选列表'
74
     const opened = collapsed ? 'off' : 'on'
95
     const opened = collapsed ? 'off' : 'on'
96
+    const nodata = houseList && houseList.length ? '' : 'nodata'
97
+    const btnText = chooseList && chooseList.length ? '确认以上选择' : '未选择房源'
98
+    const choosed = chooseList && chooseList.length
75
 
99
 
76
     return (
100
     return (
77
       <View className="footer">
101
       <View className="footer">
78
-        <View className="shoping-cart collapse">
79
-          <View className={`title ${opened}`} onClick={this.trigCartPannel}>
80
-            <Text>{title}</Text>
81
-            <Text className="at-icon at-icon-chevron-down"></Text>            
82
-          </View>
83
-          <View className={`choose-list ${opened}`}>
84
-            {chooseList.map((house, index) => {
85
-              return (
86
-                <View key={`cart-item-${index}`} className="choose-item" onClick={() => this.subChooseList(house)}>
87
-                  <View className="choose-item-body">{house.name}</View>
88
-                  <View className="choose-item-action">
89
-                    <Text className="at-icon at-icon-subtract-circle"></Text>
102
+      {
103
+        choosed && (
104
+          <View className="shoping-cart collapse">
105
+            <View className={`title ${opened}`} onClick={this.trigCartPannel}>
106
+              <Text>{title}</Text>
107
+              <Text className="at-icon at-icon-chevron-down"></Text>            
108
+            </View>
109
+
110
+            <View className={`choose-list ${opened}`}>
111
+              {chooseList.map((house, index) => {
112
+                return (
113
+                  <View key={`cart-item-${index}`} className="choose-item" onClick={() => this.subChooseList(house)}>
114
+                    <View className="choose-item-body">{house.name}</View>
115
+                    <View className="choose-item-action">
116
+                      <Text className="at-icon at-icon-subtract-circle"></Text>
117
+                    </View>
90
                   </View>
118
                   </View>
91
-                </View>
92
-              )
93
-            })}
119
+                )
120
+              })}
121
+            </View>          
94
           </View>
122
           </View>
95
-        </View>
96
-        <Button className="btn" onClick={this.handleSubmit}>确认以上选择</Button>
123
+        )
124
+      }
125
+        <Button className={`btn ${nodata}`} onClick={this.handleSubmit}>{btnText}</Button>
97
       </View>
126
       </View>
98
     )
127
     )
99
   }
128
   }
100
 
129
 
130
+  renderBlank() {
131
+    const { houseList } = this.state
132
+
133
+    return !(houseList && houseList.length) && (
134
+      <Blank tips="暂无符合条件的房源" />
135
+    )
136
+  }
137
+
101
   render() {
138
   render() {
102
     return (
139
     return (
103
       <View className="house-cart">
140
       <View className="house-cart">
104
         {this.renderHead()}
141
         {this.renderHead()}
142
+        {this.renderBlank()}
105
         {this.renderHouses()}
143
         {this.renderHouses()}
106
         {this.renderAction()}
144
         {this.renderAction()}
107
       </View>
145
       </View>

+ 5
- 0
src/onlineSelling/pages/houseCart/index.scss View File

58
       line-height: 94px;
58
       line-height: 94px;
59
       background: #BB9C79;
59
       background: #BB9C79;
60
       border-radius: 10px;
60
       border-radius: 10px;
61
+
62
+      &.nodata {
63
+        background:#000;
64
+        opacity:0.6;
65
+      }
61
     }
66
     }
62
   }
67
   }
63
 
68