123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991 |
- <!-- 确认装车 -->
- <template>
- <view class="content">
- <div class='content1'>
- <view class="level2-title">承运合同</view>
- <view class='row-between'>
- <view class="">合同编号</view>
- <view class="" @click="toSignContract">{{detailData.contractNo?detailData.contractNo:'去签订合同'}}</view>
- </view>
- </div>
- <view class="content2">
- <view class="level2-title">基本信息</view>
- <view class='row-between'>
- <view class="">订单编号</view>
- <view class="">{{detailData.orderNo}}</view>
- </view>
- <view class='row-between'>
- <view class="">货主</view>
- <view class="">{{detailData.cargoOwner}}</view>
- </view>
- <view class='row-between'>
- <view class="">货主单位</view>
- <view class="">{{detailData.compName?detailData.compName:'个人货主'}}</view>
- </view>
- <view class='row-between'>
- <view class="">发货地</view>
- <view class=" place">
- {{detailData.sendPrivate}}{{detailData.sendCity}}{{detailData.sendArea}}{{detailData.sendDetailedAddress}}
- </view>
- </view>
- <view class='row-between'>
- <view class="">卸货地</view>
- <view class=" place">
- {{detailData.unloadPrivate}}{{detailData.unloadCity}}{{detailData.unloadArea}}{{detailData.unloadDetailedAddress}}
- </view>
- </view>
- <view class='row-between'>
- <view class="">货名</view>
- <view class="">{{detailData.goodsName}}</view>
- </view>
- <!-- <view class='row-between'>
- <view class="">运费</view>
- <view class="">{{detailData.freight}}{{detailData.illingMethod==0?'元/吨':'元/车'}}</view>
- </view>-->
- </view>
- <view class="content2">
- <view class="level2-title">装车信息</view>
- <view class='row-between'>
- <view class="">车牌号</view>
- {{detailData.carNo?detailData.carNo:"来自合同"}}
- <!-- <input class="car-uumber input" v-model='detailData.carrierInfo.carNo'
- :disabled="true" placeholder="输入车牌号" name="input" disabled="true"></input> -->
- </view>
- <view class='row-between'>
- <view class="">装车日期</view>
- <view class="date-style">
- {{detailData.loadingDate1?detailData.loadingDate1:'来自合同'}}
- </view>
- </view>
- <view class='row-between'>
- <view class="">装车毛重(吨)</view>
- {{detailData.grossWeight ? detailData.grossWeight:"来自合同"}}
- </view>
- <view class='row-between'>
- <view class="">装车净重(吨)</view>
- {{detailData.weight ? detailData.weight:"来自合同"}}
- </view>
- <view class='row-between'>
- <view class="">预计运费(元)</view>
- <view class="">{{detailData.driverContract == 1 ? detailData.freight:"来自合同"}}</view>
- <!-- {{detailData.freight ? detailData.freight:"来自合同"}} -->
- <!-- <view class=""><input class="input" type="text" value="" v-model="detailData.carrierInfo.freight"
- placeholder="请输入运费"></view> -->
- </view>
- <view class='row-between'>
- <view class="">预付款(元)</view>
- {{detailData.advanceCharge ? detailData.advanceCharge:"0"}}
- <!-- <view class=""><input class="input" type="text" value="" v-model="detailData.carrierInfo.freight"
- placeholder="请输入运费"></view> -->
- </view>
- <view class='row-between'>
- <view class="">定位</view>
- <view class="flex align-center">{{localtion.city}}
- {{localtion.sendArea}}
- <view class="sx-style" @click.stop="getLngLat()">刷新</view>
- </view>
- </view>
- <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>
- </view>
- </view>
- <view class='s-flex'>
- <view class="" style="margin:20rpx 0;">上传装车照片</view>
- <u-upload class="uview-upload" :fileList="fileList1" @afterRead="afterRead($event)" @delete="deletePic"
- name="1" :multiple='true' :maxCount="3"></u-upload>
- </view>
- <!-- <view class='s-flex'>
- <view class="">上传装车磅单</view>
- <upload class="upload" ref="upload" :action="action" :max-size="maxSize" :max-count="1"
- :size-type="['compressed']" @on-success="getImgUrl" @on-error="onError" @on-remove="onRemove"
- @on-uploaded="isAdd = true" :before-upload="filterFileType" @on-progress="onProgress"></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>
- <master-keyboard ref="keyboard" keyboardtype="car" :show="keyShow" :randomNumber="true" :newCar="false"
- :defaultValue="carNumber" @keyboardClick="handleClick"></master-keyboard>
- <u-toast ref="uToast"></u-toast>
- <u-calendar :show="showDate" :mode="mode" @confirm="confirmDate" @close="showDate= false"></u-calendar>
- </view>
- </template>
- <script>
- var that;
- //插件对象
- var sdkwx = uni.requireNativePlugin('Hdgq-LocSdkWX');
- import uploadImage from '@/components/ossutil/uploadFile.js';
- import * as config from '@/config/index.js'
- import {
- mapState
- } from 'vuex';
- export default {
- data() {
- return {
- firstAuthentication: {},
- cyId: '',
- localtion: {
- city: '',
- sendArea: ''
- },
- imgList: [],
- fileList1: [],
- showDate: false,
- mode: 'single',
- id: '',
- sourceType: ['camera'],
- detailData: {
- hyCarrierInfo: {},
- loadingDate: {}
- },
- action: this.$helper.ossUploadUrl,
- maxSize: 50 * 1024 * 1024, //限制文件大小 50M
- isAdd: true,
- isShowAlert: false,
- alertContent: '',
- alertTitle: '',
- keyShow: false,
- carNumber: '',
- gjList: [],
- //网络货运信息定位
- appId: "", //网络货运企业APP的唯一标识
- appSecurity: "", //网络货运企业在省平台申请的接入安全码
- enterpriseSenderCode: "", //网络货运企业在省平台申请的企业发送代码
- environment: "debug", //环境:“debug”接入测试环境,“release”接入正式环境。
- shippingNoteInfos: [{
- shippingNoteNumber: '',
- serialNumber: "",
- startCountrySubdivisionCode: "",
- endCountrySubdivisionCode: "",
- startLongitude: "",
- startLatitude: "",
- endLongitude: "",
- endLatitude: "",
- startLocationText: "",
- endLocationText: "",
- vehicleNumber: "",
- driverName: "",
- interval: "",
- }],
- timer: null
- }
- },
- onLoad(options) {
- that = this
- let phoneType = uni.getSystemInfoSync().platform //判断手机类型
- this.enterpriseSenderCode = config.def().enterpriseSenderCode
- this.environment = config.def().environment
- if (phoneType == "android") {
- this.appId = config.def().androidAppId
- this.appSecurity = config.def().androidAppSecurity
- } else if (phoneType == "ios") {
- // this.appId = "uni.UNIDCD13AC"
- // this.appSecurity = "b01e4805276646eeb25f0fad91de97a4f32e8c2c0e0d42e5b24cc4737e9f040f"
- this.appId = config.def().iosAppId
- this.appSecurity = config.def().iosAppSecurity
- }
- if (!uni.getStorageSync('contractdata')) {
- this.id = JSON.parse(decodeURIComponent(options.obj)).id
- this.detailData.hyCarrierInfo.id = JSON.parse(decodeURIComponent(options.obj)).carrierId
- this.cyId = JSON.parse(decodeURIComponent(options.obj)).carrierId
- this.getInfo()
- }
- console.log(options)
- var isContains = true; //隐私权政策是否包含高德开平隐私权政策 true是包含
- var isShow = true; //隐私权政策是否弹窗展示告知用户 true是展示
- sdkwx.updatePrivacyShow(isContains, isShow);
- var isAgree = true; //隐私权政策是否取得用户同意 true是用户同意
- sdkwx.updatePrivacyAgree(isAgree);
- //检查定位权限
- sdkwx.checkLocationPermission(function(res) {
- console.log(res);
- });
- // this.auth()
- },
- 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
- this.cyId = uni.getStorageSync('contractdata').carrierId
- this.getInfo()
- }
- },
- computed: {
- ...mapState(['hasLogin', 'userInfo'])
- },
- methods: {
- toSignContract() {
- console.log(this.detailData)
- this.$request.baseRequest('get', '/orderInfo/getOrderInfo', {
- id: this.id,
- }).then(res => {
- uni.$u.route('/pages/order/signContract', {
- obj: JSON.stringify(res.data),
- });
- });
- },
- selectDate() {
- this.showDate = true
- },
- confirmDate(e) {
- this.detailData.hyCarrierInfo.loadingDate = e[0]
- this.showDate = false
- },
- getInfo() {
- this.$request.baseRequest('get', '/orderInfo/getOrderInfo', {
- id: this.id,
- }).then(res => {
- if (res.code == 200) {
- this.detailData = res.data
- if (res.data.hyCarrierInfo && res.data.hyCarrierInfo.transportationDuration) {
- this.detailData.transportationDuration = res.data.hyCarrierInfo.transportationDuration
- }
- // #ifdef APP-PLUS
- this.getLngLat();
- // #endif
- this.$request.baseRequest('get', '/carrierInfo/getHyCarrierInfo', {
- orderId: this.detailData.id,
- }).then(res => {
- if (res.data) {
- if (res.data.loadingImg) {
- var data = res.data.loadingImg.split(',')
- this.imgList = res.data.loadingImg.split(',')
- for (var i = 0; i < data.length; i++) {
- if (data[i] != '') {
- this.fileList1.push({
- url: data[i]
- })
- }
- }
- }
- 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]
- }
- this.detailData.weight = res.data.loadingWeight
- this.detailData.grossWeight = res.data.loadingGrossWeight
- this.detailData.freight = res.data.estimatedFreight
- }
- })
- }
- })
- },
- //车牌号弹出键盘
- handleShowKeyboard() {
- if (this.detailData.hyCarrierInfo.carNo == '') {
- this.carNumber = ''
- } else {
- this.carNumber = this.detailData.hyCarrierInfo.carNo
- }
- if (this.$refs.keyboard.open) {
- this.$refs.keyboard.open(false) //true 键盘显示 false 键盘隐藏
- } else {
- this.$refs.keyboard[0].open(false)
- }
- if (this.$refs.keyboard.open) {
- this.$refs.keyboard.open(true) //true 键盘显示 false 键盘隐藏
- } else {
- this.$refs.keyboard[0].open(true)
- }
- },
- //车牌号弹出键盘
- handleClick(e) {
- this.carNumber = e.value
- this.detailData.hyCarrierInfo.carNo = e.value //键盘输入值
- },
- checkOpenGPSServiceByAndroidIOS() {
- 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.isProviderEnabled(locationManager.GPS_PROVIDER)) {
- uni.showModal({
- title: '提示',
- content: '请打开定位服务功能',
- // showCancel: false, // 不显示取消按钮
- success(res) {
- if (res.confirm) {
- if (!mainSvr.isProviderEnabled(locationManager.GPS_PROVIDER)) {
- 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);
- main.startActivity(intent); // 打开系统设置GPS服务页面
- }
- }
- }
- });
- }
- } 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) {
- console.log("手机系统的定位已经打开");
- } else {
- console.log("手机系统的定位没有打开");
- uni.showModal({
- title: '提示',
- content: '请前往设置-隐私-定位服务打开定位服务功能',
- // showCancel: false, // 不显示取消按钮
- success(res) {
- if (res.confirm) {
- var UIApplication = plus.ios.import("UIApplication");
- var application2 = UIApplication.sharedApplication();
- var NSURL2 = plus.ios.import("NSURL");
- // var setting2 = NSURL2.URLWithString("prefs:root=LOCATION_SERVICES");
- // var setting2 = NSURL2.URLWithString("App-Prefs:root=LOCATION_SERVICES");
- // var setting2 = NSURL2.URLWithString("app-settings");
- var setting2 = NSURL2.URLWithString("App-Prefs:root=Privacy&path=LOCATION");
- // var setting2 = NSURL2.URLWithString("App-Prefs:root=Privacy&path=LOCATION_SERVICES");
- application2.openURL(setting2);
- plus.ios.deleteObject(setting2);
- plus.ios.deleteObject(NSURL2);
- plus.ios.deleteObject(application2);
- }
- }
- });
- }
- }
- },
- getLngLat() {
- this.checkOpenGPSServiceByAndroidIOS()
- var that = this
- uni.showLoading({
- title: '获取定位中',
- mask: true
- })
- uni.getLocation({
- type: 'gcj02',
- geocode: true,
- success: res => {
- if (res.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.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()
- }
- });
- },
- cancelClick() {
- this.isShowAlert = false
- },
- // 删除图片
- deletePic(event) {
- this[`fileList${event.name}`].splice(event.index, 1)
- this.imgList.splice(event.index, 1)
- },
- // 新增图片
- 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++
- }
- },
- uploadFilePromise(url) {
- uploadImage('image', url, 'appData/',
- result => {
- // 上传成功回调函数
- console.log('图片地址', result)
- this.imgList.push(result)
- }
- )
- },
- onProgress(e) {
- console.log(e)
- },
- submit(type) {
- if (type == 1) {
- if (this.detailData.driverContract != 1) { //合同签订标识
- this.$refs.uToast.show({
- type: 'error',
- message: "合同未签订不能暂存!"
- })
- return
- }
- this.alertTitle = '确定暂存装车信息?'
- } else {
- if (this.detailData.driverContract != 1) {
- this.$refs.uToast.show({
- type: 'error',
- message: "合同未签订不能提交!"
- })
- return
- }
- this.alertTitle = '确定提交装车信息?'
- }
- if (this.validate()) return
- this.isShowAlert = true
- this.detailData.statusFlag = type
- },
- validate() {
- if (uni.$u.test.isEmpty(this.detailData.carNo)) {
- this.$refs.uToast.show({
- type: 'error',
- message: "车牌号不能为空!",
- })
- return true
- }
- if (uni.$u.test.isEmpty(this.detailData.loadingDate)) {
- this.$refs.uToast.show({
- type: 'error',
- message: "装车日期不能为空!",
- })
- return true
- }
- if (uni.$u.test.isEmpty(this.detailData.freight)) {
- this.$refs.uToast.show({
- type: 'error',
- message: "预计运费不能为空!",
- })
- return true
- }
- // if (uni.$u.test.isEmpty(this.detailData.loadingCity)) {
- // this.$refs.uToast.show({
- // type: 'error',
- // message: "定位不能为空!",
- // })
- // return true
- // }
- // if (uni.$u.test.isEmpty(this.detailData.loadingArea)) {
- // this.$refs.uToast.show({
- // type: 'error',
- // message: "定位不能为空!",
- // })
- // return true
- // }
- if (uni.$u.test.isEmpty(this.detailData.transportationDuration)) {
- this.$refs.uToast.show({
- type: 'error',
- message: "运输时长不能为空!",
- })
- return true
- }
- if (this.detailData.transportationDuration < 0 || this.detailData.transportationDuration > 1000) {
- this.$refs.uToast.show({
- type: 'error',
- message: "运输时长输入错误!",
- })
- return true
- }
- if (this.imgList.length == 0) {
- this.$refs.uToast.show({
- type: 'error',
- message: "装车照片不能为空!",
- })
- return true
- }
- },
- affirm(data) {
- this.$request.baseRequest('post', '/carrierInfo/loadingAdd', data).then(res => {
- console.log("提交状态", res)
- uni.hideLoading()
- if (res.code == 200) {
- that.$refs.uToast.show({
- type: 'success',
- message: '暂存成功',
- complete() {
- uni.switchTab({
- url: '/pages/order/index'
- })
- }
- })
- }
- }).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.submitInfo(data) //先调用管局start
- }
- },
- async submitInfo(data) {
- console.log(11)
- let _auth = await this.auth()
- if (_auth.type == "onFailure") {
- that.$refs.uToast.show({
- type: 'error',
- message: "管局授权失败-" + res.data.errorMsg
- })
- return
- }
- // then(res => {
- // if (res.type == "onFailure") {
- // that.$refs.uToast.show({
- // type: 'error',
- // message: "管局授权失败-" + res.data.errorMsg
- // })
- // return
- // }
- // })
- let _start = this.start()
- if (_start.type == 'onFailure') {
- that.$refs.uToast.show({
- type: 'error',
- message: "管局上报-" + res.data.errorMsg
- })
- return
- }
- // .then(res => {
- // console.log(4)
- // var shippingNoteInfos = res.data[0]; //运单信息列表
- // if (res.type == "onSuccess") {
- // } else if (res.type == "onFailure") {
- // that.$refs.uToast.show({
- // type: 'error',
- // message: "管局上报1-" + res.data.errorMsg
- // })
- // return
- // }
- // })
- console.log("_start", _start)
- let _send = await this.send()
- // .then(res => {
- // console.log(6)
- // if (res.type == "onSuccess") {
- // var shippingNoteInfos = res.data[0]; //运单信息列表
- // let dateTtime = Number(shippingNoteInfos.interval + 1000)
- // that.timer = setTimeout(() => {
- // that.send()
- // }, dateTtime);
- // } else if (res.type == "onFailure") {
- // var errorCode = res.data.errorCode; //错误码
- // var errorMsg = res.data.errorMsg; //错误描述
- // that.$refs.uToast.show({
- // type: 'error',
- // message: "管局上报2-" + errorMsg
- // })
- // return
- // }
- // })
- console.log("_send", _send)
- if (_send.type == "onSuccess") {
- var shippingNoteInfos = _send.data[0]; //运单信息列表
- let dateTtime = Number(shippingNoteInfos.interval + 1000)
- that.timer = setTimeout(() => {
- that.send()
- }, dateTtime);
- } else if (_send.type == "onFailure") {
- var errorCode = _send.data.errorCode; //错误码
- var errorMsg = _send.data.errorMsg; //错误描述
- that.$refs.uToast.show({
- type: 'error',
- message: "管局上报-" + errorMsg
- })
- return
- }
- console.log(35453454)
- this.$request.baseRequest('post', '/carrierInfo/loadingAdd', data).then(res => {
- console.log("提交状态", res)
- uni.hideLoading()
- if (res.code == 200) {
- 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("条数", uni.getStorageSync('mapGJ').length)
- if (uni.getStorageSync('mapGJ').length > 10) {
- 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);
- });
- }
- }
- );
- that.$refs.uToast.show({
- type: 'success',
- message: '提交成功!',
- 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,
- })
- });
- },
- auth() {
- //授权
- // console.log("appid:" + this.appId + "安全码:" + this.appSecurity + "发送代码:" + this.enterpriseSenderCode +
- // "环境" + this.environment)
- console.log(2)
- let promise = new Promise(function(resolve, reject) {
- sdkwx.auth(that.appId, that.appSecurity, that.enterpriseSenderCode, that.environment, function(
- res) {
- console.log("authres", res)
- resolve(res)
- });
- })
- return promise
- },
- start() {
- console.log(3)
- //车牌号 //司机姓名 //备注 //运单信息列表
- 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 = "测试"; //备注
- var param = {}
- param.carNo = this.detailData.carNo
- param.driverName = this.firstAuthentication.driverName
- param.remark = remark
- param.shippingNoteInfos = this.shippingNoteInfos
- let promise = new Promise(function(resolve, reject) {
- sdkwx.start(that.detailData.carNo, that.firstAuthentication.driverName, remark, that
- .shippingNoteInfos,
- function(res) {
- console.log("startres", res)
- resolve(res)
- });
- })
- return promise
- },
- send() { //发送定位
- console.log(5)
- var remark = ""; //备注
- let that = this
- console.log("send this.shippingNoteInfos")
- console.log(this.shippingNoteInfos)
- let promise = new Promise(function(resolve, reject) {
- sdkwx.send(that.detailData.carNo, that.firstAuthentication.driverName, remark, that
- .shippingNoteInfos,
- function(res) {
- resolve(res)
- });
- })
- return promise
- },
- // send() { //发送定位
- // console.log(5)
- // var remark = ""; //备注
- // let that = this
- // console.log("send this.shippingNoteInfos")
- // console.log(this.shippingNoteInfos)
- // sdkwx.send(this.detailData.carNo, this.firstAuthentication.driverName, remark, this.shippingNoteInfos,
- // function(res) {
- // console.log('发送定位', res);
- // if (res.type == "onSuccess") {
- // var shippingNoteInfos = res.data[0]; //运单信息列表
- // let dateTtime = Number(shippingNoteInfos.interval + 1000)
- // console.log("开始定时", dateTtime)
- // that.timer = setTimeout(() => {
- // that.send()
- // }, dateTtime);
- // } else if (res.type == "onFailure") {
- // var errorCode = res.data.errorCode; //错误码
- // var errorMsg = res.data.errorMsg; //错误描述
- // that.timer = setTimeout(() => {
- // console.log("定时")
- // that.send()
- // }, 915204); //15分钟
- // // that.$refs.uToast.show({
- // // type: 'error',
- // // message: "管局上报-" + errorMsg
- // // })
- // }
- // });
- // },
- },
- }
- </script>
- <style scoped lang="scss">
- .content {
- // . {
- // 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;
- }
- .input {
- text-align: right;
- }
- .date-style {}
- </style>
|