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

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

/**
 * 业务订单 删除单个表格数据
 */
export const A2A_APIremove = (id: number) => {
  return http.get(`cms/order/remove/${id}`)
}

/**
 * 业务订单 新增/修改
 */
export const A2A_APIadd = (data: any) => {
  return http.post('cms/order/save', data)
}

/**
 * 业务订单 通过id获取详情
 */
export const A2A_APIgetInfo = (id: number) => {
  return http.get(`cms/order/detail/${id}`)
}
