import request from '@/utils/request'

export function searchData(check1, supplierName, check2, businessNature, check3, creationDate, check4, registeredCapital, check5, taxNumber, check6, bank, check7, account, check8, email, check9, address, check10, telephone, check11, fax, check12, deliveryPeriod, pageCurrent, pageSize) {
  return request({
    url: '',
    method: 'post',
    data: {
      type: '1',
      name: '采购管理_供应商_查询数据_根据条件',
      param: '供应商名称_check=' + check1 + '=int&供应商名称=' + supplierName + '&企业性质_check=' + check2 + '=int&企业性质=' + businessNature + '&创立日期_check=' + check3 + '=int&创立日期=' + creationDate + '&注册资本_check=' + check4 + '=int&注册资本=' + registeredCapital + '&税号_check=' + check5 + '=int&税号=' + taxNumber + '&开户行_check=' + check6 + '=int&开户行=' + bank + '&帐号_check=' + check7 + '=int&帐号=' + account + '&电子信箱_check=' + check8 + '=int&电子信箱=' + email + '&地址_check=' + check9 + '=int&地址=' + address + '&电话号码_check=' + check10 + '=int&电话号码=' + telephone + '&传真_check=' + check11 + '=int&传真=' + fax + '&货期_check=' + check12 + '=int&货期=' + deliveryPeriod,
      Pagination: pageCurrent + '&' + pageSize
    }
  })
}
// 增加新的数据
export function addTable(supplierName, businessNature, creationDate, registeredCapital, taxNumber, bank, account, email, address, telephone, fax, deliveryPeriod) {
  return request({
    url: '',
    method: 'post',
    data: {
      type: '2',
      name: '采购管理_供应商_增加数据',
      param: '供应商名称=' + supplierName + '&企业性质=' + businessNature + '&创立日期=' + creationDate + '&注册资本=' + registeredCapital + '&税号=' + taxNumber + '&开户行=' + bank + '&账号=' + account + '&电子信箱=' + email + '&地址=' + address + '&电话号码=' + telephone + '&传真=' + fax + '&货期=' + deliveryPeriod
    }
  })
}

export function editTable(supplierName, businessNature, creationDate, registeredCapital, taxNumber, bank, account, email, address, supplierSerialNumber, fax, deliveryPeriod, telephone) {
  return request({
    url: '',
    method: 'post',
    data: {
      type: '2',
      name: '采购管理_供应商_修改数据',
      param: '供应商名称=' + supplierName + '&企业性质=' + businessNature + '&创立日期=' + creationDate + '&注册资本=' + registeredCapital + '&税号=' + taxNumber + '&开户行=' + bank + '&账号=' + account + '&电子信箱=' + email + '&地址=' + address + '&供应商流水号=' + supplierSerialNumber + '&传真=' + fax + '&货期=' + deliveryPeriod + '&电话号码=' + telephone
    }
  })
}

export function deleteData(supplierSerialNumber) {
  return request({
    url: '',
    method: 'post',
    data: {
      type: '2',
      name: '采购管理_供应商_删除数据',
      param: '供应商流水号=' + supplierSerialNumber
    }
  })
}

export function getName(supplierSerialNumber) {
  return request({
    url: '',
    method: 'post',
    data: {
      type: '1',
      name: '采购管理_供应商联系人_查询数据',
      param: '供应商流水号=' + supplierSerialNumber
    }
  })
}
// 增加联系人
export function addPerson(name, work, phone, telephone, fax, num) {
  return request({
    url: '',
    method: 'post',
    data: {
      type: '2',
      name: '采购管理_供应商联系人_增加数据',
      param: '姓名=' + name + '&职务=' + work + '&电话=' + phone + '&手机=' + telephone + '&传真=' + fax + '&供应商流水号=' + num
    }
  })
}
// 编辑联系人
export function editPerson(name, work, phone, telephone, fax, num) {
  return request({
    url: '',
    method: 'post',
    data: {
      type: '2',
      name: '采购管理_供应商联系人_修改数据',
      param: '姓名=' + name + '&职务=' + work + '&电话=' + phone + '&手机=' + telephone + '&传真=' + fax + '&供应商联系人流水号=' + num
    }
  })
}
// 删除联系人
export function deletePerson(num) {
  return request({
    url: '',
    method: 'post',
    data: {
      type: '2',
      name: '采购管理_供应商联系人_删除数据',
      param: '供应商联系人流水号=' + num
    }
  })
}
