张延森 5 yıl önce
ebeveyn
işleme
c2aeff7982

+ 2
- 2
project.config.json Dosyayı Görüntüle

@@ -48,8 +48,8 @@
48 48
 			"list": [
49 49
 				{
50 50
 					"id": -1,
51
-					"name": "pages/raiseProfile/index",
52
-					"pathName": "onlineSelling/pages/raiseProfile/index",
51
+					"name": "pages/houseCart/index",
52
+					"pathName": "onlineSelling/pages/houseCart/index",
53 53
 					"query": "",
54 54
 					"scene": null
55 55
 				},

+ 1
- 0
src/app.js Dosyayı Görüntüle

@@ -135,6 +135,7 @@ class App extends Component {
135 135
           'pages/chooseConsultant/index',
136 136
           'pages/protocol/index',
137 137
           'pages/raiseProfile/index',
138
+          'pages/houseCart/index',
138 139
         ],
139 140
       }
140 141
     ],

+ 110
- 0
src/onlineSelling/pages/houseCart/index.js Dosyayı Görüntüle

@@ -0,0 +1,110 @@
1
+import Taro, { Component } from '@tarojs/taro'
2
+import { View, ScrollView } from '@tarojs/components'
3
+
4
+import './index.scss'
5
+
6
+export default class extends Component {
7
+  config = {
8
+    navigationBarTitleText: '添加其他房源',
9
+  }
10
+
11
+  state = {
12
+    dataType: 1, // maybe need change  1 预选, 2 认筹
13
+    chooseList: [ { name: '1期1栋1单元1楼101户' }, { name: '1期1栋1单元1楼102户' } ], // 已经选择的房源列表
14
+    collapsed: true, // 已选列表默认关闭, true 关闭, false 开启 
15
+  }
16
+
17
+  componentWillMount () {}
18
+
19
+  changeShowData = (dataType) => {
20
+    // 此处需要按照 dataType 去切换数据
21
+    // 切换成功之后
22
+    this.setState({ dataType })
23
+  }
24
+
25
+  // 确认选择
26
+  handleSubmit = () => {
27
+
28
+  }
29
+
30
+  // 取消选择
31
+  subChooseList = (house) => {
32
+    Taro.showModal({
33
+      title: '取消选择',
34
+      content: `确认取消 ${house.name} ?`,
35
+      success: (res) => {
36
+        if (res.confirm) {
37
+          // TODO: 取消房源选择
38
+        }
39
+      }
40
+    })
41
+  }
42
+
43
+  // 是否展开已选列表
44
+  trigCartPannel = () => {
45
+    const { collapsed } = this.state;
46
+    this.setState({ collapsed: !collapsed })
47
+  }
48
+
49
+  renderHead() {
50
+    const { dataType } = this.state
51
+
52
+    return (
53
+      <View className="head">
54
+        <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>
59
+      </View>
60
+    );
61
+  }
62
+
63
+  renderHouses() {
64
+    return (
65
+      <ScrollView className="body" scrollY>
66
+
67
+      </ScrollView>
68
+    )
69
+  }
70
+
71
+  renderAction() {
72
+    const { chooseList, collapsed } = this.state;
73
+    const title = collapsed ? `已选择: ${chooseList[0].name} 等 ${chooseList.length} 个房源` : '已选列表'
74
+    const opened = collapsed ? 'off' : 'on'
75
+
76
+    return (
77
+      <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>
90
+                  </View>
91
+                </View>
92
+              )
93
+            })}
94
+          </View>
95
+        </View>
96
+        <Button className="btn" onClick={this.handleSubmit}>确认以上选择</Button>
97
+      </View>
98
+    )
99
+  }
100
+
101
+  render() {
102
+    return (
103
+      <View className="house-cart">
104
+        {this.renderHead()}
105
+        {this.renderHouses()}
106
+        {this.renderAction()}
107
+      </View>
108
+    )
109
+  }
110
+}

+ 134
- 0
src/onlineSelling/pages/houseCart/index.scss Dosyayı Görüntüle

@@ -0,0 +1,134 @@
1
+@import "~taro-ui/dist/style/components/icon.scss";
2
+
3
+.house-cart {
4
+
5
+  .head {
6
+    margin: 30px 0;
7
+    padding: 0 30px;
8
+    font-size:24px;
9
+
10
+    .tip {
11
+      color:#666;
12
+      line-height:36px;
13
+    }
14
+
15
+    .actions {
16
+      margin-top: 20px;
17
+
18
+      .action {
19
+        display: inline-block;
20
+        color:#333;
21
+        background:#fff;
22
+        line-height:48px;
23
+        padding: 0 24px;
24
+        border:1px solid #E4E4E4;
25
+        border-radius: 24px;
26
+  
27
+        &.active {
28
+          color:#fff;
29
+          background:#BB9C79;
30
+          border:1px solid #BB9C79;
31
+          box-shadow:0px 4px 12px 0px rgba(255,171,50,0.08);
32
+        }
33
+  
34
+        & + .action {
35
+          margin-left: 30px;
36
+        }
37
+      }
38
+    }
39
+  }
40
+
41
+  .body {
42
+    height: calc(100% - 340px);
43
+  }
44
+
45
+  .footer {
46
+    position: fixed;
47
+    width: 100%;
48
+    bottom: 0;
49
+    background: #fff;
50
+    z-index: 10;
51
+    text-align: center;
52
+    padding: 0 30px 30px;
53
+
54
+    .btn {
55
+      font-size: 36px;
56
+      color: #fff;
57
+      height: 94px;
58
+      line-height: 94px;
59
+      background: #BB9C79;
60
+      border-radius: 10px;
61
+    }
62
+  }
63
+
64
+  .shoping-cart {
65
+    position: absolute;
66
+    bottom: 135px;
67
+    font-size: 28px;
68
+    line-height: 30px;
69
+    color: #333;
70
+    width: calc(100% - 70px);
71
+    box-shadow:0px 4px 12px 0px rgba(0, 0, 0, 0.08);
72
+    border-radius:44px 44px 0px 0px;
73
+
74
+    .title {
75
+      text-align: center;
76
+      font-size: 24px;
77
+
78
+      .at-icon {
79
+        display: inline-block;
80
+        margin-left: 20px;
81
+      }
82
+    }
83
+
84
+    .choose-list {
85
+      padding: 30px;
86
+      overflow: hidden;
87
+
88
+      .choose-item {
89
+        display: flex;
90
+        
91
+        &-body {
92
+          text-align: left;
93
+          flex: auto;
94
+        }
95
+
96
+        &-action {
97
+          width: 30px;
98
+          flex: none;
99
+          text-align: right;
100
+        }
101
+
102
+        & + .choose-item {
103
+          margin-top: 24px;
104
+        }
105
+      }
106
+    }
107
+  }
108
+
109
+  .collapse {
110
+    .on {
111
+      &.title {
112
+        height: 64px;
113
+        padding: 20px 0;
114
+      }
115
+
116
+      &.choose-list{
117
+        height: auto;
118
+      }
119
+    }
120
+
121
+    .off {
122
+      &.title {
123
+        padding: 40px 0;
124
+        height: 100px;
125
+      }
126
+
127
+      &.choose-list {
128
+        height: 0;
129
+        padding: 0;
130
+      }
131
+    }
132
+  }
133
+
134
+}