ソースを参照

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

zlisen 3 年 前
コミット
0b0d9b5323
共有41 個のファイルを変更した965 個の追加286 個の削除を含む
  1. 2
    2
      src/components/BossCard/index.jsx
  2. 23
    0
      src/components/ShopCommission/index.jsx
  3. 21
    0
      src/components/ShopCommission/style.less
  4. 39
    0
      src/components/ShopUnused/index.jsx
  5. 93
    0
      src/components/ShopUnused/style.less
  6. 39
    0
      src/components/ShopUsed/index.jsx
  7. 100
    0
      src/components/ShopUsed/style.less
  8. 49
    43
      src/components/foodCards/foodCards.jsx
  9. 56
    10
      src/hotel/components/HouseManage/houseManage.jsx
  10. 2
    4
      src/hotel/components/HouseManage/houseManage.less
  11. 12
    10
      src/hotel/components/Income/income.jsx
  12. 21
    0
      src/hotel/components/shareCard/shareCard.jsx
  13. 24
    0
      src/hotel/components/shareCard/shareCard.less
  14. 53
    0
      src/hotel/components/shareRoom/ShareRoom.jsx
  15. 38
    0
      src/hotel/components/shareRoom/ShareRoom.less
  16. 21
    14
      src/hotel/pages/landlord/addRoom/addRoom.jsx
  17. 2
    1
      src/hotel/pages/landlord/landlord.config.js
  18. 14
    3
      src/hotel/pages/landlord/landlord.jsx
  19. 13
    1
      src/layouts/index.jsx
  20. 6
    3
      src/pages/details/components/Extend/extend.jsx
  21. 6
    0
      src/pages/details/components/Extend/extend.less
  22. 3
    0
      src/pages/details/foodDetails/foodDetails.jsx
  23. 3
    0
      src/pages/details/mjDetails/sceneryDetails.jsx
  24. 18
    27
      src/pages/details/mjDetails/sceneryDetails.less
  25. 1
    0
      src/pages/index/index.config.js
  26. 21
    2
      src/pages/index/index.jsx
  27. 1
    12
      src/pages/index/tabs/Guide.jsx
  28. 10
    15
      src/pages/index/tabs/Recommend.jsx
  29. 2
    2
      src/pages/index/tabs/less/Recommend.less
  30. 3
    4
      src/services/landlord.js
  31. 27
    0
      src/services/shopBoss.js
  32. 15
    0
      src/services/track.js
  33. 32
    63
      src/shop/components/ShopKeeper/shopKeeper.jsx
  34. 16
    3
      src/shop/components/ShopKeeper/shopKeeper.less
  35. 50
    24
      src/shop/components/Sparead/spreadMoney.jsx
  36. 4
    24
      src/shop/components/Sparead/spreadMoney.less
  37. 59
    5
      src/shop/pages/spread/spreadIndex.jsx
  38. 25
    0
      src/utils/hooks/useTrackPage.js
  39. 22
    0
      src/utils/index.js
  40. 17
    1
      src/utils/preFetchData.js
  41. 2
    13
      src/utils/request.js

+ 2
- 2
src/components/BossCard/index.jsx ファイルの表示

