|
@@ -5,6 +5,7 @@ import withLayout from '@/layouts'
|
5
|
5
|
import { useModel } from "@/store"
|
6
|
6
|
import addresss from '@/assets/mineImgaes/addresss.png'//地址
|
7
|
7
|
import timeImage from '@/assets/icons/comm/timeImage.png'//日期图片
|
|
8
|
+import formatTimes from "@/utils/codeSegment"
|
8
|
9
|
|
9
|
10
|
import CustomNav from '@/components/CustomNav'
|
10
|
11
|
import ButtontWX from '@/components/ButtontWX'
|
|
@@ -44,37 +45,58 @@ export default withLayout((props) => {
|
44
|
45
|
}, [userOrderAddress])
|
45
|
46
|
|
46
|
47
|
const formSubmit = (e) => {
|
47
|
|
- const { amount, appontmentDate, address } = e?.detail?.value
|
48
|
|
-
|
49
|
|
- if (amount && appontmentDate && address) {
|
50
|
|
- generateOrder({
|
51
|
|
- charges: carsInfo?.price * amount,
|
52
|
|
- price: carsInfo?.price,
|
53
|
|
- amount: amount || '',
|
54
|
|
- machineryId: carsInfo?.machineryId,
|
55
|
|
- machineryName: carsInfo?.name,
|
56
|
|
- machineryType: carsInfo?.typeId,
|
57
|
|
- typeName: carsInfo?.typeName,
|
58
|
|
- address: address || '',
|
59
|
|
- orgId: carsInfo?.orgId,
|
60
|
|
- appointmentDate: `${appontmentDate} 08:00:00` || '',
|
61
|
|
- // appointmentDate: '2022-03-25 08:00:00',
|
62
|
|
- }).then((es) => {
|
|
48
|
+ const currentTime = formatTimes(new Date(), 'yyyy-MM-dd')
|
|
49
|
+ const newTime = formatTimes(timeSel, 'yyyy-MM-dd')
|
|
50
|
+
|
|
51
|
+ if (currentTime <= newTime) {
|
|
52
|
+ // const { amount, appontmentDate, address } = e?.detail?.value
|
|
53
|
+ const amount = e?.detail?.value?.amount
|
|
54
|
+ const appontmentDate = e?.detail?.value?.appontmentDate
|
|
55
|
+ const address = e?.detail?.value?.address
|
|
56
|
+
|
|
57
|
+ debugger
|
|
58
|
+
|
|
59
|
+ console.log('formSubmit', e?.detail);
|
|
60
|
+ if (e?.detail?.value?.amount && e?.detail?.value?.appontmentDate && e?.detail?.value?.address) {
|
|
61
|
+ generateOrder({
|
|
62
|
+ charges: carsInfo?.price * amount,
|
|
63
|
+ price: carsInfo?.price,
|
|
64
|
+ amount: amount || '',
|
|
65
|
+ machineryId: carsInfo?.machineryId,
|
|
66
|
+ machineryName: carsInfo?.name,
|
|
67
|
+ machineryType: carsInfo?.typeId,
|
|
68
|
+ typeName: carsInfo?.typeName,
|
|
69
|
+ address: address || '',
|
|
70
|
+ orgId: carsInfo?.orgId,
|
|
71
|
+ appointmentDate: `${appontmentDate} 08:00:00` || '',
|
|
72
|
+ // appointmentDate: '2022-03-25 08:00:00',
|
|
73
|
+ }).then((es) => {
|
|
74
|
+ Taro.showToast({
|
|
75
|
+ title: '农机预约成功',
|
|
76
|
+ icon: 'success',
|
|
77
|
+ duration: 2000
|
|
78
|
+ }).then(() => {
|
|
79
|
+ Taro.redirectTo({ url: `/pages/OrderInfo/index?orderId=${es.orderId}&stateType=待付款` })
|
|
80
|
+ })
|
|
81
|
+ })
|
|
82
|
+ } else {
|
63
|
83
|
Taro.showToast({
|
64
|
|
- title: '农机预约成功',
|
65
|
|
- icon: 'success',
|
|
84
|
+ title: '请填写完整信息',
|
|
85
|
+ icon: 'error',
|
66
|
86
|
duration: 2000
|
67
|
|
- }).then(() => {
|
68
|
|
- Taro.redirectTo({ url: `/pages/OrderInfo/index?orderId=${es.orderId}` })
|
69
|
87
|
})
|
70
|
|
- })
|
|
88
|
+ }
|
|
89
|
+
|
|
90
|
+
|
71
|
91
|
} else {
|
72
|
92
|
Taro.showToast({
|
73
|
|
- title: '请填写完整信息',
|
|
93
|
+ title: '日期有误!',
|
74
|
94
|
icon: 'error',
|
75
|
95
|
duration: 2000
|
76
|
96
|
})
|
|
97
|
+ return;
|
77
|
98
|
}
|
|
99
|
+
|
78
|
100
|
// Taro.navigateTo({ url: `/pages/OrderInfo/index?goOrder=${id}` })
|
79
|
101
|
}
|
80
|
102
|
useEffect(() => {
|
|
@@ -87,6 +109,8 @@ export default withLayout((props) => {
|
87
|
109
|
}, [id, sserLocation])
|
88
|
110
|
const onTimeChange = (e) => {
|
89
|
111
|
console.log('时间选择器', e);
|
|
112
|
+ // 获取当前时间
|
|
113
|
+
|
90
|
114
|
setTimeSel(e?.detail?.value)
|
91
|
115
|
|
92
|
116
|
}
|
|
@@ -112,7 +136,7 @@ export default withLayout((props) => {
|
112
|
136
|
<Form onSubmit={formSubmit} >
|
113
|
137
|
<View className='example-body-WorkingArea'>
|
114
|
138
|
<View>作业面积/公顷</View>
|
115
|
|
- <Input name='amount' type='number' className='aTextareaCentent' placeholder='请输入地址信息' />
|
|
139
|
+ <Input name='amount' type='number' maxlength={6} className='aTextareaCentent' placeholder='请输入地址信息' />
|
116
|
140
|
</View>
|
117
|
141
|
<View className='example-body-WorkingTime'>
|
118
|
142
|
<View>作业时间:</View>
|
|
@@ -137,7 +161,7 @@ export default withLayout((props) => {
|
137
|
161
|
</View>
|
138
|
162
|
</View>
|
139
|
163
|
<View className='BottomtBut-box'>
|
140
|
|
- <ButtontWX onClick={formSubmit} butText='确定' butWidth={315} butHeight={49} butFontSize={16} butBorderRadius={49} />
|
|
164
|
+ <ButtontWX onClick={formSubmit} formType='submit' butText='确定' butWidth={315} butHeight={49} butFontSize={16} butBorderRadius={49} />
|
141
|
165
|
<ButtontWX onClick={cancelPay} styleType butText='取消' butWidth={315} butHeight={49} butFontSize={16} butBorderRadius={49} />
|
142
|
166
|
</View>
|
143
|
167
|
</Form>
|