From 933046f7fd7fa9104bc33862951d570d88d7e2df Mon Sep 17 00:00:00 2001
From: sen <sen@qq.com>
Date: 星期二, 10 三月 2026 16:32:43 +0800
Subject: [PATCH] 按钮添加

---
 ui/car_wx_app/pages/transportation/index.vue |   97 +++++++++++++++++++++++++++++++++---------------
 1 files changed, 67 insertions(+), 30 deletions(-)

diff --git a/ui/car_wx_app/pages/transportation/index.vue b/ui/car_wx_app/pages/transportation/index.vue
index 62afbc5..08325a0 100644
--- a/ui/car_wx_app/pages/transportation/index.vue
+++ b/ui/car_wx_app/pages/transportation/index.vue
@@ -206,7 +206,7 @@
                 <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>
 
 
@@ -221,6 +221,7 @@
 import amap from '@/common/amap-wx.130.js'
 
 import store from '@/store'
+import {uploadImage} from "@/common/upload";
 export default {
     data() {
         return {
@@ -264,7 +265,8 @@
                 // odometer: [{ required: true, message: '璇疯緭鍏ヤ华琛ㄩ噷绋�', trigger: 'change' }],
                 voucher: [{ required: true, message: '璇蜂笂浼犲嚟璇�', trigger: 'blur' }]
             },
-
+            isHk: false,
+			loading: false
         };
     },
     onLoad(options) {
@@ -272,6 +274,7 @@
       this.amapPlugin = new amap.AMapWX({
         key: this.mapApiKey
       });
+      this.getLocation();
         // 鑾峰彇 URL 鍙傛暟
         if (options.id) {
             this.getList();
@@ -371,27 +374,33 @@
         },
         // 鏂板鍥剧墖
         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) {
@@ -441,24 +450,29 @@
         },
 
         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: '',
@@ -468,12 +482,16 @@
                             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
@@ -481,6 +499,9 @@
 
                         this.cleanedForm = this.cleanFormData({ ...this.form })
                         carSubmitPickHook(this.cleanedForm).then((res) => {
+						setTimeout(()=>{
+							this.loading = false
+						},2000)
                             this.form = {
                                 address: '',
                                 tripTime: '',
@@ -491,7 +512,11 @@
                             if (res == 1) {
                                 uni.$u.toast('鎿嶄綔鎴愬姛')
                             }
-                        })
+                        }).catch(()=>{
+						setTimeout(()=>{
+							this.loading = false
+						},2000)
+						})
 
                     }
 
@@ -500,6 +525,9 @@
 
             }).catch(errors => {
                 uni.$u.toast('鏍¢獙澶辫触')
+				setTimeout(()=>{
+					this.loading = false
+				},2000)
             })
             this.$forceUpdate();
         },
@@ -541,7 +569,16 @@
         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);

--
Gitblit v1.8.0