李志伟 3 år sedan
förälder
incheckning
ae13d386c9

+ 14
- 6
src/hotel/components/HouseManage/houseManage.jsx Visa fil

@@ -1,11 +1,13 @@
1 1
 import Taro, { useDidShow } from '@tarojs/taro'
2
+import { View, Input, Button, Label, Textarea,Text } from '@tarojs/components';
2 3
 import see from '@/assets/icons/landlord/lookPerson.png'
3 4
 import share from '@/assets/icons/landlord/shareLink.png'
4 5
 import del from '@/assets/icons/landlord/delete.png'
5 6
 import addImg from '@/assets/icons/landlord/add.png'
6
-import React, { useState, useEffect, useRef, useImperativeHandle,useMemo } from 'react'
7
+import React, { useState, useEffect, useRef, useImperativeHandle, useMemo } from 'react'
7 8
 import { getRoomList, deleteRoom } from '@/services/landlord'
8 9
 import List from '@/components/List';
10
+import Picker from '@/components/Picker'
9 11
 import SearchBar from '@/components/SearchBar'
10 12
 import ShareRoom from '../shareRoom/ShareRoom.jsx'
11 13
 import ShareCard from '../shareCard/shareCard'
@@ -13,10 +15,10 @@ import './houseManage.less'
13 15
 
14 16
 
