import request from '@/config/axios'

// 交易订单	 VO
export interface TradeOrderVO {
  userId: number // 用户编号
  type: string // 订单类型
  spuId: number // 商品编号
  spuName: string // 商品名字
  price: number // 价格，单位：分
  enterpriseId: number
  userType: string
}

// 交易订单	 API
export const TradeOrderApi = {
  // 查询订单	分页
  getTradeOrderPage: async (params: any) => {
    return await request.get({ url: `/menduner/system/trade/order/page`, params })
  },

  // 创建订单	
  createTradeOrder: async (data: TradeOrderVO) => {
    return await request.post({ url: `/menduner/system/trade/order/create`, data })
  },

  // 发起订单退款	
  updateTradeOrder: async (id: number) => {
    return await request.put({ url: `/menduner/system/trade/order/refund?id=${id}` })
  },

  // 职位发布
  updateOrderStatusToPublish: async (jobId: string | number) => {
    return await request.post({ url: `/menduner/system/job-advertised/wait/job/manual/submit?jobId=${jobId}` })
  }
}