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

1、实时地址

parent 5aec1478
......@@ -123,7 +123,7 @@
<view>
<u-toast ref="uToast" />
</view>
<view v-if="showCenterBtn" @click="$u.throttle(handleBtn, 500)" class="button" :class="['center-button-view', btnClass]">
<view v-if="showCenterBtn" @click="$u.throttle(handleBtn, 500)" class="button" :class="['center-button-view', btnClass]">
<text>{{ centerButtonText }}</text>
<view v-if="order.currentOverTime && showTimeOut" class="time-view">
<text style="padding-right: 8rpx;">{{order.currentOverTime > new Date().getTime()?'剩':'超'}}</text>
......@@ -232,7 +232,8 @@
num:0,
showTimeOut:true,
clicking: false,
dateItem: null
dateItem: null,
centerBtnDisabled:false
}
},
onLoad(option) {
......@@ -245,6 +246,11 @@
this.getLocation()
this.getSignDistance()
},
onHide() {
this.closeLocationChange()
},onUnload() {
this.closeLocationChange()
},
computed: {
phoneIcon() {
......@@ -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){ // 联系客户
if(this.isAllowDianhuaAndDaohang){
uni.makePhoneCall({
......@@ -515,7 +547,8 @@
this.submitType = "maintainWorkerCheckin"
this.isAllowDianhuaAndDaohang = true
this.errorSignIn = true
this.addressToCoordinate()
// this.addressToCoordinate()
this.updateLocation()
} else if (orderStatus > 31 && orderStatus < 80) {
// 完工
this.centerButton = "filish"
......@@ -554,9 +587,15 @@
}
data.appointmentDatetimeRange = this.appointmentDatetimeRange.pkey
}else if (this.submitType === 'maintainWorkerCheckin') { // 签到
// 检查见到距离是否符合
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')
return
}
......@@ -603,13 +642,14 @@
}
})
} else {
let self = this
this.$refs.uToast.show({
title: res.data.message!==undefined ? res.data.message:res.message,
// 如果不传此type参数,默认为default,也可以手动写上 type: 'default'
type: 'warning',
callback: function() {
this.clicking = false
res.data.message==='抱歉,手快的师傅已经抢到此单!'?this.isGan():''
res.data.message==='抱歉,手快的师傅已经抢到此单!'?self.isGan():''
}
})
}
......@@ -720,7 +760,7 @@
var nowTime = new Date(); // 当前时间
if(currentOverTime && nowTime.getTime() > currentOverTime){
this.btnClass='timeOut-btn'
self.$refs['uCountDown'].seconds += 2
this.$refs['uCountDown'].seconds += 2
}
},
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