diff --git a/src/api/index.js b/src/api/index.js index 6060e55..77be728 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -804,6 +804,16 @@ export const returnOrNoOrder = (params) => { return postBodyRequest('/mall/refund/allowOrReject', params) } +// 投诉吐槽分页 +export const getProblemFeedbackList = (params) => { + return postBodyRequest('/app/problemFeedback/getProblemFeedbackList', params) +} + +// 投诉吐槽回复 +export const replyProblemFeedback = (params) => { + return postBodyRequest('/app/problemFeedback/replyProblemFeedback', params) +} + //查询物流自取 export const getSaleByCompanyId = (params) => { diff --git a/src/views/sys/order-manage/orderManage.vue b/src/views/sys/order-manage/orderManage.vue index 981ae4d..0dce3b4 100644 --- a/src/views/sys/order-manage/orderManage.vue +++ b/src/views/sys/order-manage/orderManage.vue @@ -63,6 +63,24 @@ padding-top: 8px; text-align: right; } + + .feedback-preview { + text-align: center; + } + + .feedback-preview-img { + max-width: 100%; + max-height: 70vh; + border-radius: 4px; + } + + .feedback-preview-actions { + display: flex; + align-items: center; + justify-content: center; + margin-top: 12px; + gap: 12px; + } @@ -191,7 +242,9 @@ getOrderList, getReturnOrderList, returnOrNoOrder, - getGroupOrdersByOrderId + getGroupOrdersByOrderId, + getProblemFeedbackList, + replyProblemFeedback } from "@/api/index"; import addEdit from "./addEdit.vue"; import logisticsAddress from "@/views/sys/order-manage/logisticsAddress"; @@ -220,6 +273,14 @@ refundGoodsList: [], groupOrderVisible: false, groupOrderList: [], + feedbackTodoCount: 0, + feedbackDetailVisible: false, + feedbackDetail: {}, + feedbackReplyContent: "", + feedbackSubmitLoading: false, + feedbackPreviewVisible: false, + feedbackPreviewList: [], + feedbackPreviewIndex: 0, drop: false, dropDownContent: "展开", dropDownIcon: "ios-arrow-down", @@ -246,6 +307,11 @@ label: "待退款/售后", name: "refund", badge: true + }, + { + label: "投诉吐槽", + name: "feedback", + badge: true } ], statusTabs: [{ @@ -387,6 +453,17 @@ pageSize: 100, statusList: [0, 3], }, + feedbackForm: { + regionId: JSON.parse(this.getStore("user")).departmentId, + pageNum: 1, + pageSize: 10 + }, + feedbackCountForm: { + regionId: JSON.parse(this.getStore("user")).departmentId, + pageNum: 1, + pageSize: 1, + status: 0 + }, searchForm: { pageNum: 1, pageSize: 10, @@ -690,6 +767,94 @@ }, }, ], + feedbackColumns: [{ + type: "index", + width: 60, + align: "center", + fixed: "left", + }, + { + title: "反馈类型", + key: "feedbackType", + width: 110, + align: "center", + render: (h, params) => { + return h("span", params.row.feedbackType || "投诉吐槽"); + } + }, + { + title: "反馈用户", + key: "userName", + width: 150, + align: "center", + render: (h, params) => { + return h("span", params.row.userName || params.row.userId || ""); + } + }, + { + title: "联系电话", + key: "contactPhone", + width: 130, + align: "center", + }, + { + title: "反馈内容", + key: "problemContent", + minWidth: 260, + align: "center", + render: (h, params) => { + return h("Tooltip", { + props: { + content: params.row.problemContent || "无", + transfer: true, + } + }, [h("span", params.row.problemContent || "无")]); + } + }, + { + title: "状态", + key: "status", + width: 100, + align: "center", + render: (h, params) => { + return h("span", params.row.status == 1 ? "已回复" : "待回复"); + } + }, + { + title: "提交时间", + key: "createTime", + width: 180, + align: "center", + render: (h, params) => { + return h("span", this.formatDateTime(params.row.createTime)); + } + }, + { + title: "处理意见", + key: "handleOpinion", + minWidth: 200, + align: "center", + render: (h, params) => { + return h("span", params.row.handleOpinion || "未回复"); + } + }, + { + title: "操作", + key: "action", + width: 130, + align: "center", + fixed: "right", + render: (h, params) => { + return h("a", { + on: { + click: () => { + this.showFeedbackDetail(params.row); + }, + }, + }, params.row.status == 1 ? "查看详情" : "查看/回复"); + }, + }, + ], data: [], total: 0, }; @@ -706,16 +871,25 @@ return this.statusTabs; }, currentColumns() { - return this.isRefundTab ? this.refundColumns : this.columns; + if (this.isRefundTab) return this.refundColumns; + if (this.isFeedbackTab) return this.feedbackColumns; + return this.columns; }, isRefundTab() { return this.tabName == "refund"; }, + isFeedbackTab() { + return this.tabName == "feedback"; + }, currentPageNum() { - return this.isRefundTab ? this.returnForm.pageNum : this.searchForm.pageNum; + if (this.isRefundTab) return this.returnForm.pageNum; + if (this.isFeedbackTab) return this.feedbackForm.pageNum; + return this.searchForm.pageNum; }, currentPageSize() { - return this.isRefundTab ? this.returnForm.pageSize : this.searchForm.pageSize; + if (this.isRefundTab) return this.returnForm.pageSize; + if (this.isFeedbackTab) return this.feedbackForm.pageSize; + return this.searchForm.pageSize; } }, mounted() { @@ -724,6 +898,7 @@ methods: { init() { this.getRefundTodoCount(); + this.getFeedbackTodoCount(); this.getLogisticsInfo() }, closePage(){ @@ -745,6 +920,9 @@ if (item.name == "refund") { return this.renderRefundTabLabel; } + if (item.name == "feedback") { + return this.renderFeedbackTabLabel; + } return item.label; }, renderRefundTabLabel(h) { @@ -759,6 +937,18 @@ }, "待退款/售后") ]); }, + renderFeedbackTabLabel(h) { + return h("Badge", { + props: { + count: this.feedbackTodoCount, + overflowCount: 99 + } + }, [ + h("span", { + class: "order-tab-label" + }, "投诉吐槽") + ]); + }, getOrderStatusText(item) { if (!item) return ""; if (item.status == 0) return "待支付"; @@ -794,10 +984,15 @@ changeOrderTab(v){ this.searchForm.pageNum = 1; this.returnForm.pageNum = 1; + this.feedbackForm.pageNum = 1; if (v == "refund") { this.getReturnOrder(); return; } + if (v == "feedback") { + this.getProblemFeedback(); + return; + } this.searchForm.searchType = v if (!this.currentStatusTabs.some((item) => item.name == this.tabName1)) { this.tabName1 = this.currentStatusTabs[0].name; @@ -811,6 +1006,8 @@ changePage(v) { if (this.isRefundTab) { this.returnForm.pageNum = v; + } else if (this.isFeedbackTab) { + this.feedbackForm.pageNum = v; } else { this.searchForm.pageNum = v; } @@ -820,6 +1017,8 @@ changePageSize(v) { if (this.isRefundTab) { this.returnForm.pageSize = v; + } else if (this.isFeedbackTab) { + this.feedbackForm.pageSize = v; } else { this.searchForm.pageSize = v; } @@ -849,12 +1048,35 @@ } }); }, + getFeedbackTodoCount() { + getProblemFeedbackList(this.feedbackCountForm).then((res) => { + if (res.success && res.result) { + this.feedbackTodoCount = res.result.total || (res.result.records || []).length; + } + }); + }, + getProblemFeedback() { + this.loading = true; + getProblemFeedbackList(this.feedbackForm).then((res) => { + this.loading = false; + if (res.success) { + this.data = (res.result && res.result.records) || []; + this.total = (res.result && res.result.total) || 0; + } + }).catch(() => { + this.loading = false; + }); + }, //查询订单 getLogisticsInfo() { if (this.isRefundTab) { this.getReturnOrder(); return; } + if (this.isFeedbackTab) { + this.getProblemFeedback(); + return; + } this.loading = true; getOrderList(this.searchForm).then((res) => { this.loading = false; @@ -871,6 +1093,9 @@ if (this.isRefundTab) { this.returnForm.pageNum = 1; this.returnForm.pageSize = 10; + } else if (this.isFeedbackTab) { + this.feedbackForm.pageNum = 1; + this.feedbackForm.pageSize = 10; } else { this.searchForm.pageNum = 1; this.searchForm.pageSize = 10; @@ -883,6 +1108,8 @@ this.searchForm.pageSize = 10; this.returnForm.pageNum = 1; this.returnForm.pageSize = 10; + this.feedbackForm.pageNum = 1; + this.feedbackForm.pageSize = 10; // 重新加载数据 this.getLogisticsInfo(); }, @@ -945,6 +1172,52 @@ if (list.length == 0) return; window.open(list[0], "_blank"); }, + previewFeedbackImage(pictures, index = 0) { + const list = this.getPictureList(pictures); + if (list.length == 0) return; + this.feedbackPreviewList = list; + this.feedbackPreviewIndex = index >= 0 && index < list.length ? index : 0; + this.feedbackPreviewVisible = true; + }, + changeFeedbackPreview(step) { + if (this.feedbackPreviewList.length == 0) return; + const length = this.feedbackPreviewList.length; + this.feedbackPreviewIndex = (this.feedbackPreviewIndex + step + length) % length; + }, + showFeedbackDetail(row) { + this.feedbackDetail = Object.assign({}, row); + this.feedbackReplyContent = row.handleOpinion || ""; + this.feedbackDetailVisible = true; + }, + submitFeedbackReply() { + const opinion = (this.feedbackReplyContent || "").trim(); + if (opinion == "") { + this.$Message.warning("请输入处理意见"); + return; + } + this.feedbackSubmitLoading = true; + replyProblemFeedback({ + id: this.feedbackDetail.id, + handleOpinion: opinion + }).then((res) => { + this.feedbackSubmitLoading = false; + if (res.success) { + this.$Message.success(res.message || "回复成功"); + this.feedbackDetailVisible = false; + this.refreshWholePage(); + } else { + this.$Message.error(res.message || "回复失败"); + } + }).catch((err) => { + this.feedbackSubmitLoading = false; + this.$Message.error((err && err.message) || "回复失败"); + }); + }, + refreshWholePage() { + this.getRefundTodoCount(); + this.getFeedbackTodoCount(); + this.getLogisticsInfo(); + }, showRefundGoods(row) { this.refundGoodsList = row.items || []; this.refundGoodsVisible = true; @@ -1021,8 +1294,7 @@ this.submitRefundId = ""; if (res.success) { this.$Message.success(res.message || "处理成功"); - this.getReturnOrder(); - this.getRefundTodoCount(); + this.refreshWholePage(); } else { this.$Message.error(res.message || "处理失败"); }