Commit a84bad3e authored by 郭晓清's avatar 郭晓清

1、实时地址

parent 5aec1478
...@@ -232,7 +232,8 @@ ...@@ -232,7 +232,8 @@
num:0, num:0,
showTimeOut:true, showTimeOut:true,
clicking: false, clicking: false,
dateItem: null dateItem: null,
centerBtnDisabled:false
} }
}, },
onLoad(option) { onLoad(option) {
...@@ -245,6 +246,11 @@ ...@@ -245,6 +246,11 @@
this.getLocation() this.getLocation()
this.getSignDistance() this.getSignDistance()
}, },
onHide() {
this.closeLocationChange()
},onUnload() {
this.closeLocationChange()
},
computed: { computed: {
phoneIcon() { phoneIcon() {
...@@ -301,6 +307,32 @@ ...@@ -301,6 +307,32 @@
}); });
} }
}, },
updateLocation(){
let self = this
wx.startLocationUpdate({
success:function(){
self.openLocationChange()
}
})
},
_locationChangeFn(res) {
console.log('location change', res)
if(this.getDistance(res.latitude,res.longitude)>this.signDistance){
// 计算签到距离
this.btnClass = "isGan-btn"
this.centerBtnDisabled = false
}else{
this.centerBtnDisabled = true
}
},
openLocationChange(){
console.log("openLocationChange")
wx.onLocationChange(this._locationChangeFn);
},
closeLocationChange(){
console.log("closeLocationChange")
wx.offLocationChange(this._locationChangeFn);
},
phoneToCustomer(phone){ // 联系客户 phoneToCustomer(phone){ // 联系客户
if(this.isAllowDianhuaAndDaohang){ if(this.isAllowDianhuaAndDaohang){
uni.makePhoneCall({ uni.makePhoneCall({
...@@ -515,7 +547,8 @@ ...@@ -515,7 +547,8 @@
this.submitType = "maintainWorkerCheckin" this.submitType = "maintainWorkerCheckin"
this.isAllowDianhuaAndDaohang = true this.isAllowDianhuaAndDaohang = true
this.errorSignIn = true this.errorSignIn = true
this.addressToCoordinate() // this.addressToCoordinate()
this.updateLocation()
} else if (orderStatus > 31 && orderStatus < 80) { } else if (orderStatus > 31 && orderStatus < 80) {
// 完工 // 完工
this.centerButton = "filish" this.centerButton = "filish"
...@@ -554,9 +587,15 @@ ...@@ -554,9 +587,15 @@
} }
data.appointmentDatetimeRange = this.appointmentDatetimeRange.pkey data.appointmentDatetimeRange = this.appointmentDatetimeRange.pkey
}else if (this.submitType === 'maintainWorkerCheckin') { // 签到 }else if (this.submitType === 'maintainWorkerCheckin') { // 签到
// 检查见到距离是否符合 // 检查见到距离是否符合
if(!this.isErrorSign){ if(!this.isErrorSign){
if(this.getDistance(this.contactAddressLatitud,this.contactAddressLongitud)>this.signDistance){ if(!this.centerBtnDisabled){
return
}else{
this.closeLocationChange()
}
if(this.getDistance(this.order.contactAddressLatitud,this.order.contactAddressLongitud)>this.signDistance){
this.commonToast('签到失败,请点击异常签到处理或联系客服','error') this.commonToast('签到失败,请点击异常签到处理或联系客服','error')
return return
} }
...@@ -603,13 +642,14 @@ ...@@ -603,13 +642,14 @@
} }
}) })
} else { } else {
let self = this
this.$refs.uToast.show({ this.$refs.uToast.show({
title: res.data.message!==undefined ? res.data.message:res.message, title: res.data.message!==undefined ? res.data.message:res.message,
// 如果不传此type参数,默认为default,也可以手动写上 type: 'default' // 如果不传此type参数,默认为default,也可以手动写上 type: 'default'
type: 'warning', type: 'warning',
callback: function() { callback: function() {
this.clicking = false this.clicking = false
res.data.message==='抱歉,手快的师傅已经抢到此单!'?this.isGan():'' res.data.message==='抱歉,手快的师傅已经抢到此单!'?self.isGan():''
} }
}) })
} }
...@@ -720,7 +760,7 @@ ...@@ -720,7 +760,7 @@
var nowTime = new Date(); // 当前时间 var nowTime = new Date(); // 当前时间
if(currentOverTime && nowTime.getTime() > currentOverTime){ if(currentOverTime && nowTime.getTime() > currentOverTime){
this.btnClass='timeOut-btn' this.btnClass='timeOut-btn'
self.$refs['uCountDown'].seconds += 2 this.$refs['uCountDown'].seconds += 2
} }
}, },
handleClick(){ handleClick(){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment