/**
 * 委托书接口
*/
import request from '../../index'
import type { IListQuery } from '@/views/business/schedule/order/orderList_interface'
const prefix = '/business'

// 列表查询
export function getOrderList(data: IListQuery) {
  return request({
    url: `${prefix}/order/listPage?offset=${data.offset}&limit=${data.limit}`,
    method: 'post',
    data,
  })
}

// 导出列表
export function exportOrderList(data: Omit<IListQuery, 'limit' | 'offset'>) {
  return request({
    url: `${prefix}/order/export`,
    method: 'post',
    responseType: 'blob',
    data,
  })
}

// 接收
export function receiveOrder(data: { id: string }) {
  return request({
    url: `${prefix}/order/receive`,
    method: 'post',
    data,
  })
}

// 退回
export function backOrder(data: { id: string }) {
  return request({
    url: `${prefix}/order/back`,
    method: 'post',
    data,
  })
}

// 新增
export function addOrder(data: any) {
  return request({
    url: `${prefix}/order/add`,
    method: 'post',
    data,
  })
}

// 编辑
export function updateOrder(data: any) {
  return request({
    url: `${prefix}/order/update`,
    method: 'post',
    data,
  })
}

// 详情
export function getOrderDetail(data: any) {
  return request({
    url: `${prefix}/order/detail`,
    method: 'post',
    data,
  })
}

// 选择样品列表
export function getOrderSampleList(data: { customerId?: string; customerNo: string; orderId?: string }) {
  return request({
    url: '/customer/sample/listPageByOrder',
    method: 'post',
    data,
  })
}
