李志伟 3 vuotta sitten
vanhempi
commit
b0efbe09b3

+ 1
- 1
src/components/CouponCard/Card/style.less Näytä tiedosto

@@ -8,7 +8,7 @@
8 8
   border-radius: 12px;
9 9
 
10 10
   & + & {
11
-    margin-top: 36rpx;
11
+    margin-top: 36px;
12 12
   }
13 13
 
14 14
   & > view {

+ 1
- 1
src/hotel/components/Income/income.jsx Näytä tiedosto

@@ -72,7 +72,7 @@ export default (props) => {
72 72
         <view className='title' >推广收入记录</view>
73 73
 
74 74
         <List
75
-          style={{ height: 'calc(100vh - 390px)' }}
75
+          style={{ height: 'calc(100vh - 375px)' }}
76 76
           request={fetchAPI}
77 77
           params={queryParams}
78 78
           noData={<NoData />}

+ 2
- 1
src/hotel/components/shareRoom/ShareRoom.jsx Näytä tiedosto

@@ -22,7 +22,8 @@ export default (props) => {
22 22
     var myDate = new Date();
23 23
     shareRoom({
24 24
       hotelId: room.hotelId,
25
-      personNum: roomNum == '' ? 0 : roomNum, roomId: room.roomId,
25
+      personNum: roomNum == '' ? 0 : roomNum, 
26
+      roomId: room.roomId,
26 27
       startDate: startDate == '' ? myDate.toLocaleDateString() : startDate,
27 28
       endDate: endDate == '' ? myDate.toLocaleDateString() : endDate
28 29
     }).then((res) => {

+ 62
- 14
src/hotel/pages/components/Extend/index.jsx Näytä tiedosto

@@ -1,42 +1,90 @@
1 1
 import { useState } from 'react';
2 2
 import Taro from '@tarojs/taro';
3 3
 import del from '@/assets/icons/landlord/delete.png'
4
-import { View,Text, Image } from '@tarojs/components';
5
-import { update } from '@/services/landlord'
4
+import Popup from '@/components/Popup'
5
+import { View, Text, Image, Textarea, Label, Button } from '@tarojs/components';
6
+import { update,deleteExtend } from '@/services/landlord'
6 7
 import './style.less'
7 8
 
8 9
 export default (props) => {
9
-  const { item } = props
10
+  const { item,setReset } = props
10 11
   const [eimg, seteImg] = useState(item.content)
11 12
   const handerChange = () => {
12 13
     Taro.chooseImage({
13 14
       count: 1,
14 15
       success: function (res) {
15 16
         seteImg(res.tempFilePaths[0])
16
-        update(item.targetId, res.tempFilePaths[0]).then(() => { })
17
+        const date={
18
+          content:res.tempFilePaths[0],
19
+          contentType:'image'
20
+        }
21
+        update(item.extId,{...item,...date} )
17 22
       }
18 23
     })
19 24
   }
20
-  const detele=[
25
+  const [showCutover, setShowCutover] = useState(false)
26
+  const showText = () => {
27
+    setShowCutover(true)
28
+  }
29
+  const onClose = () => {
30
+    setShowCutover(false)
31
+    setReset(true)
32
+  }
33
+  const detele = [
21 34
     {
22 35
       src: del, // icon的路径
23
-      extClass:'det'
24 36
     }
25 37
   ]
26
-  const handelDelete=()=>{
27
-    seteImg()
28
-    console.log("11111111111111111")
38
+  const [content, setContent] = useState(item.content)
39
+  const handelDelete = () => {
40
+    deleteExtend(item.extId)
41
+    setReset(true)
42
+  }
43
+  const handelDelete2 = () => {
44
+    deleteExtend(item.extId)
45
+    setReset(true)
46
+  }
47
+  const handelEdit = () => { 
48
+    var content = document.getElementById('content').value
49
+    setContent(content)
50
+    const date={
51
+      content,
52
+      contentType:'text'
53
+    }
54
+    update(item.extId,{...item,...date})
55
+    onClose()
29 56
   }
30 57
   return (
31
-    <View>
58
+    <View id='det'>
59
+      <Popup show={showCutover} onClose={onClose}>
60
+        <View className='editword'>
61
+          <View style={{ marginBottom: '25px' }}>
62
+            <View className='rzline' /><Label className='srl mg'>修改文字</Label><View className='rzline' />
63
+          </View>
64
+          <View>
65
+            <Textarea  className='storezn' value={content} id='content' />
66
+          </View>
67
+          <View>
68
+            <Button className='cancel' onClick={onClose}>取消</Button>
69
+            <Button className='btn' onClick={handelEdit}>确认修改</Button>
70
+          </View>
71
+        </View>
72
+      </Popup>
32 73
       {
33 74
         item.contentType == 'image' ?
34
-          <mp-slideview  buttons={detele} icon onbuttontap={handelDelete}>
35
-            <Image src={eimg} mode='widthFix' style={{ width: '100%',display:'block' }} onClick={handerChange}/>
36
-          </mp-slideview> 
75
+          <View>
76
+            <mp-slideview buttons={detele} icon onbuttontap={handelDelete}>
77
+              <Image src={eimg} mode='widthFix' style={{ width: '100%', display: 'block' }} onClick={handerChange} />
78
+            </mp-slideview>
79
+          </View>
37 80
           :
38 81
           item.contentType == 'text' ?
39
-            <View className='storezn'>{item.content}</View> : null
82
+            <View>
83
+              <mp-slideview buttons={detele} icon onbuttontap={handelDelete2}>
84
+                <View className='storezn' onClick={showText}>{content}</View>
85
+              </mp-slideview>
86
+            </View>
87
+            : null
40 88
       }
41 89
     </View>
42 90
   )

+ 69
- 8
src/hotel/pages/components/Extend/style.less Näytä tiedosto

@@ -1,9 +1,70 @@
1
-.storezn{
2
-  font-size: 28px;    
3
-  color: #202020;
4
-  line-height: 54px;
5
-  margin-bottom: 40px;
6
-  text-align: justify;
7
-}
8
-.det{
1
+#det{
2
+  .editword{
3
+    padding: 30px;
4
+    .srl{
5
+      font-size: 30px;
6
+      font-weight: bold;
7
+      color: #202020;
8
+    }  
9
+    .mg{
10
+      font-size: 38px;
11
+      margin: 0 20px 50px 20px;
12
+    }
13
+    .rzline{
14
+      border-top: 2px #999 dashed;
15
+      height: 2px;
16
+      width: 80px;
17
+      display: inline-block;
18
+      margin-bottom: 8px;
19
+    } 
20
+    .cancel{
21
+      color: #274290;
22
+      display: inline-block;
23
+      margin: 20px 20px 0 0;
24
+      width: 200px;
25
+      height: 78px;
26
+      line-height: 78px;
27
+      border: 2px solid #274190;
28
+      border-radius: 12px;
29
+    }
30
+    .btn {
31
+      width: 200px;
32
+      height: 78px;
33
+      line-height: 78px;
34
+      background: #274290;
35
+      border-radius: 12px;
36
+      display: inline-block;
37
+      color: #fff;
38
+    }  
39
+  }
40
+  .storezn{
41
+    font-size: 28px;    
42
+    color: #202020;
43
+    line-height: 54px;
44
+    margin-bottom: 40px;
45
+    text-align: justify;
46
+  }
47
+  .weui-slideview__btn__wrp{
48
+    background: #FFFFFF;
49
+    box-shadow: 0px 8px 38px 0px rgba(0, 0, 0, 0.12);
50
+    border-radius: 12px;
51
+    margin: 5px 5px 5px 20px;
52
+    height: 97%;
53
+    width: 67px;
54
+  }
55
+  .weui-slideview__btn{
56
+    width: 44px;
57
+    height: 44px;
58
+    line-height: 44px;
59
+  }
60
+  Textarea{
61
+    height: 200px;
62
+    width: 100%;
63
+    padding: 15px;
64
+    box-sizing: border-box;
65
+    height: 254px;
66
+    border: 1px solid #b5b5b5;
67
+    font-size: 24px;
68
+    box-shadow: 0px 4px 24px 0px rgba(0, 0, 0, 0.08);
69
+  }
9 70
 }

+ 1
- 0
src/hotel/pages/landlord/addRoom2/addRoom.config.js Näytä tiedosto

@@ -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
 }

+ 65
- 16
src/hotel/pages/landlord/addRoom2/addRoom.jsx Näytä tiedosto

@@ -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, Text, Image, Input, Button, Label } from '@tarojs/components';
4
+import { View, Input, Button, Label, Textarea } from '@tarojs/components';
5 5
 import { useEffect, useState } from "react"
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
 
@@ -58,20 +60,52 @@ export default withLayout((props) => {
58 60
     }
59 61
   }
60 62
   const [extend, setExtend] = useState([]);
61
-
62 63
   useEffect(() => {
63 64
     if (roomId) {
64 65
       getRoomDetail(roomId).then((res) => {
65 66
         setRoomModel(res)
66 67
       })
67
-      getExtendContent('room', roomId).then((res) => {
68
+    }
69
+  }, [roomId])//这个地方写这个单词的目的是   因为编辑时roomId有可能还没加载成功
70
+  const [reset, setReset] = useState(false)
71
+  useEffect(() => {
72
+    if (roomId) {
73
+      getExtendContent('room', roomId, { pageSize: 999 }).then((res) => {
68 74
         setExtend(res.records || []);
69 75
       })
76
+      setReset(false)
70 77
     }
71
-  }, [roomId])//这个地方写这个单词的目的是   因为编辑时roomId有可能还没加载成功
72
-
73
-
78
+  }, [reset])
74 79
 
80
+  //新增文字
81
+  const [showCutover, setShowCutover] = useState(false)
82
+  const [cont,setcont]=useState()
83
+  const onClose = () => {
84
+    setShowCutover(false)
85
+    setReset(true)
86
+    setcont()
87
+  }
88
+  const handelAdd = () => {
89
+    var content = document.getElementById('content').value
90
+    if (content === '') {
91
+      Taro.showToast({
92
+        title: '您还没有添加文字哦',
93
+        icon: 'none'
94
+      })
95
+      return;
96
+    }
97
+    const date = {
98
+      targetId: roomId,
99
+      targetType: 'room',
100
+      content,
101
+      contentType: 'text'
102
+    }
103
+    saveExtend(date)
104
+    onClose()
105
+  }
106
+  const showText = () => {
107
+    setShowCutover(true)
108
+  }
75 109
   return (
76 110
     <view className='page-index'>
77 111
       <view className="index-navbar">
@@ -79,16 +113,32 @@ export default withLayout((props) => {
79 113
       </view>
80 114
       <view className='roomDetail' style={{ height: '100%', overflow: "hidden", }} >
81 115
         <scroll-view scrollY style={{ height: '100%' }}>
116
+          <View id='det'>
117
+            <Popup show={showCutover} onClose={onClose}>
118
+              <View className='editword'>
119
+                <View style={{ marginBottom: '25px' }}>
120
+                  <View className='rzline' /><Label className='srl mg'>新增文字</Label><View className='rzline' />
121
+                </View>
122
+                <View>
123
+                  <Textarea className='storezn' id='content' value={cont} placeholder='请输入准备新增的文字' />
124
+                </View>
125
+                <View>
126
+                  <Button className='cancel' onClick={onClose}>取消</Button>
127
+                  <Button className='btn' onClick={handelAdd}>确认修改</Button>
128
+                </View>
129
+              </View>
130
+            </Popup>
131
+          </View>
82 132
           <mp-form models={roomModel} >
83 133
             <mp-cells title='房屋名称' footer='' ext-class='cells' >
84 134
               <mp-cell>
85
-                <Input style={{fontWeight:'bold'}} onInput={(e) => setRoomModel({ ...roomModel, roomName: e.detail.value })} value={roomModel.roomName} placeholder='请输入房屋名称(必填)' />
135
+                <Input style={{ fontWeight: 'bold' }} onInput={(e) => setRoomModel({ ...roomModel, roomName: e.detail.value })} value={roomModel.roomName} placeholder='请输入房屋名称(必填)' />
86 136
               </mp-cell>
87 137
             </mp-cells>
88 138
             <mp-cells title='房屋位置'>
89 139
               <mp-cell>
90
-                <Input style={{color:'#000',fontWeight:'bold',marginBottom:'13px'}} onInput={(e) => setRoomModel({ ...roomModel, address: e.detail.value })} value={roomModel.address} placeholder='请输入房屋位置(必填)' />
91
-                <Label style={{ color: '#666'}} onClick={onRoomMap}>{roomModel.location == '' ? '房间定位(必填)' : roomModel.location}</Label>
140
+                <Input style={{ color: '#000', fontWeight: 'bold', marginBottom: '13px' }} onInput={(e) => setRoomModel({ ...roomModel, address: e.detail.value })} value={roomModel.address} placeholder='请输入房屋位置(必填)' />
141
+                <Label style={{ color: '#666' }} onClick={onRoomMap}>{roomModel.location == '' ? '房间定位(必填)' : roomModel.location}</Label>
92 142
               </mp-cell>
93 143
             </mp-cells>
94 144
             <mp-cells title='停车场位置'>
@@ -99,29 +149,28 @@ export default withLayout((props) => {
99 149
             </mp-cells>
100 150
             <mp-cells title='WiFi信息'>
101 151
               <mp-cell>
102
-                <View style={{color:'#666'}}>
103
-                <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名称' />             
104
-                <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密码' />
105
-              </View>
152
+                <View style={{ color: '#666' }}>
153
+                  <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名称' />
154
+                  <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密码' />
155
+                </View>
106 156
               </mp-cell>
107 157
             </mp-cells>
108 158
             <mp-cells title='权重'>
109 159
               <mp-cell>
110 160
                 <input type='number' value={roomModel.weight} onInput={(e) => setRoomModel({ ...roomModel, weight: e.detail.value })} placeholder='请输入权重(必填)' />
111 161
               </mp-cell>
112
-
113 162
             </mp-cells>
114 163
             <mp-cells title='其他指引'>
115 164
               {
116 165
                 extend == '' ? null :
117 166
                   <mp-cell >
118 167
                     {extend.map((item) => (
119
-                      <Extend key={item.extId} item={item} />
168
+                      <Extend key={item.extId} item={item} setReset={setReset} />
120 169
                     ))}
121 170
                   </mp-cell>
122 171
               }
123 172
               <mp-cell extClass='adds'>
124
-                <Button className='add'>增加文字</Button><Button className='add'>增加图片</Button>
173
+                <Button className='add' onClick={showText}>增加文字</Button><Button className='add'>增加图片</Button>
125 174
                 <Button className='button-OK' onClick={sumbit}>确定</Button>
126 175
               </mp-cell>
127 176
             </mp-cells>

+ 2
- 1
src/hotel/pages/landlord/addRoom2/addRoom.less Näytä tiedosto

@@ -8,7 +8,8 @@
8 8
     border-radius: 50px;
9 9
     font-size: 30px;
10 10
     margin-top: 40px;
11
-  }  
11
+  }
12
+    
12 13
   .adds{
13 14
     text-align: center;
14 15
     .add{

+ 8
- 12
src/hotel/pages/landlord/landlord.jsx Näytä tiedosto

@@ -26,6 +26,8 @@ export default withLayout((props) => {
26 26
   const houseRef = useRef()
27 27
 
28 28
   useEffect(() => {
29
+    // 禁止右上角分享
30
+    Taro.hideShareMenu()
29 31
     getHotelManage().then((res) => {
30 32
       const { hotelList: list, account: acc, hotel: current } = res
31 33
       setHotelList(list)
@@ -47,7 +49,6 @@ export default withLayout((props) => {
47 49
   const handleTabChange = (e) => {
48 50
     const { index } = e.detail
49 51
     setCurrentTab(index)
50
-
51 52
     withSubscribeMessage('hotel_check_in')
52 53
   }
53 54
 
@@ -61,27 +62,22 @@ export default withLayout((props) => {
61 62
     return houseRef.current.getShareMessage()
62 63
   })
63 64
 
64
-  useEffect(() => {
65
-    // 禁止右上角分享
66
-    Taro.hideShareMenu()
67
-  }, [])
68
-
69 65
   return (
70 66
     <view className='page-index'>
71 67
       <view className="index-navbar">
72 68
         <CustomNav title={hotel?.hotelName} logo={hotel?.logo} />
73 69
       </view>
74 70
       <view className='index-container'>
75
-        {currentTab === 0 && <Income hotelList={hotelList} hotel={hotel} account={account} onHotelChange={handleHotelChange} />}
76
-        {hotel?.hotelId ? currentTab === 1 && <HouseManage hotel={hotel} ref={houseRef} disabled={!hotel.hotelId} /> : <NoData />}
71
+        {currentTab === 1 && <Income hotelList={hotelList} hotel={hotel} account={account} onHotelChange={handleHotelChange} />}
72
+        {hotel?.hotelId ? currentTab === 0 && <HouseManage hotel={hotel} ref={houseRef} disabled={!hotel.hotelId} /> : <NoData />}
77 73
       </view>
78 74
       <view className='index-tabbar'>
79 75
         <TabBar extClass='custom-tabbar bottomTab' current={currentTab} onChange={handleTabChange}>
80
-          <view className={`${currentTab === 0 ? 'incomeTab' : ''}`}>
81
-            <image className='incomes' src={currentTab === 0 ? onincomeImg : incomeImg} /><text>我的收入</text>
76
+          <view className={`${currentTab === 0 ? 'houseTab' : ''}`}>
77
+            <image className='house' src={currentTab === 0 ? onhouseImg : houseImg} /><text>房源管理</text>
82 78
           </view>
83
-          <view className={`${currentTab === 1 ? 'houseTab' : ''}`}>
84
-            <image className='house' src={currentTab === 1 ? onhouseImg : houseImg} /><text>房源管理</text>
79
+          <view className={`${currentTab === 1 ? 'incomeTab' : ''}`}>
80
+            <image className='incomes' src={currentTab === 1 ? onincomeImg : incomeImg} /><text>我的收入</text>
85 81
           </view>
86 82
         </TabBar>
87 83
       </view>

+ 1
- 1
src/pages/details/components/Extend/extend.jsx Näytä tiedosto

@@ -4,7 +4,7 @@ import './extend.less'
4 4
 export default (props) => {
5 5
   const { item } = props
6 6
   return (
7
-    <view>
7
+    <view className='cardext'>
8 8
     {
9 9
       item.contentType == 'image' ?
10 10
         <image src={item.content} mode='widthFix' style={{ width: '100%'}} /> :

+ 8
- 6
src/pages/details/components/Extend/extend.less Näytä tiedosto

@@ -1,7 +1,9 @@
1
-.storezn{
2
-  font-size: 28px;    
3
-  color: #202020;
4
-  line-height: 54px;
5
-  margin-bottom: 40px;
6
-  text-align: justify;
1
+.cardext{
2
+  .storezn{
3
+    font-size: 28px;    
4
+    color: #202020;
5
+    line-height: 54px;
6
+    margin-bottom: 40px;
7
+    text-align: justify;
8
+  }
7 9
 }

+ 15
- 1
src/services/landlord.js Näytä tiedosto

@@ -95,4 +95,18 @@ export const getRoomOrderList = (params) => request('/roomOrder', { params })
95 95
  * @param {*} data 
96 96
  * @returns 
97 97
  */
98
- export const update = (id, data) => request(`/taExtendContent/${id}`, { method: 'put', data })
98
+ export const update = (id, data) => request(`/taExtendContent/${id}`, { method: 'put', data })
99
+
100
+ /**
101
+* 删除更多指引
102
+* @param {*} data 
103
+* @returns 
104
+*/
105
+export const deleteExtend = (id) => request(`/taExtendContent/${id}`, { method: 'delete' })
106
+
107
+/**
108
+ * 新增更多指引
109
+ * @param {*} data 
110
+ * @returns 
111
+ */
112
+ export const saveExtend = (data) => request('/taExtendContent', { method: 'post', data })