- 商品选择弹窗(出入库、订单、记录与导出筛选复用)列改为:图片 / 商品编码 / 商品名称 / 货主 / SKU规格 / 条码 / 操作,弹窗加宽以容纳新增列 - 组合商品「系统商品」与「已添加组合明细」新增图片、条码列,编辑可回显 - 店铺商品绑定弹窗「系统商品」新增图片、货主、条码列 - /api/products/search 与组合明细商品字段补充 image Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
74 lines
2.0 KiB
TypeScript
74 lines
2.0 KiB
TypeScript
import { get, post, put, del } from '@/utils/request'
|
||
|
||
/** 明细中冗余返回的系统商品信息(后端 include 提供,便于展示) */
|
||
export interface ComboItemProduct {
|
||
id: number
|
||
/** 所属货主(下属公司ID) */
|
||
subsidiary_id?: number | null
|
||
/** 所属货主名称 */
|
||
subsidiary_name?: string
|
||
item_code: string
|
||
item_name: string
|
||
sku_property: string | null
|
||
stock_unit: string | null
|
||
/** 条码(明细商品快照) */
|
||
barcode?: string | null
|
||
/** 主图(明细商品快照) */
|
||
image?: 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
|
||
/** 所属货主(下属公司ID),由组合明细的商品货主推导 */
|
||
subsidiary_id?: number | null
|
||
/** 所属货主名称 */
|
||
subsidiary_name?: string
|
||
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}`)
|
||
}
|