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 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 searchPurchaseContract(check, num) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '外协管理_查询数据_请款',
      param: `外协厂家流水号_check=${check}&外协厂家流水号=${num}&外协厂家名称_check=0`
    }
  })
}
// 采购合同明细查询
export function searchTable2(num) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '车间采购管理_采购合同明细_查询数据NEW',
      param: '采购合同流水号=' + num
    }
  })
}
// 采购合同明细查询
export function searchTable3(num) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '车间采购管理_采购合同明细_成组采购_查询数据',
      param: '采购合同流水号=' + num
    }
  })
}
