import http from '@/utils/http'
import { AppDispatch } from '..'
/**
 * 获取 物流订单 表格列表（存到仓库）
 */
export const A2B_APIgetlist = (data: any): any => {
  return async (dispatch: AppDispatch) => {
    const res = await http.post('cms/logistics/pageList', data)
    if (res.code === 0) {
      const obj = {
        list: res.data.records,
        total: res.data.total
      }
      dispatch({ type: 'A2B/getList', payload: obj })
    }
  }
}

/**
 * 获取 物流订单 表格列表（导出表格）
 */
export const A2B_APIgetlistDerive = (data: any) => {
  return http.post('cms/logistics/pageList', data)
}

/**
 * 物流订单 删除单个表格数据
 */
export const A2B_APIremove = (id: number) => {
  return http.get(`cms/logistics/remove/${id}`)
}

/**
 * 物流订单 新增/修改
 */
export const A2B_APIadd = (data: any) => {
  return http.post('cms/logistics/save', data)
}

/**
 * 物流订单 通过id获取详情
 */
export const A2B_APIgetInfo = (id: number) => {
  return http.get(`cms/logistics/detail/${id}`)
}

/**
 * 物流订单 从业务订单中添加
 */
export const A2B_APIgetCamera = (orderNum: string) => {
  return http.get(`cms/logistics/order/getCamera${orderNum}`)
}
