From 668e570bd1db6bd00e4293b6977e6d3d051053ce Mon Sep 17 00:00:00 2001
From: wlzboy <66905212@qq.com>
Date: 星期四, 27 十一月 2025 00:07:46 +0800
Subject: [PATCH] feat: 修改app录入界面及车辆用户同步

---
 app/pages/task/detail.vue |  218 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 211 insertions(+), 7 deletions(-)

diff --git a/app/pages/task/detail.vue b/app/pages/task/detail.vue
index ffd445d..fcbd8d7 100644
--- a/app/pages/task/detail.vue
+++ b/app/pages/task/detail.vue
@@ -189,8 +189,58 @@
           <view class="value">{{ taskDetail.emergencyInfo.transferDistance }}鍏噷</view>
         </view>
         <view class="info-item" v-if="taskDetail.emergencyInfo.transferPrice">
-          <view class="label">杞繍璐圭敤</view>
+          <view class="label">鍩虹璐圭敤</view>
           <view class="value">锟{ taskDetail.emergencyInfo.transferPrice }}</view>
+        </view>
+        <view class="info-item" v-if="paymentInfo">
+          <view class="label">闄勫姞璐圭敤</view>
+          <view class="value">锟{ paymentInfo.additionalAmount || 0 }}</view>
+        </view>
+        <view class="info-item" v-if="paymentInfo">
+          <view class="label">鎬昏垂鐢�</view>
+          <view class="value" style="color: #e54d42; font-weight: bold;">锟{ paymentInfo.totalAmount || 0 }}</view>
+        </view>
+        <view class="info-item" v-if="paymentInfo && paymentInfo.paidAmount > 0">
+          <view class="label">宸叉敮浠�</view>
+          <view class="value" style="color: #34C759;">锟{ paymentInfo.paidAmount }}</view>
+        </view>
+        <view class="info-item" v-if="paymentInfo && paymentInfo.paidAmount > 0">
+          <view class="label">鍓╀綑鏈粯</view>
+          <view class="value" style="color: #ff9900; font-weight: bold;">锟{ getRemainingAmount() }}</view>
+        </view>
+      </view>
+      
+      <!-- 鏀粯璁板綍鏄庣粏 -->
+      <view class="detail-section" v-if="paymentInfo && paymentInfo.paidPayments && paymentInfo.paidPayments.length > 0">
+        <view class="section-title">鏀粯璁板綍</view>
+        <view 
+          class="payment-record-item" 
+          v-for="payment in paymentInfo.paidPayments" 
+          :key="payment.id"
+        >
+          <view class="payment-header">
+            <view 
+              class="payment-method-tag" 
+              :class="[
+                payment.paymentMethod === '1' ? 'method-cash' : '',
+                payment.paymentMethod === '2' ? 'method-bank' : '',
+                payment.paymentMethod === '3' ? 'method-wechat' : '',
+                payment.paymentMethod === '4' ? 'method-alipay' : '',
+                payment.paymentMethod === '5' ? 'method-pos' : '',
+                payment.paymentMethod === '6' ? 'method-account' : '',
+                payment.paymentMethod === '7' ? 'method-yyt' : ''
+              ]"
+            >
+              {{ getPaymentMethodLabel(payment.paymentMethod) }}
+            </view>
+            <view class="payment-amount">锟{ payment.settlementAmount }}</view>
+          </view>
+          <view class="payment-time" v-if="payment.payTime">
+            {{ formatPaymentTime(payment.payTime) }}
+          </view>
+          <view class="payment-remark" v-if="payment.remark">
+            澶囨敞锛歿{ payment.remark }}
+          </view>
         </view>
       </view>
       
@@ -345,7 +395,16 @@
         </button>
       </template>
       
