import request from '@/axios'
import { REQUEST_BASE } from '@/constants'

// export const getStoreList = (params: any): Promise<IResponse> => {
//   return request.get({ url: `${REQUEST_BASE}/store`, params })
// }

export const addStore = (data: any): Promise<IResponse> => {
  return request.post({ url: `${REQUEST_BASE}/store`, data })
}

export const editStore = (data: any): Promise<IResponse> => {
  return request.put({ url: `${REQUEST_BASE}/store/${data.id}`, data })
}

export const delStore = (id: number): Promise<IResponse> => {
  return request.delete({ url: `${REQUEST_BASE}/store/${id}` })
}

export const getStoreDetail = (id: number): Promise<IResponse> => {
  return request.get({ url: `${REQUEST_BASE}/store/${id}` })
}

export const wantList = (params: any): Promise<IResponse> => {
  return request.get({ url: `${REQUEST_BASE}/want`, params })
}

export const getWantGoods = (params: any): Promise<IResponse> => {
  return request.get({ url: `${REQUEST_BASE}/want/goods`, params })
}
// store/lst
export const getStoreList = (params: any): Promise<IResponse> => {
  return request.get({ url: `${REQUEST_BASE}/store/lst`, params })
}

// 创建要货
export const createWant = (data: any): Promise<IResponse> => {
  return request.post({ url: `${REQUEST_BASE}/want`, data })
}

export const getWantInfo = (params: any): Promise<IResponse> => {
  return request.get({ url: `${REQUEST_BASE}/want/info`,params })
}


export const getStoreUser = (params: any): Promise<IResponse> => {
  return request.get({ url: `${REQUEST_BASE}/storeuser`, params })
}

export const authWant = (id:number,data: any): Promise<IResponse> => {
  return request.post({ url: `${REQUEST_BASE}/want/auth/${id}`, data })
}

export const delWant = (id:number): Promise<IResponse> => {
  return request.delete({ url: `${REQUEST_BASE}/want/${id}` })
}

export const getPurchase = (params:object): Promise<IResponse> => {
  return request.get({ url: `${REQUEST_BASE}/purchase`, params })
}

export const getSupplierList = (params:object): Promise<IResponse> => {
  return request.get({ url: `${REQUEST_BASE}/supplier`, params })
}

export const getSupplierGoodsList = (params:object): Promise<IResponse> => {
  return request.get({ url: `${REQUEST_BASE}/purchase/goods`, params })
}

export const createPur = (data:object): Promise<IResponse> => {
  return request.post({ url: `${REQUEST_BASE}/purchase`, data })
}

export const authPur = (id:number,data: any): Promise<IResponse> => {
  return request.post({ url: `${REQUEST_BASE}/purchase/auth/${id}`, data })
}

export const delPur = (id:number): Promise<IResponse> => {
  return request.delete({ url: `${REQUEST_BASE}/purchase/${id}` })
}

export const endPur = (data:any): Promise<IResponse> => {
  return request.post({ url: `${REQUEST_BASE}/purchase/Complete/${data.id}`,data })
}
// purchase/update_pay
export const upCompute = (id:number,data:any): Promise<IResponse> => {
  return request.post({ url: `${REQUEST_BASE}/purchase/update_pay/${id}`,data })
}

export const authComput= (id:number,data:any): Promise<IResponse> => {
  return request.post({ url: `${REQUEST_BASE}/purchase/pay_auth/${id}`,data })
}

// outbound
export const getOut = (params:object): Promise<IResponse> => {
  return request.get({ url: `${REQUEST_BASE}/outbound`, params })
}

export const delOut = (id:number): Promise<IResponse> => {
  return request.delete({ url: `${REQUEST_BASE}/outbound/${id}` })
}


export const getOutGood = (params:object): Promise<IResponse> => {
  return request.get({ url: `${REQUEST_BASE}/outbound/goods`, params })
}


export const createOut = (data:object): Promise<IResponse> => {
  return request.post({ url: `${REQUEST_BASE}/outbound`, data })
}

