feat: 限制上门距离为500米
This commit is contained in:
parent
e74dcf5ddb
commit
0cd425d055
|
|
@ -197,7 +197,30 @@ const reportOrderException = (orderId) => {
|
|||
|
||||
//完成上门
|
||||
const arrivedOnSite = () => {
|
||||
helpers.jumpToPage('arrived-on-site', 'id=' + id.value)
|
||||
//获取师傅当前位置
|
||||
uni.getLocation({
|
||||
type: 'gcj02',
|
||||
success(res) {
|
||||
let distances = helpers.getDistances(res.latitude, res.longitude, data.value.order_info.lat, data.value.order_info.lng);
|
||||
let msg = `上门失败!距离客户地址超过 500米,当前距离:${distances.distance}${distances.unit}`
|
||||
|
||||
if (distances.unit === '公里') {
|
||||
return helpers.showToast(msg)
|
||||
}
|
||||
|
||||
if (distances.distance > 500) {
|
||||
return helpers.showToast(msg)
|
||||
}
|
||||
|
||||
helpers.jumpToPage('arrived-on-site', 'id=' + id.value)
|
||||
},
|
||||
fail(err) {
|
||||
uni.showToast({
|
||||
title: '请授权位置权限',
|
||||
icon: "error"
|
||||
})
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//完成服务
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user