import request from '@/utils/request';

export function packTwiceList(query) {
  const {pageNum, pageSize, date, ...data} = query;
  if (Array.isArray(date)) [data.startTime, data.endTime = data.startTime] = date;
  return request({
    url: '/yfc-admin/prescriptionManage/logisticsPage',
    method: 'post',
    data,
    params: {pageNum, pageSize},
  })
}

export function dispatchList(query) {
  const {pageNum, pageSize, ...data} = query;
  return request({
    url: '/yfc-admin/prescriptionManage/resFlowPage',
    method: 'post',
    data,
    params: {pageNum, pageSize},
  })
}

// 物流管理报表导出
export function exportDispatchReport(query) {
  const {pageNum, pageSize, ...data} = query;
  return request({
    url: '/yfc-admin/prescriptionManage/exportResFlow',
    method: 'post',
    data,
    responseType: 'blob',
    fileType: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8',
  })
}
