zhongtianhaoyuan преди 2 години
родител
ревизия
df88657c6a
променени са 3 файла, в които са добавени 90 реда и са изтрити 46 реда
  1. 75 32
      App.vue
  2. 2 2
      config/index.js
  3. 13 12
      pages/order/confirmLoading.vue

+ 75 - 32
App.vue

@@ -31,7 +31,14 @@
 					vehicleNumber: "",
 					driverName: "",
 					interval: "",
+					
+					
 				}],
+				//网络货运信息定位
+				appId: "", //网络货运企业APP的唯一标识
+				appSecurity: "", //网络货运企业在省平台申请的接入安全码
+				enterpriseSenderCode: "23106960", //网络货运企业在省平台申请的企业发送代码
+				environment: "debug", //环境:“debug”接入测试环境,“release”接入正式环境。
 				
 			}},
 		methods: {
@@ -51,22 +58,50 @@
 			// 		// permision.gotoAppPermissionSetting()
 			//     }
 			// },
-			send(_obj){//发送定位
+			restart() { //开启定位
+					var remark = "测试";//备注
+					let that = this
+				sdkwx.restart(this.shippingNoteInfos[0].vehicleNumber, this.shippingNoteInfos[0].driverName,remark, this.shippingNoteInfos, function(res) {
+					if (res.type == "onSuccess") {
+						//成功
+						console.log("开启定位成功!!!")
+						console.log(res)
+						var shippingNoteInfos = res.data[0]; //运单信息列表
+						console.log(shippingNoteInfos,"sdassss")
+						if(shippingNoteInfos){
+							let dateTtime = Number(shippingNoteInfos.interval+1000)
+							console.log("开始定时",dateTtime)
+							that.timer = setInterval(() => {
+								console.log("定时")
+								that.send()
+							}, dateTtime);
+						}
+					} else if (res.type == "onFailure") {
+						//失败
+						console.log("开启定位失败!!!")
+						console.log(res)
+						var errorCode = res.data.errorCode; //错误码
+						var errorMsg = res.data.errorMsg; //错误描述
+					}
+				});
+			},
+			send(){//发送定位
 				var remark = ""
 				var that = this
 				console.log("send参数",this.shippingNoteInfos)
 				sdkwx.send(this.shippingNoteInfos[0].vehicleNumber, this.shippingNoteInfos[0].driverName,remark, this.shippingNoteInfos, function(res){
-					console.log(res)
+						
 					if (res.type == "onSuccess") {
 						console.log("App.vue发送定位成功")
 						console.log(res);
-						//成功
-						var shippingNoteInfos = res.data;//运单信息列表
-						if(shippingNoteInfos&&shippingNoteInfos.length >0 ){
+						var shippingNoteInfos = res.data[0];//运单信息列表
+						if(shippingNoteInfos){
+							let dateTime = Number(shippingNoteInfos.interval+1000)
+							console.log("定时开始",dateTime)
 							that.timer = setInterval(() => {
 							    //TODO 
 								that.send()
-							}, shippingNoteInfos[0].interval+1000);
+							},dateTime);
 						}
 					} else if (res.type == "onFailure"){
 						console.log("App.vue发送定位失败",res)
@@ -74,8 +109,39 @@
 						var errorCode = res.data.errorCode;//错误码
 						var errorMsg = res.data.errorMsg;//错误描述
 					}
+					
 				});	
 			},
+			auth() { //授权
+				let phoneType = uni.getSystemInfoSync().platform //判断手机类型
+				if (phoneType == "android") {
+					this.appId = "uni.UNI9C76CB6"
+					this.appSecurity = "24c593b7037347e08857a6ab05fd231b0509f5bb7cb741078f524f506ad32db8"
+				} else if (phoneType == "ios") {
+					this.appId = "uni.UNIDCD13AC"
+					this.appSecurity = "b01e4805276646eeb25f0fad91de97a4f32e8c2c0e0d42e5b24cc4737e9f040f"
+				}
+				let that = this
+				sdkwx.auth(this.appId, this.appSecurity, this.enterpriseSenderCode, this.environment, function(res) {
+					if (res.type == "onSuccess") {
+						//成功
+						if(res.data.length > 0){
+							that.restart()
+						}
+						console.log("授权成功")
+						console.log(res)
+					} else if (res.type == "onFailure") {
+						//失败
+						var errorCode = res.data.errorCode; //错误码
+						var errorMsg = res.data.errorMsg; //错误描述
+						console.log("授权失败")
+						console.log(res)
+					}
+					// uni.showModal({
+					// 	content: JSON.stringify(res)
+					// });
+				});
+			},
 		},
 
 		onLaunch: function() {
@@ -214,6 +280,7 @@
 						commonId:uni.getStorageSync('userInfo').id,
 					}).then(res1 => {
 						console.log("/orderInfo/getData",res1.data)
+					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 非必填
@@ -227,33 +294,8 @@
 						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"
-						// for(let i = 0; i < res1.data.length ; i++){
-						// 	this.shippingNoteInfos[i].push({'shippingNoteNumber':res1.data[i].orderNo})
-						// 	this.shippingNoteInfos[i].push({'serialNumber':"0000"})
-						// 	this.shippingNoteInfos[i].push({'interval':'5000'})
-						// 	// this.shippingNoteInfos[i].shippingNoteNumber = res1.data[i].orderNo, 
-						// 	// this.shippingNoteInfos[i].serialNumber = "0000", //分单号
-						// 		// this.shippingNoteInfos[i].startCountrySubdivisionCode = this.detailData.publishTaskInfo.sendAdCode, //起点位置行政区划代码,调 用 start/stop/pause/restart 时 必填,调用 send 非必填
-						// 		// this.shippingNoteInfos[i].endCountrySubdivisionCode = this.detailData.publishTaskInfo.unsendAdCode, //到达位置行政区划代码,调 用 start/stop/pause/restart 时 必填,调用 send 非必填
-						// 		// this.shippingNoteInfos[i].startLongitude = this.detailData.loadingLatitude, //起点位置经度,调用 start/stop/pause/restart 时必 填,调用 send 非必填
-						// 		// this.shippingNoteInfos[i].startLatitude = this.detailData.loadingLatitude, //起点位置纬度,调用 start/stop/pause/restart 时必 填,调用 send 非必填
-						// 		// this.shippingNoteInfos[i].endLongitude = this.detailData.publishTaskInfo.unsendLongitude, //到达位置经度,调用 start/stop/pause/restart 时必 填,调用 send 非必填
-						// 		// this.shippingNoteInfos[i].endLatitude = this.detailData.publishTaskInfo.unsendLatitude, //到达位置纬度,调用 start/stop/pause/restart 时必 填,调用 send 非必填
-						// 		// this.shippingNoteInfos[i].startLocationText = res1.data.sendCity, //起点地址文字描述,调用 start/stop/pause/restart 时必 填,调用 send 非必填
-						// 		// this.shippingNoteInfos[i].endLocationText = res1.data.unloadCity, //到达地址文字描述,调用 start/stop/pause/restart 时必 填,调用 send 非必填
-						// 		// this.shippingNoteInfos[i].vehicleNumber = res1.data.carNumber, //车牌号,SDK 回调返回,调 用 start/stop/pause/restart/必 填,send 时非必填
-						// 		// this.shippingNoteInfos[i].driverName = res.data.driverName, //司机姓名,SDK 回调返回, 调用 start/stop/pause/restart/ 必填,send 时非必填
-						// 		// this.shippingNoteInfos[i].interval = "5000" //请求时间间隔,SDK 回调返 回(单位 ms)
-						// }
-						
 						console.log("查看参数",this.shippingNoteInfos)
-						that.send(res1.data)
-					if(res1.data.length>0){
-			// if (uni.getStorageSync('userInfo')) {
-			// 	this.$request.baseRequest('get', '/orderInfo/getData', {
-			// 		commonId: uni.getStorageSync('userInfo').id,
-			// 	}).then(res1 => {
-			// 		if (res1.data.length > 0) {
+						that.auth()
 						that.$helper.fUN_AmapLocation.start({
 								// intervalTime: 1000 * 60,
 								intervalTime: 5000,
@@ -351,6 +393,7 @@
 			if (type == "android") {
 				appUpdate()
 			}
+		
 			// plus.push.getClientInfoAsync((info) => {
 			// 	var name = 'clientId'
 			// 	var value = info.clientid

+ 2 - 2
config/index.js

@@ -1,8 +1,8 @@
 const dev = {
-	// baseUrlNew: 'https://api.changyuntong56.com',
+	baseUrlNew: 'https://api.changyuntong56.com',
 	// baseUrlNew: 'https://apitest.changyuntong56.com',
 	// baseUrlNew: 'https://apitest.eliangeyun.com',
-	baseUrlNew: 'http://192.168.110.9:8099',
+	// baseUrlNew: 'http://192.168.110.9:8099',
 	// baseUrlNew: 'http://192.168.110.82:8999',
 	// baseUrlNew: 'http://192.168.1.119:8999',
 	h5Appid: 'wxb66b599f7f61b46f',

+ 13 - 12
pages/order/confirmLoading.vue

@@ -261,7 +261,8 @@
 					this.shippingNoteInfos[0].endLocationText = this.detailData.unloadCity, //到达地址文字描述,调用 start/stop/pause/restart 时必 填,调用 send 非必填
 					this.shippingNoteInfos[0].vehicleNumber = this.detailData.carNumber, //车牌号,SDK 回调返回,调 用 start/stop/pause/restart/必 填,send 时非必填
 					this.shippingNoteInfos[0].driverName = this.detailData.driverName, //司机姓名,SDK 回调返回, 调用 start/stop/pause/restart/ 必填,send 时非必填
-					this.shippingNoteInfos[0].interval = "5000" //请求时间间隔,SDK 回调返 回(单位 ms)				 
+					this.shippingNoteInfos[0].interval = "5000" //请求时间间隔,SDK 回调返 回(单位 ms)
+					
 				//}],//运单信息列表,一辆车运单数最大支持数为 10
 					var remark = "测试";//备注
 					let that = this
@@ -270,14 +271,15 @@
 						//成功
 						console.log("开启定位成功!!!")
 						console.log(res)
-						var shippingNoteInfos = res.data; //运单信息列表
-						if(shippingNoteInfos && shippingNoteInfos.length >0 ){
-							console.log("开始定时")
+						var shippingNoteInfos = res.data[0]; //运单信息列表
+						console.log(shippingNoteInfos,"sdassss")
+						if(shippingNoteInfos){
+							let dateTtime = Number(shippingNoteInfos.interval+1000)
+							console.log("开始定时",dateTtime)
 							that.timer = setInterval(() => {
 								console.log("定时")
-							    //TODO 
 								that.send()
-							}, shippingNoteInfos[0].interval+1000);
+							}, dateTtime);
 						}
 					} else if (res.type == "onFailure") {
 						//失败
@@ -289,20 +291,19 @@
 				});
 			},
 			send(){//发送定位
-				var remark = "测试";//备注
+				var remark = "";//备注
 				let that = this
-				console.log("成功!!!!!")
 				sdkwx.send(this.detailData.carNo, this.firstAuthentication.driverName,remark, this.shippingNoteInfos, function(res){
 					console.log('发送定位',res);
 					if (res.type == "onSuccess") {
-						//成功
-						var shippingNoteInfos = res.data;//运单信息列表
+						var shippingNoteInfos = res.data[0];//运单信息列表
+						let dateTtime = Number(shippingNoteInfos.interval+1000)
+						console.log("开始定时",dateTtime)
 						that.timer = setInterval(() => {
 						    //TODO 
 							that.send()
-						}, shippingNoteInfos[0].interval+1000);
+						}, dateTtime);
 					} else if (res.type == "onFailure"){
-						//失败
 						var errorCode = res.data.errorCode;//错误码
 						var errorMsg = res.data.errorMsg;//错误描述
 					}