diff --git a/changelogs/2026-03/2026-03-22_vehicle_assignment_fields.md b/changelogs/2026-03/2026-03-22_vehicle_assignment_fields.md new file mode 100644 index 0000000..7afcdf4 --- /dev/null +++ b/changelogs/2026-03/2026-03-22_vehicle_assignment_fields.md @@ -0,0 +1,29 @@ +# 配车接口字段说明 + +**日期**: 2026-03-22 +**接口**: `PUT /admin/order/{orderId}/vehicle-assignment` +**问题**: 前端报错 "vehicleModel: 车型不能为空; vehicleBrand: 品牌不能为空" + +--- + +## 原因 + +前端选择了车型下拉(选到了车型ID),但提交时没有传 `vehicleModel` 和 `vehicleBrand` 字段。 + +## 请求体必传字段 + +```json +{ + "vehicleModel": "小蒙马车(5座)", // 必填:车型名称(从车辆列表选中项中取) + "vehicleBrand": "蒙古马", // 必填:品牌(从车辆列表选中项中取) + "plateNumber": "222", // 选填:车牌号 + "driverName": "2222", // 选填:司机姓名 + "driverPhone": "22222" // 选填:司机电话 +} +``` + +## 前端处理方式 + +选择车型下拉时,从选中的车辆数据中取出 `vehicleModel`(车型名称)和 `vehicleBrand`(品牌),一起放到提交的请求体中。不能只传车型ID。 + +车辆列表接口 `GET /admin/order/{orderId}/available-vehicles` 返回的每项数据都包含 `vehicleModel` 和 `vehicleBrand` 字段。