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

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

/**
 * 藏品删除-创建订单
 */
export const B4_APIcreate = (data: any) => {
  return http.post('cms/order/del/create', data)
}

/**
 * 藏品删除-重新提交
 */
export const B4_APIresubmit = (orderId: number, data: any) => {
  return http.post(`cms/order/del/edit/${orderId}`, data)
}

/**
 * 藏品删除-获取详情
 */
export const B4_APIgetInfo = (id: number) => {
  return http.get(`cms/order/del/detail/${id}`)
}

/**
 * 藏品删除-审批
 */
export const B4_APIaduit = (data: any) => {
  return http.post('cms/order/del/audit', data)
}
