敬告:此 DEMO 演示为开放测试页面,仅用于开发者快速测试体验应用功能,请严格遵守开发者协议,了解更多。
♦ JS-SDK 引用方式:
♦ 普通网页 script 方式加载:下载最新版 jsBridge-v20251019.zip,请在页面上调用 jsBridge 接口之前引用 jsbridge-mini.js 库;
♦ js module 方式引用:npm install ym-jsbridge 具体请参考 npm package
♦ 模型(Model) 结构与 SDK Model 定义一致,参数含义及约束规则请参考官方文档。
//返回百度经纬度坐标 bd09ll
jsBridge.freight.location(function(succ, res) {
if (res.success) {
//定位成功,在本页面底部显示 res
//请根据 定位错误返回码 res.locType 使用位置数据
//当 61 卫星定位结果,66 离线定位结果,161 网络定位结果 时才成功
showResult(res);
} else {
alert(res.message);
}
});
enterpriseCode:
appIdentity:
appKey:
driverIdentity:
jsBridge.freight.register({
//企业代码
enterpriseCode: "{{register.enterpriseCode}}",
//企业app的身份码
appIdentity: "{{register.appIdentity}}",
//企业app验证码
appKey: "{{register.appKey}}",
//司机身份证号
driverIdentity: "{{register.driverIdentity}}"
}, function(succ, res) {
alert(succ ? '成功' : '失败\n' + JSON.stringify(res));
});
shipmentCode:
location.baiduLongitude:
location.baiduLatitude:
location.location:
location.time:
location.altitude:
location.speed:
location.direction:
jsBridge.freight.pickup({
//运单号
shipmentCode: "{{shipmentCode}}",
//位置信息
location: {
//Baidu定位经度
baiduLongitude: {{location.baiduLongitude}},
//Baidu定位纬度
baiduLatitude: {{location.baiduLatitude}},
//经纬度转化来的具体位置
location: "{{location.location}}",
//操作时间,格式:yyyy-MM-ddTHH:mm:ss
time: "{{location.time}}",
//海拔,选填
altitude: {{location.altitude}},
//速度,选填
speed: {{location.speed}},
//⽅向,选填
direction: {{location.direction}}
}
}, function(succ, res) {
alert(succ ? '成功' : '失败\n' + JSON.stringify(res));
});
shipmentCode:
location.baiduLongitude:
location.baiduLatitude:
location.location:
location.time:
location.altitude:
location.speed:
location.direction:
jsBridge.freight.unload({
//运单号
shipmentCode: "{{shipmentCode}}",
//位置信息
location: {
//Baidu定位经度
baiduLongitude: {{location.baiduLongitude}},
//Baidu定位纬度
baiduLatitude: {{location.baiduLatitude}},
//经纬度转化来的具体位置
location: "{{location.location}}",
//操作时间,格式:yyyy-MM-ddTHH:mm:ss
time: "{{location.time}}",
//海拔,选填
altitude: {{location.altitude}},
//速度,选填
speed: {{location.speed}},
//⽅向,选填
direction: {{location.direction}}
}
}, function(succ, res) {
alert(succ ? '成功' : '失败\n' + JSON.stringify(res));
});
shipmentCode:
location.baiduLongitude:
location.baiduLatitude:
location.location:
location.time:
location.altitude:
location.speed:
location.direction:
jsBridge.freight.sign({
//运单号
shipmentCode: "{{shipmentCode}}",
//位置信息
location: {
//Baidu定位经度
baiduLongitude: {{location.baiduLongitude}},
//Baidu定位纬度
baiduLatitude: {{location.baiduLatitude}},
//经纬度转化来的具体位置
location: "{{location.location}}",
//操作时间,格式:yyyy-MM-ddTHH:mm:ss
time: "{{location.time}}",
//海拔,选填
altitude: {{location.altitude}},
//速度,选填
speed: {{location.speed}},
//⽅向,选填
direction: {{location.direction}}
},
//货物清单(数组)
goodsList: [
{
//货品编号
itemNo: 11223344,
//货品名称
goodsName: "某某某",
//货品应收数量
quantity: 100,
//货品实收数量
receivedQuantity: 100,
//货品破损数量
damageQuantity: 0,
//货品丢失数量
lostQuantity: 0,
//货品单位
unit: "箱"
}
//,{ }
]
}, function(succ, res) {
alert(succ ? '成功' : '失败\n' + JSON.stringify(res));
});
shipmentCode:
location.baiduLongitude:
location.baiduLatitude:
location.location:
location.time:
location.altitude:
location.speed:
location.direction:
jsBridge.freight.pod({
//运单号
shipmentCode: "{{shipmentCode}}",
//位置信息
location: {
//Baidu定位经度
baiduLongitude: {{location.baiduLongitude}},
//Baidu定位纬度
baiduLatitude: {{location.baiduLatitude}},
//经纬度转化来的具体位置
location: "{{location.location}}",
//操作时间,格式:yyyy-MM-ddTHH:mm:ss
time: "{{location.time}}",
//海拔,选填
altitude: {{location.altitude}},
//速度,选填
speed: {{location.speed}},
//⽅向,选填
direction: {{location.direction}}
}
}, function(succ, res) {
alert(succ ? '成功' : '失败\n' + JSON.stringify(res));
});
shipmentCode:
location.baiduLongitude:
location.baiduLatitude:
location.location:
location.time:
location.altitude:
location.speed:
location.direction:
image.fileName:
image.fileData:
image.fileExt:
image.imageTakenDate:
jsBridge.freight.uploadPickupImage({
//运单号
shipmentCode: "{{shipmentCode}}",
//图⽚信息
image: {
//Baidu定位经度
baiduLongitude: {{location.baiduLongitude}},
//Baidu定位纬度
baiduLatitude: {{location.baiduLatitude}},
//经纬度转化来的具体位置
location: "{{location.location}}",
//操作时间,格式:yyyy-MM-ddTHH:mm:ss
time: "{{location.time}}",
//海拔,选填
altitude: {{location.altitude}},
//速度,选填
speed: {{location.speed}},
//⽅向,选填
direction: {{location.direction}},
//⽂件名
fileName: "{{image.fileName}}",
//建议压缩图片,不要太大
//⽂件数据(base64格式),数据格式:data:image/{file ext};base64,{file data base64}
fileData: "{{image.fileData}}",
//照⽚格式
fileExt: "{{image.fileExt}}",
//拍照时间
imageTakenDate: "{{image.imageTakenDate}}"
}
}, function(succ, res) {
alert(succ ? '成功' : '失败\n' + JSON.stringify(res));
});
shipmentCode:
location.baiduLongitude:
location.baiduLatitude:
location.location:
location.time:
location.altitude:
location.speed:
location.direction:
image.fileName:
image.fileData:
image.fileExt:
image.imageTakenDate:
jsBridge.freight.uploadUnloadImage({
//运单号
shipmentCode: "{{shipmentCode}}",
//图⽚信息
image: {
//Baidu定位经度
baiduLongitude: {{location.baiduLongitude}},
//Baidu定位纬度
baiduLatitude: {{location.baiduLatitude}},
//经纬度转化来的具体位置
location: "{{location.location}}",
//操作时间,格式:yyyy-MM-ddTHH:mm:ss
time: "{{location.time}}",
//海拔,选填
altitude: {{location.altitude}},
//速度,选填
speed: {{location.speed}},
//⽅向,选填
direction: {{location.direction}},
//⽂件名
fileName: "{{image.fileName}}",
//建议压缩图片,不要太大
//⽂件数据(base64格式),数据格式:data:image/{file ext};base64,{file data base64}
fileData: "{{image.fileData}}",
//照⽚格式
fileExt: "{{image.fileExt}}",
//拍照时间
imageTakenDate: "{{image.imageTakenDate}}"
}
}, function(succ, res) {
alert(succ ? '成功' : '失败\n' + JSON.stringify(res));
});
shipmentCode:
location.baiduLongitude:
location.baiduLatitude:
location.location:
location.time:
location.altitude:
location.speed:
location.direction:
image.fileName:
image.fileData:
image.fileExt:
image.imageTakenDate:
jsBridge.freight.uploadPODImage({
//运单号
shipmentCode: "{{shipmentCode}}",
//图⽚信息
image: {
//Baidu定位经度
baiduLongitude: {{location.baiduLongitude}},
//Baidu定位纬度
baiduLatitude: {{location.baiduLatitude}},
//经纬度转化来的具体位置
location: "{{location.location}}",
//操作时间,格式:yyyy-MM-ddTHH:mm:ss
time: "{{location.time}}",
//海拔,选填
altitude: {{location.altitude}},
//速度,选填
speed: {{location.speed}},
//⽅向,选填
direction: {{location.direction}},
//⽂件名
fileName: "{{image.fileName}}",
//建议压缩图片,不要太大
//⽂件数据(base64格式),数据格式:data:image/{file ext};base64,{file data base64}
fileData: "{{image.fileData}}",
//照⽚格式
fileExt: "{{image.fileExt}}",
//拍照时间
imageTakenDate: "{{image.imageTakenDate}}"
}
}, function(succ, res) {
alert(succ ? '成功' : '失败\n' + JSON.stringify(res));
});
shipmentCode:
jsBridge.freight.getPickupImageNames({
//运单号
shipmentCode: "{{shipmentCode}}"
}, function(succ, res) {
if (succ) {
//在本页面底部显示 res
showResult(res);
} else {
alert('失败\n' + JSON.stringify(res));
}
});
shipmentCode:
jsBridge.freight.getUnloadImageNames({
//运单号
shipmentCode: "{{shipmentCode}}"
}, function(succ, res) {
if (succ) {
//在本页面底部显示 res
showResult(res);
} else {
alert('失败\n' + JSON.stringify(res));
}
});
shipmentCode:
jsBridge.freight.getPODImageNames({
//运单号
shipmentCode: "{{shipmentCode}}"
}, function(succ, res) {
if (succ) {
//在本页面底部显示 res
showResult(res);
} else {
alert('失败\n' + JSON.stringify(res));
}
});
shipmentCode:
imageName:
imageExt:
jsBridge.freight.deletePickupImage({
//运单号
shipmentCode: "{{shipmentCode}}",
//图片名称
imageName: "{{imageName}}",
//图片类型
imageExt: "{{imageExt}}"
}, function(succ, res) {
alert(succ ? '成功' : '失败\n' + JSON.stringify(res));
});
shipmentCode:
imageName:
imageExt:
jsBridge.freight.deleteUnloadImage({
//运单号
shipmentCode: "{{shipmentCode}}",
//图片名称
imageName: "{{imageName}}",
//图片类型
imageExt: "{{imageExt}}"
}, function(succ, res) {
alert(succ ? '成功' : '失败\n' + JSON.stringify(res));
});
shipmentCode:
imageName:
imageExt:
jsBridge.freight.deletePODImage({
//运单号
shipmentCode: "{{shipmentCode}}",
//图片名称
imageName: "{{imageName}}",
//图片类型
imageExt: "{{imageExt}}"
}, function(succ, res) {
alert(succ ? '成功' : '失败\n' + JSON.stringify(res));
});
shipmentCode:
imageName:
imageExt:
jsBridge.freight.downloadPickupImage({
//运单号
shipmentCode: "{{shipmentCode}}",
//图片名称
imageName: "{{imageName}}",
//图片类型
imageExt: "{{imageExt}}"
}, function(succ, res) {
if (succ) {
//在本页面底部显示 res
showResult(res);
} else {
alert('失败\n' + JSON.stringify(res));
}
});
shipmentCode:
imageName:
imageExt:
jsBridge.freight.downloadUnloadImage({
//运单号
shipmentCode: "{{shipmentCode}}",
//图片名称
imageName: "{{imageName}}",
//图片类型
imageExt: "{{imageExt}}"
}, function(succ, res) {
if (succ) {
//在本页面底部显示 res
showResult(res);
} else {
alert('失败\n' + JSON.stringify(res));
}
});
shipmentCode:
imageName:
imageExt:
jsBridge.freight.downloadPODImage({
//运单号
shipmentCode: "{{shipmentCode}}",
//图片名称
imageName: "{{imageName}}",
//图片类型
imageExt: "{{imageExt}}"
}, function(succ, res) {
if (succ) {
//在本页面底部显示 res
showResult(res);
} else {
alert('失败\n' + JSON.stringify(res));
}
});
pageSize:
currentPage:
jsBridge.freight.getInvoices({
//分页大小
pageSize: {{pageSize}},
//当前页次
currentPage: {{currentPage}}
}, function(succ, res) {
if (succ) {
//在本页面底部显示 res
showResult(res);
} else {
alert('失败\n' + JSON.stringify(res));
}
});
driverInvoiceCode:
jsBridge.freight.confirmInvoice({
//司机发票编号
driverInvoiceCode: "{{driverInvoiceCode}}"
}, function(succ, res) {
alert(succ ? '成功' : '失败\n' + JSON.stringify(res));
});
shipmentCode:
jsBridge.freight.getShipmentStatus({
//运单号
shipmentCode: "{{shipmentCode}}"
}, function(succ, res) {
if (succ) {
alert(res.status)
} else {
alert('失败\n' + JSON.stringify(res));
}
});
监听回调数据: