[baozhangchao] 3 years ago
parent
commit
8aeeff5eda

BIN
src/assets/icons/comm/locationImage.png View File


BIN
src/assets/mineImgaes/userMoren.png View File


+ 1
- 1
src/components/CarsListContent/index.jsx View File

28
 
28
 
29
 
29
 
30
   const startReserve = () => {
30
   const startReserve = () => {
31
-    Taro.navigateTo({ url: `/pages/OrderInfo/index?id${1}` })
31
+    Taro.navigateTo({ url: `/pages/OrderConfirmation/index?id${1}` })
32
 
32
 
33
   }
33
   }
34
   const goCarsInfo = (res) => {
34
   const goCarsInfo = (res) => {

+ 17
- 5
src/pages/CheckMap/index.jsx View File

1
-import { useEffect } from "react"
1
+import { useEffect, useState } from "react"
2
 import { Map, View, Image, Text } from "@tarojs/components"
2
 import { Map, View, Image, Text } from "@tarojs/components"
3
 import CustomNav from "@/components/CustomNav"
3
 import CustomNav from "@/components/CustomNav"
4
 import ButtontWX from "@/components/ButtontWX"
4
 import ButtontWX from "@/components/ButtontWX"
5
 import Taro from "@tarojs/taro"
5
 import Taro from "@tarojs/taro"
6
-import decorate from "@/assets/icons/comm/decorate.png"
6
+import locationImage from "@/assets/icons/comm/locationImage.png"
7
 import addresss from '@/assets/mineImgaes/addresss.png'//地址
7
 import addresss from '@/assets/mineImgaes/addresss.png'//地址
8
 import './style.less'
8
 import './style.less'
9
 
9
 
11
 export default (props) => {
11
 export default (props) => {
12
 
12
 
13
   const $instance = Taro.getCurrentInstance()
13
   const $instance = Taro.getCurrentInstance()
14
+  const [mapLoca, setMapLoca] = useState('')
15
+  Taro.getStorage({
16
+    key: 'location',
17
+    success: function (res) {
18
+      setMapLoca(res.data)
19
+    }
20
+  })
21
+
22
+
23
+  const LocationMap = mapLoca.split(",")
24
+  console.log("🚀 ~ file: index.jsx ~ line 25 ~ LocationMap", LocationMap)
25
+
14
 
26
 
15
 
27
 
16
   useEffect(() => {
28
   useEffect(() => {
24
   }
36
   }
25
 
37
 
26
   const markers = [{ // 绘制浮标,传入JSON支持多个
38
   const markers = [{ // 绘制浮标,传入JSON支持多个
27
-    // iconPath: "/images/location.png", 
39
+    iconPath: locationImage,
28
     id: 0,
40
     id: 0,
29
-    latitude: 112.092169,// 经度
30
-    longitude: 32.694883,//纬度
41
+    latitude: LocationMap[0],// 经度
42
+    longitude: LocationMap[1],//纬度
31
     width: 50, // 浮标宽度
43
     width: 50, // 浮标宽度
32
     height: 50 // 浮标高度
44
     height: 50 // 浮标高度
33
   }]
45
   }]

+ 21
- 0
src/pages/FeedbackText/index.jsx View File

2
 import { Textarea, View } from "@tarojs/components"
2
 import { Textarea, View } from "@tarojs/components"
3
 import CustomNav from "@/components/CustomNav"
3
 import CustomNav from "@/components/CustomNav"
4
 import ButtontWX from "@/components/ButtontWX"
4
 import ButtontWX from "@/components/ButtontWX"
5
+import { feedback } from "@/services/mine"
6
+import Taro from "@tarojs/taro"
7
+
5
 import './style.less'
8
 import './style.less'
6
 
9
 
7
 
10
 
13
 
16
 
14
   const onSubmitClick = () => {
17
   const onSubmitClick = () => {
15
     console.log('textAreaValue', textAreaValue);
18
     console.log('textAreaValue', textAreaValue);
19
+    feedback({ content: textAreaValue }).then(() => {
20
+      Taro.showToast({
21
+        title: '反馈已收到!',
22
+        icon: 'success',
23
+        duration: 2000
24
+      }).then(() => {
25
+        setTimeout(() => {
26
+          Taro.navigateBack({
27
+            delta: 1
28
+          }
29
+
30
+          )
31
+        }, 1500)
32
+
33
+      })
34
+    })
35
+
36
+
16
   }
37
   }
17
 
38
 
18
   return (
39
   return (

+ 42
- 4
src/pages/MyAddressList/AddressInfos/index.jsx View File

11
 
11
 
12
 
12
 
13
 export default (props) => {
13
 export default (props) => {
14
+  console.log("🚀 ~ file: index.jsx ~ line 14 ~ props", props)
15
+
16
+  const $instance = Taro.getCurrentInstance()
17
+  const { addressId, address } = $instance.router.params
18
+
19
+  console.log("🚀 ~ file: index.jsx ~ line 14 ~ props", $instance.router.params)
20
+
14
   const formSubmit = e => {
21
   const formSubmit = e => {
22
+
15
     const value = e.detail.value
23
     const value = e.detail.value
16
     console.log(value)
24
     console.log(value)
17
-    addressSave({ address: value.address, isDefault: value.isDefault }).then((e) => {
18
-      console.log('e', e);
19
-    })
25
+    if (addressId) {
26
+      addressUpdate(addressId, { address: value.address }).then((res) => {
27
+        console.log('地址修改成功', res);
28
+        Taro.showToast({
29
+          title: '地址修改成功',
30
+          icon: 'success',
31
+          duration: 2000
32
+        }).then(() => {
33
+          setTimeout(() => {
34
+            Taro.navigateBack({
35
+              delta: 1
36
+            })
37
+          }, 1500)
38
+
39
+        })
40
+      })
41
+    } else {
42
+      addressSave({ address: value.address }).then((e) => {
43
+        console.log('地址添加成功', e);
44
+        Taro.showToast({
45
+          title: '地址添加成功',
46
+          icon: 'success',
47
+          duration: 2000
48
+        }).then(() => {
49
+          setTimeout(() => {
50
+            Taro.navigateBack({
51
+              delta: 1
52
+            })
53
+          }, 1500)
54
+        })
55
+      })
56
+    }
57
+
20
 
58
 
21
   }
59
   }
22
 
60
 
30
       <Form onSubmit={formSubmit} onReset={formReset} >
68
       <Form onSubmit={formSubmit} onReset={formReset} >
31
         <View className='example-body'>
69
         <View className='example-body'>
32
           <View>详细地址:</View>
70
           <View>详细地址:</View>
33
-          <Textarea name='address' className='aTextareaCentent' placeholder='请输入地址信息' />
71
+          <Textarea name='address' value={address} className='aTextareaCentent' placeholder='请输入地址信息' />
34
         </View>
72
         </View>
35
         {/* <View className='example-body'>
73
         {/* <View className='example-body'>
36
           <View>是否设为默认地址:</View>
74
           <View>是否设为默认地址:</View>

+ 23
- 14
src/pages/MyAddressList/index.jsx View File

1
 import { View, Image, Switch, Radio, RadioGroup } from "@tarojs/components"
1
 import { View, Image, Switch, Radio, RadioGroup } from "@tarojs/components"
2
-import Taro from "@tarojs/taro"
3
-import { useState, useEffect } from "react"
2
+import Taro, { useDidShow } from "@tarojs/taro"
3
+import { useState, useEffect, useMemo } from "react"
4
 import CustomNav from "@/components/CustomNav"
4
 import CustomNav from "@/components/CustomNav"
5
 import edit from "@/assets/icons/comm/edit.png"
5
 import edit from "@/assets/icons/comm/edit.png"
6
 import userRight from '@/assets/mineImgaes/userRight.png'
6
 import userRight from '@/assets/mineImgaes/userRight.png'
29
       success: function (res) {
29
       success: function (res) {
30
         if (res.confirm) {
30
         if (res.confirm) {
31
           addressDelete(e).then((e) => {
31
           addressDelete(e).then((e) => {
32
+            Taro.showToast({
33
+              title: '地址删除成功',
34
+              icon: 'success',
35
+              duration: 2000
36
+            })
37
+            getList()
32
 
38
 
33
           })
39
           })
34
         } else if (res.cancel) {
40
         } else if (res.cancel) {
43
 
49
 
44
   const handelSwitch = (a, e) => {
50
   const handelSwitch = (a, e) => {
45
     const { value } = e.detail
51
     const { value } = e.detail
46
-    // console.log('e', !!value);
47
-    console.log('a,e', a, value);
48
     addressDefault(a).then((se) => {
52
     addressDefault(a).then((se) => {
49
       console.log('e', se);
53
       console.log('e', se);
50
       getList()
54
       getList()
57
     // }
61
     // }
58
 
62
 
59
   }
63
   }
60
-  const addressEdit = (e) => {
64
+  const addressEdit = (e, res) => {
61
     console.log('e', e);
65
     console.log('e', e);
66
+    Taro.navigateTo({ url: `/pages/MyAddressList/AddressInfos/index?addressId=${e}&address=${res}` })
62
 
67
 
63
   }
68
   }
64
 
69
 
65
 
70
 
71
+
66
   const getList = () => {
72
   const getList = () => {
67
     getAddress().then((e) => {
73
     getAddress().then((e) => {
68
       console.log('地址列表', e);
74
       console.log('地址列表', e);
75
+      // let abccList = e.records.sort((a, b) => b.isDefault - a.isDefault)
76
+      // console.log("🚀 ~ file: index.jsx ~ line 75 ~ getAddress ~ abccList", abccList)
69
       setAddresList(e.records)
77
       setAddresList(e.records)
70
     })
78
     })
71
   }
79
   }
80
+  useDidShow(() => {
81
+    getList()
82
+
83
+  })
72
 
84
 
73
   useEffect(() => {
85
   useEffect(() => {
74
     getList()
86
     getList()
75
 
87
 
76
 
88
 
77
-    console.log('执行了', switchBool,);
78
-  }, [switchBool,])
89
+  }, [])
79
 
90
 
80
 
91
 
81
 
92
 
87
       <scroll-view scrollY style='height: 100%;' >
98
       <scroll-view scrollY style='height: 100%;' >
88
         <View>
99
         <View>
89
           {
100
           {
90
-
91
             addresList.map((item, index) => {
101
             addresList.map((item, index) => {
92
               return (
102
               return (
93
                 <View className='addressList-box' key={index}>
103
                 <View className='addressList-box' key={index}>
94
                   <View className='addressList-box-addressTop'>
104
                   <View className='addressList-box-addressTop'>
95
-                    <View className='addressList-box-addressTop-redText'>默认地址</View>
105
+                    {
106
+                      item.isDefault ?
107
+                        <View className='addressList-box-addressTop-redText'>默认地址</View> : ''
108
+                    }
96
                     <View className='addressList-box-addressTop-title'>我的地址{index + 1}</View>
109
                     <View className='addressList-box-addressTop-title'>我的地址{index + 1}</View>
97
                   </View>
110
                   </View>
98
                   <View className='addressList-box-addressBotton'>
111
                   <View className='addressList-box-addressBotton'>
100
                       <View>
113
                       <View>
101
                         {item.address}
114
                         {item.address}
102
                       </View>
115
                       </View>
103
-                      <Image src={edit} onClick={() => addressEdit(item.addressId)} />
116
+                      <Image src={edit} onClick={() => addressEdit(item.addressId, item.address)} />
104
                     </View>
117
                     </View>
105
 
118
 
106
                     <View className='addressList-box-addressBotton-setAddress'>
119
                     <View className='addressList-box-addressBotton-setAddress'>
107
                       <View>
120
                       <View>
108
-
109
                         设为默认地址:
121
                         设为默认地址:
110
-
111
                         <RadioGroup className='radio-group' onChange={(res) => handelSwitch(item.addressId, res)} >
122
                         <RadioGroup className='radio-group' onChange={(res) => handelSwitch(item.addressId, res)} >
112
                           <Radio color='#FC5531' checked={item.isDefault}></Radio>
123
                           <Radio color='#FC5531' checked={item.isDefault}></Radio>
113
                         </RadioGroup>
124
                         </RadioGroup>
114
-
115
-
116
                       </View>
125
                       </View>
117
 
126
 
118
                       <View className='addressList-box-addressBotton-addressDelete' onClick={() => addressDeletess(item.addressId)}>
127
                       <View className='addressList-box-addressBotton-addressDelete' onClick={() => addressDeletess(item.addressId)}>

+ 3
- 2
src/pages/MyAddressList/style.less View File

96
 }
96
 }
97
 
97
 
98
 .bottomButtom {
98
 .bottomButtom {
99
+  margin: 22vh auto;
99
   width: 100%;
100
   width: 100%;
100
-  margin: 0 auto;
101
-  margin-bottom: 15vh;
101
+  position: relative;
102
+  bottom: 17vh;
102
 }
103
 }

+ 9
- 0
src/pages/OrderConfirmation/index.config.js View File

1
+
2
+export default {
3
+  navigationBarTitleText: '订单确认',
4
+  navigationStyle: 'custom',
5
+  disableScroll: true,
6
+  usingComponents: {
7
+  }
8
+
9
+}

+ 49
- 0
src/pages/OrderConfirmation/index.jsx View File

1
+import { View, Text } from "@tarojs/components"
2
+import Taro from "@tarojs/taro"
3
+import { useState } from "react"
4
+import CustomNav from '@/components/CustomNav'
5
+import ButtontWX from '@/components/ButtontWX'
6
+// import BottomMoadl from '@/components/BottomMoadl/index'
7
+
8
+
9
+
10
+
11
+
12
+
13
+import './style.less'
14
+
15
+export default (props) => {
16
+  //底部弹窗
17
+  // const [showFrame, setShowFrame] = useState(false)
18
+  // const setRecommend = () => {
19
+  //   setShowFrame(!showFrame)
20
+  // }
21
+
22
+  const okgoPay = () => {
23
+    Taro.navigateTo({ url: `/pages/OrderInfo/index?id${1}` })
24
+  }
25
+  const cancelPay = () => {
26
+    Taro.navigateBack({
27
+      delta: 1
28
+    })
29
+  }
30
+
31
+
32
+
33
+  return (
34
+    <View className='page-index'>
35
+      <View className='index-navbar'>
36
+        <CustomNav title='订单确认' />
37
+      </View>
38
+      {/* <BottomMoadl frameTitle='支付方式' flag={showFrame} onRecommend={setRecommend} /> */}
39
+      <View>
40
+
41
+      </View>
42
+      <View className='BottomtBut' >
43
+        <ButtontWX butText='取消' onClick={cancelPay} butWidth={123} butHeight={39} butFontSize={16} butBorderRadius={49} />
44
+
45
+        <ButtontWX butText='确定' onClick={okgoPay} butWidth={123} butHeight={39} butFontSize={16} butBorderRadius={49} />
46
+      </View>
47
+    </View>
48
+  )
49
+}

+ 4
- 0
src/pages/OrderConfirmation/style.less View File

1
+.BottomtBut {
2
+  width: 99vw;
3
+  display: flex;
4
+}

+ 79
- 10
src/pages/OrderInfo/index.jsx View File

1
 import { View, Text } from "@tarojs/components"
1
 import { View, Text } from "@tarojs/components"
2
-import { useState } from "react"
2
+import { useEffect, useState } from "react"
3
+import Taro from "@tarojs/taro"
3
 import CustomNav from '@/components/CustomNav'
4
 import CustomNav from '@/components/CustomNav'
4
 import ButtontWX from '@/components/ButtontWX'
5
 import ButtontWX from '@/components/ButtontWX'
6
+import formatTimes from "@/utils/codeSegment"
7
+
8
+import { generateOrder, orderDelete, orderInfo } from "@/services/order"
5
 // import BottomMoadl from '@/components/BottomMoadl/index'
9
 // import BottomMoadl from '@/components/BottomMoadl/index'
6
 
10
 
7
 
11
 
12
 import './style.less'
16
 import './style.less'
13
 
17
 
14
 export default (props) => {
18
 export default (props) => {
19
+
20
+  const $instance = Taro.getCurrentInstance()
21
+  const { orderId } = $instance.router.params
22
+
23
+  const [orderInfos, setOrderInfos] = useState()
15
   //底部弹窗
24
   //底部弹窗
16
   // const [showFrame, setShowFrame] = useState(false)
25
   // const [showFrame, setShowFrame] = useState(false)
17
   // const setRecommend = () => {
26
   // const setRecommend = () => {
18
   //   setShowFrame(!showFrame)
27
   //   setShowFrame(!showFrame)
19
   // }
28
   // }
20
 
29
 
21
-  const pay = () => {
30
+  const cancelPay = () => {
31
+    Taro.showModal({
32
+      title: '提示',
33
+      content: '您确定要取消此订单吗?',
34
+      success: function (res) {
35
+        if (res.confirm) {
36
+          orderDelete(orderId).then((e) => {
37
+            console.log('订单取消/删除', e);
38
+            Taro.showToast({
39
+              title: '订单取消成功',
40
+              icon: 'success',
41
+              duration: 2000
42
+            }).then(() => {
43
+              setTimeout(() => {
44
+                Taro.navigateBack({
45
+                  delta: 1
46
+                })
47
+              }, 1500)
48
+            })
49
+          })
50
+        } else if (res.cancel) {
51
+          console.log('用户点击取消')
52
+        }
53
+      }
54
+    })
55
+  }
22
 
56
 
57
+  useEffect(() => {
58
+    if (orderId) {
59
+      orderInfo(orderId).then((res) => {
60
+        setOrderInfos(res)
61
+      })
62
+    } else {
63
+      Taro.showToast({
64
+        title: '暂无订单详情',
65
+        icon: 'error',
66
+        duration: 2000
67
+      }).then(() => {
68
+        setTimeout(() => {
69
+          Taro.navigateBack({
70
+            delta: 1
71
+          })
72
+        }, 1500)
73
+      })
74
+    }
75
+
76
+  }, [orderId])
77
+
78
+  const pay = () => {
79
+    generateOrder({
80
+      charges: 200,
81
+      price: 100,
82
+      amount: 20,
83
+      machineryId: '7cdf832d7a7af0c19ab33418e10e1a94',
84
+      machineryName: '第一台播种机',
85
+      machineryType: 'b4d183f684ed1f3d1cb2194c1975ae46',
86
+      typeName: '播种机',
87
+      address: '我是作业地址:房屋后面',
88
+      appontmentDate: new Date(),
89
+    })
23
   }
90
   }
24
 
91
 
25
 
92
 
30
       </View>
97
       </View>
31
       {/* <BottomMoadl frameTitle='支付方式' flag={showFrame} onRecommend={setRecommend} /> */}
98
       {/* <BottomMoadl frameTitle='支付方式' flag={showFrame} onRecommend={setRecommend} /> */}
32
       <View className='orders-listBox-RihtboxBoxOrderViewText'>
99
       <View className='orders-listBox-RihtboxBoxOrderViewText'>
33
-        <View className='View-LiftTextTop'>订单编号:<Text>41242425</Text></View>
34
-        <View>农机名称:<Text>阿松大的</Text></View>
35
-        <View>需求数量:<Text>2</Text></View>
36
-        <View>需求时间:<Text>2322-80-99</Text></View>
37
-        <View>下单时间:<Text>2244-06-78</Text></View>
38
-        <View>订单状态:<Text  >未支付</Text></View>
100
+        <View className='View-LiftTextTop'>订单编号:<Text>{orderInfos?.orderNo}</Text></View>
101
+        <View>农机名称:<Text>{orderInfos?.machineryName}</Text></View>
102
+        <View>作业面积:<Text>{orderInfos?.amount}</Text></View>
103
+        <View>需求时间:<Text>{formatTimes(orderInfos?.appointmentDate, 'yyyy-MM-dd hh:mm')}</Text></View>
104
+        <View>下单时间:<Text>{formatTimes(orderInfos?.createDate, 'yyyy-MM-dd hh:mm')}</Text></View>
105
+        <View>订单状态:<Text  >{orderInfos?.payStatus}</Text></View>
39
         <View className='View-LiftTextBotton'>
106
         <View className='View-LiftTextBotton'>
40
-          <View>费用:<Text className='feiyongStyle'>88</Text></View>
107
+          <View>费用:<Text className='feiyongStyle'>{orderInfos?.charges}</Text></View>
41
         </View>
108
         </View>
42
       </View>
109
       </View>
43
       <View className='BottomtBut' >
110
       <View className='BottomtBut' >
44
-        <ButtontWX butText='支付' onClick={pay} butWidth={345} butHeight={49} butFontSize={16} butBorderRadius={49} />
111
+        <ButtontWX butText='取消' onClick={cancelPay} butWidth={123} butHeight={39} butFontSize={16} butBorderRadius={49} />
112
+
113
+        <ButtontWX butText='支付' onClick={pay} butWidth={123} butHeight={39} butFontSize={16} butBorderRadius={49} />
45
       </View>
114
       </View>
46
     </View>
115
     </View>
47
   )
116
   )

+ 1
- 0
src/pages/OrderInfo/style.less View File

46
   width: 99vw;
46
   width: 99vw;
47
   position: absolute;
47
   position: absolute;
48
   bottom: 5vh;
48
   bottom: 5vh;
49
+  display: flex;
49
 }
50
 }

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

1
 
1
 
2
 import { View, Image } from "@tarojs/components"
2
 import { View, Image } from "@tarojs/components"
3
-import Taro from "@tarojs/taro"
3
+import Taro, { useDidShow } from "@tarojs/taro"
4
 import { useState, useEffect, useMemo } from "react"
4
 import { useState, useEffect, useMemo } from "react"
5
 import UserCellBox from '@/components/UserCellBox'
5
 import UserCellBox from '@/components/UserCellBox'
6
 import addresss from '@/assets/mineImgaes/addresss.png'//地址
6
 import addresss from '@/assets/mineImgaes/addresss.png'//地址
8
 import feedbacks from '@/assets/mineImgaes/feedbacks.png'//意见反馈
8
 import feedbacks from '@/assets/mineImgaes/feedbacks.png'//意见反馈
9
 import helpCenter from '@/assets/mineImgaes/helpCenter.png'//帮助中心
9
 import helpCenter from '@/assets/mineImgaes/helpCenter.png'//帮助中心
10
 import versionUpdate from '@/assets/mineImgaes/versionUpdate.png'//版本更新
10
 import versionUpdate from '@/assets/mineImgaes/versionUpdate.png'//版本更新
11
+import userMoren from '@/assets/mineImgaes/userMoren.png'//默认头像
11
 import userRight from '@/assets/mineImgaes/userRight.png'
12
 import userRight from '@/assets/mineImgaes/userRight.png'
12
 import { useModel } from "@/store"
13
 import { useModel } from "@/store"
13
 
14
 
15
+import { getAddress } from "@/services/address"
16
+
14
 
17
 
15
 
18
 
16
 import './MineCss/style.less'
19
 import './MineCss/style.less'
19
 export default (props) => {
22
 export default (props) => {
20
   const { person } = useModel('userData')
23
   const { person } = useModel('userData')
21
   const [isLoginBox, setIsLoginBox] = useState(false)
24
   const [isLoginBox, setIsLoginBox] = useState(false)
25
+  const [addresInfo, setAddresInfo] = useState('')
26
+
22
   const userList = [
27
   const userList = [
23
     { userTitle: '关于我们', userImg: aboutUs, pageType: 0 },
28
     { userTitle: '关于我们', userImg: aboutUs, pageType: 0 },
24
     { userTitle: '版本更新', userImg: versionUpdate, pageType: 1 },
29
     { userTitle: '版本更新', userImg: versionUpdate, pageType: 1 },
40
 
45
 
41
 
46
 
42
 
47
 
48
+  useDidShow(() => {
49
+    getAddress().then((e) => {
50
+      let abccList = e.records.sort((a, b) => b.isDefault - a.isDefault)
51
+      setAddresInfo(abccList[0].address)
52
+    })
53
+  })
54
+  useEffect(() => {
55
+
56
+    getAddress().then((e) => {
57
+      let abccList = e.records.sort((a, b) => b.isDefault - a.isDefault)
58
+      console.log("🚀 ~ file: index.jsx ~ line 75 ~ getAddress ~ abccList", abccList)
59
+      setAddresInfo(abccList[0].address)
60
+    })
61
+  }, [])
43
 
62
 
44
   const setAddress = (dd) => {
63
   const setAddress = (dd) => {
45
     Taro.navigateTo({ url: `/pages/MyAddressList/index?id${dd}` })
64
     Taro.navigateTo({ url: `/pages/MyAddressList/index?id${dd}` })
88
         {
107
         {
89
           !isLoginBox ?
108
           !isLoginBox ?
90
             <View style={{ backgroundImage: "url(" + require("@/assets/mineImgaes/mineBack.png") + ")" }} className='User-Avatar-background-falseBox'>
109
             <View style={{ backgroundImage: "url(" + require("@/assets/mineImgaes/mineBack.png") + ")" }} className='User-Avatar-background-falseBox'>
91
-              <Image className='User-Avatar-background-falseBox-userImg userImg' src='https://profile.csdnimg.cn/3/1/5/0_qq_42551866' />
110
+              <Image className='User-Avatar-background-falseBox-userImg userImg' src={userMoren} />
92
               <View onClick={userLoginnow} className='User-Avatar-background-falseBox-userLogin' >点击登陆</View>
111
               <View onClick={userLoginnow} className='User-Avatar-background-falseBox-userLogin' >点击登陆</View>
93
             </View>
112
             </View>
94
             :
113
             :
95
             <>
114
             <>
96
               <View style={{ backgroundImage: "url(" + require("@/assets/mineImgaes/mineBack.png") + ")" }} className='User-Avatar-background-trueBox'>
115
               <View style={{ backgroundImage: "url(" + require("@/assets/mineImgaes/mineBack.png") + ")" }} className='User-Avatar-background-trueBox'>
97
                 <View className='setPassword' onClick={goUserInfo}>修改个人信息</View>
116
                 <View className='setPassword' onClick={goUserInfo}>修改个人信息</View>
98
-                <Image className='User-Avatar-background-trueBox-userImg' src={userInfo?.avatar} />
117
+                <Image className='User-Avatar-background-trueBox-userImg' src={userInfo?.avatar || userMoren} />
99
                 <View className='User-Avatar-background-trueBox-name'>
118
                 <View className='User-Avatar-background-trueBox-name'>
100
                   <View >{userInfo?.nickName}</View>
119
                   <View >{userInfo?.nickName}</View>
101
                   <View >{userInfo?.phone}</View>
120
                   <View >{userInfo?.phone}</View>
106
                 <View className='addresss-box' onClick={setAddress} >
125
                 <View className='addresss-box' onClick={setAddress} >
107
                   <Image className='addresss-box-images' src={addresss} />
126
                   <Image className='addresss-box-images' src={addresss} />
108
                   <View className='addresss-box-contents'>
127
                   <View className='addresss-box-contents'>
109
-                    <View className='addresss-box-contents-texts' >河南省南阳市邓州市九龙镇5556666665</View>
128
+                    <View className='addresss-box-contents-texts' >{addresInfo}</View>
110
                     <View>》</View>
129
                     <View>》</View>
111
                   </View>
130
                   </View>
112
                 </View>
131
                 </View>

+ 29
- 23
src/pages/index/tabs/Orders.jsx View File

1
 
1
 
2
 import { View, Image, Text } from "@tarojs/components"
2
 import { View, Image, Text } from "@tarojs/components"
3
-import Taro from '@tarojs/taro'
3
+import Taro, { useDidShow } from '@tarojs/taro'
4
 
4
 
5
 import ordersListImga from '@/assets/ordersImages/ordersListImga.png'
5
 import ordersListImga from '@/assets/ordersImages/ordersListImga.png'
6
 import ordersLeft from '@/assets/ordersImages/ordersLeft.png'//订单装饰
6
 import ordersLeft from '@/assets/ordersImages/ordersLeft.png'//订单装饰
7
-
7
+import { useEffect, useState } from "react"
8
+import { getOrder } from "@/services/order"
9
+import formatTimes from "@/utils/codeSegment"
8
 
10
 
9
 import './OrdersCss/style.less'
11
 import './OrdersCss/style.less'
10
 
12
 
11
 
13
 
12
 export default (props) => {
14
 export default (props) => {
13
 
15
 
14
-
15
-
16
+  const [ourderList, setOrderList] = useState([])
17
+  useDidShow(() => {
18
+    getOrder().then((e) => {
19
+      const { records } = e
20
+      setOrderList(records)
21
+    })
22
+  })
23
+  useEffect(() => {
24
+    getOrder().then((e) => {
25
+      const { records } = e
26
+      setOrderList(records)
27
+    })
28
+  }, [])
29
+  console.log(ourderList, 'ourderList');
16
 
30
 
17
   const orderStates = (item) => {
31
   const orderStates = (item) => {
18
     switch (item) {
32
     switch (item) {
58
         }
72
         }
59
     }
73
     }
60
   }
74
   }
61
-  const handleTobePaid = () => {
62
-    Taro.navigateTo({ url: '/pages/OrderInfo/index' })
75
+  const handleTobePaid = (id) => {
76
+    Taro.navigateTo({ url: `/pages/OrderInfo/index?orderId=${id}` })
63
   }
77
   }
64
 
78
 
65
-  const orderListContent = [
66
-    { orderNumber: 'XJDF82521DA', cardsName: '联合收割机', cardNumber: '6', need: '2021-08-09', place: '2021-08-01', orderState: 0, feiyong: '360' },
67
-    { orderNumber: 'XJDF45244DA', cardsName: '不知道这是什么什么', cardNumber: '1', need: '2021-05-08', place: '2021-08-17', orderState: 1, feiyong: '78' },
68
-    { orderNumber: 'XJDF82521DA', cardsName: '为此发爱疸的箭的', cardNumber: '211', need: '2021-08-04', place: '2021-08-27', orderState: 2, feiyong: '35' },
69
-    { orderNumber: 'X78788821DA', cardsName: '水稻播种000015', cardNumber: '4', need: '2021-04-04', place: '2021-08-22', orderState: 3, feiyong: '170' },
70
-    { orderNumber: 'X44F77777DA', cardsName: '消费者协会', cardNumber: '5', need: '2021-02-11', place: '2021-08-10', orderState: 4, feiyong: '88' },
71
-    { orderNumber: 'XJ7857771DA', cardsName: '3·15', cardNumber: '1', need: '2021-01-09', place: '2021-08-10', orderState: 5, feiyong: '1.35' },
72
-    { orderNumber: 'X0000000001', cardsName: '农民伯伯', cardNumber: '2', need: '2027-08-29', place: '2021-08-17', orderState: 6, feiyong: '0.35' },
73
-  ]
79
+
74
 
80
 
75
   return (
81
   return (
76
     <scroll-view scrollY style='height: 100%;' >
82
     <scroll-view scrollY style='height: 100%;' >
82
         {/* <View className='content-header-box-orders-rightCentent'>更多&gt;&gt;</View> */}
88
         {/* <View className='content-header-box-orders-rightCentent'>更多&gt;&gt;</View> */}
83
       </View>
89
       </View>
84
       {
90
       {
85
-        orderListContent.map((item, index) => {
91
+        ourderList.map((item, index) => {
86
           return (
92
           return (
87
             <View key={index} className='orders-listBox'>
93
             <View key={index} className='orders-listBox'>
88
               <Image src={ordersLeft} />
94
               <Image src={ordersLeft} />
89
               <View className='orders-listBox-RihtboxBoxOrderViewText'>
95
               <View className='orders-listBox-RihtboxBoxOrderViewText'>
90
-                <View className='View-LiftTextTop' onClick={handleTobePaid} >订单编号:<Text>{item.orderNumber}</Text><Text className='View-LiftTextTop-nextText'>更多&gt;&gt;</Text></View>
91
-                <View>农机名称:<Text>{item.cardsName}</Text></View>
92
-                <View>需求数量:<Text>{item.cardNumber}</Text></View>
93
-                <View>需求时间:<Text>{item.need}</Text></View>
94
-                <View>下单时间:<Text>{item.place}</Text></View>
96
+                <View className='View-LiftTextTop' onClick={() => handleTobePaid(item.orderId)} >订单编号:<Text>{item.orderNo}</Text><Text className='View-LiftTextTop-nextText'>更多&gt;&gt;</Text></View>
97
+                <View>农机名称:<Text>{item.machineryName}</Text></View>
98
+                <View>作业面积:<Text>{item.amount}</Text></View>
99
+                <View>需求时间:<Text>{formatTimes(item.appointmentDate, 'yyyy-MM-dd hh:mm')}</Text></View>
100
+                <View>下单时间:<Text>{formatTimes(item.createDate, 'yyyy-MM-dd hh:mm')}</Text></View>
95
                 <View className='View-LiftTextBotton'>
101
                 <View className='View-LiftTextBotton'>
96
-                  <View>订单状态:<Text style={{ color: orderStates(item.orderState).styleColor }} >{orderStates(item.orderState).title}</Text></View>
97
-                  <View>费用:<Text className='feiyongStyle'>{item.feiyong}</Text></View>
102
+                  <View>订单状态:<Text style={{ color: orderStates(item.payStatus).styleColor }} >{orderStates(item.orderState).title}</Text></View>
103
+                  <View>费用:<Text className='feiyongStyle'>{item.charges}</Text></View>
98
                 </View>
104
                 </View>
99
               </View>
105
               </View>
100
             </View>
106
             </View>

+ 1
- 1
src/pages/index/tabs/OrdersCss/style.less View File

41
       padding-top: 0;
41
       padding-top: 0;
42
       &-nextText {
42
       &-nextText {
43
         position: relative;
43
         position: relative;
44
-        left: 13vw;
44
+        left: 5vw;
45
         font-size: 32px;
45
         font-size: 32px;
46
         font-weight: 500;
46
         font-weight: 500;
47
         color: #666666;
47
         color: #666666;

+ 5
- 1
src/pages/userInfo/index.jsx View File

40
           title: '保存成功',
40
           title: '保存成功',
41
           icon: 'none',
41
           icon: 'none',
42
         })
42
         })
43
-        Taro.navigateBack({ delta: 1 })
43
+        setTimeout(() => {
44
+          Taro.navigateBack({
45
+            delta: 1
46
+          })
47
+        }, 1500)
44
       }).catch((e) => {
48
       }).catch((e) => {
45
         console.log(e)
49
         console.log(e)
46
         Taro.showToast({
50
         Taro.showToast({

+ 4
- 0
src/routes.js View File

10
     title: '订单详情',
10
     title: '订单详情',
11
     page: 'pages/OrderInfo/index',
11
     page: 'pages/OrderInfo/index',
12
   },
12
   },
13
+  {
14
+    title: '订单确认页',
15
+    page: 'pages/OrderConfirmation/index',
16
+  },
13
   {
17
   {
14
     title: '登陆页',
18
     title: '登陆页',
15
     page: 'pages/UserLogin/index',
19
     page: 'pages/UserLogin/index',

+ 9
- 0
src/services/mine.js View File

1
+
2
+import request from '@/utils/request'
3
+/**
4
+ * 意见反馈
5
+ * @param {*} data 
6
+ * @returns 
7
+ */
8
+export const feedback = (data) => request('/feedback', { data, method: 'post' })
9
+

+ 35
- 0
src/services/order.js View File

1
+
2
+
3
+import request from '@/utils/request'
4
+
5
+
6
+
7
+/**
8
+ * 订单列表
9
+ * @param {*} data 
10
+ * @returns 
11
+ */
12
+export const getOrder = (data) => request(`/order`, { data, method: 'GET' })
13
+
14
+/**
15
+ * 生成订单
16
+ * @param {*} data 
17
+ * @returns 
18
+ */
19
+export const generateOrder = (data) => request(`/order`, { data, method: 'POST' })
20
+/**
21
+* 订单详情
22
+* @param {*} data 
23
+* @returns 
24
+*/
25
+export const orderInfo = (id, data) => request(`/order/${id}`, { data, method: 'GET' })
26
+/**
27
+ * 删除订单
28
+ * @param {*} data 
29
+ * @returns 
30
+ */
31
+export const orderDelete = (id, data) => request(`/order/${id}`, { data, method: 'DELETE' })
32
+
33
+
34
+
35
+

+ 32
- 0
src/utils/codeSegment.js View File

18
 }
18
 }
19
 
19
 
20
 
20
 
21
+
22
+
23
+
24
+function getDateByStr (dtStr) {
25
+  if (!dtStr) return undefined;
26
+
27
+  const t = dtStr.split(/[-T :]/);
28
+  return new Date(t[0], t[1] - 1, t[2], t[3] || 0, t[4] || 0, t[5] || 0)
29
+}
30
+
31
+export default function formatTimes (dt, fmt) {
32
+  if (!dt) return dt;
33
+
34
+  // 解决苹果手机不能正常初始化的问题
35
+  const date = typeof dt === 'string' ? getDateByStr(dt) : new Date(dt);
36
+
37
+  var o = {
38
+    "M+": date.getMonth() + 1, //月份
39
+    "d+": date.getDate(), //日
40
+    "h+": date.getHours(), //小时
41
+    "m+": date.getMinutes(), //分
42
+    "s+": date.getSeconds(), //秒
43
+    "q+": Math.floor((date.getMonth() + 3) / 3), //季度
44
+    "S": date.getMilliseconds() //毫秒
45
+  };
46
+  if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (date.getFullYear() + "").substr(4 - RegExp.$1.length));
47
+  for (var k in o)
48
+    if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
49
+  return fmt;
50
+};
51
+
52
+