123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873 |
- <!-- 确认卸车 -->
- <template>
- <view class="content">
- <view class="content2">
- <view class="level2-title">基本信息</view>
- <view class='row-between'>
- <view class="row-left-text">订单编号</view>
- <view class="row-right-text">{{detailData.orderNo}}</view>
- </view>
- <view class='row-between'>
- <view class="row-left-text">货主</view>
- <view class="row-right-text">{{detailData.cargoOwner}}</view>
- </view>
- <view class='row-between'>
- <view class="row-left-text">货主单位</view>
- <view class="row-right-text">{{detailData.compName?detailData.compName:'个人货主'}}</view>
- </view>
- <view class='row-between'>
- <view class="row-left-text">发货地</view>
- <view class="row-right-text place">
- {{detailData.sendPrivate}}{{detailData.sendCity}}{{detailData.sendArea}}{{detailData.sendDetailedAddress}}
- </view>
- </view>
- <view class='row-between'>
- <view class="row-left-text">卸货地</view>
- <view class="row-right-text place">
- <view class="flex" style="justify-content: flex-end;" @click="selectMap">
- {{detailData.unloadPrivate}}{{detailData.unloadCity}}{{detailData.unloadArea}}
- <u-icon name="arrow-right"></u-icon>
- </view>
- <view>
- <u-input placeholder="请输入详细地址" border="none" v-model="detailData.unloadDetailedAddress"
- inputAlign="right"></u-input>
- <!-- @change="change" -->
- </view>
- </view>
- </view>
- <view class='row-between'>
- <view class="row-left-text">货名</view>
- <view class="row-right-text">{{detailData.goodsName}}</view>
- </view>
- <view class='row-between'>
- <view class="row-left-text">运费</view>
- <view class="row-right-text">{{detailData.freight}}{{detailData.billingMethod==0?'元/吨':'元/车'}}</view>
- </view>
- </view>
- <view class="content2">
- <view class="level2-title">卸车信息</view>
- <view class='row-between'>
- <view class="row-left-text">车牌号</view>
- <view class="row-right-text">{{detailData.carNumber}}</view>
- </view>
- <view class='row-between'>
- <view class="row-left-text">卸车净重(吨)</view>
- <view class="row-right-text">
- <u--input placeholder="请输入卸车净重" border="none" type="number" v-model="detailData.unloadingWeight"
- inputAlign='right' clearable></u--input>
- </view>
- </view>
- <!-- <view class='row-between'>
- <view class="row-left-text">卸车日期</view>
- <view class="row-right-text">{{detailData.carrierInfo.unloadingDate}}</view>
- </view> -->
- <view class="row-between">
- <view class="left-text">卸车日期</view>
- <view class="row-right-text" @click="selectUnloadingDate">
- {{detailData.carrierInfo.unloadingDate?detailData.carrierInfo.unloadingDate:'选择卸车日期'}}
- </view>
- </view>
- <!-- <view class='row-between'>
- <view class="row-left-text">合计运费(元)</view>
- <view style='position:relative;'>
- <input :style="{color:this.detailData.freight!=detailData.totalFreight?'red':'#000'}" class="totalFreight-input" placeholder="输入合计运费" v-model="detailData.totalFreight"
- type="number" />
- <image @click='eliminate' class='close' v-if='detailData.totalFreight.length>0' src="../../static/images/order/guanbi.png" mode=""></image>
- </view>
- </view> -->
- <view class='row-between'>
- <view class="row-left-text">定位</view>
- <view style='font-size:14px;' class="flex align-center">
- {{detailData.carrierInfo.unloadCity}}{{detailData.carrierInfo.unloadArea}}
- <view class="sx-style" @click.stop="getLngLat()">刷新</view>
- </view>
- </view>
- <view class='s-flex'>
- <view class="row-left-text" style="margin:20rpx 0;">上传卸车照片(1-3张)</view>
- <u-upload class="uview-upload" :fileList="fileList1" @afterRead="afterRead($event)" @delete="deletePic"
- name="1" multiple :maxCount="3"></u-upload>
- </view>
- <view class='s-flex'>
- <view class="row-left-text" style="margin:20rpx 0;">上传回单照片(磅单)</view>
- <u-upload class="uview-upload" :fileList="fileList2" @afterRead="afterRead1($event)"
- @delete="deletePic1" name="2" multiple :maxCount="3"></u-upload>
- </view>
- </view>
- <view class="bottom-btn">
- <view class="store" @click="$u.throttle(submit(1), 1000)">暂存</view>
- <view class="submit" @click="$u.throttle(submit(3), 1000)">提交</view>
- </view>
- <u-modal :show="isShowAlert" :title="alertTitle" :content='alertContent' :closeOnClickOverlay='true'
- :showCancelButton='true' confirmColor='#F5BA3C' @confirm="confirmClick" @close="cancelClick"
- @cancel="cancelClick"></u-modal>
- <!--<u- picker :show="isShowValidity" :defaultIndex='defaultIndex' ref="uPicker" :columns="validityPeriod" @confirm="confirmValidityPeriod"
- :closeOnClickOverlay='true' @close='isShowValidity=false' @cancel='isShowValidity=false'>
- </u-picker> -->
- <!-- :endDate="array" -->
- <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>
- </view>
- </template>
- <script>
- let that;
- import uploadImage from '@/components/ossutil/uploadFile.js';
- //插件对象
- var sdkwx = uni.requireNativePlugin('Hdgq-LocSdkWX');
- export default {
- data() {
- return {
- imgList: [],
- fileList1: [],
- fileList2: [],
- validityPeriod: [],
- sourceType: ['camera'],
- imgList1: [],
- detailData: {
- addressUrl: '',
- hyCarrierInfo: {},
- totalFreight: ''
- },
- defaultIndex: [],
- action: this.$helper.ossUploadUrl,
- maxSize: 50 * 1024 * 1024, //限制文件大小 50M
- isAdd: true,
- isShowAlert: false,
- alertContent: '',
- alertTitle: '',
- localtion: {},
- shippingNoteInfos: [{
- shippingNoteNumber: '',
- serialNumber: "",
- startCountrySubdivisionCode: "",
- endCountrySubdivisionCode: "",
- startLongitude: "",
- startLatitude: "",
- endLongitude: "",
- endLatitude: "",
- startLocationText: "",
- endLocationText: "",
- vehicleNumber: "",
- driverName: "",
- interval: "",
- }],
- // unsendLatitude: "",
- // unsendLongitude: "",
- distance: false,
- distanceTips: "",
- editPlace: true, //编辑卸车地点标识 true未编辑 false编辑
- }
- },
- onLoad(options) {
- this.detailData = JSON.parse(options.obj)
- console.log(this.detailData)
- this.fileList1 = []
- this.fileList2 = []
- if (this.detailData.hyCarrierInfo.unloadingImg) {
- this.imgList = this.detailData.hyCarrierInfo.unloadingImg.split(',')
- var data = this.detailData.hyCarrierInfo.unloadingImg.split(',')
- for (var i = 0; i < data.length; i++) {
- if (data[i] != '') {
- this.fileList1.push({
- url: data[i]
- })
- }
- }
- }
- if (this.detailData.hyCarrierInfo.receiptImg) {
- this.imgList1 = this.detailData.hyCarrierInfo.receiptImg.split(',')
- var data = this.detailData.hyCarrierInfo.receiptImg.split(',')
- for (var i = 0; i < data.length; i++) {
- if (data[i] != '') {
- this.fileList2.push({
- url: data[i]
- })
- }
- }
- }
- if (this.detailData.hyCarrierInfo.totalFreight) {
- this.$set(this.detailData, 'totalFreight', String(this.detailData.hyCarrierInfo.totalFreight))
- // this.detailData.totalFreight=String(this.detailData.hyCarrierInfo.totalFreight)
- } else {
- this.$set(this.detailData, 'totalFreight', String(this.detailData.freight))
- // this.detailData.totalFreight=String(this.detailData.freight)
- }
- this.detailData.carrierInfo = {
- // unloadingDate: '',
- // estimatedFreight: '',
- // unloadingAreaLongitude: '',
- // unloadingAreaLatitude: '',
- // unloadCity: '',
- // unloadArea: '',
- // unloadingImg: '',
- // totalFreight: '',
- unloadingImg: this.detailData.hyCarrierInfo.unloadingImg,
- receiptImg: this.detailData.hyCarrierInfo.receiptImg,
- id: this.detailData.carrierId ? this.detailData.carrierId : this.detailData.hyCarrierInfo.id,
- }
- // #ifdef APP-PLUS
- this.getLngLat();
- // #endif
- this.getNowTime()
- },
- methods: {
- selectMap() {
- let that = this
- // this.isShowMap = true
- uni.getLocation({
- type: 'gcj02',
- geocode: true,
- altitude: true,
- isHighAccuracy: true,
- success: function(res) {
- console.log('当前位置的经度:' + res.longitude);
- console.log('当前位置的纬度:' + res.latitude);
- uni.chooseLocation({
- latitude: res.latitude,
- longitude: res.longitude,
- success: function(res) {
- console.log(res);
- console.log('位置名称:' + res.name);
- console.log('详细地址:' + res.address);
- console.log('纬度:' + res.latitude);
- console.log('经度:' + res.longitude);
- let _address = that.$helper.formatLocation(res.address)
- that.detailData.unloadPrivate = _address.Province
- that.detailData.unloadCity = _address.City
- that.detailData.unloadArea = _address.Country
- that.detailData.unloadDetailedAddress = _address.Village
- // that.unsendLatitude = res.latitude
- // that.unsendLongitude = res.longitude
- that.editPlace = false
- //获取行政区划代码
- // uni.request({
- // url: 'https://restapi.amap.com/v3/config/district?key=d29a9d10160efaca0dd616bbec936d7f&subdistrict=1&keywords=' +
- // _address.City,
- // success: (res) => {
- // for(let i = 0 ; i < res.data.districts[0].districts.length ; i++){
- // if(res.data.districts[0].districts[i].name == _address.Country){
- // that.addressInfo.adCode = res.data.districts[0].districts[i].adcode
- // console.log("行政区划代码"+that.addressInfo.adCode)
- // break
- // }
- // }
- // }
- // });
- that.$forceUpdate()
- },
- fail(err) {
- console.log(err)
- },
- complete(res1) {
- console.log(res1)
- }
- });
- }
- })
- },
- stop() { //结束定位
- let 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 = ""
- sdkwx.stop(this.detailData.carNumber, this.detailData.driverName, remark, this.shippingNoteInfos, function(
- res) {
- if (res.type == "onSuccess") {
- 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
- }
- });
- },
- deletePic(event) {
- console.log(this[`fileList${event.name}`])
- this[`fileList${event.name}`].splice(event.index, 1)
- this.imgList.splice(event.index, 1)
- },
- deletePic1(event) {
- this[`fileList${event.name}`].splice(event.index, 1)
- this.imgList1.splice(event.index, 1)
- },
- getNowTime() {
- let now = new Date();
- let year = now.getFullYear(); //得到年份
- let month = now.getMonth(); //得到月份
- let date = now.getDate(); //得到日期
- month = month + 1;
- month = month.toString().padStart(2, "0");
- date = date.toString().padStart(2, "0");
- let defaultDate = `${year}-${month}-${date}`
- this.detailData.carrierInfo.unloadingDate = defaultDate
- // this.$forceUpdate()
- },
- eliminate() {
- this.$set(this.detailData, 'totalFreight', '')
- // t.totalFreight=''
- console.log(this.detailData.totalFreight)
- console.log(this.detailData.totalFreight.length)
- },
- selectUnloadingDate() {
- this.$refs.dateEl.show()
- },
- getLngLat() {
- let that = this
- uni.showLoading({
- title: '获取定位中',
- mask: true
- })
- // this.$helper.fUN_AmapLocation.start({
- // intervalTime: 1000 * 3,
- // isReport: false,
- // },
- // res => {
- // //见下方定位返回示例
- // console.log('====fUN_AmapLocation定位====', JSON.stringify(res));
- // if (res.latitude) {
- // this.detailData.carrierInfo.loadingAreaLongitude = res.longitude;
- // this.detailData.carrierInfo.loadingAreaLatitude = res.latitude;
- // this.detailData.carrierInfo.sendCity = this.$helper.filterUrban(res.city)
- // this.detailData.carrierInfo.sendArea = this.$helper.filterArea(res.district);
- // console.log(this.detailData.carrierInfo.sendCity)
- // console.log(this.detailData.carrierInfo.sendArea)
- // this.$forceUpdate()
- // }
- // this.$helper.fUN_AmapLocation.stop({}, result => {
- // uni.hideLoading()
- // console.log('====fUN_AmapLocation定位stop====', JSON.stringify(result));
- // });
- // }
- // );
- uni.getLocation({
- type: 'gcj02',
- geocode: true,
- success: res => {
- if (res.latitude) {
- // that.detailData.hyCarrierInfo.loadingAreaLongitude = res.longitude;
- // that.detailData.hyCarrierInfo.loadingAreaLatitude = res.latitude;
- that.detailData.carrierInfo.unloadingAreaLongitude = res.longitude;
- that.detailData.carrierInfo.unloadingAreaLatitude = res.latitude;
- that.detailData.carrierInfo.unloadCity = that.$helper.filterUrban(res.address.city)
- that.detailData.carrierInfo.unloadArea = that.$helper.filterUrban(res.address
- .district)
- that.localtion.city = that.$helper.filterUrban(res.address.city)
- that.localtion.sendArea = that.$helper.filterUrban(res.address.district)
- that.detailData.carrierInfo.unloadingCity = that.$helper.filterUrban(res.address
- .city)
- that.detailData.carrierInfo.unloadingArea = that.$helper.filterUrban(res.address
- .district)
- that.detailData.carrierInfo.unloadingLongitude = res.longitude;
- that.detailData.carrierInfo.unloadingLatitude = res.latitude;
- that.$forceUpdate()
- uni.hideLoading()
- } else {
- 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 => {
- console.log('定位失败')
- console.log(res)
- uni.hideLoading()
- }
- });
- },
- alertBtn() {
- // uni.navigateTo({
- // url: '/pages/public/login'
- // })
- },
- cancelClick() {
- this.isShowAlert = false
- },
- getImgUrl(res) {
- this.detailData.carrierInfo.unloadingImg += res + ','
- console.log(res)
- console.log('------------res-----------')
- },
- onError(error) {
- alert(error)
- console.log('------------error-----------')
- console.log(error)
- },
- onRemove(index) {},
- filterFileType(index, lists) {
- if (lists[index].fileType != 'jpg' && lists[index].fileType != 'png' && lists[index].fileType != 'gif') {
- lists.splice(index, 1);
- // 当前文件不支持
- uni.showModal({
- title: '暂不支持当前图片类型',
- showCancel: false
- });
- } else {
- this.isAdd = false;
- }
- },
- // 新增图片
- async afterRead(event) {
- // 当设置 mutiple 为 true 时, file 为数组格式,否则为对象格式
- let lists = [].concat(event.file)
- let fileListLen = this[`fileList${event.name}`].length
- lists.map((item) => {
- this[`fileList${event.name}`].push({
- ...item,
- status: 'uploading',
- message: '上传中'
- })
- })
- for (let i = 0; i < lists.length; i++) {
- const result = await this.uploadFilePromise(lists[i].url)
- let item = this[`fileList${event.name}`][fileListLen]
- this[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(item, {
- status: 'success',
- message: '',
- url: result
- }))
- fileListLen++
- }
- },
- // 新增图片
- async afterRead1(event) {
- // 当设置 mutiple 为 true 时, file 为数组格式,否则为对象格式
- let lists = [].concat(event.file)
- let fileListLen = this[`fileList${event.name}`].length
- lists.map((item) => {
- this[`fileList${event.name}`].push({
- ...item,
- status: 'uploading',
- message: '上传中'
- })
- })
- for (let i = 0; i < lists.length; i++) {
- const result = await this.uploadFilePromise1(lists[i].url)
- let item = this[`fileList${event.name}`][fileListLen]
- this[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(item, {
- status: 'success',
- message: '',
- url: result
- }))
- fileListLen++
- }
- },
- uploadFilePromise(url) {
- uploadImage('image', url, 'appData/',
- result => {
- // 上传成功回调函数
- console.log('图片地址', result)
- this.imgList.push(result)
- }
- )
- },
- uploadFilePromise1(url) {
- uploadImage('image', url, 'appData/',
- result => {
- // 上传成功回调函数
- console.log('图片地址', result)
- this.imgList1.push(result)
- }
- )
- },
- onProgress(e) {
- console.log(e)
- },
- getDistance(lat1, lng1, lat2, lng2) {
- var radLat1 = lat1 * Math.PI / 180.0;
- var radLat2 = lat2 * Math.PI / 180.0;
- var a = radLat1 - radLat2;
- var b = lng1 * Math.PI / 180.0 - lng2 * Math.PI / 180.0;
- var s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2) +
- Math.cos(radLat1) * Math.cos(radLat2) * Math.pow(Math.sin(b / 2), 2)));
- s = s * 6378.137; // EARTH_RADIUS;
- s = Math.round(s * 10000) / 10000;
- // // 纬度之差
- // var a = lat1 - lat2;
- // // 经度之差
- // var b = lng1 - lng2;
- // // 计算两点距离的公式
- // var s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2) +
- // Math.cos(lat1) * Math.cos(lat2) * Math.pow(Math.sin(b / 2), 2)));
- // // 弧长乘地球半径, 返回单位: 千米
- // s = s * 6378.137;
- return s;
- },
- submit(type) {
- if (type == 1) {
- this.alertContent = '确定暂存卸车信息?'
- } else {
- if (!this.detailData.unloadingWeight) {
- this.$refs.uToast.show({
- type: 'error',
- message: "请输入卸车净重!",
- })
- return
- }
- if (this.fileList1.length == 0) {
- this.$refs.uToast.show({
- type: 'error',
- message: "卸车照片不能为空!",
- })
- return
- }
- if (this.fileList2.length == 0) {
- this.$refs.uToast.show({
- type: 'error',
- message: "请上传回单照片!",
- })
- return
- }
- this.alertContent = '确定提交卸车信息?'
- }
- // if(!this.detailData.totalFreight){
- // this.$refs.uToast.show({
- // type: 'error',
- // message: "请输入合计运费!",
- // })
- // return
- // }
- // this.detailData.publishTaskInfo.unsendLatitude //任务卸车所在地经纬度
- // this.detailData.publishTaskInfo.unsendLongitude
- 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 = "当前定位与运单卸货地不符,请在指定地点确认卸车,如果卸货地发生变化,请修改本页面基本信息中的卸货地址!",
- this.distance = true
- return
- }
- }
- this.isShowAlert = true
- this.detailData.statusFlag = type
- },
- async stopMap() {
- console.log("sjdaisdjdsi")
- let that = this
- let _isSubmit = true
- 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)
- try {
- await this.sdkWxStop().then((res) => {
- console.log(2, res)
- })
- } catch (e) {
- uni.hideLoading()
- console.log(22, e.data.errorMsg)
- that.$refs.uToast.show({
- type: 'error',
- message: e.data.errorMsg,
- })
- _isSubmit = false
- }
- return _isSubmit
- },
- sdkWxStop() {
- let that = this
- return new Promise((resolve, reject) => {
- let remark = ""
- sdkwx.stop(this.detailData.carNumber, this.detailData.driverName, remark, this
- .shippingNoteInfos,
- function(res) {
- console.log(1)
- if (res.type == "onSuccess") {
- resolve(res)
- console.log("结束成功!!!", res)
- //成功
- } else if (res.type == "onFailure") {
- console.log("结束成功!!失败!", res)
- //失败
- reject(res)
- // var errorCode = res.data.errorCode; //错误码
- // var errorMsg = res.data.errorMsg; //错误描述
- // that.$refs.uToast.show({
- // type: 'error',
- // message: errorMsg,
- // })
- // return
- }
- })
- })
- },
- async confirmClick() {
- var that = this
- if (this.detailData.statusFlag == 1) {
- delete this.detailData.carrierInfo.unloadingAreaLongitude;
- delete this.detailData.carrierInfo.unloadingAreaLatitude;
- delete this.detailData.carrierInfo.unloadCity;
- delete this.detailData.carrierInfo.unloadArea;
- }
- this.detailData.carrierInfo.statusFlag = this.detailData.statusFlag
- this.detailData.carrierInfo.unloadingImg = this.imgList.toString()
- this.detailData.carrierInfo.receiptImg = this.imgList1.toString()
- this.detailData.carrierInfo.unloadingWeight = this.detailData.unloadingWeight
- // if (!this.detailData.carrierInfo.totalFreight) {
- // uni.showToast({
- // title: '运费不能为空!',
- // duration: 2000,
- // icon: "none",
- // });
- // return
- // }
- // if (
- // this.detailData.carrierInfo.totalFreight < 0 || this.detailData.carrierInfo.totalFreight > 100000 || (
- // String(this.detailData.carrierInfo.totalFreight).indexOf('.') != -1 && String(this.detailData
- // .carrierInfo.totalFreight).length - (String(this.detailData.carrierInfo.totalFreight).indexOf(
- // '.') + 1) > 2)
- // ) {
- // uni.showToast({
- // title: '运费输入错误!',
- // duration: 2000,
- // icon: "none",
- // });
- // return
- // }
- this.isShowAlert = false
- 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
- }
- if (this.detailData.carrierInfo.unloadingDate) { //卸车时间 去当前时间的时分秒
- this.detailData.carrierInfo.unloadingDate = this.detailData.carrierInfo.unloadingDate.split(" ")[
- 0] +
- " " + h + ":" + f + ":" + m
- }
- this.detailData.carrierInfo.carNo = this.detailData.carNumber
- // if (this.detailData.statusFlag != 1 && this.detailData.orderStatus == "运输中") {
- // let _data = await this.stopMap()
- // console.log(3)
- // if (!_data) return
- // }
- this.$request.baseRequest('post', '/carrierInfo/unLoadingAdd', this.detailData.carrierInfo).then(
- res => {
- console.log(4)
- if (res.code == 200) {
- let _title = ''
- if (this.detailData.statusFlag == 1) {
- _title = '暂存成功!'
- } else {
- that.stop()
- _title = '提交成功!'
- }
- uni.hideLoading()
- that.$refs.uToast.show({
- type: 'success',
- message: _title,
- complete() {
- uni.hideLoading()
- uni.switchTab({
- url: '/pages/order/index'
- })
- if (that.$helper.fUN_AmapLocation) {
- that.$helper.fUN_AmapLocation.stop({}, result => {
- console.log('====fUN_AmapLocation定位stop====', JSON
- .stringify(result));
- });
- }
- }
- })
- }
- })
- .catch(res => {
- uni.$u.toast(res.message);
- });
- },
- confirmValidityPeriod(date) {
- this.detailData.carrierInfo.unloadingDate = date.date
- },
- },
- }
- </script>
- <style scoped lang="scss">
- .content {
- .row-left-text {
- color: #333333;
- }
- }
- .level2-title {
- margin: 0 0 20rpx 0;
- }
- .content1,
- .content2 {
- background: white;
- margin: 20rpx;
- border-radius: 20rpx;
- padding: 20rpx;
- .place {
- width: 80%;
- text-align: right;
- }
- }
- .upload {}
- .bottom-btn {
- display: flex;
- justify-content: space-around;
- // margin-bottom: 50rpx;
- background: #FFFFFF;
- padding: 40rpx 0;
- }
- .store {
- padding: 20rpx 30rpx;
- color: #F5BA3C;
- width: 40%;
- background: #EEF4FF;
- border-radius: 40rpx;
- font-size: 36rpx;
- text-align: center;
- }
- .submit {
- font-size: 36rpx;
- padding: 20rpx 30rpx;
- color: white;
- width: 40%;
- background: #F5BA3C;
- border-radius: 40rpx;
- text-align: center;
- }
- .row-between {
- margin: 20rpx 0;
- }
- .sx-style {
- background: #F5BA3C;
- color: white;
- padding: 2rpx 16rpx;
- box-sizing: border-box;
- border-radius: 10rpx;
- margin-left: 20rpx;
- }
- .totalFreight-input {
- text-align: right;
- padding-right: 18px;
- }
- .close {
- position: absolute;
- right: 0;
- width: 15px;
- height: 15px;
- top: 50%;
- transform: translateY(-50%);
- }
- </style>
|