Pārlūkot izejas kodu

Merge branch 'master' of http://git.ycjcjy.com/nanyang/machinery-miniapp

Yansen 2 gadus atpakaļ
vecāks
revīzija
e805208bc1

+ 14
- 2
project.config.json Parādīt failu

@@ -39,8 +39,20 @@
39 39
         "disableUseStrict": false,
40 40
         "showES6CompileOption": false,
41 41
         "useCompilerPlugins": false,
42
-        "minifyWXML": true
42
+        "minifyWXML": true,
43
+        "ignoreDevUnusedFiles": false,
44
+        "ignoreUploadUnusedFiles": false
43 45
     },
44 46
     "compileType": "miniprogram",
45
-    "condition": {}
47
+    "condition": {},
48
+    "libVersion": "2.25.0",
49
+    "srcMiniprogramRoot": "dist/",
50
+    "packOptions": {
51
+        "ignore": [],
52
+        "include": []
53
+    },
54
+    "editorSetting": {
55
+        "tabIndent": "insertSpaces",
56
+        "tabSize": 4
57
+    }
46 58
 }

+ 9
- 0
project.private.config.json Parādīt failu

@@ -0,0 +1,9 @@
1
+{
2
+    "description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
3
+    "projectname": "machinery-miniapp",
4
+    "setting": {
5
+        "compileHotReLoad": true,
6
+        "urlCheck": false,
7
+        "preloadBackgroundData": false
8
+    }
9
+}

Binārs
src/assets/mineImgaes/userMoren.png Parādīt failu


+ 6
- 49
src/components/AssessModel/index.jsx Parādīt failu

@@ -1,52 +1,25 @@
1
-
2 1
 import { useState } from 'react'
3
-
4
-import ButtontWX from '@/components/ButtontWX'
5
-import { Textarea, View } from '@tarojs/components'
6
-
7 2
 import Taro from '@tarojs/taro'
3
+import { Textarea, View } from '@tarojs/components'
4
+import ButtontWX from '@/components/ButtontWX'
5
+import { orderEvaluation } from '@/services/order'
8 6
 import starOn from '@/assets/icons/comm/starOn.png'
9 7
 import starOff from '@/assets/icons/comm/starOff.png'
10
-import Popup from '@/components/Popup'
11
-// import { saveEvaluate } from '@/services/mine'
12
-import { orderEvaluation } from '@/services/order'
13 8
 import './style.less'
14 9
 
