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 = () => {