import request, { postBlob, getBlob, handleImport } from '@/utils/request'

export function goodsPurchaseRetList(data) {
  return request({
    url: `/goods/purchase/ret/list?moduleId=${data.moduleId}`,
    method: 'post',
    data
  })
}

export function goodsPurchaseRetListExport(data, name) {
  return postBlob({
    url: '/goods/purchase/ret/list/export',
    data,
    name
  })
}

export function goodsPurchaseRetItemList(data) {
  return request({
    url: `/goods/purchase/ret/item/list?moduleId=${data.moduleId}`,
    method: 'post',
    data
  })
}

export function goodsPurchaseRetItemListExport(data, name) {
  return postBlob({
    url: '/goods/purchase/ret/item/list/export',
    data,
    name
  })
}

export function goodsPurchaseRetCodeList(data) {
  return request({
    url: `/goods/purchase/ret/code/list?moduleId=${data.moduleId}`,
    method: 'post',
    data
  })
}

export function goodsPurchaseRetCodeListExport(data, name) {
  return postBlob({
    url: '/goods/purchase/ret/code/list/export',
    data,
    name
  })
}

export function goodsPurchaseRetAdd(data) {
  return request({
    url: `/goods/purchase/ret/add`,
    method: 'post',
    data
  })
}

export function goodsPurchaseRetSubmit(params) {
  return request({
    url: `/goods/purchase/ret/submit`,
    method: 'post',
    params
  })
}

export function goodsPurchaseRetConfirm(params) {
  return request({
    url: `/goods/purchase/ret/confirm`,
    method: 'post',
    params
  })
}

export function goodsPurchaseRetDetail(params) {
  return request({
    url: `/goods/purchase/ret/detail`,
    method: 'post',
    params
  })
}

export function goodsPurchaseRetDel(params) {
  return request({
    url: `/goods/purchase/ret/del`,
    method: 'post',
    params
  })
}

export function goodsPurchaseRetItemImportCode(data) {
  return handleImport('/goods/purchase/ret/item/import/code', data.formdata, data.id || '')
}

export function goodsPurchaseRetItemAddCode(data) {
  return request({
    url: `/goods/purchase/ret/item/add/code`,
    method: 'post',
    data
  })
}

export function goodsPurchaseRetItemDelCode(params) {
  return request({
    url: `/goods/purchase/ret/item/del/code`,
    method: 'post',
    params
  })
}
