Parcourir la source

民宿房东端首页

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

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

1
 import Taro from '@tarojs/taro'
1
 import Taro from '@tarojs/taro'
2
-import CustomNav from '@/components/CustomNav'
3
-import pImg from '../../../assets/icons/landlord/定位 位置.png'
4
-import see from '../../../assets/icons/landlord/查看入住人.png'
5
-import share from '../../../assets/icons/landlord/分享链接.png'
6
-import del from '../../../assets/icons/landlord/删除.png'
7
-import addImg from '../../../assets/icons/landlord/添加.png'
8
-import iconsearch from '../../../assets/icons/housemantj/search.png'
2
+import see from '@/assets/icons/landlord/查看入住人.png'
3
+import share from '@/assets/icons/landlord/分享链接.png'
4
+import del from '@/assets/icons/landlord/删除.png'
5
+import addImg from '@/assets/icons/landlord/添加.png'
6
+import iconsearch from '@/assets/icons/housemantj/search.png'
9
 import './houseManage.less'
7
 import './houseManage.less'
8
+import { useState, useEffect,useRef } from 'react'
9
+import {getRoomList} from '@/services/landlord'
10
 
10
 
11
 
11
 
12
 export default (props) => {
12
 export default (props) => {
13
+  const [detail, setDetail] = useState({})
14
+  // useEffect(()=>{
15
+  //   getRoomList(id).then((res)=>{
16
+  //     setDetail(res.records||[])
17
+  //     console.log(res.records)
18
+  //   })
19
+  // })
13
   return (
20
   return (
14
     <view>
21
     <view>
15
-      <view>
16
-        <CustomNav logo={null} title='十公里周边指南' />
17
-      </view>
18
       <view style={{ padding: '0 30rpx', height: '100%' }}>
22
       <view style={{ padding: '0 30rpx', height: '100%' }}>
19
         <scroll-view scroll-y="true" scroll-view='true' bindscrolltoupper="upper" bindscrolltolower="lower" bindscroll="scroll" style={{ height: 'calc(100vh - 204px)' }}>
23
         <scroll-view scroll-y="true" scroll-view='true' bindscrolltoupper="upper" bindscrolltolower="lower" bindscroll="scroll" style={{ height: 'calc(100vh - 204px)' }}>
20
-          <view className='position'>
21
-            <image className='pImg' src={pImg} />
22
-            当前店铺:<text>南京紫荆国际公寓酒店</text>
23
-          </view>
24
           <view className='search'>
24
           <view className='search'>
25
             <input className='searchInput' disabled />
25
             <input className='searchInput' disabled />
26
             <image className='searchicon' src={iconsearch} />
26
             <image className='searchicon' src={iconsearch} />

+ 1
- 13
src/components/Landlord/HouseManage/houseManage.less Voir le fichier

1
-.position{
2
-  height: 27px;
3
-  font-size: 28px;
4
-  color: #202020;
5
-  padding-left: 25px;
6
-  .pImg{
7
-    width: 35px;
8
-    height: 42px;
9
-    position: relative;
10
-    top: 10px;
11
-    right: 21px;
12
-  }
13
-}
1
+
14
 .search{
2
 .search{
15
   padding: 40px 0  30px 0;
3
   padding: 40px 0  30px 0;
16
   position: relative;
4
   position: relative;

+ 50
- 87
src/components/Landlord/Income/income.jsx Voir le fichier

1
-import { useState} from 'react'
2
-import Taro from '@tarojs/taro'
3
-import Popup from '@/components/Popup'
4
-import CustomNav from '@/components/CustomNav'
1
+import { useState } from 'react'
5
 import './income.less'
2
 import './income.less'
6
 import eyes from '../../../assets/icons/shopKeeper/小眼睛.png'
3
 import eyes from '../../../assets/icons/shopKeeper/小眼睛.png'
7
 import ceyes from '../../../assets/icons/shopKeeper/小眼睛-闭上.png'
4
 import ceyes from '../../../assets/icons/shopKeeper/小眼睛-闭上.png'
8
 import sImg from '../../../assets/icons/landlord/我的收入2.png'
5
 import sImg from '../../../assets/icons/landlord/我的收入2.png'
9
 import cutoverUser from '@/assets/icons/UserCenter/cutoverUser.png'
6
 import cutoverUser from '@/assets/icons/UserCenter/cutoverUser.png'
10
-import touristON from '@/assets/icons/UserCenter/touristON.png'
11
-import touristOFF from '@/assets/icons/UserCenter/touristOFF.png'
12
-import hotelBossON from '@/assets/icons/UserCenter/hotelBossON.png'
13
-import hotelBossOFF from '@/assets/icons/UserCenter/hotelBossOFF.png'
14
-import shopBossON from '@/assets/icons/UserCenter/shopBossON.png'
15
-import shopBossOFF from '@/assets/icons/UserCenter/shopBossOFF.png'
16
-import  ToggleRoul  from  '@/components/toggleRoul/ToggleRoul'
17
-
7
+import ToggleRoul from '@/components/toggleRoul/ToggleRoul'
8
+import Picker from '@/components/Picker'
18
 
9
 
19
 export default (props) => {
10
 export default (props) => {
11
+  const { hotelList, hotel, account, onHotelChange, accountlog } = props
12
+
13
+  const handleHotelChange = (hotelId, current) => {
14
+    onHotelChange(current)
15
+  }
16
+
17
+  const [isyear, setYear] = useState(true)
18
+  const [isMomth, setMonth] = useState(false)
19
+  const handleYear = () => {
20
+    isyear ? setYear(false) : setYear(true)
21
+  }
22
+  const handleMonth = () => {
23
+    isMomth ? setMonth(false) : setMonth(true)
24
+  }
20
   const [showCutover, setShowCutover] = useState(false)
25
   const [showCutover, setShowCutover] = useState(false)
21
   const ShowMoldeOn = () => {
26
   const ShowMoldeOn = () => {
22
     setShowCutover(true)
27
     setShowCutover(true)
26
   }
31
   }
27
   return (
32
   return (
28
     <view>
33
     <view>
29
-      <view>
30
-        <CustomNav title='十公里' />
31
-      </view>
32
       <ToggleRoul showCutover={showCutover} onClose={onClose} />
34
       <ToggleRoul showCutover={showCutover} onClose={onClose} />
33
       <view style={{ padding: '30rpx', height: '100%' }}>
35
       <view style={{ padding: '30rpx', height: '100%' }}>
34
         <scroll-view scroll-y="true" scroll-view='true' bindscrolltoupper="upper" bindscrolltolower="lower" bindscroll="scroll" style={{ height: 'calc(100vh - 120px)' }}>
36
         <scroll-view scroll-y="true" scroll-view='true' bindscrolltoupper="upper" bindscrolltolower="lower" bindscroll="scroll" style={{ height: 'calc(100vh - 120px)' }}>
35
           <view className='storexx'>
37
           <view className='storexx'>
36
-              <view className='storeName'>店名:<text>Yun咖 云里 咖啡店</text></view>
37
-              <view onClick={ShowMoldeOn}  className='User-info-cutover'>
38
-                <image className='User-info-cutover-image' src={cutoverUser} />
39
-              </view>
40
-              <view className='money'>
41
-                <view className='sleft'>
42
-                  <view className='lword'>全年收入(税前)</view>
43
-                  <view className='yearMoney'>
44
-                    <text>2800000</text>元
45
-                    <image className='micon' src={eyes}></image>
46
-                  </view>
47
-                </view>
48
-                <view className='line' />
49
-                <view className='sright'>
50
-                  <view className='rword'>当月收入(税前)</view>
51
-                  <view className='monthMoney'>
52
-                    <text>******</text>元
53
-                    <image className='micon2' src={ceyes}></image>
54
-                  </view></view>
55
-              </view>
56
-            </view>
57
-          <view className='title'>推广收入记录</view>
58
-          <view>
59
-            <view className='spreadCard'>
60
-              <view className='spreadDate'>日期:<text>2021-06-24</text></view>
61
-              <view className='card'>
62
-                <view className='spreadTime'>时&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;间:<text>2021-06-24  20:45</text></view>
63
-                <view className='spreadMoney'>收入金额:<text>5.00</text>元</view> 
64
-                <image className='spreadImg' src={sImg} />
65
-              </view>
38
+            <view className='storeName'>店名:<Picker style={{ display: 'inline-block' }} placeholder="请选择民宿" value={hotel?.hotelId} kv={['hotelName', 'hotelId']} dicts={hotelList} onChange={handleHotelChange} /></view>
39
+            <view onClick={ShowMoldeOn} className='User-info-cutover'>
40
+              <image className='User-info-cutover-image' src={cutoverUser} />
66
             </view>
41
             </view>
67
-            <view className='spreadCard'>
68
-              <view className='spreadDate'>日期:<text>2021-06-24</text></view>
69
-              <view className='card'>
70
-                <view className='spreadTime'>时&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;间:<text>2021-06-24  20:45</text></view>
71
-                <view className='spreadMoney'>收入金额:<text>5.00</text>元</view> 
72
-                <image className='spreadImg' src={sImg} />
73
-              </view>
74
-            </view>
75
-            <view className='spreadCard'>
76
-              <view className='spreadDate'>日期:<text>2021-06-24</text></view>
77
-              <view className='card'>
78
-                <view className='spreadTime'>时&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;间:<text>2021-06-24  20:45</text></view>
79
-                <view className='spreadMoney'>收入金额:<text>5.00</text>元</view> 
80
-                <image className='spreadImg' src={sImg} />
81
-              </view>
82
-            </view>
83
-            <view className='spreadCard'>
84
-              <view className='spreadDate'>日期:<text>2021-06-24</text></view>
85
-              <view className='card'>
86
-                <view className='spreadTime'>时&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;间:<text>2021-06-24  20:45</text></view>
87
-                <view className='spreadMoney'>收入金额:<text>5.00</text>元</view> 
88
-                <image className='spreadImg' src={sImg} />
89
-              </view>
90
-            </view>
91
-            <view className='spreadCard'>
92
-              <view className='spreadDate'>日期:<text>2021-06-24</text></view>
93
-              <view className='card'>
94
-                <view className='spreadTime'>时&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;间:<text>2021-06-24  20:45</text></view>
95
-                <view className='spreadMoney'>收入金额:<text>5.00</text>元</view> 
96
-                <image className='spreadImg' src={sImg} />
97
-              </view>
98
-            </view>
99
-            <view className='spreadCard'>
100
-              <view className='spreadDate'>日期:<text>2021-06-24</text></view>
101
-              <view className='card'>
102
-                <view className='spreadTime'>时&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;间:<text>2021-06-24  20:45</text></view>
103
-                <view className='spreadMoney'>收入金额:<text>5.00</text>元</view> 
104
-                <image className='spreadImg' src={sImg} />
42
+            <view className='money'>
43
+              <view className='sleft'>
44
+                <view className='lword'>全年收入(税前)</view>
45
+                <view className='yearMoney'>
46
+                  <text>{isyear ? account?.amounts : '******'}</text>元
47
+                  <image className='micon' src={isyear ? eyes : ceyes} onClick={handleYear} />
48
+                </view>
105
               </view>
49
               </view>
50
+              <view className='line' />
51
+              <view className='sright'>
52
+                <view className='rword'>当月收入(税前)</view>
53
+                <view className='monthMoney'>
54
+                  <text>{isMomth ? account?.currentCharges : '******'}</text>元
55
+                  <image className='micon2' src={isMomth ? eyes : ceyes} onClick={handleMonth}></image>
56
+                </view></view>
106
             </view>
57
             </view>
107
           </view>
58
           </view>
108
-          <view className='botton'>已经到底了~</view>
109
-        </scroll-view>        
110
-      </view>
111
-      
59
+          
60
+          <view className='title' >{accountlog.length!=''?'推广收入记录':'暂无推广收入'}</view>
61
+            {
62
+              accountlog?.map((item) => 
63
+                <view className='spreadCard'>
64
+                  <view className='card'>
65
+                    <view className='spreadTime'>时&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;间:<text>{item.createDate}</text></view>
66
+                    <view className='spreadMoney'>收入金额:<text>{parseFloat((item.amount/100).toFixed(2))}</text>元</view>
67
+                    <image className='spreadImg' src={sImg} />
68
+                  </view>
69
+                </view>
70
+              )
71
+            }
72
+            {accountlog.length!=''?<view className='botton'>已经到底了~</view>:''}          
73
+        </scroll-view>
112
       </view>
74
       </view>
75
+    </view>
113
   )
76
   )
114
 }
77
 }

+ 15
- 22
src/components/Landlord/Income/income.less Voir le fichier

56
 }
56
 }
57
 .storexx{
57
 .storexx{
58
   text-align: center;
58
   text-align: center;
59
-  height: 302px;
59
+  display: flow-root;
60
   background: #FFFFFF;
60
   background: #FFFFFF;
61
   box-shadow: 0px 8px 32px 0px rgba(0, 0, 0, 0.08);
61
   box-shadow: 0px 8px 32px 0px rgba(0, 0, 0, 0.08);
62
   border-radius: 24px;
62
   border-radius: 24px;
80
   }
80
   }
81
   .sleft{
81
   .sleft{
82
     float: left;
82
     float: left;
83
+    text-align: left;
83
     .lword{
84
     .lword{
84
-      height: 25px;
85
       font-size: 26px;
85
       font-size: 26px;
86
       color: #666666;
86
       color: #666666;
87
-      margin-bottom: 40px;      
88
-      margin-left: 1px;
87
+      margin-bottom: 40px;
89
     }
88
     }
90
     .yearMoney{
89
     .yearMoney{
91
-      height: 30px;
92
       font-size: 28px;
90
       font-size: 28px;
93
       font-weight: bold;
91
       font-weight: bold;
94
       color: #202020;
92
       color: #202020;
93
+      line-height: 0;
94
+      display: inline-block;
95
       text{
95
       text{
96
         font-size: 40px;
96
         font-size: 40px;
97
         color: #FF3434
97
         color: #FF3434
98
       }
98
       }
99
       .micon{
99
       .micon{
100
         width: 38px;
100
         width: 38px;
101
-        height: 22px;
102
-        margin-left: 19px;
101
+        height: 26px;
102
+        margin-left: 20px;
103
       }
103
       }
104
     }
104
     }
105
   }
105
   }
114
   }
114
   }
115
   .sright{
115
   .sright{
116
     float: right;
116
     float: right;
117
-    text-align: left;
117
+    text-align: right;
118
     .rword{
118
     .rword{
119
       font-size: 26px;
119
       font-size: 26px;
120
       color: #666666;
120
       color: #666666;
121
-      margin: 0 25px 47px 0;
122
-      text-align: center;
121
+      margin-bottom: 40px;
123
     }
122
     }
124
     .monthMoney{
123
     .monthMoney{
125
-      height: 24px;
126
       font-size: 28px;
124
       font-size: 28px;
127
       font-weight: bold;
125
       font-weight: bold;
128
       color: #202020;
126
       color: #202020;
129
-      line-height: 24px;
127
+      line-height: 0;
128
+      display: inline-block;
130
       text{
129
       text{
131
         font-size: 40px;
130
         font-size: 40px;
132
         color: #FF3434;
131
         color: #FF3434;
133
       }
132
       }
134
       .micon2{
133
       .micon2{
135
-        width: 34px;
136
-        height: 16px;
137
-        margin-left: 23px;
138
-        margin-bottom: 7px;
134
+        height: 26px;
135
+        width: 38px;
136
+        margin-left: 20px;
139
       }
137
       }
140
     }
138
     }
141
   }
139
   }
147
   margin: 62px 0 10px 1px;
145
   margin: 62px 0 10px 1px;
148
 }
146
 }
