瀏覽代碼

Merge branch 'dev' of http://git.ycjcjy.com/shigongli/miniapp-v2 into dev

zlisen 3 年之前
父節點
當前提交
476bd0d5f3

+ 6
- 3
src/components/List/index.jsx 查看文件

9
     params,
9
     params,
10
     pageSize = 10,
10
     pageSize = 10,
11
     onError,
11
     onError,
12
-    shopId,
13
     onDataChange,
12
     onDataChange,
13
+    noData,
14
     ...leftProps
14
     ...leftProps
15
   } = props
15
   } = props
16
 
16
 
73
   // 请求数据
73
   // 请求数据
74
   useEffect(() => {
74
   useEffect(() => {
75
     fetchRef.current(payload)
75
     fetchRef.current(payload)
76
-  }, [payload, shopId])
76
+  }, [payload, request])
77
 
77
 
78
   return (
78
   return (
79
     <ScrollView
79
     <ScrollView
85
         ? props.children
85
         ? props.children
86
         : list.map((item, index) => render({ item, index }))
86
         : list.map((item, index) => render({ item, index }))
87
       }
87
       }
88
-      <view className='botton' style={{ display: hasMore ? 'none' : '' }}>已经到底了~</view>
88
+      { !list || !list.length && noData }
89
+
90
+      { list && list.length > 0 && !hasMore && <view className='botton'>已经到底了~</view> }
91
+      
89
     </ScrollView>
92
     </ScrollView>
90
   )
93
   )
91
 }
94
 }

+ 26
- 15
src/hotel/components/HouseManage/houseManage.jsx 查看文件

3
 import share from '@/assets/icons/landlord/分享链接.png'
3
 import share from '@/assets/icons/landlord/分享链接.png'
4
 import del from '@/assets/icons/landlord/删除.png'
4
 import del from '@/assets/icons/landlord/删除.png'
5
 import addImg from '@/assets/icons/landlord/添加.png'
5
 import addImg from '@/assets/icons/landlord/添加.png'
6
-import React, { useState, useEffect, useRef, useImperativeHandle } from 'react'
6
+import React, { useState, useEffect, useRef, useImperativeHandle,useMemo } from 'react'
7
 import { getRoomList, deleteRoom } from '@/services/landlord'
7
 import { getRoomList, deleteRoom } from '@/services/landlord'
8
+import List from '@/components/List';
8
 import SearchBar from '@/components/SearchBar'
9
 import SearchBar from '@/components/SearchBar'
9
 import ShareRoom from '../shareRoom/ShareRoom.jsx'
10
 import ShareRoom from '../shareRoom/ShareRoom.jsx'
10
 import ShareCard from '../shareCard/shareCard'
11
 import ShareCard from '../shareCard/shareCard'
15
   const { hotel } = props
16
   const { hotel } = props
16
   const [detail, setDetail] = useState([])
17
   const [detail, setDetail] = useState([])
17
 
18
 
19
+  const fetchAPI = useMemo(() => hotel.hotelId?()=>getRoomList({hotelId: hotel.hotelId}):undefined, [hotel?.hotelId])
20
+  const queryParams = useMemo(() => ({}), [])
21
+
18
   const shareDataRef = useRef()
22
   const shareDataRef = useRef()
19
 
23
 
20
   // 判断是否首次加载
24
   // 判断是否首次加载
118
         <SearchBar placeholder='请输入房源名搜索' onBlur={onSearch} />
122
         <SearchBar placeholder='请输入房源名搜索' onBlur={onSearch} />
119
         <ShareRoom showCutover={showCutover} onClose={onClose} room={room} onFinish={handleFinish} />
123
         <ShareRoom showCutover={showCutover} onClose={onClose} room={room} onFinish={handleFinish} />
120
         <ShareCard showCutover={showCard} onClose={onClose2} />
124
         <ShareCard showCutover={showCard} onClose={onClose2} />