15 17
 export default React.forwardRef((props, ref) => {
16
-  const { hotel } = props
18
+  const { hotel, hotelList, onHotelChange } = props
17 19
   const [detail, setDetail] = useState([])
18 20
 
19
-  const fetchAPI = useMemo(() => hotel.hotelId?()=>getRoomList({hotelId: hotel.hotelId}):undefined, [hotel?.hotelId])
21
+  const fetchAPI = useMemo(() => hotel.hotelId ? () => getRoomList({ hotelId: hotel.hotelId }) : undefined, [hotel?.hotelId])
20 22
   const queryParams = useMemo(() => ({}), [])
21 23
 
22 24
   const shareDataRef = useRef()
@@ -25,7 +27,7 @@ export default React.forwardRef((props, ref) => {
25 27
   const mounted = useRef(false)
26 28
 
27 29
   const handelClick = () => {
28
-    Taro.navigateTo({ url: `/hotel/pages/landlord/addRoom2/addRoom?hotelId=${hotel.hotelId}&hotelName=${hotel.hotelName}` });
30
+    Taro.navigateTo({ url: `/hotel/pages/landlord/addRoom/addRoom?hotelId=${hotel.hotelId}&hotelName=${hotel.hotelName}` });
29 31
   }
30 32
   const handelDelete = (val) => {
31 33
     Taro.showModal({
@@ -47,7 +49,7 @@ export default React.forwardRef((props, ref) => {
47 49
     })
48 50
   }
49 51
   const handelDetail = (val) => {
50
-    Taro.navigateTo({ url: `/hotel/pages/landlord/addRoom2/addRoom?hotelId=${hotel.hotelId}&hotelName=${hotel.hotelName}&roomId=${val.roomId}` });
52
+    Taro.navigateTo({ url: `/hotel/pages/landlord/addRoom/addRoom?hotelId=${hotel.hotelId}&hotelName=${hotel.hotelName}&roomId=${val.roomId}` });
51 53
   }
52 54
 
53 55
   const [showCutover, setShowCutover] = useState(false)
@@ -63,6 +65,11 @@ export default React.forwardRef((props, ref) => {
63 65
   const onClose2 = () => {
64 66
     setShowCard(false)
65 67
   }
68
+//切换民宿
69
+  const handleHotelChange = (hotelId, current) => {
70
+    onHotelChange(current)
71
+  }
72
+
66 73
   useEffect(() => {
67 74
     //首次加载页面时
68 75
     if (!mounted.current && hotel.hotelId) {
@@ -119,6 +126,7 @@ export default React.forwardRef((props, ref) => {
119 126
   return (
120 127
     <view>
121 128
       <view style={{ padding: '0 30rpx', height: '100%' }}>
129
+        <view className='storeName'>店名:<Picker style={{ display: 'inline-block' }} placeholder="请选择民宿" value={hotel?.hotelId} kv={['hotelName', 'hotelId']} dicts={hotelList} onChange={handleHotelChange} /></view>
122 130
         <SearchBar placeholder='请输入房源名搜索' onBlur={onSearch} />
123 131
         <ShareRoom showCutover={showCutover} onClose={onClose} room={room} onFinish={handleFinish} />
124 132
         <ShareCard showCutover={showCard} onClose={onClose2} />
@@ -133,7 +141,7 @@ export default React.forwardRef((props, ref) => {
133 141
             {
134 142
               detail.map((item, index) =>
135 143
                 <view className='houseCard' key={index}>
136
-                  <view className='houseName' onClick={() => { handelDetail(item) }} >{item.roomName || ''}</view>
144
+                  <view className='houseName' ><View onClick={() => { handelDetail(item) }}>{item.roomName || ''}</View></view>
137 145
                   <view className='operation'>
138 146
                     <view onClick={() => handelOrder(item)}><image src={see} />查看入住人</view>
139 147
                     <view onClick={() => ShowMoldeOn(item)}><image src={share} />分享链接</view>

+ 6
- 1
src/hotel/components/HouseManage/houseManage.less Visa fil

@@ -1,4 +1,9 @@
1
-
1
+.storeName{
2
+  font-size: 32px;
3
+  font-weight: bold;
4
+  color: #202020;
5
+  text-align: center;
6
+}
2 7
 
3 8
 .houseCard{
4 9
   background: #FFFFFF;

+ 2
- 7
src/hotel/components/Income/income.jsx Visa fil

@@ -16,17 +16,12 @@ import './income.less'
16 16
 const getList = id => params => getAccountLogList(id, params)
17 17
 
18 18
 export default (props) => {
19
-  const { hotelList, hotel, account, onHotelChange } = props
19
+  const {  hotel, account } = props
20 20
 
21 21
   const queryParams = useMemo(() => ({}), [])
22 22
 
23 23
   const fetchAPI = useMemo(()=>account.accountId ? getList(account.accountId) : undefined, [account?.accountId])
24 24
 
25
-  const handleHotelChange = (hotelId, current) => {
26
-    onHotelChange(current)
27
-  }
28
-  const [accountlog, setAccountlog] = useState([])
29
-
30 25
   const [isyear, setYear] = useState(true)
31 26
   const [isMomth, setMonth] = useState(false)
32 27
   const handleYear = () => {
@@ -47,7 +42,7 @@ export default (props) => {
47 42
       <ToggleRole role='hotel' showCutover={showCutover} maskClosable={showCutover} onClose={onClose} />
48 43
       <view style={{ padding: '30rpx', height: '100%' }}>
49 44
         <view className='storexx'>
50
-          <view className='storeName'>店名:<Picker style={{ display: 'inline-block' }} placeholder="请选择民宿" value={hotel?.hotelId} kv={['hotelName', 'hotelId']} dicts={hotelList} onChange={handleHotelChange} /></view>
45
+          <view className='storeName'>店名:{hotel.hotelName}</view>
51 46
           <view onClick={ShowMoldeOn} className='User-info-cutover'>
52 47
             <image className='User-info-cutover-image' src={cutoverUser} />
53 48
           </view>

+ 1
- 0
src/hotel/pages/landlord/addRoom/addRoom.config.js Visa fil

@@ -6,5 +6,6 @@ export default {
6 6
     "mp-cell": "weui-miniprogram/cell/cell",
7 7
     "mp-form": "weui-miniprogram/form/form",
8 8
     "mp-slideview": "weui-miniprogram/slideview/slideview",
9
+    "mp-dialog": "weui-miniprogram/dialog/dialog",
9 10
   }
10 11
 }

+ 127
- 41
src/hotel/pages/landlord/addRoom/addRoom.jsx Visa fil

@@ -1,10 +1,12 @@
1 1
 import withLayout from '@/layouts'
2 2
 import Taro from '@tarojs/taro'
3 3
 import CustomNav from '@/components/CustomNav'
4
+import { View, Input, Button, Label, Textarea, Text } from '@tarojs/components';
4 5
 import { useEffect, useState } from "react"
5
-import { Button, Label } from '@tarojs/components'
6 6
 import { saveRoom, getRoomDetail, updateRoom } from '@/services/landlord'
7 7
 import { getExtendContent } from "@/services/home";
8
+import { saveExtend } from '@/services/landlord'
9
+import Popup from '@/components/Popup'
8 10
 import Extend from "../../components/Extend";
9 11
 import './addRoom.less'
10 12
 
@@ -22,6 +24,8 @@ export default withLayout((props) => {
22 24
     wifiPassword: '',
23 25
     weight: '',
24 26
   })
27
+  const [paddress,setpAddress]=useState()
28
+  const [wifiName,setwifiName]=useState()
25 29
   const onRoomMap = () => {
26 30
     Taro.chooseLocation().then((res) => {
27 31
       setRoomModel({ ...roomModel, location: res.longitude + ',' + res.latitude })
@@ -58,80 +62,162 @@ export default withLayout((props) => {
58 62
     }
59 63
   }
60 64
   const [extend, setExtend] = useState([]);
61
-
62 65
   useEffect(() => {
63 66
     if (roomId) {
64 67
       getRoomDetail(roomId).then((res) => {
65 68
         setRoomModel(res)
69
+        setpAddress(res.parkingAddress)
70
+        setwifiName(res.wifiName)
66 71
       })
67
-      getExtendContent('room', roomId).then((res) => {
72
+    }
73
+  }, [roomId])//这个地方写这个单词的目的是   因为编辑时roomId有可能还没加载成功
74
+  const [reset, setReset] = useState(false)
75
+  useEffect(() => {
76
+    if (roomId) {
77
+      getExtendContent('room', roomId, { pageSize: 999 }).then((res) => {
68 78
         setExtend(res.records || []);
69 79
       })
80
+      setReset(false)
70 81
     }
71
-  }, [roomId])//这个地方写这个单词的目的是   因为编辑时roomId有可能还没加载成功
82
+  }, [reset])
72 83
 
84
+  //新增文字
85
+  const [showCutover, setShowCutover] = useState(false)
86
+  const [cont, setcont] = useState('')
87
+  const onClose = () => {
88
+    setShowCutover(false)
89
+  }
90
+  //判断是否只有空 空格 回车
91
+  const javaTrim = (str) => {
92
+    for (var i = 0; (str.charAt(i) == ' ') && i < str.length; i++);
93
+    if (i == str.length) return ''; //whole string is space
94
+    var newstr = str.substr(i);
95
+    for (var i = newstr.length - 1; newstr.charAt(i) == ' ' && i >= 0; i--);
96
+    newstr = newstr.substr(0, i + 1);
97
+    return newstr;
98
+  }
99
+  const handelAdd = () => {
100
+    var content = document.getElementById('cont').value
73 101
 
102
+    content = content.replace(/\n/g, '');
103
+    if (javaTrim(content) == '') {
104
+      Taro.showToast({
105
+        title: '您还没有添加文字哦',
106
+        icon: 'none'
107
+      })
108
+      return;
109
+    }
110
+    const date = {
111
+      targetId: roomId,
112
+      targetType: 'room',
113
+      content,
114
+      contentType: 'text'
115
+    }
74 116
 
117
+    saveExtend(date)
118
+    setcont('')
119
+    onClose()
120
+    setReset(!reset)
121
+  }
122
+  const showText = () => {
123
+    setShowCutover(true)
124
+    setcont('')
125
+  }
126
+  const addImage = () => {
127
+    Taro.chooseImage({
128
+      count: 1,
129
+      success: function (res) {
130
+        const date = {
131
+          targetId: roomId,
132
+          targetType: 'room',
133
+          content: res.tempFilePaths[0],
134
+          contentType: 'image'
135
+        }
136
+        saveExtend(date)
137
+        setReset(!reset)
138
+      }
139
+    })
140
+  }
75 141
   return (
76 142
     <view className='page-index'>
77 143
       <view className="index-navbar">
78 144
         <CustomNav title={hotelName} />
79 145
       </view>
80
-      <view className='from-room' style={{ height: '100%', overflow: "hidden", }} >
146
+      <view className='roomDetail' style={{ height: '100%', overflow: "hidden", }} >
81 147
         <scroll-view scrollY style={{ height: '100%' }}>
148
+          <View id='det'>
149
+            <Popup show={showCutover} onClose={onClose}>
150
+              <View className='editword'>
151
+                <View style={{ marginBottom: '25px' }}>
152
+                  <View className='rzline' /><Label className='srl mg'>新增文字</Label><View className='rzline' />
153
+                </View>
154
+                <View>
155
+                  <Textarea className='storezn' id='cont' value={cont} placeholder='请输入准备新增的文字' />
156
+                </View>
157
+                <View>
158
+                  <Button className='cancel' onClick={onClose}>取消</Button>
159
+                  <Button className='btn' onClick={handelAdd}>确认增加</Button>
160
+                </View>
161
+              </View>
162
+            </Popup>
163
+          </View>
82 164
           <mp-form models={roomModel} >
83
-            <mp-cells title='房屋名称' footer='  ' >
84
-              <mp-cell extClass='font'>
85
-                <input onInput={(e) => setRoomModel({ ...roomModel, roomName: e.detail.value })} value={roomModel.roomName} placeholder='请输入房屋名称(必填)' />
165
+            <mp-cells title='房屋名称' footer='' ext-class='cells' >
166
+              <mp-cell>
167
+                <Input style={{ fontWeight: 'bold' }} onInput={(e) => setRoomModel({ ...roomModel, roomName: e.detail.value })} value={roomModel.roomName} placeholder='请输入房屋名称(必填)' />
86 168
               </mp-cell>
87 169
             </mp-cells>
88 170
             <mp-cells title='房屋位置'>
89
-              <mp-cell extClass='font'>
90
-                <input onInput={(e) => setRoomModel({ ...roomModel, address: e.detail.value })} value={roomModel.address} placeholder='请输入房屋位置(必填)' />
91
-              </mp-cell>
92
-              <mp-cell extClass='font'>
93
-                <label onClick={onRoomMap}>{roomModel.location == '' ? '房间定位(必填)' : roomModel.location}</label>
94
-              </mp-cell>
95
-              </mp-cells>
96
-            <mp-cells title='停车场位置'>
97
-              <mp-cell extClass='font'>
98
-                <input onInput={(e) => setRoomModel({ ...roomModel, parkingAddress: e.detail.value })} value={roomModel.parkingAddress} placeholder='请输入停车场位置' />
99
-              </mp-cell>
100
-              <mp-cell title='停车场经纬度:' extClass='font'>
101
-                <label onClick={onParkMap}>{roomModel.parkingLocation == '' ? '停车场定位' : roomModel.parkingLocation}</label>
102
-              </mp-cell>              
103
-              </mp-cells>
104
-            <mp-cells title='WiFi'>
105
-              <mp-cell title='Wi-Fi名称:' extClass='font'>
106
-                <input onInput={(e) => setRoomModel({ ...roomModel, wifiName: e.detail.value })} value={roomModel.wifiName} placeholder='请输入wifi名称' />
171
+              <mp-cell>
172
+                <Input style={{ color: '#000', fontWeight: 'bold', marginBottom: '13px' }} onInput={(e) => setRoomModel({ ...roomModel, address: e.detail.value })} value={roomModel.address} placeholder='请输入房屋位置(必填)' />
173
+                <Label style={{ color: '#666' }} onClick={onRoomMap}>{roomModel.location == '' ? '房间定位(必填)' : roomModel.location}</Label>
107 174
               </mp-cell>
108
-              <mp-cell title='Wi-Fi密码:' extClass='font'>
109
-                <input onInput={(e) => setRoomModel({ ...roomModel, wifiPassword: e.detail.value })} value={roomModel.wifiPassword} placeholder='请输入wifi密码' />
110
-              </mp-cell>                          
111
-              </mp-cells>
175
+            </mp-cells>
176
+            {
177
+              paddress != '' ?
178
+                <mp-cells title='停车场位置'>
179
+                  <mp-cell>
180
+                    <Input onInput={(e) => setRoomModel({ ...roomModel, parkingAddress: e.detail.value })} value={roomModel.parkingAddress} placeholder='请输入停车场位置' />
181
+                    <Label style={{ color: '#666', lineHeight: '30px' }} onClick={onParkMap}>{roomModel.parkingLocation == '' ? '停车场定位' : roomModel.parkingLocation}</Label>
182
+                  </mp-cell>
183
+                </mp-cells> : null
184
+            }
185
+            {
186
+              wifiName != '' ?
187
+                <mp-cells title='WiFi信息'>
188
+                  <mp-cell>
189
+                    <View style={{ color: '#666' }}>
190
+                      <Input style={{ display: 'inline-block', background: '#fff', width: '20%' }} value='名称:' disabled /><Input style={{ display: 'inline-block', width: '80%' }} onInput={(e) => setRoomModel({ ...roomModel, wifiName: e.detail.value })} value={roomModel.wifiName} placeholder='请输入wifi名称' />
191
+                      <Input style={{ display: 'inline-block', background: '#fff', width: '20%' }} value='密码:' disabled /><Input style={{ display: 'inline-block', width: '80%' }} onInput={(e) => setRoomModel({ ...roomModel, wifiPassword: e.detail.value })} value={roomModel.wifiPassword} placeholder='请输入wifi密码' />
192
+                    </View>
193
+                  </mp-cell>
194
+                </mp-cells> : null
195
+            }
112 196
             <mp-cells title='权重'>
113
-              <mp-cell  extClass='font'>
197
+              <mp-cell>
114 198
                 <input type='number' value={roomModel.weight} onInput={(e) => setRoomModel({ ...roomModel, weight: e.detail.value })} placeholder='请输入权重(必填)' />
115 199
               </mp-cell>
116
-                             
117
-              </mp-cells>
118
-            <mp-cells title='更多指引'>              
200
+            </mp-cells>
201
+            <mp-cells title='其他指引'>
119 202
               {
120 203
                 extend == '' ? null :
121 204
                   <mp-cell >
122 205
                     {extend.map((item) => (
123
-                      <Extend key={item.extId} item={item} />
206
+                      <Extend key={item.extId} item={item} setReset={setReset} />
124 207
                     ))}
125 208
                   </mp-cell>
126 209
               }
127
-              <mp-cell extClass='adds'>
128
-                <Button className='add'>增加文字</Button><Button className='add'>增加图片</Button>
129
-              </mp-cell>
130
-              <mp-cell>
131
-                <Button className='button-OK' onClick={sumbit}>确定</Button>
132
-              </mp-cell>
133 210
             </mp-cells>
134 211
           </mp-form>
212
+          <View className='adds' >
213
+            <Text className='zuobian'>增加文字</Text>
214
+            <View className='add' onClick={showText}><Text className='jiahao'>+</Text><Text className='zengjia'>添加</Text></View>
215
+          </View>
216
+          <View className='adds' >
217
+            <Text className='zuobian'>增加图片</Text>
218
+            <View className='add' onClick={addImage}><Text className='jiahao'>+</Text><Text className='zengjia'>添加</Text></View>
219
+          </View>
220
+          <Button className='button-OK' onClick={sumbit}>确定</Button>
135 221
         </scroll-view>
136 222
       </view>
137 223
     </view>

+ 50
- 23
src/hotel/pages/landlord/addRoom/addRoom.less Visa fil

@@ -1,30 +1,57 @@
1
-.from-room{
2
-  width: 100%;
3
-  box-shadow: 0px 8px 32px 0px rgba(0, 0, 0, 0.08);
4
-  border-radius: 24px;
5
-  .button-OK {
6
-    width: calc(100% - 60px);
7
-    height: 92px;
8
-    background: #1A3B83;
9
-    margin: 0 auto;
10
-    line-height: 92px;
11
-    border-radius: 12px;
12
-    font-size: 40px;
13
-    color: #ffffff;
1
+.roomDetail{
2
+  padding: 30px;
3
+  background-color: #F8F8F8;
4
+  .weui-cells__title{
5
+    font-size: 34px;
14 6
   }
15
-  .font{
16
-    font-size: 28px;
17
-    color: #202020;
7
+  .weui-cells_after-title{
8
+    border-radius: 50px;
9
+    font-size: 30px;
10
+    margin-top: 40px;
18 11
   }
12
+    
19 13
   .adds{
20
-    text-align: center;
14
+    width: 100%;
15
+    background-color: #fff;
16
+    border-radius: 12px;
17
+    font-weight: bold;
18
+    margin-top: 20px;
19
+    padding: 30px;
20
+    position: relative;
21
+    .zuobian{
22
+      text-align: left;
23
+      font-size: 32px;      
24
+    }
21 25
     .add{
22
-      display: inline-block;
23
-      width: 40%;
24
-      height: 92px;
26
+      position: absolute;
27
+      right: 90px;
28
+      height: 60px;
29
+      top: calc(50% - 30px);
30
+      width: 170px;
31
+      border: 2px solid #000;
32
+      color: #202020;
33
+      line-height: 56px;
25 34
       border-radius: 12px;
26
-      font-size: 40px;
27
-      margin: 0 5%;
35
+      letter-spacing: 5px;
36
+      text-align: center;
37
+      .jiahao{        
38
+        font-size: 48px;
39
+      }
40
+      .zengjia{
41
+        position: relative;
42
+        bottom:  4px;
43
+      }
28 44
     }
29 45
   }  
30
-}
46
+  .button-OK {
47
+    height: 92px;
48
+    background: #274291;
49
+    margin: 60px 0 30px 0;
50
+    letter-spacing: 5px;
51
+    line-height: 92px;
52
+    border-radius: 12px;
53
+    font-size: 30px;
54
+    font-weight: bold;
55
+    color: #fff;
56
+  }
57
+}

+ 0
- 11
src/hotel/pages/landlord/addRoom2/addRoom.config.js Visa fil

@@ -1,11 +0,0 @@
1
-export default {
2
-  navigationBarTitleText: '',
3
-  navigationStyle: 'custom',
4
-  usingComponents: {
5
-    "mp-cells": "weui-miniprogram/cells/cells",
6
-    "mp-cell": "weui-miniprogram/cell/cell",
7
-    "mp-form": "weui-miniprogram/form/form",
8
-    "mp-slideview": "weui-miniprogram/slideview/slideview",
9
-    "mp-dialog": "weui-miniprogram/dialog/dialog",
10
-  }
11
-}

+ 0
- 215
src/hotel/pages/landlord/addRoom2/addRoom.jsx Visa fil

@@ -1,215 +0,0 @@
1
-import withLayout from '@/layouts'
2
-import Taro from '@tarojs/taro'
3
-import CustomNav from '@/components/CustomNav'
4
-import { View, Input, Button, Label, Textarea,Text } from '@tarojs/components';
5
-import { useEffect, useState } from "react"
6
-import { saveRoom, getRoomDetail, updateRoom } from '@/services/landlord'
7
-import { getExtendContent } from "@/services/home";
8
-import { saveExtend } from '@/services/landlord'
9
-import Popup from '@/components/Popup'
10
-import Extend from "../../components/Extend";
11
-import './addRoom.less'
12
-
13
-
14
-export default withLayout((props) => {
15
-  const { hotelId, hotelName, roomId } = props.router.params
16
-  const [roomModel, setRoomModel] = useState({
17
-    hotelId,
18
-    roomName: '',
19
-    address: '',
20
-    location: '',
21
-    parkingAddress: '',
22
-    parkingLocation: '',
23
-    wifiName: '',
24
-    wifiPassword: '',
25
-    weight: '',
26
-  })
27
-  const onRoomMap = () => {
28
-    Taro.chooseLocation().then((res) => {
29
-      setRoomModel({ ...roomModel, location: res.longitude + ',' + res.latitude })
30
-
31
-    })
32
-  }
33
-  const onParkMap = () => {
34
-    Taro.chooseLocation().then((res) => {
35
-      setRoomModel({ ...roomModel, parkingLocation: res.longitude + ',' + res.latitude })
36
-
37
-    })
38
-  }
39
-  const sumbit = () => {
40
-    if (
41
-      roomModel.roomName != '' &&
42
-      roomModel.address != '' &&
43
-      roomModel.location != '' &&
44
-      roomModel.weight != ''
45
-    ) {
46
-      const seveices = roomId ? updateRoom : saveRoom
47
-      seveices(roomModel, roomId).then(() => {
48
-        Taro.showModal({
49
-          title: roomId ? '修改成功' : '保存成功',
50
-          showCancel: false
51
-        }).then(() => {
52
-          Taro.navigateBack()
53
-        })
54
-      })
55
-    } else {
56
-      Taro.showToast({
57
-        title: '有必填项未填哦',
58
-        icon: 'none',
59
-      })
60
-    }
61
-  }
62
-  const [extend, setExtend] = useState([]);
63
-  useEffect(() => {
64
-    if (roomId) {
65
-      getRoomDetail(roomId).then((res) => {
66
-        setRoomModel(res)
67
-      })
68
-    }
69
-  }, [roomId])//这个地方写这个单词的目的是   因为编辑时roomId有可能还没加载成功
70
-  const [reset, setReset] = useState(false)
71
-  useEffect(() => {
72
-    if (roomId) {
73
-      getExtendContent('room', roomId, { pageSize: 999 }).then((res) => {
74
-        setExtend(res.records || []);
75
-      })
76
-      setReset(false)
77
-    }
78
-  }, [reset])
79
-
80
-  //新增文字
81
-  const [showCutover, setShowCutover] = useState(false)
82
-  const [cont, setcont] = useState('')
83
-  const onClose = () => {
84
-    setShowCutover(false)
85
-  }
86
-  //判断是否只有空 空格 回车
87
-  const javaTrim = (str) => {
88
-    for (var i = 0; (str.charAt(i) == ' ') && i < str.length; i++);
89
-    if (i == str.length) return ''; //whole string is space
90
-    var newstr = str.substr(i);
91
-    for (var i = newstr.length - 1; newstr.charAt(i) == ' ' && i >= 0; i--);
92
-    newstr = newstr.substr(0, i + 1);
93
-    return newstr;
94
-  }
95
-  const handelAdd = () => {
96
-    var content = document.getElementById('cont').value
97
-
98
-    content = content.replace(/\n/g, '');
99
-    if (javaTrim(content) == '') {
100
-      Taro.showToast({
101
-        title: '您还没有添加文字哦',
102
-        icon: 'none'
103
-      })
104
-      return;
105
-    }
106
-    const date = {
107
-      targetId: roomId,
108
-      targetType: 'room',
109
-      content,
110
-      contentType: 'text'
111
-    }
112
-
113
-    saveExtend(date)
114
-    setcont('')
115
-    onClose()
116
-    setReset(!reset)
117
-  }
118
-  const showText = () => {
119
-    setShowCutover(true)
120
-    setcont('')
121
-  }
122
-  const addImage = () => {
123
-    Taro.chooseImage({
124
-      count: 1,
125
-      success: function (res) {
126
-        const date = {
127
-          targetId: roomId,
128
-          targetType: 'room',
129
-          content: res.tempFilePaths[0],
130
-          contentType: 'image'
131
-        }
132
-        saveExtend(date)
133
-        setReset(!reset)
134
-      }
135
-    })
136
-  }
137
-  return (
138
-    <view className='page-index'>
139
-      <view className="index-navbar">
140
-        <CustomNav title={hotelName} />
141
-      </view>
142
-      <view className='roomDetail' style={{ height: '100%', overflow: "hidden", }} >
143
-        <scroll-view scrollY style={{ height: '100%' }}>
144
-          <View id='det'>
145
-            <Popup show={showCutover} onClose={onClose}>
146
-              <View className='editword'>
147
-                <View style={{ marginBottom: '25px' }}>
148
-                  <View className='rzline' /><Label className='srl mg'>新增文字</Label><View className='rzline' />
149
-                </View>
150
-                <View>
151
-                  <Textarea className='storezn' id='cont' value={cont} placeholder='请输入准备新增的文字' />
152
-                </View>
153
-                <View>
154
-                  <Button className='cancel' onClick={onClose}>取消</Button>
155
-                  <Button className='btn' onClick={handelAdd}>确认增加</Button>
156
-                </View>
157
-              </View>
158
-            </Popup>
159
-          </View>
160
-          <mp-form models={roomModel} >
161
-            <mp-cells title='房屋名称' footer='' ext-class='cells' >
162
-              <mp-cell>
163
-                <Input style={{ fontWeight: 'bold' }} onInput={(e) => setRoomModel({ ...roomModel, roomName: e.detail.value })} value={roomModel.roomName} placeholder='请输入房屋名称(必填)' />
164
-              </mp-cell>
165
-            </mp-cells>
166
-            <mp-cells title='房屋位置'>
167
-              <mp-cell>
168
-                <Input style={{ color: '#000', fontWeight: 'bold', marginBottom: '13px' }} onInput={(e) => setRoomModel({ ...roomModel, address: e.detail.value })} value={roomModel.address} placeholder='请输入房屋位置(必填)' />
169
-                <Label style={{ color: '#666' }} onClick={onRoomMap}>{roomModel.location == '' ? '房间定位(必填)' : roomModel.location}</Label>
170
-              </mp-cell>
171
-            </mp-cells>
172
-            <mp-cells title='停车场位置'>
173
-              <mp-cell>
174
-                <Input onInput={(e) => setRoomModel({ ...roomModel, parkingAddress: e.detail.value })} value={roomModel.parkingAddress} placeholder='请输入停车场位置' />
175
-                <Label style={{ color: '#666', lineHeight: '30px' }} onClick={onParkMap}>{roomModel.parkingLocation == '' ? '停车场定位' : roomModel.parkingLocation}</Label>
176
-              </mp-cell>
177
-            </mp-cells>
178
-            <mp-cells title='WiFi信息'>
179
-              <mp-cell>
180
-                <View style={{ color: '#666' }}>
181
-                  <Input style={{ display: 'inline-block', background: '#fff', width: '20%' }} value='名称:' disabled /><Input style={{ display: 'inline-block', width: '80%' }} onInput={(e) => setRoomModel({ ...roomModel, wifiName: e.detail.value })} value={roomModel.wifiName} placeholder='请输入wifi名称' />
182
-                  <Input style={{ display: 'inline-block', background: '#fff', width: '20%' }} value='密码:' disabled /><Input style={{ display: 'inline-block', width: '80%' }} onInput={(e) => setRoomModel({ ...roomModel, wifiPassword: e.detail.value })} value={roomModel.wifiPassword} placeholder='请输入wifi密码' />
183
-                </View>
184
-              </mp-cell>
185
-            </mp-cells>
186
-            <mp-cells title='权重'>
187
-              <mp-cell>
188
-                <input type='number' value={roomModel.weight} onInput={(e) => setRoomModel({ ...roomModel, weight: e.detail.value })} placeholder='请输入权重(必填)' />
189
-              </mp-cell>
190
-            </mp-cells>
191
-            <mp-cells title='其他指引'>
192
-              {
193
-                extend == '' ? null :
194
-                  <mp-cell >
195
-                    {extend.map((item) => (
196
-                      <Extend key={item.extId} item={item} setReset={setReset} />
197
-                    ))}
198
-                  </mp-cell>
199
-              }
200
-            </mp-cells>
201
-          </mp-form>
202
-          <View className='adds' >
203
-            <Text className='zuobian'>增加文字</Text>
204
-            <View className='add' onClick={showText}><Text className='jiahao'>+</Text><Text className='zengjia'>添加</Text></View>
205
-          </View>
206
-          <View className='adds' >
207
-            <Text className='zuobian'>增加图片</Text>
208
-            <View className='add' onClick={addImage}><Text className='jiahao'>+</Text><Text className='zengjia'>添加</Text></View>
209
-          </View>
210
-          <Button className='button-OK' onClick={sumbit}>确定</Button>
211
-        </scroll-view>
212
-      </view>
213
-    </view>
214
-  )
215
-})

+ 0
- 57
src/hotel/pages/landlord/addRoom2/addRoom.less Visa fil

@@ -1,57 +0,0 @@
1
-.roomDetail{
2
-  padding: 30px;
3
-  background-color: #F8F8F8;
4
-  .weui-cells__title{
5
-    font-size: 34px;
6
-  }
7
-  .weui-cells_after-title{
8
-    border-radius: 50px;
9
-    font-size: 30px;
10
-    margin-top: 40px;
11
-  }
12
-    
13
-  .adds{
14
-    width: 100%;
15
-    background-color: #fff;
16
-    border-radius: 12px;
17
-    font-weight: bold;
18
-    margin-top: 20px;
19
-    padding: 30px;
20
-    position: relative;
21
-    .zuobian{
22
-      text-align: left;
23
-      font-size: 32px;      
24
-    }
25
-    .add{
26
-      position: absolute;
27
-      right: 90px;
28
-      height: 60px;
29
-      top: calc(50% - 30px);
30
-      width: 170px;
31
-      border: 2px solid #000;
32
-      color: #202020;
33
-      line-height: 56px;
34
-      border-radius: 12px;
35
-      letter-spacing: 5px;
36
-      text-align: center;
37
-      .jiahao{        
38
-        font-size: 48px;
39
-      }
40
-      .zengjia{
41
-        position: relative;
42
-        bottom:  4px;
43
-      }
44
-    }
45
-  }  
46
-  .button-OK {
47
-    height: 92px;
48
-    background: #274291;
49
-    margin: 60px 0 30px 0;
50
-    letter-spacing: 5px;
51
-    line-height: 92px;
52
-    border-radius: 12px;
53
-    font-size: 30px;
54
-    font-weight: bold;
55
-    color: #fff;
56
-  }
57
-}

+ 2
- 5
src/hotel/pages/landlord/landlord.jsx Visa fil

@@ -1,8 +1,6 @@
1 1
 import React, { useState, useEffect, useRef } from 'react'
2 2
 import Taro, { useRouter, useShareAppMessage } from '@tarojs/taro'
3
-
4 3
 import withLayout from '@/layouts'
5
-
6 4
 import { getHotelManage, getNowHotelManage } from '@/services/landlord'
7 5
 import NoData from '@/components/NoData'
8 6
 import CustomNav from '@/components/CustomNav'
@@ -10,7 +8,6 @@ import { withSubscribeMessage } from '@/utils/subscribeMessage'
10 8
 import HouseManage from '../../components/HouseManage/houseManage'
11 9
 import Income from '../../components/Income/income'
12 10
 import tabList from './Roomtabbar'
13
-
14 11
 import './landlord.less'
15 12
 
16 13
 export default withLayout((props) => {
@@ -67,8 +64,8 @@ export default withLayout((props) => {
67 64
         <CustomNav title={hotel?.hotelName} logo={hotel?.logo} />
68 65
       </view>
69 66
       <view className='index-container'>
70
-        {currentTab === 1 && <Income hotelList={hotelList} hotel={hotel} account={account} onHotelChange={handleHotelChange} />}
71
-        {hotel?.hotelId ? currentTab === 0 && <HouseManage hotel={hotel} ref={houseRef} disabled={!hotel.hotelId} /> : <NoData />}
67
+        {currentTab === 1 && <Income hotel={hotel} account={account} />}
68
+        {hotel?.hotelId ? currentTab === 0 && <HouseManage hotelList={hotelList} hotel={hotel} onHotelChange={handleHotelChange} ref={houseRef} disabled={!hotel.hotelId} /> : <NoData />}
72 69
       </view>
73 70
       <view className='index-tabbar'>
74 71
         {/* <TabBar extClass='custom-tabbar bottomTab' current={currentTab} onChange={handleTabChange}>

+ 0
- 4
src/routes.js Visa fil

@@ -80,10 +80,6 @@ const hotelPages = [
80 80
     title: '新增房源',
81 81
     page: 'pages/landlord/addRoom/addRoom',
82 82
   },
83
-  {
84
-    title: '新增房源2',
85
-    page: 'pages/landlord/addRoom2/addRoom',
86
-  },
87 83
   {
88 84
     title: '查看入住人',
89 85
     page: 'pages/landlord/roomOrder/roomOrder',