|
@@ -88,8 +88,8 @@
|
|
|
<view class='row-between'>
|
|
|
<view class="">运输时长(小时)</view>
|
|
|
<view class="flex align-center">
|
|
|
- <u--input placeholder="请输入运输时长" border="none" type="digit" v-model="detailData.transportationDuration" inputAlign='right'
|
|
|
- clearable></u--input>
|
|
|
+ <u--input placeholder="请输入运输时长" border="none" type="digit"
|
|
|
+ v-model="detailData.transportationDuration" inputAlign='right' clearable></u--input>
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class='s-flex'>
|
|
@@ -131,6 +131,7 @@
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
+ firstAuthentication:{},
|
|
|
cyId: '',
|
|
|
localtion: {
|
|
|
city: '',
|
|
@@ -198,26 +199,24 @@
|
|
|
this.getInfo()
|
|
|
}
|
|
|
console.log(options)
|
|
|
- var isContains = true;//隐私权政策是否包含高德开平隐私权政策 true是包含
|
|
|
- var isShow = true;//隐私权政策是否弹窗展示告知用户 true是展示
|
|
|
+ var isContains = true; //隐私权政策是否包含高德开平隐私权政策 true是包含
|
|
|
+ var isShow = true; //隐私权政策是否弹窗展示告知用户 true是展示
|
|
|
sdkwx.updatePrivacyShow(isContains, isShow);
|
|
|
-
|
|
|
- var isAgree = true;//隐私权政策是否取得用户同意 true是用户同意
|
|
|
+
|
|
|
+ var isAgree = true; //隐私权政策是否取得用户同意 true是用户同意
|
|
|
sdkwx.updatePrivacyAgree(isAgree);
|
|
|
//检查定位权限
|
|
|
- sdkwx.checkLocationPermission(function(res){
|
|
|
+ sdkwx.checkLocationPermission(function(res) {
|
|
|
console.log(res);
|
|
|
});
|
|
|
this.auth()
|
|
|
- // this.detailData = JSON.parse(options.obj) ;
|
|
|
- // console.log(this.detailData)
|
|
|
- // CYHT20220317000001
|
|
|
},
|
|
|
onHide() {
|
|
|
uni.removeStorageSync(
|
|
|
"contractdata")
|
|
|
},
|
|
|
onShow() {
|
|
|
+ this.firstAuthentication = uni.getStorageSync("firstAuthentication")
|
|
|
if (uni.getStorageSync('contractdata')) {
|
|
|
this.id = uni.getStorageSync('contractdata').id
|
|
|
this.detailData.hyCarrierInfo.id = uni.getStorageSync('contractdata').carrierId
|
|
@@ -226,12 +225,12 @@
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
|
- ...mapState(['hasLogin', 'userInfo', "firstAuthentication"])
|
|
|
+ ...mapState(['hasLogin', 'userInfo'])
|
|
|
},
|
|
|
methods: {
|
|
|
auth() { //授权
|
|
|
- console.log("appid:" + this.appId + "安全码:" + this.appSecurity + "发送代码:" + this.enterpriseSenderCode)
|
|
|
- let that = this
|
|
|
+ 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") {
|
|
|
//成功
|
|
@@ -241,44 +240,49 @@
|
|
|
//失败
|
|
|
var errorCode = res.data.errorCode; //错误码
|
|
|
var errorMsg = res.data.errorMsg; //错误描述
|
|
|
+ that.$refs.uToast.show({
|
|
|
+ type: 'error',
|
|
|
+ message: "管局授权失败-"+errorMsg
|
|
|
+ })
|
|
|
console.log("授权失败")
|
|
|
console.log(res)
|
|
|
}
|
|
|
- // uni.showModal({
|
|
|
- // content: JSON.stringify(res)
|
|
|
- // });
|
|
|
});
|
|
|
},
|
|
|
- start() { //开启定位
|
|
|
+ start(val) { //开启定位
|
|
|
+ var that = this
|
|
|
//车牌号 //司机姓名 //备注 //运单信息列表
|
|
|
- console.log(this.detailData, "行政区划分")
|
|
|
- this.shippingNoteInfos[0].shippingNoteNumber = this.detailData.orderNo, //运单号
|
|
|
- this.shippingNoteInfos[0].serialNumber = "0000", //分单号
|
|
|
- this.shippingNoteInfos[0].startCountrySubdivisionCode = this.detailData.publishTaskInfo.sendAdCode, //起点位置行政区划代码,调 用 start/stop/pause/restart 时 必填,调用 send 非必填
|
|
|
- this.shippingNoteInfos[0].endCountrySubdivisionCode = this.detailData.publishTaskInfo.unsendAdCode, //到达位置行政区划代码,调 用 start/stop/pause/restart 时 必填,调用 send 非必填
|
|
|
- this.shippingNoteInfos[0].startLongitude = this.detailData.publishTaskInfo.sendLongitude, //起点位置经度,调用 start/stop/pause/restart 时必 填,调用 send 非必填
|
|
|
- this.shippingNoteInfos[0].startLatitude = this.detailData.publishTaskInfo.sendLatitude, //起点位置纬度,调用 start/stop/pause/restart 时必 填,调用 send 非必填
|
|
|
- this.shippingNoteInfos[0].endLongitude = this.detailData.publishTaskInfo.unsendLongitude, //到达位置经度,调用 start/stop/pause/restart 时必 填,调用 send 非必填
|
|
|
- this.shippingNoteInfos[0].endLatitude = this.detailData.publishTaskInfo.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].shippingNoteNumber = this.detailData.orderNo //运单号
|
|
|
+ this.shippingNoteInfos[0].serialNumber = "0000" //分单号
|
|
|
+ this.shippingNoteInfos[0].startCountrySubdivisionCode = this.detailData.publishTaskInfo
|
|
|
+ .sendAdCode //起点位置行政区划代码,调 用 start/stop/pause/restart 时 必填,调用 send 非必填
|
|
|
+ this.shippingNoteInfos[0].endCountrySubdivisionCode = this.detailData.publishTaskInfo
|
|
|
+ .unsendAdCode //到达位置行政区划代码,调 用 start/stop/pause/restart 时 必填,调用 send 非必填
|
|
|
+ this.shippingNoteInfos[0].startLongitude = this.detailData.publishTaskInfo
|
|
|
+ .sendLongitude //起点位置经度,调用 start/stop/pause/restart 时必 填,调用 send 非必填
|
|
|
+ this.shippingNoteInfos[0].startLatitude = this.detailData.publishTaskInfo
|
|
|
+ .sendLatitude //起点位置纬度,调用 start/stop/pause/restart 时必 填,调用 send 非必填
|
|
|
+ this.shippingNoteInfos[0].endLongitude = this.detailData.publishTaskInfo
|
|
|
+ .unsendLongitude //到达位置经度,调用 start/stop/pause/restart 时必 填,调用 send 非必填
|
|
|
+ this.shippingNoteInfos[0].endLatitude = this.detailData.publishTaskInfo
|
|
|
+ .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)
|
|
|
|
|
|
//}],//运单信息列表,一辆车运单数最大支持数为 10
|
|
|
var remark = "测试"; //备注
|
|
|
- let that = this
|
|
|
- console.log("start this.shippingNoteInfos")
|
|
|
- console.log(this.shippingNoteInfos)
|
|
|
var param = {}
|
|
|
param.carNo = this.detailData.carNo
|
|
|
param.driverName = this.firstAuthentication.driverName
|
|
|
param.remark = remark
|
|
|
param.shippingNoteInfos = this.shippingNoteInfos
|
|
|
- // uni.setStorageSync("sdkStartParam",param)
|
|
|
- // uni.setStorageSync("sdkStartParamOrderNum",this.detailData.orderNo)
|
|
|
- // this.$helper.sdkStart(this.detailData.carNo, this.firstAuthentication.driverName, remark, this.shippingNoteInfos)
|
|
|
sdkwx.start(this.detailData.carNo, this.firstAuthentication.driverName, remark, this.shippingNoteInfos,
|
|
|
function(res) {
|
|
|
if (res.type == "onSuccess") {
|
|
@@ -286,34 +290,28 @@
|
|
|
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.send()
|
|
|
- // that.timer = setTimeout(() => {
|
|
|
- // console.log("定时")
|
|
|
- // that.send()
|
|
|
- // }, dateTtime);
|
|
|
}
|
|
|
+ that.affirm(val)//管局上报成功后提交
|
|
|
} else if (res.type == "onFailure") {
|
|
|
//失败
|
|
|
console.log("开启定位失败!!!")
|
|
|
console.log(res)
|
|
|
var errorCode = res.data.errorCode; //错误码
|
|
|
var errorMsg = res.data.errorMsg; //错误描述
|
|
|
+ uni.hideLoading()
|
|
|
that.$refs.uToast.show({
|
|
|
type: 'error',
|
|
|
- message: errorMsg
|
|
|
+ message: "管局上报-"+errorMsg
|
|
|
})
|
|
|
that.timer = setTimeout(() => {
|
|
|
console.log("定时")
|
|
|
that.send()
|
|
|
}, 915204);
|
|
|
}
|
|
|
- // uni.showModal({
|
|
|
- // content:JSON.stringify(res)
|
|
|
- // });
|
|
|
});
|
|
|
},
|
|
|
send() { //发送定位
|
|
@@ -365,7 +363,7 @@
|
|
|
if (res.code == 200) {
|
|
|
|
|
|
this.detailData = res.data
|
|
|
- if(res.data.hyCarrierInfo && res.data.hyCarrierInfo.transportationDuration){
|
|
|
+ if (res.data.hyCarrierInfo && res.data.hyCarrierInfo.transportationDuration) {
|
|
|
this.detailData.transportationDuration = res.data.hyCarrierInfo.transportationDuration
|
|
|
}
|
|
|
// #ifdef APP-PLUS
|
|
@@ -389,7 +387,7 @@
|
|
|
console.log(this.fileList1)
|
|
|
this.detailData.carNo = res.data.carNo
|
|
|
this.detailData.loadingDate = res.data.loadingDate
|
|
|
-
|
|
|
+
|
|
|
if (res.data.loadingDate) {
|
|
|
this.detailData.loadingDate1 = res.data.loadingDate.split(' ')[0]
|
|
|
}
|
|
@@ -663,7 +661,7 @@
|
|
|
})
|
|
|
return
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
this.alertTitle = '确定提交装车信息?'
|
|
|
}
|
|
|
|
|
@@ -723,7 +721,7 @@
|
|
|
})
|
|
|
return true
|
|
|
}
|
|
|
- if (this.detailData.transportationDuration < 0 || this.detailData.transportationDuration >1000) {
|
|
|
+ if (this.detailData.transportationDuration < 0 || this.detailData.transportationDuration > 1000) {
|
|
|
this.$refs.uToast.show({
|
|
|
type: 'error',
|
|
|
message: "运输时长输入错误!",
|
|
@@ -738,54 +736,19 @@
|
|
|
return true
|
|
|
}
|
|
|
},
|
|
|
- confirmClick() {
|
|
|
- uni.removeStorageSync('contractdata')
|
|
|
+ affirm(data){
|
|
|
+ console.log("提交",data)
|
|
|
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
|
|
|
- }
|
|
|
-
|
|
|
- // console.log("查看id--------",this.detailData.hyCarrierInfo.id)
|
|
|
this.$request.baseRequest('post', '/carrierInfo/loadingAdd', data).then(res => {
|
|
|
+ console.log("提交状态",res)
|
|
|
if (res.code == 200) {
|
|
|
uni.hideLoading()
|
|
|
let _title = ''
|
|
|
if (that.detailData.statusFlag == 1) {
|
|
|
_title = '暂存成功!'
|
|
|
+ return
|
|
|
} else {
|
|
|
- that.start() //开始授权并开始定位
|
|
|
+ // that.start() //开始授权并开始定位
|
|
|
_title = '提交成功!'
|
|
|
}
|
|
|
that.$helper.fUN_AmapLocation.start({
|
|
@@ -793,16 +756,6 @@
|
|
|
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('====确认装车开启连续定位====');
|
|
@@ -835,18 +788,19 @@
|
|
|
orderId: that.id,
|
|
|
longitudeLatitude: JSON.stringify(uni.getStorageSync('mapGJ'))
|
|
|
}).then(res => {
|
|
|
- console.log("已发送定位----------------",res)
|
|
|
+ console.log("已发送定位----------------", res)
|
|
|
uni.removeStorageSync('mapGJ');
|
|
|
that.$helper.gjList = []
|
|
|
})
|
|
|
.catch(res => {
|
|
|
+ console.log("0",res.message)
|
|
|
uni.$u.toast(res.message);
|
|
|
});
|
|
|
}
|
|
|
//判断缓存数据条数,超过reportInterval时清空缓存,重新存入缓存
|
|
|
}
|
|
|
);
|
|
|
-
|
|
|
+
|
|
|
this.$refs.uToast.show({
|
|
|
type: 'success',
|
|
|
message: _title,
|
|
@@ -856,11 +810,59 @@
|
|
|
})
|
|
|
}
|
|
|
})
|
|
|
+ } else {
|
|
|
+ console.log("1",res.message)
|
|
|
+ uni.$u.toast(res.message);
|
|
|
}
|
|
|
- })
|
|
|
- .catch(res => {
|
|
|
+ }).catch(res => {
|
|
|
+ console.log("2",res.message)
|
|
|
uni.$u.toast(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
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
}
|