浏览代码

小程序角色切换功能

李志伟 3 年前
父节点
当前提交
e6860916b5

+ 0
- 3
src/components/Landlord/HouseManage/houseManage.jsx 查看文件

@@ -10,9 +10,6 @@ import './houseManage.less'
10 10
 
11 11
 
12 12
 export default (props) => {
13
-  const toIncome=()=>{
14
-    Taro.redirectTo({url:'/pages/landlord/income/income'})
15
-  }
16 13
   return (
17 14
     <view>
18 15
       <view>

+ 42
- 2
src/components/Landlord/Income/income.jsx 查看文件

@@ -1,24 +1,64 @@
1
+import { useState} from 'react'
1 2
 import Taro from '@tarojs/taro'
3
+import Popup from '@/components/Popup'
2 4
 import CustomNav from '@/components/CustomNav'
3 5
 import './income.less'
4 6
 import eyes from '../../../assets/icons/shopKeeper/小眼睛.png'
5 7
 import ceyes from '../../../assets/icons/shopKeeper/小眼睛-闭上.png'
6 8
 import sImg from '../../../assets/icons/landlord/我的收入2.png'
9
+import cutoverUser from '@/assets/icons/UserCenter/cutoverUser.png'
10
+import touristON from '@/assets/icons/UserCenter/touristON.png'
11
+import touristOFF from '@/assets/icons/UserCenter/touristOFF.png'
12
+import hotelBossON from '@/assets/icons/UserCenter/hotelBossON.png'
13
+import hotelBossOFF from '@/assets/icons/UserCenter/hotelBossOFF.png'
14
+import shopBossON from '@/assets/icons/UserCenter/shopBossON.png'
15
+import shopBossOFF from '@/assets/icons/UserCenter/shopBossOFF.png'
7 16
 
8 17
 
9 18
 export default (props) => {
10
-  const toHouse=()=>{
11
-    Taro.navigateTo({url:'/pages/landlord/houseManage/houseManage'})
19
+  const [showCutover, setShowCutover] = useState(false)
20
+  const ShowMoldeOn = () => {
21
+    setShowCutover(true)
22
+  }
23
+  const ok = () => {
24
+    setShowCutover(false)
25
+  }
26
+  const gotoShop = () => {
27
+    Taro.redirectTo({ url: '/shop/pages/spread/spreadIndex' })
28
+  }
29
+  const gotoPerson = () => {
30
+    Taro.redirectTo({ url: '/pages/index/index' })
12 31
   }
13 32
   return (
14 33
     <view>
15 34
       <view>
16 35
         <CustomNav title='十公里' />
17 36
       </view>
37
+      <Popup show={showCutover} maskClosable={false}>
38
+          <view className='User-box-sths' >
39
+            <view className='User-box-selectUser'>请选择身份:</view>
40
+            <view className='User-box-tourist' onClick={gotoPerson}>
41
+              <image className='Ubs-tourist-image' src={touristOFF} />
42
+              <text className='Ubs-tourist-text'>游客</text>
43
+            </view>
44
+            <view className='User-box-hotelBoss' onClick={ok}>
45
+              <image className='Ubs-hotelBoss-image' src={hotelBossON} />
46
+              <text className='Ubs-hotelBoss-text'>民宿老板</text>
47
+
48
+            </view>
49
+            <view className='User-box-shopBoss' onClick={gotoShop}>
50
+              <image className='Ubs-shopBoss-image' src={shopBossOFF} />
51
+              <text className='Ubs-shopBoss-text'>店铺老板</text>
52
+            </view>
53
+          </view>
54
+        </Popup>     
18 55
       <view style={{ padding: '30rpx', height: '100%' }}>
19 56
         <scroll-view scroll-y="true" scroll-view='true' bindscrolltoupper="upper" bindscrolltolower="lower" bindscroll="scroll" style={{ height: 'calc(100vh - 120px)' }}>
20 57
           <view className='storexx'>
21 58
               <view className='storeName'>店名:<text>Yun咖 云里 咖啡店</text></view>
59
+              <view onClick={ShowMoldeOn}  className='User-info-cutover'>
60
+                <image className='User-info-cutover-image' src={cutoverUser} />
61
+              </view>
22 62
               <view className='money'>
23 63
                 <view className='sleft'>
24 64
                   <view className='lword'>全年收入(税前)</view>

+ 65
- 1
src/components/Landlord/Income/income.less 查看文件

@@ -1,3 +1,59 @@
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: #202020;
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:#999999;
53
+    }
54
+  }
55
+
56
+}
1 57
 .storexx{
2 58
   text-align: center;
3 59
   height: 302px;
@@ -13,7 +69,15 @@
13 69
     color: #202020;
14 70
     margin-bottom:58px;
15 71
   }
16
-  
72
+  .User-info-cutover{
73
+    position: absolute;
74
+    top: 60px;
75
+    right: 60px;
76
+    .User-info-cutover-image{
77
+      width: 36px;
78
+      height: 36px;
79
+    }
80
+  }
17 81
   .sleft{
18 82
     float: left;
19 83
     .lword{

+ 53
- 9
src/components/spreads/ShopKeeper/shopKeeper.jsx 查看文件

@@ -1,10 +1,18 @@
1 1
 import { React, useState, useEffect, } from 'react'
2
-import{ Taro,useRouter } from '@tarojs/taro'
2
+import Taro,{ useRouter } from '@tarojs/taro'
3 3
 import CustomNav from '@/components/CustomNav'
4
+import Popup from '@/components/Popup'
4 5
 import eyes from '@/assets/icons/shopKeeper/小眼睛.png'
5 6
 import ceyes from '@/assets/icons/shopKeeper/小眼睛-闭上.png'
6 7
 import iconsearch from '@/assets/icons/housemantj/search.png'
7 8
 import ms from '@/assets/icons/housemantj/ms3.jpg'
9
+import cutoverUser from '@/assets/icons/UserCenter/cutoverUser.png'
10
+import touristON from '@/assets/icons/UserCenter/touristON.png'
11
+import touristOFF from '@/assets/icons/UserCenter/touristOFF.png'
12
+import hotelBossON from '@/assets/icons/UserCenter/hotelBossON.png'
13
+import hotelBossOFF from '@/assets/icons/UserCenter/hotelBossOFF.png'
14
+import shopBossON from '@/assets/icons/UserCenter/shopBossON.png'
15
+import shopBossOFF from '@/assets/icons/UserCenter/shopBossOFF.png'
8 16
 import './shopKeeper.less'
9 17
 
10 18
 
@@ -24,24 +32,60 @@ export default (props) => {
24 32
     setActiveTab(index)
25 33
   }
26 34
   const tabs = [
27
-      {
28
-        title: '未核销订单',
29
-      },
30
-      {
31
-        title: '已核销订单',  
32
-      },   
33
-    ]
34
-
35
+    {
36
+      title: '未核销订单',
37
+    },
38
+    {
39
+      title: '已核销订单',  
40
+    },   
41
+  ]
35 42
 
43
+  const [showCutover, setShowCutover] = useState(false)
44
+  const ShowMoldeOn = () => {
45
+    setShowCutover(true)
46
+  }
47
+  const ok = () => {
48
+    setShowCutover(false)
49
+  }
50
+  const goToHotel = () => {
51
+    Taro.redirectTo({ url: '/hotel/pages/landlord/landlord' })
52
+  }
53
+  const gotoPerson = () => {
54
+    Taro.redirectTo({ url: '/pages/index/index' })
55
+  }
36 56
   return (
37 57
     <view>
38 58
       <view>
39 59
         <CustomNav title='十公里' />
40 60
       </view>
61
+      <Popup show={showCutover} maskClosable={false}>
62
+          <view className='User-box-sths' >
63
+            <view className='User-box-selectUser'>请选择身份:</view>
64
+            <view className='User-box-tourist' onClick={gotoPerson}>
65
+              <image className='Ubs-tourist-image' src={touristOFF} />
66
+              <text className='Ubs-tourist-text'>游客</text>
67
+            </view>
68
+            <view className='User-box-hotelBoss' onClick={goToHotel}>
69
+              <image className='Ubs-hotelBoss-image' src={hotelBossOFF} />
70
+              <text className='Ubs-hotelBoss-text'>民宿老板</text>
71
+
72
+            </view>
73
+            <view className='User-box-shopBoss' onClick={ok}>
74
+              <image className='Ubs-shopBoss-image' src={shopBossON} />
75
+              <text className='Ubs-shopBoss-text'>店铺老板</text>
76
+
77
+            </view>
78
+          </view>
79
+
80
+        </Popup>
81
+        
41 82
       <view style={{ padding: '30rpx', height: '100%' }}>
42 83
         <scroll-view scroll-y="true" scroll-view='true' bindscrolltoupper="upper" bindscrolltolower="lower" bindscroll="scroll" style={{ height: 'calc(100vh - 120px)' }}>
43 84
           <view className='storexx'>
44 85
             <view className='storeName'>店名:<text>Yun咖 云里 咖啡店</text></view>
86
+            <view onClick={ShowMoldeOn}  className='User-info-cutover'>
87
+              <image className='User-info-cutover-image' src={cutoverUser} />
88
+            </view>
45 89
             <view className='tip'>(计算收入以核销为准)</view>
46 90
             <view className='money'>
47 91
               <view className='sleft'>

+ 63
- 0
src/components/spreads/ShopKeeper/shopKeeper.less 查看文件

@@ -1,3 +1,57 @@
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
+     .Ubs-tourist-image{
18
+      width: 86px;
19
+      height: 86px;
20
+    }
21
+    .Ubs-tourist-text{
22
+      display: block;
23
+      font-size: 30px;
24
+      font-weight: bold;
25
+      color: #999999;      
26
+    }
27
+  }
28
+  .User-box-hotelBoss{
29
+    display: inline-block;
30
+    .Ubs-hotelBoss-image{
31
+      width: 86px;
32
+      height: 86px;
33
+    }
34
+    .Ubs-hotelBoss-text{
35
+      display: block;
36
+      font-size: 30px;
37
+      font-weight: bold;
38
+      color: #999999;
39
+    }
40
+  }
41
+  .User-box-shopBoss{
42
+    .Ubs-shopBoss-image{
43
+      width: 86px;
44
+      height: 86px;
45
+    }
46
+    .Ubs-shopBoss-text{
47
+      display: block;
48
+      font-size: 30px;
49
+      font-weight: bold;
50
+      color:#202020;
51
+    }
52
+  }
53
+
54
+}
1 55
 .storexx{
2 56
   text-align: center;
3 57
   height: 342px;
@@ -13,6 +67,15 @@
13 67
     color: #202020;
14 68
     margin-bottom:27px;
15 69
   }
70
+  .User-info-cutover{
71
+    position: absolute;
72
+    top: 60px;
73
+    right: 60px;
74
+    .User-info-cutover-image{
75
+      width: 36px;
76
+      height: 36px;
77
+    }
78
+  }
16 79
   .tip{
17 80
     height: 23px;
18 81
     font-size: 24px;

+ 46
- 2
src/components/spreads/Sparead/spreadMoney.jsx 查看文件

@@ -1,19 +1,63 @@
1
+import { useState} from 'react'
2
+import Taro from '@tarojs/taro'
1 3
 import CustomNav from '@/components/CustomNav'
2
-import './spreadMoney.less'
4
+import Popup from '@/components/Popup'
3 5
 import eyes from '@/assets/icons/shopKeeper/小眼睛.png'
4 6
 import ceyes from '@/assets/icons/shopKeeper/小眼睛-闭上.png'
5
-
7
+import cutoverUser from '@/assets/icons/UserCenter/cutoverUser.png'
8
+import touristOFF from '@/assets/icons/UserCenter/touristOFF.png'
9
+import hotelBossOFF from '@/assets/icons/UserCenter/hotelBossOFF.png'
10
+import shopBossON from '@/assets/icons/UserCenter/shopBossON.png'
11
+import './spreadMoney.less'
6 12
 
7 13
 export default (props) => {
14
+  const [showCutover, setShowCutover] = useState(false)
15
+  const ShowMoldeOn = () => {
16
+    setShowCutover(true)
17
+  }
18
+  const ok = () => {
19
+    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
+  }
27
+
8 28
   return (
9 29
     <view>
10 30
       <view>
11 31
         <CustomNav title='十公里' />
12 32
       </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
+     
13 54
       <view style={{ padding: '30rpx', height: '100%' }}>
14 55
         <scroll-view scroll-y="true" scroll-view='true' bindscrolltoupper="upper" bindscrolltolower="lower" bindscroll="scroll" style={{ height: 'calc(100vh - 120px)' }}>
15 56
           <view className='storexx'>
16 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>
17 61
               <view className='tip'>(计算收入以核销为准)</view>
18 62
               <view className='money'>
19 63
                 <view className='sleft'>

+ 65
- 0
src/components/spreads/Sparead/spreadMoney.less 查看文件

@@ -1,3 +1,59 @@
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
+}
1 57
 .storexx{
2 58
   text-align: center;
3 59
   height: 342px;
@@ -13,6 +69,15 @@
13 69
     color: #202020;
14 70
     margin-bottom:27px;
15 71
   }
72
+  .User-info-cutover{
73
+    position: absolute;
74
+    top: 60px;
75
+    right: 60px;
76
+    .User-info-cutover-image{
77
+      width: 36px;
78
+      height: 36px;
79
+    }
80
+  }
16 81
   .tip{
17 82
     height: 23px;
18 83
     font-size: 24px;

+ 3
- 1
src/hotel/pages/landlord/landlord.config.js 查看文件

@@ -3,6 +3,8 @@ export default {
3 3
   navigationStyle: 'custom',
4 4
   styleIsolation: 'shared',
5 5
   usingComponents: {
6
-    "mp-tabbar": "weui-miniprogram/tabbar/tabbar"
6
+    "mp-tabbar": "weui-miniprogram/tabbar/tabbar",
7
+    "mp-dialog": "weui-miniprogram/dialog/dialog"
8
+
7 9
   }
8 10
 }

+ 10
- 4
src/pages/index/tabs/Mine.jsx 查看文件

@@ -79,7 +79,13 @@ export default withLayout((props) => {
79 79
   const handleRules = () => {
80 80
     Taro.navigateTo({ url: '/pages/MineUserAll/Rules/index' })
81 81
   }
82
-
82
+  
83
+  const goToHotel = () => {
84
+    Taro.redirectTo({ url: '/hotel/pages/landlord/landlord' })
85
+  }
86
+  const goToShop = () => {
87
+    Taro.redirectTo({ url: '/shop/pages/spread/spreadIndex' })
88
+  }
83 89
 
84 90
   return !person.phone ? <AuthPage /> : (
85 91
     <scroll-view scroll-y style='height: 77vh;' >
@@ -88,16 +94,16 @@ export default withLayout((props) => {
88 94
         <Popup show={showCutover} maskClosable={false}>
89 95
           <view className='User-box-sths' >
90 96
             <view className='User-box-selectUser'>请选择身份:</view>
91
-            <view className='User-box-tourist'>
97
+            <view className='User-box-tourist' onClick={ok}>
92 98
               <image className='Ubs-tourist-image' src={touristON} />
93 99
               <text className='Ubs-tourist-text'>游客</text>
94 100
             </view>
95
-            <view className='User-box-hotelBoss'>
101
+            <view className='User-box-hotelBoss' onClick={goToHotel}>
96 102
               <image className='Ubs-hotelBoss-image' src={hotelBossOFF} />
97 103
               <text className='Ubs-hotelBoss-text'>民宿老板</text>
98 104
 
99 105
             </view>
100
-            <view className='User-box-shopBoss'>
106
+            <view className='User-box-shopBoss' onClick={goToShop}>
101 107
               <image className='Ubs-shopBoss-image' src={shopBossOFF} />
102 108
               <text className='Ubs-shopBoss-text'>店铺老板</text>
103 109
 

+ 2
- 1
src/shop/pages/spread/spreadIndex.config.js 查看文件

@@ -3,6 +3,7 @@ export default {
3 3
   navigationStyle: 'custom',
4 4
   usingComponents: {
5 5
     "mp-tabbar": "weui-miniprogram/tabbar/tabbar",
6
-    "mp-tabs": "../../../components/tabs/index"
6
+    "mp-tabs": "../../../components/tabs/index",
7
+    "mp-dialog": "weui-miniprogram/dialog/dialog"
7 8
   }
8 9
 }