| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- import { http } from "@/utils/http";
- type Result = {
- code: number;
- message: string;
- data?: any;
- };
- type ResultTable = {
- code: number;
- message: string;
- data?: {
- list: Array<any>;
- total: number;
- pageSize: number;
- currentPage: number;
- };
- };
- export const getProductList = (params: {
- page?: number;
- pageSize?: number;
- name?: string;
- barcode?: string;
- category?: string;
- syncStatus?: number;
- }) => {
- return http.request<ResultTable>("get", "/products/list", { params });
- };
- export const getProductById = (id: number) => {
- return http.request<Result>("get", `/products/${id}`);
- };
- export const getProductStatistics = () => {
- return http.request<Result>("get", "/products/statistics");
- };
- export const addProduct = (data: any) => {
- return http.request<Result>("post", "/products", { data });
- };
- export const updateProduct = (id: number, data: any) => {
- return http.request<Result>("put", `/products/${id}`, { data });
- };
- export const deleteProduct = (id: number) => {
- return http.request<Result>("delete", `/products/${id}`);
- };
- export const syncProduct = (id: number) => {
- return http.request<Result>("post", `/products/${id}/sync`);
- };
- // 商品总库
- export const getMasterProductList = (params: {
- page?: number;
- pageSize?: number;
- barcode?: string;
- code?: string;
- productName?: string;
- deviceAdapt?: string;
- }) => {
- return http.request<ResultTable>("get", "/products/master/list", { params });
- };
- export const addToMerchantProducts = (data: { codeList: string }) => {
- return http.request<Result>("post", "/products/master/add-to-merchant", { data });
- };
- // 商品上下架控制
- export const setProductShelfStatus = (data: {
- deviceId: string;
- goodsCode: string;
- salesType: string;
- callType?: string;
- }) => {
- return http.request<Result>("post", "/products/shelf-status", { data });
- };
- // 获取指定设备可售卖商品列表
- export const getDeviceProducts = (deviceId: string) => {
- return http.request<Result>("get", `/products/device/${deviceId}`);
- };
- // 查询商品ID对应关系
- export const getIdMapping = (codeList?: string) => {
- const params = codeList ? { codeList } : {};
- return http.request<Result>("get", "/products/id-mapping", { params });
- };
|