- 工程脚手架:Vite、TypeScript 配置、路由、Pinia store(auth/principal/menu)、请求封装 - 布局与通用组件:BasicLayout、SideMenu、DataTable/VirtualTable、VirtualSelect、ProductSelect、ImageUploader 等 - 业务页面:登录、首页、商品、店铺、店铺商品、组合商品、仓库/接口配置、库存、入库单、出库单、发货单(列表 + 创建)、外部接口、主体/主体用户、个人资料 - API 层:api/*.ts 与后端接口一一对应
62 lines
1.5 KiB
TypeScript
62 lines
1.5 KiB
TypeScript
import { get, post, put, del } from '@/utils/request'
|
||
|
||
/** 明细中冗余返回的系统商品信息(后端 include 提供,便于展示) */
|
||
export interface ComboItemProduct {
|
||
id: number
|
||
item_code: string
|
||
item_name: string
|
||
sku_property: string | null
|
||
stock_unit: string | null
|
||
retail_price?: number | string
|
||
}
|
||
|
||
export interface ComboItem {
|
||
product_id: number
|
||
quantity: number
|
||
product?: ComboItemProduct | null
|
||
}
|
||
|
||
export interface ComboProductItem {
|
||
id: number
|
||
principal_id: number
|
||
code: string
|
||
name: string
|
||
price: number | string
|
||
items: ComboItem[] | null
|
||
status: number
|
||
remark: string | null
|
||
created_at?: string
|
||
}
|
||
|
||
export interface ComboProductPayload {
|
||
code: string
|
||
name: string
|
||
price: number
|
||
items?: ComboItem[] | null
|
||
status?: number
|
||
remark?: string
|
||
}
|
||
|
||
/** 当前主体下的组合商品列表(principal_id 由请求拦截器自动注入) */
|
||
export function getComboProducts(params?: object) {
|
||
return get<{ list: ComboProductItem[]; total: number; page: number; pageSize: number }>(
|
||
'/combo-products',
|
||
params,
|
||
)
|
||
}
|
||
|
||
/** 新增组合商品(同一主体下 code 唯一) */
|
||
export function createComboProduct(data: ComboProductPayload) {
|
||
return post<{ id: number }>('/combo-products', data)
|
||
}
|
||
|
||
/** 更新组合商品 */
|
||
export function updateComboProduct(id: number, data: Partial<ComboProductPayload>) {
|
||
return put<{ id: number }>(`/combo-products/${id}`, data)
|
||
}
|
||
|
||
/** 删除组合商品 */
|
||
export function deleteComboProduct(id: number) {
|
||
return del<{ id: number }>(`/combo-products/${id}`)
|
||
}
|