李志伟 3 years ago
parent
commit
d4cf659111

+ 2
- 2
src/components/Popup/index.jsx View File

@@ -2,10 +2,10 @@
2 2
 import './style.less'
3 3
 
4 4
 export default (props) => {
5
-  const { show, mask = true, maskClosable, onClose } = props
5
+  const { show, mask = true,  onClose } = props
6 6
 
7 7
   return (
8
-    <mp-dialog extClass='x-popup' buttons={[]} show={show} mask={mask} maskClosable={maskClosable} onClose={onClose}>
8
+    <mp-dialog extClass='x-popup'  buttons={[]} show={show} mask={mask} maskClosable={true} onClose={onClose}>
9 9
       {props.children}
10 10
     </mp-dialog>
11 11
   )

+ 30
- 54
src/components/spreads/Sparead/spreadMoney.jsx View File

@@ -1,4 +1,4 @@
1
-import { useState} from 'react'
1
+import { useState } from 'react'
2 2
 import Taro from '@tarojs/taro'
3 3
 import CustomNav from '@/components/CustomNav'
4 4
 import Popup from '@/components/Popup'
@@ -9,94 +9,70 @@ import touristOFF from '@/assets/icons/UserCenter/touristOFF.png'
9 9
 import hotelBossOFF from '@/assets/icons/UserCenter/hotelBossOFF.png'
10 10
 import shopBossON from '@/assets/icons/UserCenter/shopBossON.png'
11 11
 import './spreadMoney.less'
12
+import  ToggleRoul  from  '@/components/toggleRoul/ToggleRoul'
12 13
 
13 14
 export default (props) => {
15
+
14 16
   const [showCutover, setShowCutover] = useState(false)
15 17
   const ShowMoldeOn = () => {
16 18
     setShowCutover(true)
17 19
   }
18
-  const ok = () => {
20
+  const onClose = () => {
19 21
     setShowCutover(false)
20
-  }
21
-  const goToHotel = () => {
22
-    Taro.redirectTo({ url: '/hotel/pages/landlord/landlord' })
23
-  }
24
-  const gotoPerson = () => {
25
-    Taro.redirectTo({ url: '/pages/index/index' })
26
-  }
22
+    }
27 23
 
28 24
   return (
29 25
     <view>
30 26
       <view>
31 27
         <CustomNav title='十公里' />
32 28
       </view>
33
-      <Popup show={showCutover} maskClosable={false}>
34
-          <view className='User-box-sths' >
35
-            <view className='User-box-selectUser'>请选择身份:</view>
36
-            <view className='User-box-tourist' onClick={gotoPerson}>
37
-              <image className='Ubs-tourist-image' src={touristOFF} />
38
-              <text className='Ubs-tourist-text'>游客</text>
39
-            </view>
40
-            <view className='User-box-hotelBoss' onClick={goToHotel}>
41
-              <image className='Ubs-hotelBoss-image' src={hotelBossOFF} />
42
-              <text className='Ubs-hotelBoss-text'>民宿老板</text>
43
-
44
-            </view>
45
-            <view className='User-box-shopBoss' onClick={ok}>
46
-              <image className='Ubs-shopBoss-image' src={shopBossON} />
47
-              <text className='Ubs-shopBoss-text'>店铺老板</text>
48
-
49
-            </view>
50
-          </view>
51
-
52
-        </Popup>
53
-     
29
+      <ToggleRoul showCutover={showCutover} onClose={onClose} />
54 30
       <view style={{ padding: '30rpx', height: '100%' }}>
55 31
         <scroll-view scroll-y="true" scroll-view='true' bindscrolltoupper="upper" bindscrolltolower="lower" bindscroll="scroll" style={{ height: 'calc(100vh - 120px)' }}>
56 32
           <view className='storexx'>
57
-              <view className='storeName'>店名:<text>Yun咖 云里 咖啡店</text></view>
58
-              <view onClick={ShowMoldeOn}  className='User-info-cutover'>
59
-                <image className='User-info-cutover-image' src={cutoverUser} />
60
-              </view>
61
-              <view className='tip'>(计算收入以核销为准)</view>
62
-              <view className='money'>
63
-                <view className='sleft'>
64
-                  <view className='lword'>全年推广收入(税前)</view>
65
-                  <view className='yearMoney'>
66
-                    <text>2800000</text>元
67
-                    <image className='micon' src={eyes}></image>
68
-                  </view>
33
+            <view className='storeName'>店名:<text>Yun咖 云里 咖啡店</text></view>
34
+            <view onClick={ShowMoldeOn} className='User-info-cutover'>
35
+              <image className='User-info-cutover-image' src={cutoverUser} />
36
+            </view>
37
+            <view className='tip'>(计算收入以核销为准)</view>
38
+            <view className='money'>
39
+              <view className='sleft'>
40
+                <view className='lword'>全年推广收入(税前)</view>
41
+                <view className='yearMoney'>
42
+                  <text>2800000</text>元
43
+                  <image className='micon' src={eyes}></image>
69 44
                 </view>
70
-                <view className='line' />
71
-                <view className='sright'>
72
-                  <view className='rword'>当月推广收入(税前)</view>
73
-                  <view className='monthMoney'>
74
-                    <text>******</text>元
75
-                    <image className='micon2' src={ceyes}></image>
76
-                  </view></view>
77 45
               </view>
46
+              <view className='line' />
47
+              <view className='sright'>
48
+                <view className='rword'>当月推广收入(税前)</view>
49
+                <view className='monthMoney'>
50
+                  <text>******</text>元
51
+                  <image className='micon2' src={ceyes}></image>
52
+                </view></view>
78 53
             </view>
54
+          </view>
79 55
           <view className='title'>推广收入记录</view>
80 56
           <view>
81 57
             <view className='spreadCard'>
82 58
               <view className='spreadDate'>日期:<text>2021-06-24</text></view>
83 59
               <view className='card'>
84 60
                 <view className='spreadTime'>时&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;间:<text>2021-06-24  20:45</text></view>
85
-                <view className='spreadMoney'>收入金额:<text>5.00</text>元</view> 
61
+                <view className='spreadMoney'>收入金额:<text>5.00</text>元</view>
86 62
               </view>
87 63
             </view>
88 64
             <view className='spreadCard'>
89 65
               <view className='spreadDate'>日期:<text>2021-06-24</text></view>
90 66
               <view className='card'>
91 67
                 <view className='spreadTime'>时&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;间:<text>2021-06-24  20:45</text></view>
92
-                <view className='spreadMoney'>收入金额:<text>5.00</text>元</view> 
68
+                <view className='spreadMoney'>收入金额:<text>5.00</text>元</view>
93 69
               </view>
94 70
             </view>
95 71
           </view>
96 72
           <view className='botton'>已经到底了~</view>
97
-        </scroll-view>        
98
-      </view>
99
-      
73
+        </scroll-view>
100 74
       </view>
75
+
76
+    </view>
101 77
   )
102 78
 }

+ 47
- 0
src/components/toggleRoul/ToggleRoul.jsx View File

@@ -0,0 +1,47 @@
1
+import { useState,useEffect } from 'react';
2
+
3
+import touristON from '@/assets/icons/UserCenter/touristON.png'
4
+import touristOFF from '@/assets/icons/UserCenter/touristOFF.png'
5
+import hotelBossON from '@/assets/icons/UserCenter/hotelBossON.png'
6
+import hotelBossOFF from '@/assets/icons/UserCenter/hotelBossOFF.png'
7
+import shopBossON from '@/assets/icons/UserCenter/shopBossON.png'
8
+import shopBossOFF from '@/assets/icons/UserCenter/shopBossOFF.png'
9
+
10
+import Popup from '@/components/Popup'
11
+import './ToggleRoul.less'
12
+import { useModel } from '@/store'
13
+
14
+
15
+export default ( props)=>{
16
+  const {showCutover, onClose }=props
17
+  const {getRoul}=useModel('person')
18
+  const goToPerson=()=>{
19
+    getRoul('normal')
20
+  }
21
+  const goToHotel=()=>{
22
+    getRoul('hotel')
23
+  }
24
+  const goToShop=()=>{
25
+    getRoul('shop')
26
+  }
27
+
28
+    return (      
29
+      <Popup show={showCutover} onClose={onClose}>
30
+          <view className='User-box-sths' >
31
+            <view className='User-box-selectUser'>请选择身份:</view>
32
+            <view className='User-box-tourist' onClick={goToPerson}>
33
+              <image className='Ubs-tourist-image' src={touristOFF} />
34
+              <text className='Ubs-tourist-text'>游客</text>
35
+            </view>
36
+            <view className='User-box-hotelBoss' onClick={goToHotel}>
37
+              <image className='Ubs-hotelBoss-image' src={hotelBossOFF} />
38
+              <text className='Ubs-hotelBoss-text'>民宿老板</text>
39
+            </view>
40
+            <view className='User-box-shopBoss' onClick={goToShop}>
41
+              <image className='Ubs-shopBoss-image' src={shopBossON} />
42
+              <text className='Ubs-shopBoss-text'>店铺老板</text>
43
+            </view>
44
+          </view>
45
+        </Popup>
46
+    )  
47
+}

+ 56
- 0
src/components/toggleRoul/ToggleRoul.less View File

@@ -0,0 +1,56 @@
1
+.User-box-sths{
2
+  display: flex;
3
+  margin: 40px 0  60px 0;
4
+  justify-content: space-around;
5
+  flex-wrap: wrap;
6
+  .User-box-selectUser{
7
+    width: 100%;
8
+    font-size: 32px;
9
+    font-weight: bold;
10
+    color: #202020;
11
+    line-height: 32px;
12
+    margin: 60px 0 70px  0;
13
+    text-align: left;
14
+  }
15
+  .User-box-tourist{
16
+    display: inline-block;
17
+
18
+     .Ubs-tourist-image{
19
+      width: 86px;
20
+      height: 86px;
21
+
22
+    }
23
+    .Ubs-tourist-text{
24
+      display: block;
25
+      font-size: 30px;
26
+      font-weight: bold;
27
+      color: #999999;      
28
+    }
29
+  }
30
+  .User-box-hotelBoss{
31
+    display: inline-block;
32
+    .Ubs-hotelBoss-image{
33
+      width: 86px;
34
+      height: 86px;
35
+    }
36
+    .Ubs-hotelBoss-text{
37
+      display: block;
38
+      font-size: 30px;
39
+      font-weight: bold;
40
+      color: #999999;
41
+    }
42
+  }
43
+  .User-box-shopBoss{
44
+    .Ubs-shopBoss-image{
45
+      width: 86px;
46
+      height: 86px;
47
+    }
48
+    .Ubs-shopBoss-text{
49
+      display: block;
50
+      font-size: 30px;
51
+      font-weight: bold;
52
+      color:#202020;
53
+    }
54
+  }
55
+
56
+}

+ 22
- 3
src/pages/details/foodDetails/foodDetails.jsx View File

@@ -15,11 +15,12 @@ import share from '../../../assets/icons/housemantj/景点分享.png'
15 15
 import good from '../../../assets/icons/housemantj/景点爆赞.png'
16 16
 import collection from '../../../assets/icons/housemantj/景点收藏.png'
17 17
 import hongxin from '../../../assets/icons/housemantj/已收藏.png'
18
-
19 18
 import './foodDetails.less'
19
+import Taro from '@tarojs/taro'
20 20
 import Extend from '../components/extend'
21 21
 import useSave from "@/utils/hooks/useSave"
22 22
 import useLike from "@/utils/hooks/useLike"
23
+import { useRef } from 'react';
23 24
 
24 25
 export default withLayout((props) => {
25 26
   const { router, person } = props
@@ -67,9 +68,27 @@ export default withLayout((props) => {
67 68
       setNewextNum(newextNum+res.records.length)
68 69
     })
69 70
   }
71
+  const toShare=()=>{
72
+    console.log(222222222222)
73
+    onShareAppMessage()
74
+  }
75
+  const openMap=()=>{
76
+     Taro.openLocation({
77
+              longitude: log.current - 0,
78
+              latitude: lat.current - 0,
79
+              name: detail.shopName,
80
+              address:detail.address,
81
+              scale: 12,
82
+            })
83
+  }
84
+  const log=useRef('')
85
+  const lat=useRef('')
86
+
70 87
   useEffect(()=>{
71 88
     getShopDetail(id).then((res)=>{
72 89
       setDetail(res)
90
+      log.current=(res.locaton).toString().split(',')[0]
91
+      lat.current=(res.locaton).toString().split(',')[1]
73 92
       setimglist(res.imageList||[])
74 93
     })
75 94
     getShopPackage(id).then((res)=>{
@@ -133,7 +152,7 @@ return (
133 152
               <view className='yysj'>
134 153
                 <image src={yysj} className='yysjImg' />营业时间:{detail.businessHours}
135 154
               </view>
136
-              <view className='dpPosition'> 
155
+              <view className='dpPosition' onClick={openMap}> 
137 156
                 <image src={dw} className='dwTip' />
138 157
                 <view>
139 158
                   {detail.address}<image src={zhuandao} className='zhuandao'/>
@@ -166,7 +185,7 @@ return (
166 185
         </scroll-view>
167 186
       </view>
168 187
       <view className='bottomTab'>
169
-        <view className='tab'>
188
+        <view className='tab' onClick={toShare}>
170 189
           <image className='share' src={share} />分享
171 190
         </view>
172 191
         <view className='tab' onClick={toggleLike}>

+ 21
- 6
src/pages/details/mjDetails/sceneryDetails.jsx View File

@@ -9,15 +9,16 @@ import showMore from '../../../assets/icons/housemantj/查看更多.png'
9 9
 import share from '../../../assets/icons/housemantj/景点分享.png'
10 10
 import good from '../../../assets/icons/housemantj/景点爆赞.png'
11 11
 import collection from '../../../assets/icons/housemantj/景点收藏.png'
12
-import './sceneryDetails.less'
13 12
 import withLayout from '@/layouts'
14
-import { useState, useEffect } from 'react'
13
+import { useState, useEffect, useRef } from 'react'
15 14
 import { getTouristDetail, getExtendContent, getRecommendList } from '@/services/home'
16 15
 import { Swiper, SwiperItem } from '@tarojs/components';
17 16
 import useSave from "@/utils/hooks/useSave"
18 17
 import useLike from "@/utils/hooks/useLike"
19 18
 import Extend from '../components/extend'
20 19
 import Cards from '@/components/foodCards/foodCards.jsx'
20
+import Taro from '@tarojs/taro'
21
+import './sceneryDetails.less'
21 22
 
22 23
 
23 24
 
@@ -54,8 +55,23 @@ export default withLayout((props) => {
54 55
   // 推荐套餐列表
55 56
   const [recommend, setRecommend] = useState([])
56 57
 
58
+  const openMap = () => {
59
+    Taro.openLocation({
60
+      longitude: log.current - 0,
61
+      latitude: lat.current - 0,
62
+      name: detail.touristName,
63
+      address: detail.address,
64
+      scale: 12,
65
+    })
66
+  }
67
+  const log = useRef('')
68
+  const lat = useRef('')
69
+
70
+
57 71
   useEffect(() => {
58 72
     getTouristDetail(id).then((res) => {
73
+      log.current = (res.locaton).toString().split(',')[0]
74
+      lat.current = (res.locaton).toString().split(',')[1]
59 75
       setDetail(res)
60 76
       setimglist(res.imageList || [])
61 77
 
@@ -69,7 +85,6 @@ export default withLayout((props) => {
69 85
       setRecommend(res || [])
70 86
     })
71 87
   }, [])
72
-  console.log(extend=='')
73 88
   return (
74 89
     <view className='page-index'>
75 90
       <view className='index-navbar'>
@@ -106,7 +121,7 @@ export default withLayout((props) => {
106 121
                 <text className='bzRight'>爆赞{detail.likeNum}</text>
107 122
               </view>
108 123
               <view className='wz'>{detail.address}</view>
109
-              <view className='dpPosition'>
124
+              <view className='dpPosition' onClick={openMap}>
110 125
                 <image src={dw} className='dwTip' />
111 126
                 <view className='distance'>{distance}公里</view>
112 127
               </view>
@@ -119,7 +134,7 @@ export default withLayout((props) => {
119 134
               <image className='scTip' src={isSaved > 0 ? hongxin : baixin} /><text>{isSaved > 0 ? '已收藏' : '加入收藏'}</text>
120 135
             </view>
121 136
           </view>
122
-          <view style={{ position: 'relative',display:extend==''?'none':''}}>
137
+          <view style={{ position: 'relative', display: extend == '' ? 'none' : '' }}>
123 138
             <view className='title'>
124 139
               <image src={titlejd} />景点介绍
125 140
             </view>
@@ -129,7 +144,7 @@ export default withLayout((props) => {
129 144
               <image src={showMore} className='moreTip' />
130 145
             </view>
131 146
           </view>
132
-          <view style={{ position: 'relative', display: recommend=='' ? 'none' : '' }}>
147
+          <view style={{ position: 'relative', display: recommend == '' ? 'none' : '' }}>
133 148
             <view className='title'>
134 149
               <image src={titlems} />老板推荐好吃的
135 150
             </view>

+ 1
- 1
src/pages/index/tabs/Mine.jsx View File

@@ -32,7 +32,7 @@ export default (props) => {
32 32
   // console.log("🚀 ~ file: Mine.jsx ~ line 31 ~ hidePhone", hidePhone)
33 33
 
34 34
   const ShowMoldeOn = () => {
35
-    setShowCutover(true)
35
+    setShowCutover(!showCutover)
36 36
   }
37 37
 
38 38
   // 通过getUserProfile获取微信用户信息

+ 11
- 3
src/pages/index/tabs/Recommend.jsx View File

@@ -35,7 +35,7 @@ export default (props) => {
35 35
       typeId: tab
36 36
     })
37 37
     if (index == 0) {
38
-      setQueryParams({ location: location1, pageNum: 1, pageSize: 10, typeId: '' })
38
+      setQueryParams({ location:  locRef.current, pageNum: 1, pageSize: 10, typeId: '' })
39 39
     }
40 40
   }
41 41
 
@@ -60,7 +60,6 @@ export default (props) => {
60 60
       // 更新 typeId
61 61
       // 更新 分页
62 62
     }
63
-
64 63
     setActiveTab(tabJump - 0)
65 64
   }, [tabJump])
66 65
 
@@ -77,6 +76,13 @@ export default (props) => {
77 76
     // 用绝对路径
78 77
     Taro.navigateTo({ url: '/pages/search/search' });
79 78
   }
79
+
80
+
81
+  const RefreshCard=()=>{
82
+    console.log(1111)
83
+  }
84
+
85
+  
80 86
   return (
81 87
     <view style={{ height: '100%', overflow: 'auto' }}>
82 88
       <view className='search' onClick={onSearch}>
@@ -104,7 +110,9 @@ export default (props) => {
104 110
           </mp-tabs>
105 111
         </scroll-view>
106 112
       </view>
107
-      <scroll-view scroll-y='true' scroll-view='true' bindscrolltoupper='upper' bindscrolltolower='lower' bindscroll='scroll'>
113
+      <scroll-view scroll-y='true' scroll-view='true'  	bindscrolltolower='lower' bindscrolltoupper='upper'	 bindscroll='scroll'
114
+      
115
+      >
108 116
         <view className='waterfall'>
109 117
           {
110 118
             alllist.map((item) => <Card key={item.resourceNo} item={item} />)

+ 7
- 0
src/services/person.js View File

@@ -20,3 +20,10 @@ export const authPhone = (data) => request('/auth-phone', { data, method: 'put'
20 20
  * @returns 
21 21
  */
22 22
 export const authAvatar = (data) => request('/auth-user', { data, method: 'put' })
23
+
24
+ /**
25
+ * 切换角色
26
+ * @param {*} data 
27
+ * @returns 
28
+ */
29
+  export const toggleRoul = (targetType) => request(`/person-role/${targetType}`,{ method: 'post'})

+ 8
- 2
src/store/models/person.js View File

@@ -1,6 +1,6 @@
1 1
 import { useState } from "react"
2 2
 import Taro from '@tarojs/taro'
3
-import { signIn, authPhone, authAvatar } from '@/services/person'
3
+import { signIn, authPhone, authAvatar,toggleRoul } from '@/services/person'
4 4
 
5 5
 export default () => {
6 6
   const [person, setPerson] = useState()
@@ -34,13 +34,19 @@ export default () => {
34 34
     })
35 35
   }
36 36
 
37
+  const getRoul = (data) => {
38
+    return toggleRoul(data).then((res) => {
39
+      setPerson(res);
40
+    })
41
+  }
42
+
37 43
   return {
38 44
     person,
39 45
     peronRoles,
40 46
     setPerson,
41 47
     login,
42 48
     getPhone,
43
-
44 49
     getAvatar,
50
+    getRoul
45 51
   }
46 52
 }