Browse Source

feat: 积分订单详情页增加操作记录和物流信息同步功能

- 新增订单操作记录表格展示
- 新增物流信息同步按钮功能
- 添加获取订单操作记录API接口
- 优化物流信息加载状态显示
dengweize 1 month ago
parent
commit
12c4c582ae
3 changed files with 86 additions and 2 deletions
  1. 3 0
      .gitignore
  2. 8 0
      src/api/his/integralOrder.js
  3. 75 2
      src/views/components/his/integralOrderDetails.vue

+ 3 - 0
.gitignore

@@ -25,3 +25,6 @@ pnpm-debug.log*
 
 
 package-lock.json
 package-lock.json
 yarn.lock
 yarn.lock
+
+# AGENTS.md - 项目指导文档,不上传到远程仓库
+AGENTS.md

+ 8 - 0
src/api/his/integralOrder.js

@@ -132,4 +132,12 @@ export function getIntegralTemplate(){
     url: '/his/integralOrder/importUpdateOrderTemplate',
     url: '/his/integralOrder/importUpdateOrderTemplate',
     method: 'get'
     method: 'get'
   })
   })
+}
+
+// 获取订单操作记录
+export function getOrderLogs(orderId) {
+  return request({
+    url: '/his/logs/order/' + orderId,
+    method: 'get'
+  })
 }
 }

+ 75 - 2
src/views/components/his/integralOrderDetails.vue

@@ -106,6 +106,27 @@
 
 
       </el-table>
       </el-table>
     </div>
     </div>
+    
+    <!-- 操作记录 -->
+    <div class="contentx" v-if="item != null" style="padding-bottom: 70px;">
+      <div class="desct">
+        操作记录
+      </div>
+      <el-table :data="orderLogs" border style="width: 100%; margin-top: 20px;" v-loading="logsLoading">
+        <!-- <el-table-column prop="changeType" label="操作类型" align="center" width="120">
+        </el-table-column> -->
+        <el-table-column prop="changeTime" label="操作时间" align="center" width="180">
+          <template slot-scope="scope">
+            {{ parseTime(scope.row.changeTime) }}
+          </template>
+        </el-table-column>
+        <el-table-column prop="changeMessage" label="操作备注" align="center">
+        </el-table-column>
+        <!-- <el-table-column prop="operator" label="操作员" align="center" width="120">
+        </el-table-column> -->
+        
+      </el-table>
+    </div>
     <el-dialog width="35%" title="发货" :visible.sync="sendVisible" append-to-body @close="sendCancel">
     <el-dialog width="35%" title="发货" :visible.sync="sendVisible" append-to-body @close="sendCancel">
       <el-form ref="form" :model="form" label-width="120px">
       <el-form ref="form" :model="form" label-width="120px">
         <el-form-item label="快递名称" prop="deliveryName">
         <el-form-item label="快递名称" prop="deliveryName">
@@ -179,7 +200,10 @@
     </el-dialog>
     </el-dialog>
 
 
     <el-dialog :title="expressDialog.title" :visible.sync="expressDialog.open" width="600px" append-to-body>
     <el-dialog :title="expressDialog.title" :visible.sync="expressDialog.open" width="600px" append-to-body>
-      <el-table style="margin-top: 20px;width: 100%" ref="orderHistoryTable" :data="traces" border>
+      <div style="margin-bottom: 10px; text-align: right;">
+        <el-button type="primary" size="small" @click="syncExpressInfo" :loading="syncLoading">同步物流信息</el-button>
+      </div>
+      <el-table style="margin-top: 20px;width: 100%" ref="orderHistoryTable" :data="traces" border v-loading="tableLoading">
         <el-table-column label="操作时间" width="160" align="center">
         <el-table-column label="操作时间" width="160" align="center">
           <template slot-scope="scope">
           <template slot-scope="scope">
             {{ scope.row.AcceptTime }}
             {{ scope.row.AcceptTime }}
@@ -345,7 +369,7 @@
 </template>
 </template>
 
 
 <script>
 <script>
