Procházet zdrojové kódy

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

zlisen před 3 roky
rodič
revize
476bd0d5f3

+ 6
- 3
src/components/List/index.jsx Zobrazit soubor

@@ -9,8 +9,8 @@ export default (props) => {
9 9
     params,
10 10
     pageSize = 10,
11 11
     onError,
12
-    shopId,
13 12
     onDataChange,
13
+    noData,
14 14
     ...leftProps
15 15
   } = props
16 16
 
@@ -73,7 +73,7 @@ export default (props) => {
73 73
   // 请求数据
74 74
   useEffect(() => {
75 75
     fetchRef.current(payload)
76
-  }, [payload, shopId])
76
+  }, [payload, request])
77 77
 
78 78
   return (
79 79
     <ScrollView
@@ -85,7 +85,10 @@ export default (props) => {
85 85
         ? props.children
86 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 92
     </ScrollView>
90 93
   )
91 94
 }

+ 26
- 15
src/hotel/components/HouseManage/houseManage.jsx Zobrazit soubor

@@ -3,8 +3,9 @@ import see from '@/assets/icons/landlord/查看入住人.png'
3 3
 import share from '@/assets/icons/landlord/分享链接.png'
4 4
 import del from '@/assets/icons/landlord/删除.png'
5 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 7
 import { getRoomList, deleteRoom } from '@/services/landlord'
8
+import List from '@/components/List';
8 9
 import SearchBar from '@/components/SearchBar'
9 10
 import ShareRoom from '../shareRoom/ShareRoom.jsx'
10 11
 import ShareCard from '../shareCard/shareCard'
@@ -15,6 +16,9 @@ export default React.forwardRef((props, ref) => {
15 16
   const { hotel } = props
16 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 22
   const shareDataRef = useRef()
19 23
 
20 24
   // 判断是否首次加载
@@ -118,20 +122,27 @@ export default React.forwardRef((props, ref) => {
118 122
         <SearchBar placeholder='请输入房源名搜索' onBlur={onSearch} />
119 123
         <ShareRoom showCutover={showCutover} onClose={onClose} room={room} onFinish={handleFinish} />
120 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 146
       </view>
136 147
       <view className='addHouse' onClick={handelClick}>
137 148
         <image className='addImg' src={addImg} />添加房源

+ 39
- 39
src/hotel/components/Income/income.jsx Zobrazit soubor

@@ -1,4 +1,4 @@
1
-import { useState } from 'react'
1
+import { useState, useMemo } from 'react'
2 2
 import eyes from '@/assets/icons/shopKeeper/小眼睛.png'
3 3
 import ceyes from '@/assets/icons/shopKeeper/小眼睛-闭上.png'
4 4
 import sImg from '@/assets/icons/landlord/我的收入2.png'
@@ -6,25 +6,25 @@ import cutoverUser from '@/assets/icons/UserCenter/cutoverUser.png'
6 6
 import ToggleRole from '@/components/toggleRole/ToggleRole'
7 7
 import Picker from '@/components/Picker'
8 8
 import formatTime from "@/utils/formatTime";
9
-import {getAccountLogList} from '@/services/landlord'
9
+import { getAccountLogList } from '@/services/landlord'
10 10
 
11 11
 import List from '@/components/List';
12 12
 import './income.less'
13 13
 
14 14
 
15
+const getList = id => params => getAccountLogList(id, params)
15 16
 
16 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 24
   const handleHotelChange = (hotelId, current) => {
26 25
     onHotelChange(current)
27 26
   }
27
+  const [accountlog, setAccountlog] = useState([])
28 28
 
29 29
   const [isyear, setYear] = useState(true)
30 30
   const [isMomth, setMonth] = useState(false)
@@ -68,44 +68,44 @@ export default (props) => {
68 68
           </view>
69 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 100
                 <view className='card'>
100 101
                   <view className='spreadTime'>时&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;间:<text>{formatTime(item.createDate, 'yyyy/MM/dd hh:mm:ss')}</text></view>
101 102
                   <view className='spreadMoney'>收入金额:<text>{parseFloat((item.amount / 100).toFixed(2))}</text>元</view>
102 103
                   <image className='spreadImg' src={sImg} />
103 104
                 </view>
104
-              </view>
105
-            )
106
-          }
107
-        <view className='botton' >已经到底了~</view>
108
-        </scroll-view>
105
+              </view>)
106
+            }
107
+          </view>
108
+        </List> */}
109 109
       </view>
110 110
     </view>
111 111
   )

+ 3
- 9
src/hotel/pages/landlord/landlord.jsx Zobrazit soubor

@@ -8,7 +8,7 @@ import onincomeImg from '@/assets/icons/landlord/我的收入按下.png'
8 8
 import houseImg from '@/assets/icons/landlord/房源管理.png'
9 9
 import onhouseImg from '@/assets/icons/landlord/房源管理按下.png'
10 10
 import withLayout from '@/layouts'
11
-import { getHotelManage, getAccountLogList, getNowHotelManage } from '@/services/landlord'
11
+import { getHotelManage,  getNowHotelManage } from '@/services/landlord'
12 12
 import CustomNav from '@/components/CustomNav'
13 13
 import './landlord.less'
14 14
 
@@ -20,19 +20,16 @@ export default withLayout((props) => {
20 20
   const [hotelList, setHotelList] = useState([])
21 21
   const [hotel, setHotel] = useState()
22 22
   const [account, setAccount] = useState({})
23
-  const [accountlog, setAccountLog] = useState([])
24 23
 
25 24
   const houseRef = useRef()
26 25
 
26
+
27 27
   useEffect(() => {
28 28
     getHotelManage().then((res) => {
29 29
       const { hotelList: list, account: acc, hotel: current } = res
30 30
       setHotelList(list)
31 31
       setHotel(current)
32 32
       setAccount(acc)
33
-      getAccountLogList(acc.accountId).then((res2) => {
34
-        setAccountLog(res2.records || [])
35
-      })
36 33
     })
37 34
   }, [])
38 35
 
@@ -41,9 +38,6 @@ export default withLayout((props) => {
41 38
       const { account: acc } = res
42 39
       setAccount(acc)
43 40
       setHotel(current)
44
-      getAccountLogList(acc.accountId).then((res2) => {
45
-        setAccountLog(res2.records || [])
46
-      })
47 41
     })
48 42
   }
49 43
 
@@ -73,7 +67,7 @@ export default withLayout((props) => {
73 67
     <view className='page-index'>
74 68
       <CustomNav title={hotel?.hotelName} logo={hotel?.logo} />
75 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 71
         {currentTab === 1 && <HouseManage hotel={hotel} ref={houseRef} />}
78 72
       </view>
79 73
       <view className='index-tabbar'>

+ 0
- 1
src/pages/index/components/Card.js Zobrazit soubor

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

+ 1
- 1
src/services/landlord.js Zobrazit soubor

@@ -36,7 +36,7 @@ export const getHotelManage = (params) => request('/hotel/manage/index', { param
36 36
  * @param {*} params 
37 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 Zobrazit soubor

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