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

// 初始化合同
export function initPayState(num) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '车间采购管理_采购合同_查询_核算价格',
      param: '供应商流水号=' + num
    }
  })
}
// 初始化供应商
export function initSupplier() {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '车间采购管理_采购合同_供应商查询'
    }
  })
}
// 查询表1
export function searchParts(pageCurrent, pageSize, check1, num) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '车间管理_核算价格_查询数据',
      param: `采购合同流水号_check=${check1}&采购合同流水号=${num}`,
      Pagination: pageCurrent + '&' + pageSize
    }
  })
}
// 查询总额
export function searchMoney(check1, num) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '车间管理_核算价格_查询数据_获取总价',
      param: `采购合同流水号_check=${check1}&采购合同流水号=${num}`
    }
  })
}
// 保存
export function Preservation(id, num) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '车间管理_核算总额_编辑数据',
      param: `采购合同明细流水号=${id}&单价=${num}`
    }
  })
}
