achao há 2 anos atrás
pai
commit
a4c2cc257d
5 ficheiros alterados com 411 adições e 289 exclusões
  1. 108 102
      App.vue
  2. 16 13
      main.js
  3. 52 42
      pages/goodSource/index.vue
  4. 163 132
      pages/order/confirmLoading.vue
  5. 72 0
      util/dw.js

+ 108 - 102
App.vue

@@ -43,8 +43,8 @@
 				appSecurity: "", //网络货运企业在省平台申请的接入安全码
 				enterpriseSenderCode: "", //网络货运企业在省平台申请的企业发送代码
 				environment: "", //环境:“debug”接入测试环境,“release”接入正式环境。
-				version: "" ,// 版本号
-				id:""
+				version: "", // 版本号
+				id: ""
 			}
 		},
 		methods: {
@@ -304,113 +304,119 @@
 					if (res1.data.length > 0) {
 						this.shippingNoteInfos[0].shippingNoteNumber = res1.data[0].orderNo //运单号
 						this.shippingNoteInfos[0].serialNumber = "0000" //分单号
-						this.shippingNoteInfos[0].startCountrySubdivisionCode = res1.data[0].sendAdCode //起点位置行政区划代码,调 用 start/stop/pause/restart 时 必填,调用 send 非必填
-						this.shippingNoteInfos[0].endCountrySubdivisionCode = res1.data[0].unsendAdCode //到达位置行政区划代码,调 用 start/stop/pause/restart 时 必填,调用 send 非必填
-						this.shippingNoteInfos[0].startLongitude = res1.data[0].sendLongitude //起点位置经度,调用 start/stop/pause/restart 时必 填,调用 send 非必填
-						this.shippingNoteInfos[0].startLatitude = res1.data[0].sendLatitude //起点位置纬度,调用 start/stop/pause/restart 时必 填,调用 send 非必填
-						this.shippingNoteInfos[0].endLongitude = res1.data[0].unsendLongitude //到达位置经度,调用 start/stop/pause/restart 时必 填,调用 send 非必填
-						this.shippingNoteInfos[0].endLatitude = res1.data[0].unsendLatitude //到达位置纬度,调用 start/stop/pause/restart 时必 填,调用 send 非必填
-						this.shippingNoteInfos[0].driverName = res1.data[0].driverName //司机姓名,SDK 回调返回, 调用 start/stop/pause/restart/ 必填,send 时非必填
-						this.shippingNoteInfos[0].vehicleNumber = res1.data[0].carNumber //车牌号,SDK 回调返回,调 用 start/stop/pause/restart/必 填,send 时非必填
-						this.shippingNoteInfos[0].startLocationText = res1.data[0].sendCity //起点地址文字描述,调用 start/stop/pause/restart 时必 填,调用 send 非必填
-						this.shippingNoteInfos[0].endLocationText = res1.data[0].unloadCity //到达地址文字描述,调用 start/stop/pause/restart 时必 填,调用 send 非必填
+						this.shippingNoteInfos[0].startCountrySubdivisionCode = res1.data[0]
+							.sendAdCode //起点位置行政区划代码,调 用 start/stop/pause/restart 时 必填,调用 send 非必填
+						this.shippingNoteInfos[0].endCountrySubdivisionCode = res1.data[0]
+							.unsendAdCode //到达位置行政区划代码,调 用 start/stop/pause/restart 时 必填,调用 send 非必填
+						this.shippingNoteInfos[0].startLongitude = res1.data[0]
+							.sendLongitude //起点位置经度,调用 start/stop/pause/restart 时必 填,调用 send 非必填
+						this.shippingNoteInfos[0].startLatitude = res1.data[0]
+							.sendLatitude //起点位置纬度,调用 start/stop/pause/restart 时必 填,调用 send 非必填
+						this.shippingNoteInfos[0].endLongitude = res1.data[0]
+							.unsendLongitude //到达位置经度,调用 start/stop/pause/restart 时必 填,调用 send 非必填
+						this.shippingNoteInfos[0].endLatitude = res1.data[0]
+							.unsendLatitude //到达位置纬度,调用 start/stop/pause/restart 时必 填,调用 send 非必填
+						this.shippingNoteInfos[0].driverName = res1.data[0]
+							.driverName //司机姓名,SDK 回调返回, 调用 start/stop/pause/restart/ 必填,send 时非必填
+						this.shippingNoteInfos[0].vehicleNumber = res1.data[0]
+							.carNumber //车牌号,SDK 回调返回,调 用 start/stop/pause/restart/必 填,send 时非必填
+						this.shippingNoteInfos[0].startLocationText = res1.data[0]
+							.sendCity //起点地址文字描述,调用 start/stop/pause/restart 时必 填,调用 send 非必填
+						this.shippingNoteInfos[0].endLocationText = res1.data[0]
+							.unloadCity //到达地址文字描述,调用 start/stop/pause/restart 时必 填,调用 send 非必填
 						this.shippingNoteInfos[0].interval = "5000"
 						console.log("查看参数", this.shippingNoteInfos)
 						// that.auth()
-						that.$helper.fUN_AmapLocation.start({
-								// intervalTime: 1000 * 60,
-								intervalTime: 60000,
-								// locationCacheEnable:true,
-								isReport: false
-								// url: 'http://192.168.0.66/fun/open/test_json.do',
-								// params: {
-								// 	a: 1,
-								// 	B: '测试',
-								// 	c: true
-								// },
-								// headers: {
-								// 	a: '123',
-								// 	B: 'abcd'
-								// }
-							},
-							res => {
-								// console.log('====确认装车开启连续定位====');
-								// console.log(res)
-								that.id = res1.data[0].id
-								let _data = {
-									orderId: res1.data[0].id,
-									longitude: res.longitude,
-									latitude: res.latitude,
-									province: res.province,
-									city: res.city,
-									area: res.district
-								}
-								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)
-								if (uni.getStorageSync('mapGJ').length > 100) {
-									// console.log(JSON.stringify(uni.getStorageSync('mapGJ')))
-									this.$request.baseRequest('post', '/hyOrderTravelPath/api/addInfo', {
-											orderId: that.id,
-											// orderId: "cdae6ec34c2349768c490a9fefa03fb3",
-											longitudeLatitude: JSON.stringify(uni.getStorageSync(
-												'mapGJ'))
-										}).then(res => {
-											uni.removeStorageSync('mapGJ');
-											this.$helper.gjList = []
-										})
-										.catch(res => {
-											uni.$u.toast(res.message);
-										});
-								}
-								//判断缓存数据条数,超过reportInterval时清空缓存,重新存入缓存
+						//判断有没有定位权限  有权限 定位 没权限不操作
+						let system = uni.getSystemInfoSync(); // 获取系统信息
+						if (system.platform === 'android') { // 判断平台
+							var context = plus.android.importClass("android.content.Context");
+							var locationManager = plus.android.importClass("android.location.LocationManager");
+							var main = plus.android.runtimeMainActivity();
+							var mainSvr = main.getSystemService(context.LOCATION_SERVICE);
+							if (mainSvr) {
+								that.$helper.fUN_AmapLocation.start({
+										intervalTime: 60000,
+										isReport: false
+									},
+									res => {
+										that.id = res1.data[0].id
+										let _data = {
+											orderId: res1.data[0].id,
+											longitude: res.longitude,
+											latitude: res.latitude,
+											province: res.province,
+											city: res.city,
+											area: res.district
+										}
+										this.$helper.gjList.push(_data)
+										uni.setStorageSync('mapGJ', this.$helper.gjList);
+										if (uni.getStorageSync('mapGJ').length > 100) {
+											this.$request.baseRequest('post',
+													'/hyOrderTravelPath/api/addInfo', {
+														orderId: that.id,
+														// orderId: "cdae6ec34c2349768c490a9fefa03fb3",
+														longitudeLatitude: JSON.stringify(uni
+															.getStorageSync(
+																'mapGJ'))
+													}).then(res => {
+													uni.removeStorageSync('mapGJ');
+													this.$helper.gjList = []
+												})
+												.catch(res => {
+													uni.$u.toast(res.message);
+												});
+										}
+									}
+								);
 							}
-						);
+						} else if (system.platform === 'ios') {
+							// console.log("苹果");
+							var cllocationManger = plus.ios.import("CLLocationManager");
+							var enable = cllocationManger.locationServicesEnabled();
+							var status = cllocationManger.authorizationStatus();
+							plus.ios.deleteObject(cllocationManger);
+							if (enable && status != 2) {
+								that.$helper.fUN_AmapLocation.start({
+										intervalTime: 60000,
+										isReport: false
+									},
+									res => {
+										that.id = res1.data[0].id
+										let _data = {
+											orderId: res1.data[0].id,
+											longitude: res.longitude,
+											latitude: res.latitude,
+											province: res.province,
+											city: res.city,
+											area: res.district
+										}
+										this.$helper.gjList.push(_data)
+										uni.setStorageSync('mapGJ', this.$helper.gjList);
+										if (uni.getStorageSync('mapGJ').length > 100) {
+											this.$request.baseRequest('post',
+													'/hyOrderTravelPath/api/addInfo', {
+														orderId: that.id,
+														longitudeLatitude: JSON.stringify(uni
+															.getStorageSync(
+																'mapGJ'))
+													}).then(res => {
+													uni.removeStorageSync('mapGJ');
+													this.$helper.gjList = []
+												})
+												.catch(res => {
+													uni.$u.toast(res.message);
+												});
+										}
+									}
+								);
+
+							}
+						}
 					}
 				})
 			}
