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

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

/**
 * 藏品修改-创建订单
 */
export const B3_APIcreate = (data: any) => {
  return http.post('cms/order/edit/create', data)
}

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

/**
 * 藏品修改-获取详情
 */
export const B3_APIgetInfo = (id: number) => {
  return http.get(`cms/order/edit/detail/${id}`)
}

/**
 * 藏品修改-审批
 */
export const B3_APIaduit = (data: any) => {
  return http.post('cms/order/edit/audit', data)
}
