[baozhangchao] 3 年之前
父節點
當前提交
4879afe37c

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

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

+ 5
- 4
src/pages/MoreCars/CarTypeList.jsx 查看文件

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

+ 1
- 2
src/pages/MoreCars/index.jsx 查看文件

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

+ 51
- 14
src/pages/MyAddressList/index.jsx 查看文件

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'
7
 import withLayout from '@/layouts'
7
 import withLayout from '@/layouts'
8
-
9
 import deletes from "@/assets/icons/comm/deletes.png"
8
 import deletes from "@/assets/icons/comm/deletes.png"
10
 import ButtontWX from '@/components/ButtontWX'
9
 import ButtontWX from '@/components/ButtontWX'
10
+import { useModel } from "@/store"
11
 
11
 
12
 
12
 
13
 import { addressDefault, getAddress, addressDelete, addressUpdate } from "@/services/address"
13
 import { addressDefault, getAddress, addressDelete, addressUpdate } from "@/services/address"
18
 
18
 
19
 export default withLayout((props) => {
19
 export default withLayout((props) => {
20
   const [addresList, setAddresList] = useState([])
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
   const addAddress = () => {
26
   const addAddress = () => {
23
     Taro.navigateTo({ url: `/pages/MyAddressList/AddressInfos/index?id=${1}` })
27
     Taro.navigateTo({ url: `/pages/MyAddressList/AddressInfos/index?id=${1}` })
93
     console.log('评分', e.detail);
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
   return (
126
   return (
98
     <View className='page-index'>
127
     <View className='page-index'>
99
       <View className='index-navbar'>
128
       <View className='index-navbar'>
122
                     </View>
151
                     </View>
123
 
152
 
124
                     <View className='addressList-box-addressBotton-setAddress'>
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
                     </View>
176
                     </View>
140
                   </View>
177
                   </View>
141
                 </View>
178
                 </View>

+ 4
- 0
src/pages/MyAddressList/style.less 查看文件

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

+ 6
- 0
src/pages/OrderConfirmation/style.less 查看文件

59
         white-space: nowrap;
59
         white-space: nowrap;
60
         color: #000;
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
   .BottomtBut-box {
70
   .BottomtBut-box {

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

5
 import ButtontWX from '@/components/ButtontWX'
5
 import ButtontWX from '@/components/ButtontWX'
6
 import formatTimes from "@/utils/codeSegment"
6
 import formatTimes from "@/utils/codeSegment"
7
 import withLayout from '@/layouts'
7
 import withLayout from '@/layouts'
8
+import formatPrice from "@/utils/formatPrice"
8
 
9
 
9
 import { generateOrder, orderDelete, orderInfo } from "@/services/order"
10
 import { generateOrder, orderDelete, orderInfo } from "@/services/order"
10
 // import BottomMoadl from '@/components/BottomMoadl/index'
11
 // import BottomMoadl from '@/components/BottomMoadl/index'
92
         <View className='View-LiftTextTop'>订单编号:<Text>{orderInfos?.orderNo}</Text></View>
93
         <View className='View-LiftTextTop'>订单编号:<Text>{orderInfos?.orderNo}</Text></View>
93
         <View>农机名称:<Text>{orderInfos?.machineryName}</Text></View>
94
         <View>农机名称:<Text>{orderInfos?.machineryName}</Text></View>
94
         <View>作业面积:<Text>{orderInfos?.amount}</Text></View>
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
         <View>订单状态:<Text  >{orderInfos?.payStatus}</Text></View>
98
         <View>订单状态:<Text  >{orderInfos?.payStatus}</Text></View>
98
         <View className='View-LiftTextBotton'>
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
         </View>
101
         </View>
101
       </View>
102
       </View>
102
       <View className='BottomtBut' >
103
       <View className='BottomtBut' >

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

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

+ 7
- 2
src/store/userData.js 查看文件

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

+ 16
- 1
src/utils/codeSegment.js 查看文件

20
 
20
 
21
 
21
 
22
 
22
 
23
-
23
+//日期格式化
24
 function getDateByStr (dtStr) {
24
 function getDateByStr (dtStr) {
25
   if (!dtStr) return undefined;
25
   if (!dtStr) return undefined;
26
 
26
 
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 查看文件

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