import request from '@/utils/request'

// 查询售后记录列表
export function listSales(query) {
  return request({
    url: '/store/storeAfterSales/list',
    method: 'get',
    params: query
  })
}

// 查询售后记录详细
export function getSales(id) {
  return request({
    url: '/store/storeAfterSales/' + id,
    method: 'get'
  })
}
export function depotAuditing(data) {
  return request({
    url: '/store/storeAfterSales/depotAuditing',
    method: 'put',
    data: data
  })
}
// 查询售后记录详细
export function itemList(id) {
  return request({
    url: '/store/storeAfterSales/itemList/' + id,
    method: 'get'
  })
}
export function codeId(id) {
  return request({
    url: '/store/storeAfterSales/codeId/' + id,
    method: 'get'
  })
}

export function logList(id) {
  return request({
    url: '/store/storeAfterSales/logList/' + id,
    method: 'get'
  })
}
// 新增售后记录
export function addSales(data) {
  return request({
    url: '/store/storeAfterSales',
    method: 'post',
    data: data
  })
}

// 修改售后记录
export function updateSales(data) {
  return request({
    url: '/store/storeAfterSales',
    method: 'put',
    data: data
  })
}
// 审核
export function auditing(data) {
  return request({
    url: '/store/storeAfterSales/auditing',
    method: 'put',
    data: data
  })
}

// 财务审核
export function tuiMoney(data) {
  return request({
    url: '/store/storeAfterSales/tuiMoney',
    method: 'put',
    data: data
  })
}
// 撤销
export function noAuditing(data) {
  return request({
    url: '/store/storeAfterSales/noAuditing',
    method: 'put',
    data: data
  })
}

// 撤销（与 admin 平台 /cancel 保持一致）
export function cancelSales(data) {
  return request({
    url: '/store/storeAfterSales/cancel',
    method: 'post',
    data: data
  })
}

// 平台审核（与 admin 平台 /audit1 保持一致）
export function audit1(data) {
  return request({
    url: '/store/storeAfterSales/audit1',
    method: 'post',
    data: data
  })
}

// 删除售后记录
export function delSales(id) {
  return request({
    url: '/store/storeAfterSales/' + id,
    method: 'delete'
  })
}

// 导出售后记录
export function exportSales(query) {
  return request({
    url: '/store/storeAfterSales/export',
    method: 'get',
    params: query
  })
}

// 查询售后记录详细
export function getRelatedProducts(id) {
  return request({
    url: '/store/storeAfterSales/getRelatedProducts/' + id,
    method: 'get'
  })
}

// 查询用户寄回快递轨迹
export function getExpress(id) {
  return request({
    url: '/store/storeAfterSales/getExpress/' + id,
    method: 'get'
  })
}
