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

// 查询请款表
export function searchRequestFund(pageCurrent, pageSize, check1, start, end, check2, num) {
  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}`,
      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 searchOfflineContract(check, num) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '采购管理_离线合同_查询数据',
      param: `供应商流水号_check=${check}&供应商流水号=${num}`
    }
  })
}
// 查询离线合同待请款信息
export function submitRequestFund(contractGroup, sumGroup, supplier, money, person) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '采购管理_离线合同_请款_增加数据',
      param: `离线合同流水号组=${contractGroup}&合同总额组=${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 searchMateriel(num) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '采购管理_离线合同明细_查询数据',
      param: `离线合同流水号=${num}`
    }
  })
}
