From 7ed2a032d0724e68aec8af940f2ce0023a9f0eb7 Mon Sep 17 00:00:00 2001
From: sen <sen@qq.com>
Date: 星期三, 15 四月 2026 09:27:51 +0800
Subject: [PATCH] 修改调度单年月日
---
ui/car_wx_app/pages/transportation/index.vue | 1235 +++++++++++++++++++++-------------------------------------
1 files changed, 442 insertions(+), 793 deletions(-)
diff --git a/ui/car_wx_app/pages/transportation/index.vue b/ui/car_wx_app/pages/transportation/index.vue
index 08325a0..e333f9b 100644
--- a/ui/car_wx_app/pages/transportation/index.vue
+++ b/ui/car_wx_app/pages/transportation/index.vue
@@ -1,854 +1,503 @@
<template>
- <view class="container">
- <!-- 鏍囬鏍� -->
- <Nav :title="formData.name" :customBack="formData.router"></Nav>
+ <view class="container">
+ <!-- 瀵艰埅鏍� -->
+ <Nav :title="pageTitle" custom-back="/pages/beReferred/index" />
- <!-- 鍩虹淇℃伅鍖哄煙 -->
- <view class="info-section">
- <view class="info-item" v-for="(item, index) in infoList" :key="index">
- <view class="item-label">{{ item.label }}</view>
- <view class="item-value" :class="{ status: item.status }">{{ item.value }}</view>
- </view>
- </view>
+ <!-- 鍩虹淇℃伅 - 浣跨敤缁熶竴鐨� InfoSection 缁勪欢 -->
+ <InfoSection :list="infoList" />
+ <!-- 琛ㄥ崟鍖哄煙 -->
+ <view class="form-content">
+ <view class="form-section">
+ <!-- 鐢╂寕琛ㄥ崟 -->
+ <template v-if="statusStr === '寰呯敥鎸�'">
+ <u--form ref="dropForm" :rules="rules" :model="form" labelPosition="left">
+ <!-- 鐢╂寕鍦板潃 -->
+ <u-form-item borderBottom label=" " labelWidth="0" prop="address">
+ <view class="form-row" @click="getLocation">
+ <view class="form-label required">
+ <view class="label-icon">
+ <u--image :showLoading="true" src="/static/bt.png" width="18" height="18" />
+ </view>
+ <text class="label-text">鐢╂寕鍦板潃</text>
+ </view>
+ <view class="address-box">
+ <u--text
+ :lines="3"
+ :text="form.address"
+ :placeholder="locationLoading ? '姝e湪鑾峰彇浣嶇疆...' : '鐐瑰嚮鑾峰彇褰撳墠鍦板潃'"
+ />
+ <view class="location-icon">
+ <u-loading-icon v-if="locationLoading" size="20" color="#409eff" />
+ <u-icon v-else name="map-fill" color="#409eff" size="22" />
+ </view>
+ </view>
+ </view>
+ </u-form-item>
+ <!-- 鐢╂寕鏃堕棿 -->
+ <u-form-item borderBottom label=" " labelWidth="0" prop="tripTime">
+ <view class="form-row">
+ <view class="form-label">
+ <u--image :showLoading="true" src="/static/bt.png" width="20" height="20" />
+ <text>鐢╂寕鏃堕棿</text>
+ </view>
+ <uni-datetime-picker type="datetime" v-model="form.tripTime" class="flex-1" />
+ </view>
+ </u-form-item>
- <!-- 涓婁紶琛岀▼琛ㄥ崟 -->
- <view class="form-section" v-if="newForm.statusStr == '寰呯敥鎸�'">
- <!-- 鍗曢�夋搷浣滄寜閽粍锛堥亶鍘嗕紭鍖栵級 -->
- <!-- <view class="action-buttons-container">
- <view class="action-buttons-row" v-for="(row, rowIndex) in actionButtonRows" :key="rowIndex">
- <button class="action-btn" v-for="(btn, btnIndex) in row" :key="btnIndex"
- :class="{ selected: selectedAction === btn.dictValue }" @tap="selectAction(btn.dictValue)">
- {{ btn.dictLabel }}
- </button>
- </view>
- </view> -->
+ <!-- 鍑瘉涓婁紶 -->
+ <u-form-item label="鍑瘉" labelWidth="80" :borderBottom="false">
+ <u-upload
+ :fileList="fileList"
+ name="file"
+ multiple
+ :maxCount="6"
+ :maxSize="50 * 1024 * 1024"
+ @afterRead="afterRead"
+ @delete="deletePic"
+ @oversize="overSize"
+ />
+ </u-form-item>
+ </u--form>
+ <BottomBar :loading="loading" @submit="submitForm" @advance="goToAdvanceList" />
+ </template>
+ <!-- 鎺ユ寕琛ㄥ崟 -->
+ <template v-if="statusStr === '寰呮帴鎸�'">
+ <u--form ref="pickForm" :rules="rules" :model="form" labelPosition="left">
+ <!-- 鎺ユ寕鍦板潃 -->
+ <u-form-item borderBottom label=" " labelWidth="0" prop="address">
+ <view class="form-row" @click="getLocation">
+ <view class="form-label required">
+ <view class="label-icon">
+ <u--image :showLoading="true" src="/static/bt.png" width="18" height="18" />
+ </view>
+ <text class="label-text">鎺ユ寕鍦板潃</text>
+ </view>
+ <view class="address-box">
+ <u--text
+ :lines="3"
+ :text="form.address"
+ :placeholder="locationLoading ? '姝e湪鑾峰彇浣嶇疆...' : '鐐瑰嚮鑾峰彇褰撳墠鍦板潃'"
+ />
+ <view class="location-icon">
+ <u-loading-icon v-if="locationLoading" size="20" color="#409eff" />
+ <u-icon v-else name="map-fill" color="#409eff" size="22" />
+ </view>
+ </view>
+ </view>
+ </u-form-item>
- <u--form ref="uForm" :rules="rules" :model="form" labelPosition="left">
- <u-form-item ref="item1" borderBottom label=" " labelWidth="0" prop="address">
- <!-- <view style="display: flex; align-items: center; width: 100%;">
- <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--input placeholder="璇疯幏鍙栫敥鎸傚湴鍧�" v-model="form.address" suffixIcon="map-fill"
- @click="getLocation" suffixIconStyle="color: #909399"></u--input>
-
-
+ <!-- 鎺ユ寕鏃堕棿 -->
+ <u-form-item borderBottom label=" " labelWidth="0" prop="tripTime">
+ <view class="form-row">
+ <view class="form-label">
+ <u--image :showLoading="true" src="/static/bt.png" width="20" height="20" />
+ <text>鎺ユ寕鏃堕棿</text>
+ </view>
+ <uni-datetime-picker type="datetime" v-model="form.tripTime" class="flex-1" />
+ </view>
+ </u-form-item>
- </view> -->
- <view style="display: flex; align-items: flex-start; width: 100%;">
- <!-- 宸︿晶鏍囩锛堝甫蹇呭~鏄熷彿锛� -->
- <view
- style="display: flex; align-items: center; flex-shrink: 0; margin-right: 10px; padding-top: 12rpx;">
- <u--image :showLoading="true" src="/static/bt.png" width="20px" height="20px"></u--image>
- <text style="display: flex; align-items: center;">
- <span style="color: #ff4d4f; margin-right: 4rpx;">*</span> <!-- 绾㈣壊蹇呭~鏄熷彿 -->
- 鐢╂寕鍦板潃:
- </text>
- </view>
+ <!-- 鍑瘉涓婁紶 -->
+ <u-form-item label="鍑瘉" labelWidth="80" :borderBottom="false">
+ <u-upload
+ :fileList="fileList"
+ name="file"
+ multiple
+ :maxCount="6"
+ :maxSize="50 * 1024 * 1024"
+ @afterRead="afterRead"
+ @delete="deletePic"
+ @oversize="overSize"
+ />
+ </u-form-item>
+ </u--form>
- <!-- 鍙充晶鏂囨湰妗�+鍥炬爣锛堝甫杈规锛屽浘鏍囧湪妗嗗唴锛� -->
- <view style="position: relative; width: 100%; margin-top: 6rpx;" @click="getLocation">
- <view class="custom-textarea" style="border: 1px solid #e5e5e5;">
- <u--text :lines="2" :text="form.address"></u--text>
- <view style="position: absolute; top: 50%; right: 10rpx; transform: translateY(-50%);">
- <u-icon name="map-fill" color="#909399" size="24" @click="getLocation"></u-icon>
- </view>
- </view>
-
- </view>
- </view>
- </u-form-item>
-
- <u-form-item ref="item1" borderBottom label=" " labelWidth="0" prop="tripTime">
- <view style="display: flex; align-items: center; width: 100%;">
- <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>
- <uni-datetime-picker type="datetime" v-model="form.tripTime" style="flex: 1;"
- @change="onDateTimeChange">
- </uni-datetime-picker>
- </view>
- </u-form-item>
-
- <!-- <u-form-item ref="item1" borderBottom label=" " labelWidth="0" prop="odometer">
- <view style="display: flex; align-items: center; width: 100%;">
- <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>浠〃閲岀▼锛坘m锛�:</text>
- </view>
-
- <uni-number-box v-model="form.odometer" @change="changeValue" />
- </view>
- </u-form-item> -->
-
-
- <u-form-item ref="item1" borderBottom label=" " labelWidth="0" prop="" :borderBottom="false">
- <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-form-item>
- <u-form-item ref="item1" borderBottom label=" " labelWidth="0" prop="fileList" :borderBottom="false">
- <view style="margin-right: 10px;"></view>
- <u-upload :fileList="fileList" name="file" multiple :maxCount="6" :maxSize="2 * 1024 * 1024"
- @afterRead="afterRead" :previewFullImage="true" @delete="deletePic" @oversize="overSize">
- </u-upload>
-
- </u-form-item>
-
-
-
-
-
-
- </u--form>
- <view class="bottom-btn-group">
- <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>
- </view>
-
- </view>
-
-
-
-
-
-
- <!-- 涓婃姤鍨粯琛ㄥ崟 -->
- <view class="form-section" v-if="newForm.statusStr == '寰呮帴鎸�'">
-
- <u--form ref="uForm" :rules="rules" :model="form" labelPosition="left">
- <u-form-item ref="item1" borderBottom label=" " labelWidth="0" prop="address">
- <!-- <view style="display: flex; align-items: center; width: 100%;">
- <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>
- <view @click="getLocation" style="width: 100%;">
- <u--input placeholder="璇疯幏鍙栫敥鎸傚湴鍧�" readonly v-model="form.address" suffixIcon="map-fill"
- suffixIconStyle="color: #909399"></u--input>
- </view>
- </view> -->
- <view style="display: flex; align-items: flex-start; width: 100%;">
- <!-- 宸︿晶鏍囩锛堝甫蹇呭~鏄熷彿锛� -->
- <view
- style="display: flex; align-items: center; flex-shrink: 0; margin-right: 10px; padding-top: 12rpx;">
- <u--image :showLoading="true" src="/static/bt.png" width="20px" height="20px"></u--image>
- <text style="display: flex; align-items: center;">
- <span style="color: #ff4d4f; margin-right: 4rpx;">*</span> <!-- 绾㈣壊蹇呭~鏄熷彿 -->
- 鎺ユ寕鍦板潃:
- </text>
- </view>
-
- <!-- 鍙充晶鏂囨湰妗�+鍥炬爣锛堝甫杈规锛屽浘鏍囧湪妗嗗唴锛� -->
- <view style="position: relative; width: 100%; margin-top: 6rpx;" @click="getLocation">
- <view class="custom-textarea" style="border: 1px solid #e5e5e5;">
- <u--text :lines="2" :text="form.address"></u--text>
- <view style="position: absolute; top: 50%; right: 10rpx; transform: translateY(-50%);">
- <u-icon name="map-fill" color="#909399" size="24" @click="getLocation"></u-icon>
- </view>
- </view>
-
- </view>
- </view>
- </u-form-item>
-
- <u-form-item ref="item1" borderBottom label=" " labelWidth="0" prop="tripTime">
- <view style="display: flex; align-items: center; width: 100%;">
- <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>
- <uni-datetime-picker type="datetime" v-model="form.tripTime" style="flex: 1;"
- @change="onDateTimeChange">
- </uni-datetime-picker>
- </view>
- </u-form-item>
-
- <!-- <u-form-item ref="item1" borderBottom label=" " labelWidth="0" prop="odometer">
- <view style="display: flex; align-items: center; width: 100%;">
- <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>浠〃閲岀▼锛坘m锛�:</text>
- </view>
-
- <uni-number-box v-model="form.odometer" @change="changeValue" />
- </view>
- </u-form-item> -->
-
-
- <u-form-item ref="item1" borderBottom label=" " labelWidth="0" prop="" :borderBottom="false">
- <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-form-item>
- <u-form-item ref="item1" borderBottom label=" " labelWidth="0" prop="fileList" :borderBottom="false">
- <view style="margin-right: 10px;"></view>
- <u-upload :fileList="fileList" name="file" multiple :maxCount="6" :maxSize="2 * 1024 * 1024"
- @afterRead="afterRead" :previewFullImage="true" @delete="deletePic" @oversize="overSize">
- </u-upload>
-
- </u-form-item>
-
-
-
-
-
-
- </u--form>
- <view class="bottom-btn-group">
- <u-button class="btn-list" @click="goTravelItinerary" text="琛岀▼鍘嗗彶"></u-button>
-
- <!-- <u-button class="btn-budget" @click="goToAdvanceBudget" type="success" text="鍨粯棰勭畻"></u-button> -->
- <u-button :loading="loading" class="btn-submit" @click="submitForm" type="primary" text="鎻愪氦"></u-button>
- </view>
-
-
- </view>
+ <BottomBar :loading="loading" @submit="submitForm" @history="goTravelItinerary" />
+ </template>
+ </view>
</view>
+ </view>
+</template>
+
+ <!-- 搴曢儴鎸夐挳 -->
+ <view class="btn-group">
+ <u-button class="btn-default" @click="goTravelItinerary" text="琛岀▼鍘嗗彶" />
+ <u-button class="btn-primary" :loading="loading" @click="submitForm" type="primary" text="鎻愪氦" />
+ </view>
+ </template>
+ </view>
+ </view>
</template>
<script>
-
-import { getcarDispatch, getcarType, carUploadTrip, carUploadFinance, carSubmitDropHoo, carSubmitPickHook } from "@/common/examine";
+import InfoSection from '@/components/InfoSection/index.vue'
+import BottomBar from '@/components/BottomBar/index.vue'
+import {
+ getcarDispatch,
+ getcarType,
+ carSubmitDropHoo,
+ carSubmitPickHook
+} from '@/common/examine'
+import { uploadImage } from '@/common/upload'
import config from '@/config'
import amap from '@/common/amap-wx.130.js'
+import {navigateTo, PAGES, reLaunch} from '@/common/router'
-import store from '@/store'
-import {uploadImage} from "@/common/upload";
+const INFO_FIELDS = Object.freeze([
+ { key: 'dispatchNo', label: '璋冨害鍗曞彿' },
+ { key: 'licensePlate', label: '杞︾墝鍙�' },
+ { key: 'transportLine', label: '璺嚎' },
+ { key: 'customerName', label: '瀹㈡埛' },
+ { key: 'statusStr', label: '褰撳墠鐘舵��', status: true, default: '寰呭彂杞�' },
+ { key: 'latestDeparture', label: '鏈�鏅氬彂杞︽椂闂�' }
+])
+
export default {
- data() {
- return {
- mapApiKey: 'fdb2d2e64ffc9254045935d3227d5cd9', // <-- 鏇挎崲鎴愪綘鐨� API Key
- amapPlugin: null,
- formData: {
- name: '',
- router: '',
- id: ''
- },
- fileList: [],
- range: [
+ components: { InfoSection, BottomBar },
- ],
- feeTypeList: [],
- cleanedForm: {},
- newForm: {},
- selectedAction: '',
- activeTab: 'upload',
- infoList: [
- { label: '璋冨害鍗曞彿', value: '' },
- { label: '杩愯緭宸ュ叿鍙风爜', value: '' },
- { label: '璺嚎', value: '' },
- { label: '瀹㈡埛', value: '' },
- { label: '褰撳墠鐘舵��', value: '寰呭彂杞�', status: true },
- { label: '瑕佹眰鏈�鏅氬彂杞︽椂闂�', value: '' }
- ],
- actionButtonRows: [
+ data() {
+ return {
+ // 楂樺痉鍦板浘閰嶇疆
+ mapApiKey: 'fdb2d2e64ffc9254045935d3227d5cd9',
+ amapPlugin: null,
+ isHk: false,
- ],
- form: {
- address: '',
- tripTime: '',
- odometer: 0,
- tripType: ''
- },
- rules: {
+ // 椤甸潰鍙傛暟
+ dispatchId: '',
+ statusStr: '',
+ pageTitle: '',
- address: [{ required: true, message: '璇疯緭鍏ュ湴鍧�', trigger: 'blur' }],
- tripTime: [{ required: true, message: '璇烽�夋嫨鏃堕棿', trigger: 'change' }], // 淇敼杩欓噷
- // odometer: [{ required: true, message: '璇疯緭鍏ヤ华琛ㄩ噷绋�', trigger: 'change' }],
- voucher: [{ required: true, message: '璇蜂笂浼犲嚟璇�', trigger: 'blur' }]
- },
- isHk: false,
- loading: false
- };
- },
- onLoad(options) {
- this.formData = options;
- this.amapPlugin = new amap.AMapWX({
- key: this.mapApiKey
- });
- this.getLocation();
- // 鑾峰彇 URL 鍙傛暟
- if (options.id) {
- this.getList();
- }
- },
- created() {
- // this.getList();
- this.form.tripTime = this.getCurrentDateTime();
-
- },
- methods: {
- getCurrentDateTime() {
- var now = new Date();
- var year = now.getFullYear();
- var month = (now.getMonth() + 1).toString().padStart(2, '0');
- var day = now.getDate().toString().padStart(2, '0');
- var hour = now.getHours().toString().padStart(2, '0');
- var minute = now.getMinutes().toString().padStart(2, '0');
- var second = now.getSeconds().toString().padStart(2, '0');
- return year + '-' + month + '-' + day + ' ' + hour + ':' + minute + ':' + second;
- },
- goTravelItinerary() {
- setTimeout(() => {
- uni.$u.route('/pages/travelItinerary/index?id=' + this.formData.id + '&name=' + '涓婁紶琛岀▼' + '&router=' + '/pages/travelItinerary/index' + '&statusStr=' + this.formData.statusStr);
- }, 1000);
+ // 璋冨害淇℃伅
+ newForm: {},
+ infoList: INFO_FIELDS.map(f => ({ ...f, value: f.default || '' })),
- },
- feeTypeChange(e) {
- },
- getList() {
- getcarDispatch(this.formData.id).then((res) => {
- res.statusStr = '寰呮帴鎸�'
- this.newForm = res;
- // 瀹氫箟瀛楁鏄犲皠鍏崇郴
- const fieldMap = {
- dispatchNo: '璋冨害鍗曞彿',
- licensePlate: '杩愯緭宸ュ叿鍙风爜',
- transportLine: '璺嚎',
- customerName: '瀹㈡埛',
- statusStr: '褰撳墠鐘舵��',
- latestDeparture: '瑕佹眰鏈�鏅氬彂杞︽椂闂�'
- };
-
- // 閬嶅巻 infoList锛岃嚜鍔ㄦ洿鏂� value
- this.infoList = this.infoList.map(item => {
- const key = Object.keys(fieldMap).find(k => fieldMap[k] === item.label);
- if (key && res[key] !== undefined) {
- return { ...item, value: res[key] };
- }
- return item;
- });
- }).catch(err => {
- console.error('鑾峰彇璋冨害淇℃伅澶辫触:', err);
- });
-
- getcarType('trip_type').then((res) => {
- this.actionButtonRows = [res]
-
- }).catch(err => {
- });
- getcarType('fee_type').then((res) => {
- this.feeTypeList = res
- this.range = res.map(item => ({
- value: item.dictValue,
- text: item.dictLabel
- }));
-
- }).catch(err => {
- });
- },
-
-
- switchTab(tab) {
- this.activeTab = tab;
- this.form = {
- address: '',
- tripTime: '',
- odometer: 0,
- tripType: ''
- }
- this.fileList = []
- this.selectedAction = ''
-
- },
- selectAction(type) {
- // 璁剧疆閫変腑鐨勬搷浣滅被鍨�
- this.selectedAction = type;
- // 鍚屾椂鏇存柊琛ㄥ崟涓殑 tripType 瀛楁
- this.form.tripType = type;
- // wx.showToast({
- // title: `宸查�夋嫨${type}`,
- // icon: 'none'
- // });
- },
- maskClick() {
-
- },
- // 鏂板鍥剧墖
- async afterRead(event) {
- 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) {
- const param = {
- filePath: url,
- type: 'images'
- }
- return new Promise((resolve, reject) => {
- // console.log(store.state);
- uni.uploadFile({
- url: config.host + `app/car/uploadImg`, // 浠呬负绀轰緥锛岄潪鐪熷疄鐨勬帴鍙e湴鍧�
- filePath: url,
- name: 'file',
- header: {
- "Authorization": store.state.sso_user_token
- },
- success: (res) => {
- if (res.statusCode == 200) {
- const dataObject = JSON.parse(res.data);
- resolve({
- url: config['wms'] + dataObject.fileName,
- status: 'success'
- })
- } else {
- resolve({
- url: dataObject.fileName,
- status: 'failed'
- })
- }
- },
- fail: (err) => {
- reject({ status: 'failed' });
- }
- });
- })
- },
- // 鍥剧墖澶у皬瓒呭嚭鏈�澶у厑璁稿ぇ灏�
- overSize(e) {
- uni.$u.toast('涓婁紶鍥剧墖澶у皬涓嶈兘瓒呰繃2MB!')
- },
- // 鍒犻櫎鍥剧墖
- deletePic(event) {
- this.fileList.splice(event.index, 1)
- },
- onDateTimeChange(event) {
- // this.form.workTime = event.detail.value;
- },
-
- 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.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: '',
- }
- this.fileList = []
- this.selectedAction = ''
- if (res == 1) {
- uni.$u.toast('鎿嶄綔鎴愬姛')
- }
- }).catch(()=>{
- setTimeout(()=>{
- this.loading = false
- },2000)
- })
-
-
- } else if (this.newForm.statusStr == '寰呮帴鎸�') {
-
- 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: '',
- }
- this.cleanedForm = {}
- this.fileList = []
- this.selectedAction = ''
- if (res == 1) {
- uni.$u.toast('鎿嶄綔鎴愬姛')
- }
- }).catch(()=>{
- setTimeout(()=>{
- this.loading = false
- },2000)
- })
-
- }
-
-
- }
-
- }).catch(errors => {
- uni.$u.toast('鏍¢獙澶辫触')
- setTimeout(()=>{
- this.loading = false
- },2000)
- })
- this.$forceUpdate();
- },
- changeValue(e) {
-
- },
- cleanFormData(formData) {
- const cleanedData = {};
- for (const key in formData) {
- if (formData[key] !== '' && formData[key] !== null && formData[key] !== undefined) {
- cleanedData[key] = formData[key];
- }
- }
- return cleanedData;
- },
- goToAdvanceList() {
- // 浣跨敤绠ご鍑芥暟淇濇寔 this 涓婁笅鏂�
- setTimeout(() => {
- uni.$u.route('/pages/paymentList/index?name=' + '鍨粯鍒楄〃' + '&router=' + 'pages/examine/index' + '&id=' + this.formData.id);
- }, 1000);
- },
- // 鑾峰彇缁忕含搴�
- getLocation() {
- wx.getLocation({
- type: 'gcj02',
- success: (res) => {
- const latitude = res.latitude;
- const longitude = res.longitude;
- this.getAddress(latitude, longitude);
- },
- fail: (err) => {
- console.error('鑾峰彇浣嶇疆澶辫触:', err);
- wx.showToast({ title: '鑾峰彇浣嶇疆澶辫触', icon: 'none' });
- }
- });
- },
-
- getAddress(latitude, longitude) {
- this.amapPlugin.getRegeo({
- location:`${longitude},${latitude}`,
- success: (data) => {
- 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);
- wx.showToast({ title: '鍦板潃瑙f瀽澶辫触'+JSON.stringify(err) + latitude+ longitude, icon: 'none' });
- }
- });
-
+ // 琛ㄥ崟鏁版嵁
+ form: {
+ address: '',
+ tripTime: '',
+ tripType: ''
},
+
+ // 鏂囦欢鍒楄〃
+ fileList: [],
+
+ // 鍔犺浇鐘舵��
+ loading: false,
+ locationLoading: false,
+
+ // 琛ㄥ崟楠岃瘉瑙勫垯
+ rules: {
+ address: [{ required: true, message: '璇疯幏鍙栧湴鍧�', trigger: 'blur' }],
+ tripTime: [{ required: true, message: '璇烽�夋嫨鏃堕棿', trigger: 'change' }],
+ fileList: [{ validator: this.validateFiles, trigger: 'change' }]
+ }
}
-};
+ },
+
+ onLoad(options) {
+ // 浣跨敤鏂扮殑鍙傛暟鏂瑰紡
+ this.dispatchId = options.id || ''
+ this.statusStr = options.statusStr || ''
+
+ // 鏍规嵁鐘舵�佽缃爣棰�
+ this.pageTitle = this.statusStr || '涓婁紶琛岀▼'
+
+ // 鍒濆鍖栭珮寰峰湴鍥�
+ this.amapPlugin = new amap.AMapWX({ key: this.mapApiKey })
+
+ // 鑾峰彇浣嶇疆
+ this.getLocation()
+
+ // 鍔犺浇鏁版嵁
+ if (this.dispatchId) {
+ this.loadDispatchInfo()
+ }
+ },
+
+ created() {
+ this.form.tripTime = this.getCurrentDateTime()
+ },
+
+ methods: {
+ // 鑾峰彇褰撳墠鏃堕棿
+ getCurrentDateTime() {
+ const now = new Date()
+ const pad = (n) => n.toString().padStart(2, '0')
+ return `${now.getFullYear()}-${pad(now.getMonth() + 1)}-${pad(now.getDate())} ${pad(now.getHours())}:${pad(now.getMinutes())}:${pad(now.getSeconds())}`
+ },
+
+ // 鍔犺浇璋冨害淇℃伅
+ async loadDispatchInfo() {
+ try {
+ const res = await getcarDispatch(this.dispatchId)
+ this.newForm = { ...res, statusStr: this.statusStr }
+ this.infoList = INFO_FIELDS.map(f => ({ ...f, value: res[f.key] ?? f.value }))
+
+ // 鍔犺浇琛岀▼绫诲瀷
+ const tripTypes = await getcarType('trip_type')
+ // 鍙牴鎹渶瑕佸瓨鍌� tripTypes
+ } catch (err) {
+ console.error('鍔犺浇璋冨害淇℃伅澶辫触:', err)
+ uni.$u.toast('鍔犺浇鏁版嵁澶辫触')
+ }
+ },
+
+ // 鏂囦欢楠岃瘉
+ validateFiles(rule, value, callback) {
+ if (this.fileList.length === 0) {
+ callback(new Error('璇蜂笂浼犲嚟璇�'))
+ } else {
+ callback()
+ }
+ },
+
+ // 鍥剧墖涓婁紶
+ async afterRead(event) {
+ try {
+ const res = await uploadImage(event.file[0].url, this.isHk)
+ this.fileList.push(res)
+ } catch (err) {
+ console.error('涓婁紶澶辫触:', err)
+ uni.$u.toast('涓婁紶澶辫触')
+ }
+ },
+
+ // 鍒犻櫎鍥剧墖
+ deletePic(event) {
+ this.fileList.splice(event.index, 1)
+ },
+
+ // 鍥剧墖瓒呭嚭澶у皬
+ overSize() {
+ uni.$u.toast('鍥剧墖澶у皬涓嶈兘瓒呰繃2MB')
+ },
+
+ // 鑾峰彇浣嶇疆锛堟坊鍔犺秴鏃跺鐞嗭級
+ getLocation() {
+ this.locationLoading = true
+
+ // 璁剧疆 10 绉掕秴鏃�
+ const timeout = setTimeout(() => {
+ this.locationLoading = false
+ uni.$u.toast('瀹氫綅瓒呮椂锛岃鎵嬪姩杈撳叆鍦板潃')
+ }, 10000)
+
+ uni.getLocation({
+ type: 'gcj02',
+ success: (res) => {
+ clearTimeout(timeout)
+ this.getAddress(res.latitude, res.longitude)
+ },
+ fail: (err) => {
+ clearTimeout(timeout)
+ this.locationLoading = false
+ console.error('鑾峰彇浣嶇疆澶辫触:', err)
+ uni.$u.toast('鑾峰彇浣嶇疆澶辫触锛岃鎵嬪姩杈撳叆鍦板潃')
+ }
+ })
+ },
+
+ // 瑙f瀽鍦板潃
+ getAddress(latitude, longitude) {
+ this.amapPlugin.getRegeo({
+ location: `${longitude},${latitude}`,
+ success: (data) => {
+ this.locationLoading = false
+ const datum = data[0]
+ if (datum.regeocodeData?.addressComponent?.province) {
+ this.isHk = datum.regeocodeData.addressComponent.province.includes('棣欐腐')
+ }
+ this.form.address = datum.name || datum.desc
+ },
+ fail: (err) => {
+ this.locationLoading = false
+ console.error('鍦板潃瑙f瀽澶辫触:', err)
+ uni.$u.toast('鍦板潃瑙f瀽澶辫触锛岃鎵嬪姩杈撳叆鍦板潃')
+ }
+ })
+ },
+
+ // 鎻愪氦琛ㄥ崟
+ submitForm() {
+ if (this.loading) return
+
+ const formRef = this.statusStr === '寰呯敥鎸�' ? 'dropForm' : 'pickForm'
+
+ this.$refs[formRef].validate().then(() => {
+ this.doSubmit()
+ }).catch(() => {
+ uni.$u.toast('璇峰畬鍠勮〃鍗曚俊鎭�')
+ })
+ },
+
+ // 鎵ц鎻愪氦
+ async doSubmit() {
+ this.loading = true
+
+ const submitData = {
+ ...this.form,
+ voucherUrl: this.fileList.map(item => item.url).join(','),
+ dispatchOrderId: this.newForm.dispatchId,
+ driverId: this.newForm.driverId
+ }
+
+ try {
+ const api = this.statusStr === '寰呯敥鎸�' ? carSubmitDropHoo : carSubmitPickHook
+ const res = await api(submitData)
+
+ uni.$u.toast('鎿嶄綔鎴愬姛')
+ reLaunch('/pages/beReferred/index')
+
+ } catch (err) {
+ uni.$u.toast(err.message || '鎻愪氦澶辫触')
+ } finally {
+ setTimeout(() => {
+ this.loading = false
+ }, 500)
+ }
+ },
+
+ // 閲嶇疆琛ㄥ崟
+ resetForm() {
+ this.form = {
+ address: '',
+ tripTime: this.getCurrentDateTime(),
+ tripType: ''
+ }
+ this.fileList = []
+ },
+
+ // 璺宠浆鍒板灚浠樺垪琛�
+ goToAdvanceList() {
+ navigateTo(PAGES.PAYMENT_LIST, { id: this.dispatchId })
+ },
+
+ // 璺宠浆鍒拌绋嬪巻鍙�
+ goTravelItinerary() {
+ navigateTo(PAGES.TRAVEL_ITINERARY, { id: this.dispatchId })
+ }
+ }
+}
</script>
<style scoped>
.container {
- display: flex;
- flex-direction: column;
- height: 100vh;
- background-color: #f7f7f7;
- align-items: stretch;
+ display: flex;
+ flex-direction: column;
+ min-height: 100vh;
+ background-color: #f7f7f7;
}
-.info-section {
- background-color: #fff;
- margin: 20rpx;
- border-radius: 12rpx;
- overflow: hidden;
- flex-shrink: 0;
-}
-
-.info-item {
- display: flex;
- padding: 20rpx;
- border-bottom: 1rpx solid #eee;
-}
-
-.info-item:last-child {
- border-bottom: none;
-}
-
-.item-label {
- width: 180rpx;
- color: #666;
- font-size: 28rpx;
-}
-
-.item-value {
- flex: 1;
- color: #333;
- font-size: 28rpx;
-}
-
-.item-value.status {
- color: #ff6b6b;
- font-weight: 500;
-}
-
-.tab-bar {
- display: flex;
- height: 80rpx;
- background-color: #fff;
- border-bottom: 1rpx solid #eee;
-}
-
-.tab-item {
- flex: 1;
- display: flex;
- justify-content: center;
- align-items: center;
- font-size: 28rpx;
- color: #666;
- position: relative;
- height: 80rpx;
- /* 纭繚楂樺害 */
- z-index: 1;
- /* 纭繚灞傜骇 */
-}
-
-.tab-item.active {
- color: #4285f4;
- font-weight: 500;
-}
-
-.tab-item.active::after {
- content: '';
- position: absolute;
- bottom: 0;
- left: 50%;
- transform: translateX(-50%);
- width: 60rpx;
- height: 6rpx;
- background-color: #4285f4;
- border-radius: 3rpx;
+.form-content {
+ flex: 1;
+ padding-bottom: 40rpx;
}
.form-section {
- flex: 1;
- padding: 20rpx;
- background-color: #fff;
- margin: 0 20rpx 20rpx;
- border-radius: 12rpx;
- box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
- /* overflow-y: auto; */
+ padding: 20rpx;
+ background-color: #fff;
+ border-radius: 12rpx;
+ margin: 20rpx;
}
-/* 涓婁紶琛岀▼-鍗曢�夋搷浣滄寜閽粍锛堣嚜閫傚簲鎹㈣鏍峰紡锛� */
-.action-buttons-container {
- margin-bottom: 30rpx;
- overflow-y: auto;
-}
-
-.action-buttons-row {
- gap: 20rpx;
- /* margin-bottom: 20rpx; */
- display: grid;
- grid-template-columns: repeat(auto-fill, 150rpx);
- grid-gap: 20rpx;
- min-width: 100%;
-}
-
-.action-btn {
- width: 150rpx;
- height: 80rpx;
- line-height: 80rpx;
- text-align: center;
- font-size: 25rpx;
- border-radius: 8rpx;
- background-color: #fff;
- border: 1rpx solid #eee;
- color: #333;
- transition: all 0.2s ease;
- /* 浣跨敤 flex 甯冨眬纭繚涓�鑷存�� */
- display: flex;
- justify-content: center;
- align-items: center;
- /* 鍏抽敭锛氳缃枃鏈孩鍑哄鐞� */
- overflow: hidden;
- white-space: nowrap;
- text-overflow: ellipsis;
-}
-
-/* 閫変腑鐘舵�佹牱寮� */
-.action-btn.selected {
- background-color: #e8f4f8;
- border-color: #4285f4;
- color: #4285f4;
- font-weight: 500;
-}
-
-.action-btn::after {
- border: none;
-}
-
-/* 閫変腑鎸夐挳鎸夊帇鍙嶉 */
-.action-btn.selected:active {
- background-color: #d1e7fd;
-}
-
-/* 鏈�変腑鎸夐挳鎸夊帇鍙嶉 */
-.action-btn:not(.selected):active {
- background-color: #f5f5f5;
-}
-
-.form-item {
- margin-bottom: 30rpx;
+.form-row {
+ display: flex;
+ align-items: flex-start;
+ width: 100%;
+ padding: 10rpx 0;
}
.form-label {
- font-size: 28rpx;
- color: #333;
- margin-bottom: 16rpx;
- display: flex;
- align-items: center;
+ display: flex;
+ align-items: center;
+ flex-shrink: 0;
+ margin-right: 20rpx;
+ min-width: 120rpx;
+ padding-top: 16rpx;
}
-.required-tag {
- display: inline-block;
- width: 24rpx;
- height: 24rpx;
- line-height: 24rpx;
- text-align: center;
- background-color: #e53e3e;
- color: #fff;
- font-size: 20rpx;
- border-radius: 50%;
- margin-left: 8rpx;
+.label-icon {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ width: 36rpx;
+ height: 36rpx;
+ margin-right: 8rpx;
}
-.form-control {
- display: flex;
- align-items: center;
- border: 1rpx solid #eee;
- border-radius: 8rpx;
- padding: 16rpx;
- background-color: #f9f9f9;
+.label-text {
+ font-size: 28rpx;
+ color: #303133;
+ font-weight: 500;
}
-.form-control input {
- flex: 1;
- font-size: 28rpx;
+.form-label.required .label-text::after {
+ content: '*';
+ color: #ff4d4f;
+ margin-left: 4rpx;
}
-.icon {
- width: 32rpx;
- height: 32rpx;
- margin-left: 16rpx;
+.flex-1 {
+ flex: 1;
}
-.form-control input[disabled] {
- background-color: #f9f9f9;
- color: #999;
+.address-box {
+ flex: 1;
+ display: flex;
+ align-items: center;
+ background-color: #f5f7fa;
+ border: 2rpx solid #e4e7ed;
+ border-radius: 12rpx;
+ padding: 20rpx 80rpx 20rpx 20rpx;
+ position: relative;
}
-.picker-value {
- flex: 1;
- font-size: 28rpx;
- color: #333;
+.location-icon {
+ position: absolute;
+ top: 50%;
+ right: 0;
+ transform: translateY(-50%);
+ width: 72rpx;
+ height: 72rpx;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+}
+</style>
+ top: 50%;
+ right: 16rpx;
+ transform: translateY(-50%);
}
-.bottom-buttons {
- display: flex;
- gap: 20rpx;
- margin-top: 40rpx;
+// 鏃堕棿閫夋嫨
+.datetime-wrapper {
+ display: flex;
+ align-items: center;
+ width: 100%;
}
-.bottom-btn {
- flex: 1;
- height: 80rpx;
- line-height: 80rpx;
- text-align: center;
- font-size: 28rpx;
- border-radius: 8rpx;
- background-color: #fff;
- border: 1rpx solid #eee;
- color: #333;
+.datetime-picker {
+ flex: 1;
}
-.bottom-btn.primary {
- background-color: #4285f4;
- color: #fff;
- border: none;
+// 鎸夐挳缁�
+.btn-group {
+ display: flex;
+ gap: 20rpx;
+ margin-top: 40rpx;
+ padding-top: 20rpx;
+ border-top: 1rpx solid #ebeef5;
}
-.bottom-btn::after {
- border: none;
+.btn-default {
+ flex: 1;
}
-/* 鎸夐挳 */
-.bottom-btn-group {
- display: flex;
- gap: 20rpx;
- padding: 30rpx;
+.btn-primary {
+ flex: 2;
}
-
-/* 鏂囨湰妗嗘牱寮忎紭鍖栵細鍐呰竟璺�+鍗犱綅绗� */
-::v-deep .custom-textarea {
- padding: 16rpx 50rpx 16rpx 16rpx !important;
- /* 涓婁笅鍐呰竟璺濈◢澶э紝鍙充晶鐣欏浘鏍囦綅缃� */
- min-height: 80rpx;
-}
-
-/* 鍗犱綅绗︽牱寮忥細鐏拌壊锛屽拰鍥剧墖涓�鑷� */
-::v-deep .custom-textarea textarea::placeholder {
- color: #c6c0ba !important;
- /* 娴呯伆鑹插崰浣嶇 */
- font-size: 28rpx;
-}
-
-/* 纭繚鏂囨湰妗嗚竟妗嗕笉琚鐩� */
-::v-deep .custom-textarea .uni-textarea {
- border: none !important;
- /* 鍘绘帀缁勪欢鑷甫杈规锛岀敤澶栧眰鑷畾涔夎竟妗� */
-}
-</style>
\ No newline at end of file
+</style>
--
Gitblit v1.8.0