15
-
16
-
17
-
18
-
19
-
20 10
 export default (props) => {
21
-  const { showCutover, maskClosable, orderId, onClose, goBACK } = props
22
-
11
+  const { showCutover, orderId, onClose } = props
23 12
   const scoreList = new Array(5).fill(0)
24
-
25
-
26 13
   const [textAreaCentent, setTextAreaCentent] = useState('')
27
-
28
-
29
-
30 14
   const [evaluate, setEvaluate] = useState({
31 15
     sweetScore: 0,
32 16
   })
33
-
34
-
35
-
36 17
   const [kwCollectNub, setkwCollectNub] = useState(0)
37 18
   const kwChange = (e, val) => {
38 19
     e.stopPropagation();
39 20
     setkwCollectNub(val + 1)
40
-
41
-    console.log("🚀 ~ file: index.jsx ~ line 49 ~ kwChange ~ val", e, val + 1)
42
-
43 21
     setEvaluate({ sweetScore: val + 1, })
44 22
   }
45
-
46
-
47
-  const ButtonCancel = () => {
48
-    onClose()
49
-  }
50 23
   const ButtonOK = (e) => {
51 24
     if (evaluate.sweetScore == 0) {
52 25
       Taro.showToast({
@@ -56,7 +29,6 @@ export default (props) => {
56 29
       return;
57 30
     }
58 31
     else {
59
-
60 32
       orderEvaluation({ orderId: orderId, score: kwCollectNub, content: textAreaCentent }).then(() => {
61 33
         Taro.showToast({
62 34
           title: '评价成功',
@@ -68,15 +40,11 @@ export default (props) => {
68 40
           }, 500);
69 41
         })
70 42
       })
71
-
72 43
     }
73 44
   }
74 45
 
75
-
76
-
77 46
   return (
78 47
     <>
79
-
80 48
       {
81 49
         showCutover ? <View className='modelBack' >
82 50
           <View className='assessModel-box'>
@@ -85,7 +53,6 @@ export default (props) => {
85 53
                 <text className='card-box-star-text'  >满意度:</text>
86 54
                 {
87 55
                   scoreList.map((_, index) => {
88
-
89 56
                     const src = index < kwCollectNub ? starOn : starOff
90 57
                     return (
91 58
                       <image className='card-star-image' key={index} src={src} onClick={(e) => kwChange(e, index)} />
@@ -93,24 +60,14 @@ export default (props) => {
93 60
                   })
94 61
                 }
95 62
               </view>
96
-
97 63
             </view>
98 64
             <Textarea placeholder='请输入评价内容' onInput={(e) => setTextAreaCentent(e.detail.value)} />
99 65
             <View className='bottomButtomBox'>
100 66
               <ButtontWX onClick={ButtonOK} butText='提交' butWidth={80} butHeight={34} butFontSize={16} butBorderRadius={0} />
101 67
             </View>
102 68
           </View>
103
-
104
-
105
-
106
-        </View> : <View></View>
69
+        </View> : <></>
107 70
       }
108 71
     </>
109
-
110
-
111
-
112
-
113
-
114 72
   )
115
-}
116
-
73
+}

+ 2
- 27
src/components/CarsListContent/index.jsx Parādīt failu

@@ -1,13 +1,11 @@
1 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"
2
+import { View, Image, Text, } from "@tarojs/components"
3
+import Taro from "@tarojs/taro"
5 4
 import ButtontWX from '@/components/ButtontWX'
6 5
 import withLayout from '@/layouts'
7 6
 import addresss from '@/assets/mineImgaes/addresss.png'//地址
8 7
 import { useModel } from "@/store"
9 8
 import ListPlaceholder from "@/components/ListPlaceholder"
10
-import { getMachinery, } from "@/services/homes"
11 9
 import formatPrice from "@/utils/formatPrice"
12 10
 import { setMorKm } from '@/utils/codeSegment'
13 11
 
@@ -18,39 +16,17 @@ export default withLayout((props) => {
18 16
 
19 17
   const { carsList } = props
20 18
   const { sserLocation } = useModel('userData')
21
-  // const { carsList } = props
22
-
23
-  // const [carsList, setCarsList] = useState([])
24
-
25
-  // useEffect(() => {
26
-  //   getMachinery(sserLocation).then((e) => {
27
-  //     setCarsList(e.records)
28
-  //   })
29
-
30
-  // }, [sserLocation])
31
-
32
-
33
-
34
-
35 19
   const startReserve = (res) => {
36 20
     Taro.navigateTo({ url: `/pages/OrderConfirmation/index?id=${res}&location=${sserLocation}` })
37
-
38 21
   }
39 22
   const goCarsInfo = (res) => {
40 23
     Taro.navigateTo({ url: `/pages/CheckDetails/index?id=${res}&location=${sserLocation}` })
41
-
42 24
   }
43 25
   const goMapInfo = (res) => {
44
-    console.log("🚀 ~ file: index.jsx ~ line 43 ~ goMapInfo ~ res", res)
45 26
     Taro.navigateTo({ url: `/pages/CheckMap/index?id=${res}&location=${sserLocation}` })
46
-
47
-
48 27
   }
49 28
 
50
-
51 29
   return (
52
-
53
-
54 30
     <>
55 31
       {
56 32
         carsList?.length > 0 ? carsList.map((item, index) => {
@@ -77,7 +53,6 @@ export default withLayout((props) => {
77 53
           )
78 54
         }) : <ListPlaceholder title='暂无农机信息!' />
79 55
       }
80
-
81 56
     </>
82 57
   )
83 58
 })

+ 5
- 19
src/components/LoginModel/index.jsx Parādīt failu

@@ -45,8 +45,6 @@ export default (props) => {
45 45
 
46 46
   const onInputPhone = (r) => {
47 47
     setInputPhoneValue(r?.detail?.value)
48
-    console.log("🚀 ~ file: index.jsx ~ line 26 ~ InputCodeValue", InputPhoneValue)
49
-
50 48
   }
51 49
   const onInputCode = (r) => {
52 50
     setInputCodeValue(r?.detail?.value)
@@ -55,7 +53,6 @@ export default (props) => {
55 53
   //获取验证码
56 54
   const getCode = (r) => {
57 55
     if (InputPhoneValue === '' || !(/^1[3456789]\d{9}$/.test(InputPhoneValue))) {
58
-      console.log('提示')
59 56
       Taro.showToast({
60 57
         title: '手机号码有误',
61 58
         icon: 'none',
@@ -96,7 +93,6 @@ export default (props) => {
96 93
   const getUserLogin = () => {
97 94
 
98 95
     if (InputPhoneValue === '' || !(/^1[3456789]\d{9}$/.test(InputPhoneValue))) {
99
-      console.log('提示')
100 96
       Taro.showToast({
101 97
         title: '手机号或验证码有误',
102 98
         icon: 'none',
@@ -111,40 +107,30 @@ export default (props) => {
111 107
         })
112 108
       } else {
113 109
         setUserPhone(person.personId, { captcha: InputCodeValue, phone: InputPhoneValue }).then((e) => {
114
-          console.log('e', e);
115
-
116 110
           setPerson(e.person)
117 111
           // Taro.navigateTo({ url: path });
118 112
           // Taro.navigateTo({ url: `/pages/index/index?tab=${tab}` });
119
-
120 113
           if (loginType) {
121
-
122 114
             Taro.navigateBack({
123 115
               delta: 1
124 116
             })
125
-
126 117
           } else {
127 118
             myClosure()
128
-
129 119
           }
130 120
         })
131
-        // console.log('person', person);
132 121
       }
133
-
134 122
     }
135
-
136 123
   }
137 124
 
138
-
139
-
140 125
   return (
141 126
     <>
142 127
       {
143 128
         isLoginVisible !== myClosures ? myClosures : isLoginVisible ?
144 129
           <View className='page-index  ' style={{ position: 'absolute', zIndex: '29999' }
145
-          }>
130
+          }
131
+          >
146 132
             <View className='index-navbar'>
147
-              <CustomNav title='登' home />
133
+              <CustomNav title='登' home />
148 134
             </View>
149 135
             <View className='loginBackImg-box' >
150 136
               <Image src={require("@/assets/lolginImages/backLogin.png")} />
@@ -157,7 +143,7 @@ export default (props) => {
157 143
                 <View className='loginPhone-box' >
158 144
                   <View className='loginPhone-box-loginPhoneView'>+86</View>
159 145
                   <Input maxlength={11} placeholder='请输入手机号码' type={Number} value={InputPhoneValue} onInput={onInputPhone} />
160
-                  <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} />
146
+                  <ButtontWX opacity={countCenter.show_btn ? '0.7' : '11'} disabled={countCenter.show_btn} onClick={getCode} butText={countCenter.code_ts} butWidth={150} butHeight={34} butFontSize={15} butBorderRadius={10} />
161 147
                 </View>
162 148
                 <View className='loginPhone-box'>
163 149
                   <View className='loginPhone-box-loginPhoneView'>
@@ -168,7 +154,7 @@ export default (props) => {
168 154
               </View>
169 155
             </View>
170 156
             <View className='BottomtButrelative'  >
171
-              <ButtontWX onClick={getUserLogin} butText='登' butWidth={315} butHeight={49} butFontSize={16} butBorderRadius={49} />
157
+              <ButtontWX onClick={getUserLogin} butText='登' butWidth={315} butHeight={49} butFontSize={16} butBorderRadius={49} />
172 158
             </View>
173 159
             <View className='bottom-agreement'>
174 160
               <Image src={!checkImage ? checkedImg : unselectedImg} onClick={() => { setCheckImage(!checkImage) }} />

+ 0
- 10
src/components/orderRater/index.js Parādīt failu

@@ -57,32 +57,22 @@ Component({
57 57
       ]
58 58
     }
59 59
   },
60
-
61 60
   data: {
62 61
     initScore: 0
63 62
   },
64
-
65
-
66 63
   methods: {
67
-
68 64
     clickStar: function (e) {
69 65
       if (this.properties.onlyShow) return
70 66
       let index = e.currentTarget.dataset.index
71 67
       this.setData({
72 68
         initScore: index + 1
73 69
       })
74
-
75
-      console.log("🚀 ~ file: index.js ~ line 73 ~ index + 1", index + 1)
76 70
       this.triggerEvent('raterChange', index + 1)
77
-
78
-
79
-
80 71
     }
81 72
   },
82 73
   ready () {
83 74
     this.setData({
84 75
       initScore: this.properties.score
85 76
     })
86
-    console.log('ready')
87 77
   }
88 78
 })

+ 2
- 48
src/layouts/index.jsx Parādīt failu

@@ -1,7 +1,7 @@
1 1
 
2 2
 
3 3
 import useRouter from '@/utils/hooks/useRouter'
4
-import { useEffect, useMemo, useState } from 'react'
4
+import { useMemo } from 'react'
5 5
 import { useModel } from '@/store'
6 6
 import Spin from "@/components/Spin";
7 7
 
@@ -31,50 +31,4 @@ export default (Child) => (props) => {
31 31
   )
32 32
 
33 33
 
34
-}
35
-
36
-
37
-
38
-
39
-
40
-
41
-
42
-
43
-
44
-// import useRouter from '@/utils/hooks/useRouter'
45
-// import Taro from '@tarojs/taro'
46
-// import { useState, useMemo } from 'react'
47
-// import { useModel } from '@/store'
48
-// import LoginModel from '@/components/LoginModel'
49
-// import useLogin from '@/utils/hooks/useLogin'
50
-
51
-
52
-// export default (Child) => (props) => {
53
-//   const { person } = useModel('userData')
54
-//   const router = useRouter()
55
-//   const [isShow, setIsShow] = useState(false)
56
-
57
-
58
-//   const { path } = router
59
-
60
-//   useLogin()
61
-//   console.log("🚀 ~ file: index.jsx ~ line 20 ~   useLogin().abac", useLogin())
62
-
63
-//   const isShowFun = () => {
64
-//     setIsShow(true)
65
-
66
-//   }
67
-//   // Taro.useReady(()=>{
68
-//   //   useLogin(person,router)
69
-//   // })
70
-//   // useEffect(()=>{
71
-//   //   useLogin(person,router)
72
-//   // },[person, person?.phone, router, router?.path])
73
-
74
-//   // 确保执行过 login 方法,拿到了 person
75
-//   const isLoged = useMemo(() => !!person?.personId, [person?.personId])
76
-
77
-//   return isLoged ? <Child {...props} router={router} /> : <LoginModel isLoginVisible={isShow} />
78
-// }
79
-
80
-
34
+}

+ 2
- 19
src/pages/AddressInfos/index.jsx Parādīt failu

@@ -1,32 +1,20 @@
1
-import { View, Form, Input, Switch, Textarea } from "@tarojs/components"
1
+import { View, Form, Textarea } from "@tarojs/components"
2 2
 import Taro from "@tarojs/taro"
3 3
 import CustomNav from "@/components/CustomNav"
4 4
 import ButtontWX from '@/components/ButtontWX'
5
-import { addressSave, getAddress, addressDelete, addressUpdate } from "@/services/address"
5
+import { addressSave, addressUpdate } from "@/services/address"
6 6
 import withLayout from '@/layouts'
7
-
8 7
 import './style.less'
9 8
 
10
-
11
-
12
-
13
-
14 9
 export default withLayout((props) => {
15 10
 
16 11
   const $instance = Taro.getCurrentInstance()
17 12
   const { addressId, address } = $instance.router.params
18 13
 
19 14
   const formSubmit = e => {
20
-
21 15
     const value = e?.detail?.value
22
-    console.log(value)
23
-
24
-
25
-
26 16
     if (addressId) {
27
-
28 17
       addressUpdate(addressId, { address: value.address }).then((res) => {
29
-        console.log('地址修改成功', res);
30 18
         Taro.showToast({
31 19
           title: '地址修改成功',
32 20
           icon: 'success',
@@ -37,12 +25,10 @@ export default withLayout((props) => {
37 25
               delta: 1
38 26
             })
39 27
           }, 1000)
40
-
41 28
         })
42 29
       })
43 30
     } else {
44 31
       addressSave({ address: value.address }).then((e) => {
45
-        console.log('地址添加成功', e);
46 32
         Taro.showToast({
47 33
           title: '地址添加成功',
48 34
           icon: 'success',
@@ -56,10 +42,7 @@ export default withLayout((props) => {
56 42
         })
57 43
       })
58 44
     }
59
-
60
-
61 45
   }
62
-
63 46
   const formReset = e => {
64 47
     console.log(e)
65 48
   }

+ 2
- 25
src/pages/CheckDetails/index.jsx Parādīt failu

@@ -9,14 +9,9 @@ import addresss from '@/assets/mineImgaes/addresss.png'//地址
9 9
 import { getMachineryInfo } from "@/services/homes"
10 10
 import formatPrice from "@/utils/formatPrice"
11 11
 import TextContent from "./TextContent"
12
-
13
-
14 12
 import './style.less'
15 13
 
16
-
17
-
18 14
 export default withLayout((props) => {
19
-  console.log("🚀 ~ file: index.jsx ~ line 14 ~ props", props)
20 15
 
21 16
   const $instance = Taro.getCurrentInstance()
22 17
   const { id, location } = $instance.router.params
@@ -39,34 +34,25 @@ export default withLayout((props) => {
39 34
 
40 35
   }, [$instance.router.params, id, location])
41 36
 
42
-  console.log("🚀 ~ file: index.jsx ~ line 23 ~ carsInfo", carsInfo)
43
-
44
-
45 37
   const startReserve = () => {
46 38
     Taro.navigateTo({ url: `/pages/OrderConfirmation/index?id=${carsInfo?.machineryId}&location=${location}` })
47
-
48 39
   }
49 40
 
50 41
   const goMapInfo = (res) => {
51 42
     Taro.navigateTo({ url: `/pages/CheckMap/index?id=${carsInfo?.machineryId}&location=${location}` })
52
-
53 43
   }
54 44
 
55 45
   return (
56 46
     <View className='page-index'>
57
-
58 47
       <View className='index-navbar'>
59 48
         <CustomNav title='查看详情' />
60 49
       </View>
61 50
       <scroll-view scrollY style='height: 100%;' >
62
-
63 51
         <View >
64
-
65 52
           {/* <Image style={{ width: '100%' }} src='http://img3.jc001.cn/img/001/1/1512/15566fd0311736f.jpg' /> */}
66 53
           <Swiper
67 54
             mode='scaleToFill'
68 55
             className='swiper-box-info'
69
-
70 56
           >
71 57
             {imagesList.map((item, inx) => (
72 58
               <SwiperItem key={inx}>
@@ -83,7 +69,7 @@ export default withLayout((props) => {
83 69
             <View className='content-header-box-map-Info' onClick={() => goMapInfo('222888')}>
84 70
               <View className='content-header-box-map-Info-liftCentent'>
85 71
                 <Image src={addresss} />
86
-                <View>距离当前位置8.8公里&gt;&gt;</View>
72
+                <View>距离当前位置{carsInfo?.distance/1000}公里&gt;&gt;</View>
87 73
               </View>
88 74
             </View>
89 75
             <View className='content-header-box-map-Info-carsName'>{carsInfo?.orgName}</View>
@@ -95,27 +81,18 @@ export default withLayout((props) => {
95 81
               </View>
96 82
               {
97 83
                 contentList.map((item, index) => {
98
-
99 84
                   return (
100
-                    <TextContent item={item} />
85
+                    <TextContent key={item.machineryId} item={item} />
101 86
                   )
102
-
103
-
104 87
                 })
105 88
               }
106
-
107
-
108 89
             </View>
109 90
             <View className='startReserve-Bottom-oen'>
110 91
               <ButtontWX butText='预约' onClick={startReserve} butWidth={300} butHeight={49} butFontSize={16} butBorderRadius={49} />
111
-
112 92
             </View>
113
-
114
-
115 93
           </View>
116 94
         </View>
117 95
       </scroll-view>
118
-
119 96
     </View >
120 97
   )
121 98
 })

+ 2
- 2
src/pages/CheckDetails/style.less Parādīt failu

@@ -13,8 +13,6 @@
13 13
   background-color: #fff;
14 14
   border-radius: 40px 40px 0px 0px;
15 15
   .CheckDetails-bottom-box-flaxBox-liftText {
16
-    width: 95%;
17
-
18 16
     display: flex;
19 17
     justify-content: space-between;
20 18
 
@@ -33,6 +31,8 @@
33 31
       background: linear-gradient(180deg, #fa7878 0%, #b61515 100%);
34 32
       -webkit-background-clip: text;
35 33
       -webkit-text-fill-color: transparent;
34
+      width: 6em;
35
+      text-align: right;
36 36
       > Text {
37 37
         font-size: 25px;
38 38
       }

+ 0
- 1
src/pages/CheckMap/index.jsx Parādīt failu

@@ -64,7 +64,6 @@ export default withLayout((props) => {
64 64
     width: 40, // 浮标宽度
65 65
     height: 37,// 浮标高度
66 66
   }]
67
-  console.log("🚀 ~ file: index.jsx ~ line 46 ~ markers", markers)
68 67
 
69 68
   return (
70 69
     <View className='page-index'>

+ 0
- 1
src/pages/FeedbackText/index.jsx Parādīt failu

@@ -18,7 +18,6 @@ export default withLayout((props) => {
18 18
 
19 19
   const onSubmitClick = () => {
20 20
     setLoading(true)
21
-    console.log('textAreaValue', textAreaValue);
22 21
     if (textAreaValue == '') {
23 22
       Taro.showToast({
24 23
         title: '请填写内容哦',

+ 1
- 1
src/pages/LoginPage/index.config.js Parādīt failu

@@ -1,6 +1,6 @@
1 1
 
2 2
 export default {
3
-  navigationBarTitleText: '登',
3
+  navigationBarTitleText: '登',
4 4
   navigationStyle: 'custom',
5 5
   disableScroll: true,
6 6
   usingComponents: {

+ 0
- 22
src/pages/MoreCars/CarTypeList.jsx Parādīt failu

@@ -1,6 +1,5 @@
1 1
 
2 2
 import { View, Swiper, Image, SwiperItem, Text, Input } from "@tarojs/components"
3
-import { useEffect, useState, useMemo } from "react"
4 3
 import Taro, { useReachBottom } from "@tarojs/taro"
5 4
 import ButtontWX from '@/components/ButtontWX'
6 5
 import withLayout from '@/layouts'
@@ -14,36 +13,18 @@ import './CarTypeList.less'
14 13
 
15 14
 export default withLayout((props) => {
16 15
   const { csrsListType } = props
17
-  console.log("🚀 ~ file: index.jsx ~ line 17 ~ withLayout ~ csrsListType", csrsListType)
18 16
   const { sserLocation } = useModel('userData')
19
-
20
-  // const { carsList } = props
21
-
22
-  const [carsList, setCarsList] = useState([])
23
-  console.log("🚀 ~ file: index.jsx ~ line 23 ~ withLayout ~ carsList", carsList)
24
-
25
-  const [caryType, setCaryType] = useState(false)
26
-
27
-
28 17
   const startReserve = (res) => {
29 18
     Taro.navigateTo({ url: `/pages/OrderConfirmation/index?id=${res}&location=${sserLocation}` })
30
-
31 19
   }
32 20
   const goCarsInfo = (res) => {
33 21
     Taro.navigateTo({ url: `/pages/CheckDetails/index?id=${res}&location=${sserLocation}` })
34
-
35 22
   }
36 23
   const goMapInfo = (res) => {
37 24
     Taro.navigateTo({ url: `/pages/CheckMap/index?id=${res}&location=${sserLocation}` })
38
-
39
-
40 25
   }
41 26
 
42
-
43
-
44 27
   return (
45
-
46
-
47 28
     <>
48 29
       {
49 30
         csrsListType?.length > 0 ? csrsListType.map((item, index) => {
@@ -69,10 +50,7 @@ export default withLayout((props) => {
69 50
             </View>
70 51
           )
71 52
         }) : <ListPlaceholder title='该分类暂无农机!' />
72
-
73 53
       }
74
-
75
-
76 54
     </>
77 55
   )
78 56
 })

+ 0
- 15
src/pages/MoreCars/index.jsx Parādīt failu

@@ -38,52 +38,37 @@ export default withLayout((props) => {
38 38
 
39 39
   useEffect(() => {
40 40
     if (tabIndex !== 0) {
41
-      // ClassificationComparison()
42 41
       activeNames.map((item) => {
43 42
         classId.push({ id: item.typeId })
44 43
 
45 44
       })
46 45
       getMachinery(sserLocation, { typeId: classId[tabIndex - 1].id }).then((e) => {
47
-        console.log('农机分类', e);
48 46
         steCsrsListType(e.records)
49 47
       })
50 48
     } else {
51
-      // ClassificationComparison()
52
-
53 49
       getMachinery(sserLocation, { pageSize: 999 }).then((e) => {
54 50
         steCsrsListType(e.records)
55 51
       })
56 52
     }
57
-
58
-
59 53
   }, [sserLocation, tabIndex])
60 54
 
61
-
62 55
   useEffect(() => {
63
-
64 56
     getMachineryType().then((e) => {
65 57
       const tabList = e.records
66 58
       setActiveNames(tabList)
67 59
       let tabss = tabList.map(x => ({ title: x.name, }))
68 60
       const newTabs = [{ title: '全部' }, ...tabss]
69 61
       setTabs(newTabs)
70
-
71 62
     })
72 63
   }, [])
73 64
 
74 65
   const goSearch = () => {
75 66
     Taro.navigateTo({ url: `/pages/Search/index?location=${sserLocation}` })
76
-
77 67
   }
78
-
79
-
80 68
   const handleTabChange = (e) => {
81
-    console.log('e', e.detail);
82 69
     steTabIndex(e?.detail?.index)
83
-
84 70
   }
85 71
 
86
-
87 72
   return (
88 73
     <View className='page-index'>
89 74
       <View className='index-navbar'>

+ 0
- 6
src/pages/MyAddressList/index.jsx Parādīt failu

@@ -46,7 +46,6 @@ export default withLayout((props) => {
46 46
   const handelSwitch = (id) => {
47 47
     addressDefault(id).then((res) => {
48 48
       getList()
49
-      console.log(addresList);
50 49
     })
51 50
 
52 51
   }
@@ -59,14 +58,9 @@ export default withLayout((props) => {
59 58
     })
60 59
   }
61 60
   useDidShow(() => {
62
-    console.log(9999);
63 61
     getList()
64 62
   })
65 63
 
66
-  // useEffect(() => {
67
-  //   getList()
68
-  // }, [])
69
-
70 64
   const handleAddress = (e) => {
71 65
     if (e) {
72 66
       setUserOrderAddress(e)

+ 0
- 16
src/pages/OrderConfirmation/index.jsx Parādīt failu

@@ -57,7 +57,6 @@ export default withLayout((props) => {
57 57
 
58 58
       // debugger
59 59
 
60
-      console.log('formSubmit', e?.detail);
61 60
       if (e?.detail?.value?.amount && e?.detail?.value?.appontmentDate && e?.detail?.value?.address) {
62 61
         generateOrder({
63 62
           charges: carsInfo?.price * amount,
@@ -97,36 +96,26 @@ export default withLayout((props) => {
97 96
       })
98 97
       return;
99 98
     }
100
-
101
-    // Taro.navigateTo({ url: `/pages/OrderInfo/index?goOrder=${id}` })
102 99
   }
103 100
   useEffect(() => {
104 101
     if (id) {
105 102
       getMachineryInfo(id, { location: location, attached: true }).then((e) => {
106 103
         setCarsInfo(e)
107
-        console.log('e', e);
108 104
       })
109 105
     }
110 106
   }, [id, sserLocation])
111 107
   const onTimeChange = (e) => {
112
-    console.log('时间选择器', e);
113 108
     // 获取当前时间 
114
-
115 109
     setTimeSel(e?.detail?.value)
116
-
117 110
   }
118 111
   const cancelPay = () => {
119 112
     Taro.navigateBack({
120 113
       delta: 1
121 114
     })
122 115
   }
123
-
124
-
125 116
   const goAddress = () => {
126 117
     Taro.navigateTo({ url: `/pages/MyAddressList/index?type=orderAddress` })
127 118
   }
128
-
129
-
130 119
   return (
131 120
     <View className='page-index'>
132 121
       <View className='index-navbar'>
@@ -143,22 +132,18 @@ export default withLayout((props) => {
143 132
             <View>作业时间:</View>
144 133
             <View className='example-body-WorkingTime-TimePicker'>
145 134
               <Image src={timeImage} />
146
-              {/* <mp-pickerTime tips='请选择时间' isChinese={1} onChange={myevent} /> */}
147
-
148 135
               <Picker mode='date' name='appontmentDate' onChange={onTimeChange}>
149 136
                 <View className='picker' >
150 137
                   {timeSel || '请选择日期'}
151 138
                 </View>
152 139
               </Picker>
153 140
             </View>
154
-
155 141
           </View>
156 142
           <View className='example-body-WorkingLocation'>
157 143
             <View>作业位置:</View>
158 144
             <View className='example-body-WorkingLocation-info' onClick={goAddress}>
159 145
               <Image src={addresss} />
160 146
               <Input name='address' disabled className='aTextareaCentent' value={userAddres} placeholder={userAddres == '' ? '请输入地址信息' : ''} />
161
-
162 147
             </View>
163 148
           </View>
164 149
           <View className='BottomtBut-box'>
@@ -167,7 +152,6 @@ export default withLayout((props) => {
167 152
           </View>
168 153
         </Form>
169 154
       </View>
170
-
171 155
     </View>
172 156
   )
173 157
 })

+ 69
- 96
src/pages/OrderInfo/index.jsx Parādīt failu

@@ -1,37 +1,27 @@
1 1
 import { View, Text } from "@tarojs/components"
2 2
 import { useEffect, useState, useMemo } from "react"
3
-import Taro, { useDidShow } from "@tarojs/taro"
3
+import Taro from "@tarojs/taro"
4 4
 import CustomNav from '@/components/CustomNav'
5 5
 import ButtontWX from '@/components/ButtontWX'
6
-import formatTimes from "@/utils/codeSegment"
6
+import AssessModel from "@/components/AssessModel"
7 7
 import withLayout from '@/layouts'
8
+import formatTimes from "@/utils/codeSegment"
8 9
 import formatPrice from "@/utils/formatPrice"
9
-import AssessModel from "@/components/AssessModel"
10 10
 import useProcessStatus, { getProcessSignBy } from "@/utils/hooks/useProcessStatus"
11
-import { orderPrepay, orderDelete, orderInfo, orderRefund } from "@/services/order"
12
-// import BottomMoadl from '@/components/BottomMoadl/index'
13
-
14
-
11
+import { orderPrepay, orderDelete, orderInfo } from "@/services/order"
12
+import { useModel } from "@/store"
15 13
 import './style.less'
16 14
 
17 15
 export default withLayout((props) => {
18
-  // const { stateType } = props
19 16
 
20 17
   const $instance = Taro.getCurrentInstance()
21 18
   const { orderId } = $instance.router.params
22
-
19
+  const { orderList, setOrderList } = useModel('order')
23 20
   const [orderInfos, setOrderInfos] = useState()
24
-
25 21
   const [isAssessVisible, setIsAssessVisible] = useState(false)
26
-
27 22
   const { processStatus } = useProcessStatus(orderInfos)
28 23
 
29
-  //底部弹窗
30
-  // const [showFrame, setShowFrame] = useState(false)
31
-  // const setRecommend = () => {
32
-  //   setShowFrame(!showFrame)
33
-  // }
34
-
24
+  //取消订单
35 25
   const cancelPay = () => {
36 26
     Taro.showModal({
37 27
       title: '提示',
@@ -39,13 +29,19 @@ export default withLayout((props) => {
39 29
       success: function (res) {
40 30
         if (res.confirm) {
41 31
           orderDelete(orderId).then((e) => {
42
-            console.log('订单取消/删除', e);
43 32
             Taro.showToast({
44 33
               title: '订单取消成功',
45 34
               icon: 'success',
46 35
               duration: 2000
47 36
             }).then(() => {
48 37
               setTimeout(() => {
38
+                var list = [];
39
+                for (var item of orderList) {
40
+                  if (item.orderId != orderId) {
41
+                    list.push(item)
42
+                  }
43
+                }
44
+                setOrderList(list);
49 45
                 Taro.navigateBack({
50 46
                   delta: 1
51 47
                 })
@@ -59,34 +55,24 @@ export default withLayout((props) => {
59 55
     })
60 56
   }
61 57
 
62
-  useEffect(() => {
63
-    if (orderId) {
64
-      orderInfo(orderId).then((res) => {
65
-        setOrderInfos(res)
66
-      })
67
-    } else {
68 58
 
69
-      Taro.showToast({
70
-        title: '暂无订单详情',
71
-        icon: 'error',
72
-        duration: 2000
73
-      }).then(() => {
74
-        setTimeout(() => {
75
-          Taro.navigateBack({
76
-            delta: 1
77
-          })
78
-        }, 1000)
59
+  //支付
60
+  const pay = () => {
61
+    orderPrepay(orderId, {
62
+      payType: 'wx',
63
+    }).then((e) => {
64
+      console.log('订单返回', e);
65
+      Taro.showLoading({
66
+        title: '支付中',
79 67
       })
80
-    }
81
-
82
-  }, [orderId])
83
-
68
+      requestPayment(e)
69
+    })
70
+  }
71
+  //微信支付付款
84 72
   const requestPayment = (params) => {
85 73
     Taro.hideLoading()
86
-    console.log("🚀 ~ file: index.jsx ~ line 92 ~ requestPayment ~ params", params)
87 74
     Taro.requestPayment({
88 75
       ...params,
89
-
90 76
       package: params.packageValue,
91 77
       success: () => {
92 78
         Taro.showToast({
@@ -95,8 +81,15 @@ export default withLayout((props) => {
95 81
           duration: 1000,
96 82
         }).then(() => {
97 83
           setTimeout(() => {
98
-            Taro.reLaunch({
99
-              url: `/pages/index/index?tab=2`
84
+            var list = [...orderList];
85
+            for (var item of list) {
86
+              if (item.orderId == orderId) {
87
+                item.payStatus = 1
88
+              }
89
+            }
90
+            setOrderList(list);
91
+            Taro.navigateBack({
92
+              delta: 1
100 93
             })
101 94
           }, 400)
102 95
         })
@@ -107,72 +100,31 @@ export default withLayout((props) => {
107 100
           icon: "none",
108 101
           duration: 2000,
109 102
         });
110
-        Taro.reLaunch({
111
-          // url: `/pages/MineUserAll/AllOrder/index?tabJump=1`
112
-        })
113 103
       },
114 104
     })
115 105
   }
116 106
 
117
-  const pay = () => {
118
-
119
-    orderPrepay(orderId, {
120
-      payType: 'wx',
121
-
122
-    }).then((e) => {
123
-      console.log('订单返回', e);
124
-      Taro.showLoading({
125
-        title: '支付中',
126
-      })
127
-      requestPayment(e)
128
-
129
-    })
130
-    //支付逻辑
131
-  }
132
-
133
-  //退单
134
-  const orderRefunds = () => {
135
-    Taro.showLoading({
136
-      title: '退单申请中',
137
-    })
138
-    orderRefund(orderId).then(() => {
139
-      Taro.showLoading()
140
-
141
-      Taro.showToast({
142
-        title: "退单成功",
143
-        icon: "none",
144
-        duration: 2000,
145
-      }).then(() => {
146
-        setTimeout(() => {
147
-          Taro.navigateBack({
148
-            delta: 1
149
-          })
150
-        }, 400)
151
-
152
-
153
-      })
154
-    }).catch(() => {
155
-      Taro.showLoading()
156
-      Taro.showToast({
157
-        title: "请重试",
158
-        icon: "error",
159
-        duration: 2000,
160
-      });
161
-    })
162
-  }
107
+  //弹出弹窗
163 108
   const startModle = () => {
164 109
     setIsAssessVisible(true)
165
-
166 110
   }
111
+  //关闭评价弹窗
167 112
   const onClose = () => {
168 113
     setIsAssessVisible(false)
114
+    var list = [...orderList];
115
+    for (var item of list) {
116
+      if (item.orderId == orderId) {
117
+        item.isEvaluated = 1
118
+      }
119
+    }
120
+    setOrderList(list);
169 121
     Taro.navigateBack({
170 122
       delta: 1
171 123
     })
172 124
 
173 125
   }
174
-
175
-  const { processLabel, stateStyle, action : Actions } = useMemo(() => {
126
+  //显示底部按钮
127
+  const { processLabel, stateStyle, action: Actions } = useMemo(() => {
176 128
     const { label, color } = getProcessSignBy(processStatus)
177 129
     let action = <></>;
178 130
 
@@ -192,19 +144,40 @@ export default withLayout((props) => {
192 144
       default:
193 145
         break;
194 146
     }
195
-    return  {
147
+    return {
196 148
       processLabel: label,
197 149
       stateStyle: color,
198 150
       action
199 151
     }
200 152
   }, [processStatus])
201 153
 
154
+  useEffect(() => {
155
+    if (orderId) {
156
+      orderInfo(orderId).then((res) => {
157
+        setOrderInfos(res)
158
+      })
159
+    } else {
160
+      Taro.showToast({
161
+        title: '暂无订单详情',
162
+        icon: 'error',
163
+        duration: 2000
164
+      }).then(() => {
165
+        setTimeout(() => {
166
+          Taro.navigateBack({
167
+            delta: 1
168
+          })
169
+        }, 1000)
170
+      })
171
+    }
172
+  }, [orderId])
173
+
202 174
   return (
203 175
     <View className='page-index'>
204 176
       <View className='index-navbar'>
205 177
         <CustomNav title='订单详情' />
206 178
       </View>
207
-      <AssessModel orderId={orderId} showCutover={isAssessVisible} maskClosable={isAssessVisible} onClose={onClose} onFinish={onClose} />
179
+      {/* 评价弹窗 */}
180
+      <AssessModel orderId={orderId} showCutover={isAssessVisible} onClose={onClose} />
208 181
       {/* <BottomMoadl frameTitle='支付方式' flag={showFrame} onRecommend={setRecommend} /> */}
209 182
       <View className='orders-listBox-RihtboxBoxOrderViewText'>
210 183
         <View className='View-LiftTextTop'>订单编号:<Text>{orderInfos?.orderNo}</Text></View>

+ 4
- 23
src/pages/Search/index.jsx Parādīt failu

@@ -1,39 +1,25 @@
1 1
 import Taro from '@tarojs/taro'
2
-import CustomNav from '@/components/CustomNav'
3
-import searchs from '@/assets/homesImgaes/searchs.png'//搜索图片
4
-
2
+import { useState } from 'react'
5 3
 import { View, Input, Image } from '@tarojs/components'
6 4
 import withLayout from '@/layouts'
7
-import { useThrottle } from '@/utils/codeSegment'
5
+import CustomNav from '@/components/CustomNav'
8 6
 import CarsListContent from "@/components/CarsListContent"
7
+import { useThrottle } from '@/utils/codeSegment'
9 8
 import { getMachinery } from '@/services/homes'
10
-import { useModel } from '@/store'
11
-
12
-
9
+import searchs from '@/assets/homesImgaes/searchs.png'//搜索图片
13 10
 import './style.less'
14
-import { useState } from 'react'
15
-
16
-
17 11
 
18 12
 export default withLayout((props) => {
19 13
   const $instance = Taro.getCurrentInstance()
20 14
   const { id, location } = $instance.router.params
21
-  console.log("🚀 ~ file: index.jsx ~ line 20 ~ withLayout ~ location", location)
22
-
23
-  const handleSearch = (e) => {
24
-    console.log("🚀 ~ file: index.jsx ~ line 14 ~ handleSearch ~ e", e)
25
-
26
-  }
27 15
 
28 16
   const [carsList, setCarsList] = useState([])
29 17
   //节流 搜索
30 18
   const handlerSearch = useThrottle((e) => {
31 19
     const { value } = e?.detail
32 20
     getMachinery(location, { q: value, location: location }).then((res) => {
33
-      console.log('根据农机名字查', res);
34 21
       setCarsList(res.records)
35 22
     })
36
-
37 23
   }, 1000)
38 24
 
39 25
   return (
@@ -48,13 +34,8 @@ export default withLayout((props) => {
48 34
       <scroll-view scrollY style='height: 100%;' >
49 35
         <View className='CarsListContent'>
50 36
           <CarsListContent carsList={carsList} />
51
-
52 37
         </View>
53
-
54
-
55
-
56 38
       </scroll-view>
57 39
     </View>
58 40
   )
59
-
60 41
 })

+ 1
- 1
src/pages/UserLogin/index.config.js Parādīt failu

@@ -1,6 +1,6 @@
1 1
 
2 2
 export default {
3
-  navigationBarTitleText: '登',
3
+  navigationBarTitleText: '登',
4 4
   navigationStyle: 'custom',
5 5
   disableScroll: true,
6 6
   usingComponents: {

+ 2
- 2
src/pages/UserLogin/index.jsx Parādīt failu

@@ -118,7 +118,7 @@
118 118
 //   return (
119 119
 //     <View className='page-index' hidden={isLoginVisible}>
120 120
 //       <View className='index-navbar'>
121
-//         <CustomNav title='登' home />
121
+//         <CustomNav title='登' home />
122 122
 //       </View>
123 123
 //       <View className='loginBackImg-box' >
124 124
 //         <Image src={require("@/assets/lolginImages/backLogin.png")} />
@@ -143,7 +143,7 @@
143 143
 //         </View>
144 144
 //       </View>
145 145
 //       <View className='BottomtButrelative'  >
146
-//         <ButtontWX onClick={getUserLogin} butText='登' butWidth={315} butHeight={49} butFontSize={16} butBorderRadius={49} />
146
+//         <ButtontWX onClick={getUserLogin} butText='登' butWidth={315} butHeight={49} butFontSize={16} butBorderRadius={49} />
147 147
 //       </View>
148 148
 //       <View className='bottom-agreement'>
149 149
 //         <Image src={!checkImage ? checkedImg : unselectedImg} onClick={() => { setCheckImage(!checkImage) }} />

+ 0
- 26
src/pages/index/index.jsx Parādīt failu

@@ -28,54 +28,29 @@ import './index.less'
28 28
 export default withLayout((props) => {
29 29
   const { router } = props
30 30
   const { person } = useModel('userData')
31
-
32
-
33 31
   const { params, path } = router
34
-
35
-
36 32
   const { tab } = params || {}
37
-
38
-
39
-  console.log("🚀 ~ file: index.jsx ~ line 24 ~ withLayout ~ tab", tab)
40 33
   const [currentTab, setCurrentTab] = useState(0)
41
-
42
-
43
-
44
-  // const [isShow, setIsShow] = useState(false)
45
-
46
-
47 34
   useDidShow(() => {
48
-    console.log('useDidShow',);
49
-
50 35
     if (!person?.phone) {
51
-      console.log('还是未登录',);
52 36
       setCurrentTab(0)
53 37
     }
54 38
   })
55 39
 
56 40
   useEffect(() => {
57
-    // setCurrentTab(index)
58
-
59 41
     if (tab) {
60 42
       setCurrentTab(tab - 0)
61 43
     }
62
-    // setIsShow(true)
63 44
   }, [tab,])
64 45
 
65 46
   const handleClick = (index) => {
66
-    // Taro.switchTab({
67
-    //   url: '/pages/InformationPage/index'
68
-    // })
69 47
     if (!person?.phone) {
70 48
       Taro.navigateTo({ url: `/pages/LoginPage/index?login=true&tab=${index}` })
71
-      // setIsShow(true)
72 49
     } else {
73 50
       Taro.redirectTo({ url: `/pages/index/index?tab=${index}` });
74
-      // setCurrentTab(index)
75 51
     }
76 52
   }
77 53
 
78
-
79 54
   return (
80 55
     <view className='page-index'>
81 56
       {/* <LoginModel isLoginVisible={isShow} /> */}
@@ -120,7 +95,6 @@ export default withLayout((props) => {
120 95
           <Image className='tabberImg' src={currentTab == 3 ? MineNOImgaes : MineOFFImgaes}></Image>
121 96
           <View className='text'>我的</View>
122 97
         </View>
123
-        {/* <mp-tabbar extClass='custom-tabbar' autoSelect={false} current={currentTab} list={tabList} onChange={handleTabChange}></mp-tabbar> */}
124 98
       </view>
125 99
     </view>
126 100
   )

+ 0
- 19
src/pages/index/tabs/Homes.jsx Parādīt failu

@@ -26,56 +26,40 @@ export default withLayout((props) => {
26 26
 
27 27
   useEffect(() => {
28 28
     getHomeBanner({ position: 'banner' }).then((e) => {
29
-      console.log('e', e);
30 29
       setBannerHome(e)
31 30
     })
32 31
     getMachinery(sserLocation, { pageNum: currentPage, }).then((e) => {
33 32
       const records = currentPage === 1 ? e.records || [] : carsList.concat(e.records || [])
34
-      console.log("🚀 ~ file: Orders.jsx ~ line 41 ~ getOrder ~ records", records)
35 33
       if (e.records.length == 0 && currentPage != 1) {
36 34
         setIsMore(true)
37 35
         return
38 36
       }
39 37
       setCarsList(records)
40 38
     })
41
-
42 39
   }, [currentPage, sserLocation])
43 40
 
44
-
45
-
46 41
   const handleScrollToLower = () => {
47 42
     if (carsList.length < 9) {
48 43
       return;
49 44
     } else {
50 45
       setCurrentPage(currentPage + 1)
51
-
52 46
     }
53 47
   }
54 48
 
55
-
56
-
57
-
58
-
59 49
   const goSearch = () => {
60 50
     Taro.navigateTo({ url: `/pages/Search/index?location=${sserLocation}` })
61
-
62 51
   }
63 52
 
64 53
   const goToCarsList = () => {//更多
65 54
     Taro.navigateTo({ url: `/pages/MoreCars/index` })
66
-
67
-
68
-
69 55
   }
70 56
 
71
-
72 57
   return (
73 58
     <scroll-view
74 59
       className='scrollView'
75 60
       scrollY
76 61
       style='height: 100%;'
77 62
       onScrollToLower={isMore ? '' : handleScrollToLower}
78
-
79 63
     >
80 64
 
81 65
       <View className='heads-top-box'>
@@ -90,7 +74,6 @@ export default withLayout((props) => {
90 74
         </View>
91 75
       </View>
92 76
       <Swiper
93
-
94 77
         mode='scaleToFill'
95 78
         className='swiper-box'
96 79
       >
@@ -108,8 +91,6 @@ export default withLayout((props) => {
108 91
         <View onClick={goToCarsList} className='content-header-box-rightCentent'>更多&gt;&gt;</View>
109 92
       </View>
110 93
       <CarsListContent carsList={carsList} />
111
-
112
-
113 94
     </scroll-view>
114 95
   )
115 96
 })

+ 2
- 2
src/pages/index/tabs/Mine.jsx Parādīt failu

@@ -105,7 +105,7 @@ export default withLayout((props) => {
105 105
               <Image className='Userback' src={back} />
106 106
 
107 107
               <Image className='User-Avatar-background-falseBox-userImg userImg' src={userMoren} />
108
-              <View onClick={userLoginnow} className='User-Avatar-background-falseBox-userLogin' >点击登</View>
108
+              <View onClick={userLoginnow} className='User-Avatar-background-falseBox-userLogin' >点击登</View>
109 109
             </View>
110 110
             :
111 111
             <>
@@ -153,7 +153,7 @@ export default withLayout((props) => {
153 153
 
154 154
         {/* {
155 155
           !isLoginBox ? '' :
156
-            <View className='bottom-buttom'>退出登</View>
156
+            <View className='bottom-buttom'>退出登</View>
157 157
         } */}
158 158
 
159 159
       </View>

+ 1
- 1
src/pages/index/tabs/MineCss/style.less Parādīt failu

@@ -35,7 +35,7 @@
35 35
   }
36 36
 }
37 37
 
38
-//已登样式-----------------------
38
+//已登样式-----------------------
39 39
 
40 40
 .User-Avatar-background-trueBox {
41 41
   background-size: 100% 100%;

+ 23
- 46
src/pages/index/tabs/Orders.jsx Parādīt failu

@@ -3,73 +3,52 @@ import { View, Image, Text } from "@tarojs/components"
3 3
 import Taro, { useDidShow } from '@tarojs/taro'
4 4
 import ListPlaceholder from "@/components/ListPlaceholder"
5 5
 import withLayout from '@/layouts'
6
-
7 6
 import ordersListImga from '@/assets/ordersImages/ordersListImga.png'
8 7
 import ordersLeft from '@/assets/ordersImages/ordersLeft.png'//订单装饰
9 8
 import { useEffect, useState } from "react"
10 9
 import { getOrder } from "@/services/order"
11 10
 import formatTimes from "@/utils/codeSegment"
12
-import { useModel } from "@/store"
13 11
 import formatPrice from "@/utils/formatPrice"
14 12
 import { getProcessStatus, getProcessSignBy } from "@/utils/hooks/useProcessStatus"
15
-
13
+import { useModel } from "@/store"
16 14
 import './OrdersCss/style.less'
17 15
 
18 16
 
19 17
 
20 18
 export default withLayout((props) => {
21 19
 
22
-  const [ourderList, setOrderList] = useState([])
23
-
24
-  const [currentPage, setCurrentPage] = useState(1)
25
-
26
-  const [isMore, setIsMore] = useState(false)
27
-
28
-  const { person, setPerson } = useModel('userData')
29
-
30
-
31
-  useDidShow(() => {
32
-    getOrder({ pageNum: currentPage || 1, mine: true }).then((e) => {
33
-      const { records } = e
34
-      setOrderList(records)
35
-    })
36
-  })
37
-
20
+  const { orderList, setOrderList, pageNum, setPageNum, isMore, setIsMore } = useModel('order')
21
+  
38 22
   const handleScrollToLower = () => {
39
-    if (ourderList.length < 9) {
23
+    if (orderList.length < 9) {
40 24
       return;
41 25
     } else {
42
-      setCurrentPage(currentPage + 1)
43
-
26
+      setPageNum(pageNum + 1)
44 27
     }
45 28
   }
46
-  useEffect(() => {
47
-    getOrder({ pageNum: currentPage, mine: true }).then((e) => {
48
-      const records = currentPage === 1 ? e.records || [] : ourderList.concat(e.records || [])
49
-      console.log("🚀 ~ file: Orders.jsx ~ line 41 ~ getOrder ~ records", records)
50
-      if (e.records.length == 0 && currentPage != 1) {
51
-        setIsMore(true)
52
-        return
53
-      }
54
-      // setJobList(lst)
55
-      setOrderList(records)
56
-
57
-
58
-
59
-    })
60
-  }, [currentPage])
61
-  console.log(ourderList, 'ourderList');
62
-
63 29
   const orderStates = (item) => {
64 30
     const processStatus = getProcessStatus(item)
65 31
     const { label: title, color: styleColor } = getProcessSignBy(processStatus)
66 32
     return { title, styleColor }
67 33
   }
68 34
 
69
-  const handleTobePaid = (id, stateType, stateStyle) => {
70
-    Taro.navigateTo({ url: `/pages/OrderInfo/index?orderId=${id}&stateType=${stateType}&stateStyle=${stateStyle}` })
35
+  const handleTobePaid = (id) => {
36
+    Taro.navigateTo({ url: `/pages/OrderInfo/index?orderId=${id}` })
71 37
   }
72
-
38
+  useEffect(()=>{
39
+    setPageNum(1);
40
+    setIsMore(false);
41
+  },[])
42
+  useEffect(() => {
43
+    getOrder({ pageNum: pageNum, mine: true }).then((e) => {
44
+      const records = pageNum === 1 ? e.records || [] : orderList.concat(e.records || [])
45
+      if (e.records.length == 0 && pageNum != 1) {
46
+        setIsMore(true)
47
+        return
48
+      }
49
+      setOrderList(records)
50
+    })
51
+  }, [pageNum])
73 52
 
74 53
   return (
75 54
     <scroll-view
@@ -77,21 +56,19 @@ export default withLayout((props) => {
77 56
       style='height: 100%;'
78 57
       onScrollToLower={isMore ? '' : handleScrollToLower}
79 58
     >
80
-
81 59
       <View className='content-header-box-orders'>
82 60
         <View className='content-header-box-orders-liftCentent'>
83 61
           <Image src={ordersListImga} />
84 62
           <View>订单列表</View>
85 63
         </View>
86
-        {/* <View className='content-header-box-orders-rightCentent'>更多&gt;&gt;</View> */}
87 64
       </View>
88 65
       {
89
-        ourderList?.length > 0 ? ourderList.map((item, index) => {
66
+        orderList?.length > 0 ? orderList.map((item, index) => {
90 67
           return (
91 68
             <View key={index} className='orders-listBox'>
92 69
               <Image src={ordersLeft} />
93 70
               <View className='orders-listBox-RihtboxBoxOrderViewText'>
94
-                <View className='View-LiftTextTop' onClick={() => handleTobePaid(item.orderId, orderStates(item)?.title, orderStates(item)?.styleColor)} >
71
+                <View className='View-LiftTextTop' onClick={() => handleTobePaid(item.orderId)} >
95 72
                   编号:<Text>{item.orderNo}</Text><Text className='View-LiftTextTop-nextText'>详情&gt;&gt;</Text></View>
96 73
                 <View>农机名称:<Text>{item.machineryName}</Text></View>
97 74
                 <View>作业面积:<Text>{item.amount}</Text></View>

+ 2
- 2
src/routes.js Parādīt failu

@@ -25,7 +25,7 @@ const Pages = [
25 25
     page: 'pages/OrderConfirmation/index',
26 26
   },
27 27
   {
28
-    title: '登页',
28
+    title: '登页',
29 29
     page: 'pages/UserLogin/index',
30 30
   },
31 31
   {
@@ -92,7 +92,7 @@ const Pages = [
92 92
 
93 93
 
94 94
   {
95
-    title: '登页面~',
95
+    title: '登页面~',
96 96
     page: 'pages/LoginPage/index',
97 97
   },
98 98
 

+ 1
- 1
src/services/login.js Parādīt failu

@@ -14,7 +14,7 @@ export const login = (data) => request('/login', { data, method: 'post' })
14 14
 export const getUserQcode = (params) => request('/sms-captcha', { method: 'post', params })
15 15
 
16 16
 /**
17
-* 验证码登修改
17
+* 验证码登修改
18 18
 * @param {*} 
19 19
 * @returns 
20 20
 */

+ 2
- 1
src/store/index.js Parādīt failu

@@ -1,8 +1,9 @@
1 1
 import { createStore, createStoreRoot, createModelHook } from '@zjxpcyc/react-tiny-store'
2 2
 import userData from './userData'
3
+import order from './order'
3 4
 
4 5
 const store = createStore()
5
-const models = { userData, }
6
+const models = { userData,order }
6 7
 
7 8
 
8 9
 

+ 8
- 0
src/store/order.js Parādīt failu

@@ -0,0 +1,8 @@
1
+import { useState } from "react";
2
+
3
+export default () => {
4
+  const [orderList, setOrderList] = useState();
5
+  const [pageNum, setPageNum] = useState(1);
6
+  const [isMore, setIsMore] = useState(false);
7
+  return { orderList, setOrderList, pageNum, setPageNum, isMore, setIsMore };
8
+};

+ 0
- 7
src/store/userData.js Parādīt failu

@@ -11,13 +11,6 @@ export default () => {
11 11
   const [sserLocation, setUserLocation] = useState('')
12 12
   const [userOrderAddress, setUserOrderAddress] = useState('')
13 13
 
14
-
15
-
16
-  // console.log("🚀 来自store的打印 person数据", person)
17
-
18
-
19
-
20
-
21 14
   const logins = (params) => {
22 15
     login(params).then((res) => {
23 16
       const { person: taPerson, sessionKey: skey } = res;

+ 54
- 47
src/utils/hooks/useProcessStatus.js Parādīt failu

@@ -1,102 +1,109 @@
1 1
 import { useState, useEffect } from "react";
2 2
 
3 3
 export default function useProcessStatus(orderInfo) {
4
-/**
5
- * 业务流程如下:
6
- * 1、农户下单 - 未支付 (管理端待分配订单)
7
- * 2、农机手待接单
8
- * 3、农机手接单干活
9
- * 4、农机手结单 - 确定亩数 (农户待支付)
10
- * 5、农户待评价
11
- * 6、结单(订单完成)
12
- */
4
+  /**
5
+   * 业务流程如下:
6
+   * 1、农户下单 - 未支付 (管理端待分配订单)
7
+   * 2、农机手待接单
8
+   * 3、农机手接单干活
9
+   * 4、农机手结单 - 确定亩数 (农户待支付)
10
+   * 5、农户待评价
11
+   * 6、结单(订单完成)
12
+   */
13 13
 
14
-  const [processStatus, setProcessStatus] = useState()
14
+  const [processStatus, setProcessStatus] = useState();
15 15
 
16 16
   useEffect(() => {
17 17
     if (!orderInfo || !orderInfo.orderId) return;
18 18
 
19 19
     setProcessStatus(getProcessStatus(orderInfo));
20
-  }, [orderInfo])
20
+  }, [orderInfo]);
21 21
 
22
-  return { processStatus }
22
+  return { processStatus };
23 23
 }
24 24
 
25 25
 export function getProcessStatus(orderInfo) {
26
-  
27 26
   if (!orderInfo || !orderInfo.orderId) return;
28 27
 
29 28
   // 订单完成
30 29
   if (orderInfo.isEvaluated) {
31
-    return 6
30
+    return 6;
32 31
   }
33
-  
32
+
34 33
   // 待支付
35
-  if (orderInfo.workStatus === 3 && orderInfo.charges > 0 && orderInfo.payStatus !== 1) {
36
-    return 4
34
+  if (
35
+    orderInfo.workStatus === 3 &&
36
+    orderInfo.charges > 0 &&
37
+    orderInfo.payStatus !== 1
38
+  ) {
39
+    return 4;
37 40
   }
38 41
 
39 42
   // 待评价
40 43
   if (orderInfo.workStatus === 3 && !orderInfo.isEvaluated) {
41
-    return 5
44
+    return 5;
42 45
   }
43 46
 
44 47
   // 工作中
45
-  if (orderInfo.workStatus > 0 && orderInfo.workStatus < 3 && orderInfo.dispatchStatus) {
46
-    return 3
48
+  if (
49
+    orderInfo.workStatus > 0 &&
50
+    orderInfo.workStatus < 3 &&
51
+    orderInfo.dispatchStatus
52
+  ) {
53
+    return 3;
47 54
   }
48 55
 
49 56
   // 待接单
50 57
   if (!orderInfo.workStatus && orderInfo.dispatchStatus) {
51
-    return 2
58
+    return 2;
52 59
   }
53 60
 
54 61
   // 待分配
55 62
   if (orderInfo.status === 1 && !orderInfo.dispatchStatus) {
56
-    return 1
63
+    return 1;
57 64
   }
58
-  
59
-  return -1
65
+
66
+  return -1;
60 67
 }
61 68
 
62 69
 export function getProcessSignBy(status) {
63
-  if (status === undefined || status === null) return {}
64
-  
70
+  if (status === undefined || status === null) return {};
71
+
65 72
   switch (status) {
66 73
     case 1:
67 74
       return {
68
-        label: '待分配',
69
-        color: '#FF703B'
70
-      }
75
+        label: "待分配",
76
+        color: "#FF703B",
77
+      };
71 78
     case 2:
72 79
       return {
73
-        label: '待作业',
74
-        color: '#FF703B'
75
-      }
80
+        label: "待作业",
81
+        color: "#FF703B",
82
+      };
76 83
     case 3:
77 84
       return {
78
-        label: '进行中',
79
-        color: '#44F68B'
80
-      }
85
+        label: "进行中",
86
+        color: "#44F68B",
87
+      };
81 88
     case 4:
82 89
       return {
83
-        label: '待付款',
84
-        color: '#51D4FF'
85
-      }
90
+        label: "待付款",
91
+        color: "#51D4FF",
92
+      };
86 93
     case 5:
87 94
       return {
88
-        label: '待评价',
89
-        color: '#51D4FF'
90
-      }
95
+        label: "待评价",
96
+        color: "#51D4FF",
97
+      };
91 98
     case 6:
92 99
       return {
93
-        label: '已完成',
94
-        color: '#FF703B'
95
-      }
100
+        label: "已完成",
101
+        color: "#FF703B",
102
+      };
96 103
     default:
97 104
       return {
98
-        label: '异常',
99
-        color: '#FF0000'
100
-      }
105
+        label: "异常",
106
+        color: "#FF0000",
107
+      };
101 108
   }
102 109
 }