import http from '@/utils/http'
import { AppDispatch } from '..'
/**
 * 藏品移库-获取列表
 */
export const C3_APIgetlist = (data: any, exportFlag?: boolean): any => {
  if (exportFlag) return http.post('cms/orderSite/move/page', data)
  else {
    return async (dispatch: AppDispatch) => {
      const res = await http.post('cms/orderSite/move/page', data)
      if (res.code === 0) {
        const obj = {
          list: res.data.records,
          total: res.data.total
        }

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

/**
 * 藏品移库-创建订单
 */
export const C3_APIcreate = () => {
  return http.get('cms/orderSite/move/create')
}

/**
 * 藏品移库-提交
 */
export const C3_APIresubmit = (data: any) => {
  return http.post('cms/orderSite/move/apply', data)
}

/**
 * 藏品移库-获取详情
 */
export const C3_APIgetInfo = (id: number) => {
  return http.get(`cms/orderSite/move/detail/${id}`)
}

/**
 * 藏品移库-审批
 */
export const C3_APIaduit = (data: any) => {
  return http.post('cms/orderSite/move/audit', data)
}
