[baozhangchao] 3 years ago
parent
commit
4879afe37c

+ 4
- 2
src/components/CarsListContent/index.jsx View File

@@ -8,6 +8,8 @@ import addresss from '@/assets/mineImgaes/addresss.png'//地址
8 8
 import { useModel } from "@/store"
9 9
 import ListPlaceholder from "@/components/ListPlaceholder"
10 10
 import { getMachinery, } from "@/services/homes"
11
+import formatPrice from "@/utils/formatPrice"
12
+import { setMorKm } from '@/utils/codeSegment'
11 13
 
12 14
 
13 15
 import './style.less'
@@ -56,7 +58,7 @@ export default withLayout((props) => {
56 58
               <View className='carsListImga-bottom-box-flaxBox'>
57 59
                 <View className='carsListImga-bottom-box-flaxBox-liftText'>
58 60
                   <View className='carsListImga-bottom-box-flaxBox-liftText-Titles'>{item.name}</View>
59
-                  <View className='carsListImga-bottom-box-flaxBox-liftText-price'>{item.price}/<Text>公顷</Text></View>
61
+                  <View className='carsListImga-bottom-box-flaxBox-liftText-price'>{formatPrice(item.price)}/<Text>公顷</Text></View>
60 62
                 </View>
61 63
                 <View className='carsListImga-bottom-box-flaxBox-rightBut'>
62 64
                   <ButtontWX onClick={() => startReserve(item.machineryId)} butText='预约' butWidth={80} butHeight={34} butFontSize={19} butBorderRadius={0} />
@@ -65,7 +67,7 @@ export default withLayout((props) => {
65 67
               <View className='content-header-box-map' onClick={() => goMapInfo(item.machineryId)}>
66 68
                 <View className='content-header-box-map-liftCentent'>
67 69
                   <Image src={addresss} />
68
-                  <View>距离当前位置公里</View>
70
+                  <View>距离当前位置{setMorKm(item.distance)}</View>
69 71
                 </View>
70 72
                 <View className='content-header-box-map-rightCentent'>进入地图&gt;&gt;</View>
71 73
               </View>

+ 5
- 4
src/pages/MoreCars/CarTypeList.jsx View File

@@ -7,7 +7,8 @@ import withLayout from '@/layouts'
7 7
 import addresss from '@/assets/mineImgaes/addresss.png'//地址
8 8
 import { useModel } from "@/store"
9 9
 import ListPlaceholder from "@/components/ListPlaceholder"
10
-
10
+import formatPrice from "@/utils/formatPrice"
11
+import { setMorKm } from '@/utils/codeSegment'
11 12
 
12 13
 import './CarTypeList.less'
13 14
 
@@ -44,14 +45,14 @@ export default withLayout((props) => {
44 45
 
45 46
     <>
46 47
       {
47
-        csrsListType == [] ? csrsListType.map((item, index) => {
48
+        csrsListType !== [] ? csrsListType.map((item, index) => {
48 49
           return (
49 50
             <View key={index} className='carsListImga-bottom-box'>
50 51
               <Image src={item.thumb} onClick={() => goCarsInfo(item.machineryId)} />
51 52
               <View className='carsListImga-bottom-box-flaxBox'>
52 53
                 <View className='carsListImga-bottom-box-flaxBox-liftText'>
53 54
                   <View className='carsListImga-bottom-box-flaxBox-liftText-Titles'>{item.name}</View>
54
-                  <View className='carsListImga-bottom-box-flaxBox-liftText-price'>{item.price}/<Text>公顷</Text></View>
55
+                  <View className='carsListImga-bottom-box-flaxBox-liftText-price'>{formatPrice(item.price)}/<Text>公顷</Text></View>
55 56
                 </View>
56 57
                 <View className='carsListImga-bottom-box-flaxBox-rightBut'>
57 58
                   <ButtontWX onClick={() => startReserve(item.machineryId)} butText='预约' butWidth={80} butHeight={34} butFontSize={19} butBorderRadius={0} />
@@ -60,7 +61,7 @@ export default withLayout((props) => {
60 61
               <View className='content-header-box-map' onClick={() => goMapInfo(item.machineryId)}>
61 62
                 <View className='content-header-box-map-liftCentent'>
62 63
                   <Image src={addresss} />
63
-                  <View>距离当前位置公里</View>
64
+                  <View>距离当前位置{setMorKm(item.distance)}</View>
64 65
                 </View>
65 66
                 <View className='content-header-box-map-rightCentent'>进入地图&gt;&gt;</View>
66 67
               </View>

+ 1
- 2
src/pages/MoreCars/index.jsx View File

@@ -50,7 +50,6 @@ export default withLayout((props) => {
50 50
   //   }
51 51
 
52 52
 
53
-
54 53
   // }
55 54
 
56 55
   useEffect(() => {
@@ -67,7 +66,7 @@ export default withLayout((props) => {
67 66
     } else {
68 67
       // ClassificationComparison()
69 68
 
70
-      getMachinery(sserLocation).then((e) => {
69
+      getMachinery(sserLocation, { pageSize: 999 }).then((e) => {
71 70
         steCsrsListType(e.records)
72 71
       })
73 72
     }

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

@@ -5,9 +5,9 @@ import CustomNav from "@/components/CustomNav"
5 5
 import edit from "@/assets/icons/comm/edit.png"
6 6
 import userRight from '@/assets/mineImgaes/userRight.png'
7 7
 import withLayout from '@/layouts'
8
-
9 8
 import deletes from "@/assets/icons/comm/deletes.png"
10 9
 import ButtontWX from '@/components/ButtontWX'
10
+import { useModel } from "@/store"
11 11
 
12 12
 
13 13
 import { addressDefault, getAddress, addressDelete, addressUpdate } from "@/services/address"
@@ -18,6 +18,10 @@ import './style.less'
18 18
 
19 19
 export default withLayout((props) => {
20 20
   const [addresList, setAddresList] = useState([])
21
+  const $instance = Taro.getCurrentInstance()
22
+  const { orderAddress } = $instance.router.params
23
+  const { setUserOrderAddress, userOrderAddress } = useModel('userData')
24
+
21 25
 
22 26
   const addAddress = () => {
23 27
     Taro.navigateTo({ url: `/pages/MyAddressList/AddressInfos/index?id=${1}` })
@@ -93,7 +97,32 @@ export default withLayout((props) => {
93 97
     console.log('评分', e.detail);
94 98
 
95 99
   }
100
+  const handleAddress = (e) => {
101
+    if (e) {
102
+      setUserOrderAddress(e)
103
+      Taro.showToast({
104
+        title: '选择成功',
105
+        icon: 'success',
106
+        duration: 2000
107
+      }).then(() => {
108
+        setTimeout(() => {
109
+          Taro.navigateBack({
110
+            delta: 1
111
+          })
112
+          setInterval()
113
+
114
+        }, 300)
115
+      })
116
+
117
+      console.log('选择的地址存放在store', userOrderAddress);
118
+
119
+
120
+
121
+    }
96 122
 
123
+
124
+
125
+  }
97 126
   return (
98 127
     <View className='page-index'>
99 128
       <View className='index-navbar'>
@@ -122,20 +151,28 @@ export default withLayout((props) => {
122 151
                     </View>
123 152
 
124 153
                     <View className='addressList-box-addressBotton-setAddress'>
125
-                      <View>
126
-                        设为默认地址:
127
-                        <RadioGroup className='radio-group' onChange={(res) => handelSwitch(item.addressId, res)} >
128
-                          <Radio color='#FC5531' checked={item.isDefault}></Radio>
129
-                        </RadioGroup>
130
-                      </View>
131
-
132
-                      <View className='addressList-box-addressBotton-addressDelete' onClick={() => addressDeletess(item.addressId)}>
133
-                        <View>
134
-                          删除
135
-                        </View>
136
-                        <Image src={deletes} />
154
+                      {
155
+                        orderAddress ? <>
156
+                          <View>
157
+                            设为默认地址:
158
+                            <RadioGroup className='radio-group' onChange={(res) => handelSwitch(item.addressId, res)} >
159
+                              <Radio color='#FC5531' checked={item.isDefault}></Radio>
160
+                            </RadioGroup>
161
+                          </View>
162
+
163
+                          <View className='addressList-box-addressBotton-addressDelete' onClick={() => addressDeletess(item.addressId)}>
164
+                            <View>
165
+                              删除
166
+                            </View>
167
+                            <Image src={deletes} />
168
+
169
+                          </View>
170
+                        </>
171
+                          : <View className='orderAddressa' onClick={() => handleAddress(item.address)}>
172
+                            选择此地址
173
+                          </View>
174
+                      }
137 175
 
138
-                      </View>
139 176
                     </View>
140 177
                   </View>
141 178
                 </View>

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

@@ -83,6 +83,10 @@
83 83
         //   position: relative;
84 84
         // }
85 85
       }
86
+      .orderAddressa {
87
+        font-size: 34px;
88
+        font-weight: 800;
89
+      }
86 90
     }
87 91
     &-addressDelete {
88 92
       display: flex;

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

@@ -59,6 +59,12 @@
59 59
         white-space: nowrap;
60 60
         color: #000;
61 61
       }
62
+      .aTextareaCentent {
63
+        width: 80vw;
64
+        overflow: hidden;
65
+        text-overflow: ellipsis;
66
+        -webkit-line-clamp: 1;
67
+      }
62 68
     }
63 69
   }
64 70
   .BottomtBut-box {

+ 4
- 3
src/pages/OrderInfo/index.jsx View File

@@ -5,6 +5,7 @@ import CustomNav from '@/components/CustomNav'
5 5
 import ButtontWX from '@/components/ButtontWX'
6 6
 import formatTimes from "@/utils/codeSegment"
7 7
 import withLayout from '@/layouts'
8
+import formatPrice from "@/utils/formatPrice"
8 9
 
9 10
 import { generateOrder, orderDelete, orderInfo } from "@/services/order"
10 11
 // import BottomMoadl from '@/components/BottomMoadl/index'
@@ -92,11 +93,11 @@ export default withLayout((props) => {
92 93
         <View className='View-LiftTextTop'>订单编号:<Text>{orderInfos?.orderNo}</Text></View>
93 94
         <View>农机名称:<Text>{orderInfos?.machineryName}</Text></View>
94 95
         <View>作业面积:<Text>{orderInfos?.amount}</Text></View>
95
-        <View>需求时间:<Text>{formatTimes(orderInfos?.appointmentDate, 'yyyy-MM-dd hh:mm')}</Text></View>
96
-        <View>下单时间:<Text>{formatTimes(orderInfos?.createDate, 'yyyy-MM-dd hh:mm')}</Text></View>
96
+        <View>需求时间:<Text>{formatTimes(orderInfos?.appointmentDate, 'yyyy-MM-dd')}</Text></View>
97
+        <View>下单时间:<Text>{formatTimes(orderInfos?.createDate, 'yyyy-MM-dd')}</Text></View>
97 98
         <View>订单状态:<Text  >{orderInfos?.payStatus}</Text></View>
98 99
         <View className='View-LiftTextBotton'>
99
-          <View>费用:<Text className='feiyongStyle'>{orderInfos?.charges}</Text></View>
100
+          <View>费用:<Text className='feiyongStyle'>{formatPrice(orderInfos?.charges)}</Text></View>
100 101
         </View>
101 102
       </View>
102 103
       <View className='BottomtBut' >

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

@@ -103,8 +103,8 @@ export default withLayout((props) => {
103 103
                 <View className='View-LiftTextTop' onClick={() => handleTobePaid(item.orderId)} >订单编号:<Text>{item.orderNo}</Text><Text className='View-LiftTextTop-nextText'>更多&gt;&gt;</Text></View>
104 104
                 <View>农机名称:<Text>{item.machineryName}</Text></View>
105 105
                 <View>作业面积:<Text>{item.amount}</Text></View>
106
-                <View>需求时间:<Text>{formatTimes(item.appointmentDate, 'yyyy-MM-dd hh:mm')}</Text></View>
107
-                <View>下单时间:<Text>{formatTimes(item.createDate, 'yyyy-MM-dd hh:mm')}</Text></View>
106
+                <View>需求时间:<Text>{formatTimes(item.appointmentDate, 'yyyy-MM-dd')}</Text></View>
107
+                <View>下单时间:<Text>{formatTimes(item.createDate, 'yyyy-MM-dd')}</Text></View>
108 108
                 <View className='View-LiftTextBotton'>
109 109
                   <View>订单状态:<Text style={{ color: orderStates(item.payStatus).styleColor }} >{orderStates(item.orderState).title}</Text></View>
110 110
                   <View>费用:<Text className='feiyongStyle'>{item.charges}</Text></View>

+ 7
- 2
src/store/userData.js View File

@@ -8,12 +8,13 @@ export default () => {
8 8
   const [sessionKey, setSessionKey] = useState()
9 9
   const [userPhoneInfo, setUserPhoneInfo] = useState()
10 10
 
11
-
12 11
   const [sserLocation, setUserLocation] = useState('')
12
+  const [userOrderAddress, setUserOrderAddress] = useState('')
13
+
13 14
 
14 15
 
15 16
   console.log("🚀 来自store的打印 person数据", person)
16
-  console.log("🚀 来自store的打印 sserLocation定位", sserLocation)
17
+
17 18
 
18 19
 
19 20
 
@@ -39,6 +40,10 @@ export default () => {
39 40
     sserLocation,
40 41
     setUserLocation,
41 42
 
43
+
44
+    userOrderAddress,//订单选择位置
45
+    setUserOrderAddress,
46
+
42 47
     logins,
43 48
   }
44 49
 }

+ 16
- 1
src/utils/codeSegment.js View File

@@ -20,7 +20,7 @@ export function getQueryString (params) {
20 20
 
21 21
 
22 22
 
23
-
23
+//日期格式化
24 24
 function getDateByStr (dtStr) {
25 25
   if (!dtStr) return undefined;
26 26
 
@@ -50,3 +50,18 @@ export default function formatTimes (dt, fmt) {
50 50
 };
51 51
 
52 52
 
53
+
54
+export function setMorKm (m) {
55
+  var n = ''
56
+  if (m) {
57
+    if (m >= 1000) {
58
+      n = (m / 1000).toFixed(2) + '公里'
59
+    } else {
60
+      n = m + '米'
61
+    }
62
+  } else {
63
+    n = '0m'
64
+  }
65
+  return n
66
+}
67
+

+ 1
- 0
src/utils/formatPrice.js View File

@@ -0,0 +1 @@
1
+export default (t) => ((t || 0) / 100).toFixed(2);