|
|
|
|
@ -152,7 +152,7 @@
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
|
|
|
|
|
<u-modal v-model="isShowModal" :content="tips" @confirm="isShowModal = false">
|
|
|
|
|
<u-modal v-model="isShowModal" :show-cancel-button="isSignOutConfirm" :content="tips" @confirm="modalConfirm">
|
|
|
|
|
</u-modal>
|
|
|
|
|
|
|
|
|
|
<imgUpload ref="imgUpload" :isShow.sync="isShowImg" :type="type" @confirm="clock"></imgUpload>
|
|
|
|
|
@ -176,7 +176,8 @@
|
|
|
|
|
},
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
tips:"",
|
|
|
|
|
tips: "",
|
|
|
|
|
isSignOutConfirm: false,
|
|
|
|
|
isShowModal: false, //是否超过时间确认
|
|
|
|
|
type: 0, //打卡类型,1签到 2过程打卡 3签退
|
|
|
|
|
isShowImg: false,
|
|
|
|
|
@ -219,6 +220,15 @@
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
modalConfirm () {
|
|
|
|
|
this.isShowModal = false
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (this.isSignOutConfirm) {
|
|
|
|
|
this.signOut()
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
showimg(img) {
|
|
|
|
|
if (img.upload)
|
|
|
|
|
this.$showimg({
|
|
|
|
|
@ -507,6 +517,48 @@
|
|
|
|
|
|
|
|
|
|
//签退前检查
|
|
|
|
|
checkSignOut() {
|
|
|
|
|
//验证打卡次数是否已满
|
|
|
|
|
if (this.detail.logs_count < this.detail.product.process_total) {
|
|
|
|
|
uni.showToast({
|
|
|
|
|
icon: 'none',
|
|
|
|
|
title: `请先完成${this.detail.product.process_total}次打卡,再签退。当前完成打卡次数${this.detail.logs_count}`
|
|
|
|
|
})
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
//验证是否有选择服务项目并填写
|
|
|
|
|
let flag = false
|
|
|
|
|
for (let i of this.skuList) {
|
|
|
|
|
if (i.isSelect && i.form.time) {
|
|
|
|
|
flag = true
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (!flag) {
|
|
|
|
|
uni.showToast({
|
|
|
|
|
icon: 'none',
|
|
|
|
|
title: `请选择并填写服务项目与时间`
|
|
|
|
|
})
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
//判断时间是否超出
|
|
|
|
|
let useTotalTime = 0
|
|
|
|
|
for (let i of this.skuList) {
|
|
|
|
|
if (i.isSelect && i.form.time) {
|
|
|
|
|
useTotalTime += Number(i.form.time)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
let totalTime = this.$moment(new Date()).diff(this.$moment(this.detail.sign_in), 'minutes')
|
|
|
|
|
if (useTotalTime <= (totalTime + 10) && useTotalTime > totalTime && this.detail.demand === 2) {
|
|
|
|
|
uni.showToast({
|
|
|
|
|
icon:'none',
|
|
|
|
|
title:'请下次补足时间',
|
|
|
|
|
duration:2000
|
|
|
|
|
})
|
|
|
|
|
} else if (useTotalTime <= totalTime){
|
|
|
|
|
} else {
|
|
|
|
|
this.tips="当前勾选的时间为"+useTotalTime+"分钟,实际服务时间为"+totalTime+"分钟。系统要求实际服务时间要大于您勾选的时间。";
|
|
|
|
|
this.isShowModal = true
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
uni.getLocation({
|
|
|
|
|
type: 'gcj02',
|
|
|
|
|
isHighAccuracy: true
|
|
|
|
|
@ -515,61 +567,17 @@
|
|
|
|
|
//距离
|
|
|
|
|
const distance = this.getMapDistance([res[1].latitude,res[1].longitude],this.detail.sign_in_loc.split(","))
|
|
|
|
|
console.log('distance',distance)
|
|
|
|
|
if (!distance && distance > 2) {
|
|
|
|
|
uni.showToast({
|
|
|
|
|
icon:'none',
|
|
|
|
|
title:'当前签退位置距离签到位置过远!',
|
|
|
|
|
duration:2000
|
|
|
|
|
})
|
|
|
|
|
if (distance && this.detail.product?.product_type?.max_distance && distance > this.detail.product.product_type.max_distance) {
|
|
|
|
|
this.isSignOutConfirm = true
|
|
|
|
|
this.tips = `当前签退位置距离签到位置超过${this.detail.product.product_type.max_distance}公里,确认要继续签退吗?`
|
|
|
|
|
this.isShowModal = true
|
|
|
|
|
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
//验证打卡次数是否已满
|
|
|
|
|
if (this.detail.logs_count < this.detail.product.process_total) {
|
|
|
|
|
uni.showToast({
|
|
|
|
|
icon: 'none',
|
|
|
|
|
title: `请先完成${this.detail.product.process_total}次打卡,再签退。当前完成打卡次数${this.detail.logs_count}`
|
|
|
|
|
})
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
//验证是否有选择服务项目并填写
|
|
|
|
|
let flag = false
|
|
|
|
|
for (let i of this.skuList) {
|
|
|
|
|
if (i.isSelect && i.form.time) {
|
|
|
|
|
flag = true
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (!flag) {
|
|
|
|
|
uni.showToast({
|
|
|
|
|
icon: 'none',
|
|
|
|
|
title: `请选择并填写服务项目与时间`
|
|
|
|
|
})
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//判断时间是否超出
|
|
|
|
|
let useTotalTime = 0
|
|
|
|
|
for (let i of this.skuList) {
|
|
|
|
|
if (i.isSelect && i.form.time) {
|
|
|
|
|
useTotalTime += Number(i.form.time)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
let totalTime = this.$moment(new Date()).diff(this.$moment(this.detail.sign_in), 'minutes')
|
|
|
|
|
if (useTotalTime <= (totalTime + 10) && useTotalTime > totalTime && this.detail.demand === 2) {
|
|
|
|
|
this.signOut()
|
|
|
|
|
|
|
|
|
|
uni.showToast({
|
|
|
|
|
icon:'none',
|
|
|
|
|
title:'请下次补足时间',
|
|
|
|
|
duration:2000
|
|
|
|
|
})
|
|
|
|
|
} else if (useTotalTime <= totalTime){
|
|
|
|
|
this.signOut()
|
|
|
|
|
} else {
|
|
|
|
|
this.tips="当前勾选的时间为"+useTotalTime+"分钟,实际服务时间为"+totalTime+"分钟。系统要求实际服务时间要大于您勾选的时间。";
|
|
|
|
|
this.isShowModal = true
|
|
|
|
|
}
|
|
|
|
|
this.signOut()
|
|
|
|
|
}
|
|
|
|
|
this.isSignOutConfirm = false
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
//签退
|
|
|
|
|
|