-import { getExpress,mandatoryRefunds,getCitys,finishOrder, listIntegralOrder, sendgoods, getIntegralOrder, delIntegralOrder, addIntegralOrder, updateIntegralOrder, exportIntegralOrder, getOrderUserPhone } from "@/api/his/integralOrder";
+import { getExpress,mandatoryRefunds,getCitys,finishOrder, listIntegralOrder, sendgoods, getIntegralOrder, delIntegralOrder, addIntegralOrder, updateIntegralOrder, exportIntegralOrder, getOrderUserPhone, getOrderLogs } from "@/api/his/integralOrder";
 import { getExpressList } from "@/api/his/express";
 import { getExpressList } from "@/api/his/express";
 import { listAccount } from "@/api/his/dfAccount";
 import { listAccount } from "@/api/his/dfAccount";
 export default {
 export default {
@@ -429,6 +453,11 @@ export default {
       selectedDistrict: null, // 选中的区
       selectedDistrict: null, // 选中的区
       detailAddress: '', // 详细地址
       detailAddress: '', // 详细地址
       deliveryTypeOptions:[],
       deliveryTypeOptions:[],
+      // 操作记录相关数据
+      orderLogs: [], // 订单操作记录
+      logsLoading: false, // 操作记录加载状态
+      syncLoading: false, // 同步物流信息按钮加载状态
+      tableLoading: false // 物流信息表格加载状态
     }
     }
   },
   },
   created() {
   created() {
@@ -726,13 +755,31 @@ export default {
     },
     },
     showExpress() {
     showExpress() {
       this.expressDialog.open = true;
       this.expressDialog.open = true;
+      this.loadExpressInfo();
+    },
+    // 加载物流信息
+    loadExpressInfo() {
+      this.tableLoading = true;
       getExpress(this.item.orderId).then(response => {
       getExpress(this.item.orderId).then(response => {
         this.express = response.data;
         this.express = response.data;
         if (this.express != null && this.express.Traces != null) {
         if (this.express != null && this.express.Traces != null) {
           this.traces = this.express.Traces
           this.traces = this.express.Traces
+        } else {
+          this.traces = [];
         }
         }
+        this.tableLoading = false;
+      }).catch(error => {
+        this.traces = [];
+        this.tableLoading = false;
+        console.error('获取物流信息失败:', error);
       });
       });
     },
     },
+    // 同步物流信息
+    syncExpressInfo() {
+      this.syncLoading = true;
+      this.loadExpressInfo();
+      this.syncLoading = false;
+    },
     sendGoods() {
     sendGoods() {
       // 手动验证所有必填字段
       // 手动验证所有必填字段
       if (!this.selectedRow) {
       if (!this.selectedRow) {
@@ -772,9 +819,12 @@ export default {
     },
     },
     getDetails(orderId) {
     getDetails(orderId) {
       this.item = null;
       this.item = null;
+      this.orderLogs = []; // 清空操作记录
       getIntegralOrder(orderId).then(response => {
       getIntegralOrder(orderId).then(response => {
         this.item = response.data;
         this.item = response.data;
         this.prod = [JSON.parse(this.item.itemJson)][0];
         this.prod = [JSON.parse(this.item.itemJson)][0];
+        // 获取操作记录
+        this.getOrderLogsData();
       });
       });
     },
     },
     // 代服账号选择变化
     // 代服账号选择变化
@@ -884,6 +934,29 @@ export default {
         console.error('完成订单失败:', error);
         console.error('完成订单失败:', error);
       });
       });
     },
     },
+    // 获取订单操作记录
+    getOrderLogsData() {
+      if (!this.item || !this.item.orderId) {
+        return;
+      }
+      
+      this.logsLoading = true;
+      getOrderLogs(this.item.orderId).then(response => {
+        if (response.code === 200) {
+          // 按照时间升序排列
+          this.orderLogs = response.data.sort((a, b) => {
+            return new Date(a.changeTime) - new Date(b.changeTime);
+          });
+        } else {
+          this.orderLogs = [];
+        }
+        this.logsLoading = false;
+      }).catch(error => {
+        this.orderLogs = [];
+        this.logsLoading = false;
+        console.error('获取操作记录失败:', error);
+      });
+    }
   }
   }
 }
 }
 </script>
 </script>