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

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

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

/**
 * 藏品登记-获取详情
 */
export const B2_APIgetInfo = (id: number) => {
  return http.get(`cms/order/register/detail/${id}`)
}

/**
 * 藏品登记-审批
 */
export const B2_APIaduit = (data: any) => {
  return http.post('cms/order/register/audit', data)
}
