吃个甘蔗嚼一年 3 лет назад
Родитель
Сommit
96a7198cdc

+ 0
- 3
src/components/CollectList/MyCollect/index.jsx Просмотреть файл

@@ -19,7 +19,6 @@ import ProCard_hot from '@/assets/icons/ProCard/ProCard_hot.png'
19 19
 
20 20
 
21 21
 
22
-
23 22
 import './style.less'
24 23
 
25 24
 export default (props) => {
@@ -30,8 +29,6 @@ export default (props) => {
30 29
   const targetType = item.targetType
31 30
 
32 31
 
33
-
34
-
35 32
   const star = parseFloat(((item.sweetScore + item.environmentScore + item.serviceScore) / 3).toFixed(1));
36 33
   return (
37 34
     <View>

+ 2
- 1
src/components/List/index.jsx Просмотреть файл

@@ -9,6 +9,7 @@ export default (props) => {
9 9
     params,
10 10
     pageSize = 10,
11 11
     onError,
12
+    shopId,
12 13
     onDataChange,
13 14
     ...leftProps
14 15
   } = props
@@ -72,7 +73,7 @@ export default (props) => {
72 73
   // 请求数据
73 74
   useEffect(() => {
74 75
     fetchRef.current(payload)
75
-  }, [payload])
76
+  }, [payload, shopId])
76 77
 
77 78
   return (
78 79
     <ScrollView

+ 3
- 8
src/components/ShopUnused/index.jsx Просмотреть файл

@@ -1,10 +1,7 @@
1 1
 import Taro from '@tarojs/taro'
2 2
 import { useState, useEffect } from 'react'
3 3
 import formatTimes from '@/utils/formatTime'
4
-import iconsearch from '@/assets/icons/housemantj/search.png'
5
-import ms from '@/assets/icons/housemantj/ms3.jpg'
6
-import cutoverUser from '@/assets/icons/UserCenter/cutoverUser.png'
7
-import { getShopList, getShopMoney, getAccount, getVerifiedOrder, setGetVerifiedOrder } from '@/services/shopBoss'
4
+
8 5
 
9 6
 import './style.less'
10 7
 
@@ -14,11 +11,9 @@ export default (props) => {
14 11
 
15 12
 
16 13
 
17
-  // useEffect(() => {
18
-  //   getVerifiedOrder({ phone: '18082043755' }).then((res) => {
14
+  useEffect(() => {
19 15
 
20
-  //   })
21
-  // }, [])
16
+  }, [])
22 17
 
23 18
   return (
24 19
     <view className='orderCard'>

+ 28
- 20
src/services/landlord.js Просмотреть файл

@@ -6,14 +6,22 @@ import request from '@/utils/request'
6 6
  * @param {*} id 
7 7
  * @returns 
8 8
  */
9
- export const getHotelDetail = (id) => request(`/taHotel/${id}`)
10
- 
9
+export const getHotelDetail = (id) => request(`/taHotel/${id}`)
10
+
11 11
 /**
12 12
  * 查询指定名宿的账户
13 13
  * @param {*} params 
14 14
  * @returns 
15 15
  */
16
- export const getNowHotelManage = (id,params) => request(`/hotel/manage/${id}`, { params })
16
+export const getNowHotelManage = (id, params) => request(`/hotel/manage/${id}`, { params })
17
+
18
+
19
+/**
20
+* 查询指定商铺的账户
21
+* @param {*} params 
22
+* @returns 
23
+*/
24
+export const getNowShopManage = (id, params) => request(`/shop/manage/${id}`, { params })
17 25
 
18 26
 
19 27
 /**
@@ -21,35 +29,35 @@ import request from '@/utils/request'
21 29
  * @param {*} params 
22 30
  * @returns 
23 31
  */
24
- export const getHotelManage = (params) => request('/hotel/manage/index', { params })
32
+export const getHotelManage = (params) => request('/hotel/manage/index', { params })
25 33
 
26 34
 /**
27 35
  * 查询指定名宿的账户流水
28 36
  * @param {*} params 
29 37
  * @returns 
30 38
  */
31
- export const getAccountLogList = (id) => request(`/hotel/account/${id}/log`)
39
+export const getAccountLogList = (id) => request(`/hotel/account/${id}/log`)
32 40
 
33 41
 /**
34 42
  * 房源列表
35 43
  * @param {*} id 
36 44
  * @returns 
37 45
  */
38
- export const getRoomList = (params) => request('/taRoom',{params})
46
+export const getRoomList = (params) => request('/taRoom', { params })
39 47
 
40 48
 /**
41 49
  * 保存房源
42 50
  * @param {*} data 
43 51
  * @returns 
44 52
  */
45
- export const saveRoom = (data) => request('/taRoom', { method: 'post', data })
53
+export const saveRoom = (data) => request('/taRoom', { method: 'post', data })
46 54
 
47
- /**
48
- * 删除房源
49
- * @param {*} data 
50
- * @returns 
51
- */
52
-  export const deleteRoom = (id) => request(`/taRoom/${id}`, { method: 'delete'})
55
+/**
56
+* 删除房源
57
+* @param {*} data 
58
+* @returns 
59
+*/
60
+export const deleteRoom = (id) => request(`/taRoom/${id}`, { method: 'delete' })
53 61
 
54 62
 
55 63
 /**
@@ -57,10 +65,10 @@ import request from '@/utils/request'
57 65
  * @param {*} data 
58 66
  * @returns 
59 67
  */
60
- export const shareRoom = (data) => request('/roomOrder', { method: 'post', data })
61
- /**
62
- * 查看历史入住人列表
63
- * @param {*} id 
64
- * @returns 
65
- */
66
-  export const getRoomOrderList = (params) => request('/roomOrder',{params})
68
+export const shareRoom = (data) => request('/roomOrder', { method: 'post', data })
69
+/**
70
+* 查看历史入住人列表
71
+* @param {*} id 
72
+* @returns 
73
+*/
74
+export const getRoomOrderList = (params) => request('/roomOrder', { params })

+ 20
- 68
src/shop/components/ShopKeeper/shopKeeper.jsx Просмотреть файл

@@ -1,4 +1,4 @@
1
-import { React, useState, useEffect, } from 'react'
1
+import { React, useState, useEffect, useRef } from 'react'
2 2
 import Taro, { useRouter } from '@tarojs/taro'
3 3
 import CustomNav from '@/components/CustomNav'
4 4
 import Picker from '@/components/Picker'
@@ -16,25 +16,25 @@ import ms from '@/assets/icons/housemantj/ms3.jpg'
16 16
 import ToggleRole from '@/components/toggleRole/ToggleRole'
17 17
 
18 18
 import cutoverUser from '@/assets/icons/UserCenter/cutoverUser.png'
19
-import touristON from '@/assets/icons/UserCenter/touristON.png'
20
-import touristOFF from '@/assets/icons/UserCenter/touristOFF.png'
21
-import hotelBossON from '@/assets/icons/UserCenter/hotelBossON.png'
22
-import hotelBossOFF from '@/assets/icons/UserCenter/hotelBossOFF.png'
23
-import shopBossON from '@/assets/icons/UserCenter/shopBossON.png'
24
-import shopBossOFF from '@/assets/icons/UserCenter/shopBossOFF.png'
25 19
 import './shopKeeper.less'
20
+import { useMemo } from 'react'
26 21
 
27 22
 
28 23
 export default (props) => {
29
-  const { shopList, shop, onHotelChange, shopMoney, isVerified, verifiedOrder, onVarified, onVarifiedTwo, setVer } = props
30
-  const shopId = shop?.shopId
31
-  const [activeTab, setActiveTab] = useState(0)
24
+  const { shopList, shop, onHotelChange, shopMoney, verifiedOrder, isVerified, onVarified, onVarifiedTwo, setVer } = props
32 25
   const { params } = useRouter()
33 26
   const { tabJump } = params || {}
34 27
 
35
-  const [queryParams, setQueryParams] = useState({ isVerified: isVerified, pageNum: 1, pageSize: 10, shopId: '' })
36
-
28
+  const [activeTab, setActiveTab] = useState(0)
29
+  const [phone, setPhone] = useState()
30
+  // const [isVerified, setisVerified] = useState(0)
31
+  // const [queryParams, setQueryParams] = useState({ isVerified: isVerified, pageNum: 1, pageSize: 10, shopId: shop?.shopId, phone: phone })
37 32
 
33
+  const queryParams = useMemo(() => ({
34
+    shopId: shop?.shopId,
35
+    isVerified: `${tabJump}` === '1' ? 1 : 0,
36
+    phone: phone || '',
37
+  }), [phone, shop?.shopId, tabJump])
38 38
 
39 39
 
40 40
   // 获取资源表信息
@@ -56,6 +56,10 @@ export default (props) => {
56 56
   }
57 57
 
58 58
 
59
+  const handelSearch = (e) => {
60
+    const val = e.detail.value
61
+    setPhone(val)
62
+  }
59 63
   useEffect(() => {
60 64
     if (tabJump) {
61 65
       setActiveTab(tabJump - 0)
@@ -65,13 +69,6 @@ export default (props) => {
65 69
   const handleTabChange = (e) => {
66 70
     const { index } = e.detail
67 71
     setActiveTab(index)
68
-    if (index === 1) {
69
-      onVarified()
70
-
71
-    } else {
72
-      onVarifiedTwo()
73
-
74
-    }
75 72
   }
76 73
   const tabs = [
77 74
     {
@@ -82,39 +79,12 @@ export default (props) => {
82 79
     },
83 80
   ]
84 81
 
85
-
86 82
   //给父组件传val
87 83
   const handleVarified = () => {
88 84
     onVarified()
89 85
   }
90 86
 
91 87
 
92
-  const onSearch = (e) => {
93
-    const val = e.detail.value
94
-    if (val !== '') {
95
-      getVerifiedOrder({
96
-        phone: val,
97
-        pageNum: 1,
98
-        pageSize: 10,
99
-
100
-      }).then((res) => {
101
-        setVer(res)
102
-
103
-      })
104
-    } else {
105
-      getVerifiedOrder({
106
-        shopId: shopId,
107
-        pageNum: 1,
108
-        pageSize: 10,
109
-
110
-      }).then((res) => {
111
-        setVer(res)
112
-
113
-      })
114
-    }
115
-
116
-  }
117
-
118 88
   const [showCutover, setShowCutover] = useState(false)
119 89
   const ShowMoldeOn = () => {
120 90
     setShowCutover(true)
@@ -126,7 +96,7 @@ export default (props) => {
126 96
     <view>
127 97
       <view>
128 98
       </view>
129
-      <ToggleRole showCutover={showCutover} onClose={onClose} role='shop' />
99
+      <ToggleRole showCutover={showCutover} onClose={onClose} maskClosable={showCutover} role='shop' />
130 100
       <view style={{ padding: '30rpx', height: '100%' }}>
131 101
         <scroll-view scroll-y scroll-view='true' bindscrolltoupper='upper' bindscrolltolower='lower' bindscroll='scroll' style={{ height: 'calc(100vh - 120px)' }}>
132 102
           <view className='storexx'>
@@ -155,7 +125,7 @@ export default (props) => {
155 125
           </view>
156 126
           <view className='search'>
157 127
 
158
-            <SearchBar placeholder='搜索订单(输入客户手机号码)' onBlur={onSearch} />
128
+            <SearchBar placeholder='搜索订单(输入客户手机号码)' onBlur={handelSearch} />
159 129
           </view>
160 130
           <view className='index-tabs'>
161 131
             <mp-tabs
@@ -178,13 +148,8 @@ export default (props) => {
178 148
                   request={getVerifiedOrder}
179 149
                   params={queryParams}
180 150
                   onDataChange={setAllList}
151
+                  render={({ item, index }) => <ShopUnused key={(index)} item={item} />}
181 152
                 >
182
-                  {
183
-                    alllist.map((item, index) => {
184
-
185
-                      return <ShopUnused key={(index)} item={item} />
186
-                    })
187
-                  }
188 153
                 </List>
189 154
               </>
190 155
 
@@ -197,22 +162,9 @@ export default (props) => {
197 162
                   request={getVerifiedOrder}
198 163
                   params={queryParams}
199 164
                   onDataChange={setAllList}
165
+                  render={({ item, index }) => <ShopUsed verifiedOrder={verifiedOrder} key={(index)} item={item} />}
200 166
                 >
201
-                  {
202
-                    alllist.map((item, index) => {
203
-
204
-                      return <ShopUsed verifiedOrder={verifiedOrder} key={(index)} item={item} />
205
-                    })
206
-                  }
207 167
                 </List>
208
-                {/* {
209
-                  verifiedOrder.map((item, index) => {
210
-
211
-                    return <ShopUsed verifiedOrder={verifiedOrder} key={(index)} item={item} />
212
-                  })
213
-                } */}
214
-
215
-
216 168
 
217 169
               </>
218 170
             }

+ 4
- 26
src/shop/components/Sparead/spreadMoney.jsx Просмотреть файл

@@ -24,28 +24,15 @@ export default (props) => {
24 24
   const [showCutover, setShowCutover] = useState(false)
25 25
   const [isyear, setYear] = useState(false)
26 26
   const [isMomth, setMonth] = useState(false)
27
-  const [shopAccount, setShopAccount] = useState([])
28 27
   const acc = shopMoney?.acc
29 28
   const { accountId } = acc
29
+  const [accId, setaccId] = useState(accountId)
30 30
 
31
-  const reqestAPI = getList(accountId)
31
+  const reqestAPI = getList(accId)
32 32
 
33 33
 
34
-  // 获取资源表信息
35
-  const [alllist, setAllList] = useState([])
36 34
 
37 35
 
38
-
39
-
40
-  useEffect(() => {
41
-    getAccount(accountId).then((e) => {
42
-      const accContent = e.records
43
-      setShopAccount(accContent)
44
-
45
-    })
46
-
47
-  }, [accountId])
48
-
49 36
   //小眼睛开关
50 37
   const handleYear = () => {
51 38
     isyear ? setYear(false) : setYear(true)
@@ -85,7 +72,7 @@ export default (props) => {
85 72
               <view className='sleft'>
86 73
                 <view className='lword'>全年推广收入(税前)</view>
87 74
                 <view className='yearMoney'>
88
-                  <text>{isyear ? shopMoney?.totalCharges / 100 : '******'}</text>元
75
+                  <text>{isyear ? (shopMoney?.totalCharges / 100).toFixed(2) : '******'}</text>元
89 76
                   <image className='micon' src={isyear ? eyes : ceyes} onClick={handleYear} />
90 77
                 </view>
91 78
               </view>
@@ -93,7 +80,7 @@ export default (props) => {
93 80
               <view className='sright'>
94 81
                 <view className='rword'>当月推广收入(税前)</view>
95 82
                 <view className='monthMoney'>
96
-                  <text>{isMomth ? shopMoney?.currentCharges / 100 : '******'}</text>元
83
+                  <text>{isMomth ? (shopMoney?.currentCharges / 100).toFixed(2) : '******'}</text>元
97 84
                   <image className='micon2' src={isMomth ? eyes : ceyes} onClick={handleMonth}></image>
98 85
                 </view></view>
99 86
             </view>
@@ -105,15 +92,6 @@ export default (props) => {
105 92
             render={({ item, index }) => <ShopCommission key={(index)} item={item} />}
106 93
           >
107 94
           </List>
108
-          {/* {
109
-            shopAccount.map((item, index) => {
110
-              return (
111
-                <ShopCommission key={(index)} item={item} />
112
-
113
-              )
114
-            })
115
-          } */}
116
-          {/* <view className='botton'>已经到底了~</view> */}
117 95
         </scroll-view>
118 96
       </view>
119 97
 

+ 35
- 28
src/shop/pages/spread/spreadIndex.jsx Просмотреть файл

@@ -2,14 +2,17 @@ import React, { useState, useEffect } from 'react'
2 2
 import CustomNav from '@/components/CustomNav'
3 3
 import { useRouter } from '@tarojs/taro'
4 4
 import { getShopList, getShopMoney, getAccount, getVerifiedOrder, setGetVerifiedOrder } from '@/services/shopBoss'
5
-import ShopKeeper from '../../components/ShopKeeper/shopKeeper'
6
-import Sparead from '../../components/Sparead/spreadMoney'
5
+import { getHotelManage, getAccountLogList, getNowShopManage } from '@/services/landlord'
6
+
7 7
 import TabBar from '@/components/CustTabBar'
8 8
 import shopImg from '@/assets/icons/shopKeeper/订单收入.png'
9 9
 import onShopImg from '@/assets/icons/shopKeeper/订单收入按下.png'
10 10
 import spareadImg from '@/assets/icons/shopKeeper/推广收入.png'
11 11
 import onSpareadImg from '@/assets/icons/shopKeeper/推广收入按下.png'
12 12
 import withLayout from '@/layouts'
13
+import ShopKeeper from '../../components/ShopKeeper/shopKeeper'
14
+import Sparead from '../../components/Sparead/spreadMoney'
15
+
13 16
 
14 17
 import './spreadIndex.less'
15 18
 
@@ -28,6 +31,7 @@ export default withLayout((props) => {
28 31
   const [isVerified, setisVerified] = useState(0)
29 32
   const [shopMoney, setShopMoney] = useState([])
30 33
   const [verifiedOrder, setVerifiedOrder] = useState([])
34
+
31 35
   const handleTabChange = (e) => {
32 36
     const { index } = e.detail
33 37
     setCurrentTab(index)
@@ -36,10 +40,9 @@ export default withLayout((props) => {
36 40
   const handelType = () => {
37 41
     setAmountType('commission')
38 42
   }
39
-
43
+  //商铺列表
40 44
   useEffect(() => {
41 45
     getShopList().then((res) => {
42
-      console.log("🚀 ~ file: spreadIndex.jsx ~ line 42 ~ getShopList ~ res", res)
43 46
       const { shopList: list, shop: current } = res
44 47
       setShopList(list)
45 48
       setShop(current)
@@ -56,23 +59,22 @@ export default withLayout((props) => {
56 59
 
57 60
   }
58 61
 
59
-
60 62
   //未核销订单列表
61
-  useEffect(() => {
62
-    getVerifiedOrder({
63
-      isVerified: isVerified,
64
-      pageNum: 1,
65
-      pageSize: 99,
66
-      shopId: shopId,
63
+  // useEffect(() => {
64
+  //   getVerifiedOrder({
65
+  //     isVerified: isVerified,
66
+  //     pageNum: 1,
67
+  //     pageSize: 99,
68
+  //     shopId: shopId,
67 69
 
68
-    }).then((res) => {
69
-      const order = res.records
70
-      setVerifiedOrder(order)
70
+  //   }).then((res) => {
71
+  //     const order = res.records
72
+  //     setVerifiedOrder(order)
71 73
 
72
-    })
74
+  //   })
73 75
 
74 76
 
75
-  }, [shopId, isVerified])
77
+  // }, [shopId, isVerified])
76 78
 
77 79
 
78 80
   const onVarified = () => {
@@ -87,25 +89,30 @@ export default withLayout((props) => {
87 89
   useEffect(() => {
88 90
     if (shopId) {
89 91
       getShopMoney(shopId, amountType).then((e) => {
90
-
91 92
         setShopMoney(e)
92 93
 
93 94
       })
94 95
     }
95 96
 
96
-  }, [amountType, shopId])
97
-
97
+  }, [amountType, shopId, currentTab])
98 98
 
99
+  //店铺选择
99 100
   const handleHotelChange = (current) => {
100 101
     console.log('已选择店铺', current);
101
-    // getNowHotelManage(current.shopId).then((res) => {
102
-    //   const { account: acc } = res
103
-    //   setAccount(acc)
104
-    //   setHotel(current)
105
-    //   getAccountLogList(acc.accountId).then((res2) => {
106
-    //     setAccountLog(res2.records || [])
107
-    //   })
108
-    // })
102
+    getShopMoney(current.shopId, amountType).then((e) => {
103
+      setShop(current)
104
+      getVerifiedOrder({
105
+        isVerified: isVerified,
106
+        pageNum: 1,
107
+        pageSize: 99,
108
+        shopId: current.shopId,
109
+
110
+      }).then((res) => {
111
+        const order = res.records
112
+        setVerifiedOrder(order)
113
+
114
+      })
115
+    })
109 116
   }
110 117
 
111 118
   useEffect(() => {
@@ -118,7 +125,7 @@ export default withLayout((props) => {
118 125
     <view className='page-index'>
119 126
       <CustomNav title={shop?.shopName} />
120 127
       <view className='index-container'>
121
-        {currentTab === 0 && <ShopKeeper isVerified={isVerified} setVer={setVer} onVarifiedTwo={onVarifiedTwo} onVarified={onVarified} verifiedOrder={verifiedOrder} shopList={shopList} shop={shop} onHotelChange={handleHotelChange} shopMoney={shopMoney} />
128
+        {currentTab === 0 && <ShopKeeper isVerified={isVerified} setVer={setVer} onVarifiedTwo={onVarifiedTwo} onVarified={onVarified} verifiedOrder={verifiedOrder} shopList={shopList} shop={shop} shopId={shopId} onHotelChange={handleHotelChange} shopMoney={shopMoney} />
122 129
         }
123 130
         {currentTab === 1 && <Sparead shopList={shopList} shop={shop} verifiedOrder={verifiedOrder} onHotelChange={handleHotelChange} shopMoney={shopMoney} />}
124 131
       </view>