Parcourir la source

民宿房东端v2.1.1

李志伟 il y a 3 ans
Parent
révision
c1314352ea

BIN
src/assets/icons/landlord/copyroom.png Voir le fichier


+ 14
- 4
src/hotel/components/HouseManage/houseManage.jsx Voir le fichier

@@ -1,11 +1,12 @@
1 1
 import Taro, { useDidShow } from '@tarojs/taro'
2
-import { View, Input, Button, Label, Textarea,Text } from '@tarojs/components';
2
+import { View, Image, Input, Button, Label, Textarea, Text } from '@tarojs/components';
3 3
 import see from '@/assets/icons/landlord/lookPerson.png'
4 4
 import share from '@/assets/icons/landlord/shareLink.png'
5 5
 import del from '@/assets/icons/landlord/delete.png'
6 6
 import addImg from '@/assets/icons/landlord/add.png'
7
+import copyRoom from '@/assets/icons/landlord/copyroom.png'
7 8
 import React, { useState, useEffect, useRef, useImperativeHandle, useMemo } from 'react'
8
-import { getRoomList, deleteRoom } from '@/services/landlord'
9
+import { getRoomList, saveRoom,deleteRoom } from '@/services/landlord'
9 10
 import List from '@/components/List';
10 11
 import Picker from '@/components/Picker'
11 12
 import SearchBar from '@/components/SearchBar'
@@ -65,7 +66,7 @@ export default React.forwardRef((props, ref) => {
65 66
   const onClose2 = () => {
66 67
     setShowCard(false)
67 68
   }
68
-//切换民宿
69
+  //切换民宿
69 70
   const handleHotelChange = (hotelId, current) => {
70 71
     onHotelChange(current)
71 72
   }
@@ -123,6 +124,14 @@ export default React.forwardRef((props, ref) => {
123 124
       })
124 125
     }
125 126
   }
127
+  const handelCopy = (val) => {
128
+    saveRoom({ ...val, roomId: null, roomName: val.roomName + '复制' }).then(() => {
129
+      getRoomList({ hotelId: hotel.hotelId }).then((res) => {
130
+        setDetail(res.records || [])
131
+      })
132
+    })
133
+    // console.log()
134
+  }
126 135
   return (
127 136
     <view>
128 137
       <view style={{ padding: '0 30rpx', height: '100%' }}>
@@ -141,7 +150,8 @@ export default React.forwardRef((props, ref) => {
141 150
             {
142 151
               detail.map((item, index) =>
143 152
                 <view className='houseCard' key={index}>
144
-                  <view className='houseName' ><View onClick={() => { handelDetail(item) }}>{item.roomName || ''}</View></view>
153
+                  {/* onClick={() =>handelDetail(item) } */}
154
+                  <view className='houseName' ><View className='name' >{item.roomName || ''}<Image src={copyRoom} onClick={() => handelCopy(item)} /></View></view>
145 155
                   <view className='operation'>
146 156
                     <view onClick={() => handelOrder(item)}><image src={see} />查看入住人</view>
147 157
                     <view onClick={() => ShowMoldeOn(item)}><image src={share} />分享链接</view>

+ 8
- 0
src/hotel/components/HouseManage/houseManage.less Voir le fichier

@@ -18,6 +18,14 @@
18 18
     font-weight: bold;
19 19
     color: #202020;
20 20
     width:100%;
21
+    Image{
22
+      width: 45px;
23
+      height: 45px;
24
+      position: relative;
25
+      left: 0.5em;
26
+      top: 0.3em;
27
+      opacity: 0.7;
28
+    }
21 29
   }
22 30
   .operation{
23 31
     column-count: 3;

+ 26
- 20
src/hotel/pages/landlord/addRoom/addRoom.jsx Voir le fichier

@@ -24,8 +24,8 @@ export default withLayout((props) => {
24 24
     wifiPassword: '',
25 25
     weight: '',
26 26
   })
27
-  const [paddress,setpAddress]=useState()
28
-  const [wifiName,setwifiName]=useState()
27
+  const [paddress, setpAddress] = useState()
28
+  const [wifiName, setwifiName] = useState()
29 29
   const onRoomMap = () => {
30 30
     Taro.chooseLocation().then((res) => {
31 31
       setRoomModel({ ...roomModel, location: res.longitude + ',' + res.latitude })
@@ -198,25 +198,31 @@ export default withLayout((props) => {
198 198
                 <input type='number' value={roomModel.weight} onInput={(e) => setRoomModel({ ...roomModel, weight: e.detail.value })} placeholder='请输入权重(必填)' />
199 199
               </mp-cell>
200 200
             </mp-cells>
201
-            <mp-cells title='其他指引'>
202
-              {
203
-                extend == '' ? null :
204
-                  <mp-cell >
205
-                    {extend.map((item) => (
206
-                      <Extend key={item.extId} item={item} setReset={setReset} />
207
-                    ))}
208
-                  </mp-cell>
209
-              }
210
-            </mp-cells>
201
+            {roomId ? <>
202
+              <mp-cells title='其他指引'>
203
+                {
204
+                  extend == '' ? null :
205
+                    <mp-cell >
206
+                      {extend.map((item) => (
207
+                        <Extend key={item.extId} item={item} setReset={setReset} />
208
+                      ))}
209
+                    </mp-cell>
210
+                }
211
+              </mp-cells>
212
+            </> : null
213
+            }
211 214
           </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>
215
+          {roomId ? <>
216
+            <View className='adds' >
217
+              <Text className='zuobian'>增加文字</Text>
218
+              <View className='add' onClick={showText}><Text className='jiahao'>+</Text><Text className='zengjia'>添加</Text></View>
219
+            </View>
220
+            <View className='adds' >
221
+              <Text className='zuobian'>增加图片</Text>
222
+              <View className='add' onClick={addImage}><Text className='jiahao'>+</Text><Text className='zengjia'>添加</Text></View>
223
+            </View>
224
+          </> : null
225
+          }
220 226
           <Button className='button-OK' onClick={sumbit}>确定</Button>
221 227
         </scroll-view>
222 228
       </view>