export const outAuth = (id:number,data:object): Promise<IResponse> => {
  return request.post({ url: `${REQUEST_BASE}/outbound/auth/${id}`, data })
}

export const outOut = (id:number): Promise<IResponse> => {
  return request.post({ url: `${REQUEST_BASE}/outbound/out/${id}` })
}

export const getSimple = (params:object): Promise<IResponse> => {
  return request.get({ url: `${REQUEST_BASE}/outbound/simple_lst`, params })
}

export const storeSimple = (data:object): Promise<IResponse> => {
  return request.post({ url: `${REQUEST_BASE}/product_stock/store_delivery`, data })
}

export const wareSimple = (data:object): Promise<IResponse> => {
  return request.post({ url: `${REQUEST_BASE}/outbound/ware_delivery`, data })
}
export const refuse = (data: object): Promise<IResponse> => {
  return request.post({ url: `${REQUEST_BASE}/outbound/refuse`, data })
}

export const getStoreLoss = (params:object): Promise<IResponse> => {
  return request.get({ url: `${REQUEST_BASE}/product_stock`, params })
}

export const getWareLoss = (params:object): Promise<IResponse> => {
  return request.get({ url: `${REQUEST_BASE}/loss`, params })
}


// stock/goods
export const getStoreGood = (params:object): Promise<IResponse> => {
  return request.get({ url: `${REQUEST_BASE}/product_stock/goods`, params })
}

export const getLossType = (params:object): Promise<IResponse> => {
  return request.get({ url: `${REQUEST_BASE}/product_stock/loss_type`, params })
}

//
export const storePutLoss = (data:object): Promise<IResponse> => {
  return request.post({ url: `${REQUEST_BASE}/product_stock/loss_save`, data })
}

export const warePutLoss = (id: number,data:object): Promise<IResponse> => {
  return request.post({ url: `${REQUEST_BASE}/loss/save/${id}`, data })
}

export const getGoods = (params:object): Promise<IResponse> => {
  return request.get({ url: `${REQUEST_BASE}/product_stock/goods`, params })
}

export const lossesAuth = (id: any,data:object): Promise<IResponse> => {
  return request.post({ url: `${REQUEST_BASE}/product_stock/expend_auth_data/${id}`, data })
}


export const wareLossAuth = (id: any,data:object): Promise<IResponse> => {
  return request.post({ url: `${REQUEST_BASE}/loss/auth/${id}`, data })
}

export const refuseStock = (id:number,data:object): Promise<IResponse> => {
  return request.post({ url: `${REQUEST_BASE}/product_stock/expend_auth_data/${id}`, data })
}

export const getMirror = (params:object): Promise<IResponse> => {
  return request.get({ url: `${REQUEST_BASE}/mirror`, params })
}

export const addMirror = (id:number,data:object): Promise<IResponse> => {
  return request.post({ url: `${REQUEST_BASE}/mirror_save/${id}`, data })
}

export const getMirrorDetail = (id:number): Promise<IResponse> => {
  return request.get({ url: `${REQUEST_BASE}/mirror_info/${id}`})
}

export const addWareAdjust = (data: object): Promise<IResponse> => {
  return request.post({ url: `${REQUEST_BASE}/Product/adjust_price`,data})
}
export const addStoreAdjust = (data: object): Promise<IResponse> => {
  return request.post({ url: `${REQUEST_BASE}/Product/set_out_price`,data})
}
export const getWareAdjust = (params:object): Promise<IResponse> => {
  return request.get({ url: `${REQUEST_BASE}/adjust_price_lst`, params })
}
// Product/adjust_price_lst
export const getAdjust = (params:object): Promise<IResponse> => {
  return request.get({ url: `${REQUEST_BASE}/Product/adjust_price_lst`, params })
}

export const getCheck = (params:object): Promise<IResponse> => {
  return request.get({ url: `${REQUEST_BASE}/purchase/inventory_lst`, params })
}

export const addCheck = (data:object): Promise<IResponse> => {
  return request.post({ url: `${REQUEST_BASE}/purchase/inventory_save`, data })
}


