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

// 查询请款表
export function searchRequestFund(pageCurrent, pageSize, check1, start, end, check2, name) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '备料管理_请款_查询数据',
      param: `时间段_check=${check1}&开始时间=${start}&结束时间=${end}&供应商名称_check=${check2}&供应商名称=${name}`,
      Pagination: pageCurrent + '&' + pageSize
    }
  })
}
// 查询采购计划待请款信息
export function searchOfflineContract(num) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '备料管理_待请款_查询数据',
      param: `供应商=${num}`
    }
  })
}
// 查询采购计划待请款信息
export function searchOfflineContract1(num, num1) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '备料管理_待请款_查询数据_新',
      param: `供应商_check=${num}&供应商=${num1}`
    }
  })
}
// 增加请款
export function submitRequestFund(contractGroup, LXcontractGroup, sumGroup, supplier, money, person) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '备料管理_请款_增加数据',
      param: `采购计划流水号组=${contractGroup}&离线采购计划流水号组=${LXcontractGroup}&请款金额组=${sumGroup}&供应商=${supplier}&请款总金额=${money}&请款人=${person}`
    }
  })
}
// 查询采购计划待请款信息
export function searchRequsetFundDetail(num) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '备料管理_请款明细_查询数据',
      param: `采购计划请款流水号=${num}`
    }
  })
}
// 取消请款
export function cancelRequestFund(num) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '备料管理_请款_删除数据',
      param: `采购计划请款流水号=${num}`
    }
  })
}
// 取消请款明细
export function deleteRequsetFundMX(num, num1) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '备料管理_请款明细_删除数据',
      param: `采购计划请款明细流水号=${num}&发票流水号=${num1}`
    }
  })
}
