浏览代码

民宿房东端v2.1.1

李志伟 3 年前
父节点
当前提交
c1314352ea

二进制
src/assets/icons/landlord/copyroom.png 查看文件


+ 14
- 4
src/hotel/components/HouseManage/houseManage.jsx 查看文件

1
 import Taro, { useDidShow } from '@tarojs/taro'
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
 import see from '@/assets/icons/landlord/lookPerson.png'
3
 import see from '@/assets/icons/landlord/lookPerson.png'
4
 import share from '@/assets/icons/landlord/shareLink.png'
4
 import share from '@/assets/icons/landlord/shareLink.png'
5
 import del from '@/assets/icons/landlord/delete.png'
5
 import del from '@/assets/icons/landlord/delete.png'
6
 import addImg from '@/assets/icons/landlord/add.png'
6
 import addImg from '@/assets/icons/landlord/add.png'
7
+import copyRoom from '@/assets/icons/landlord/copyroom.png'
7
 import React, { useState, useEffect, useRef, useImperativeHandle, useMemo } from 'react'
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
 import List from '@/components/List';
10
 import List from '@/components/List';
10
 import Picker from '@/components/Picker'
11
 import Picker from '@/components/Picker'
11
 import SearchBar from '@/components/SearchBar'
12
 import SearchBar from '@/components/SearchBar'
65
   const onClose2 = () => {
66
   const onClose2 = () => {
66
     setShowCard(false)
67
     setShowCard(false)
67
   }
68
   }
68
-//切换民宿
69
+  //切换民宿
69
   const handleHotelChange = (hotelId, current) => {
70
   const handleHotelChange = (hotelId, current) => {
70
     onHotelChange(current)
71
     onHotelChange(current)
71
   }
72
   }
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
   return (
135
   return (
127
     <view>
136
     <view>
128
       <view style={{ padding: '0 30rpx', height: '100%' }}>
137
       <view style={{ padding: '0 30rpx', height: '100%' }}>
141
             {
150
             {
142
               detail.map((item, index) =>
151
               detail.map((item, index) =>
143
                 <view className='houseCard' key={index}>
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
                   <view className='operation'>
155
                   <view className='operation'>
146
                     <view onClick={() => handelOrder(item)}><image src={see} />查看入住人</view>
156
                     <view onClick={() => handelOrder(item)}><image src={see} />查看入住人</view>
147
                     <view onClick={() => ShowMoldeOn(item)}><image src={share} />分享链接</view>
157
                     <view onClick={() => ShowMoldeOn(item)}><image src={share} />分享链接</view>

+ 8
- 0
src/hotel/components/HouseManage/houseManage.less 查看文件

18
     font-weight: bold;
18
     font-weight: bold;
19
     color: #202020;
19
     color: #202020;
20
     width:100%;
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
   .operation{
30
   .operation{
23
     column-count: 3;
31
     column-count: 3;

+ 26
- 20
src/hotel/pages/landlord/addRoom/addRoom.jsx 查看文件

24
     wifiPassword: '',
24
     wifiPassword: '',
25
     weight: '',
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
   const onRoomMap = () => {
29
   const onRoomMap = () => {
30
     Taro.chooseLocation().then((res) => {
30
     Taro.chooseLocation().then((res) => {
31
       setRoomModel({ ...roomModel, location: res.longitude + ',' + res.latitude })
31
       setRoomModel({ ...roomModel, location: res.longitude + ',' + res.latitude })
198
                 <input type='number' value={roomModel.weight} onInput={(e) => setRoomModel({ ...roomModel, weight: e.detail.value })} placeholder='请输入权重(必填)' />
198
                 <input type='number' value={roomModel.weight} onInput={(e) => setRoomModel({ ...roomModel, weight: e.detail.value })} placeholder='请输入权重(必填)' />
199
               </mp-cell>
199
               </mp-cell>
200
             </mp-cells>
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
           </mp-form>
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
           <Button className='button-OK' onClick={sumbit}>确定</Button>
226
           <Button className='button-OK' onClick={sumbit}>确定</Button>
221
         </scroll-view>
227
         </scroll-view>
222
       </view>
228
       </view>