文档
测试

4.计价

POST
https://openapi-pre.huolala.cn/api/e-order-price-calculate

服务入口

测试环境:https://openapi-pre.huolala.cn/api/e-order-price-calculate 正式环境:https://openapi.huolala.cn/api/e-order-price-calculate

调用特别注意事项

1.货拉拉计价的规则是什么? 答:计价接口返回结果为货拉拉根据车型,公里数计算出来的基础报价 - 下单城市 - 公里数 - 车型(起步价,超里程后区间内每公里价) 2.价格是固定的么? 答:价格是实时浮动的。每个城市,每个车型下,某个时间点价格可能都不一样。请实时进行获取 3.接口返回"车型已变更",应如何处理? 答:以上可能因为“城市版本号变更”,“车型变更”,“计价结果不正确”等可能导致此返回。处理方式如下 - 重新调用“获取城市可选车型信息”接口。获取最新的城市版本号revision - 重新计价

前端UI参考

![image.png](https://cos.easydoc.net/48578360/files/k9xtqp9l)

公共请求参数

参数名
类型
描述
必填
app_key
string
开发者应用唯一标识.
必填
access_token
string
货拉拉用户授权给开发者应用的账户访问令牌码
必填
nonce_str
string
随机数,用户自定义,60s内不可重复使用,仅用于保证签名不可预测;示例:474
必填
timestamp
string
Unix时间戳(单位:秒),60s内有效,超过60s则超时;示例:1565225482
必填

应用级请求参数

参数名
类型
描述
必填
city_id
string
下单城市ID
必填
city_info_revision
int
下单城市版本号
必填
order_vehicle_id
string
下单车型ID
必填
std_tag_arr
string
用户选择的车型附加要求。 示例:[2,5] 格式如:"[\"带尾板\"]";值可取“获取城市可选车型信息"接口返回值中data.vehicle_arr[0].vehicle_std_arr.name的值作为成员
可选
spec_req_arr
string
用户选择的城市额外需求。 示例:[2,5] 整型数组;格式如:"[2, 3, 5]";值可取“获取城市可选车型信息"接口返回值中data.spec_req_arr.type的值作为成员;1搬运 2小推车 3回单 4尾板 5返程 6回单拍照 7海外入仓 8代收货款;示例:2
可选
lat_lon_arr
string
地址经纬度数据列表(wgs84坐标系); 示例:"[{ \"lat\":22.567877804561395, \"lon\":114.0477470255907,\"city_id\":1002}, { \"lat\":22.666208176685512, \"lon\":114.0309379237187,\"city_id\":1002}]"
必填
lat
double
纬度; 示例:22.572197643651
必填
lon
double
经度; 示例:114.05432170645
必填
city_id
int
地址所在城市id
必填

响应参数

参数名
类型
描述
必填
ret
int
结果码,示例:0
必填
msg
string
结果描述,示例:
必填
data
object
数据字典
必填
total_price_fen
int
总价(以分为单位)
必填
distance_total
int
总里程,单位米
必填
exceed_distance
int
超里程,单位米
必填
distance_by
int
里程计算方式1:百度,2:高德
必填
order_vehicle_name
string
车型名称,示例:小面包车
必填
order_price_arr
object
总费用计价条目
必填
type
int
计价类型 1-起步价,2-超里程价,3-拉拉券,4-额外需求产生的费用,5-小费,6-规格,7-平台订单补贴,8-额外费用
必填
price_fen
int
计价金额(以分为单位)
必填
pay_status
int
支付状态;0-非在线支付,1-已支付,3-退款中,4-已退款,5-支付中
必填
vehicle_std_price_arr
array
车型附加要求---计价条目
必填
spec_req_price_arr
array
城市额外需求---计价条目
必填
type
int
额外需求ID
必填
name
string
额外需求名称
必填
price_type
int
计价类型(1-固定值计价, 2-百分⽐计价, 3-司机商议,4-免费 )
必填
price_fen
int
计价金额
必填
price_value_fen
int
价格(以分为单位)
必填

request Body请求示例

```json { "access_token":"***********************", "app_key":"****************************", "nonce_str":"7941180883048h5", "timestamp":"1572315580883", "order_vehicle_id":"229", "std_tag_arr":"[]", "spec_req_arr":"[3, 5]", "city_id":"1024", "city_info_revision":"2", "lat_lon_arr":"[{\"lat\":\"41.823051883242\",\"lon\":\"123.342272691723\", \"city_id\":1024},{\"lat":\"41.8170107833461\", \"lon\":\"123.429901803093\", \"city_id\":1024}]" } ```

response响应示例

```json { "ret": 0, "data": { "order_price_arr": [ { "type": 1, "price_fen": 3500, "pay_status": 0 }, { "type": 6, "price_fen": 300, "pay_status": 0 }, { "type": 4, "price_fen": 1900, "pay_status": 0 } ], "spec_req_price_arr": [ { "type": 2, "price_fen": 500, "price_type": 0, "name": "小推车", "price_value_fen": 500 }, { "type": 3, "price_fen": 0, "price_type": 0, "name": "纸质回单", "price_value_fen": 0 }, { "type": 5, "price_fen": 1400, "price_type": 0, "name": "返程", "price_value_fen": 40 } ], "vehicle_std_price_arr": [ { "type": 0, "price_fen": 300, "name": "双排座" } ], "exceed_distance": 0, "distance_total": 1017, "total_price_fen": 5700, "order_vehicle_name": "小型厢货", "distance_by": 1 }, "msg": "Success" } ```

返回状态码

|结果码|描述| |-|-| |0|成功| |1|服务器异常| |1000|传输参数异常| |20002|企业账户信息不存在| |21001|当前城市暂无车型| |21002|车型有变更| |21003|当前城市未开通| |22007|地址信息有错误|