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

export function partsPartssalesorderSalesOrderList(data) {
  return request({
    url: `/parts/sales/order/list?moduleId=${data.moduleId}`,
    method: 'post',
    data
  })
}

export function partsPartssalesorderSalesOrderExport(data, name) {
  return postBlob({
    url: '/parts/sales/order/list/export',
    data,
    name
  })
}

// -------------------------------------------

export function partsPartssalesorderSalesOrderAdd(data) {
  return request({
    url: `/parts/sales/order/add`,
    method: 'post',
    data
  })
}

export function partsPartssalesorderSalesOrderEdit(data) {
  return request({
    url: `/parts/sales/order/update`,
    method: 'post',
    data
  })
}

export function partsPartssalesorderCode(params) {
  return request({
    url: `/parts/sales/order/code`,
    method: 'post',
    params
  })
}

export function partsSalesOrderChangeCredit(params) {
  return request({
    url: `/parts/sales/order/change-credit`,
    method: 'post',
    params
  })
}

export function partsPartssalesorderSalesOrderDetail(params) {
  return request({
    url: `/parts/sales/order/loadSalesOrderById`,
    method: 'post',
    params
  })
}

export function partsPartssalesorderSubmit(params) {
  return request({
    url: `/parts/sales/order/submit`,
    method: 'post',
    params
  })
}

export function partsPartssalesorderConfirmDelivery(params) {
  return request({
    url: `/parts/sales/order/confirm/delivery`,
    method: 'post',
    params
  })
}

export function partsPartssalesorderDeleteById(params) {
  return request({
    url: `/parts/sales/order/deleteById`,
    method: 'post',
    params
  })
}

export function partsPartssalesorderBackToSave(params) {
  return request({
    url: `/parts/sales/order/backToSave`,
    method: 'post',
    params
  })
}

export function partsPartssalesorderQueryPartsNewQty(params) {
  return request({
    url: `/parts/sales/order/query/parts/new/qty`,
    method: 'post',
    params
  })
}

export function partsPartssalesorderCancel(params) {
  return request({
    url: `/parts/sales/order/cancel`,
    method: 'post',
    params
  })
}

export function partsPartssalesorderChangeCash(params) {
  return request({
    url: `/parts/sales/order/change-cash`,
    method: 'post',
    params
  })
}

// -------------------------------------------

export function partsPartssalesorderSalesOrderShopList(data) {
  return request({
    url: `/parts/sales/order/websit/list?moduleId=${data.moduleId}`,
    method: 'post',
    data
  })
}

export function partsPartssalesorderSalesOrderShopExport(data, name) {
  return postBlob({
    url: '/parts/sales/order/websit/list/export',
    data,
    name
  })
}

// 查询支付情况
export function queryPayStatus(params) {
  return request({
    url: '/parts/sales/order/query/pay/status',
    method: 'get',
    params
  })
}