121
-        <scroll-view scroll-y="true" scroll-view='true' bindscrolltoupper="upper" bindscrolltolower="lower" bindscroll="scroll" style={{ height: 'calc(100vh - 244px)' }}>
122
-          {
123
-            (detail || []).map((item) =>
124
-              <view className='houseCard'>
125
-                <view className='houseName' onClick={() => { handelDetail(item) }} >{item.roomName || ''}</view>
126
-                <view className='operation'>
127
-                  <view onClick={() => handelOrder(item)}><image src={see} />查看入住人</view>
128
-                  <view onClick={() => ShowMoldeOn(item)}><image src={share} />分享链接</view>
129
-                  <view onClick={() => handelDelete(item)}><image src={del} />删除房源</view>
130
-                </view>
131
-              </view>
132
-            )
133
-          }
134
-        </scroll-view>
125
+        <List
126
+          style={{ height: 'calc(100vh - 244px)' }}
127
+          request={fetchAPI}
128
+          params={queryParams}
129
+          onDataChange={setDetail}
130
+          noData="暂无房源信息"
131
+        >
132
+          <view className='waterfall'>
133
+            {
134
+              detail.map((item, index) =>
135
+                <view className='houseCard' key={index}>
136
+                  <view className='houseName' onClick={() => { handelDetail(item) }} >{item.roomName || ''}</view>
137
+                  <view className='operation'>
138
+                    <view onClick={() => handelOrder(item)}><image src={see} />查看入住人</view>
139
+                    <view onClick={() => ShowMoldeOn(item)}><image src={share} />分享链接</view>
140
+                    <view onClick={() => handelDelete(item)}><image src={del} />删除房源</view>
141
+                  </view>
142
+                </view>)
143
+            }
144
+          </view>
145
+        </List>
135
       </view>
146
       </view>
136
       <view className='addHouse' onClick={handelClick}>
147
       <view className='addHouse' onClick={handelClick}>
137
         <image className='addImg' src={addImg} />添加房源
148
         <image className='addImg' src={addImg} />添加房源

+ 39
- 39
src/hotel/components/Income/income.jsx 查看文件

1
-import { useState } from 'react'
1
+import { useState, useMemo } from 'react'
2
 import eyes from '@/assets/icons/shopKeeper/小眼睛.png'
2
 import eyes from '@/assets/icons/shopKeeper/小眼睛.png'
3
 import ceyes from '@/assets/icons/shopKeeper/小眼睛-闭上.png'
3
 import ceyes from '@/assets/icons/shopKeeper/小眼睛-闭上.png'
4
 import sImg from '@/assets/icons/landlord/我的收入2.png'
4
 import sImg from '@/assets/icons/landlord/我的收入2.png'
6
 import ToggleRole from '@/components/toggleRole/ToggleRole'
6
 import ToggleRole from '@/components/toggleRole/ToggleRole'
7
 import Picker from '@/components/Picker'
7
 import Picker from '@/components/Picker'
8
 import formatTime from "@/utils/formatTime";
8
 import formatTime from "@/utils/formatTime";
9
-import {getAccountLogList} from '@/services/landlord'
9
+import { getAccountLogList } from '@/services/landlord'
10
 
10
 
11
 import List from '@/components/List';
11
 import List from '@/components/List';
12
 import './income.less'
12
 import './income.less'
13
 
13
 
14
 
14
 
15
+const getList = id => params => getAccountLogList(id, params)
15
 
16
 
