import request from '@/utils/request'
import state from '@/store'
import router from '@/router'

// 查询审核/审批/付款
export function initApproval(pageCurrent, pageSize, haha) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '采购管理_采购合同_审批付款_查询数据',
      param: `审批_付款状态=${haha}`,
      Pagination: pageCurrent + '&' + pageSize
    }
  })
}
// 查询审核/审批/付款
export function initApproval_noPage(haha) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '采购管理_采购合同_审批付款_查询数据',
      param: `审批_付款状态=${haha}`
    }
  })
}
// 执行审核/审批/付款
export function execApproval(num1, num2, reason, person, haha) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '采购管理_采购合同_审批付款_修改数据',
      param: `采购合同请款流水号=${num1}&审批_付款情况流水号=${num2}&未通过原因=${reason}&操作员编号=${person}&审批_付款状态=${haha}`
    }
  })
}
// 查询离线合同审核/审批/付款
export function initApprovalOffline(pageCurrent, pageSize, haha) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '采购管理_离线合同_审批付款_查询数据',
      param: `审批_付款状态=${haha}`,
      Pagination: pageCurrent + '&' + pageSize
    }
  })
}
// 查询离线合同请款信息明细
export function searchRequsetFundDetail1(num) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '采购管理_采购合同_请款明细_查询数据',
      param: `采购合同请款流水号=${num}`
    }
  })
}
// 查询离线合同请款信息明细
export function searchRequsetFundDetail2(num) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '采购管理_离线合同_请款明细_查询数据',
      param: `离线合同请款流水号=${num}`
    }
  })
}
// 执行审核/审批/付款（离线合同）
export function execApprovalOffline(num1, num2, reason, person, haha) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '采购管理_离线合同_审批付款_修改数据',
      param: `离线合同请款流水号=${num1}&审批_付款情况流水号=${num2}&未通过原因=${reason}&操作员编号=${person}&审批_付款状态=${haha}`
    }
  })
}
// 采购合同内容查询
export function searchContactDetail(check, num1, num2) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '采购管理_采购合同内容_查询数据_合并后',
      param: `check=${check}&采购合同流水号=${num1}&离线合同流水号=${num2}`
    }
  })
}
// 查询离线合同明细
export function searchMateriel(num) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '采购管理_离线合同明细_查询数据',
      param: `离线合同流水号=${num}`
    }
  })
}
