xy 2 years ago
parent 7436b7c576
commit f15c01a59a

@ -152,7 +152,7 @@
</view> </view>
</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> </u-modal>
<imgUpload ref="imgUpload" :isShow.sync="isShowImg" :type="type" @confirm="clock"></imgUpload> <imgUpload ref="imgUpload" :isShow.sync="isShowImg" :type="type" @confirm="clock"></imgUpload>
@ -176,7 +176,8 @@
}, },
data() { data() {
return { return {
tips:"", tips: "",
isSignOutConfirm: false,
isShowModal: false, // isShowModal: false, //
type: 0, //,1 2 3退 type: 0, //,1 2 3退
isShowImg: false, isShowImg: false,
@ -219,6 +220,15 @@
} }
}, },
methods: { methods: {
modalConfirm () {
this.isShowModal = false
if (this.isSignOutConfirm) {
this.signOut()
}
},
showimg(img) { showimg(img) {
if (img.upload) if (img.upload)
this.$showimg({ this.$showimg({
@ -507,6 +517,48 @@
//退 //退
checkSignOut() { 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({ uni.getLocation({
type: 'gcj02', type: 'gcj02',
isHighAccuracy: true isHighAccuracy: true
@ -515,61 +567,17 @@
// //
const distance = this.getMapDistance([res[1].latitude,res[1].longitude],this.detail.sign_in_loc.split(",")) const distance = this.getMapDistance([res[1].latitude,res[1].longitude],this.detail.sign_in_loc.split(","))
console.log('distance',distance) console.log('distance',distance)
if (!distance && distance > 2) { if (distance && this.detail.product?.product_type?.max_distance && distance > this.detail.product.product_type.max_distance) {
uni.showToast({ this.isSignOutConfirm = true
icon:'none', this.tips = `当前签退位置距离签到位置超过${this.detail.product.product_type.max_distance}公里,确认要继续签退吗?`
title:'当前签退位置距离签到位置过远!', this.isShowModal = true
duration:2000
})
return 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
}
// this.signOut()
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.isSignOutConfirm = false
}) })
}, },
//退 //退

Loading…
Cancel
Save