149
 .spreadCard{
147
 .spreadCard{
150
-  margin-bottom: 1px;
151
-  .spreadDate{
152
-    font-size: 20px;
153
-    color: #202020;
154
-    line-height: 60px;
155
-  }
148
+  margin-bottom: 60px;  
156
   .card{
149
   .card{
157
     height: 166px;
150
     height: 166px;
158
     background: #FFF;
151
     background: #FFF;

+ 34
- 3
src/hotel/pages/landlord/landlord.jsx Voir le fichier

7
 import onincomeImg from '@/assets/icons/landlord/我的收入按下.png'
7
 import onincomeImg from '@/assets/icons/landlord/我的收入按下.png'
8
 import houseImg from '@/assets/icons/landlord/房源管理.png'
8
 import houseImg from '@/assets/icons/landlord/房源管理.png'
9
 import onhouseImg from '@/assets/icons/landlord/房源管理按下.png'
9
 import onhouseImg from '@/assets/icons/landlord/房源管理按下.png'
10
-import './landlord.less'
11
 import withLayout from '@/layouts'
10
 import withLayout from '@/layouts'
11
+import { getHotelManage, getAccountLogList, getNowHotelManage } from '@/services/landlord'
12
+import CustomNav from '@/components/CustomNav'
12
 
13
 
14
+import './landlord.less'
13
 
15
 
14
 export default withLayout((props) => {
16
 export default withLayout((props) => {
15
   const { router, person } = props
17
   const { router, person } = props
16
   const { params } = useRouter()
18
   const { params } = useRouter()
17
   const { tab } = params || {}
19
   const { tab } = params || {}
18
 
20
 
21
+  const [hotelList, setHotelList] = useState([])
22
+  const [hotel, setHotel] = useState()
23
+  const [account, setAccount] = useState()
24
+  const [accountlog, setAccountLog] = useState([])
25
+
26
+  useEffect(() => {
27
+    getHotelManage().then((res) => {
28
+      const { hotelList: list, account: acc, hotel: current } = res
29
+      setHotelList(list)
30
+      setHotel(current)
31
+      setAccount(acc)
32
+      getAccountLogList(acc.accountId).then((res2) => {
33
+        setAccountLog(res2.records || [])
34
+      })
35
+    })
36
+  }, [])
37
+
38
+  const handleHotelChange = (current) => {
39
+    setHotel(current)
40
+    getNowHotelManage(current.hotelId).then((res) => {
41
+      const {account: acc } = res
42
+      setAccount(acc)
43
+      getAccountLogList(acc.accountId).then((res2) => {
44
+        setAccountLog(res2.records || [])
45
+      })
46
+    })
47
+  }
48
+
19
   const [currentTab, setCurrentTab] = useState(0)
49
   const [currentTab, setCurrentTab] = useState(0)
20
 
50
 
21
   const handleTabChange = (e) => {
51
   const handleTabChange = (e) => {
31
 
61
 
32
   return (
62
   return (
33
     <view className='page-index'>
63
     <view className='page-index'>
64
+      <CustomNav title={hotel?.hotelName} logo={hotel?.logo} />
34
       <view className='index-container'>
65
       <view className='index-container'>
35
-        {currentTab === 0 && <Income />}
36
-        {currentTab === 1 && <HouseManage />}
66
+        {currentTab === 0 && <Income hotelList={hotelList} hotel={hotel} account={account} onHotelChange={handleHotelChange} accountlog={accountlog} />}
67
+        {currentTab === 1 && <HouseManage hotel={hotel} />}
37
       </view>
68
       </view>
38
       <view className='index-tabbar'>
69
       <view className='index-tabbar'>
39
         <TabBar extClass='custom-tabbar bottomTab' current={currentTab} onChange={handleTabChange}>
70
         <TabBar extClass='custom-tabbar bottomTab' current={currentTab} onChange={handleTabChange}>

+ 1
- 2
src/pages/details/foodDetails/foodDetails.jsx Voir le fichier

1
 import CustomNav from '@/components/CustomNav'
1
 import CustomNav from '@/components/CustomNav'
2
 import withLayout from '@/layouts'
2
 import withLayout from '@/layouts'
3
 import { getShopDetail, getShopPackage, getExtendContent } from '@/services/home'
3
 import { getShopDetail, getShopPackage, getExtendContent } from '@/services/home'
4
-import { useState, useEffect } from 'react'
4
+import { useState, useEffect,useRef } from 'react'
5
 import { Swiper, SwiperItem } from '@tarojs/components';
5
 import { Swiper, SwiperItem } from '@tarojs/components';
6
 import Star from '@/components/Star/Star.jsx'
6
 import Star from '@/components/Star/Star.jsx'
7
 import Cards from '@/components/foodCards/foodCards.jsx'
7
 import Cards from '@/components/foodCards/foodCards.jsx'
20
 import Extend from '../components/extend'
20
 import Extend from '../components/extend'
21
 import useSave from "@/utils/hooks/useSave"
21
 import useSave from "@/utils/hooks/useSave"
22
 import useLike from "@/utils/hooks/useLike"
22
 import useLike from "@/utils/hooks/useLike"
23
-import { useRef } from 'react';
24
 
23
 
25
 export default withLayout((props) => {
24
 export default withLayout((props) => {
26
   const { router, person } = props
25
   const { router, person } = props

+ 19
- 2
src/services/landlord.js Voir le fichier

11
 
11
 
12
  
12
  
13
 /**
13
 /**
14
- * 查询房源列表 
14
+ * 查询指定名宿的账户
15
  * @param {*} params 
15
  * @param {*} params 
16
  * @returns 
16
  * @returns 
17
  */
17
  */
18
- export const getRoomList = (params) => request('/taRoom', { params })
18
+ export const getNowHotelManage = (id,params) => request(`/hotel/manage/${id}`, { params })
19
+
20
+
21
+/**
22
+ * 查询民宿老板的所有名宿列表
23
+ * @param {*} params 
24
+ * @returns 
25
+ */
26
+ export const getHotelManage = (params) => request('/hotel/manage/index', { params })
27
+
28
+/**
29
+ * 查询指定名宿的账户流水
30
+ * @param {*} params 
31
+ * @returns 
32
+ */
33
+ export const getAccountLogList = (id) => request(`/hotel/account/${id}/log`)
34
+
35
+
19
 
36
 
20
  /**
37
  /**
21
  * 删除房源
38
  * 删除房源