16
 export default (props) => {
17
 export default (props) => {
17
-  const { hotelList, hotel, account, onHotelChange, accountlog } = props
18
+  const { hotelList, hotel, account, onHotelChange } = props
18
 
19
 
19
-  // const [accountLog,setAccountLog]=useState(accountlog)
20
+  const queryParams = useMemo(() => ({}), [])
20
 
21
 
21
-
22
-  // const [queryParams, setQueryParams] = useState({pageNum: 1, pageSize: 10})
23
-  // setQueryParams(hotel.hotelId)
22
+  const fetchAPI = useMemo(()=>account.accountId ? getList(account.accountId) : undefined, [account?.accountId])
24
 
23
 
25
   const handleHotelChange = (hotelId, current) => {
24
   const handleHotelChange = (hotelId, current) => {
26
     onHotelChange(current)
25
     onHotelChange(current)
27
   }
26
   }
27
+  const [accountlog, setAccountlog] = useState([])
28
 
28
 
29
   const [isyear, setYear] = useState(true)
29
   const [isyear, setYear] = useState(true)
30
   const [isMomth, setMonth] = useState(false)
30
   const [isMomth, setMonth] = useState(false)
68
           </view>
68
           </view>
69
         </view>
69
         </view>
70
 
70
 
71
-        <view className='title' >{accountlog.length != '' ? '推广收入记录' : '暂无推广收入'}</view>
72
-        
73
-        {/* <List
74
-                  style={{ height: '50vh' }}
75
-                  request={getAccountLogList}
76
-                  params={queryParams}
77
-                  onDataChange={setAccountLog}
78
-                >
79
-                  {
80
-                    (accountLog || []).map((item) =>
81
-                    <view className='spreadCard'>
82
-                      <view className='card'>
83
-                        <view className='spreadTime'>时&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;间:<text>{formatTime(item.createDate, 'yyyy/MM/dd hh:mm:ss')}</text></view>
84
-                        <view className='spreadMoney'>收入金额:<text>{parseFloat((item.amount / 100).toFixed(2))}</text>元</view>
85
-                        <image className='spreadImg' src={sImg} />
86
-                      </view>
87
-                    </view>
88
-                    )
89
-                  }
90
-          </List> */}
91
-        
92
-        
93
-        
94
-        <scroll-view scroll-y="true" scroll-view='true' bindscrolltoupper="upper" bindscrolltolower="lower" bindscroll="scroll" style={{ height: '50vh' }}>
71
+        <view className='title' >推广收入记录</view>
95
 
72
 
96
-          {
97
-            (accountlog || []).map((item) =>
98
-              <view className='spreadCard'>
73
+        <List
74
+          style={{ height: 'calc(100vh - 390px)' }}
75
+          request={fetchAPI}
76
+          params={queryParams}
77
+          noData={<view className='title' >暂无</view>}
78
+          render={({item, index}) => (
79
+            <view className='spreadCard' key={index}>
80
+              <view className='card'>
81
+                <view className='spreadTime'>时&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;间:<text>{formatTime(item.createDate, 'yyyy/MM/dd hh:mm:ss')}</text></view>
82
+                <view className='spreadMoney'>收入金额:<text>{parseFloat((item.amount / 100).toFixed(2))}</text>元</view>
83
+                <image className='spreadImg' src={sImg} />
84
+              </view>
85
+            </view>
86
+          )}
87
+        >
88
+        </List>
89
+        {/*<view className='title' >{accountlog.length==0?'推广收入记录':'暂无推广收入'}</view>
90
+         <List
91
+          style={{ height: '50vh' }}
92
+          request={fetchAPI}
93
+          params={queryParams}
94
+          onDataChange={setAccountlog}
95
+          noData="暂无推广收入"
96
+        >
97
+          <view className='waterfall'>
98
+            {
99
+              accountlog.map((item,index) => <view className='spreadCard' key={index}>
99
                 <view className='card'>
100
                 <view className='card'>
100
                   <view className='spreadTime'>时&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;间:<text>{formatTime(item.createDate, 'yyyy/MM/dd hh:mm:ss')}</text></view>
101
                   <view className='spreadTime'>时&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;间:<text>{formatTime(item.createDate, 'yyyy/MM/dd hh:mm:ss')}</text></view>
101
                   <view className='spreadMoney'>收入金额:<text>{parseFloat((item.amount / 100).toFixed(2))}</text>元</view>
102
                   <view className='spreadMoney'>收入金额:<text>{parseFloat((item.amount / 100).toFixed(2))}</text>元</view>
102
                   <image className='spreadImg' src={sImg} />
103
                   <image className='spreadImg' src={sImg} />
103
                 </view>
104
                 </view>
104
-              </view>
105
-            )
106
-          }
107
-        <view className='botton' >已经到底了~</view>
108
-        </scroll-view>
105
+              </view>)
106
+            }
107
+          </view>
108
+        </List> */}
109
       </view>
109
       </view>
110
     </view>
110
     </view>
111
   )
111
   )

+ 3
- 9
src/hotel/pages/landlord/landlord.jsx 查看文件

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 withLayout from '@/layouts'
10
 import withLayout from '@/layouts'
11
-import { getHotelManage, getAccountLogList, getNowHotelManage } from '@/services/landlord'
11
+import { getHotelManage,  getNowHotelManage } from '@/services/landlord'
12
 import CustomNav from '@/components/CustomNav'
12
 import CustomNav from '@/components/CustomNav'
13
 import './landlord.less'
13
 import './landlord.less'
14
 
14
 
20
   const [hotelList, setHotelList] = useState([])
20
   const [hotelList, setHotelList] = useState([])
21
   const [hotel, setHotel] = useState()
21
   const [hotel, setHotel] = useState()
22
   const [account, setAccount] = useState({})
22
   const [account, setAccount] = useState({})
23
-  const [accountlog, setAccountLog] = useState([])
24
 
23
 
25
   const houseRef = useRef()
24
   const houseRef = useRef()
26
 
25
 
26
+
27
   useEffect(() => {
27
   useEffect(() => {
28
     getHotelManage().then((res) => {
28
     getHotelManage().then((res) => {
29
       const { hotelList: list, account: acc, hotel: current } = res
29
       const { hotelList: list, account: acc, hotel: current } = res
30
       setHotelList(list)
30
       setHotelList(list)
31
       setHotel(current)
31
       setHotel(current)
32
       setAccount(acc)
32
       setAccount(acc)
33
-      getAccountLogList(acc.accountId).then((res2) => {
34
-        setAccountLog(res2.records || [])
35
-      })
36
     })
33
     })
37
   }, [])
34
   }, [])
38
 
35
 
41
       const { account: acc } = res
38
       const { account: acc } = res
42
       setAccount(acc)
39
       setAccount(acc)
43
       setHotel(current)
40
       setHotel(current)
44
-      getAccountLogList(acc.accountId).then((res2) => {
45
-        setAccountLog(res2.records || [])
46
-      })
47
     })
