李志伟 пре 2 година
родитељ
комит
37cf79a412

+ 6
- 49
src/components/AssessModel/index.jsx Прегледај датотеку

@@ -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 Прегледај датотеку

@@ -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
 })

+ 2
- 16
src/components/LoginModel/index.jsx Прегледај датотеку

@@ -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,38 +107,28 @@ 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 133
               <CustomNav title='登录' home />
148 134
             </View>

+ 0
- 10
src/components/orderRater/index.js Прегледај датотеку

@@ -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 Прегледај датотеку

@@ -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 Прегледај датотеку

@@ -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
   }

+ 1
- 24
src/pages/CheckDetails/index.jsx Прегледај датотеку

@@ -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}>
@@ -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
 })

+ 0
- 1
src/pages/CheckMap/index.jsx Прегледај датотеку

@@ -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 Прегледај датотеку

@@ -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: '请填写内容哦',

+ 0
- 22
src/pages/MoreCars/CarTypeList.jsx Прегледај датотеку

@@ -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 Прегледај датотеку

@@ -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 Прегледај датотеку

@@ -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 Прегледај датотеку

@@ -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
- 93
src/pages/OrderInfo/index.jsx Прегледај датотеку

@@ -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=1`
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
         })
@@ -111,65 +104,27 @@ export default withLayout((props) => {
111 104
     })
112 105
   }
113 106
 
114
-  const pay = () => {
115
-
116
-    orderPrepay(orderId, {
117
-      payType: 'wx',
118
-
119
-    }).then((e) => {
120
-      console.log('订单返回', e);
121
-      Taro.showLoading({
122
-        title: '支付中',
123
-      })
124
-      requestPayment(e)
125
-
126
-    })
127
-    //支付逻辑
128
-  }
129
-
130
-  //退单
131
-  const orderRefunds = () => {
132
-    Taro.showLoading({
133
-      title: '退单申请中',
134
-    })
135
-    orderRefund(orderId).then(() => {
136
-      Taro.showLoading()
137
-
138
-      Taro.showToast({
139
-        title: "退单成功",
140
-        icon: "none",
141
-        duration: 2000,
142
-      }).then(() => {
143
-        setTimeout(() => {
144
-          Taro.navigateBack({
145
-            delta: 1
146
-          })
147
-        }, 400)
148
-
149
-
150
-      })
151
-    }).catch(() => {
152
-      Taro.showLoading()
153
-      Taro.showToast({
154
-        title: "请重试",
155
-        icon: "error",
156
-        duration: 2000,
157
-      });
158
-    })
159
-  }
107
+  //弹出弹窗
160 108
   const startModle = () => {
161 109
     setIsAssessVisible(true)
162
-
163 110
   }
111
+  //关闭评价弹窗
164 112
   const onClose = () => {
165 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);
166 121
     Taro.navigateBack({
167 122
       delta: 1
168 123
     })
169 124
 
170 125
   }
171
-
172
-  const { processLabel, stateStyle, action : Actions } = useMemo(() => {
126
+  //显示底部按钮
127
+  const { processLabel, stateStyle, action: Actions } = useMemo(() => {
173 128
     const { label, color } = getProcessSignBy(processStatus)
174 129
     let action = <></>;
175 130
 
@@ -189,19 +144,40 @@ export default withLayout((props) => {
189 144
       default:
190 145
         break;
191 146
     }
192
-    return  {
147
+    return {
193 148
       processLabel: label,
194 149
       stateStyle: color,
195 150
       action
196 151
     }
197 152
   }, [processStatus])
198 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
+
199 174
   return (
200 175
     <View className='page-index'>
201 176
       <View className='index-navbar'>
202 177
         <CustomNav title='订单详情' />
203 178
       </View>
204
-      <AssessModel orderId={orderId} showCutover={isAssessVisible} maskClosable={isAssessVisible} onClose={onClose} onFinish={onClose} />
179
+      {/* 评价弹窗 */}
180
+      <AssessModel orderId={orderId} showCutover={isAssessVisible} onClose={onClose} />
205 181
       {/* <BottomMoadl frameTitle='支付方式' flag={showFrame} onRecommend={setRecommend} /> */}
206 182
       <View className='orders-listBox-RihtboxBoxOrderViewText'>
207 183
         <View className='View-LiftTextTop'>订单编号:<Text>{orderInfos?.orderNo}</Text></View>

+ 4
- 23
src/pages/Search/index.jsx Прегледај датотеку

@@ -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
 })

+ 0
- 26
src/pages/index/index.jsx Прегледај датотеку

@@ -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 Прегледај датотеку

@@ -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
 })

+ 23
- 46
src/pages/index/tabs/Orders.jsx Прегледај датотеку

@@ -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
- 1
src/store/index.js Прегледај датотеку

@@ -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 Прегледај датотеку

@@ -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 Прегледај датотеку

@@ -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;