Skip to content
This repository has been archived by the owner on Oct 31, 2023. It is now read-only.

Commit

Permalink
Merge pull request #104 from Jzow/master
Browse files Browse the repository at this point in the history
Add Product info request and response data object
  • Loading branch information
Jzow committed Oct 22, 2023
2 parents 678e760 + 3439952 commit e5ec10f
Show file tree
Hide file tree
Showing 8 changed files with 518 additions and 210 deletions.
9 changes: 9 additions & 0 deletions src/api/basic/warehouse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ enum API {
AddOrUpdateWarehouse = '/basic/warehouse/addOrUpdate',
DeleteBatch = '/basic/warehouse/delete',
UpdateStatus = '/basic/warehouse/updateStatus',
GetWarehouse = '/basic/warehouse/getWarehouse',
}

export function getWarehouseList(params: QueryWarehouseReq, mode: ErrorMessageMode = 'notice') {
Expand Down Expand Up @@ -60,4 +61,12 @@ export function deleteBatchWarehouse(ids: number[], mode: ErrorMessageMode = 'no
errorMessageMode: mode,
},
);
}

export function getWarehouse() {
return defHttp.get<BaseDataResp<WarehouseResp>>(
{
url: API.GetWarehouse,
}
);
}
99 changes: 99 additions & 0 deletions src/api/product/model/productModel.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,102 @@
export interface AddProductStockReq {
warehouseId: number | string;
warehouseName: string;
initStockQuantity: number;
lowStockQuantity: number;
highStockQuantity: number;
}

export interface AddProductPriceReq {
barCode: number;
productUnit: string;
multiAttribute: string;
purchasePrice: number;
retailPrice: number;
salesPrice: number;
lowSalesPrice: number;
}

export interface AddProductImageReq {
uid: string;
type: string;
status: string;
imageName: string;
imageUrl: string;
imageSize: number;
}

export interface AddProductReq {
productName: string;
productStandard: string;
productModel: string;
productUnit: string | undefined,
productUnitId: number | string | undefined;
productColor: string;
productWeight: number;
productExpiryNum: number;
productCategoryId: number | string | undefined;
enableSerialNumber: number;
enableBatchNumber: number;
warehouseShelves: string;
remark: string;
productManufacturer: string;
otherFieldOne: string;
otherFieldTwo: string;
otherFieldThree: string;
priceList: AddProductPriceReq[];
stockList: AddProductStockReq[];
imageList: AddProductImageReq[];
}

export interface QueryProductReq {
productCategoryId: number | string
keywords: string
productColor: string
extendInfo: string
remark: string
warehouseShelves: string
status: number
enableSerialNumber: number
enableBatchNumber: number
}

export interface ProductInfoDetailResp {
productId: string;
productCategoryId: string;
productName: string;
productStandard: string;
productModel: string;
productColor: string;
productWeight: number;
productExpiryNum: number;
productCategoryName: string;
enableSerialNumber: number;
enableBatchNumber: number;
warehouseShelves: string;
productManufacturer: string;
otherFieldOne: string;
otherFieldTwo: string;
otherFieldThree: string;
priceList: ProductPriceResp[];
stockList: ProductStockResp[];
imageList: ProductImageResp[];
}

export interface ProductImageResp {
imageName: string;
iImageUrl: string;
}

export interface ProductPriceResp {
barCode: number;
productUnit: string;
multiAttribute: string;
purchasePrice: number;
retailPrice: number;
salesPrice: number;
lowSalesPrice: number;
}

export interface ProductStockResp {
id: number | string;
warehouseId: number | string;
Expand Down
39 changes: 33 additions & 6 deletions src/api/product/product.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import {defHttp} from '/@/utils/http/axios';
import {BaseDataResp} from "@/api/model/baseModel";
import {ProductStockResp} from "@/api/product/model/productModel";
import {BaseDataResp, BaseResp} from "@/api/model/baseModel";
import {AddProductReq, ProductInfoDetailResp, QueryProductReq} from "@/api/product/model/productModel";
import {ErrorMessageMode} from "#/axios";

enum Api {
getBarCode = '/product/getBarCode',
getStock = '/product/getStock',
addProduct = '/product/addProduct',
getProductInfo = '/product/getProductInfo',
getProductInfoDetail = '/product/getProductInfoDetail',
}

export function getBarCode() {
Expand All @@ -15,10 +18,34 @@ export function getBarCode() {
);
}

export function getStock() {
return defHttp.get<BaseDataResp<ProductStockResp>>(
export function addProduct(params: AddProductReq, mode: ErrorMessageMode = 'notice') {
return defHttp.post<BaseResp>(
{
url: Api.getStock,
url: Api.addProduct,
params
},
{
errorMessageMode: mode,
},
);
}

export function getProductInfo(params: QueryProductReq, mode: ErrorMessageMode = 'notice') {
return defHttp.post<BaseResp>(
{
url: Api.getProductInfo,
params
},
{
errorMessageMode: mode,
},
);
}

export function getProductInfoDetail(productId: number) {
return defHttp.get<BaseDataResp<ProductInfoDetailResp>>(
{
url: `${Api.getProductInfoDetail}/${productId}`,
}
);
}
3 changes: 1 addition & 2 deletions src/views/product/info/components/BatchSetPriceModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
:width="500"
v-model:open="openPriceModal"
:confirm-loading="confirmLoading"
:mask-style="{'top':'93px','left':'154px'}"
:mask-closable="false"
@ok="handleOk"
@cancel="handleCancel"
style="top:30%;height: 30%;">
Expand Down Expand Up @@ -93,6 +91,7 @@ export default {
const handleCancel = () => {
close();
};
return {
Expand Down
2 changes: 0 additions & 2 deletions src/views/product/info/components/BatchSetStockModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
:width="500"
v-model:open="openStockModal"
:confirm-loading="confirmLoading"
:mask-style="{'top':'93px','left':'154px'}"
:mask-closable="false"
@ok="handleOk"
@cancel="handleCancel"
style="top:30%;height: 30%;">
Expand Down
Loading

0 comments on commit e5ec10f

Please sign in to comment.