41
     })
48
   }
42
   }
49
 
43
 
73
     <view className='page-index'>
67
     <view className='page-index'>
74
       <CustomNav title={hotel?.hotelName} logo={hotel?.logo} />
68
       <CustomNav title={hotel?.hotelName} logo={hotel?.logo} />
75
       <view className='index-container'>
69
       <view className='index-container'>
76
-        {currentTab === 0 && <Income hotelList={hotelList} hotel={hotel} account={account} onHotelChange={handleHotelChange} accountlog={accountlog} />}
70
+        {currentTab === 0 && <Income hotelList={hotelList} hotel={hotel}  account={account} onHotelChange={handleHotelChange} />}
77
         {currentTab === 1 && <HouseManage hotel={hotel} ref={houseRef} />}
71
         {currentTab === 1 && <HouseManage hotel={hotel} ref={houseRef} />}
78
       </view>
72
       </view>
79
       <view className='index-tabbar'>
73
       <view className='index-tabbar'>

+ 0
- 1
src/pages/index/components/Card.js 查看文件

15
   const [isSaved, toggleSave] = useSave(item.isSaved, item.targetType, item.targetId)
15
   const [isSaved, toggleSave] = useSave(item.isSaved, item.targetType, item.targetId)
16
   const Detail = () => {
16
   const Detail = () => {
17
     if (item.targetType == 'tourist') {
17
     if (item.targetType == 'tourist') {
18
-      let loc = item.lng + ',' + item.lat
19
       Taro.navigateTo({ url: `/pages/details/mjDetails/sceneryDetails?id=${item.targetId}` });
18
       Taro.navigateTo({ url: `/pages/details/mjDetails/sceneryDetails?id=${item.targetId}` });
20
     }
19
     }
21
     else {
20
     else {

+ 1
- 1
src/services/landlord.js 查看文件

36
  * @param {*} params 
36
  * @param {*} params 
37
  * @returns 
37
  * @returns 
38
  */
38
  */
39
-export const getAccountLogList = (id) => request(`/hotel/account/${id}/log`)
39
+export const getAccountLogList = (id,params) => request(`/hotel/account/${id}/log`,{params})
40
 
40
 
41
 /**
41
 /**
42
  * 房源列表
42
  * 房源列表

+ 1
- 2
src/shop/components/ShopKeeper/shopKeeper.jsx 查看文件

1
-import { React, useState, useEffect, useRef } from 'react'
1
+import { React, useState, useEffect, useMemo } from 'react'
2
 import Taro, { useRouter } from '@tarojs/taro'
2
 import Taro, { useRouter } from '@tarojs/taro'
3
 import CustomNav from '@/components/CustomNav'
3
 import CustomNav from '@/components/CustomNav'
4
 import Picker from '@/components/Picker'
4
 import Picker from '@/components/Picker'
17
 
17
 
18
 import cutoverUser from '@/assets/icons/UserCenter/cutoverUser.png'
18
 import cutoverUser from '@/assets/icons/UserCenter/cutoverUser.png'
19
 import './shopKeeper.less'
19
 import './shopKeeper.less'
20
-import { useMemo } from 'react'
21
 
20
 
22
 
21
 
23
 export default (props) => {
22
 export default (props) => {