|
@@ -131,7 +131,7 @@
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
- firstAuthentication:{},
|
|
|
+ firstAuthentication: {},
|
|
|
cyId: '',
|
|
|
localtion: {
|
|
|
city: '',
|
|
@@ -206,9 +206,9 @@
|
|
|
var isAgree = true; //隐私权政策是否取得用户同意 true是用户同意
|
|
|
sdkwx.updatePrivacyAgree(isAgree);
|
|
|
//检查定位权限
|
|
|
- sdkwx.checkLocationPermission(function(res) {
|
|
|
- console.log(res);
|
|
|
- });
|
|
|
+ // sdkwx.checkLocationPermission(function(res) {
|
|
|
+ // console.log(res);
|
|
|
+ // });
|
|
|
this.auth()
|
|
|
},
|
|
|
onHide() {
|
|
@@ -229,7 +229,8 @@
|
|
|
},
|
|
|
methods: {
|
|
|
auth() { //授权
|
|
|
- console.log("appid:" + this.appId + "安全码:" + this.appSecurity + "发送代码:" + this.enterpriseSenderCode+"环境"+this.environment)
|
|
|
+ console.log("appid:" + this.appId + "安全码:" + this.appSecurity + "发送代码:" + this.enterpriseSenderCode +
|
|
|
+ "环境" + this.environment)
|
|
|
var that = this
|
|
|
sdkwx.auth(this.appId, this.appSecurity, this.enterpriseSenderCode, this.environment, function(res) {
|
|
|
if (res.type == "onSuccess") {
|
|
@@ -242,7 +243,7 @@
|
|
|
var errorMsg = res.data.errorMsg; //错误描述
|
|
|
that.$refs.uToast.show({
|
|
|
type: 'error',
|
|
|
- message: "管局授权失败-"+errorMsg
|
|
|
+ message: "管局授权失败-" + errorMsg
|
|
|
})
|
|
|
console.log("授权失败")
|
|
|
console.log(res)
|
|
@@ -250,7 +251,7 @@
|
|
|
});
|
|
|
},
|
|
|
start(val) { //开启定位
|
|
|
- var that = this
|
|
|
+ var that = this
|
|
|
//车牌号 //司机姓名 //备注 //运单信息列表
|
|
|
this.shippingNoteInfos[0].shippingNoteNumber = this.detailData.orderNo //运单号
|
|
|
this.shippingNoteInfos[0].serialNumber = "0000" //分单号
|
|
@@ -295,7 +296,7 @@
|
|
|
console.log("开始定时", dateTtime)
|
|
|
that.send()
|
|
|
}
|
|
|
- that.affirm(val)//管局上报成功后提交
|
|
|
+ that.affirm(val) //管局上报成功后提交
|
|
|
} else if (res.type == "onFailure") {
|
|
|
//失败
|
|
|
console.log("开启定位失败!!!")
|
|
@@ -305,7 +306,7 @@
|
|
|
uni.hideLoading()
|
|
|
that.$refs.uToast.show({
|
|
|
type: 'error',
|
|
|
- message: "管局上报-"+errorMsg
|
|
|
+ message: "管局上报-" + errorMsg
|
|
|
})
|
|
|
that.timer = setTimeout(() => {
|
|
|
console.log("定时")
|
|
@@ -367,7 +368,7 @@
|
|
|
this.detailData.transportationDuration = res.data.hyCarrierInfo.transportationDuration
|
|
|
}
|
|
|
// #ifdef APP-PLUS
|
|
|
- this.getLngLat();
|
|
|
+ // this.getLngLat();
|
|
|
// #endif
|
|
|
this.$request.baseRequest('get', '/carrierInfo/getHyCarrierInfo', {
|
|
|
orderId: this.detailData.id,
|
|
@@ -736,142 +737,172 @@
|
|
|
return true
|
|
|
}
|
|
|
},
|
|
|
- affirm(data){
|
|
|
- console.log("提交",data)
|
|
|
+ affirm(data) {
|
|
|
+ console.log("提交", data)
|
|
|
var that = this
|
|
|
this.$request.baseRequest('post', '/carrierInfo/loadingAdd', data).then(res => {
|
|
|
- console.log("提交状态",res)
|
|
|
+ console.log("提交状态", res)
|
|
|
uni.hideLoading()
|
|
|
- if (res.code == 200) {
|
|
|
- let _title = ''
|
|
|
- if (that.detailData.statusFlag == 1) {
|
|
|
- _title = '暂存成功!'
|
|
|
- return
|
|
|
- } else {
|
|
|
- // that.start() //开始授权并开始定位
|
|
|
- _title = '提交成功!'
|
|
|
- }
|
|
|
- that.$helper.fUN_AmapLocation.start({
|
|
|
- // intervalTime: 1000 * 60,
|
|
|
- intervalTime: 60000,
|
|
|
- // locationCacheEnable:true,
|
|
|
- isReport: false
|
|
|
- },
|
|
|
- res => {
|
|
|
- // console.log('====确认装车开启连续定位====');
|
|
|
- // console.log(res)
|
|
|
- let _data = {
|
|
|
- orderId: that.id,
|
|
|
- longitude: res.longitude,
|
|
|
- latitude: res.latitude,
|
|
|
- province: res.province,
|
|
|
- city: res.city,
|
|
|
- area: res.district
|
|
|
- }
|
|
|
- if (this.shippingNoteInfos && this.shippingNoteInfos.length > 0) { //更新持续定位经纬度
|
|
|
- for (let i = 0; i < this.shippingNoteInfos.length; i++) {
|
|
|
- this.shippingNoteInfos[i].startLatitude = _data.latitude //纬度
|
|
|
- this.shippingNoteInfos[i].startLocationText = _data.city //起点
|
|
|
- this.shippingNoteInfos[i].startLongitude = _data.longitude //经度
|
|
|
- }
|
|
|
- }
|
|
|
- this.$helper.gjList.push(_data)
|
|
|
- uni.setStorageSync('mapGJ', this.$helper.gjList);
|
|
|
- // console.log('this.$helper.gjList')
|
|
|
- // console.log(this.$helper.gjList)
|
|
|
- console.log("条数", uni.getStorageSync('mapGJ').length)
|
|
|
- // console.log("条数", uni.getStorageSync('mapGJ'))
|
|
|
- if (uni.getStorageSync('mapGJ').length > 100) {
|
|
|
- // console.log(JSON.stringify(uni.getStorageSync('mapGJ')))
|
|
|
- // that.send()
|
|
|
- that.$request.baseRequest('post', '/hyOrderTravelPath/api/addInfo', {
|
|
|
- orderId: that.id,
|
|
|
- longitudeLatitude: JSON.stringify(uni.getStorageSync('mapGJ'))
|
|
|
- }).then(res => {
|
|
|
- console.log("已发送定位----------------", res)
|
|
|
- uni.removeStorageSync('mapGJ');
|
|
|
- that.$helper.gjList = []
|
|
|
- })
|
|
|
- .catch(res => {
|
|
|
- console.log("0",res.message)
|
|
|
- uni.$u.toast(res.message);
|
|
|
- });
|
|
|
+ if (res.code == 200) {
|
|
|
+ let _title = ''
|
|
|
+ if (that.detailData.statusFlag == 1) {
|
|
|
+ _title = '暂存成功!'
|
|
|
+ return
|
|
|
+ } else {
|
|
|
+ // that.start() //开始授权并开始定位
|
|
|
+ _title = '提交成功!'
|
|
|
+ }
|
|
|
+ that.$helper.fUN_AmapLocation.start({
|
|
|
+ // intervalTime: 1000 * 60,
|
|
|
+ intervalTime: 60000,
|
|
|
+ // locationCacheEnable:true,
|
|
|
+ isReport: false
|
|
|
+ },
|
|
|
+ res => {
|
|
|
+ // console.log('====确认装车开启连续定位====');
|
|
|
+ // console.log(res)
|
|
|
+ let _data = {
|
|
|
+ orderId: that.id,
|
|
|
+ longitude: res.longitude,
|
|
|
+ latitude: res.latitude,
|
|
|
+ province: res.province,
|
|
|
+ city: res.city,
|
|
|
+ area: res.district
|
|
|
+ }
|
|
|
+ if (this.shippingNoteInfos && this.shippingNoteInfos.length > 0) { //更新持续定位经纬度
|
|
|
+ for (let i = 0; i < this.shippingNoteInfos.length; i++) {
|
|
|
+ this.shippingNoteInfos[i].startLatitude = _data.latitude //纬度
|
|
|
+ this.shippingNoteInfos[i].startLocationText = _data.city //起点
|
|
|
+ this.shippingNoteInfos[i].startLongitude = _data.longitude //经度
|
|
|
}
|
|
|
- //判断缓存数据条数,超过reportInterval时清空缓存,重新存入缓存
|
|
|
}
|
|
|
- );
|
|
|
-
|
|
|
- that.$refs.uToast.show({
|
|
|
- type: 'success',
|
|
|
- message: _title,
|
|
|
- complete() {
|
|
|
- uni.switchTab({
|
|
|
- url: '/pages/order/index'
|
|
|
- })
|
|
|
+ this.$helper.gjList.push(_data)
|
|
|
+ uni.setStorageSync('mapGJ', this.$helper.gjList);
|
|
|
+ // console.log('this.$helper.gjList')
|
|
|
+ // console.log(this.$helper.gjList)
|
|
|
+ console.log("条数", uni.getStorageSync('mapGJ').length)
|
|
|
+ // console.log("条数", uni.getStorageSync('mapGJ'))
|
|
|
+ if (uni.getStorageSync('mapGJ').length > 100) {
|
|
|
+ // console.log(JSON.stringify(uni.getStorageSync('mapGJ')))
|
|
|
+ // that.send()
|
|
|
+ that.$request.baseRequest('post', '/hyOrderTravelPath/api/addInfo', {
|
|
|
+ orderId: that.id,
|
|
|
+ longitudeLatitude: JSON.stringify(uni.getStorageSync('mapGJ'))
|
|
|
+ }).then(res => {
|
|
|
+ console.log("已发送定位----------------", res)
|
|
|
+ uni.removeStorageSync('mapGJ');
|
|
|
+ that.$helper.gjList = []
|
|
|
+ })
|
|
|
+ .catch(res => {
|
|
|
+ console.log("0", res.message)
|
|
|
+ uni.$u.toast(res.message);
|
|
|
+ });
|
|
|
}
|
|
|
- })
|
|
|
- } else {
|
|
|
- console.log("1",res)
|
|
|
- // uni.$u.toast(res.message);
|
|
|
- that.$refs.uToast.show({
|
|
|
- type: 'error',
|
|
|
- message: res.message,
|
|
|
- })
|
|
|
- }
|
|
|
- }).catch(res => {
|
|
|
- uni.hideLoading()
|
|
|
- console.log("2",res.message)
|
|
|
+ //判断缓存数据条数,超过reportInterval时清空缓存,重新存入缓存
|
|
|
+ }
|
|
|
+ );
|
|
|
+
|
|
|
+ that.$refs.uToast.show({
|
|
|
+ type: 'success',
|
|
|
+ message: _title,
|
|
|
+ complete() {
|
|
|
+ uni.switchTab({
|
|
|
+ url: '/pages/order/index'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ console.log("1", res)
|
|
|
// uni.$u.toast(res.message);
|
|
|
that.$refs.uToast.show({
|
|
|
type: 'error',
|
|
|
message: res.message,
|
|
|
})
|
|
|
- });
|
|
|
+ }
|
|
|
+ }).catch(res => {
|
|
|
+ uni.hideLoading()
|
|
|
+ console.log("2", res.message)
|
|
|
+ // uni.$u.toast(res.message);
|
|
|
+ that.$refs.uToast.show({
|
|
|
+ type: 'error',
|
|
|
+ message: res.message,
|
|
|
+ })
|
|
|
+ });
|
|
|
},
|
|
|
confirmClick() {
|
|
|
- uni.removeStorageSync('contractdata')
|
|
|
- var that = this
|
|
|
- this.isShowAlert = false
|
|
|
- //1暂存
|
|
|
- if (this.detailData.statusFlag == 1) {
|
|
|
- delete this.detailData.hyCarrierInfo.loadingAreaLongitude;
|
|
|
- delete this.detailData.hyCarrierInfo.loadingAreaLatitude;
|
|
|
- delete this.detailData.hyCarrierInfo.sendCity;
|
|
|
- delete this.detailData.hyCarrierInfo.sendArea;
|
|
|
- }
|
|
|
- uni.showLoading({
|
|
|
- title: '加载中'
|
|
|
- })
|
|
|
- let time = new Date() //装车时间 去当前时间的时分秒
|
|
|
- let h = time.getHours();
|
|
|
- if (h < 10) {
|
|
|
- h = "0" + h
|
|
|
- }
|
|
|
- let f = time.getMinutes();
|
|
|
- if (f < 10) {
|
|
|
- f = "0" + f
|
|
|
- }
|
|
|
- let m = time.getSeconds();
|
|
|
- if (m < 10) {
|
|
|
- m = "0" + m
|
|
|
- }
|
|
|
- var data = {
|
|
|
- loadingImg: this.imgList.toString(),
|
|
|
- statusFlag: this.detailData.statusFlag,
|
|
|
- loadingDate: this.detailData.hyCarrierInfo.loadingDate.split(" ")[0] + " " + h + ":" + f + ":" + m,
|
|
|
- loadingArea: this.detailData.loadingArea,
|
|
|
- loadingCity: this.detailData.loadingCity,
|
|
|
- loadingLongitude: this.detailData.loadingLongitude,
|
|
|
- loadingLatitude: this.detailData.loadingLatitude,
|
|
|
- id: this.detailData.hyCarrierInfo.id,
|
|
|
- transportationDuration: this.detailData.transportationDuration
|
|
|
- }
|
|
|
- if (that.detailData.statusFlag == 1) {//暂存
|
|
|
- console.log("暂存")
|
|
|
- this.affirm(data)
|
|
|
- } else {//提交
|
|
|
- this.start(data)//先调用管局start
|
|
|
+ //判断有没有定位权限 没有 不让提交
|
|
|
+ // this.getLngLat()
|
|
|
+ let _dw = this.$tx.calculateDistance()
|
|
|
+ if (_dw.latitude) {
|
|
|
+ that.detailData.hyCarrierInfo.longitudeLatitude = res.longitude + ',' + res
|
|
|
+ .latitude
|
|
|
+ that.detailData.hyCarrierInfo.loadingAreaLongitude = res.longitude;
|
|
|
+ that.detailData.hyCarrierInfo.loadingAreaLatitude = res.latitude;
|
|
|
+ that.detailData.hyCarrierInfo.sendCity = that.$helper.filterUrban(res.address.city)
|
|
|
+ that.localtion.city = that.$helper.filterUrban(res.address.city)
|
|
|
+ that.$set(that.detailData, 'loadingArea', that.$helper.filterUrban(res.address
|
|
|
+ .district))
|
|
|
+ that.$set(that.detailData, 'loadingCity', that.$helper.filterUrban(res.address
|
|
|
+ .city))
|
|
|
+ that.localtion.sendArea = that.$helper.filterUrban(res.address.district)
|
|
|
+ // .loadingCity = that.$helper.filterUrban(res.address.city)
|
|
|
+ that.detailData.loadingLongitude = res.longitude;
|
|
|
+ that.detailData.loadingLatitude = res.latitude;
|
|
|
+ that.$forceUpdate()
|
|
|
+ uni.removeStorageSync('contractdata')
|
|
|
+ var that = this
|
|
|
+ this.isShowAlert = false
|
|
|
+ //1暂存
|
|
|
+ if (this.detailData.statusFlag == 1) {
|
|
|
+ delete this.detailData.hyCarrierInfo.loadingAreaLongitude;
|
|
|
+ delete this.detailData.hyCarrierInfo.loadingAreaLatitude;
|
|
|
+ delete this.detailData.hyCarrierInfo.sendCity;
|
|
|
+ delete this.detailData.hyCarrierInfo.sendArea;
|
|
|
+ }
|
|
|
+ uni.showLoading({
|
|
|
+ title: '加载中'
|
|
|
+ })
|
|
|
+ let time = new Date() //装车时间 去当前时间的时分秒
|
|
|
+ let h = time.getHours();
|
|
|
+ if (h < 10) {
|
|
|
+ h = "0" + h
|
|
|
+ }
|
|
|
+ let f = time.getMinutes();
|
|
|
+ if (f < 10) {
|
|
|
+ f = "0" + f
|
|
|
+ }
|
|
|
+ let m = time.getSeconds();
|
|
|
+ if (m < 10) {
|
|
|
+ m = "0" + m
|
|
|
+ }
|
|
|
+ var data = {
|
|
|
+ loadingImg: this.imgList.toString(),
|
|
|
+ statusFlag: this.detailData.statusFlag,
|
|
|
+ loadingDate: this.detailData.hyCarrierInfo.loadingDate.split(" ")[0] + " " + h + ":" + f +
|
|
|
+ ":" + m,
|
|
|
+ loadingArea: this.detailData.loadingArea,
|
|
|
+ loadingCity: this.detailData.loadingCity,
|
|
|
+ loadingLongitude: this.detailData.loadingLongitude,
|
|
|
+ loadingLatitude: this.detailData.loadingLatitude,
|
|
|
+ id: this.detailData.hyCarrierInfo.id,
|
|
|
+ transportationDuration: this.detailData.transportationDuration
|
|
|
+ }
|
|
|
+ if (that.detailData.statusFlag == 1) { //暂存
|
|
|
+ console.log("暂存")
|
|
|
+ this.affirm(data)
|
|
|
+ } else { //提交
|
|
|
+ this.start(data) //先调用管局start
|
|
|
+ }
|
|
|
+
|
|
|
+ } else {
|
|
|
+ that.$refs.uToast.show({
|
|
|
+ type: 'error',
|
|
|
+ message: "未获取定位权限!",
|
|
|
+ })
|
|
|
+
|
|
|
+ return
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
},
|
|
|
}
|