import request from '../utils/request'

const api = {
  Goods: '/Goods',
  GoodsList: '/Goods/List',
  GetCount: '/Goods/GetCount',
  SendCount: '/Goods/SendCount',
  MySendCountRequestList: '/Goods/SendCountRequest/MyList',
  AdminGoods: '/Admin/Goods',
  AdminGoodsList: '/Admin/Goods/List',
  AdminSendCountRequestList: '/Admin/Goods/SendCountRequest/List',
  AdminApproveSendCountRequest: '/Admin/Goods/SendCountRequest/Approve',
  AdminRejectSendCountRequest: '/Admin/Goods/SendCountRequest/Reject'
}

export function getGoods (parameter) {
  return request({
    url: api.Goods,
    method: 'get',
    params: parameter
  })
}

export function addGoods (parameter) {
  return request({
    url: api.AdminGoods,
    method: 'post',
    data: parameter
  })
}

export function sendCount (parameter) {
  return request({
    url: api.SendCount,
    method: 'post',
    data: parameter
  })
}

export function getMySendCountRequestList (parameter) {
  return request({
    url: api.MySendCountRequestList,
    method: 'get',
    params: parameter
  })
}

export function adminGetGoods (parameter) {
  return request({
    url: api.AdminGoods,
    method: 'get',
    params: parameter
  })
}

export function getGoodsList (parameter) {
  return request({
    url: api.GoodsList,
    method: 'get',
    params: parameter
  })
}

export function adminGetGoodsList (parameter) {
  return request({
    url: api.AdminGoodsList,
    method: 'get',
    params: parameter
  })
}

export function getCount (parameter) {
  return request({
    url: api.GetCount,
    method: 'get',
    params: parameter
  })
}

export function adminSendCountRequestList (parameter) {
  return request({
    url: api.AdminSendCountRequestList,
    method: 'get',
    params: parameter
  })
}

export function adminApproveSendCountRequest (parameter) {
  return request({
    url: api.AdminApproveSendCountRequest,
    method: 'post',
    data: parameter
  })
}

export function adminRejectSendCountRequest (parameter) {
  return request({
    url: api.AdminRejectSendCountRequest,
    method: 'post',
    data: parameter
  })
}
