瀏覽代碼

Carsclass

[baozhangchao] 3 年之前
父節點
當前提交
79757f5d67

二進制
src/assets/icons/comm/ListBack.png 查看文件


+ 3
- 3
src/components/CarsListContent/index.jsx 查看文件

@@ -6,7 +6,7 @@ import ButtontWX from '@/components/ButtontWX'
6 6
 import withLayout from '@/layouts'
7 7
 import addresss from '@/assets/mineImgaes/addresss.png'//地址
8 8
 import { useModel } from "@/store"
9
-
9
+import ListPlaceholder from "@/components/ListPlaceholder"
10 10
 import { getMachinery, } from "@/services/homes"
11 11
 
12 12
 
@@ -49,7 +49,7 @@ export default withLayout((props) => {
49 49
 
50 50
     <>
51 51
       {
52
-        carsList.map((item, index) => {
52
+        carsList != [] ? carsList.map((item, index) => {
53 53
           return (
54 54
             <View key={index} className='carsListImga-bottom-box'>
55 55
               <Image src={item.thumb} onClick={() => goCarsInfo(item.machineryId)} />
@@ -71,7 +71,7 @@ export default withLayout((props) => {
71 71
               </View>
72 72
             </View>
73 73
           )
74
-        })
74
+        }) : <ListPlaceholder title='暂无农机信息' />
75 75
       }
76 76
 
77 77
     </>

+ 17
- 0
src/components/ListPlaceholder/index.jsx 查看文件

@@ -0,0 +1,17 @@
1
+import { View, Image } from '@tarojs/components'
2
+import ListBack from '@/assets/icons/comm/ListBack.png'
3
+
4
+import './style.less'
5
+
6
+
7
+export default (props) => {
8
+  const { title } = props
9
+
10
+
11
+  return (
12
+    <View className='ListBack-box'>
13
+      <Image src={ListBack} />
14
+      <View>{title}</View>
15
+    </View>
16
+  )
17
+}

+ 18
- 0
src/components/ListPlaceholder/style.less 查看文件

@@ -0,0 +1,18 @@
1
+.ListBack-box {
2
+  width: 90%;
3
+  padding: 78px 0;
4
+  margin: 3em auto;
5
+  text-align: center;
6
+  background: #ffffff;
7
+  box-shadow: 0px 0px 44px 0px rgba(0, 0, 0, 0.08);
8
+  border-radius: 40px;
9
+  > Image {
10
+    width: 220px;
11
+    height: 264px;
12
+  }
13
+  > View {
14
+    font-size: 34px;
15
+    font-weight: bold;
16
+    color: #b4b4b4;
17
+  }
18
+}

+ 161
- 0
src/components/LoginModel/index.jsx 查看文件

@@ -0,0 +1,161 @@
1
+
2
+import { useState } from 'react'
3
+import Taro from '@tarojs/taro'
4
+import { getUserQcode, setUserPhone } from '@/services/login'
5
+
6
+import { View, Image, Input, Text, Form } from '@tarojs/components'
7
+import CustomNav from '@/components/CustomNav'
8
+import ButtontWX from '@/components/ButtontWX'
9
+import checkedImg from '@/assets/lolginImages/checkedImg.png'
10
+import unselectedImg from '@/assets/lolginImages/unselectedImg.png'
11
+import { useModel } from '@/store'
12
+
13
+
14
+import './style.less'
15
+
16
+
17
+export default (props) => {
18
+
19
+  const { isLoginVisible } = props
20
+
21
+  const { person, setPerson } = useModel('userData')
22
+
23
+
24
+  const [countCenter, setCountCenter] = useState({
25
+    count: 60,
26
+    toast: false,
27
+    show_btn: false,
28
+    code_ts: '获取验证码'
29
+  })
30
+
31
+  const [checkImage, setCheckImage] = useState(false)
32
+
33
+  const [InputPhoneValue, setInputPhoneValue] = useState('18082043755')
34
+  const [InputCodeValue, setInputCodeValue] = useState('375501')
35
+
36
+  const onInputPhone = (r) => {
37
+    setInputPhoneValue(r?.detail?.value)
38
+    console.log("🚀 ~ file: index.jsx ~ line 26 ~ InputCodeValue", InputPhoneValue)
39
+
40
+  }
41
+  const onInputCode = (r) => {
42
+    setInputCodeValue(r?.detail?.value)
43
+
44
+  }
45
+  //获取验证码
46
+  const getCode = (r) => {
47
+    if (InputPhoneValue === '' || !(/^1[3456789]\d{9}$/.test(InputPhoneValue))) {
48
+      console.log('提示')
49
+      Taro.showToast({
50
+        title: '手机号码有误',
51
+        icon: 'none',
52
+        duration: 2000
53
+      })
54
+
55
+    } else {
56
+      getUserQcode({ phone: InputPhoneValue }).then(() => {
57
+        Taro.showToast({
58
+          title: '验证码发送成功',
59
+          icon: 'none',
60
+          duration: 2000
61
+        })
62
+      })
63
+      let count = countCenter.count
64
+      const timer = setInterval(() => {
65
+        setCountCenter({
66
+          count: (count--),
67
+          show_btn: true,
68
+          code_ts: count + '秒后重发'
69
+        })
70
+        if (count == 0) {
71
+          setCountCenter({
72
+            show_btn: false,
73
+            count: 60,
74
+            code_ts: '获取验证码'
75
+          })
76
+          clearInterval(timer)
77
+
78
+        }
79
+
80
+      }, 1000)
81
+    }
82
+  }
83
+
84
+
85
+
86
+  const getUserLogin = () => {
87
+    if (InputPhoneValue === '' || !(/^1[3456789]\d{9}$/.test(InputPhoneValue))) {
88
+      console.log('提示')
89
+      Taro.showToast({
90
+        title: '手机号或验证码有误',
91
+        icon: 'none',
92
+        duration: 2000
93
+      })
94
+    } else {
95
+      if (!checkImage) {
96
+        Taro.showToast({
97
+          title: '下方协议未勾选',
98
+          icon: 'none',
99
+          duration: 2000
100
+        })
101
+      } else {
102
+        setUserPhone(person.personId, { captcha: InputCodeValue, phone: InputPhoneValue }).then((e) => {
103
+          console.log('e', e);
104
+          setPerson({ ...person, phone: InputPhoneValue })
105
+          Taro.reLaunch({ url: '/pages/index/index' });
106
+        })
107
+        // console.log('person', person);
108
+      }
109
+
110
+    }
111
+
112
+  }
113
+
114
+
115
+
116
+  return (
117
+    <>
118
+      {
119
+        isLoginVisible ? <View className='page-index  ' style={{ position: 'absolute', zIndex: '29999' }
120
+        } >
121
+          <View className='index-navbar'>
122
+            <CustomNav title='登陆' home />
123
+          </View>
124
+          <View className='loginBackImg-box' >
125
+            <Image src={require("@/assets/lolginImages/backLogin.png")} />
126
+
127
+            <View className='loginhallo-text'>
128
+              <View>您好!</View>
129
+              <View>欢迎进入农户端小程序!</View>
130
+            </View>
131
+            <View>
132
+              <View className='loginPhone-box' >
133
+                <View className='loginPhone-box-loginPhoneView'>+86</View>
134
+                <Input maxlength={11} placeholder='请输入手机号码' type={Number} value={InputPhoneValue} onInput={onInputPhone} />
135
+
136
+                <ButtontWX opacity={countCenter.show_btn ? '0.7' : '11'} disabled={countCenter.show_btn} onClick={getCode} butText={countCenter.code_ts} butWidth={94} butHeight={34} butFontSize={15} butBorderRadius={10} />
137
+              </View>
138
+              <View className='loginPhone-box'>
139
+                <View className='loginPhone-box-loginPhoneView'>
140
+                  <Image style={{ width: '16px', height: '20px', margin: 'auto 2.8vw auto 2.8vw' }} src={require("@/assets/lolginImages/phoneCode.png")} />
141
+                </View>
142
+                <Input maxlength={10} placeholder='请输入验证码' value={InputCodeValue} onInput={onInputCode} />
143
+              </View>
144
+            </View>
145
+          </View>
146
+          <View className='BottomtButrelative'  >
147
+            <ButtontWX onClick={getUserLogin} butText='登陆' butWidth={315} butHeight={49} butFontSize={16} butBorderRadius={49} />
148
+          </View>
149
+          <View className='bottom-agreement'>
150
+            <Image src={!checkImage ? checkedImg : unselectedImg} onClick={() => { setCheckImage(!checkImage) }} />
151
+            <View>
152
+              请认真查看<Text style={{ color: '#CE3800' }}>文本协议/隐私政策</Text>,确认之后选择此项!
153
+            </View>
154
+          </View>
155
+
156
+        </View >
157
+          : <></>
158
+      }
159
+    </>
160
+  )
161
+}

+ 72
- 0
src/components/LoginModel/style.less 查看文件

@@ -0,0 +1,72 @@
1
+.loginBackImg-box {
2
+  width: 100vw;
3
+  height: 100vh;
4
+  top: 0;
5
+  left: 0;
6
+
7
+  > Image {
8
+    height: 100%;
9
+    width: 100%;
10
+
11
+    position: absolute;
12
+    top: 0;
13
+  }
14
+
15
+  .loginhallo-text {
16
+    position: relative;
17
+    margin: 98px 0 80px 30px;
18
+  }
19
+  .loginhallo-text:nth-child(1) {
20
+    font-size: 66px;
21
+    font-weight: bold;
22
+    color: #333333;
23
+  }
24
+  .loginhallo-text:nth-child(2) {
25
+    font-size: 54px;
26
+    font-weight: bold;
27
+    color: #333333;
28
+  }
29
+
30
+  .loginPhone-box {
31
+    width: 93%;
32
+    height: 108px;
33
+    margin: 0 auto;
34
+    position: relative;
35
+    display: flex;
36
+    align-items: center;
37
+    border-bottom: 1px solid rgba(0, 0, 0, 0.12);
38
+    padding-bottom: 12px;
39
+
40
+    &-loginPhoneView {
41
+      font-size: 38px;
42
+      font-weight: 500;
43
+      color: #333333;
44
+      height: 39px;
45
+      line-height: 39px;
46
+      padding-right: 20px;
47
+      margin-right: 31px;
48
+      border-right: 3px solid #000;
49
+    }
50
+  }
51
+}
52
+.BottomtButrelative {
53
+  position: relative;
54
+  bottom: 5vh;
55
+}
56
+
57
+.bottom-agreement {
58
+  position: relative;
59
+  display: flex;
60
+  align-items: center;
61
+  font-size: 26px;
62
+  color: #2a2a2a;
63
+  margin-left: 30px;
64
+  margin-bottom: 60px;
65
+  // height: 2vh;
66
+  // bottom: 8vh;
67
+  > Image {
68
+    width: 28px;
69
+    height: 28px;
70
+    margin-right: 11px;
71
+  }
72
+}

+ 34
- 0
src/components/Spin/index.jsx 查看文件

@@ -0,0 +1,34 @@
1
+import { View } from '@tarojs/components'
2
+import './style.less'
3
+
4
+export default (props) => {
5
+  const { size = '160rpx', background = 'transparent' } = props
6
+  const wrapperStyle = {
7
+    width: size,
8
+    height: size,
9
+    background,
10
+  }
11
+
12
+  const leftBarStyle = {
13
+    'border-top-right-radius': size,
14
+    'border-bottom-right-radius': size,
15
+  }
16
+
17
+  const rightBarStyle = {
18
+    'border-top-left-radius': size,
19
+    'border-bottom-left-radius': size,
20
+  }
21
+
22
+  return (
23
+    <View className='spinbox'>
24
+      <view className='spin' style={wrapperStyle}>
25
+        <view className='mask-left'>
26
+          <view className='spin-bar' style={leftBarStyle}></view>
27
+        </view>
28
+        <view className='mask-right'>
29
+          <view className='spin-bar' style={rightBarStyle}></view>
30
+        </view>
31
+      </view>
32
+    </View>
33
+  )
34
+}

+ 123
- 0
src/components/Spin/style.less 查看文件

@@ -0,0 +1,123 @@
1
+@width: 160px;
2
+
3
+.spinbox {
4
+  width: 100vw;
5
+  height: 100vh;
6
+  justify-content: center;
7
+  padding-top: 30vh;
8
+  display: flex;
9
+  .spin {
10
+    width: @width;
11
+    height: @width;
12
+    border-radius: 100%;
13
+    display: inline-block;
14
+    position: relative;
15
+    animation: spin-rotate 4s linear infinite;
16
+    box-sizing: border-box;
17
+
18
+    view {
19
+      box-sizing: border-box;
20
+      position: absolute;
21
+    }
22
+
23
+    .mask-left,
24
+    .mask-right {
25
+      top: 0;
26
+      width: calc(50% + 1px);
27
+      height: 100%;
28
+      overflow: hidden;
29
+    }
30
+
31
+    .mask-left {
32
+      left: 0;
33
+
34
+      .spin-bar {
35
+        left: 100%;
36
+        border-top-right-radius: @width;
37
+        border-bottom-right-radius: @width;
38
+        border-left: 0;
39
+        transform-origin: center left;
40
+        animation: spin-rotate-right 1.2s cubic-bezier(0.25, 0.5, 0.25, 1) 0.6s
41
+            infinite,
42
+          spin-color 2s linear infinite;
43
+      }
44
+    }
45
+
46
+    .mask-right {
47
+      right: 0;
48
+
49
+      .spin-bar {
50
+        left: -100%;
51
+        border-top-left-radius: @width;
52
+        border-bottom-left-radius: @width;
53
+        border-right: 0;
54
+        transform-origin: center right;
55
+        animation: spin-rotate-right 1.2s cubic-bezier(1, 0.25, 0.5, 0.25)
56
+            infinite,
57
+          spin-color 2s linear infinite;
58
+      }
59
+    }
60
+
61
+    .spin-bar {
62
+      float: left;
63
+      width: 100%;
64
+      height: 100%;
65
+      border-width: 4px;
66
+      border-style: solid;
67
+    }
68
+  }
69
+}
70
+@keyframes spin-rotate-right {
71
+  0% {
72
+    transform: rotate(0deg);
73
+  }
74
+
75
+  50% {
76
+    transform: rotate(180deg);
77
+  }
78
+
79
+  100% {
80
+    transform: rotate(360deg);
81
+  }
82
+}
83
+
84
+@keyframes spin-rotate-left {
85
+  0% {
86
+    transform: rotate(180deg);
87
+  }
88
+
89
+  50% {
90
+    transform: rotate(360deg);
91
+  }
92
+
93
+  100% {
94
+    transform: rotate(540deg);
95
+  }
96
+}
97
+
98
+@keyframes spin-rotate {
99
+  0% {
100
+    transform: rotate(0deg);
101
+  }
102
+
103
+  100% {
104
+    transform: rotate(360deg);
105
+  }
106
+}
107
+
108
+@keyframes spin-color {
109
+  0%,
110
+  100% {
111
+    border-color: #d62d20;
112
+  }
113
+  40% {
114
+    border-color: #0057e7;
115
+  }
116
+  60% {
117
+    border-color: #008744;
118
+  }
119
+  80%,
120
+  90% {
121
+    border-color: #ffa700;
122
+  }
123
+}

+ 47
- 25
src/layouts/index.jsx 查看文件

@@ -1,62 +1,84 @@
1 1
 
2 2
 
3 3
 import useRouter from '@/utils/hooks/useRouter'
4
-import Taro from '@tarojs/taro'
5
-import { useEffect, useMemo } from 'react'
4
+import { useEffect, useMemo, useState } from 'react'
6 5
 import { useModel } from '@/store'
7 6
 
7
+import LoginModel from '@/components/LoginModel'
8 8
 import useLogin from '@/utils/hooks/useLogin'
9
+import Spin from "@/components/Spin";
10
+
9 11
 
10 12
 
11 13
 export default (Child) => (props) => {
12 14
   const { person } = useModel('userData')
13 15
   const router = useRouter()
14 16
 
15
-  const { path } = router
16 17
 
17
-  useLogin()
18
+  const { loginVisible } = useLogin()
18 19
 
19 20
 
20
-  // Taro.useReady(()=>{
21
-  //   useLogin(person,router)
22
-  // })
23
-  // useEffect(()=>{
24
-  //   useLogin(person,router)
25
-  // },[person, person?.phone, router, router?.path])
26 21
 
27 22
   // 确保执行过 login 方法,拿到了 person
28 23
   const isLoged = useMemo(() => !!person?.personId, [person?.personId])
29 24
 
30
-  return isLoged ? <Child {...props} router={router} /> : <></>
25
+  return (
26
+    <>
27
+      {!isLoged && <Spin />}
28
+      {
29
+        isLoged && !loginVisible && <Child {...props} router={router} />
30
+      }
31
+      {
32
+        isLoged && loginVisible && <LoginModel isLoginVisible={loginVisible} />
33
+      }
34
+    </>
35
+  )
36
+
37
+
31 38
 }
32 39
 
33 40
 
34 41
 
35 42
 
36 43
 
44
+
45
+
46
+
47
+
48
+// import useRouter from '@/utils/hooks/useRouter'
49
+// import Taro from '@tarojs/taro'
50
+// import { useState, useMemo } from 'react'
51
+// import { useModel } from '@/store'
52
+// import LoginModel from '@/components/LoginModel'
53
+// import useLogin from '@/utils/hooks/useLogin'
54
+
55
+
37 56
 // export default (Child) => (props) => {
38 57
 //   const { person } = useModel('userData')
39 58
 //   const router = useRouter()
59
+//   const [isShow, setIsShow] = useState(false)
40 60
 
41
-//   const { path } = router
42 61
 
43
-//   useEffect(() => {
44
-//     if (!person?.phone) {
45
-//       if (path != '/pages/index/index' && path !== '/pages/UserLogin/index') {
46
-//         Taro.navigateTo({ url: `/pages/UserLogin/index?id${1}` })
47
-//       }
48
-//     }
49
-//     console.log("🚀 ~ file: index.jsx ~ line 11 ~ person", person, path)
62
+//   const { path } = router
50 63
 
51
-//     // if (path != '/pages/index/index' && !person?.phone) {
52
-//     //   Taro.navigateTo({ url: `/pages/userInfo/index?id${1}` })
53
-//     // }
54
-//   }, [path, person?.phone])
64
+//   useLogin()
65
+//   console.log("🚀 ~ file: index.jsx ~ line 20 ~   useLogin().abac", useLogin())
55 66
 
67
+//   const isShowFun = () => {
68
+//     setIsShow(true)
56 69
 
70
+//   }
71
+//   // Taro.useReady(()=>{
72
+//   //   useLogin(person,router)
73
+//   // })
74
+//   // useEffect(()=>{
75
+//   //   useLogin(person,router)
76
+//   // },[person, person?.phone, router, router?.path])
57 77
 
78
+//   // 确保执行过 login 方法,拿到了 person
79
+//   const isLoged = useMemo(() => !!person?.personId, [person?.personId])
58 80
 
81
+//   return isLoged ? <Child {...props} router={router} /> : <LoginModel isLoginVisible={isShow} />
82
+// }
59 83
 
60
-//   return <Child {...props} router={router} />
61 84
 
62
-// }

+ 76
- 0
src/pages/MoreCars/CarTypeList.jsx 查看文件

@@ -0,0 +1,76 @@
1
+
2
+import { View, Swiper, Image, SwiperItem, Text, Input } from "@tarojs/components"
3
+import { useEffect, useState, useMemo } from "react"
4
+import Taro, { useReachBottom } from "@tarojs/taro"
5
+import ButtontWX from '@/components/ButtontWX'
6
+import withLayout from '@/layouts'
7
+import addresss from '@/assets/mineImgaes/addresss.png'//地址
8
+import { useModel } from "@/store"
9
+import ListPlaceholder from "@/components/ListPlaceholder"
10
+
11
+
12
+import './CarTypeList.less'
13
+
14
+export default withLayout((props) => {
15
+  const { csrsListType } = props
16
+  console.log("🚀 ~ file: index.jsx ~ line 17 ~ withLayout ~ csrsListType", csrsListType)
17
+  const { sserLocation } = useModel('userData')
18
+
19
+  // const { carsList } = props
20
+
21
+  const [carsList, setCarsList] = useState([])
22
+  console.log("🚀 ~ file: index.jsx ~ line 23 ~ withLayout ~ carsList", carsList)
23
+
24
+  const [caryType, setCaryType] = useState(false)
25
+
26
+
27
+  const startReserve = (res) => {
28
+    Taro.navigateTo({ url: `/pages/OrderConfirmation/index?id=${res}` })
29
+
30
+  }
31
+  const goCarsInfo = (res) => {
32
+    Taro.navigateTo({ url: `/pages/CheckDetails/index?id=${res}&location=${sserLocation}` })
33
+
34
+  }
35
+  const goMapInfo = (res) => {
36
+    Taro.navigateTo({ url: `/pages/CheckMap/index?id=${res}&location=${sserLocation}` })
37
+
38
+
39
+  }
40
+
41
+
42
+  return (
43
+
44
+
45
+    <>
46
+      {
47
+        csrsListType == [] ? csrsListType.map((item, index) => {
48
+          return (
49
+            <View key={index} className='carsListImga-bottom-box'>
50
+              <Image src={item.thumb} onClick={() => goCarsInfo(item.machineryId)} />
51
+              <View className='carsListImga-bottom-box-flaxBox'>
52
+                <View className='carsListImga-bottom-box-flaxBox-liftText'>
53
+                  <View className='carsListImga-bottom-box-flaxBox-liftText-Titles'>{item.name}</View>
54
+                  <View className='carsListImga-bottom-box-flaxBox-liftText-price'>{item.price}/<Text>公顷</Text></View>
55
+                </View>
56
+                <View className='carsListImga-bottom-box-flaxBox-rightBut'>
57
+                  <ButtontWX onClick={() => startReserve(item.machineryId)} butText='预约' butWidth={80} butHeight={34} butFontSize={19} butBorderRadius={0} />
58
+                </View>
59
+              </View>
60
+              <View className='content-header-box-map' onClick={() => goMapInfo(item.machineryId)}>
61
+                <View className='content-header-box-map-liftCentent'>
62
+                  <Image src={addresss} />
63
+                  <View>距离当前位置公里</View>
64
+                </View>
65
+                <View className='content-header-box-map-rightCentent'>进入地图&gt;&gt;</View>
66
+              </View>
67
+            </View>
68
+          )
69
+        }) : <ListPlaceholder title='该分类暂无农机!' />
70
+
71
+      }
72
+
73
+
74
+    </>
75
+  )
76
+})

+ 75
- 0
src/pages/MoreCars/CarTypeList.less 查看文件

@@ -0,0 +1,75 @@
1
+.carsListImga-bottom-box {
2
+  margin: 30px auto 0 auto;
3
+  background: #f2f2f2;
4
+  width: 93vw;
5
+  > Image {
6
+    width: 100%;
7
+    margin: 0 auto;
8
+  }
9
+  &-flaxBox {
10
+    width: 94%;
11
+    display: flex;
12
+    align-items: center;
13
+    margin: 0 auto;
14
+    margin-top: 40px;
15
+    margin-bottom: 38px;
16
+    &-liftText {
17
+      width: 95%;
18
+
19
+      &-Titles {
20
+        width: 95%;
21
+
22
+        text-overflow: ellipsis; //显示...
23
+        white-space: nowrap; //不换行
24
+        overflow: hidden;
25
+        font-size: 36px;
26
+        font-weight: bold;
27
+        color: #222222;
28
+      }
29
+      &-price {
30
+        margin-top: 44px;
31
+        font-size: 44px;
32
+        font-weight: 800;
33
+        color: #666666;
34
+        background: linear-gradient(180deg, #fa7878 0%, #b61515 100%);
35
+        -webkit-background-clip: text;
36
+        -webkit-text-fill-color: transparent;
37
+        > Text {
38
+          font-size: 25px;
39
+        }
40
+      }
41
+    }
42
+    &-rightBut {
43
+      align-items: center;
44
+      margin: 0 auto;
45
+    }
46
+  }
47
+  .content-header-box-map {
48
+    width: 94%;
49
+
50
+    margin: 0 auto;
51
+    display: flex;
52
+    align-items: center;
53
+    justify-content: space-between;
54
+    padding-bottom: 60px;
55
+    &-liftCentent {
56
+      display: flex;
57
+      align-items: center;
58
+      > Image {
59
+        width: 22px;
60
+        height: 27px;
61
+      }
62
+      > View {
63
+        padding-left: 15px;
64
+        font-size: 30px;
65
+        font-weight: 800;
66
+        color: #222222;
67
+      }
68
+    }
69
+    &-rightCentent {
70
+      font-size: 30px;
71
+      font-weight: 500;
72
+      color: #666666;
73
+    }
74
+  }
75
+}

+ 74
- 31
src/pages/MoreCars/index.jsx 查看文件

@@ -1,16 +1,16 @@
1 1
 
2 2
 
3
-import {
4
-  View, Image, Input, Picker,
5
-  Text
6
-} from "@tarojs/components"
3
+import { View, Image, Input, Picker, Text } from "@tarojs/components"
4
+import { useModel } from "@/store"
7 5
 
8
-import { useState } from "react"
6
+import withLayout from '@/layouts'
7
+import { useState, useEffect } from "react"
9 8
 import CustomNav from "@/components/CustomNav"
10 9
 import searchs from '@/assets/homesImgaes/searchs.png'//搜索图片
11
-import { getMachineryType } from "@/services/homes"
12
-import CarsListContent from "@/components/CarsListContent"
13
-import withLayout from '@/layouts'
10
+import { getMachineryType, getMachinery } from "@/services/homes"
11
+import CarTypeList from "./CarTypeList"
12
+
13
+
14 14
 
15 15
 import './style.less'
16 16
 
@@ -18,37 +18,80 @@ import './style.less'
18 18
 
19 19
 
20 20
 export default withLayout((props) => {
21
-  const [activeTab, setActiveTab] = useState(1)
21
+  const [activeTab, setActiveTab] = useState(0)
22
+  const { sserLocation } = useModel('userData')
23
+
24
+  const [tabs, setTabs] = useState([])
25
+  const [csrsListType, steCsrsListType] = useState([])
26
+  const [activeNames, setActiveNames] = useState([])//全部分类
27
+  const [classId, setClassId] = useState([])//分类ID
28
+
29
+
30
+
31
+  const [tabIndex, steTabIndex] = useState(0)
22 32
 
23 33
 
24 34
   const handleSearch = (e) => {
25
-    console.log(e?.detail?.value)
26 35
   }
27 36
 
28
-  const tabs = [
29
-    {
30
-      title: '全部',
31
-    },
32
-    {
33
-      title: '收割机',
34
-    },
35
-    {
36
-      title: '水稻机',
37
-    },
38
-    {
39
-      title: '战斗机',
40
-    },
41
-    {
42
-      title: '清障机',
43
-    },
44
-  ]
45 37
 
46 38
 
47 39
 
40
+  // const ClassificationComparison = () => {
41
+  //   for (let item1 of tabs) {
42
+  //     let _index = activeNames.findIndex(c => c.name == item1.title)
43
+  //     if (_index > -1) {
44
+  //       item1.count = activeNames[_index].typeId;
45
+  //       console.log('saleTypes=tempSales //这', activeNames[_index].typeId);
46
+
47
+  //       // classId.push({ id: item1.count })
48
+
49
+  //     }
50
+  //   }
51
+
52
+
53
+
54
+  // }
55
+
56
+  useEffect(() => {
57
+    if (tabIndex !== 0) {
58
+      // ClassificationComparison()
59
+      activeNames.map((item) => {
60
+        classId.push({ id: item.typeId })
61
+
62
+      })
63
+      getMachinery(sserLocation, { typeId: classId[tabIndex - 1].id }).then((e) => {
64
+        console.log('农机分类', e);
65
+        steCsrsListType(e.records)
66
+      })
67
+    } else {
68
+      // ClassificationComparison()
69
+
70
+      getMachinery(sserLocation).then((e) => {
71
+        steCsrsListType(e.records)
72
+      })
73
+    }
74
+
75
+
76
+  }, [sserLocation, tabIndex])
77
+
78
+
79
+  useEffect(() => {
80
+    getMachineryType().then((e) => {
81
+      const tabList = e.records
82
+      setActiveNames(tabList)
83
+      let tabss = tabList.map(x => ({ title: x.name, }))
84
+      const newTabs = [{ title: '全部' }, ...tabss]
85
+      setTabs(newTabs)
86
+
87
+    })
88
+  }, [])
89
+
90
+
48 91
   const handleTabChange = (e) => {
49
-    console.log('e', e.detail.index);
50
-    const { index } = e.detail
51
-    setActiveTab(index)
92
+    console.log('e', e.detail);
93
+    steTabIndex(e?.detail?.index)
94
+
52 95
   }
53 96
 
54 97
 
@@ -75,7 +118,7 @@ export default withLayout((props) => {
75 118
 
76 119
         {/* 内容区域 */}
77 120
         <View className='cententText'>
78
-          <CarsListContent />
121
+          <CarTypeList csrsListType={csrsListType} />
79 122
         </View>
80 123
       </scroll-view>
81 124
     </View>

+ 4
- 3
src/pages/OrderConfirmation/index.jsx 查看文件

@@ -18,7 +18,7 @@ import './style.less'
18 18
 
19 19
 //为了调试,删除了withLayout 记得加上 如果我忘记的话
20 20
 
21
-export default (props) => {
21
+export default withLayout((props) => {
22 22
   //底部弹窗
23 23
   // const [showFrame, setShowFrame] = useState(false)
24 24
   // const setRecommend = () => {
@@ -46,10 +46,11 @@ export default (props) => {
46 46
       machineryType: carsInfo?.typeId,
47 47
       typeName: carsInfo?.typeName,
48 48
       address: address || '',
49
+      orgId: carsInfo?.orgId,
49 50
       // appontmentDate: appontmentDate || '',
50 51
       appontmentDate: '2022-03-25 08:00:00',
51 52
     }).then((es) => {
52
-      // Taro.navigateTo({ url: `/pages/OrderInfo/index?orderId=${es.orderId}` })
53
+      Taro.redirectTo({ url: `/pages/OrderInfo/index?orderId=${es.orderId}` })
53 54
 
54 55
     })
55 56
   }
@@ -118,4 +119,4 @@ export default (props) => {
118 119
 
119 120
     </View>
120 121
   )
121
-}
122
+})

+ 1
- 11
src/pages/OrderInfo/index.jsx 查看文件

@@ -78,17 +78,7 @@ export default withLayout((props) => {
78 78
   }, [orderId])
79 79
 
80 80
   const pay = () => {
81
-    generateOrder({
82
-      charges: 200,
83
-      price: 100,
84
-      amount: 20,
85
-      machineryId: '7cdf832d7a7af0c19ab33418e10e1a94',
86
-      machineryName: '第一台播种机',
87
-      machineryType: 'b4d183f684ed1f3d1cb2194c1975ae46',
88
-      typeName: '播种机',
89
-      address: '我是作业地址:房屋后面',
90
-      appontmentDate: new Date(),
91
-    })
81
+    //支付逻辑
92 82
   }
93 83
 
94 84
 

+ 156
- 153
src/pages/UserLogin/index.jsx 查看文件

@@ -1,154 +1,157 @@
1 1
 
2
-import { useState } from 'react'
3
-import Taro from '@tarojs/taro'
4
-import { getUserQcode, setUserPhone } from '@/services/login'
5
-
6
-import { View, Image, Input, Text, Form } from '@tarojs/components'
7
-import CustomNav from '@/components/CustomNav'
8
-import ButtontWX from '@/components/ButtontWX'
9
-import checkedImg from '@/assets/lolginImages/checkedImg.png'
10
-import unselectedImg from '@/assets/lolginImages/unselectedImg.png'
11
-import { useModel } from '@/store'
12
-
13
-import withLayout from '@/layouts'
14
-
15
-import './style.less'
16
-
17
-
18
-export default withLayout((props) => {
19
-
20
-  const { person, setPerson } = useModel('userData')
21
-
22
-
23
-  const [countCenter, setCountCenter] = useState({
24
-    count: 60,
25
-    toast: false,
26
-    show_btn: false,
27
-    code_ts: '获取验证码'
28
-  })
29
-
30
-  const [checkImage, setCheckImage] = useState(false)
31
-
32
-  const [InputPhoneValue, setInputPhoneValue] = useState('18082043755')
33
-  const [InputCodeValue, setInputCodeValue] = useState('375501')
34
-
35
-  const onInputPhone = (r) => {
36
-    setInputPhoneValue(r?.detail?.value)
37
-    console.log("🚀 ~ file: index.jsx ~ line 26 ~ InputCodeValue", InputPhoneValue)
38
-
39
-  }
40
-  const onInputCode = (r) => {
41
-    setInputCodeValue(r?.detail?.value)
42
-
43
-  }
44
-  //获取验证码
45
-  const getCode = (r) => {
46
-    if (InputPhoneValue === '' || !(/^1[3456789]\d{9}$/.test(InputPhoneValue))) {
47
-      console.log('提示')
48
-      Taro.showToast({
49
-        title: '手机号码有误',
50
-        icon: 'none',
51
-        duration: 2000
52
-      })
53
-
54
-    } else {
55
-      getUserQcode({ phone: InputPhoneValue }).then(() => {
56
-        Taro.showToast({
57
-          title: '验证码发送成功',
58
-          icon: 'none',
59
-          duration: 2000
60
-        })
61
-      })
62
-      let count = countCenter.count
63
-      const timer = setInterval(() => {
64
-        setCountCenter({
65
-          count: (count--),
66
-          show_btn: true,
67
-          code_ts: count + '秒后重发'
68
-        })
69
-        if (count == 0) {
70
-          setCountCenter({
71
-            show_btn: false,
72
-            count: 60,
73
-            code_ts: '获取验证码'
74
-          })
75
-          clearInterval(timer)
76
-
77
-        }
78
-
79
-      }, 1000)
80
-    }
81
-  }
82
-
83
-
84
-
85
-  const getUserLogin = () => {
86
-    if (InputPhoneValue === '' || !(/^1[3456789]\d{9}$/.test(InputPhoneValue))) {
87
-      console.log('提示')
88
-      Taro.showToast({
89
-        title: '手机号或验证码有误',
90
-        icon: 'none',
91
-        duration: 2000
92
-      })
93
-    } else {
94
-      if (!checkImage) {
95
-        Taro.showToast({
96
-          title: '下方协议未勾选',
97
-          icon: 'none',
98
-          duration: 2000
99
-        })
100
-      } else {
101
-        setUserPhone(person.personId, { captcha: InputCodeValue, phone: InputPhoneValue }).then((e) => {
102
-          console.log('e', e);
103
-          setPerson({ ...person, phone: InputPhoneValue })
104
-          Taro.reLaunch({ url: '/pages/index/index?tab=2&userOk' });
105
-        })
106
-        // console.log('person', person);
107
-      }
108
-
109
-    }
110
-
111
-  }
112
-
113
-
114
-
115
-  return (
116
-    <View className='page-index'>
117
-      <View className='index-navbar'>
118
-        <CustomNav title='登陆' home />
119
-      </View>
120
-      <View className='loginBackImg-box' >
121
-        <Image src={require("@/assets/lolginImages/backLogin.png")} />
122
-
123
-        <View className='loginhallo-text'>
124
-          <View>您好!</View>
125
-          <View>欢迎进入农户端小程序!</View>
126
-        </View>
127
-        <View>
128
-          <View className='loginPhone-box' >
129
-            <View className='loginPhone-box-loginPhoneView'>+86</View>
130
-            <Input maxlength={11} placeholder='请输入手机号码' type={Number} value={InputPhoneValue} onInput={onInputPhone} />
131
-
132
-            <ButtontWX opacity={countCenter.show_btn ? '0.7' : '11'} disabled={countCenter.show_btn} onClick={getCode} butText={countCenter.code_ts} butWidth={94} butHeight={34} butFontSize={15} butBorderRadius={10} />
133
-          </View>
134
-          <View className='loginPhone-box'>
135
-            <View className='loginPhone-box-loginPhoneView'>
136
-              <Image style={{ width: '16px', height: '20px', margin: 'auto 2.8vw auto 2.8vw' }} src={require("@/assets/lolginImages/phoneCode.png")} />
137
-            </View>
138
-            <Input maxlength={10} placeholder='请输入验证码' value={InputCodeValue} onInput={onInputCode} />
139
-          </View>
140
-        </View>
141
-      </View>
142
-      <View className='BottomtButrelative'  >
143
-        <ButtontWX onClick={getUserLogin} butText='登陆' butWidth={315} butHeight={49} butFontSize={16} butBorderRadius={49} />
144
-      </View>
145
-      <View className='bottom-agreement'>
146
-        <Image src={!checkImage ? checkedImg : unselectedImg} onClick={() => { setCheckImage(!checkImage) }} />
147
-        <View>
148
-          请认真查看<Text style={{ color: '#CE3800' }}>文本协议/隐私政策</Text>,确认之后选择此项!
149
-        </View>
150
-      </View>
151
-
152
-    </View>
153
-  )
154
-})
2
+// import { useState } from 'react'
3
+// import Taro from '@tarojs/taro'
4
+// import { getUserQcode, setUserPhone } from '@/services/login'
5
+
6
+// import { View, Image, Input, Text, Form } from '@tarojs/components'
7
+// import CustomNav from '@/components/CustomNav'
8
+// import ButtontWX from '@/components/ButtontWX'
9
+// import checkedImg from '@/assets/lolginImages/checkedImg.png'
10
+// import unselectedImg from '@/assets/lolginImages/unselectedImg.png'
11
+// import { useModel } from '@/store'
12
+
13
+// import withLayout from '@/layouts'
14
+
15
+// import './style.less'
16
+
17
+
18
+// export default withLayout((props) => {
19
+
20
+//   const { isLoginVisible } = props
21
+//   console.log("🚀 ~ file: index.jsx ~ line 21 ~ withLayout ~ props", props)
22
+
23
+//   const { person, setPerson } = useModel('userData')
24
+
25
+
26
+//   const [countCenter, setCountCenter] = useState({
27
+//     count: 60,
28
+//     toast: false,
29
+//     show_btn: false,
30
+//     code_ts: '获取验证码'
31
+//   })
32
+
33
+//   const [checkImage, setCheckImage] = useState(false)
34
+
35
+//   const [InputPhoneValue, setInputPhoneValue] = useState('18082043755')
36
+//   const [InputCodeValue, setInputCodeValue] = useState('375501')
37
+
38
+//   const onInputPhone = (r) => {
39
+//     setInputPhoneValue(r?.detail?.value)
40
+//     console.log("🚀 ~ file: index.jsx ~ line 26 ~ InputCodeValue", InputPhoneValue)
41
+
42
+//   }
43
+//   const onInputCode = (r) => {
44
+//     setInputCodeValue(r?.detail?.value)
45
+
46
+//   }
47
+//   //获取验证码
48
+//   const getCode = (r) => {
49
+//     if (InputPhoneValue === '' || !(/^1[3456789]\d{9}$/.test(InputPhoneValue))) {
50
+//       console.log('提示')
51
+//       Taro.showToast({
52
+//         title: '手机号码有误',
53
+//         icon: 'none',
54
+//         duration: 2000
55
+//       })
56
+
57
+//     } else {
58
+//       getUserQcode({ phone: InputPhoneValue }).then(() => {
59
+//         Taro.showToast({
60
+//           title: '验证码发送成功',
61
+//           icon: 'none',
62
+//           duration: 2000
63
+//         })
64
+//       })
65
+//       let count = countCenter.count
66
+//       const timer = setInterval(() => {
67
+//         setCountCenter({
68
+//           count: (count--),
69
+//           show_btn: true,
70
+//           code_ts: count + '秒后重发'
71
+//         })
72
+//         if (count == 0) {
73
+//           setCountCenter({
74
+//             show_btn: false,
75
+//             count: 60,
76
+//             code_ts: '获取验证码'
77
+//           })
78
+//           clearInterval(timer)
79
+
80
+//         }
81
+
82
+//       }, 1000)
83
+//     }
84
+//   }
85
+
86
+
87
+
88
+//   const getUserLogin = () => {
89
+//     if (InputPhoneValue === '' || !(/^1[3456789]\d{9}$/.test(InputPhoneValue))) {
90
+//       console.log('提示')
91
+//       Taro.showToast({
92
+//         title: '手机号或验证码有误',
93
+//         icon: 'none',
94
+//         duration: 2000
95
+//       })
96
+//     } else {
97
+//       if (!checkImage) {
98
+//         Taro.showToast({
99
+//           title: '下方协议未勾选',
100
+//           icon: 'none',
101
+//           duration: 2000
102
+//         })
103
+//       } else {
104
+//         setUserPhone(person.personId, { captcha: InputCodeValue, phone: InputPhoneValue }).then((e) => {
105
+//           console.log('e', e);
106
+//           setPerson({ ...person, phone: InputPhoneValue })
107
+//           Taro.reLaunch({ url: '/pages/index/index?tab=2&userOk' });
108
+//         })
109
+//         // console.log('person', person);
110
+//       }
111
+
112
+//     }
113
+
114
+//   }
115
+
116
+
117
+
118
+//   return (
119
+//     <View className='page-index' hidden={isLoginVisible}>
120
+//       <View className='index-navbar'>
121
+//         <CustomNav title='登陆' home />
122
+//       </View>
123
+//       <View className='loginBackImg-box' >
124
+//         <Image src={require("@/assets/lolginImages/backLogin.png")} />
125
+
126
+//         <View className='loginhallo-text'>
127
+//           <View>您好!</View>
128
+//           <View>欢迎进入农户端小程序!</View>
129
+//         </View>
130
+//         <View>
131
+//           <View className='loginPhone-box' >
132
+//             <View className='loginPhone-box-loginPhoneView'>+86</View>
133
+//             <Input maxlength={11} placeholder='请输入手机号码' type={Number} value={InputPhoneValue} onInput={onInputPhone} />
134
+
135
+//             <ButtontWX opacity={countCenter.show_btn ? '0.7' : '11'} disabled={countCenter.show_btn} onClick={getCode} butText={countCenter.code_ts} butWidth={94} butHeight={34} butFontSize={15} butBorderRadius={10} />
136
+//           </View>
137
+//           <View className='loginPhone-box'>
138
+//             <View className='loginPhone-box-loginPhoneView'>
139
+//               <Image style={{ width: '16px', height: '20px', margin: 'auto 2.8vw auto 2.8vw' }} src={require("@/assets/lolginImages/phoneCode.png")} />
140
+//             </View>
141
+//             <Input maxlength={10} placeholder='请输入验证码' value={InputCodeValue} onInput={onInputCode} />
142
+//           </View>
143
+//         </View>
144
+//       </View>
145
+//       <View className='BottomtButrelative'  >
146
+//         <ButtontWX onClick={getUserLogin} butText='登陆' butWidth={315} butHeight={49} butFontSize={16} butBorderRadius={49} />
147
+//       </View>
148
+//       <View className='bottom-agreement'>
149
+//         <Image src={!checkImage ? checkedImg : unselectedImg} onClick={() => { setCheckImage(!checkImage) }} />
150
+//         <View>
151
+//           请认真查看<Text style={{ color: '#CE3800' }}>文本协议/隐私政策</Text>,确认之后选择此项!
152
+//         </View>
153
+//       </View>
154
+
155
+//     </View>
156
+//   )
157
+// })

+ 64
- 64
src/pages/UserLogin/style.less 查看文件

@@ -1,69 +1,69 @@
1
-.loginBackImg-box {
2
-  width: 100vw;
3
-  height: 100vh;
4
-  > Image {
5
-    height: 100%;
6
-    width: 100%;
1
+// .loginBackImg-box {
2
+//   width: 100vw;
3
+//   height: 100vh;
4
+//   > Image {
5
+//     height: 100%;
6
+//     width: 100%;
7 7
 
8
-    position: absolute;
9
-    top: 0;
10
-  }
8
+//     position: absolute;
9
+//     top: 0;
10
+//   }
11 11
 
12
-  .loginhallo-text {
13
-    position: relative;
14
-    margin: 98px 0 80px 30px;
15
-  }
16
-  .loginhallo-text:nth-child(1) {
17
-    font-size: 66px;
18
-    font-weight: bold;
19
-    color: #333333;
20
-  }
21
-  .loginhallo-text:nth-child(2) {
22
-    font-size: 54px;
23
-    font-weight: bold;
24
-    color: #333333;
25
-  }
12
+//   .loginhallo-text {
13
+//     position: relative;
14
+//     margin: 98px 0 80px 30px;
15
+//   }
16
+//   .loginhallo-text:nth-child(1) {
17
+//     font-size: 66px;
18
+//     font-weight: bold;
19
+//     color: #333333;
20
+//   }
21
+//   .loginhallo-text:nth-child(2) {
22
+//     font-size: 54px;
23
+//     font-weight: bold;
24
+//     color: #333333;
25
+//   }
26 26
 
27
-  .loginPhone-box {
28
-    width: 93%;
29
-    height: 108px;
30
-    margin: 0 auto;
31
-    position: relative;
32
-    display: flex;
33
-    align-items: center;
34
-    border-bottom: 1px solid rgba(0, 0, 0, 0.12);
35
-    padding-bottom: 12px;
27
+//   .loginPhone-box {
28
+//     width: 93%;
29
+//     height: 108px;
30
+//     margin: 0 auto;
31
+//     position: relative;
32
+//     display: flex;
33
+//     align-items: center;
34
+//     border-bottom: 1px solid rgba(0, 0, 0, 0.12);
35
+//     padding-bottom: 12px;
36 36
 
37
-    &-loginPhoneView {
38
-      font-size: 38px;
39
-      font-weight: 500;
40
-      color: #333333;
41
-      height: 39px;
42
-      line-height: 39px;
43
-      padding-right: 20px;
44
-      margin-right: 31px;
45
-      border-right: 3px solid #000;
46
-    }
47
-  }
48
-}
49
-.BottomtButrelative {
50
-  position: relative;
51
-  bottom: 5vh;
52
-}
37
+//     &-loginPhoneView {
38
+//       font-size: 38px;
39
+//       font-weight: 500;
40
+//       color: #333333;
41
+//       height: 39px;
42
+//       line-height: 39px;
43
+//       padding-right: 20px;
44
+//       margin-right: 31px;
45
+//       border-right: 3px solid #000;
46
+//     }
47
+//   }
48
+// }
49
+// .BottomtButrelative {
50
+//   position: relative;
51
+//   bottom: 5vh;
52
+// }
53 53
 
54
-.bottom-agreement {
55
-  position: relative;
56
-  display: flex;
57
-  align-items: center;
58
-  font-size: 26px;
59
-  color: #2a2a2a;
60
-  margin-left: 30px;
61
-  margin-bottom: 60px;
62
-  // height: 2vh;
63
-  // bottom: 8vh;
64
-  > Image {
65
-    width: 28px;
66
-    height: 28px;
67
-    margin-right: 11px;
68
-  }
69
-}
54
+// .bottom-agreement {
55
+//   position: relative;
56
+//   display: flex;
57
+//   align-items: center;
58
+//   font-size: 26px;
59
+//   color: #2a2a2a;
60
+//   margin-left: 30px;
61
+//   margin-bottom: 60px;
62
+//   // height: 2vh;
63
+//   // bottom: 8vh;
64
+//   > Image {
65
+//     width: 28px;
66
+//     height: 28px;
67
+//     margin-right: 11px;
68
+//   }
69
+// }

+ 15
- 8
src/pages/index/index.jsx 查看文件

@@ -3,6 +3,7 @@ import Taro, { useDidShow } from '@tarojs/taro'
3 3
 import withLayout from '@/layouts'
4 4
 import CustomNav from '@/components/CustomNav'
5 5
 import { useModel } from '@/store'
6
+import LoginModel from "@/components/LoginModel"
6 7
 
7 8
 import tabList from './tabbar'
8 9
 import Homes from './tabs/Homes'
@@ -16,6 +17,7 @@ export default withLayout((props) => {
16 17
   const { router } = props
17 18
   const { person } = useModel('userData')
18 19
 
20
+
19 21
   const { params, path } = router
20 22
   const { tab } = params || {}
21 23
 
@@ -23,6 +25,9 @@ export default withLayout((props) => {
23 25
 
24 26
   const [isDidShow, setIsDidShow] = useState(0)
25 27
 
28
+  const [isShow, setIsShow] = useState(false)
29
+
30
+
26 31
   useDidShow(() => {
27 32
     setIsDidShow(isDidShow + 1)
28 33
   })
@@ -31,28 +36,30 @@ export default withLayout((props) => {
31 36
     if (tab) {
32 37
       setCurrentTab(tab - 0)
33 38
     }
39
+    // setIsShow(true)
34 40
   }, [tab,])
35 41
 
36 42
 
37 43
   const handleTabChange = (e) => {
38
-    const { index } = e.detail
39
-    setCurrentTab(index)
40
-    // if (!person?.phone) {
41
-    //   Taro.navigateTo({ url: `/pages/UserLogin/index` })
42 44
 
43
-    // } else {
44
-    //   const { index } = e.detail
45
-    //   setCurrentTab(index)
45
+    if (!person?.phone) {
46
+      // Taro.navigateTo({ url: `/pages/UserLogin/index` })
47
+      setIsShow(true)
48
+    } else {
49
+      const { index } = e.detail
50
+      setCurrentTab(index)
46 51
 
47
-    // }
52
+    }
48 53
 
49 54
   }
50 55
 
51 56
 
52 57
   return (
53 58
     <view className='page-index'>
59
+      <LoginModel isLoginVisible={isShow} />
54 60
 
55 61
       <view className='index-navbar'>
62
+
56 63
         <CustomNav title='首页' home />
57 64
       </view>
58 65
       <view className='index-container'>

+ 4
- 1
src/pages/index/tabs/Homes.jsx 查看文件

@@ -20,6 +20,7 @@ export default withLayout((props) => {
20 20
   const { person, setPerson } = useModel('userData')
21 21
 
22 22
 
23
+
23 24
   useEffect(() => {
24 25
     getHomeBanner({ position: 'banner' }).then((e) => {
25 26
       console.log('e', e);
@@ -42,7 +43,9 @@ export default withLayout((props) => {
42 43
   }
43 44
 
44 45
   const goToCarsList = () => {//更多
45
-    Taro.navigateTo({ url: '/pages/MoreCars/index' })
46
+    Taro.navigateTo({ url: `/pages/MoreCars/index` })
47
+
48
+
46 49
 
47 50
   }
48 51
 

+ 27
- 31
src/pages/index/tabs/Orders.jsx 查看文件

@@ -9,7 +9,7 @@ import { getOrder } from "@/services/order"
9 9
 import formatTimes from "@/utils/codeSegment"
10 10
 import { useModel } from "@/store"
11 11
 import withLayout from '@/layouts'
12
-
12
+import ListPlaceholder from "@/components/ListPlaceholder"
13 13
 import './OrdersCss/style.less'
14 14
 
15 15
 
@@ -87,40 +87,36 @@ export default withLayout((props) => {
87 87
   return (
88 88
     <scroll-view scrollY style='height: 100%;' >
89 89
 
90
+      <View className='content-header-box-orders'>
91
+        <View className='content-header-box-orders-liftCentent'>
92
+          <Image src={ordersListImga} />
93
+          <View>订单列表</View>
94
+        </View>
95
+        {/* <View className='content-header-box-orders-rightCentent'>更多&gt;&gt;</View> */}
96
+      </View>
90 97
       {
91
-        person?.phone ? <>
92
-          <View className='content-header-box-orders'>
93
-            <View className='content-header-box-orders-liftCentent'>
94
-              <Image src={ordersListImga} />
95
-              <View>订单列表</View>
96
-            </View>
97
-            {/* <View className='content-header-box-orders-rightCentent'>更多&gt;&gt;</View> */}
98
-          </View>
99
-          {
100
-            ourderList.map((item, index) => {
101
-              return (
102
-                <View key={index} className='orders-listBox'>
103
-                  <Image src={ordersLeft} />
104
-                  <View className='orders-listBox-RihtboxBoxOrderViewText'>
105
-                    <View className='View-LiftTextTop' onClick={() => handleTobePaid(item.orderId)} >订单编号:<Text>{item.orderNo}</Text><Text className='View-LiftTextTop-nextText'>更多&gt;&gt;</Text></View>
106
-                    <View>农机名称:<Text>{item.machineryName}</Text></View>
107
-                    <View>作业面积:<Text>{item.amount}</Text></View>
108
-                    <View>需求时间:<Text>{formatTimes(item.appointmentDate, 'yyyy-MM-dd hh:mm')}</Text></View>
109
-                    <View>下单时间:<Text>{formatTimes(item.createDate, 'yyyy-MM-dd hh:mm')}</Text></View>
110
-                    <View className='View-LiftTextBotton'>
111
-                      <View>订单状态:<Text style={{ color: orderStates(item.payStatus).styleColor }} >{orderStates(item.orderState).title}</Text></View>
112
-                      <View>费用:<Text className='feiyongStyle'>{item.charges}</Text></View>
113
-                    </View>
114
-                  </View>
98
+        ourderList != [] ? ourderList.map((item, index) => {
99
+          return (
100
+            <View key={index} className='orders-listBox'>
101
+              <Image src={ordersLeft} />
102
+              <View className='orders-listBox-RihtboxBoxOrderViewText'>
103
+                <View className='View-LiftTextTop' onClick={() => handleTobePaid(item.orderId)} >订单编号:<Text>{item.orderNo}</Text><Text className='View-LiftTextTop-nextText'>更多&gt;&gt;</Text></View>
104
+                <View>农机名称:<Text>{item.machineryName}</Text></View>
105
+                <View>作业面积:<Text>{item.amount}</Text></View>
106
+                <View>需求时间:<Text>{formatTimes(item.appointmentDate, 'yyyy-MM-dd hh:mm')}</Text></View>
107
+                <View>下单时间:<Text>{formatTimes(item.createDate, 'yyyy-MM-dd hh:mm')}</Text></View>
108
+                <View className='View-LiftTextBotton'>
109
+                  <View>订单状态:<Text style={{ color: orderStates(item.payStatus).styleColor }} >{orderStates(item.orderState).title}</Text></View>
110
+                  <View>费用:<Text className='feiyongStyle'>{item.charges}</Text></View>
115 111
                 </View>
116
-              )
117
-            })
118
-
119
-          }
120
-        </>
121
-          : <View>未登录,请先登陆</View>
112
+              </View>
113
+            </View>
114
+          )
115
+        })
116
+          : <ListPlaceholder title='您还没有新的订单!' />
122 117
       }
123 118
 
119
+
124 120
     </scroll-view>
125 121
   )
126 122
 })

+ 10
- 7
src/utils/hooks/useLogin.js 查看文件

@@ -1,27 +1,30 @@
1
-import Taro, { useRouter, useDidShow } from "@tarojs/taro";
1
+
2
+
3
+
4
+import Taro, { useRouter } from "@tarojs/taro";
2 5
 import { useModel } from '@/store'
3
-import { useEffect, useMemo } from "react";
6
+import { useMemo, useState, useEffect } from "react";
4 7
 
5 8
 const whiteList = [
6
-  "/pages/UserLogin/index",
7 9
   "/pages/index/index"
8 10
 ]
9 11
 
10 12
 export default () => {
11 13
   const router = useRouter()
12 14
   const { person } = useModel('userData')
15
+  const [loginVisible, setLoginVisible] = useState(false)
13 16
 
14 17
   const isInWhiteList = useMemo(() => whiteList.includes(router.path), [router.path])
15 18
   const hasPhone = useMemo(() => !!person?.phone, [person?.phone])
16 19
 
17
-
18 20
   useEffect(() => {
19 21
     if (!isInWhiteList && !hasPhone) {
20
-      Taro.navigateTo({ url: "/pages/UserLogin/index" });
22
+      setLoginVisible(true)
23
+    } else {
24
+      setLoginVisible(false)
21 25
     }
22 26
   }, [hasPhone, isInWhiteList])
23 27
 
24 28
 
25
-
26
-  return { hasPhone, isInWhiteList }
29
+  return { loginVisible }
27 30
 };