lxr 2 luni în urmă
părinte
comite
a4b8d3926b

+ 33 - 10
src/api/modules/newLoginApi.ts

@@ -183,6 +183,7 @@ export const addAppealNew = (params: FormData | Record<string, unknown>) => {
   return httpLogin.post(`/alienStore/storeCommentAppeal/addAppealNew`, params);
 };
 
+// 动态-------------------------------------------------------------------------------------
 /** 商家端 commonComment/addComment:发表评论/回复(评价回复 sourceType=1,动态评论 sourceType=2) */
 // 发表评论 - 表单形式提交(字符串键值对,非 JSON 对象)
 export const addComment = (data: {
@@ -215,16 +216,6 @@ export const addComment = (data: {
 export const saveComment = (params: any) => {
   const businessType = Number(params.businessType ?? 0);
   const isRating = businessType === 1;
-  // const payload = {
-  //   sourceType: isRating ? 1 : 2,
-  //   sourceId: isRating ? params.replyId : params.businessId,
-  //   userId: String(params.userId ?? params.phoneId ?? ""),
-  //   parentId: isRating ? 0 : Number(params.replyId || 0),
-  //   content: String(params.commentContent ?? params.content ?? ""),
-  //   commentType: 2,
-  //   merchantId: String(params.merchantId ?? params.storeId ?? params.businessId ?? ""),
-  //   isAnonymous: 0
-  // };
   const payload = {
     commentContent: String(params.commentContent ?? params.content ?? ""),
     businessType: 2,
@@ -238,6 +229,38 @@ export const saveComment = (params: any) => {
   return addComment(payload);
 };
 
+// 评价-------------------------------------------------------------------------------------
+export const addComment2 = (data: {
+  sourceType: number; // 1-评价的评论 2-动态等
+  sourceId: string | number; // 评价ID或动态ID
+  userId: string;
+  parentId: number; // 0-根评论
+  content: string;
+  commentType: number; // 2-商户评论
+  merchantId: string;
+  isAnonymous?: number;
+}) => {
+  return httpLogin.post(`/alienStore/commonComment/addComment`, {
+    ...data,
+    isAnonymous: data.isAnonymous ?? 0
+  });
+};
+export const saveComment2 = (params: any) => {
+  const businessType = Number(params.businessType ?? 0);
+  const isRating = businessType === 1;
+  const payload = {
+    sourceType: isRating ? 1 : 2,
+    sourceId: isRating ? params.replyId : params.businessId,
+    userId: String(params.userId ?? params.phoneId ?? ""),
+    parentId: isRating ? 0 : Number(params.replyId || 0),
+    content: String(params.commentContent ?? params.content ?? ""),
+    commentType: 2,
+    merchantId: String(params.merchantId ?? params.storeId ?? params.businessId ?? ""),
+    isAnonymous: 0
+  };
+  return addComment2(payload);
+};
+
 //评论列表
 export const commentList = (params: any) => {
   return httpLogin.get(`/alienStore/storeComment/getList`, params);

+ 2 - 2
src/views/dynamicManagement/reviewAppeal.vue

@@ -227,7 +227,7 @@ import { useRouter } from "vue-router";
 import { ElMessage } from "element-plus";
 import { User, Plus, VideoPlay } from "@element-plus/icons-vue";
 import type { FormInstance, FormRules, UploadUserFile } from "element-plus";
-import { getList, addAppealNew, saveComment, uploadImg, getRatingCount } from "@/api/modules/newLoginApi";
+import { getList, addAppealNew, saveComment2, uploadImg, getRatingCount } from "@/api/modules/newLoginApi";
 import { localGet } from "@/utils";
 import { useUserStore } from "@/stores/modules/user";
 
@@ -531,7 +531,7 @@ const submitReply = async () => {
         replyId: currentReplyReview.value.id
       };
 
-      const res: any = await saveComment(params);
+      const res: any = await saveComment2(params);
       const isOk = res?.code === 200 || res?.code === 0;
 
       if (isOk) {