export const  addStoreCheck = (id:number,data:object): Promise<IResponse> => {
  return request.post({ url: `${REQUEST_BASE}/inventory_save/${id}`, data })
}
//inventory_lst
export const getStoreCheck = (params:object): Promise<IResponse> => {
  return request.get({ url: `${REQUEST_BASE}/inventory_lst`, params })
}

export const wareCheckAuth = (id:number,data:object): Promise<IResponse> => {
  return request.post({ url: `${REQUEST_BASE}/purchase/inventory_auth/${id}`, data })
}

export const storeCheckAuth = (id:number,data:object): Promise<IResponse> => {
  return request.post({ url: `${REQUEST_BASE}/inventory_auth/${id}`, data })
}



// oute::get('product_stock/export', 'product.ProductStock')->option(['real_name' => '商品库存导出']);
//             Route::post('product_stock/store_delivery', 'product.ProductStock/store_delivery')->option(['real_name' => '门店收货']);
//             Route::get('product_stock/goods', 'product.ProductStock/goods')->option(['real_name' => '商品列表']);
//             Route::get('product_stock/loss_type', 'product.ProductStock/loss_type')->option(['real_name' => '库存类型']);
//             Route::post('product_stock/loss_save', 'product.ProductStock/loss_save')->option(['real_name' => '门店报损']);
//             Route::post('product_stock/expend_auth_data/:id', 'product.ProductStock/expend_auth_data')->option(['real_name' => '门店报损审核']);
//             Route::post('product_stock/refuse', 'product.ProductStock/refuse')->option(['real_name' => '库存报损拒绝']);

// Route::get('outbound/export', 'Outbound')->option(['real_name' => '出库导出']);
//             Route::get('outbound/goods', 'Outbound')->option(['real_name' => '出库商品']);
//             Route::post('outbound/auth/:id', 'Outbound/auth_save')->option(['real_name' => '审核出库']);
//             Route::post('outbound/out/:id', 'Outbound/ck_out')->option(['real_name' => '商品出库']);
//             Route::get('outbound/simple_lst', 'Outbound/simple_lst')->option(['real_name' => '类型1库间流转 2商品在途']);
//             Route::post('outbound/refuse', 'Outbound/refuse')->option(['real_name' => '拒绝收货']);
//             Route::post('outbound/update_pay', 'Outbound/update_pay')->option(['real_name' => '上传结算单']);
//             Route::get('outbound/auth_lst', 'Outbound/auth_lst')->option(['real_name' => '结算列表']);
//             Route::post('outbound/ware_delivery', 'Outbound/ware_delivery')->option(['real_name' => '库间收货']);

// Route::get('purchase/export', 'Purchase')->option(['real_name' => '采购导出']);
//             Route::get('purchase/goods', 'Purchase/goods')->option(['real_name' => '采购商品']);
//             Route::post('purchase/auth/:id', 'Purchase/auth_save')->option(['real_name' => '审核采购']);
//             Route::post('purchase/Complete/:id', 'Purchase/Complete')->option(['real_name' => '完成采购']);
//             Route::post('purchase/refuse', 'Purchase/refuse')->option(['real_name' => '拒绝收货']);
//             Route::post('purchase/update_pay', 'Purchase/update_pay')->option(['real_name' => '上传结算单']);
//             Route::post('purchase/pay_auth', 'Purchase/pay_auth')->option(['real_name' => '结算单审核']);
//             Route::get('purchase/auth_lst', 'Purchase/auth_lst')->option(['real_name' => '结算列表']);
//             Route::get('purchase/inventory_lst', 'Purchase/inventory_lst')->option(['real_name' => '仓库盘点列表']);
//             Route::get('purchase/inventory_detail/:id', 'Purchase/inventory_info')->option(['real_name' => '仓库盘点详情']);
//             Route::get('purchase/inventory_save', 'Purchase/inventory_save')->option(['real_name' => '仓库盘点保存']);
//             Route::get('purchase/inventory_auth', 'Purchase/inventory_auth')->option(['real_name' => '仓库盘点审核']);