Parcourir la source

订单详情页添加:配送进度

shizhongqi il y a 11 mois
Parent
commit
a5365d5fe6

+ 4 - 4
hdApp/src/admin/express/create.vue

@@ -442,7 +442,7 @@ export default {
   padding: 30upx;
   background: #f0f9ff;
   border-radius: 12upx;
-  border: 2upx solid #007aff;
+  border: 1upx solid #09C567;
 
   .fee-label {
     font-size: 32upx;
@@ -475,8 +475,8 @@ export default {
   
   &.query-button {
     background: #f0f9ff;
-    color: #007aff;
-    border: 2upx solid #007aff;
+    color: #09C567;
+    border: 2upx solid #09C567;
 
     &:disabled {
       background: #f5f5f5;
@@ -486,7 +486,7 @@ export default {
   }
 
   &.submit-button {
-    background: #007aff;
+    background: #09C567;
     color: white;
 
     &:disabled {

+ 1 - 1
hdApp/src/admin/home/order.vue

@@ -305,7 +305,7 @@ export default {
      * 取消配送订单
      */
     async cancelExpress(orderId) {
-      this.$util.confirmModal({content: '确认取消配送订单?'}, async () => {
+      this.$util.confirmModal({content: '确认取消?(若配送员接单1分钟后取消,扣2元违约金)'}, async () => {
         try {
           const res = await cancelExpressOrder({orderId: orderId})
           if (res.code === 1) {

+ 156 - 1
hdApp/src/admin/order/detail.vue

@@ -7,6 +7,52 @@
           <text class="tip-text">本单是售后付款单<block v-if="!$util.isEmpty(orderInfo.forwardMap)">,点击查看原订单</block></text>
         </view>
       </view>
+
+      <!-- 配送进度模块 -->
+      <view class="module-com order-msg">
+        <view class="module-tit">
+          <text class="module-tit__text">配送进度</text>
+        </view>
+        <view class="module-det">
+          <view class="order-msg-blo">
+            <!-- 付款类型 -->
+            <view class="msg-list">
+              <view class="label">配送平台:</view>
+              <view class="value">{{getExpressPlatformText(expressData.deliveryId)}}</view>
+            </view>
+            <view class="msg-list express-progress-row">
+              <view class="label">配送进度:</view>
+              <view class="value">{{getExpressStatusText(expressData.orderStatus)}}</view>
+              <view class="express-actions" v-if="orderInfo.payStatus == 1">
+                <button 
+                  class="admin-button-com mini-btn" 
+                  v-if="orderInfo.sendStatus == '0'" 
+                  @click.stop="openExpressPage(orderInfo.id, true)">
+                  呼叫跑腿
+                </button>
+                <button 
+                  class="admin-button-com mini-btn btn-danger" 
+                  v-if="orderInfo.sendStatus == '1'" 
+                  @click.stop="cancelExpress(orderInfo.id)">
+                  取消跑腿
+                </button>
+                <button 
+                  class="admin-button-com mini-btn" 
+                  v-if="orderInfo.sendStatus == '3'" 
+                  @click.stop="openExpressPage(orderInfo.id, false)">
+                  重叫跑腿
+                </button>
+                <button 
+                  class="admin-button-com mini-btn" 
+                  v-if="orderInfo.sendStatus == '2'" 
+                  @click.stop="selectExpress(orderInfo.id)">
+                  跑腿完成
+                </button>
+              </view>
+            </view>
+          </view>
+        </view>
+      </view>
       
       <!-- 商品信息模块 -->
       <view class="module-com">
@@ -340,6 +386,10 @@
           v-if="orderInfo.status == 1">
           扫码收款
         </button>
+        <button class="admin-button-com middle" v-if="orderInfo.sendStatus == '0' && orderInfo.payStatus == 1" @click.stop="openExpressPage(orderInfo.id, true)">呼叫跑腿</button>
+        <button class="admin-button-com default" v-if="orderInfo.sendStatus == '1' && orderInfo.payStatus == 1" @click.stop="cancelExpress(orderInfo.id)" style="background-color: #ff6b6b;">取消跑腿</button>
+        <button class="admin-button-com middle" v-if="orderInfo.sendStatus == '3' && orderInfo.payStatus == 1" @click.stop="openExpressPage(item.id, false)">重叫跑腿</button>
+        <button class="admin-button-com middle" v-if="orderInfo.sendStatus == '2' && orderInfo.payStatus == 1" @click.stop="selectExpress(item.id)">跑腿完成</button>
         <button 
           class="admin-button-com middle" 
           @click.stop="printOrder(orderInfo)" 
@@ -363,6 +413,7 @@ import { getDetB } from "@/api/order";
 const commonUtil = require("@/utils/common.js");
 import { confirmSettle } from "@/api/settle/index"
 import { refundAmount } from "@/api/refund";
+import { expressDetail } from "@/api/express";
 
 export default {
   name: "detail",
@@ -379,7 +430,8 @@ export default {
     return {
       constant: this.$constant,
       orderInfo: {},
-      refreshPage: 0
+      refreshPage: 0,
+      expressData: {}
     };
   },
   
@@ -398,6 +450,34 @@ export default {
   },
   
   methods: {
+    /**
+     * 获取配送平台
+     */
+    getExpressPlatformText(platform) {
+      const platformMap = {
+        'DADA': '达达',
+        'SFTC': '顺丰',
+      }
+      return platformMap[platform] || platform
+    },
+    /**
+     * 转换配送状态为中文显示
+     */
+    getExpressStatusText(status) {
+      const statusMap = {
+        1: '订单创建成功',
+        2: '商家取消订单',
+        3: '配送方取消订单',
+        4: '配送员接单',
+        5: '配送员到店',
+        6: '配送中',
+        7: '配送员撤单',
+        8: '配送完成',
+        9: '配送异常'
+      }
+      return statusMap[status] || status
+    },
+    
     goPreOrder(info) {
       if (!this.$util.isEmpty(info.forwardMap)) {
         this.$util.pageTo({url: '/admin/order/detail?id=' + info.forwardMap.orderId})
@@ -507,6 +587,7 @@ export default {
     
     init() {
       this.getDetailInfo();
+      this.getExpressDetail();
     },
     
     getDetailInfo() {
@@ -514,6 +595,55 @@ export default {
         this.orderInfo = res.data;
         this.orderInfo.deadline = commonUtil.getFormatDate(this.orderInfo.deadline, 'MM-dd hh:mm')
       })
+    },
+    /**
+     * 打开配送页面
+     */
+     openExpressPage(orderId, isNew) {
+      const val = isNew ? 1 : 0;
+      this.$util.pageTo({ 
+        url: '/admin/express/create', 
+        query: { orderId: orderId, isNew: val }
+      })
+    },
+    /**
+     * 取消配送订单
+     */
+    async cancelExpress(orderId) {
+      this.$util.confirmModal({content: '确认取消?(若配送员接单1分钟后取消,扣2元违约金)'}, async () => {
+        try {
+          const res = await cancelExpressOrder({orderId: orderId})
+          if (res.code === 1) {
+            this.$msg('配送订单已取消')
+            // 刷新订单列表
+            this.resetList()
+            this.getOrderList()
+          } else {
+            this.$msg(res.msg || '取消配送订单失败')
+          }
+        } catch (error) {
+          this.$msg('取消配送订单失败,请重试')
+          console.error('取消配送订单错误:', error)
+        }
+      })
+    },
+    
+    /**
+     * 查看配送成功详情
+     */
+    selectExpress(orderId) {
+      this.$util.pageTo({ 
+        url: '/admin/express/success', 
+        query: { orderId: orderId }
+      })
+    },
+    /**
+     * 获取配送详情
+     */
+    getExpressDetail() {
+      expressDetail({ orderId: this.option.id }).then(res => {
+        this.expressData = res.data;
+      })
     }
   }
 };
@@ -677,4 +807,29 @@ export default {
   border: 1upx solid red;
   color: red;
 }
+
+/* 配送进度行样式 */
+.express-progress-row {
+  align-items: center;
+  
+  .express-actions {
+    margin-left: auto;
+    display: flex;
+    align-items: center;
+    gap: 12upx;
+    flex-shrink: 0;
+    
+    .admin-button-com {
+      font-size: 24upx;
+      padding: 8upx 16upx;
+      margin: 0;
+      
+      &.btn-danger {
+        background-color: #ff6b6b;
+        color: #fff;
+        border: none;
+      }
+    }
+  }
+}
 </style>

+ 5 - 0
hdApp/src/api/express/index.js

@@ -14,4 +14,9 @@ export const getUserDistance = data => {
 // 获取字典中的 hasMap
 export const getHasMap = data => {
 	return https.get('/express/get-has-map', data)
+}
+
+// 配送详情
+export const expressDetail = data => {
+	return https.post('/express/detail', data)
 }