@@ -41,7 +41,7 @@ export default (props) => {
41 41
   return (
42 42
     <view class='container'>
43 43
       <view class='wrapper'>
44
-        <view class='left-complete-one' onClick={() => { goFood() }} >
44
+        <view class='left-complete-one'  >
45 45
           <image className='left-image-1' src={ProCard_hot}></image>
46 46
           <view className='left-viewText'>
47 47
             返现¥{item.cashback / 100}
@@ -56,7 +56,7 @@ export default (props) => {
56 56
             <image className='image-2' src={food}></image>
57 57
           </view>
58 58
           <view className='title-content'>
59
-            <view className='Pro-title'>
59
+            <view className='Pro-title' onClick={() => { goFood() }} >
60 60
               <view className='title-text'>{(item.description).toString().length > 25 ? (item.description).substring(0, 25) + '...' : (item.description)}</view>
61 61
             </view>
62 62
             <text className='title-money' >¥{item.actualPrice / 100}元<text className='title-money-2'>门市价{item.standardPrice / 100}元</text></text>

+ 23
- 0
src/components/ShopCommission/index.jsx ファイルの表示

@@ -0,0 +1,23 @@
1
+import Taro from '@tarojs/taro'
2
+import { useEffect } from 'react'
3
+import { getAccount } from '@/services/shopBoss'
4
+import formatTimes from '@/utils/formatTime'
5
+
6
+import './style.less'
7
+
8
+
9
+export default (props) => {
10
+
11
+  const { item } = props
12
+
13
+
14
+  return (
15
+    <view className='spreadCard'>
16
+      <view className='spreadDate'>日期:<text>{formatTimes(item.createDate, "yyyy/MM/dd")}</text></view>
17
+      <view className='card'>
18
+        <view className='spreadTime'>时&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;间:<text>{formatTimes(item.createDate, "yyyy/MM/dd hh:ss")}</text></view>
19
+        <view className='spreadMoney'>收入金额:<text>{item.amount / 100}</text>元</view>
20
+      </view>
21
+    </view>
22
+  )
23
+}

+ 21
- 0
src/components/ShopCommission/style.less ファイルの表示

@@ -0,0 +1,21 @@
1
+.spreadCard{
2
+  margin-bottom: 1px;
3
+  .spreadDate{
4
+    font-size: 20px;
5
+    color: #202020;
6
+    line-height: 60px;
7
+  }
8
+  .card{
9
+    height: 166px;
10
+    background: #FFF;
11
+    box-shadow: 0px 8px 32px 0px rgba(0, 0, 0, 0.08);
12
+    border-radius: 12px;
13
+    padding: 40px 0 43px 22px;
14
+    font-size: 24px;
15
+    color: #202020;
16
+    box-sizing: border-box;
17
+    .spreadMoney{
18
+      line-height: 60px;
19
+    }
20
+  }
21
+}

+ 39
- 0
src/components/ShopUnused/index.jsx ファイルの表示

@@ -0,0 +1,39 @@
1
+import Taro from '@tarojs/taro'
2
+import { useState, useEffect } from 'react'
3
+import iconsearch from '@/assets/icons/housemantj/search.png'
4
+import ms from '@/assets/icons/housemantj/ms3.jpg'
5
+import cutoverUser from '@/assets/icons/UserCenter/cutoverUser.png'
6
+import './style.less'
7
+
8
+
9
+export default (props) => {
10
+  const { } = props
11
+
12
+
13
+
14
+  useEffect(() => {
15
+
16
+  }, [])
17
+
18
+  return (
19
+    <view className='orderCard'>
20
+      <view style={{ overflow: 'hidden' }}>
21
+        <view className='orderId'>订单编号:<text>ABC123456789</text></view>
22
+        <view className='orderTime'>下单日期:<text>2021-06-22 12:35</text></view>
23
+      </view>
24
+      <view className='order'>
25
+        <image className='orderImg' src={ms} mode='aspectFit' />
26
+        <view className='orderRight'>
27
+          <view className='foodName'>【SEOUL.创意韩国料理】火爆全南京,
28
+            新街口又开新店啦...</view>
29
+          <view className='price'>合计金额:¥<text style={{ fontSize: '24rpx' }}>88</text>元 <text className='pnum'>数量:<text>1</text>张</text> </view>
30
+          <view>已下单:等待客户上门就餐</view>
31
+        </view>
32
+        <view className='line' />
33
+
34
+        <view className='phone'>客户手机:<text>136****9434</text></view>
35
+        <view className='tripTime'>客户行程日期:预计在<text>2021-06-21中下午10:30-16:30</text></view>
36
+      </view>
37
+    </view>
38
+  )
39
+}

+ 93
- 0
src/components/ShopUnused/style.less ファイルの表示

@@ -0,0 +1,93 @@
1
+.orderCard{
2
+  margin-bottom: 20px;
3
+  .orderId{
4
+    font-size: 20px;
5
+    color: #666666;
6
+    line-height: 44px;
7
+    float: left;
8
+    margin: 60px 0 32px 0;
9
+
10
+  }
11
+  .orderTime{    
12
+    font-size: 20px;
13
+    color: #666666;
14
+    line-height: 44px;
15
+    float: right;
16
+    margin: 60px 0 32px 0;
17
+  }
18
+  .order{
19
+    background: #FFFFFF;
20
+    box-shadow: 0px 8px 32px 0px rgba(0, 0, 0, 0.08);
21
+    border-radius: 12px;
22
+    padding: 20px;
23
+    .orderImg{
24
+      width: 194px;
25
+      height: 194px;
26
+      border-radius: 22px;
27
+      float: left;
28
+      margin:0 26px 30px 0;
29
+    }
30
+    .orderRight{
31
+      .foodName{
32
+        height: 63px;
33
+        font-size: 24px;
34
+        color: #333333;
35
+        line-height: 40px;
36
+      }
37
+      .price{
38
+        font-size: 20px;
39
+        font-weight: bold;
40
+        color: #202020;
41
+        line-height: 44px;
42
+        margin: 37px 0 40px 0;
43
+        height: 19px;
44
+        .pnum{
45
+          color: #333333;
46
+          font-weight: 400;
47
+          margin-left: 47px;         
48
+        }
49
+      }
50
+      .price+view{
51
+        font-size: 20px;
52
+        font-weight: bold;
53
+        color: #FF3434;
54
+        line-height: 44px;
55
+        margin-bottom: 35px;
56
+        height: 19px;
57
+      }
58
+    }
59
+    .line{
60
+      width: 100%;
61
+      height: 2px;
62
+      background: #000;
63
+      opacity: 0.1;
64
+    }
65
+    .phone{
66
+      font-size: 24px;
67
+      color: #666666;
68
+      line-height: 44px;
69
+      height: 23px;
70
+      margin: 30px 0;
71
+    }
72
+    .button-OK{
73
+      width: 160px;
74
+    height: 40px;
75
+    background: #1A3B83;
76
+    /* margin: 0 auto; */
77
+    line-height: 40px;
78
+    border-radius: 12px;
79
+    font-size: 23px;
80
+    color: #ffffff;
81
+    position: relative;
82
+    right: -8em;
83
+    top: -2em;
84
+    }
85
+    .tripTime{
86
+      font-size: 24px;
87
+      color: #666666;
88
+      line-height: 44px;
89
+      margin-bottom: 30px;
90
+    }
91
+  }
92
+  
93
+}

+ 39
- 0
src/components/ShopUsed/index.jsx ファイルの表示

@@ -0,0 +1,39 @@
1
+import Taro from '@tarojs/taro'
2
+import { useState, useEffect } from 'react'
3
+import iconsearch from '@/assets/icons/housemantj/search.png'
4
+import ms from '@/assets/icons/housemantj/ms3.jpg'
5
+import cutoverUser from '@/assets/icons/UserCenter/cutoverUser.png'
6
+import './style.less'
7
+
8
+
9
+export default (props) => {
10
+  const { } = props
11
+
12
+
13
+
14
+  useEffect(() => {
15
+
16
+  }, [])
17
+
18
+  return (
19
+    <view className='orderCard'>
20
+      <view style={{ overflow: 'hidden' }}>
21
+        <view className='orderId'>订单编号:<text>ABC123456789</text></view>
22
+        <view className='orderTime'>下单日期:<text>2021-06-22 12:35</text></view>
23
+      </view>
24
+      <view className='order'>
25
+        <image className='orderImg' src={ms} mode='aspectFit' />
26
+        <view className='orderRight'>
27
+          <view className='foodName'>【SEOUL.创意韩国料理】火爆全南京,
28
+            新街口又开新店啦...</view>
29
+          <view className='price'>合计金额:¥<text style={{ fontSize: '24rpx' }}>88</text>元 <text className='pnum'>数量:<text>1</text>张</text> </view>
30
+          <view>已下单:等待客户上门就餐</view>
31
+        </view>
32
+        <view className='line' />
33
+
34
+        <view className='phone'>客户手机:<text>136****9434</text><button className='button-OK'  >确认核销</button> </view>
35
+        <view className='tripTime'>客户行程日期:预计在<text>2021-06-21中下午10:30-16:30</text></view>
36
+      </view>
37
+    </view>
38
+  )
39
+}

+ 100
- 0
src/components/ShopUsed/style.less ファイルの表示

@@ -0,0 +1,100 @@
1
+.orderCard{
2
+  margin-bottom: 20px;
3
+  .orderId{
4
+    font-size: 20px;
5
+    color: #666666;
6
+    line-height: 44px;
7
+    float: left;
8
+    margin: 60px 0 32px 0;
9
+
10
+  }
11
+  .orderTime{    
12
+    font-size: 20px;
13
+    color: #666666;
14
+    line-height: 44px;
15
+    float: right;
16
+    margin: 60px 0 32px 0;
17
+  }
18
+  .order{
19
+    background: #FFFFFF;
20
+    box-shadow: 0px 8px 32px 0px rgba(0, 0, 0, 0.08);
21
+    border-radius: 12px;
22
+    padding: 20px;
23
+    .orderImg{
24
+      width: 194px;
25
+      height: 194px;
26
+      border-radius: 22px;
27
+      float: left;
28
+      margin:0 26px 30px 0;
29
+    }
30
+    .orderRight{
31
+      .foodName{
32
+        height: 63px;
33
+        font-size: 24px;
34
+        color: #333333;
35
+        line-height: 40px;
36
+      }
37
+      .price{
38
+        font-size: 20px;
39
+        font-weight: bold;
40
+        color: #202020;
41
+        line-height: 44px;
42
+        margin: 37px 0 40px 0;
43
+        height: 19px;
44
+        .pnum{
45
+          color: #333333;
46
+          font-weight: 400;
47
+          margin-left: 47px;         
48
+        }
49
+      }
50
+      .price+view{
51
+        font-size: 20px;
52
+        font-weight: bold;
53
+        color: #FF3434;
54
+        line-height: 44px;
55
+        margin-bottom: 35px;
56
+        height: 19px;
57
+      }
58
+    }
59
+    .line{
60
+      width: 100%;
61
+      height: 2px;
62
+      background: #000;
63
+      opacity: 0.1;
64
+    }
65
+    .phone{
66
+      font-size: 24px;
67
+      color: #666666;
68
+      line-height: 44px;
69
+      height: 23px;
70
+      margin: 30px 0;
71
+    }
72
+    .button-OK{
73
+      width: 160px;
74
+    height: 40px;
75
+    background: #1A3B83;
76
+    /* margin: 0 auto; */
77
+    line-height: 40px;
78
+    border-radius: 12px;
79
+    font-size: 23px;
80
+    color: #ffffff;
81
+    position: relative;
82
+    right: -8em;
83
+    top: -2em;
84
+    }
85
+    .tripTime{
86
+      font-size: 24px;
87
+      color: #666666;
88
+      line-height: 44px;
89
+      margin-bottom: 30px;
90
+    }
91
+  }
92
+  
93
+}
94
+.botton{
95
+  font-size: 28px;   
96
+  color: #C0C8D3;
97
+  line-height: 34px;
98
+  text-align: center;
99
+  padding:40px 0 100px 0;
100
+}

+ 49
- 43
src/components/foodCards/foodCards.jsx ファイルの表示

@@ -7,7 +7,7 @@ import hongxin from '@/assets/icons/housemantj/已收藏.png'
7 7
 import baixin from '@/assets/icons/housemantj/收藏.png'
8 8
 import './style.less'
9 9
 import useSave from "@/utils/hooks/useSave"
10
-import {getShopDetail,getShopcity} from '@/services/home'
10
+import { getShopDetail, getShopcity } from '@/services/home'
11 11
 import { useState, useEffect } from 'react'
12 12
 
13 13
 
@@ -15,59 +15,65 @@ import { useState, useEffect } from 'react'
15 15
 //套餐卡片
16 16
 export default (props) => {
17 17
   const { item } = props
18
-  const [isSaved, toggleSave] = useSave(item.isSaved,'shop_package', item.packageId)
19
-  const [city,setCity]=useState({})
20
-  const [detail,setDetail]=useState({})
18
+  const { shopId } = props.item
19
+  const [isSaved, toggleSave] = useSave(item.isSaved, 'shop_package', item.packageId)
20
+  const [city, setCity] = useState({})
21
+  const [detail, setDetail] = useState({})
22
+
23
+  const goFood = () => {
24
+    Taro.navigateTo({ url: `/pages/details/foodDetails/foodDetails?id=${shopId}` })
25
+
26
+  }
21 27
 
22 28
   useEffect(() => {
23
-  getShopDetail(item.shopId).then((res)=>{
24
-    setDetail(res)
25
-    getShopcity(res.cityId).then((res2)=>{
26
-      setCity(res2)
29
+    getShopDetail(item.shopId).then((res) => {
30
+      setDetail(res)
31
+      getShopcity(res.cityId).then((res2) => {
32
+        setCity(res2)
33
+      })
27 34
     })
28
-  })
29
-}, [])
30
-const star=parseFloat(((detail.sweetScore+detail.environmentScore+detail.serviceScore)/3).toFixed(1)); 
35
+  }, [])
36
+  const star = parseFloat(((detail.sweetScore + detail.environmentScore + detail.serviceScore) / 3).toFixed(1));
31 37
 
32 38
   return (
33
-      <view className='foodCard'>
34
-        <view className='fCleft'>
35
-          <view className='backMoney'>
36
-            返现¥{item.cashback/100}
37
-          </view>
38
-          <view className='appraise'>
39
-            <Star star={star} />
40
-            <text className='storezf'>{star}</text>
39
+    <view className='foodCard'>
40
+      <view className='fCleft'>
41
+        <view className='backMoney'>
42
+          返现¥{item.cashback / 100}
43
+        </view>
44
+        <view className='appraise'>
45
+          <Star star={star} />
46
+          <text className='storezf'>{star}</text>
47
+        </view>
48
+        <view>
49
+          <view className='contentImg'>
50
+            <image src={item.poster} className='img1'></image>
51
+            <image src={msTip} className='mstip'></image>
41 52
           </view>
42
-          <view>
43
-            <view className='contentImg'>
44
-              <image src={item.poster} className='img1'></image>
45
-              <image src={msTip} className='mstip'></image>
53
+          <view className='neirong'>
54
+            <view className='textword'>{(item.description).toString().length > 25 ? (item.description).substring(0, 25) + '...' : (item.description)}</view>
55
+            <view className='jiage' onClick={() => { goFood() }} >
56
+              <text className='rmb' >¥&nbsp;&nbsp;</text>
57
+              <text className='p1'><text className='price' >{item.actualPrice / 100}</text>元&nbsp;&nbsp;</text>
58
+              <text className='p2'>门市价<text className='oldprice' >{item.standardPrice / 100}</text>元</text>
46 59
             </view>
47
-            <view className='neirong'>
48
-              <view className='textword'>{(item.description).toString().length>25?(item.description).substring(0, 25)+'...':(item.description)}</view>
49
-              <view className='jiage'>
50
-                <text className='rmb' >¥&nbsp;&nbsp;</text>
51
-                <text className='p1'><text className='price' >{item.actualPrice/100}</text>元&nbsp;&nbsp;</text>
52
-                <text className='p2'>门市价<text className='oldprice' >{item.standardPrice/100}</text>元</text>
53
-              </view>
54
-              <view className='address'>
55
-                <image className='dw' src={wz} />
56
-                <text className='wz'>{city.areaPName}/{city.areaName}</text>
57
-                <view style={{display:'inline-block'}} onClick={toggleSave}>
58
-                <image className='star' src={isSaved>0?hongxin:baixin}></image>
59
-                <text className='collection'>{isSaved>0?'已收藏':'加入收藏'}</text>
60
-              </view>
60
+            <view className='address'>
61
+              <image className='dw' src={wz} />
62
+              <text className='wz'>{city.areaPName}/{city.areaName}</text>
63
+              <view style={{ display: 'inline-block' }} onClick={toggleSave}>
64
+                <image className='star' src={isSaved > 0 ? hongxin : baixin}></image>
65
+                <text className='collection'>{isSaved > 0 ? '已收藏' : '加入收藏'}</text>
61 66
               </view>
62 67
             </view>
63 68
           </view>
64 69
         </view>
65
-        <view className='fCright' onClick={()=>{Taro.navigateTo({ url: `/pages/PayOrder/index?packageId=${item.packageId}` });}}>
66
-          <image src={pay} />
67
-          <view>支付</view>
68
-        </view>
69
-        <view className='columnLine'></view>
70 70
       </view>
71
-    
71
+      <view className='fCright' onClick={() => { Taro.navigateTo({ url: `/pages/PayOrder/index?packageId=${item.packageId}` }); }}>
72
+        <image src={pay} />
73
+        <view>支付</view>
74
+      </view>
75
+      <view className='columnLine'></view>
76
+    </view>
77
+
72 78
   )
73 79
 }

+ 56
- 10
src/hotel/components/HouseManage/houseManage.jsx ファイルの表示

@@ -1,24 +1,49 @@
1
-import Taro from '@tarojs/taro'
1
+import Taro, {useDidShow } from '@tarojs/taro'
2 2
 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 6
 import iconsearch from '@/assets/icons/housemantj/search.png'
7
+import React,{useState, useEffect,useRef, useImperativeHandle } from 'react'
8
+import {getRoomList,deleteRoom} from '@/services/landlord'
9
+import ShareRoom from '../shareRoom/ShareRoom.jsx'
10
+import ShareCard from '../shareCard/shareCard'
7 11
 import './houseManage.less'
8
-import {useState, useEffect,useRef } from 'react'
9
-import {useDidShow } from '@tarojs/taro'
10
-import {getRoomList} from '@/services/landlord'
11 12
 
12
-
13
-export default (props) => {
13
+export default React.forwardRef((props, ref) => {
14 14
   const {hotel}=props
15 15
   const [detail, setDetail] = useState([])
16
+
17
+  const shareDataRef = useRef()
18
+
16 19
   // 判断是否首次加载
17 20
   const mounted = useRef(false)
18 21
 
19 22
   const handelClick=()=>{
20 23
     Taro.navigateTo({ url: `/hotel/pages/landlord/addRoom/addRoom?hotelId=${hotel.hotelId}&hotelName=${hotel.hotelName}` });
21 24
   }
25
+  const handelDelete=(roomId)=>{
26
+    deleteRoom(roomId).then(()=>{
27
+      Taro.showToast({
28
+        title: '删除房源成功',
29
+        icon: 'none',
30
+      })
31
+      getRoomList({hotelId:hotel.hotelId}).then((res)=>{
32
+        setDetail(res.records||[])
33
+      })
34
+    })
35
+  }
36
+
37
+  const [showCutover, setShowCutover] = useState(false)
38
+  const [showCard, setShowCard] = useState(false)
39
+  const [room, setRoom] = useState({})
40
+  const ShowMoldeOn = (room) => {
41
+    setRoom(room)
42
+    setShowCutover(true)
43
+  }
44
+  const onClose = () => {
45
+    setShowCutover(false)
46
+  }
22 47
   useEffect(()=>{
23 48
     //首次加载页面时
24 49
     if (!mounted.current && hotel.hotelId) {
@@ -38,6 +63,25 @@ export default (props) => {
38 63
     }
39 64
   })
40 65
 
66
+  useImperativeHandle(ref, () => ({
67
+    getShareMessage: () => {
68
+      const { shareImage, roomOrderId } = shareDataRef.current
69
+      setShowCard(false)
70
+      return {
71
+        title: room.roomName,
72
+        path: `/pages/index/index?tab=1&roomId=${room.roomId}&roomOrderId=${roomOrderId}`,
73
+        imageUrl: shareImage,
74
+      }
75
+    }
76
+  }))
77
+
78
+  const handleFinish = (val) => {
79
+    shareDataRef.current = val
80
+    setShowCutover(false)
81
+    // 打开分享弹窗
82
+    setShowCard(true)
83
+  }
84
+
41 85
   return (
42 86
     <view>
43 87
       <view style={{ padding: '0 30rpx', height: '100%' }}>
@@ -46,6 +90,8 @@ export default (props) => {
46 90
             <image className='searchicon' src={iconsearch} />
47 91
             <view className="searchword">请输入关键字搜索</view>
48 92
           </view>
93
+          <ShareRoom showCutover={showCutover} onClose={onClose}  room={room} onFinish={handleFinish} />
94
+          <ShareCard showCutover={showCard} onClose={onClose}/>
49 95
         <scroll-view scroll-y="true" scroll-view='true' bindscrolltoupper="upper" bindscrolltolower="lower" bindscroll="scroll" style={{ height: 'calc(100vh - 255px)' }}>
50 96
 
51 97
           <view>
@@ -54,9 +100,9 @@ export default (props) => {
54 100
               <view className='houseCard'>
55 101
               <view className='houseName'>{item.roomName}</view>
56 102
               <view className='operation'>
57
-                <view><image src={see} /><text>查看入住人</text></view>
58
-                <view><image src={share} /><text>分享链接</text></view>
59
-                <view><image src={del} /><text>删除房源</text></view>
103
+                <view><image src={see} />查看入住人</view>
104
+                <view onClick={()=>ShowMoldeOn(item)}><image src={share}/>分享链接</view>
105
+                <view onClick={()=>{handelDelete(item.roomId)}}><image src={del} />删除房源</view>
60 106
               </view>
61 107
             </view>
62 108
               )
@@ -72,4 +118,4 @@ export default (props) => {
72 118
     
73 119
       </view>
74 120
   )
75
-}
121
+})

+ 2
- 4
src/hotel/components/HouseManage/houseManage.less ファイルの表示

@@ -40,6 +40,8 @@
40 40
   }
41 41
   .operation{
42 42
     column-count: 3;
43
+    font-size: 28px;
44
+    color: #202020;
43 45
     image{
44 46
       width: 28px;
45 47
       height: 28px;
@@ -47,10 +49,6 @@
47 49
       position: relative;
48 50
       top: 5px;
49 51
     }
50
-    text{      
51
-      font-size: 28px;
52
-      color: #202020;
53
-    }
54 52
   }
55 53
 }
56 54
 .addHouse{

+ 12
- 10
src/hotel/components/Income/income.jsx ファイルの表示

@@ -6,6 +6,8 @@ import sImg from '@/assets/icons/landlord/我的收入2.png'
6 6
 import cutoverUser from '@/assets/icons/UserCenter/cutoverUser.png'
7 7
 import ToggleRole from '@/components/toggleRole/ToggleRole'
8 8
 import Picker from '@/components/Picker'
9
+import formatTime from "@/utils/formatTime";
10
+
9 11
 
10 12
 export default (props) => {
11 13
   const { hotelList, hotel, account, onHotelChange, accountlog } = props
@@ -57,17 +59,17 @@ export default (props) => {
57 59
                 </view></view>
58 60
             </view>
59 61
           </view>
60
-
61
-          <view className='title' >{accountlog.length != '' ? '推广收入记录' : '暂无推广收入'}</view>
62
-          {
63
-            accountlog?.map((item) =>
64
-              <view className='spreadCard'>
65
-                <view className='card'>
66
-                  <view className='spreadTime'>时&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;间:<text>{item.createDate}</text></view>
67
-                  <view className='spreadMoney'>收入金额:<text>{parseFloat((item.amount / 100).toFixed(2))}</text>元</view>
68
-                  <image className='spreadImg' src={sImg} />
62
+          
63
+          <view className='title' >{accountlog.length!=''?'推广收入记录':'暂无推广收入'}</view>
64
+            {
65
+              accountlog?.map((item) => 
66
+                <view className='spreadCard'>
67
+                  <view className='card'>
68
+                    <view className='spreadTime'>时&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;间:<text>{formatTime(item.createDate,'yyyy/MM/dd hh:mm:ss')}</text></view>
69
+                    <view className='spreadMoney'>收入金额:<text>{parseFloat((item.amount/100).toFixed(2))}</text>元</view>
70
+                    <image className='spreadImg' src={sImg} />
71
+                  </view>
69 72
                 </view>
70
-              </view>
71 73
             )
72 74
           }
73 75
           {accountlog.length != '' ? <view className='botton'>已经到底了~</view> : ''}

+ 21
- 0
src/hotel/components/shareCard/shareCard.jsx ファイルの表示

@@ -0,0 +1,21 @@
1
+import React from 'react'
2
+import Popup from '@/components/Popup'
3
+import Taro from '@tarojs/taro'
4
+import { Input, Button, View, Picker, Label } from '@tarojs/components'
5
+import {shareRoom} from '@/services/landlord'
6
+import { useState } from 'react'
7
+import './shareCard.less'
8
+
9
+
10
+export default (props) => {
11
+  const { showCutover, onClose} = props
12
+
13
+  return (
14
+    <Popup show={showCutover} onClose={onClose}>
15
+      <View className='card'>
16
+      <Label style={{color:'black',fontSize:'45rpx'}}>确认分享给游客</Label>      
17
+      <View><Button  className='cancel' onClick={onClose}>取消</Button><Button openType='share' className='btn'>确认</Button></View>
18
+    </View>
19
+    </Popup>
20
+  )
21
+}

+ 24
- 0
src/hotel/components/shareCard/shareCard.less ファイルの表示

@@ -0,0 +1,24 @@
1
+.card{
2
+  font-size: 34px;
3
+  padding-top: 40px;
4
+}
5
+.cancel{
6
+  width: 150px;
7
+  height: 70px;
8
+  display: inline-block;
9
+  line-height: 70px;
10
+  border-radius: 12px;
11
+  font-size: 36px;
12
+  margin-top: 15px;
13
+  margin-right: 20px;
14
+}
15
+.btn {
16
+  width: 150px;
17
+  height: 70px;
18
+  background: #1A3B83;
19
+  display: inline-block;
20
+  line-height: 70px;
21
+  border-radius: 12px;
22
+  font-size: 36px;
23
+  color: #fff;
24
+}

+ 53
- 0
src/hotel/components/shareRoom/ShareRoom.jsx ファイルの表示

@@ -0,0 +1,53 @@
1
+import React from 'react'
2
+import Popup from '@/components/Popup'
3
+import Taro from '@tarojs/taro'
4
+import { Input, Button, View, Picker, Label } from '@tarojs/components'
5
+import { shareRoom } from '@/services/landlord'
6
+import './ShareRoom.less'
7
+import { useState } from 'react'
8
+
9
+
10
+export default (props) => {
11
+  const { showCutover, onClose, room, onFinish } = props
12
+  const [startDate, setStartDate] = useState('')
13
+  const [endDate, setEndDate] = useState('')
14
+  const [roomNum, setRoomNum] = useState('')
15
+  const handelStartDate = (e) => {
16
+    setStartDate(e.detail.value)
17
+  }
18
+  const handelEndDate = (e) => {
19
+    setEndDate(e.detail.value)
20
+  }
21
+  const handelShare = () => {
22
+    if (roomNum != '' && startDate != '' && endDate != '') {
23
+      shareRoom({ hotelId: room.hotelId, personNum: roomNum, roomId: room.roomId, startDate: startDate, endDate: endDate }).then((res) => {
24
+        onFinish(res)
25
+        setStartDate('')
26
+        setEndDate('')
27
+        setRoomNum()
28
+      })
29
+    }
30
+  }
31
+  return (
32
+    <Popup show={showCutover} onClose={onClose}>
33
+      <View className='from-room'>
34
+        <Label style={{ color: 'black' }}>请输入入住人信息</Label>
35
+        <View className='flex'>
36
+          <Label>入住人数:</Label><Input focus dataField='nm' onInput={(e) => setRoomNum(e.detail.value)} value={roomNum} type='number' placeholder='请输入入住人数' /></View>
37
+        <View className='flex'>
38
+          <Label>入住开始时间:</Label>
39
+          <Picker mode='date' className='picker' onChange={handelStartDate}>
40
+            {startDate == '' ? '请选择入住开始时间' : startDate}
41
+          </Picker>
42
+        </View>
43
+        <View className='flex'>
44
+          <Label>入住结束时间:</Label>
45
+          <Picker className='picker' mode='date' onChange={handelEndDate}>
46
+            {endDate == '' ? '请选择入住结束时间' : endDate}
47
+          </Picker>
48
+        </View>
49
+        <View><Button className='cancel' onClick={onClose}>取消</Button><Button className='btn' onClick={handelShare}>分享</Button></View>
50
+      </View>
51
+    </Popup>
52
+  )
53
+}

+ 38
- 0
src/hotel/components/shareRoom/ShareRoom.less ファイルの表示

@@ -0,0 +1,38 @@
1
+  .from-room{
2
+    font-size: 34px;
3
+    padding-top: 30px;
4
+    .flex{
5
+      display: flex;
6
+      margin: 10px 0;
7
+      Input{
8
+        width: 345px;
9
+        border-radius: 15px;
10
+        border: solid 1px rgb(121, 116, 116);
11
+        margin-left: 70px;
12
+      }
13
+      .picker{
14
+        width: 345px;
15
+        border-radius: 15px;
16
+        border: solid 1px rgb(121, 116, 116);
17
+      }
18
+    }
19
+  }
20
+  .cancel{
21
+      width: 150px;
22
+      height: 70px;
23
+      display: inline-block;
24
+      line-height: 70px;
25
+      border-radius: 12px;
26
+      font-size: 36px;
27
+      margin-right: 20px;
28
+  }
29
+  .btn {
30
+      width: 150px;
31
+      height: 70px;
32
+      background: #1A3B83;
33
+      display: inline-block;
34
+      line-height: 70px;
35
+      border-radius: 12px;
36
+      font-size: 36px;
37
+      color: #fff;
38
+  }

+ 21
- 14
src/hotel/pages/landlord/addRoom/addRoom.jsx ファイルの表示

@@ -32,21 +32,28 @@ export default withLayout((props) => {
32 32
     })
33 33
   }
34 34
   const sumbit = () => {
35
-    //判断每一项是否为空Object.values(roomModel).filter返回一个数组如果有空属性就是数组长度就不为0
36
-    Object.values(roomModel).filter(item => item == '').length != 0 ?
37
-      Taro.showToast({
38
-        title: '每一项都是必填项哦',
39
-        icon: 'none',
40
-      }) :
41
-      saveRoom(roomModel).then(() => {
42
-       
43
-          Taro.showToast({
35
+    if(
36
+    roomModel.roomName!=''&&
37
+    roomModel.address!=''&&
38
+    roomModel.location!=''&&
39
+    roomModel.weight!=''
40
+    )
41
+     { 
42
+      saveRoom(roomModel).then(() => {       
43
+          Taro.showModal({
44 44
             title: '保存成功',
45
-            icon: 'success',
45
+            showCancel:false
46 46
           }).then(() => {
47 47
             Taro.navigateBack()
48 48
           })
49
+      })       
50
+     } else{
51
+       Taro.showToast({
52
+        title: '有必填项未填哦',
53
+        icon: 'none',
49 54
       })
55
+     }
56
+      
50 57
   }
51 58
   return (
52 59
     <view className='page-index'>
@@ -55,13 +62,13 @@ export default withLayout((props) => {
55 62
         <mp-form models={roomModel} >
56 63
           <mp-cells title='请填写新增的房源信息' footer='  ' >
57 64
             <mp-cell prop='roomName' title='房屋名称:' extClass='font'>
58
-              <input focus dataField='roomName' onInput={(e) => setRoomModel({ ...roomModel, roomName: e.detail.value })} value={roomModel.roomName}  placeholder='请输入房屋名称' />
65
+              <input focus dataField='roomName' onInput={(e) => setRoomModel({ ...roomModel, roomName: e.detail.value })} value={roomModel.roomName}  placeholder='请输入房屋名称(必填)' />
59 66
             </mp-cell>
60 67
             <mp-cell prop='address' title='位置信息:' extClass='font'>
61
-              <input dataField='address' onInput={(e) => setRoomModel({ ...roomModel, address: e.detail.value })} value={roomModel.address}  placeholder='请输入房屋位置' />
68
+              <input dataField='address' onInput={(e) => setRoomModel({ ...roomModel, address: e.detail.value })} value={roomModel.address}  placeholder='请输入房屋位置(必填)' />
62 69
             </mp-cell>
63 70
             <mp-cell prop='location' title='定位经纬度:' extClass='font'>
64
-              <label onClick={onRoomMap}>{roomModel.location == '' ? '房间定位' : roomModel.location}</label>
71
+              <label onClick={onRoomMap}>{roomModel.location == '' ? '房间定位(必填)' : roomModel.location}</label>
65 72
             </mp-cell>
66 73
             <mp-cell prop='parkingAddress' title='停车场位置:' extClass='font'>
67 74
               <input dataField='parkingAddress' onInput={(e) => setRoomModel({ ...roomModel, parkingAddress: e.detail.value })} value={roomModel.parkingAddress}  placeholder='请输入停车场位置' />
@@ -76,7 +83,7 @@ export default withLayout((props) => {
76 83
               <input dataField='wifiPassword' onInput={(e) => setRoomModel({ ...roomModel, wifiPassword: e.detail.value })} value={roomModel.wifiPassword}  placeholder='请输入wifi密码' />
77 84
             </mp-cell>
78 85
             <mp-cell prop='weight' title='权重:' extClass='font'>
79
-              <input type='number' dataField='weight'  onInput={(e) => setRoomModel({ ...roomModel, weight: e.detail.value })} placeholder='请输入权重' />
86
+              <input type='number' dataField='weight'  onInput={(e) => setRoomModel({ ...roomModel, weight: e.detail.value })} placeholder='请输入权重(必填)' />
80 87
             </mp-cell>
81 88
             <mp-cell>
82 89
               <button className='button-OK' onClick={sumbit}>确定</button>

+ 2
- 1
src/hotel/pages/landlord/landlord.config.js ファイルの表示

@@ -5,5 +5,6 @@ export default {
5 5
   usingComponents: {
6 6
     "mp-tabbar": "weui-miniprogram/tabbar/tabbar",
7 7
     "mp-dialog": "weui-miniprogram/dialog/dialog"
8
-  }
8
+  },
9
+  enableShareAppMessage: true
9 10
 }

+ 14
- 3
src/hotel/pages/landlord/landlord.jsx ファイルの表示

@@ -1,5 +1,5 @@
1
-import React, { useState, useEffect } from 'react'
2
-import { useRouter } from '@tarojs/taro'
1
+import React, { useState, useEffect, useRef } from 'react'
2
+import Taro,{ useRouter,useShareAppMessage } from '@tarojs/taro'
3 3
 import HouseManage from '../../components/HouseManage/houseManage'
4 4
 import Income from '../../components/Income/income'
5 5
 import TabBar from '@/components/CustTabBar'
@@ -23,6 +23,8 @@ export default withLayout((props) => {
23 23
   const [account, setAccount] = useState()
24 24
   const [accountlog, setAccountLog] = useState([])
25 25
 
26
+  const houseRef = useRef()
27
+
26 28
   useEffect(() => {
27 29
     getHotelManage().then((res) => {
28 30
       const { hotelList: list, account: acc, hotel: current } = res
@@ -59,12 +61,21 @@ export default withLayout((props) => {
59 61
     }
60 62
   }, [tab])
61 63
 
64
+  useShareAppMessage(() => {
65
+    return houseRef.current.getShareMessage()
66
+  })
67
+
68
+  useEffect(() => {
69
+    // 禁止右上角分享
70
+    Taro.hideShareMenu()
71
+  }, [])
72
+
62 73
   return (
63 74
     <view className='page-index'>
64 75
       <CustomNav title={hotel?.hotelName} logo={hotel?.logo} />
65 76
       <view className='index-container'>
66 77
         {currentTab === 0 && <Income hotelList={hotelList} hotel={hotel} account={account} onHotelChange={handleHotelChange} accountlog={accountlog} />}
67
-        {currentTab === 1 && <HouseManage hotel={hotel} />}
78
+        {currentTab === 1 && <HouseManage hotel={hotel} ref={houseRef} />}
68 79
       </view>
69 80
       <view className='index-tabbar'>
70 81
         <TabBar extClass='custom-tabbar bottomTab' current={currentTab} onChange={handleTabChange}>

+ 13
- 1
src/layouts/index.jsx ファイルの表示

@@ -2,14 +2,26 @@
2 2
 import { useMemo } from 'react'
3 3
 import Taro from '@tarojs/taro'
4 4
 import { useModel } from '@/store'
5
+import { getQueryString } from '@/utils'
5 6
 import useRouter from '@/utils/hooks/useRouter'
7
+import useTrackPage from '@/utils/hooks/useTrackPage'
6 8
 import Loading from './Loading'
7 9
 import { getPageBy, getIndexPageOf } from '../routes'
8 10
 
9 11
 export default (Child) => (props) => {
12
+  const location = Taro.getStorageSync('location')
13
+
10 14
   const { person } = useModel('person')
11 15
   const router = useRouter()
12 16
 
17
+  // 埋点页面访问
18
+  const trackPageData = {
19
+    page: router.path,
20
+    params: getQueryString(router.params),
21
+    location,
22
+  }
23
+  useTrackPage(trackPageData)
24
+
13 25
   // 确保人员信息到位
14 26
   const loading = !person?.personRole;
15 27
 
@@ -48,5 +60,5 @@ export default (Child) => (props) => {
48 60
     })
49 61
   }
50 62
 
51
-  return loading ? <Loading /> : <Child {...props} person={person} router={router} />
63
+  return loading ? <Loading /> : <Child {...props} person={person} router={router} location={location} />
52 64
 }

+ 6
- 3
src/pages/details/components/Extend/extend.jsx ファイルの表示

@@ -1,18 +1,21 @@
1 1
 import { Video } from '@tarojs/components';
2
+import './extend.less'
2 3
 
3 4
 export default (props) => {
4 5
   const { item } = props
5 6
   return (
6
-    <>{
7
+    <>
8
+    {
7 9
       item.contentType == 'image' ?
8
-        <image src={item.content} mode='widthFix' style={{ width: '100%' }} /> :
10
+        <image src={item.content} mode='widthFix' style={{ width: '100%'}} /> :
9 11
         item.contentType == 'text' ?
10 12
           <view className='storezn'>{item.content}</view> :
11 13
           <Video
12 14
             controls
13 15
             autoplay={false}
14 16
             loop={false}
15
-            muted={false} style={{ width: "100%", height: '200px' }} src={item.content}></Video>
17
+            muted={false} style={{ width: "100%", height: '200px' }} src={item.content}>              
18
+          </Video>
16 19
     }
17 20
     </>
18 21
   )

+ 6
- 0
src/pages/details/components/Extend/extend.less ファイルの表示

@@ -0,0 +1,6 @@
1
+.storezn{
2
+  font-size: 28px;    
3
+  color: #202020;
4
+  line-height: 54px;
5
+  margin-bottom: 40px;
6
+}

+ 3
- 0
src/pages/details/foodDetails/foodDetails.jsx ファイルの表示

@@ -2,7 +2,10 @@ import CustomNav from '@/components/CustomNav'
2 2
 import withLayout from '@/layouts'
3 3
 import { getShopDetail, getShopPackage, getExtendContent } from '@/services/home'
4 4
 import { useState, useEffect, useRef } from 'react'
5
+
5 6
 import { Swiper, SwiperItem } from '@tarojs/components';
7
+import BossCard from '@/components/BossCard'
8
+
6 9
 import Star from '@/components/Star/Star.jsx'
7 10
 import Cards from '@/components/foodCards/foodCards.jsx'
8 11
 import ax from '@/assets/icons/housemantj/onlove.png'

+ 3
- 0
src/pages/details/mjDetails/sceneryDetails.jsx ファイルの表示

@@ -1,4 +1,6 @@
1 1
 import CustomNav from '@/components/CustomNav'
2
+import BossCard from '@/components/BossCard'
3
+
2 4
 import ax from '../../../assets/icons/housemantj/onlove.png'
3 5
 import hongxin from '../../../assets/icons/housemantj/已收藏.png'
4 6
 import baixin from '../../../assets/icons/housemantj/收藏.png'
@@ -9,6 +11,7 @@ import showMore from '../../../assets/icons/housemantj/查看更多.png'
9 11
 import share from '../../../assets/icons/housemantj/景点分享.png'
10 12
 import good from '../../../assets/icons/housemantj/景点爆赞.png'
11 13
 import collection from '../../../assets/icons/housemantj/景点收藏.png'
14
+
12 15
 import withLayout from '@/layouts'
13 16
 import { useState, useEffect, useRef } from 'react'
14 17
 import { getTouristDetail, getExtendContent, getRecommendList } from '@/services/home'

+ 18
- 27
src/pages/details/mjDetails/sceneryDetails.less ファイルの表示

@@ -110,6 +110,23 @@
110 110
     margin-right: 10px;
111 111
   }
112 112
 }
113
+.showMore{
114
+  width: 100%;
115
+  background: linear-gradient(0deg, rgba(248, 248, 248, 0.58) 42%, rgba(248, 248, 248, 0) 100%);
116
+  font-size: 28px;
117
+  font-weight: bold;
118
+  color: #202020;
119
+  text-align: center;
120
+  position: absolute;
121
+  bottom: -40px;
122
+  padding-top: 77px;
123
+  padding-bottom: 20px;
124
+  .moreTip{
125
+    width: 38px;
126
+    height: 19px;
127
+    margin-top: 14px;
128
+  }
129
+}
113 130
 .foodCard{
114 131
   background: #FFF;
115 132
   box-shadow: 0px 8px 38px 0px rgba(0, 0, 0, 0.12);
@@ -245,33 +262,7 @@
245 262
     bottom:15%;
246 263
   }
247 264
 }
248
-.showMore{
249
-  width: 100%;
250
-  background: linear-gradient(0deg, rgba(248, 248, 248, 0.58) 42%, rgba(248, 248, 248, 0) 100%);
251
-  font-size: 28px;
252
-  font-weight: bold;
253
-  color: #202020;
254
-  text-align: center;
255
-  position: absolute;
256
-  bottom: -40px;
257
-  padding-top: 77px;
258
-  padding-bottom: 20px;
259
-  .moreTip{
260
-    width: 38px;
261
-    height: 19px;
262
-    margin-top: 14px;
263
-  }
264
-}
265
-.storezn{
266
-  font-size: 28px;
267
-    
268
-    color: #202020;
269
-  line-height: 54px;
270
-  margin-bottom: 40px;
271
-}
272
-.storezn+image{
273
-  width: 100%;
274
-}  
265
+
275 266
 .bottom{
276 267
   font-size: 28px;    
277 268
   color: #C0C8D3;

+ 1
- 0
src/pages/index/index.config.js ファイルの表示

@@ -4,6 +4,7 @@ export default {
4 4
   styleIsolation: 'shared',
5 5
   usingComponents: {
6 6
     "mp-tabbar": "weui-miniprogram/tabbar/tabbar",
7
+    "mp-tabs": "../../../components/tabs/index",
7 8
     "mp-checkbox-group": "weui-miniprogram/checkbox-group/checkbox-group",
8 9
     "mp-checkbox": "weui-miniprogram/checkbox/checkbox",
9 10
     "mp-cells": "weui-miniprogram/cells/cells",

+ 21
- 2
src/pages/index/index.jsx ファイルの表示

@@ -1,4 +1,4 @@
1
-import React, { useState, useEffect } from 'react'
1
+import React, { useState, useEffect,useRef } from 'react'
2 2
 import Taro from '@tarojs/taro'
3 3
 import CustomNav from '@/components/CustomNav'
4 4
 import logo from '@/assets/icons/comm/logo_small.png'
@@ -8,6 +8,10 @@ import Guide from './tabs/Guide'
8 8
 import Mine from './tabs/Mine'
9 9
 import Recommend from './tabs/Recommend'
10 10
 import './index.less'
11
+import { getLocation } from '@/utils/location'
12
+import { getIndexType,  getResourceList } from '@/services/home'
13
+
14
+
11 15
 
12 16
 export default withLayout((props) => {
13 17
   const { router, person } = props
@@ -16,12 +20,27 @@ export default withLayout((props) => {
16 20
 
17 21
   const [currentTab, setCurrentTab] = useState(0)
18 22
 
23
+  const locRef = useRef()
24
+
19 25
 
20 26
   const handleTabChange = (e) => {
21 27
     const { index } = e.detail
22 28
     setCurrentTab(index)
23 29
   }
24 30
 
31
+  const [queryParams, setQueryParams] = useState({ location: '', pageNum: 1, pageSize: 10, typeId: '' })
32
+
33
+
34
+  useEffect(() => {
35
+    getLocation().then((res) => {
36
+      locRef.current = `${res.longitude},${res.latitude}`
37
+      setQueryParams({
38
+        ...queryParams,
39
+        location: locRef.current
40
+      })
41
+    })  
42
+  }, [])
43
+
25 44
   useEffect(() => {
26 45
     if (tab) {
27 46
       setCurrentTab(tab - 0)
@@ -33,7 +52,7 @@ export default withLayout((props) => {
33 52
         <CustomNav logo={logo} title='十公里' />
34 53
       </view>
35 54
       <view className='index-container'>
36
-        {currentTab === 0 && <Recommend />}
55
+        {currentTab === 0 && <Recommend loc={locRef} qp={queryParams}/>}
37 56
         {currentTab === 1 && <Guide person={person} router={router} />}
38 57
         {/* {currentTab === 2 && <Strategy />} */}
39 58
         {currentTab === 2 && <Mine person={person} />}

+ 1
- 12
src/pages/index/tabs/Guide.jsx ファイルの表示

@@ -1,21 +1,13 @@
1 1
 import { useState, useEffect, useRef } from "react";
2 2
 import Taro from '@tarojs/taro'
3 3
 import MoreGuide from "@/components/MoreGuide";
4
-import Cards from '@/components/foodCards/foodCards.jsx'
5 4
 import BossCard from '@/components/BossCard'
6
-import image from '@/assets/icons/ProCard/8kb.jpg'
7
-import Pay from '@/assets/icons/GuideCheck/Pay_logo.png'
8
-import food from '@/assets/icons/ProCard/food.png'
9
-import ProCard_hot from '@/assets/icons/ProCard/ProCard_hot.png'
10 5
 import Taxi from '@/assets/icons/GuideCheck/taxi.png'
11 6
 import WiFi from '@/assets/icons/GuideCheck/WiFi.png'
12 7
 import GoHere from '@/assets/icons/GuideCheck/GoHere.png'
13
-import position from '@/assets/icons/GuideCheck/position_logo.png'
14 8
 import Cup from '@/assets/icons/GuideCheck/Cup.png'
15 9
 import BlackSpot from '@/assets/icons/GuideCheck/BlackSpot.png'
16
-import starOn from '@/assets/icons/GuideCheck/starOn.png'
17
-import starOff from '@/assets/icons/GuideCheck/starOff.png'
18
-import { getRecommendList, getExtendContent, getShopPackage } from '@/services/home'
10
+import { getRecommendList, getExtendContent } from '@/services/home'
19 11
 import sleep from '@/assets/icons/GuideCheck/sleep_logo.png'
20 12
 import { getTaRoom, goToRoomForm } from '@/services/taRoom​'
21 13
 import showMore from '../../../assets/icons/housemantj/查看更多.png'
@@ -23,8 +15,6 @@ import showMore from '../../../assets/icons/housemantj/查看更多.png'
23 15
 import './GuideCss/style.less'
24 16
 
25 17
 
26
-const scoreList = new Array(5).fill(0)
27
-const score = '3.9'
28 18
 
29 19
 
30 20
 
@@ -243,7 +233,6 @@ export default (props) => {
243 233
           </view>
244 234
         </view>
245 235
         {spackage?.map((item, index) => <BossCard key={(index)} item={item} />)}
246
-
247 236
         {/* 卡片------------- */}
248 237
         {/* <view className='Guide-Content-box-two'>
249 238
           <view className='title-image-two'>

+ 10
- 15
src/pages/index/tabs/Recommend.jsx ファイルの表示

@@ -11,15 +11,20 @@ import './less/Recommend.less'
11 11
 
12 12
 
13 13
 export default (props) => {
14
-  const { router, person } = props
14
+  const { router, person, loc,qp } = props
15 15
   const [activeTab, setActiveTab] = useState(0)
16 16
   const { params } = useRouter()
17 17
   const { tabJump } = params || {}
18 18
   const [typeList, setTypeList] = useState([])
19 19
   
20
-  const locRef = useRef()
21
-
22
-  const [queryParams, setQueryParams] = useState({ location: '', pageNum: 1, pageSize: 10, typeId: '' })
20
+  const locRef = useRef(loc)
21
+  // if(locRef.current==null){
22
+  //     Taro.showLoading()
23
+  //   }
24
+  //   if (locRef.current!=null) {
25
+  //     Taro.hideLoading()
26
+  //   }
27
+  const [queryParams, setQueryParams] = useState(qp)
23 28
 
24 29
   // 获取资源表信息
25 30
   const [alllist, setAllList] = useState([])
@@ -40,14 +45,7 @@ export default (props) => {
40 45
   }
41 46
 
42 47
   useEffect(() => {
43
-    getLocation().then((res) => {
44
-      locRef.current = `${res.longitude},${res.latitude}`
45
-      setQueryParams({
46
-        ...queryParams,
47
-        location: locRef.current
48
-      })
49
-    })
50
-
48
+    
51 49
     //查询分类标签表
52 50
     getIndexType({ pageSize: 20 }).then((res) => {
53 51
       setTypeList(res.records || [])
@@ -78,9 +76,6 @@ export default (props) => {
78 76
   }
79 77
 
80 78
 
81
-  const RefreshCard=()=>{
82
-    console.log(1111)
83
-  }
84 79
 
85 80
   
86 81
   return (

+ 2
- 2
src/pages/index/tabs/less/Recommend.less ファイルの表示

@@ -141,7 +141,7 @@
141 141
     }
142 142
   }
143 143
   .tabs-Unselected {
144
-    width: 20vw;      
144
+    width: 25vw;      
145 145
     font-weight: bold;
146 146
     color: #C0C8D3; 
147 147
     text-align: center;
@@ -154,7 +154,7 @@
154 154
   .tabs-Selected {
155 155
     font-size: 32px;
156 156
     color: #4C4C4C;
157
-    width: 20vw;      
157
+    width: 25vw;      
158 158
     font-weight: bold;
159 159
     text-align: center;
160 160
     border-bottom: 6px solid #4C4C4C;

+ 3
- 4
src/services/landlord.js ファイルの表示

@@ -53,9 +53,8 @@ import request from '@/utils/request'
53 53
 
54 54
 
55 55
 /**
56
- * 房源详情
57
- * @param {*} id 
56
+ * 分享房源
57
+ * @param {*} data 
58 58
  * @returns 
59 59
  */
60
-export const getRoomDetail = (id) => request(`/taRoom/${id}`)
61
-
60
+ export const shareRoom = (data) => request('/roomOrder', { method: 'post', data })

+ 27
- 0
src/services/shopBoss.js ファイルの表示

@@ -0,0 +1,27 @@
1
+
2
+import request from '@/utils/request'
3
+
4
+
5
+/**
6
+ * 商铺老板详情
7
+ * @param {*} 
8
+ * @returns 
9
+ */
10
+export const getShopList = (params) => request(`/shop/manage/index`, { params })
11
+
12
+
13
+/**
14
+ * 商铺账户全年订单收入/推广
15
+ * @param {*} 
16
+ * @returns 
17
+ */
18
+export const getShopMoney = (id, amountType) => request(`/shop/${id}/account?amountType=${amountType}`, { id })
19
+
20
+
21
+/**
22
+ * 商铺推广收入
23
+ * @param {*} 
24
+ * @returns 
25
+ */
26
+export const getAccount = (id,) => request(`/shop/account/${id}/log`, { id })
27
+

+ 15
- 0
src/services/track.js ファイルの表示

@@ -0,0 +1,15 @@
1
+import request from '@/utils/request'
2
+
3
+/**
4
+ * 埋点页面访问
5
+ * @param {*} data 
6
+ * @returns 
7
+ */
8
+export const trackPage = (data) => request('/track/page', { data, method: 'post', skipError: true })
9
+
10
+/**
11
+ * 更新埋点访问
12
+ * @param {*} id 
13
+ * @returns 
14
+ */
15
+export const updateTrackPage = (id) => request(`/track/page/${id}`, { method: 'put', skipError: true })

+ 32
- 63
src/shop/components/ShopKeeper/shopKeeper.jsx ファイルの表示

@@ -1,7 +1,10 @@
1 1
 import { React, useState, useEffect, } from 'react'
2 2
 import Taro, { useRouter } from '@tarojs/taro'
3 3
 import CustomNav from '@/components/CustomNav'
4
+import Picker from '@/components/Picker'
4 5
 import Popup from '@/components/Popup'
6
+import ShopUsed from '@/components/ShopUsed' //已核销
7
+import ShopUnused from '@/components/ShopUnused' //未核销
5 8
 import eyes from '@/assets/icons/shopKeeper/小眼睛.png'
6 9
 import ceyes from '@/assets/icons/shopKeeper/小眼睛-闭上.png'
7 10
 import iconsearch from '@/assets/icons/housemantj/search.png'
@@ -18,10 +21,26 @@ import ToggleRole from '@/components/toggleRole/ToggleRole'
18 21
 
19 22
 
20 23
 export default (props) => {
21
-
24
+  const { shopList, shop, account, onHotelChange, accountlog, shopMoney } = props
22 25
   const [activeTab, setActiveTab] = useState(0)
23 26
   const { params } = useRouter()
24 27
   const { tabJump } = params || {}
28
+
29
+  const [isyear, setYear] = useState(false)
30
+  const [isMomth, setMonth] = useState(false)
31
+  //小眼睛开关
32
+  const handleYear = () => {
33
+    isyear ? setYear(false) : setYear(true)
34
+  }
35
+  const handleMonth = () => {
36
+    isMomth ? setMonth(false) : setMonth(true)
37
+  }
38
+
39
+
40
+  const handleHotelChange = (shopId, current) => {
41
+    onHotelChange(current)
42
+  }
43
+
25 44
   useEffect(() => {
26 45
     if (tabJump) {
27 46
       setActiveTab(tabJump - 0)
@@ -41,6 +60,7 @@ export default (props) => {
41 60
     },
42 61
   ]
43 62
 
63
+
44 64
   const [showCutover, setShowCutover] = useState(false)
45 65
   const ShowMoldeOn = () => {
46 66
     setShowCutover(true)
@@ -51,14 +71,12 @@ export default (props) => {
51 71
   return (
52 72
     <view>
53 73
       <view>
54
-        <CustomNav title='十公里' />
55 74
       </view>
56 75
       <ToggleRole showCutover={showCutover} onClose={onClose} role='shop' />
57
-
58 76
       <view style={{ padding: '30rpx', height: '100%' }}>
59
-        <scroll-view scroll-y="true" scroll-view='true' bindscrolltoupper="upper" bindscrolltolower="lower" bindscroll="scroll" style={{ height: 'calc(100vh - 120px)' }}>
77
+        <scroll-view scroll-y scroll-view='true' bindscrolltoupper="upper" bindscrolltolower="lower" bindscroll="scroll" style={{ height: 'calc(100vh - 120px)' }}>
60 78
           <view className='storexx'>
61
-            <view className='storeName'>店名:<text>Yun咖 云里 咖啡店</text></view>
79
+            <view className='storeName'>店名:<Picker style={{ display: 'inline-block' }} placeholder="请选择商铺" value={shop?.shopId} kv={['shopName', 'shopId']} dicts={shopList} onChange={handleHotelChange} /></view>
62 80
             <view onClick={ShowMoldeOn} className='User-info-cutover'>
63 81
               <image className='User-info-cutover-image' src={cutoverUser} />
64 82
             </view>
@@ -66,17 +84,18 @@ export default (props) => {
66 84
             <view className='money'>
67 85
               <view className='sleft'>
68 86
                 <view className='lword'>全年订单收入(税前)</view>
87
+
69 88
                 <view className='yearMoney'>
70
-                  <text>2800000</text>元
71
-                  <image className='micon' src={eyes}></image>
89
+                  <text>{isyear ? shopMoney?.totalCharges : '******'}</text>元
90
+                  <image className='micon' src={isyear ? eyes : ceyes} onClick={handleYear} />
72 91
                 </view>
73 92
               </view>
74 93
               <view className='line' />
75 94
               <view className='sright'>
76 95
                 <view className='rword'>当月订单收入(税前)</view>
77 96
                 <view className='monthMoney'>
78
-                  <text>******</text>元
79
-                  <image className='micon2' src={ceyes}></image>
97
+                  <text>{isMomth ? shopMoney?.currentCharges : '******'}</text>元
98
+                  <image className='micon2' src={isMomth ? eyes : ceyes} onClick={handleMonth}></image>
80 99
                 </view></view>
81 100
             </view>
82 101
           </view>
@@ -99,64 +118,14 @@ export default (props) => {
99 118
           </view>
100 119
 
101 120
           <view>
121
+            {/* 未核销 */}
102 122
             {activeTab === 0 &&
103
-              <view className='orderCard'>
104
-                <view style={{ overflow: 'hidden' }}>
105
-                  <view className='orderId'>订单编号:<text>ABC123456789</text></view>
106
-                  <view className='orderTime'>下单日期:<text>2021-06-22 12:35</text></view>
107
-                </view>
108
-                <view className='order'>
109
-                  <image className='orderImg' src={ms} mode='aspectFit' />
110
-                  <view className='orderRight'>
111
-                    <view className='foodName'>【SEOUL.创意韩国料理】火爆全南京,
112
-                      新街口又开新店啦...</view>
113
-                    <view className='price'>合计金额:¥<text style={{ fontSize: '24rpx' }}>88</text>元 <text className='pnum'>数量:<text>1</text>张</text> </view>
114
-                    <view>已下单:等待客户上门就餐</view>
115
-                  </view>
116
-                  <view className='line' />
117
-                  <view className='phone'>客户手机:<text>136****9434</text></view>
118
-                  <view className='tripTime'>客户行程日期:预计在<text>2021-06-21中下午10:30-16:30</text></view>
119
-                </view>
120
-              </view>
123
+              <ShopUnused />
121 124
             }
125
+            {/* 已核销 */}
122 126
             {activeTab === 1 &&
123 127
               <>
124
-                <view className='orderCard'>
125
-                  <view style={{ overflow: 'hidden' }}>
126
-                    <view className='orderId'>订单编号:<text>ABC123456789</text></view>
127
-                    <view className='orderTime'>下单日期:<text>2021-06-22 12:35</text></view>
128
-                  </view>
129
-                  <view className='order'>
130
-                    <image className='orderImg' src={ms} mode='aspectFit' />
131
-                    <view className='orderRight'>
132
-                      <view className='foodName'>【SEOUL.创意韩国料理】火爆全南京,
133
-                        新街口又开新店啦...</view>
134
-                      <view className='price'>合计金额:¥<text style={{ fontSize: '24rpx' }}>88</text>元 <text className='pnum'>数量:<text>1</text>张</text> </view>
135
-                      <view>已下单:等待客户上门就餐</view>
136
-                    </view>
137
-                    <view className='line' />
138
-                    <view className='phone'>客户手机:<text>136****9434</text></view>
139
-                    <view className='tripTime'>客户行程日期:预计在<text>2021-06-21中下午10:30-16:30</text></view>
140
-                  </view>
141
-                </view>
142
-                <view className='orderCard'>
143
-                  <view style={{ overflow: 'hidden' }}>
144
-                    <view className='orderId'>订单编号:<text>ABC123456789</text></view>
145
-                    <view className='orderTime'>下单日期:<text>2021-06-22 12:35</text></view>
146
-                  </view>
147
-                  <view className='order'>
148
-                    <image className='orderImg' src={ms} mode='aspectFit' />
149
-                    <view className='orderRight'>
150
-                      <view className='foodName'>【SEOUL.创意韩国料理】火爆全南京,
151
-                        新街口又开新店啦...</view>
152
-                      <view className='price'>合计金额:¥<text style={{ fontSize: '24rpx' }}>88</text>元 <text className='pnum'>数量:<text>1</text>张</text> </view>
153
-                      <view>已下单:等待客户上门就餐</view>
154
-                    </view>
155
-                    <view className='line' />
156
-                    <view className='phone'>客户手机:<text>136****9434</text></view>
157
-                    <view className='tripTime'>客户行程日期:预计在<text>2021-06-21中下午10:30-16:30</text></view>
158
-                  </view>
159
-                </view>
128
+                <ShopUsed />
160 129
               </>
161 130
             }
162 131
           </view>

+ 16
- 3
src/shop/components/ShopKeeper/shopKeeper.less ファイルの表示

@@ -136,10 +136,10 @@
136 136
         color: #FF3434;
137 137
       }
138 138
       .micon2{
139
-        width: 34px;
140
-        height: 16px;
139
+        width: 38px;
140
+        height: 22px;
141 141
         margin-left: 23px;
142
-        margin-bottom: 7px;
142
+        margin-bottom: -2px;
143 143
       }
144 144
     }
145 145
   }
@@ -265,6 +265,19 @@
265 265
       height: 23px;
266 266
       margin: 30px 0;
267 267
     }
268
+    .button-OK{
269
+      width: 160px;
270
+    height: 40px;
271
+    background: #1A3B83;
272
+    /* margin: 0 auto; */
273
+    line-height: 40px;
274
+    border-radius: 12px;
275
+    font-size: 23px;
276
+    color: #ffffff;
277
+    position: relative;
278
+    right: -8em;
279
+    top: -2em;
280
+    }
268 281
     .tripTime{
269 282
       font-size: 24px;
270 283
       color: #666666;

+ 50
- 24
src/shop/components/Sparead/spreadMoney.jsx ファイルの表示

@@ -1,19 +1,54 @@
1
-import { useState } from 'react'
1
+import { useState, useEffect } from 'react'
2 2
 import Taro from '@tarojs/taro'
3 3
 import CustomNav from '@/components/CustomNav'
4 4
 import Popup from '@/components/Popup'
5
+import Picker from '@/components/Picker'
6
+import ShopCommission from '@/components/ShopCommission'
5 7
 import eyes from '@/assets/icons/shopKeeper/小眼睛.png'
6 8
 import ceyes from '@/assets/icons/shopKeeper/小眼睛-闭上.png'
7 9
 import cutoverUser from '@/assets/icons/UserCenter/cutoverUser.png'
8 10
 import touristOFF from '@/assets/icons/UserCenter/touristOFF.png'
9 11
 import hotelBossOFF from '@/assets/icons/UserCenter/hotelBossOFF.png'
10 12
 import shopBossON from '@/assets/icons/UserCenter/shopBossON.png'
13
+import { getAccount } from '@/services/shopBoss'
14
+
11 15
 import './spreadMoney.less'
12 16
 import ToggleRole from '@/components/toggleRole/ToggleRole'
13 17
 
14 18
 export default (props) => {
15
-
19
+  const { shopList, shop, account, onHotelChange, accountlog, shopMoney } = props
16 20
   const [showCutover, setShowCutover] = useState(false)
21
+  const [isyear, setYear] = useState(false)
22
+  const [isMomth, setMonth] = useState(false)
23
+  const [shopAccount, setShopAccount] = useState([])
24
+  const acc = shopMoney?.acc
25
+  const { accountId } = acc
26
+
27
+
28
+
29
+  useEffect(() => {
30
+    getAccount(accountId).then((e) => {
31
+      const accContent = e.records
32
+      setShopAccount(accContent)
33
+
34
+    })
35
+  }, [accountId])
36
+
37
+  //小眼睛开关
38
+  const handleYear = () => {
39
+    isyear ? setYear(false) : setYear(true)
40
+  }
41
+  const handleMonth = () => {
42
+    isMomth ? setMonth(false) : setMonth(true)
43
+  }
44
+
45
+  //商铺更改
46
+  const handleHotelChange = (shopId, current) => {
47
+    onHotelChange(current)
48
+  }
49
+
50
+
51
+
17 52
   const ShowMoldeOn = () => {
18 53
     setShowCutover(true)
19 54
   }
@@ -24,13 +59,12 @@ export default (props) => {
24 59
   return (
25 60
     <view>
26 61
       <view>
27
-        <CustomNav title='十公里' />
28 62
       </view>
29 63
       <ToggleRole showCutover={showCutover} onClose={onClose} role='shop' />
30 64
       <view style={{ padding: '30rpx', height: '100%' }}>
31 65
         <scroll-view scroll-y="true" scroll-view='true' bindscrolltoupper="upper" bindscrolltolower="lower" bindscroll="scroll" style={{ height: 'calc(100vh - 120px)' }}>
32 66
           <view className='storexx'>
33
-            <view className='storeName'>店名:<text>Yun咖 云里 咖啡店</text></view>
67
+            <view className='storeName'>店名:<Picker style={{ display: 'inline-block' }} placeholder="请选择商铺" value={shop?.shopId} kv={['shopName', 'shopId']} dicts={shopList} onChange={handleHotelChange} /></view>
34 68
             <view onClick={ShowMoldeOn} className='User-info-cutover'>
35 69
               <image className='User-info-cutover-image' src={cutoverUser} />
36 70
             </view>
@@ -39,36 +73,28 @@ export default (props) => {
39 73
               <view className='sleft'>
40 74
                 <view className='lword'>全年推广收入(税前)</view>
41 75
                 <view className='yearMoney'>
42
-                  <text>2800000</text>元
43
-                  <image className='micon' src={eyes}></image>
76
+                  <text>{isyear ? shopMoney?.totalCharges : '******'}</text>元
77
+                  <image className='micon' src={isyear ? eyes : ceyes} onClick={handleYear} />
44 78
                 </view>
45 79
               </view>
46 80
               <view className='line' />
47 81
               <view className='sright'>
48 82
                 <view className='rword'>当月推广收入(税前)</view>
49 83
                 <view className='monthMoney'>
50
-                  <text>******</text>元
51
-                  <image className='micon2' src={ceyes}></image>
84
+                  <text>{isMomth ? shopMoney?.currentCharges : '******'}</text>元
85
+                  <image className='micon2' src={isMomth ? eyes : ceyes} onClick={handleMonth}></image>
52 86
                 </view></view>
53 87
             </view>
54 88
           </view>
55 89
           <view className='title'>推广收入记录</view>
56
-          <view>
57
-            <view className='spreadCard'>
58
-              <view className='spreadDate'>日期:<text>2021-06-24</text></view>
59
-              <view className='card'>
60
-                <view className='spreadTime'>时&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;间:<text>2021-06-24  20:45</text></view>
61
-                <view className='spreadMoney'>收入金额:<text>5.00</text>元</view>
62
-              </view>
63
-            </view>
64
-            <view className='spreadCard'>
65
-              <view className='spreadDate'>日期:<text>2021-06-24</text></view>
66
-              <view className='card'>
67
-                <view className='spreadTime'>时&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;间:<text>2021-06-24  20:45</text></view>
68
-                <view className='spreadMoney'>收入金额:<text>5.00</text>元</view>
69
-              </view>
70
-            </view>
71
-          </view>
90
+          {
91
+            shopAccount.map((item, index) => {
92
+              return (
93
+                <ShopCommission item={item} />
94
+
95
+              )
96
+            })
97
+          }
72 98
           <view className='botton'>已经到底了~</view>
73 99
         </scroll-view>
74 100
       </view>

+ 4
- 24
src/shop/components/Sparead/spreadMoney.less ファイルの表示

@@ -138,10 +138,10 @@
138 138
         color: #FF3434;
139 139
       }
140 140
       .micon2{
141
-        width: 34px;
142
-        height: 16px;
141
+        width: 38px;
142
+        height: 22px;
143 143
         margin-left: 23px;
144
-        margin-bottom: 7px;
144
+        margin-bottom: -2px;
145 145
       }
146 146
     }
147 147
   }
@@ -152,27 +152,7 @@
152 152
   line-height: 60px;
153 153
   margin: 62px 0 10px 1px;
154 154
 }
155
-.spreadCard{
156
-  margin-bottom: 1px;
157
-  .spreadDate{
158
-    font-size: 20px;
159
-    color: #202020;
160
-    line-height: 60px;
161
-  }
162
-  .card{
163
-    height: 166px;
164
-    background: #FFF;
165
-    box-shadow: 0px 8px 32px 0px rgba(0, 0, 0, 0.08);
166
-    border-radius: 12px;
167
-    padding: 40px 0 43px 22px;
168
-    font-size: 24px;
169
-    color: #202020;
170
-    box-sizing: border-box;
171
-    .spreadMoney{
172
-      line-height: 60px;
173
-    }
174
-  }
175
-}
155
+
176 156
 .botton{
177 157
   font-size: 28px;   
178 158
   color: #C0C8D3;

+ 59
- 5
src/shop/pages/spread/spreadIndex.jsx ファイルの表示

@@ -1,5 +1,7 @@
1 1
 import React, { useState, useEffect } from 'react'
2
+import CustomNav from '@/components/CustomNav'
2 3
 import { useRouter } from '@tarojs/taro'
4
+import { getShopList, getShopMoney, getAccount } from '@/services/shopBoss'
3 5
 import ShopKeeper from '../../components/ShopKeeper/shopKeeper'
4 6
 import Sparead from '../../components/Sparead/spreadMoney'
5 7
 import TabBar from '@/components/CustTabBar'
@@ -7,22 +9,72 @@ import shopImg from '@/assets/icons/shopKeeper/订单收入.png'
7 9
 import onShopImg from '@/assets/icons/shopKeeper/订单收入按下.png'
8 10
 import spareadImg from '@/assets/icons/shopKeeper/推广收入.png'
9 11
 import onSpareadImg from '@/assets/icons/shopKeeper/推广收入按下.png'
10
-import './spreadIndex.less'
11 12
 import withLayout from '@/layouts'
12 13
 
14
+import './spreadIndex.less'
15
+
16
+
13 17
 export default withLayout((props) => {
14 18
   const { router, person } = props
15 19
 
16 20
   const { params } = useRouter()
17 21
   const { tab } = params || {}
18
-
19 22
   const [currentTab, setCurrentTab] = useState(0)
23
+  const [shopList, setShopList] = useState([])
24
+  const [shop, setShop] = useState()
25
+  const shopId = shop?.shopId
26
+  console.log("🚀 ~ file: spreadIndex.jsx ~ line 26 ~ withLayout ~ shopId", shopId)
27
+  const [account, setAccount] = useState()
28
+  const [accountlog, setAccountLog] = useState([])
20 29
 
30
+  const [amountType, setAmountType] = useState('order')
31
+  const [shopMoney, setShopMoney] = useState([])
21 32
   const handleTabChange = (e) => {
22 33
     const { index } = e.detail
23 34
     setCurrentTab(index)
24 35
   }
25 36
 
37
+  const handelType = () => {
38
+    setAmountType('commission')
39
+  }
40
+
41
+  useEffect(() => {
42
+    getShopList().then((res) => {
43
+      const { shopList: list, account: acc, shop: current } = res
44
+      setShopList(list)
45
+      setShop(current)
46
+      setAccount(acc)
47
+      console.log("🚀 ~ file: shopKeeper.jsx ~ line 48 ~ getShopList ~ res", res)
48
+
49
+
50
+
51
+    })
52
+
53
+  }, [])
54
+
55
+  useEffect(() => {
56
+    if (shopId) {
57
+      getShopMoney(shopId, amountType).then((e) => {
58
+        setShopMoney(e)
59
+
60
+      })
61
+    }
62
+
63
+  }, [amountType, shopId])
64
+
65
+
66
+  const handleHotelChange = (current) => {
67
+    console.log('已选择店铺', current);
68
+    // getNowHotelManage(current.shopId).then((res) => {
69
+    //   const { account: acc } = res
70
+    //   setAccount(acc)
71
+    //   setHotel(current)
72
+    //   getAccountLogList(acc.accountId).then((res2) => {
73
+    //     setAccountLog(res2.records || [])
74
+    //   })
75
+    // })
76
+  }
77
+
26 78
   useEffect(() => {
27 79
     if (tab) {
28 80
       setCurrentTab(tab - 0)
@@ -31,16 +83,18 @@ export default withLayout((props) => {
31 83
 
32 84
   return (
33 85
     <view className='page-index'>
86
+      <CustomNav title={shop?.shopName} />
87
+
34 88
       <view className='index-container'>
35
-        {currentTab === 0 && <ShopKeeper />}
36
-        {currentTab === 1 && <Sparead />}
89
+        {currentTab === 0 && <ShopKeeper shopList={shopList} shop={shop} account={account} onHotelChange={handleHotelChange} accountlog={accountlog} shopMoney={shopMoney} />}
90
+        {currentTab === 1 && <Sparead shopList={shopList} shop={shop} account={account} onHotelChange={handleHotelChange} accountlog={accountlog} shopMoney={shopMoney} />}
37 91
       </view>
38 92
       <view className='index-tabbar'>
39 93
         <TabBar extClass='custom-tabbar bottomTab' current={currentTab} onChange={handleTabChange}>
40 94
           <view className={`${currentTab === 0 ? 'orderstab' : ''}`}>
41 95
             <image className='incomes' src={currentTab === 0 ? onShopImg : shopImg} /><text>订单收入</text>
42 96
           </view>
43
-          <view className={`${currentTab === 1 ? 'spreadtab' : ''}`}>
97
+          <view className={`${currentTab === 1 ? 'spreadtab' : ''}`} onClick={() => { handelType() }} >
44 98
             <image className='house' src={currentTab === 1 ? onSpareadImg : spareadImg} /><text>推广收入</text>
45 99
           </view>
46 100
         </TabBar>

+ 25
- 0
src/utils/hooks/useTrackPage.js ファイルの表示

@@ -0,0 +1,25 @@
1
+
2
+import { useRef } from 'react'
3
+import { useDidShow, useDidHide, nextTick } from '@tarojs/taro'
4
+import { trackPage, updateTrackPage } from '@/services/track'
5
+
6
+export default (payload) => {
7
+  const payloadRef = useRef()
8
+  const resRef = useRef()
9
+  payloadRef.current = payload
10
+
11
+  useDidShow(() => {
12
+    trackPage(payloadRef.current).then((res) => {
13
+      resRef.current = res;
14
+    }).catch((err) => {
15
+      console.error(err);
16
+    })
17
+  })
18
+
19
+  useDidHide(() => {
20
+    if (resRef.current) {
21
+      updateTrackPage(resRef.current.trackId)
22
+      resRef.current = undefined
23
+    }
24
+  })
25
+}

+ 22
- 0
src/utils/index.js ファイルの表示

@@ -1,4 +1,9 @@
1 1
 
2
+/**
3
+ * queryString 转 object
4
+ * @param {*} queryStr 
5
+ * @returns 
6
+ */
2 7
 export function parseQueryString(queryStr) {
3 8
   if (!queryStr) {
4 9
     return;
@@ -20,3 +25,20 @@ export function parseQueryString(queryStr) {
20 25
   }, {});
21 26
   return params;
22 27
 }
28
+
29
+/**
30
+ * object 转 queryStr
31
+ * @param {*} params 
32
+ * @returns 
33
+ */
34
+export function getQueryString(params) {
35
+  if (!params) return ;
36
+
37
+  const keys = Object.keys(params)
38
+  const arr = keys.map((key) => {
39
+    const val = params[key]
40
+    return `${key}=${encodeURIComponent(val)}`
41
+  })
42
+
43
+  return arr.join('&')
44
+}

+ 17
- 1
src/utils/preFetchData.js ファイルの表示

@@ -5,7 +5,23 @@ export default () => {
5 5
   const personId = Taro.getStorageSync('personId')
6 6
   const openid = Taro.getStorageSync('openid')
7 7
 
8
-  return Promise.resolve({ personId, openid })
8
+  return new Promise((resolve, reject) => {
9
+    Taro.getLocation({
10
+      success(res) {
11
+        const location = `${res.longitude},${res.latitude}`
12
+        Taro.setStorageSync('location', location)
13
+        resolve({
14
+          location,
15
+          personId,
16
+          openid
17
+        })
18
+      },
19
+      fail(err) {
20
+        console.error(err)
21
+        reject(err)
22
+      }
23
+    })
24
+  })
9 25
 
10 26
   // return new Promise((resolve, reject) => {
11 27
   //   Taro.getBackgroundFetchData({

+ 2
- 13
src/utils/request.js ファイルの表示

@@ -1,23 +1,12 @@
1 1
 
2 2
 import Taro from '@tarojs/taro'
3
+import { getQueryString } from '.'
3 4
 
4 5
 const logger = Taro.getRealtimeLogManager()
5 6
 
6
-const object2QueryString = (params) => {
7
-  if (!params) return ;
8
-
9
-  const keys = Object.keys(params)
10
-  const arr = keys.map((key) => {
11
-    const val = params[key]
12
-    return `${key}=${encodeURIComponent(val)}`
13
-  })
14
-
15
-  return arr.join('&')
16
-}
17
-
18 7
 export default (url, options) => {
19 8
   const { params, skipError, header, ...leftOptions } = options || {}
20
-  const queryStr = object2QueryString(params)
9
+  const queryStr = getQueryString(params)
21 10
 
22 11
   const urlWithParams = queryStr ? `${url}?${queryStr}` : url;
23 12
   const nwUrl = `${HOST}/api/wx${urlWithParams}`