import request from '@/utils/request'
import axios from "@/utils/request";


export function listApply(query) {
  return request({
    url: '/purchase/apply/list',
    method: 'get',
    params: query
  })
}

export function auditListApply(query) {
  return request({
    url: '/purchase/apply/auditList',
    method: 'get',
    params: query
  })
}


export function listApplyDetail(query) {
  return request({
    url: '/purchase/apply/list/detail',
    method: 'get',
    params: query
  })
}

export function getApply(id) {
  return request({
    url: '/purchase/apply/' + id,
    method: 'get'
  })
}

export function addApply(data) {
  return request({
    url: '/purchase/apply',
    method: 'post',
    data: data
  })
}


export function auditOrder(data) {
  return request({
    url: '/purchase/apply/auditOrder',
    method: 'post',
    data: data
  })
}


// 修改pur
export function updateApply(data) {
  return request({
    url: '/purchase/apply',
    method: 'put',
    data: data
  })
}

// 删除pur
export function delApply(id) {
  return request({
    url: '/purchase/apply/' + id,
    method: 'delete'
  })
}

export function inserThrOrderWeb(query) {
  return axios({
    url: "/purchase/apply/postOrder",
    method: "post",
    data: query
  });
}


// 删除pur
export function delApplyDetail(id) {
  return request({
    url: '/purchase/apply/detail/' + id,
    method: 'delete'
  })
}

// 添加pur
export function addApplyDetail(data) {
  return request({
    url: "/purchase/apply/addDetail",
    method: 'post',
    data: data
  })
}

// 添加app
export function addApplyId() {
  return request({
    url: "/purchase/apply/add",
    method: 'post'
  })
}

//更新pur
export function updateDetail(data) {
  return request({
    url: "/purchase/apply/updateDetail",
    method: 'post',
    data: data
  })
}

//删除申购表和详情表
export function delApplyDetailAll(data) {
  return request({
    url: "/purchase/apply/delApplyDetailAll",
    method: 'post',
    data: data
  })
}

export function getDetailList(params) {
  return axios({
    url: "/purchase/apply/getDetailList",
    method: "get",
    params: params
  })
}