-			// this.$helper.fUN_AmapLocation.stop({}, result => {
-			// 	console.log('====fUN_AmapLocation定位stop====', JSON.stringify(result));
-			// 	this.$helper.fUN_AmapLocation.start(
-			// 		{
-			// 			intervalTime: 1000*60,
-			// 			isReport: true,
-			// 			reportInterval: 5,
-			// 			url: 'http://192.168.0.66/fun/open/test_json.do',
-			// 			params: { a: 1, B: '测试', c: true },
-			// 			headers: { a: '123', B: 'abcd' }
-			// 		},
-			// 		res => {
-			// 			//见下方定位返回示例
-			// 			console.log('====确认装车开启连续定位====', JSON.stringify(res));
-			// 			//判断缓存数据条数,超过reportInterval时清空缓存,重新存入缓存
-			// 		}
-			// 	); 
-			// });
 
-			// fUN_AmapLocation.permission({}, result => {
-			//     console.log('====fUN_AmapLocation定位====');
-			// });
-			// fUN_AmapLocation.hasLocationPermissions(function(result) {
-			//     console.log('====fUN_AmapLocation定位权限===='+ result)
-			// });
-			// startLocation与start均可
-			// this.$helper.fUN_AmapLocation.start(
-			// 	{
-			// 		intervalTime: 1000*10,
-			// 		isReport: false,
-			// 	},
-			// 	result => {
-			// 		//见下方定位返回示例
-			// 		console.log('====fUN_AmapLocation定位====', JSON.stringify(result));
-			// 	}
-			// ); 
-
-			// let  isOpenLocation= permision.checkSystemEnableLocation() 
-			// console.log("isOpenLocation",isOpenLocation)
-			// this.requestAndroidPermission('android.permission.ACCESS_FINE_LOCATION')
 			let type = uni.getSystemInfoSync().platform
 			if (type == "android") {
 				// appUpdate()
@@ -510,7 +516,7 @@
 			// var isContains = true;//隐私权政策是否包含高德开平隐私权政策  true是包含
 			// var isShow = true;//隐私权政策是否弹窗展示告知用户 true是展示 
 			// sdkwx.updatePrivacyShow(isContains, isShow);
-			
+
 			// var isAgree = true;//隐私权政策是否取得用户同意  true是用户同意
 			// sdkwx.updatePrivacyAgree(isAgree);
 			// //检查定位权限

+ 16 - 13
main.js

@@ -11,7 +11,10 @@ import baseApi from '@/util/base.js'
 import request from '@/util/request.js'
 import utils from '@/util/util.js'
 import webim from 'webim.js';
-import helper from'@/common/helper.js'
+
+import helper from '@/common/helper.js'
+import dw from '@/util/dw.js'
+Vue.prototype.$dw = dw
 // import axios from 'axios'
 // import TabbarView from "./common/TabBarView.js";
 // Vue.prototype.$tabbarView = new TabbarView();
@@ -24,9 +27,9 @@ Vue.prototype.$store = store
 // Vue.prototype.$axios = axios
 
 // import axios from 'axios'
- 
- 
- 
+
+
+
 // // 解决uniapp 适配axios请求,避免报adapter is not a function错误
 // axios.defaults.adapter = config => {
 // 	console.log(config)
@@ -73,8 +76,8 @@ const mpShare = require('@/uni_modules/uview-ui/libs/mixin/mpShare.js')
 Vue.mixin(mpShare)
 // #endif
 const app = new Vue({
-    store,
-    ...App
+	store,
+	...App
 })
 
 // // 引入请求封装
@@ -82,16 +85,16 @@ const app = new Vue({
 
 app.$mount()
 // #ifdef APP-PLUS
-let main = plus.android.runtimeMainActivity(); 
+let main = plus.android.runtimeMainActivity();
 plus.runtime.quit = function() {
-    main.moveTaskToBack(false);
+	main.moveTaskToBack(false);
 };
 
 plus.nativeUI.toast = (function(str) {
-    if (str == '再按一次退出应用') {
+	if (str == '再按一次退出应用') {
 
-        main.moveTaskToBack(false);
-        return false;
-    }
+		main.moveTaskToBack(false);
+		return false;
+	}
 });
-// #endif
+// #endif

+ 52 - 42
pages/goodSource/index.vue

@@ -223,6 +223,7 @@
 			//          },
 		},
 		onLoad() {
+			that = this
 			this.checkOpenGPSServiceByAndroidIOS()
 		},
 		onHide() {
@@ -244,23 +245,37 @@
 				selectedIconPath: 'static/images/common/dingdan@2x.png'
 			})
 			var that = this
-			setTimeout(() => {
-				// var photol=await permision.checkSystemEnableLocation()
-				if (uni.getStorageSync('confirm_location')) {
-					that.get_localtion_permission()
-				}
-				//获取上一次点击起装卸地
-				if (uni.getStorageSync('fPlaceObj')) {
-					that.startPlace = uni.getStorageSync('fPlaceObj');
-				}
-				if (uni.getStorageSync('sPlaceObj')) {
-					that.endPlace = uni.getStorageSync('sPlaceObj');
-				}
-				that.upCallback({
-					size: 10,
-					num: 1
+			// var photol=await permision.checkSystemEnableLocation()
+			// if (uni.getStorageSync('confirm_location')) {
+			// 	// that.get_localtion_permission()
+			// }
+			//获取上一次点击起装卸地
+			if (uni.getStorageSync('fPlaceObj')) {
+				that.startPlace = uni.getStorageSync('fPlaceObj');
+			} else {
+				that.startPlace.selected = '北京'
+				uni.setStorageSync('fPlaceObj', {
+					fchoosearea: '全部',
+					fchoosecity: '市辖区',
+					fchooseprovince: '北京',
+					selected: '北京'
+				})
+			}
+			if (uni.getStorageSync('sPlaceObj')) {
+				that.endPlace = uni.getStorageSync('sPlaceObj');
+			} else {
+				that.endPlace.selected = '全国';
+				uni.setStorageSync('sPlaceObj', {
+					schoosearea: '请选择区',
+					schoosecity: '请选择市',
+					schooseprovince: '全国',
+					selected: '全国'
 				})
-			}, 1500)
+			}
+			that.upCallback({
+				size: 10,
+				num: 1
+			})
 
 			that.$request.baseRequest('get', '/newsInfo/unreadMessage', {
 				reCommonId: this.userInfo.id,
@@ -335,30 +350,12 @@
 			async get_localtion_permission() {
 				var photol = await permision.checkSystemEnableLocation()
 				if (photol == true) {
-					uni.removeStorageSync('confirm_location')
-					// uni.showToast({
-					// 				title: '只有文字弹窗',
-					// 				icon: 'none',    //如果要纯文本,不要icon,将值设为'none'
-					// 				duration: 2000    //持续时间为 2秒
-					// 			})  
 					this.getLngLat()
 				} else {
-					if (uni.getStorageSync('confirm_location')) {
-						uni.removeStorageSync('confirm_location')
-					}
-					uni.setStorageSync('fPlaceObj', {
-						fchoosearea: '全部',
-						fchoosecity: '市辖区',
-						fchooseprovince: '北京',
-						selected: '东城'
-					})
-					uni.setStorageSync('sPlaceObj', {
-						schoosearea: '请选择区',
-						schoosecity: '请选择市',
-						schooseprovince: '全国',
-						selected: '全国'
+					that.$refs.uToast.show({
+						type: 'error',
+						message: "未获取定位权限!",
 					})
-					uni.setStorageSync('longitudeAndLatitude', '116.3972,39.9096')
 				}
 			},
 			async getLngLat() {
@@ -392,6 +389,10 @@
 								selected: '全国'
 							})
 							uni.setStorageSync('longitudeAndLatitude', res.longitude + ',' + res.latitude)
+							that.upCallback({
+								size: 10,
+								num: 1
+							})
 						}
 					}
 				})
@@ -953,12 +954,21 @@
 						this.mescroll.endErr();
 					});
 			},
