import request from '@/config/axios'

// 查询工资条
export const getSalaryPage = async (params) => {
  return await request.get({ url: '/admin-api/oa/user-salary-grant/periodPage', params })
}

// 生成工资条
export const createSalarySlip = async (data) => {
  return await request.upload({
    url: '/admin-api/oa/user-salary-grant/import',
    data,
    isSubmitForm: true
  })
}

// 导入工资条
export const importSalarySlip = async (data) => {
  return await request.upload({ url: '/admin-api/oa/user-salary-grant/import/history', data })
}

// 修改工资条
export const updateSalarySlip = async (data) => {
  return await request.put({ url: '/admin-api/oa/user-salary-grant/batchUpdate', data })
}

// 封存
export const sealupSalarySlip = async (data) => {
  return await request.post({ url: '/admin-api/oa/user-salary-grant/confirm', data })
}

// 获取考勤模板链接
export const getLinkAttendance = async () => {
  return await request.download({
    url: '/admin-api/oa/user-attendance/get-import-template'
  })
}

// 获取奖金模板
export const getLinkReward = async () => {
  return await request.download({
    url: '/admin-api/oa/user-salary-grant/get-import-template'
  })
}

// 获取历史工资条模板
export const getLinkHistorySalary = async () => {
  return await request.download({
    url: '/admin-api/oa/user-salary-grant/get-import-template/history'
  })
}

// 查询提成明细
export const getCommissionDetail = async (params) => {
  return await request.get({ url: '/admin-api/oa/user-salary-grant/detail', params })
}

// 发送工资条通知
export const sendSalaryNotice = (data) => {
  return request.post({ url: '/admin-api/oa/user-salary-grant/pushUserSalaryGrantDetail', data })
}
