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

// 发票查询
export function searchInvoice(pageCurrent, pageSize, num2, num3, num4, num5, num6, token) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '备料管理_发票审批查询_查询数据',
      param: '供应商_check=' + num2 + '&供应商流水号=' + num3 + '&时间段_check=' + num4 + '&开始日期=' + num5 + '&结束日期=' + num6 + '&角色编号=' + token,
      Pagination: pageCurrent + '&' + pageSize
    }
  })
}
// 发票明细查询
export function searchInvoiceDetail(num) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '备料管理_发票明细_查询数据',
      param: '发票流水号=' + num
    }
  })
}
export function getGongyingshang() {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '备料管理_发票_初始化获取供应商'
    }
  })
}
// 执行审批
export function cancel(...data) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '备料管理_发票_撤销审批',
      param: `发票流水号=${data[0]}&审批代号=${data[1]}`
    }
  })
}
