import request from '@/utils/request'
import state from '@/store'
import router from '@/router'
// 查询付款计划
export function searchTable0(check, date1, date2) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '采购管理_付款计划_查询数据',
      param: `时间段_check=${check}&开始时间=${date1}&结束时间=${date2}`
    }
  })
}
// 采购合同内容查询
export function searchContract(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 searchRequestFund(pageCurrent, pageSize, check1, start, end, check2, num, check3) {
  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}&供应商流水号=${num}&查询当前_check=${check3}`,
      Pagination: pageCurrent + '&' + pageSize
    }
  })
}
// 查询供应商
export function searchSupplier() {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '采购管理_供应商_查询数据_根据条件'
    }
  })
}
// 查询供应商(请款)
export function searchSupplierRequest() {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '采购管理_采购合同_查询数据_请款'
    }
  })
}
// 采购合同请款
export function submitRequestFund(contractGroup, offGroup, sumGroup, supplier, money, person) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '采购管理_采购合同_请款_增加数据_合并后',
      param: `采购合同流水号组=${contractGroup}&离线合同流水号组=${offGroup}&合同总额组=${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: '1',
      name: '采购管理_采购合同_请款_删除数据',
      param: `采购合同请款流水号=${num}`
    }
  })
}
// 查询离线合同待请款信息
export function searchPurchaseContract(check1, check, num) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '采购管理_采购合同_查询数据_合并后',
      param: `check=${check1}&供应商流水号_check=${check}&供应商流水号=${num}`
    }
  })
}
// 请款审批查看状态
export function RequestFund() {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '采购管理_离线合同_请款查看状态_查询数据'
    }
  })
}
export function setChakan2() {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '采购管理_离线合同_更新查看状态_修改数据'
    }
  })
}
// 采购合同内容查询
export function searchTable2(num) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '采购管理_采购合同内容_查询数据',
      param: '采购合同流水号=' + num
    }
  })
}
// 查询离线合同明细
export function searchOfflineContractContent(num) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '采购管理_离线合同明细_查询数据',
      param: `离线合同流水号=${num}`
    }
  })
}
