achao 1 year ago
parent
commit
ab6be9911d
1 changed files with 91 additions and 29 deletions
  1. 91 29
      pages/order/confirmUnloading.vue

+ 91 - 29
pages/order/confirmUnloading.vue

@@ -108,7 +108,8 @@
 		<itmister-date-picker :dateStatus="0" ref="dateEl" :startYear="1999" :futureYear="30"
 			@dateConfirm="confirmValidityPeriod"></itmister-date-picker>
 		<u-toast ref="uToast"></u-toast>
-		<u-modal :show="distance" :content="distanceTips" :showConfirmButton="false" :showCancelButton="true" :closeOnClickOverlay="true" @cancel="distance=false" @close="distance=false"></u-modal>
+		<u-modal :show="distance" :content="distanceTips" :showConfirmButton="false" :showCancelButton="true"
+			:closeOnClickOverlay="true" @cancel="distance=false" @close="distance=false"></u-modal>
 	</view>
 </template>
 
@@ -156,10 +157,10 @@
 				}],
 				// unsendLatitude: "",
 				// unsendLongitude: "",
-				distance:false,
-				distanceTips:"",
-				editPlace:true,//编辑卸车地点标识 true未编辑  false编辑
-				
+				distance: false,
+				distanceTips: "",
+				editPlace: true, //编辑卸车地点标识 true未编辑  false编辑
+
 			}
 		},
 		onLoad(options) {
@@ -270,30 +271,30 @@
 				})
 			},
 			stop() { //结束定位
-			var that = this
+				var that = this
 				this.shippingNoteInfos[0].shippingNoteNumber = this.detailData.orderNo //运单号
-					this.shippingNoteInfos[0].serialNumber = "0000" //分单号
-					this.shippingNoteInfos[0].startCountrySubdivisionCode = this.detailData
+				this.shippingNoteInfos[0].serialNumber = "0000" //分单号
+				this.shippingNoteInfos[0].startCountrySubdivisionCode = this.detailData
 					.sendAdCode //起点位置行政区划代码,调 用 start/stop/pause/restart 时 必填,调用 send 非必填
-					this.shippingNoteInfos[0].endCountrySubdivisionCode = this.detailData
-					.unsendAdCode//到达位置行政区划代码,调 用 start/stop/pause/restart 时 必填,调用 send 非必填
-					this.shippingNoteInfos[0].startLongitude = this.detailData
+				this.shippingNoteInfos[0].endCountrySubdivisionCode = this.detailData
+					.unsendAdCode //到达位置行政区划代码,调 用 start/stop/pause/restart 时 必填,调用 send 非必填
+				this.shippingNoteInfos[0].startLongitude = this.detailData
 					.sendLongitude //起点位置经度,调用 start/stop/pause/restart 时必 填,调用 send 非必填
-					this.shippingNoteInfos[0].startLatitude = this.detailData
+				this.shippingNoteInfos[0].startLatitude = this.detailData
 					.sendLatitude //起点位置纬度,调用 start/stop/pause/restart 时必 填,调用 send 非必填
-					this.shippingNoteInfos[0].endLongitude = this.detailData
+				this.shippingNoteInfos[0].endLongitude = this.detailData
 					.unsendLongitude //到达位置经度,调用 start/stop/pause/restart 时必 填,调用 send 非必填
-					this.shippingNoteInfos[0].endLatitude = this.detailData
+				this.shippingNoteInfos[0].endLatitude = this.detailData
 					.unsendLatitude //到达位置纬度,调用 start/stop/pause/restart 时必 填,调用 send 非必填
-					this.shippingNoteInfos[0].startLocationText = this.detailData
+				this.shippingNoteInfos[0].startLocationText = this.detailData
 					.sendCity //起点地址文字描述,调用 start/stop/pause/restart 时必 填,调用 send 非必填
-					this.shippingNoteInfos[0].endLocationText = this.detailData
+				this.shippingNoteInfos[0].endLocationText = this.detailData
 					.unloadCity //到达地址文字描述,调用 start/stop/pause/restart 时必 填,调用 send 非必填
-					this.shippingNoteInfos[0].vehicleNumber = this.detailData
+				this.shippingNoteInfos[0].vehicleNumber = this.detailData
 					.carNumber //车牌号,SDK 回调返回,调 用 start/stop/pause/restart/必 填,send 时非必填
-					this.shippingNoteInfos[0].driverName = this.detailData
+				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)
 				// var shippingNoteInfos = this.shippingNoteInfos;//运单信息列表
 				console.log("查看结束参数", this.shippingNoteInfos)
 				let remark = ""
@@ -596,16 +597,18 @@
 				// }
 				// this.detailData.publishTaskInfo.unsendLatitude //任务卸车所在地经纬度
 				// this.detailData.publishTaskInfo.unsendLongitude
-				 
-				var lat = this.detailData.carrierInfo.unloadingLatitude  //当前定位所在的经纬度
+
+				var lat = this.detailData.carrierInfo.unloadingLatitude //当前定位所在的经纬度
 				var lng = this.detailData.carrierInfo.unloadingLongitude