-      <!-- 宸插畬鎴�/宸插彇娑�: 涓嶆樉绀烘寜閽� -->
+      <!-- 宸插畬鎴�/宸插彇娑�: 涓嶆樉绀烘寜閽紝浣嗗鏋滄槸杞繍浠诲姟鍒欐樉绀虹粨绠楁寜閽� -->
+      
+      <!-- 杞繍浠诲姟鐨勭粨绠楁寜閽細浠呭畬鎴�/鍙栨秷鐘舵�佷笉鏄剧ず -->
+      <button 
+        v-if="taskDetail.taskType === 'EMERGENCY_TRANSFER' && !isTaskFinished"
+        class="action-btn settlement" 
+        @click="handleSettlement"
+      >
+        缁撶畻
+      </button>
     </view>
   </view>
 </template>
@@ -353,6 +412,7 @@
 <script>
   import { getTask, changeTaskStatus } from '@/api/task'
   import { checkVehicleActiveTasks } from '@/api/task'
+  import { getPaymentInfo } from '@/api/payment'
   import { formatDateTime } from '@/utils/common'
   import AttachmentUpload from '@/components/AttachmentUpload.vue'
   
@@ -363,7 +423,8 @@
     data() {
       return {
         taskDetail: null,
-        taskId: null
+        taskId: null,
+        paymentInfo: null // 鏀粯淇℃伅
       }
     },
     computed: {
@@ -456,10 +517,67 @@
           console.log('鍑哄彂鍦板潃:', this.taskDetail.departureAddress)
           console.log('鐩殑鍦板潃:', this.taskDetail.destinationAddress)
           console.log('杞繍浠诲姟淇℃伅 (emergencyInfo):', this.taskDetail.emergencyInfo)
+          
+          // 濡傛灉鏄浆杩愪换鍔★紝鍔犺浇鏀粯淇℃伅
+          if (this.taskDetail.taskType === 'EMERGENCY_TRANSFER') {
+            this.loadPaymentInfo()
+          }
         }).catch(error => {
           console.error('鍔犺浇浠诲姟璇︽儏澶辫触:', error)
           this.$modal.showToast('鍔犺浇浠诲姟璇︽儏澶辫触')
         })
+      },
+      
+      // 鍔犺浇鏀粯淇℃伅
+      loadPaymentInfo() {
+        getPaymentInfo(this.taskId).then(res => {
+          this.paymentInfo = res.data
+          console.log('鏀粯淇℃伅:', this.paymentInfo)
+        }).catch(err => {
+          console.error('鍔犺浇鏀粯淇℃伅澶辫触', err)
+        })
+      },
+      
+      // 鏍规嵁鏀粯鏂瑰紡瀛楀吀鍊艰幏鍙栨樉绀烘爣绛�
+      getPaymentMethodLabel(dictValue) {
+        const methodMap = {
+          '1': '鐜伴噾',
+          '2': '閾惰杞处',
+          '3': '寰俊鏀粯',
+          '4': '鏀粯瀹�',
+          '5': 'POS鏀舵',
+          '6': '鎸傝处',
+          '7': '鏄撳尰閫氭寕璐�',
+          '8': '閫�娆�',
+          '9': '绉垎'
+        }
+        return methodMap[dictValue] || dictValue
+      },
+      
+      // 鏍煎紡鍖栨敮浠樻椂闂�
+      formatPaymentTime(time) {
+        if (!time) return '鏈煡'
+        const date = new Date(time)
+        const year = date.getFullYear()
+        const month = String(date.getMonth() + 1).padStart(2, '0')
+        const day = String(date.getDate()).padStart(2, '0')
+        const hour = String(date.getHours()).padStart(2, '0')
+        const minute = String(date.getMinutes()).padStart(2, '0')
+        return `${year}-${month}-${day} ${hour}:${minute}`
+      },
+      
+      // 璁$畻鍓╀綑鏈粯閲戦
+      getRemainingAmount() {
+        if (!this.paymentInfo) {
+          return '0.00'
+        }
+        const total = parseFloat(this.paymentInfo.totalAmount || 0)
+        const paid = parseFloat(this.paymentInfo.paidAmount || 0)
+        const remaining = total - paid
+        console.log('鎬婚噾棰�:', total.toFixed(2))
+        console.log('宸蹭粯閲戦:', paid.toFixed(2))
+        console.log('鍓╀綑鏈粯閲戦:', remaining.toFixed(2))
+        return remaining > 0 ? remaining.toFixed(2) : '0.00'
       },
       
       // 鑾峰彇杞﹁締淇℃伅