-			clickTab(val) {
+			async clickTab(val) {
+				console.log("val", val)
 				this.tabIndex = val.index
-				this.upCallback({
-					size: 10,
-					num: 1,
-				})
+				if (val == '按距离') {
+					var photol = await permision.checkSystemEnableLocation()
+					if (uni.getStorageSync('confirm_location')) {
+						that.get_localtion_permission()
+					}
+				} else {
+					this.upCallback({
+						size: 10,
+						num: 1,
+					})
+				}
+
 			},
 			changeCity() {
 				if (this.endPlace.selected == '全国') {

+ 163 - 132
pages/order/confirmLoading.vue

@@ -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
 				}
+
 			}
 		},
 	}

+ 72 - 0
util/dw.js

@@ -0,0 +1,72 @@
+const calculateDistance = (options) => {
+
+	return new Promise((resolve, reject) => {
+		uni.getLocation({
+			type: 'gcj02',
+			geocode: true,
+			success: res => {
+				if (res.latitude) {
+					resolve(res)
+					// 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.hideLoading()
+				} else {
+					reject(err)
+					// if (uni.getSystemInfoSync().platform == 'android') {
+					// 	var context = plus.android.importClass("android.content.Context");
+					// 	var locationManager = plus.android.importClass(
+					// 		"android.location.LocationManager");
+					// 	var main = plus.android.runtimeMainActivity();
+					// 	var mainSvr = main.getSystemService(context.LOCATION_SERVICE);
+					// 	that.bool = mainSvr.isProviderEnabled(locationManager.GPS_PROVIDER)
+					// }
+					// if (that.bool === false) {
+					// 	uni.showModal({
+					// 		title: '提示',
+					// 		content: '请打开定位服务',
+					// 		success: ({
+					// 			confirm,
+					// 			cancel
+					// 		}) => {
+					// 			if (confirm) {
+					// 				if (uni.getSystemInfoSync().platform == 'android') {
+					// 					var Intent = plus.android.importClass(
+					// 						'android.content.Intent');
+					// 					var Settings = plus.android.importClass(
+					// 						'android.provider.Settings');
+					// 					var intent = new Intent(Settings
+					// 						.ACTION_LOCATION_SOURCE_SETTINGS);
+					// 					var main = plus.android.runtimeMainActivity();
+					// 					main.startActivity(intent); // 打开系统设置GPS服务页面
+					// 				}
+					// 			}
+					// 		}
+					// 	});
+					// 	uni.hideLoading()
+					// }
+				}
+			},
+			fail: res => {
+				reject(err)
+			}
+		});
+
+	})
+}
+
+export default {
+	calculateDistance
+}