From c91dd28fa350574e76dd4b7b78552a8390bc40f8 Mon Sep 17 00:00:00 2001
From: Suk1No <674874220@qq.com>
Date: Sat, 23 Aug 2025 15:20:15 +0800
Subject: [PATCH] =?UTF-8?q?=E8=AF=84=E8=AE=BA=E6=8E=A5=E5=8F=A3=E5=AF=B9?=
=?UTF-8?q?=E6=8E=A5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
order-app/src/api/user.js | 4 ++++
order-app/src/pages/order/order.vue | 32 ++++++++++++++++++++++++-----
2 files changed, 31 insertions(+), 5 deletions(-)
diff --git a/order-app/src/api/user.js b/order-app/src/api/user.js
index 0df2fba..52f43f7 100644
--- a/order-app/src/api/user.js
+++ b/order-app/src/api/user.js
@@ -88,4 +88,8 @@ export const uploadImageApi = (parm) => {
//头像昵称更新
export const saveOrUpdateApi = (parm) => {
return http.post("/wxapi/wxUser/saveOrUpdate", parm)
+}
+//新增评论
+export const addCommentApi = (parm) => {
+ return http.post("/wxapi/comment/addComment", parm)
}
\ No newline at end of file
diff --git a/order-app/src/pages/order/order.vue b/order-app/src/pages/order/order.vue
index 981d016..9f21a60 100644
--- a/order-app/src/pages/order/order.vue
+++ b/order-app/src/pages/order/order.vue
@@ -49,7 +49,8 @@
取消订单
- 评价
+ 评价
+
@@ -61,7 +62,7 @@
-
+
@@ -75,14 +76,20 @@
getOrderListApi,
cancelOrderApi
} from '../../api/order.js'
+ import {
+ addCommentApi
+ } from '../../api/user.js'
import {
ref,
computed
} from 'vue'
//评论弹框显示
const show = ref(false)
+ const orderId = ref('')
+ const commentText = ref('')
//评价点击事件
- const commentBtn = () => {
+ const commentBtn = (item) => {
+ orderId.value = item.orderId;
show.value = true
}
const tabs = ref(null);
@@ -211,9 +218,24 @@
});
}
//评论提交
- const confirmBtn = () => {
+ const confirmBtn = async () => {
console.log('确定')
- show.value = false
+ if (!commentText.value) {
+ uni.showToast({
+ icon: 'none',
+ title: '请填写评论'
+ })
+ return;
+ }
+ let res = await addCommentApi({
+ orderId: orderId.value,
+ openid: uni.getStorageSync('openid'),
+ commentText: commentText.value
+ })
+ if (res && res.code == 200) {
+ show.value = false
+ }
+
}
//评论取消
const cancelBtn = () => {