56 lines
1.5 KiB
TypeScript
56 lines
1.5 KiB
TypeScript
import { request } from '@/http/axios'
|
|
import type { CabinetDetailResponse, RentingCabinetDetailDTO } from './type'
|
|
import { OpenCabinetApiData } from '../shop/type'
|
|
|
|
/** 获取智能柜详情接口 */
|
|
export function getCabinetDetailApi(shopId: number) {
|
|
return request<CabinetDetailResponse>({
|
|
url: 'cabinet/detail',
|
|
method: 'get',
|
|
params: {
|
|
shopId
|
|
}
|
|
})
|
|
}
|
|
|
|
/** 获取租用中的智能柜详情接口 */
|
|
export function getRentingCabinetDetailApi(shopId: number) {
|
|
return request<ApiResponseData<RentingCabinetDetailDTO[]>>({
|
|
url: 'cabinet/detail/renting',
|
|
method: 'get',
|
|
params: {
|
|
shopId
|
|
}
|
|
})
|
|
}
|
|
|
|
export function openCabinet(cabinetId: number, pinNo: number, data: OpenCabinetApiData) {
|
|
return request<ApiResponseData<void>>({
|
|
url: `cabinet/openCabinet/${cabinetId}/${pinNo}`,
|
|
method: 'post',
|
|
data
|
|
})
|
|
}
|
|
|
|
export const configureGoodsCellsStock = (cellId: number, goodsId: number, stock: number) => {
|
|
return request<ApiResponseData<void>>({
|
|
url: `/cabinet/configureGoodsCellsStock/${cellId}/${goodsId}/${stock}`,
|
|
method: 'put'
|
|
});
|
|
};
|
|
|
|
export const changeGoodsCellsStock = (cellId: number, stock: number) => {
|
|
return request<ApiResponseData<void>>({
|
|
url: `/cabinet/changeGoodsCellsStock/${cellId}/${stock}`,
|
|
method: 'put'
|
|
});
|
|
};
|
|
|
|
export const clearGoodsCells = (cellId: number) => {
|
|
return request<ApiResponseData<void>>({
|
|
url: `/cabinet/clearGoodsCells/${cellId}`,
|
|
method: 'put'
|
|
});
|
|
};
|
|
|