oms/frontend/src/api/shopProduct.ts
liufumingren 266c01538e feat(frontend): 订单与店铺商品交互完善
- 待审核订单增加「含未绑定」开关(默认只显示已绑定),列表与导出条件保持一致
- 店铺商品增加「只看有订单未绑定」筛选与「待处理订单」列;绑定弹窗改为左侧页签 + 右侧可搜索分页列表
- 订单切换仓库改为弹窗选择,新增通用 RecordPickerDialog 组件
- 订单与店铺商品表格改为表体内部滚动,筛选栏与分页固定
- 手工建单必须选择非平台店铺;平台订单编辑时店铺不可修改

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-11-03 03:29:12 +08:00

54 lines
1.8 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { get, post } from '@/utils/request'
/** 绑定类型:0未绑定 1系统商品 2组合商品 */
export const BIND_TYPES = { none: 0, product: 1, combo: 2 } as const
export interface ShopProductItem {
id: number
principal_id: number
shop_id: number
outer_item_id: string
outer_sku_id: string | null
title: string | null
outer_code: string | null
spec: string | null
image: string | null
price: number | string | null
stock: number
status: number
/** 外部平台类型:TouTiao/Taobao/Pinduoduo 等(外部平台采集时有值) */
platform_type?: string | null
/** 外部平台的店铺ID(如店管家 ShopId) */
external_shop_id?: string | null
/** 引用该商品但未绑定系统商品的订单数(列表接口回填) */
unbound_order_count?: number
bind_type: number
product_id: number | null
combo_product_id: number | null
synced_at: string | null
created_at?: string
/** 列表接口 include 带回的关联对象 */
shop?: { id: number; name: string; platform: string | null } | null
product?: { id: number; item_code: string; item_name: string } | null
comboProduct?: { id: number; code: string; name: string } | null
}
export interface BindPayload {
bind_type: number
product_id?: number | null
combo_product_id?: number | null
}
/** 当前主体下的店铺商品列表(principal_id 由请求拦截器自动注入) */
export function getShopProducts(params?: object) {
return get<{ list: ShopProductItem[]; total: number; page: number; pageSize: number }>(
'/shop-products',
params,
)
}
/** 绑定系统商品 / 组合商品,bind_type=0 为解绑 */
export function bindShopProduct(id: number, data: BindPayload) {
return post<{ id: number }>(`/shop-products/${id}/bind`, data)
}