import request from '@/utils/request'

/** 评价列表（待评价/已评价） */
export function listReviews(params) {
  return request({
    url: '/api/order/review/list',
    method: 'GET',
    params
  })
}

/** 查看订单商品行评价 */
export function getOrderReview(orderId, orderItemId) {
  return request({
    url: `/api/order/${orderId}/review`,
    method: 'GET',
    params: orderItemId != null && orderItemId !== '' ? { orderItemId } : undefined
  })
}

/** 提交评价 */
export function submitReview(orderId, data) {
  return request({
    url: `/api/order/${orderId}/review`,
    method: 'POST',
    data,
    header: { repeatSubmit: false }
  })
}
