| | |
| | | class="form-input" |
| | | type="digit" |
| | | placeholder="请输入行驶公里数" |
| | | v-model="taskForm.distance" |
| | | v-model="taskForm.transferDistance" |
| | | /> |
| | | </view> |
| | | |
| | |
| | | plannedEndTime: '', |
| | | startLocation: '', |
| | | endLocation: '', |
| | | distance: '', |
| | | transferDistance: '', |
| | | remark: '' |
| | | }, |
| | | vehicles: [], |
| | |
| | | // 百度地图返回的距离单位是米,需要转换为公里 |
| | | const distanceInMeters = response.data.distance |
| | | const distanceInKm = distanceInMeters / 1000 |
| | | this.taskForm.distance = distanceInKm.toFixed(2) |
| | | this.taskForm.transferDistance = distanceInKm.toFixed(2) |
| | | |
| | | console.log('距离计算成功:', distanceInMeters, '米 =', distanceInKm, '公里') |
| | | |
| | |
| | | plannedEndTime: this.taskForm.plannedEndTime, |
| | | departureAddress: this.taskForm.startLocation, |
| | | destinationAddress: this.taskForm.endLocation, |
| | | estimatedDistance: this.taskForm.distance ? parseFloat(this.taskForm.distance) : null, |
| | | transferDistance: this.taskForm.transferDistance ? parseFloat(this.taskForm.transferDistance) : null, |
| | | remark: this.taskForm.remark |
| | | } |
| | | |