import request from '@/config/axios'

export interface TaskRecordVO {
  id: number
  orderNo: string
  userId: number
  quantity: number
  productId: number
  unitPrice: number
  totalPrice: number
  combination: number
  taskSequence: number
  status: number
  orderTime: Date
  submitTime: Date
  starRating: number
  description: string
}

// 查询任务记录列表
export const getTaskRecordPage = async (params) => {
  return await request.get({ url: `/member/task-record/page`, params })
}

// 查询任务记录详情
export const getTaskRecord = async (id: number) => {
  return await request.get({ url: `/member/task-record/get?id=` + id })
}

// 新增任务记录
export const createTaskRecord = async (data: TaskRecordVO) => {
  return await request.post({ url: `/member/task-record/create`, data })
}

// 修改任务记录
export const updateTaskRecord = async (data: TaskRecordVO) => {
  return await request.put({ url: `/member/task-record/update`, data })
}

// 删除任务记录
export const deleteTaskRecord = async (id: number) => {
  return await request.delete({ url: `/member/task-record/delete?id=` + id })
}

// 导出任务记录 Excel
export const exportTaskRecord = async (params) => {
  return await request.download({ url: `/member/task-record/export-excel`, params })
}
