import http from '@/utils/http'
import { AppDispatch } from '@/store'

/**
 * 流程中心-获取详情
 */
export const API_getGoodsInfo = (id: number) => {
  return http.get(`cms/workFlow/orderDetail/${id}`)
}

/**
 * 流程中心-获取分页列表
 */
export const API_getGoodsList = (data: any): any => {
  return async (dispatch: AppDispatch) => {
    const res = await http.post(`cms/workFlow/orderPage`, data)
    if (res.code === 0) {
      const obj = {
        list: res.data.records,
        total: res.data.total
      }

      dispatch({ type: 'A3/getList', payload: obj })
    }
  }
}

/**
 * 流程中心-获取全部数据
 */
export const API_getGoodsListAll = () => {
  return http.post(`cms/workFlow/orderPage`, {
    auditType: 0,
    businessEndTime: '',
    businessStartTime: '',
    endTime: '',
    pageNum: 1,
    pageSize: 99999,
    searchKey: '',
    startTime: '',
    status: '',
    storageId: '',
    type: ''
  })
}
