瀏覽代碼

feat(投诉管理): 添加回复状态跟踪功能

yz 4 周之前
父節點
當前提交
764f4a6d97
共有 1 個文件被更改,包括 18 次插入0 次删除
  1. 18 0
      src/views/complaint/complaintMixin.js

+ 18 - 0
src/views/complaint/complaintMixin.js

@@ -20,6 +20,7 @@ import {
   REPLY_TYPE_OPTIONS,
   COMPLAINT_STATUS,
   REPLY_TYPE,
+  REPLY_STATUS,
   getComplainantTypeLabel,
   getComplaintTypeLabel,
   getComplainantTypeType,
@@ -111,6 +112,8 @@ export default {
       replyTotal: 0,
       currentComplaintId: '',
       currentComplaintNo: '',
+      /** @type {number} */
+      currentComplaintReplyStatus: 0,
       // 新增回复相关数据
       addReplyVisible: false,
       replyForm: {
@@ -490,6 +493,7 @@ export default {
     async handleReplyList(row) {
       this.currentComplaintId = row.id
       this.currentComplaintNo = row.complaintNo
+      this.currentComplaintReplyStatus = row.replyStatus
       this.replyListVisible = true
       this.replyPage.current = 1
       await this.loadReplyList()
@@ -578,6 +582,20 @@ export default {
           this.$message.success('新增回复成功')
           this.addReplyVisible = false
           
+          // 如果当前投诉的回复状态是未回复,则更新为已回复
+          if (this.currentComplaintReplyStatus === REPLY_STATUS.NOT_REPLIED) {
+            try {
+              const updateData = {
+                id: this.currentComplaintId,
+                replyStatus: REPLY_STATUS.REPLIED
+              }
+              await update(updateData)
+              this.currentComplaintReplyStatus = REPLY_STATUS.REPLIED
+            } catch (error) {
+              console.error('更新投诉回复状态失败:', error)
+            }
+          }
+          
           // 重新加载回复列表
           await this.loadReplyList()