| | |
| | | </u-form-item> --> |
| | | |
| | | |
| | | <u-form-item ref="item1" borderBottom label=" " labelWidth="0" prop="" :borderBottom="false"> |
| | | <u-form-item ref="item1" borderBottom label=" " labelWidth="0" prop="" :borderBottom="false" v-if="uploadAreas.length > 0"> |
| | | <view style="display: flex;align-items: center;"><u--image :showLoading="true" src="/static/bt.png" |
| | | width="20px" height="20px"></u--image>凭证<span |
| | | style="color: #c6c0ba;margin-left: 10px;display: inline-block;"></span></view> |
| | |
| | | <u-button class="btn-list" @click="goThistory" text="行程历史"></u-button> |
| | | <u-button class="btn-list" @click="goToAdvanceList" 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> |
| | | |
| | | </view> |
| | |
| | | <u-button class="btn-list" @click="goThistory" text="行程历史"></u-button> |
| | | <u-button class="btn-list" @click="goToAdvanceList" 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> |
| | | |
| | | |
| | |
| | | </u-number-box> |
| | | |
| | | |
| | | |
| | | </view> |
| | | |
| | | <view v-if="form.tripType == '5'" style="display: flex; align-items: center; width: 100%; margin-top: 15px"> |
| | | <view style="display: flex; align-items: center; flex-shrink: 0; margin-right: 10px;"> |
| | | <u--image :showLoading="true" src="/static/bt.png" width="20px" height="20px"></u--image> |
| | | <text>是否查车:</text> |
| | | |
| | | </view> |
| | | |
| | | <u-radio-group |
| | | v-model="form.iscc" iconPlacement="right" |
| | | placement="row"> |
| | | <u-radio label="是" name="0" style="margin-right: 20px"></u-radio> |
| | | <u-radio label="否" name="1"></u-radio> |
| | | </u-radio-group> |
| | | |
| | | |
| | | |
| | | </view> |
| | | |
| | | |
| | |
| | | <u-button class="cancel-btn" @click="showPopup = false" type="info" plain> |
| | | 取消 |
| | | </u-button> |
| | | <u-button class="submit-btn" @click="handleSubmit" type="primary"> |
| | | <u-button class="submit-btn" @click="handleSubmit" type="primary"> |
| | | 提交 |
| | | </u-button> |
| | | </view> |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | import {uploadImage} from "@/common/upload"; |
| | | |
| | | function groupBy(array, key){ |
| | | return array.reduce((acc, item) => { |
| | | const groupKey = String(item[key]); |
| | |
| | | }, |
| | | mapList: {}, |
| | | activeActive: {}, |
| | | |
| | | |
| | | isHk:false, |
| | | loading: false |
| | | }; |
| | | }, |
| | | onLoad(options) { |
| | |
| | | this.amapPlugin = new amap.AMapWX({ |
| | | key: this.mapApiKey |
| | | }); |
| | | |
| | | // 获取 URL 参数 |
| | | if (options.id) { |
| | | //this.getList(); |
| | |
| | | this.form.tripTime = this.getCurrentDateTime(); |
| | | |
| | | } |
| | | |
| | | this.getLocation(); |
| | | }, |
| | | created() { |
| | | // this.getList(); |
| | |
| | | success: (res) => { |
| | | const latitude = res.latitude; |
| | | const longitude = res.longitude; |
| | | this.form.longitude =longitude; |
| | | this.form.latitude =latitude; |
| | | this.getAddress(latitude, longitude); |
| | | }, |
| | | fail: (err) => { |
| | |
| | | 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); |
| | |
| | | else if (type == '2'||type == '6'){ // 到达装货点 到达卸货点 |
| | | this.uploadAreas = [ |
| | | { name: '车头', imageUrl: '',required: true }, |
| | | { name: '车尾(非必填)', imageUrl: '',required: false }, |
| | | { name: '仪表盘(非必填)', imageUrl: '',required: false }, |
| | | // { name: '车尾(非必填)', imageUrl: '',required: false }, |
| | | // { name: '仪表盘(非必填)', imageUrl: '',required: false }, |
| | | |
| | | |
| | | ] |
| | |
| | | this.uploadAreas = [ |
| | | { name: '车头', imageUrl: '',required: true }, |
| | | { name: '车尾', imageUrl: '',required: true }, |
| | | { name: '仪表盘(非必填)', imageUrl: '',required: false }, |
| | | // { name: '仪表盘(非必填)', imageUrl: '',required: false }, |
| | | ] |
| | | }else if (type == '4'||type == '5'){// 到达清关场地 离开清关场地 |
| | | this.uploadAreas = [ |
| | | { name: '仪表盘(非必填)', imageUrl: '',required: false }, |
| | | { name: '车头(非必填)', imageUrl: '',required: false }, |
| | | { name: '车尾(非必填)', imageUrl: '',required: false }, |
| | | // { name: '仪表盘(非必填)', imageUrl: '',required: false }, |
| | | // { name: '车头(非必填)', imageUrl: '',required: false }, |
| | | // { name: '车尾(非必填)', imageUrl: '',required: false }, |
| | | ] |
| | | }else if (type == '8'){ |
| | | this.uploadAreas = [ |
| | | { name: '车头', imageUrl: '',required: true }, |
| | | { name: '仪表盘', imageUrl: '',required: true }, |
| | | |
| | | { name: '车尾', imageUrl: '',required: true }, |
| | | { name: '承运单', imageUrl: '',required: false }, |
| | | ] |
| | | }else{ |
| | | this.uploadAreas = [ |
| | |
| | | if (['3','5','7'].includes(type)){ |
| | | let item = this.tmsTripTables[0] || {}; |
| | | this.form.odometer = item.odometer; |
| | | this.form.iscc = "1"; |
| | | }else{ |
| | | this.form.odometer = 0 |
| | | } |
| | |
| | | // 新增图片 |
| | | 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: '上传中' |
| | | }) |
| | | uploadImage(event.file[0].url,this.isHk).then(res=>{ |
| | | console.log(res) |
| | | this.fileList.push(res); |
| | | }) |
| | | 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++ |
| | | } |
| | | // 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) { |
| | |
| | | sizeType: ['original', 'compressed'], |
| | | sourceType: ['album', 'camera'], |
| | | success: (res) => { |
| | | const tempFilePaths = res.tempFilePaths; |
| | | const imgUrl = tempFilePaths[0]; |
| | | uploadImage(imgUrl,this.isHk).then(res2=>{ |
| | | this.uploadAreas[index].imageUrl = res2.url; |
| | | // const tempFilePath = res.tempFilePaths[0]; |
| | | // // 上传图片到服务器 |
| | | // this.uploadAreaPic(tempFilePath, index); |
| | | }) |
| | | |
| | | const tempFilePath = res.tempFilePaths[0]; |
| | | // 上传图片到服务器 |
| | | this.uploadAreaPic(tempFilePath, index); |
| | | } |
| | | }); |
| | | }, |
| | |
| | | |
| | | // 表单提交时验证图片是否完整(根据需求调整必填项) |
| | | submitForm() { |
| | | |
| | | if(this.loading){ |
| | | return; |
| | | } |
| | | |
| | | // 根据当前激活的标签页执行不同的提交逻辑 |
| | | if (this.activeTab == 'upload') { |
| | |
| | | } else { |
| | | // 验证是否至少上传了一张图片 |
| | | // 收集所有上传的图片地址(用逗号分隔) |
| | | |
| | | this.loading = true; |
| | | const voucherUrls = this.uploadAreas.filter(item => item.imageUrl!=='').map(item => item.imageUrl).join(','); |
| | | this.form.voucherUrl = voucherUrls; |
| | | |
| | |
| | | if (this.form.tripType == 1) { |
| | | /*设置 */ |
| | | // console.log(this.form); |
| | | |
| | | setTimeout(()=>{ |
| | | this.loading = false |
| | | },2000) |
| | | uni.setStorageSync("signContractForm", this.form); |
| | | setTimeout(() => { |
| | | uni.$u.route('/pages/signContract/index'); |
| | |
| | | /* 上传行程发车 */ |
| | | carUploadTrip(this.form).then((res) => { |
| | | if (res == 1) { |
| | | setTimeout(()=>{ |
| | | this.loading = false |
| | | },2000) |
| | | uni.$u.toast('操作成功') |
| | | // 重置表单 |
| | | this.form = { |
| | |
| | | } |
| | | }).catch(err => { |
| | | uni.$u.toast('提交失败') |
| | | setTimeout(()=>{ |
| | | this.loading = false |
| | | },2000) |
| | | }) |
| | | } |
| | | |
| | | } |
| | | }).catch(errors => { |
| | | uni.$u.toast('校验失败') |
| | | setTimeout(()=>{ |
| | | this.loading = false |
| | | },2000) |
| | | }) |
| | | |
| | | |
| | |
| | | |
| | | this.$refs.uForm.validate().then(res => { |
| | | if (res) { |
| | | var urls = this.fileList.map(item => item.urls).join(','); |
| | | var urls = this.fileList.map(item => item.url).join(','); |
| | | this.form.feeVoucherUrl = urls |
| | | this.form.dispatchOrderId = this.newForm.dispatchId |
| | | this.form.driverId = this.newForm.driverId |
| | |
| | | this.cleanedForm = this.cleanFormData({ ...this.form }) |
| | | carUploadFinance(this.cleanedForm).then((res) => { |
| | | if (res == 1) { |
| | | setTimeout(()=>{ |
| | | this.loading = false |
| | | },2000) |
| | | uni.$u.toast('操作成功') |
| | | // 重置表单 |
| | | this.form = { |
| | |
| | | } |
| | | }).catch(err => { |
| | | uni.$u.toast('提交失败') |
| | | setTimeout(()=>{ |
| | | this.loading = false |
| | | },2000) |
| | | }) |
| | | } |
| | | }).catch(errors => { |
| | | uni.$u.toast('校验失败') |
| | | setTimeout(()=>{ |
| | | this.loading = false |
| | | },2000) |
| | | }) |
| | | } |
| | | |
| | |
| | | padding: 2px; |
| | | z-index: 999; |
| | | } |
| | | |
| | | </style> |
| | | <style lang="scss" scoped> |
| | | ::v-deep .u-radio{ |
| | | margin-right: 20px; |
| | | } |
| | | ::v-deep .u-radio__icon-wrap{ |
| | | margin-left: 10px; |
| | | } |
| | | </style> |