comment.ts 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. import request from '@/config/axios'
  2. export interface CommentVO {
  3. id: number
  4. userId: number
  5. userNickname: string
  6. userAvatar: string
  7. anonymous: boolean
  8. orderId: number
  9. orderItemId: number
  10. spuId: number
  11. spuName: string
  12. skuId: number
  13. visible: boolean
  14. scores: number
  15. descriptionScores: number
  16. benefitScores: number
  17. content: string
  18. picUrls: string
  19. replyStatus: boolean
  20. replyUserId: number
  21. replyContent: string
  22. replyTime: Date
  23. }
  24. // 查询商品评论列表
  25. export const getCommentPage = async (params) => {
  26. return await request.get({ url: `/product/comment/page`, params })
  27. }
  28. // 查询商品评论详情
  29. export const getComment = async (id: number) => {
  30. return await request.get({ url: `/product/comment/get?id=` + id })
  31. }
  32. // 添加自评
  33. export const createComment = async (data: CommentVO) => {
  34. return await request.post({ url: `/product/comment/create`, data })
  35. }
  36. // 显示 / 隐藏评论
  37. export const updateCommentVisible = async (data: any) => {
  38. return await request.put({ url: `/product/comment/update-visible`, data })
  39. }
  40. // 商家回复
  41. export const replyComment = async (data: any) => {
  42. return await request.put({ url: `/product/comment/reply`, data })
  43. }