diff --git a/src/pages/user/order/order_detail.vue b/src/pages/user/order/order_detail.vue index ad153579b9888faf522af100a3280f2f116c60ee..37f751c9dc5d42fef04605aa60b17fd459703736 100644 --- a/src/pages/user/order/order_detail.vue +++ b/src/pages/user/order/order_detail.vue @@ -623,8 +623,58 @@ export default { }, methods: { addEvaluation() { - console.log(this.serviceRate, this.textarea); - this.visible = false; + if (this.textarea == "" || this.serviceRate == null) { + this.$message({ + message: "请先完善评价内容", + type: "error", + }); + } else { + if (this.orderDetail.order_type == 1) { + let query = { + service_id: this.orderDetail.service_id, + content: this.textarea, + score: this.serviceRate, + apply_id: this.orderDetail.apply_id, + }; + this.$api.user.addServiceEvaluation(query).then((response) => { + if (response.data.success == 1) { + this.$message({ + message: "评价订单成功", + type: "success", + }); + this.visible = false; + this.getOrderDetail(); + } else { + this.$message({ + message: "评价订单失败", + type: "error", + }); + } + }); + } else if (this.orderDetail.order_type == 2) { + let query = { + app: this.orderDetail.app_id, + content: this.textarea, + score: this.serviceRate, + apply_id: this.orderDetail.apply_id, + }; + this.$api.user.addServiceEvaluation(query).then((response) => { + if (response.data.success == 1) { + this.$message({ + message: "评价订单成功", + type: "success", + }); + this.visible = false; + this.getOrderDetail(); + } else { + this.$message({ + message: "评价订单失败", + type: "error", + }); + } + }); + } + } }, download() {}, getOrderDetail() {