@@ -565,6 +683,13 @@
           'WELFARE': '绂忕杞�'
         }
         return typeMap[type] || '鏈煡绫诲瀷'
+      },
+      
+      // 澶勭悊缁撶畻
+      handleSettlement() {
+        uni.navigateTo({
+          url: '/pages/task/settlement?taskId=' + this.taskId
+        })
       },
       
       // 澶勭悊浠诲姟鎿嶄綔
@@ -674,10 +799,10 @@
         if (!this.taskDetail) {
           return null;
         }
-        
-        // 浠庤溅杈嗗垪琛ㄤ腑鑾峰彇绗竴涓溅杈嗙殑ID
-        if (this.taskDetail.vehicleList && this.taskDetail.vehicleList.length > 0) {
-          return this.taskDetail.vehicleList[0].vehicleId;
+        console.log("taskDetail assignedVehicles",this.taskDetail.assignedVehicles); 
+        // 浠庤溅杈嗗垪琛ㄤ腑鑾峰彇绗竴涓溅杈嗙殑ID锛堝悗绔繑鍥炵殑瀛楁鍚嶆槸assignedVehicles锛�
+        if (this.taskDetail.assignedVehicles && this.taskDetail.assignedVehicles.length > 0) {
+          return this.taskDetail.assignedVehicles[0].vehicleId;
         }
         
         // 鎴栬�呬粠鍗曚釜杞﹁締瀵硅薄鑾峰彇
@@ -1128,6 +1253,80 @@
       }
     }
     
+    // 鏀粯璁板綍鏍峰紡
+    .payment-record-item {
+      background-color: #f9f9f9;
+      border-radius: 10rpx;
+      padding: 20rpx;
+      margin-bottom: 20rpx;
+      
+      &:last-child {
+        margin-bottom: 0;
+      }
+      
+      .payment-header {
+        display: flex;
+        justify-content: space-between;
+        align-items: center;
+        margin-bottom: 15rpx;
+        
+        .payment-method-tag {
+          display: inline-block;
+          padding: 6rpx 16rpx;
+          border-radius: 6rpx;
+          font-size: 24rpx;
+          color: white;
+          font-weight: 500;
+          
+          &.method-cash {
+            background-color: #34C759;
+          }
+          
+          &.method-bank {
+            background-color: #5AC8FA;
+          }
+          
+          &.method-wechat {
+            background-color: #09BB07;
+          }
+          
+          &.method-alipay {
+            background-color: #1677FF;
+          }
+          
+          &.method-pos {
+            background-color: #FF9500;
+          }
+          
+          &.method-account {
+            background-color: #FF9500;
+          }
+          
+          &.method-yyt {
+            background-color: #AF52DE;
+          }
+        }
+        
+        .payment-amount {
+          font-size: 32rpx;
+          font-weight: bold;
+          color: #34C759;
+        }
+      }
+      
+      .payment-time {
+        font-size: 24rpx;
+        color: #999;
+        margin-bottom: 10rpx;
+      }
+      
+      .payment-remark {
+        font-size: 24rpx;
+        color: #666;
+        line-height: 1.5;
+      }
+    }
+    
     .loading {
       display: flex;
       flex-direction: column;
@@ -1176,6 +1375,11 @@
           color: white;
         }
         
+        &.settlement {
+          background-color: #34C759;
+          color: white;
+        }
+        
         &:first-child {
           margin-left: 0;
         }

--
Gitblit v1.9.1