Commit 2be5a020 authored by 郭晓清's avatar 郭晓清

1、异常签到问题修复-自营平台高级bug问题修复

parent cefaedc8
......@@ -120,6 +120,13 @@ let orderApiFun = function(vm){
*/
let outOrderFinish = async (params = {},orderId) => await vm.$u.post(prefix + vm.vuex_token+'/order/'+ orderId +'/v1/finishedAndConfirmOutGuaranteePeriod', params, {'content-type': 'application/x-www-form-urlencoded'});
/**
* 获取工单联系人经纬度
*/
let addressToCoordinate= async (orderId) => await vm.$u.get(prefix+'order/specialfee/'+ vm.vuex_token +'/address/coordinate/'+orderId);
const orderApi = {
listByRecommendOrder,
listOrderCount,
......@@ -145,7 +152,8 @@ let orderApiFun = function(vm){
getMeasure,
saveCompleteData,
inOrderFinish,
outOrderFinish
outOrderFinish,
addressToCoordinate
}
return orderApi
}
......
......@@ -55,6 +55,7 @@
<text class="cell-title">充电桩信息:</text>
<text>{{ order.serviceContent }}</text>
</view>
<!-- <view class="order-cell between-cell">
<!-- <view class="order-cell between-cell">
<text>备注:</text>
......@@ -142,6 +143,7 @@
<view class="right">
<view v-if="errorSignIn || scenePhoto" @click="$u.debounce(handleClickRight, 500)" :class="['button', {'active': scenePhoto}]">
<text>{{errorSignIn ? '异常签到' : '现场拍照'}}</text>
</view>
</view>
</view>
......@@ -155,6 +157,11 @@
import takePhoto from '@/components/take/index.vue'
import PopView from "@/components/popView/index.vue"
let now = Date.now()
let r = require("../../libs/bmap-wx.min.js");
let h = new r.BMapWX({
// ak: "rpVq5d3yxaRCoKzVwmFMo0o4iC524CAG",
ak: "lF1HoyXdiv4uZx6TrGQEZs48F5y8kEHI"
});
export default {
components: {
appointTime,
......@@ -218,7 +225,16 @@
appointmentDatetimeRange:'',
appointmentDatetime:'',
signDistance:3000,
contactAddressLongitud:0,
contactAddressLatitud:0,
num:0,
waterInfo: {
longitude: '', // 经度
latitude: '', // 维度
address: '', //地址
date: '', //日期
markImage: 'https://qn-static.banshouhui.com/live_mark.png'
}
}
},
onLoad(option) {
......@@ -233,6 +249,7 @@
this.getSignDistance()
},
computed: {
phoneIcon() {
//self-support/icon/dianhua-0@2x.png
if(this.isAllowDianhuaAndDaohang){
......@@ -262,6 +279,31 @@
}
},
methods: {
baiduLocation() {
// 百度sdk解析经纬度
let waterInfo = this.waterInfo
const t = function() {
let t = {
success: function(res) {
let e = res.wxMarkerData[0];
let i = e.address;
waterInfo.address = i
},
fail: function(err) {
console.log(err, 'err')
}
};
if (waterInfo.latitude && waterInfo.longitude) {
let e = waterInfo.latitude + "," + waterInfo.longitude;
t.location = e;
}
if(waterInfo.address){
t.address = waterInfo.address
}
h.geocoding(t);
};
t()
},
openLocation(){
if(this.isAllowDianhuaAndDaohang){
uni.getLocation({
......@@ -319,7 +361,6 @@
this.takeStatus = false
// 获取返回的图片 ,如果返回的图片存在则直接异常签约,成功后跳转到去完工页面,
if(img){ // 拍照完成
this.isErrorSign = true
this.errorSignUrl = process.uniEnv.qn_asset_url +img[img.length-1].key
this.handleBtn()
......@@ -426,7 +467,22 @@
console.log(data,'timeChange')
this.appointmentDatetimeRange = data.item
},
addressToCoordinate(){
let self = this
self.$u.api.addressToCoordinate(self.orderId).then((res) => {
if (res.code == 200) {
self.contactAddressLongitud=res.data.lng
self.contactAddressLatitud = res.data.lat
} else {
console.log(res.message);
}
})
},
getCurrentBtn() {
// this.waterInfo.address=this.order.contactProvinceText+this.order.contactCityText
// +this.order.contactCommunityText
// //+this.order.contactStreetText
// this.baiduLocation()
// 根据工单状态确定按钮的显示
var orderStatus = this.order.orderStatus
// 业务类型 指派单/订单池
......@@ -460,7 +516,9 @@
this.allowFeedback = true
this.showCenterBtn = true
this.submitType = "maintainWorkerCheckin"
this.isAllowDianhuaAndDaohang = true
this.errorSignIn = true
this.addressToCoordinate()
} else if (orderStatus > 31 && orderStatus < 80) {
// 完工
this.centerButton = "filish"
......@@ -469,7 +527,7 @@
this.allowFeedback = true
this.showCenterBtn = true
this.scenePhoto = true
this.isAllowDianhuaAndDaohang = true
} else {}
},
handleBtn() {
......@@ -496,7 +554,7 @@
}else if (this.submitType === 'maintainWorkerCheckin') { // 签到
// 检查见到距离是否符合
if(!this.isErrorSign){
if(this.getDistance(this.order.contactAddressLatitud,this.order.contactAddressLongitud)>3){
if(this.getDistance(this.contactAddressLatitud,this.contactAddressLongitud)>this.signDistance){
this.commonToast('签到失败,请点击异常签到处理或联系客服','error')
return
}
......@@ -523,8 +581,8 @@
this.$refs.uToast.show({
title: res.data.message!==undefined ? res.data.message:res.message,
// 如果不传此type参数,默认为default,也可以手动写上 type: 'default'
type: 'error',
callback: res.data.message==='该工单已被抢'?this.isGan():''
type: 'warning',
callback: res.data.message==='抱歉,手快的师傅已经抢到此单!'?this.isGan():''
})
}
})
......@@ -561,10 +619,14 @@
// 检查是否可以拒单
var data={}
this.$u.api.checkRejectable(data).then(res => {
if (res.data.code === 200 && res.data.data === true) {
uni.navigateTo({
url: 'pages/order/refuse?orderId='+this.order.orderId
})
if (res.data.code === 200 ) {
if( res.data.data === true){
uni.navigateTo({
url: 'pages/order/refuse?orderId='+this.order.orderId
})
}else{
this.commonToast("本月无拒单机会,请联系客服","warning")
}
}
})
},
......@@ -588,7 +650,7 @@
});
},
getDistance(Latitud, Longitud){
return this.distance(Latitud,Longitud,this.dataValue[0],this.dataValue[1])
return this.distance(Latitud,Longitud,this.dataValue[1],this.dataValue[0])
},
/**
* echo distance(116.3896,39.91917,116.3940,39.91726);
......@@ -599,16 +661,21 @@
* @param float $lat2 维度
* @return float 浮点数
*/
distance(la1, lo1, la2, lo2) {
var La1 = la1 * Math.PI / 180.0;
var La2 = la2 * Math.PI / 180.0;
var La3 = La1 - La2;
var Lb3 = lo1 * Math.PI / 180.0 - lo2 * Math.PI / 180.0;
var s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(La3 / 2), 2),Math.cos(La1) * Math.cos(La2) * Math.pow(Math.sin(Lb3 / 2), 2)));
s = s * 6378.137;//地球半径
s = Math.round(s * 10000) / 10000;
console.log("计算结果",s,'KM');
return s?s.toFixed(2):0;
distance(lat1, lng1, lat2, lng2) {
console.log(lat1, lng1, lat2, lng2)
var radLat1 = this.Rad(lat1);
var radLat2 = this.Rad(lat2);
var a = radLat1 - radLat2;
var b = this.Rad(lng1) - this.Rad(lng2);
var s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a/2),2) +
Math.cos(radLat1)*Math.cos(radLat2)*Math.pow(Math.sin(b/2),2)));
s = s *6378.137 ;// EARTH_RADIUS;
s = Math.round(s * 10000)/10 ; //输出为米
console.log("计算结果",s,'M');
return s?s.toFixed(2):0;
},
Rad(d){
return d * Math.PI / 180.0;//经纬度转换成三角函数中度分表形式。
},
timestampDiff(currentOverTime){ // 计算超时时间
if(!currentOverTime){
......
......@@ -267,7 +267,7 @@
const photo = getApp().globalData.photo
photo.currentItem = item
photo.itemIndex = ikey
const len = item.orderImages.length
const len = item.orderImages?item.orderImages.length:0
photo.currentItemLength = len > 9 ? 10 : len
uni.hideTabBar()
......
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