张延森 4 년 전
부모
커밋
b6d0601946

+ 13
- 0
src/compents/Divider/index.jsx 파일 보기

1
+import React from 'react'
2
+import { View } from '@tarojs/components'
3
+import './index.scss'
4
+
5
+export default props => {
6
+  return (
7
+    <View className="x-divider" style={props.style}>
8
+      <View className="x-divider__line">&nbsp;</View>
9
+      <View className="x-divider__text">{props.children}</View>
10
+      <View className="x-divider__line">&nbsp;</View>
11
+    </View>
12
+  )
13
+}

+ 16
- 0
src/compents/Divider/index.scss 파일 보기

1
+
2
+.x-divider {
3
+  display: flex;
4
+  align-items: center;
5
+
6
+  &__line {
7
+    flex: auto;
8
+    height: 1px;
9
+    background-color: #333;
10
+  }
11
+
12
+  &__text {
13
+    flex: none;
14
+    margin: 0 0.6em;
15
+  }
16
+}

+ 14
- 6
src/pages/addimg/index.jsx 파일 보기

37
     }
37
     }
38
 
38
 
39
     const choiceImg = (value) => {
39
     const choiceImg = (value) => {
40
-        console.log(value, '111')
41
         const t = choiceList.find(x => x.imageId == value.imageId)
40
         const t = choiceList.find(x => x.imageId == value.imageId)
42
         if (t) {
41
         if (t) {
43
             setChoicelist(choiceList.filter(x => x.imageId != value.imageId))
42
             setChoicelist(choiceList.filter(x => x.imageId != value.imageId))
50
     }
49
     }
51
 
50
 
52
     const onAddimg = (e) => {
51
     const onAddimg = (e) => {
53
-        console.log(e, '111')
54
         if (choiceList.length > 0) {
52
         if (choiceList.length > 0) {
55
-
56
             const data = choiceList.map(x => {
53
             const data = choiceList.map(x => {
57
                 return {
54
                 return {
58
                     houseId,
55
                     houseId,
90
         })
87
         })
91
     }
88
     }
92
 
89
 
90
+    const handleSelectAll = () => {
91
+        if (choiceList && choiceList.length) {
92
+            setChoicelist([])
93
+        } else {
94
+            setChoicelist(list.slice())
95
+        }
96
+    }
93
 
97
 
94
     return <View className='addimg'>
98
     return <View className='addimg'>
95
-        <View>
96
-            <button className="weui-btn weui-btn_primary">全选</button>            
99
+        <View style="margin: 16px 0">
100
+            <button className="weui-btn weui-btn_primary" onClick={handleSelectAll}>
101
+            {
102
+                choiceList && choiceList.length ? '取消全选' : '全选'
103
+            }
104
+            </button>
97
         </View>
105
         </View>
98
 
106
 
99
         <View >
107
         <View >
100
-            <Layout>
108
+            <Layout type="custom">
101
             <View className='at-row at-row--wrap'>
109
             <View className='at-row at-row--wrap'>
102
                 {list.map((x) => {
110
                 {list.map((x) => {
103
                     return <View className='at-col at-col-3 addimg-view-card' key={x.imageId}>
111
                     return <View className='at-col at-col-3 addimg-view-card' key={x.imageId}>

+ 2
- 5
src/pages/customer/index.js 파일 보기

61
     if(props.houseId && (!props.orderId || !regUnFinished)){
61
     if(props.houseId && (!props.orderId || !regUnFinished)){
62
       request({url: `/taHouse/${props.houseId}`,}).then(res=>{
62
       request({url: `/taHouse/${props.houseId}`,}).then(res=>{
63
         const data = res.data.data
63
         const data = res.data.data
64
-        console.log(data,'data')
64
+        // console.log(data,'data')
65
         setHouseInfo(data)
65
         setHouseInfo(data)
66
         setPageState('2')
66
         setPageState('2')
67
       })
67
       })
74
 
74
 
75
   }, [props.houseId, props.orderId, regUnFinished])
75
   }, [props.houseId, props.orderId, regUnFinished])
76
 
76
 
77
-  console.log('---------->', pageState)
78
-  // console.log('--------------->', houseId, orderId)
79
-
80
   return (
77
   return (
81
     <View className='index' >
78
     <View className='index' >
82
 
79
 
91
     {/* !!houseId&& */}
88
     {/* !!houseId&& */}
92
       {pageState!='1' && (
89
       {pageState!='1' && (
93
         <Tab
90
         <Tab
94
-        styleType='tab'
91
+          styleType='tab'
95
           value={['入住指引','房东推荐']}
92
           value={['入住指引','房东推荐']}
96
           pageState={pageState}
93
           pageState={pageState}
97
           onClick={[(e) => setPageState('2'),(e) => setPageState('3')]} />
94
           onClick={[(e) => setPageState('2'),(e) => setPageState('3')]} />

+ 12
- 2
src/pages/guide/index.jsx 파일 보기

8
 import { useSelector } from "react-redux";
8
 import { useSelector } from "react-redux";
9
 import request, { uploadFiles } from "@/util/request";
9
 import request, { uploadFiles } from "@/util/request";
10
 import uploadicon from "../../assets/uploadicon.png";
10
 import uploadicon from "../../assets/uploadicon.png";
11
+// import copy from '../../assets/copy.png'
12
+
11
 const guide = props => {
13
 const guide = props => {
12
   const user = useSelector(state => state.user);
14
   const user = useSelector(state => state.user);
13
   // const guide = useSelector(state => state.guide)
15
   // const guide = useSelector(state => state.guide)
32
     });
34
     });
33
   };
35
   };
34
 
36
 
37
+  const handleCopy = v => {
38
+    wx.setClipboardData({
39
+      data: v,
40
+      success(res) {}
41
+    });
42
+  }
43
+
35
   const onToMap = type => {
44
   const onToMap = type => {
36
     if (user.role == userRloe.customer) return;
45
     if (user.role == userRloe.customer) return;
37
     switch (type) {
46
     switch (type) {
190
                     <Text>名称:</Text>
199
                     <Text>名称:</Text>
191
                     <Text>{detail.wifiName}</Text>
200
                     <Text>{detail.wifiName}</Text>
192
                   </View>
201
                   </View>
193
-                  <View>
202
+                  <View onClick={() => handleCopy(detail.wifiPassword)}>
194
                     <Text>密码:</Text>
203
                     <Text>密码:</Text>
195
-                    <Text>{detail.wifiPassword}</Text>
204
+                    <Text style="display: inline-block; margin-right: 6px">{detail.wifiPassword}</Text>
205
+                    <mp-icon icon="copy" size={12}></mp-icon>
196
                   </View>
206
                   </View>
197
                 </ContainerLayout>
207
                 </ContainerLayout>
198
               </View>
208
               </View>

+ 3
- 0
src/pages/house/household/index.config.js 파일 보기

1
 export default {
1
 export default {
2
     navigationBarTitleText: '查看入住人',
2
     navigationBarTitleText: '查看入住人',
3
+    usingComponents: {
4
+      "mp-icon": "weui-miniprogram/icon/icon"
5
+    }
3
 }
6
 }

+ 54
- 21
src/pages/house/household/index.jsx 파일 보기

8
 import request from "../../../util/request";
8
 import request from "../../../util/request";
9
 import groupby from "lodash.groupby";
9
 import groupby from "lodash.groupby";
10
 import copy from '../../../assets/copy.png'
10
 import copy from '../../../assets/copy.png'
11
+
11
 const house = props => {
12
 const house = props => {
12
   const router = useRouter();
13
   const router = useRouter();
14
+  const [queryParams, setQueryParams] = useState({})
13
   const { houseId } = router.params;
15
   const { houseId } = router.params;
14
 
16
 
15
   const [list, setList] = useState({});
17
   const [list, setList] = useState({});
16
 
18
 
17
   useEffect(() => {
19
   useEffect(() => {
18
     getList();
20
     getList();
19
-  }, []);
21
+  }, [queryParams]);
20
 
22
 
21
   const getList = () => {
23
   const getList = () => {
22
     request({
24
     request({
33
     });
35
     });
34
   };
36
   };
35
 
37
 
36
-  const getDate = value => {
37
-    const [date, time] = value.split("T");
38
-    console.log(time, "time");
39
-    return `${date} ${time.split(":")[0]}:${time.split(":")[1]}`;
40
-  };
41
-
42
   const onCopy = value => {
38
   const onCopy = value => {
43
     wx.setClipboardData({
39
     wx.setClipboardData({
44
       data: value,
40
       data: value,
45
       success(res) {}
41
       success(res) {}
46
     });
42
     });
47
   };
43
   };
44
+
45
+
46
+  const handleDateChange = (e, item) => {
47
+    const dt = e.detail.value
48
+    if (!dt || dt == item.startDate) {
49
+      return
50
+    }
51
+
52
+    Taro.showModal({
53
+      title: '修改日期',
54
+      content: `确认日期修改为: ${dt}`,
55
+      success: e => {
56
+        if (e.confirm) {
57
+          request({
58
+            url: `/taHouseSetting/${item.settingId}`,
59
+            method: 'PUT',
60
+            data: {
61
+              startDate: dt
62
+            }
63
+          }).then(res => {
64
+            Taro.showToast({
65
+              title: '修改成功',
66
+              icon: 'success',
67
+            })
68
+
69
+            // 触发页面刷新
70
+            setQueryParams({})
71
+          })
72
+        }
73
+      }
74
+    })
75
+
76
+  }
77
+
48
   return (
78
   return (
49
     <View className="household">
79
     <View className="household">
50
       <Layout>
80
       <Layout>
70
                     </View>
100
                     </View>
71
                   );
101
                   );
72
                 })}
102
                 })}
73
-                <View style="margin-top: 1em">{`入住时间:${getDate(list[item][0].createDate)}`}</View>
103
+                <View style="margin-top: 1em">
104
+                  <picker
105
+                    mode="date"
106
+                    start="2021-03-01"
107
+                    value={list[item][0].startDate}
108
+                    onChange={e => handleDateChange(e, list[item][0])}
109
+                  >
110
+                    <View>
111
+                      <Text>
112
+                      {`入住时间:${list[item][0].startDate}`}
113
+                      </Text>
114
+                      <View style="display: inline-block; margin-left: .5em">
115
+                        <mp-icon icon="pencil" size={16} color="#ffffff"></mp-icon>
116
+                      </View>
117
+                    </View>
118
+                  </picker>
119
+                </View>
74
                 {list[item].length == 0 && "暂无入住人信息"}
120
                 {list[item].length == 0 && "暂无入住人信息"}
75
               </ContainerLayout>
121
               </ContainerLayout>
76
             </View>
122
             </View>
81
             暂无入住信息
127
             暂无入住信息
82
           </view>
128
           </view>
83
         )}
129
         )}
84
-
85
-        {/* {list.map((x, index) => {
86
-      return <View className='household-view'>
87
-
88
-        <Text className='household-view-title'>入住日期:{index + 1}</Text>
89
-        <ContainerLayout className='household-view-card'>
90
-         
91
-         暂无入住人信息    
92
-        </ContainerLayout>
93
-
94
-      </View>
95
-
96
-    })} */}
97
       </Layout>
130
       </Layout>
98
     </View>
131
     </View>
99
   );
132
   );

+ 38
- 55
src/pages/recommend/index.jsx 파일 보기

1
 import React, { useEffect, useState } from "react";
1
 import React, { useEffect, useState } from "react";
2
 import Taro from "@tarojs/taro";
2
 import Taro from "@tarojs/taro";
3
 import { View, Text, Image, Button } from "@tarojs/components";
3
 import { View, Text, Image, Button } from "@tarojs/components";
4
+import groupby from 'lodash.groupby'
4
 import ContainerLayout from "../../compents/container/index";
5
 import ContainerLayout from "../../compents/container/index";
5
-import more from "../../assets/more.png";
6
+import Divider from '../../compents/Divider'
6
 import deleteicon from "../../assets/deleteicon.png";
7
 import deleteicon from "../../assets/deleteicon.png";
7
 import userRloe from "../../util/userRole";
8
 import userRloe from "../../util/userRole";
8
 import "./index.scss";
9
 import "./index.scss";
9
 import { useSelector } from "react-redux";
10
 import { useSelector } from "react-redux";
10
-import { AtFab } from "taro-ui";
11
 import request from "../../util/request";
11
 import request from "../../util/request";
12
 
12
 
13
 const ImageCard = props => {
13
 const ImageCard = props => {
14
   const { image, onDelete } = props;
14
   const { image, onDelete } = props;
15
   const user = useSelector(state => state.user);
15
   const user = useSelector(state => state.user);
16
   const [isopen, setIsOpen] = useState(false);
16
   const [isopen, setIsOpen] = useState(false);
17
-// boxShadow:'0rpx 12rpx 0rpx 0rpx #8a8b8d'
17
+
18
   return (
18
   return (
19
     <View
19
     <View
20
       className="recommend-view-card"
20
       className="recommend-view-card"
21
       style={{ height: !isopen ? "330rpx" : undefined, overflow: "hidden" ,background:'#fff', boxShadow:'6rpx 12rpx 0rpx #898989' }}
21
       style={{ height: !isopen ? "330rpx" : undefined, overflow: "hidden" ,background:'#fff', boxShadow:'6rpx 12rpx 0rpx #898989' }}
22
     >
22
     >
23
-      {/* <View onClick={() => setIsOpen(!isopen)}  style={{zIndex:99,boxShadow:'6rpx 12rpx 0rpx #898989',position: 'absolute',width:'100%',height:'330rpx',borderRadius: '30rpx',opacity:0}}>
24
-
25
-      </View>
26
-      <View onClick={() => setIsOpen(!isopen)}  style={{zIndex:-9, boxShadow:'0rpx 12rpx 0rpx -4rpx #898989',position: 'absolute',bottom:'0',width:'670rpx',background:'#fff', height:'100%',borderRadius: '30rpx',opacity:0}}>
27
-
28
-      </View> */}
29
       <Image
23
       <Image
30
         className="recommend-view-img"
24
         className="recommend-view-img"
31
         mode="widthFix"
25
         mode="widthFix"
46
       )}
40
       )}
47
     </View>
41
     </View>
48
   );
42
   );
49
-  //   : (
50
-  //     <View>
51
-  //       <Image className="recommend-view-img" mode="widthFix" src={image} onClick={() => setIsOpen(!isopen)}></Image>
52
-  //     </View>
53
-  //   );
54
 };
43
 };
55
 
44
 
56
 const recommend = props => {
45
 const recommend = props => {
59
   const { value, houseId, ...prop } = props;
48
   const { value, houseId, ...prop } = props;
60
 
49
 
61
   // const [state, setState] = useState(1)
50
   // const [state, setState] = useState(1)
62
-  const [list, setList] = useState([]);
51
+  const [list, setList] = useState({});
63
   const [id, setId] = useState();
52
   const [id, setId] = useState();
64
 
53
 
65
-  // let list = props.dataSource || []
66
-
67
   useEffect(() => {
54
   useEffect(() => {
68
-    setList(props.dataSource || []);
55
+    const lst = groupby(props.dataSource || [], 'groupName')
56
+    // setList(props.dataSource || []);
57
+    setList(lst)
69
   }, [props.dataSource]);
58
   }, [props.dataSource]);
70
 
59
 
71
-  // const getImageList=()=>{
72
-  //     request({url:'/taHouseSurround',params:{houseId:houseId}}).then((res)=>{
73
-  //         const {records,...page} =res.data.data
74
-  //         setList(records)
75
-  //     })
76
-  // }
77
-
78
-  //
79
-
80
   const onClick = item => {
60
   const onClick = item => {
81
     if (user.role == userRloe.customer) {
61
     if (user.role == userRloe.customer) {
82
       setId(item.surroundId);
62
       setId(item.surroundId);
103
     }
83
     }
104
   };
84
   };
105
 
85
 
86
+  const listGroupKeys = Object.keys(list) || []
87
+
106
   return (
88
   return (
107
-    <View className="recommend">
89
+    <View className="recommend page">
108
       {user.role == userRloe.landlord && (
90
       {user.role == userRloe.landlord && (
109
         <Button
91
         <Button
110
           onClick={() =>
92
           onClick={() =>
114
           添加图片
96
           添加图片
115
         </Button>
97
         </Button>
116
       )}
98
       )}
117
-      {true &&
118
-        list.map(x => {
119
-          return (
120
-            <View className="recommend-view">
121
-              <ContainerLayout className="recommend-view-layout">
122
-                <ImageCard image={x.image} onDelete={() => onClick(x)} />
123
-                {/* {id != x.surroundId ? <View className='recommend-view-card' style={userRloe.customer == user.role ? { height: "300rpx",overflow:'hidden' }:''}>
124
-
125
-                            <Image className='recommend-view-img' mode='widthFix' src={x.image} ></Image>
126
-
127
-
128
-                            {userRloe.customer == user.role ? <Image className='icon' src={more} onClick={() => onClick(x)}></Image>
129
-
130
-                                : <Image className='icon' src={deleteicon} mode='widthFix' style={{ width: '40rpx' }} onClick={() => onClick(x)}></Image>
131
-                            }
132
-
133
-                        </View> :
134
-                            <View  >
135
-                                <Image className='recommend-view-img' mode='widthFix' src={x.image}></Image>
136
-
137
-                            </View>
138
-                        } */}
139
-              </ContainerLayout>
140
-            </View>
141
-          );
142
-        })}
143
 
99
 
144
-      {list.length == 0 && <View className="nodata"> 暂无数据</View>}
100
+      { 
101
+        listGroupKeys.length == 0 ?
102
+          (<View className="nodata"> 暂无数据</View>) :
103
+          listGroupKeys.map(k => {
104
+            const lst = list[k] || []
105
+
106
+            return (
107
+              <View className="page__hd">
108
+                <View className="page__title" style="font-size: 1.6em">
109
+                  <Divider>{lst[0].groupName}</Divider>
110
+                </View>
111
+                <View className="page__bd">
112
+                {
113
+                  lst.map(x => {
114
+                    return (
115
+                      <View className="recommend-view">
116
+                        <ContainerLayout className="recommend-view-layout">
117
+                          <ImageCard image={x.image} onDelete={() => onClick(x)} />
118
+                        </ContainerLayout>
119
+                      </View>
120
+                    );
121
+                  })
122
+                }
123
+                </View>
124
+              </View>
125
+            )
126
+          })          
127
+      }
145
     </View>
128
     </View>
146
   );
129
   );
147
 };
130
 };