| | |
| | | <u-button class="btn-list" @click="goTravelItinerary" text="行程历史"></u-button> |
| | | |
| | | <!-- <u-button class="btn-budget" @click="goToAdvanceBudget" type="success" text="垫付预算"></u-button> --> |
| | | <u-button class="btn-submit" @click="submitForm" type="primary" text="提交"></u-button> |
| | | <u-button :loading="loading" class="btn-submit" @click="submitForm" type="primary" text="提交"></u-button> |
| | | </view> |
| | | |
| | | |
| | |
| | | import amap from '@/common/amap-wx.130.js' |
| | | |
| | | import store from '@/store' |
| | | import {uploadImage} from "@/common/upload"; |
| | | export default { |
| | | data() { |
| | | return { |
| | |
| | | // odometer: [{ required: true, message: '请输入仪表里程', trigger: 'change' }], |
| | | voucher: [{ required: true, message: '请上传凭证', trigger: 'blur' }] |
| | | }, |
| | | |
| | | isHk: false, |
| | | loading: false |
| | | }; |
| | | }, |
| | | onLoad(options) { |
| | |
| | | this.amapPlugin = new amap.AMapWX({ |
| | | key: this.mapApiKey |
| | | }); |
| | | this.getLocation(); |
| | | // 获取 URL 参数 |
| | | if (options.id) { |
| | | this.getList(); |
| | |
| | | }, |
| | | // 新增图片 |
| | | async afterRead(event) { |
| | | // 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式 |
| | | let lists = [].concat(event.file) |
| | | let fileListLen = this.fileList.length |
| | | lists.map((item) => { |
| | | this.fileList.push({ |
| | | ...item, |
| | | status: 'success', |
| | | message: '上传中' |
| | | }) |
| | | }) |
| | | for (let i = 0; i < lists.length; i++) { |
| | | |
| | | const result = await this.uploadFilePromise(lists[i].url) |
| | | let item = this.fileList[fileListLen] |
| | | this.fileList.splice(fileListLen, 1, Object.assign(item, { |
| | | status: result.status, |
| | | message: result.status == 'success' ? '上传成功' : '上传失败', |
| | | urls: result.url |
| | | })) |
| | | fileListLen++ |
| | | } |
| | | console.log(event) |
| | | uploadImage(event.file[0].url,this.isHk).then(res=>{ |
| | | console.log(res) |
| | | this.fileList.push(res); |
| | | }) |
| | | // console.log(event) |
| | | // // 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式 |
| | | // let lists = [].concat(event.file) |
| | | // let fileListLen = this.fileList.length |
| | | // lists.map((item) => { |
| | | // this.fileList.push({ |
| | | // ...item, |
| | | // status: 'success', |
| | | // message: '上传中' |
| | | // }) |
| | | // }) |
| | | // for (let i = 0; i < lists.length; i++) { |
| | | // |
| | | // const result = await this.uploadFilePromise(lists[i].url) |
| | | // let item = this.fileList[fileListLen] |
| | | // this.fileList.splice(fileListLen, 1, Object.assign(item, { |
| | | // status: result.status, |
| | | // message: result.status == 'success' ? '上传成功' : '上传失败', |
| | | // urls: result.url |
| | | // })) |
| | | // fileListLen++ |
| | | // } |
| | | }, |
| | | |
| | | uploadFilePromise(url) { |
| | |
| | | }, |
| | | |
| | | submitForm() { |
| | | |
| | | if(this.loading){ |
| | | return; |
| | | } |
| | | if (this.fileList.length == 0) { |
| | | uni.$u.toast('图片上传不能为空') |
| | | return |
| | | } |
| | | |
| | | console.log(this.loading); |
| | | this.loading = true; |
| | | this.$refs.uForm.validate().then(res => { |
| | | if (res) { |
| | | |
| | | if (this.newForm.statusStr == '待甩挂') { |
| | | |
| | | var urls = this.fileList.map(item => item.urls).join(','); |
| | | var urls = this.fileList.map(item => item.url).join(','); |
| | | this.form.voucherUrl = urls |
| | | this.form.dispatchOrderId = this.newForm.dispatchId |
| | | this.form.driverId = this.newForm.driverId |
| | | |
| | | |
| | | carSubmitDropHoo(this.form).then((res) => { |
| | | |
| | | |
| | | this.form = { |
| | | address: '', |
| | | tripTime: '', |
| | |
| | | if (res == 1) { |
| | | uni.$u.toast('操作成功') |
| | | } |
| | | }) |
| | | }).catch(()=>{ |
| | | setTimeout(()=>{ |
| | | this.loading = false |
| | | },2000) |
| | | }) |
| | | |
| | | |
| | | } else if (this.newForm.statusStr == '待接挂') { |
| | | |
| | | var urls = this.fileList.map(item => item.urls).join(','); |
| | | var urls = this.fileList.map(item => item.url).join(','); |
| | | this.form.voucherUrl = urls |
| | | this.form.dispatchOrderId = this.newForm.dispatchId |
| | | this.form.driverId = this.newForm.driverId |
| | |
| | | |
| | | this.cleanedForm = this.cleanFormData({ ...this.form }) |
| | | carSubmitPickHook(this.cleanedForm).then((res) => { |
| | | setTimeout(()=>{ |
| | | this.loading = false |
| | | },2000) |
| | | this.form = { |
| | | address: '', |
| | | tripTime: '', |
| | |
| | | if (res == 1) { |
| | | uni.$u.toast('操作成功') |
| | | } |
| | | }) |
| | | }).catch(()=>{ |
| | | setTimeout(()=>{ |
| | | this.loading = false |
| | | },2000) |
| | | }) |
| | | |
| | | } |
| | | |
| | |
| | | |
| | | }).catch(errors => { |
| | | uni.$u.toast('校验失败') |
| | | setTimeout(()=>{ |
| | | this.loading = false |
| | | },2000) |
| | | }) |
| | | this.$forceUpdate(); |
| | | }, |
| | |
| | | this.amapPlugin.getRegeo({ |
| | | location:`${longitude},${latitude}`, |
| | | success: (data) => { |
| | | this.form.address = data[0].name; |
| | | let datum = data[0]; |
| | | if (datum.regeocodeData){ |
| | | if (datum.regeocodeData.addressComponent){ |
| | | let province = datum.regeocodeData.addressComponent.province; |
| | | this.isHk = province.indexOf("香港") != -1; |
| | | } |
| | | } |
| | | |
| | | |
| | | this.form.address = datum.name; |
| | | }, |
| | | fail: (err) => { |
| | | console.error("SDK调用失败:", err); |