-				var endlat = this.detailData.publishTaskInfo?this.detailData.publishTaskInfo.unsendLatitude:this.detailData.unsendLatitude
-				var endlng = this.detailData.publishTaskInfo?this.detailData.publishTaskInfo.unsendLongitude:this.detailData.unsendLongitude
-				if(this.editPlace){//true 未编辑 判断当前定位与任务卸车地点距离  大于5KM提示,编辑卸车地点后不在判断
-				let juli = this.getDistance(endlat,endlng,lat,lng)
-					console.log("更改卸车地后距离",juli)
-					if(Number(juli)>5){
-						this.distanceTips="当前定位与运单卸货地不符,请在指定地点确认卸车,如果卸货地发生变化,请修改本页面基本信息中的卸货地址!",
+				var endlat = this.detailData.publishTaskInfo ? this.detailData.publishTaskInfo.unsendLatitude : this
+					.detailData.unsendLatitude
+				var endlng = this.detailData.publishTaskInfo ? this.detailData.publishTaskInfo.unsendLongitude : this
+					.detailData.unsendLongitude
+				if (this.editPlace) { //true 未编辑 判断当前定位与任务卸车地点距离  大于5KM提示,编辑卸车地点后不在判断
+					let juli = this.getDistance(endlat, endlng, lat, lng)
+					console.log("更改卸车地后距离", juli)
+					if (Number(juli) > 5) {
+						this.distanceTips = "当前定位与运单卸货地不符,请在指定地点确认卸车,如果卸货地发生变化,请修改本页面基本信息中的卸货地址!",
 							this.distance = true
 						return
 					}
@@ -613,6 +616,61 @@
 				this.isShowAlert = true
 				this.detailData.statusFlag = type
 			},
+			async stopMap() {
+				var that = this
+				this.shippingNoteInfos[0].shippingNoteNumber = this.detailData.orderNo //运单号
+				this.shippingNoteInfos[0].serialNumber = "0000" //分单号
+				this.shippingNoteInfos[0].startCountrySubdivisionCode = this.detailData
+					.sendAdCode //起点位置行政区划代码,调 用 start/stop/pause/restart 时 必填,调用 send 非必填
+				this.shippingNoteInfos[0].endCountrySubdivisionCode = this.detailData
+					.unsendAdCode //到达位置行政区划代码,调 用 start/stop/pause/restart 时 必填,调用 send 非必填
+				this.shippingNoteInfos[0].startLongitude = this.detailData
+					.sendLongitude //起点位置经度,调用 start/stop/pause/restart 时必 填,调用 send 非必填
+				this.shippingNoteInfos[0].startLatitude = this.detailData
+					.sendLatitude //起点位置纬度,调用 start/stop/pause/restart 时必 填,调用 send 非必填
+				this.shippingNoteInfos[0].endLongitude = this.detailData
+					.unsendLongitude //到达位置经度,调用 start/stop/pause/restart 时必 填,调用 send 非必填
+				this.shippingNoteInfos[0].endLatitude = this.detailData
+					.unsendLatitude //到达位置纬度,调用 start/stop/pause/restart 时必 填,调用 send 非必填
+				this.shippingNoteInfos[0].startLocationText = this.detailData
+					.sendCity //起点地址文字描述,调用 start/stop/pause/restart 时必 填,调用 send 非必填
+				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)
+				// var shippingNoteInfos = this.shippingNoteInfos;//运单信息列表
+				console.log("查看结束参数", this.shippingNoteInfos)
+				let remark = ""
+				await this.sdkWxStop()
+
+			},
+			sdkWxStop() {
+				return new Promise((resolve, reject) => {
+					sdkwx.stop(this.detailData.carNumber, this.detailData.driverName, remark, this
+						.shippingNoteInfos,
+						function(
+							res) {
+							if (res.type == "onSuccess") {
+								resolve(res)
+								console.log("结束成功!!!", res)
+								//成功
+							} else if (res.type == "onFailure") {
+								console.log("结束成功!!!", res)
+								//失败
+								var errorCode = res.data.errorCode; //错误码
+								var errorMsg = res.data.errorMsg; //错误描述
+								that.$refs.uToast.show({
+									type: 'error',
+									message: errorMsg,
+								})
+								return
+							}
+						})
+				})
+			},
 			confirmClick() {
 				var that = this
 				if (this.detailData.statusFlag == 1) {
@@ -669,13 +727,17 @@
 						" " + h + ":" + f + ":" + m
 				}
 				this.detailData.carrierInfo.carNo = this.detailData.carNumber
+
+				if (this.detailData.statusFlag != 1 && this.detailData.cargoOwnerStatus == "运输中") {
+					this.stopMap()
+				}
 				this.$request.baseRequest('post', '/carrierInfo/unLoadingAdd', this.detailData.carrierInfo).then(res => {
 						if (res.code == 200) {
 							let _title = ''
 							if (this.detailData.statusFlag == 1) {
 								_title = '暂存成功!'
 							} else {
-								that.stop()
+								// that.stop()
 								_title = '提交成功!'
 							}
 							uni.hideLoading()