下单接口支持其他店铺

/api/order/get_shipping_fee 与购物车加入逻辑此前只认官方自营详情页,加盟店运费分桶
仅靠自由文本 supplier 判断,未与其他店铺列表的 tenpo_cd 打通。补充 OrderItem/
CargoItemRequest 的 tenpo_cd/branch_number 字段,运费计算优先按 tenpo_cd 分桶
(无则回退 supplier 保持兼容),cargo_service 加购 URL 同步带上店铺参数。

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-08 22:31:03 +08:00
parent fe2a3f3768
commit 118667d01f
6 changed files with 139 additions and 5 deletions
+8
View File
@@ -42,6 +42,7 @@ class DetailRequest(BaseModel):
product_url: HttpUrl | None = None
tenpo_cd: str | None = None # 指定店铺代码;跳转查看某个加盟店/市场店铺的报价时传入
branch_number: str | None = None # 指定分支编号,与 tenpo_cd 搭配使用
include_other_shops: bool = False # 为 True 时,随详情额外抓取并返回 other_shop_list(多付出一次页面请求)
class ProductSummary(BaseModel):
@@ -104,6 +105,7 @@ class ProductDetailData(BaseModel):
sku_list: list[dict[str, Any]] # 规格列表
sku: str = "" # 规格
breadcrumb_list: list[dict[str, Any]] = [] # 面包屑
other_shop_list: list[OtherShopItem] = [] # 仅当请求 include_other_shops=True 时才会填充,否则为空列表
class OtherShopListData(BaseModel):
@@ -126,6 +128,8 @@ class CargoItemRequest(BaseModel):
id: str
number: int = 1
price_limit: int | None = None
tenpo_cd: str | None = None # 指定店铺代码;跳转加入指定加盟店/市场店铺的商品时传入
branch_number: str | None = None # 指定分支编号,与 tenpo_cd 搭配使用
class CargoPayload(BaseModel):
@@ -160,6 +164,10 @@ class OrderItem(BaseModel):
goods_price: int = Field(ge=0)
# 店铺标识: 空串 = 官方店铺;非空 = 加盟店标识(同名视为同一家加盟店)
supplier: str = ""
# 店铺代码,来自 other_shop_list 中的 tenpo_cd;非空 = 加盟店/市场店铺。
# 优先于 supplier 用于判定"同一家店铺"(同 tenpo_cd 视为同一家);未提供时回退使用 supplier。
tenpo_cd: str = ""
branch_number: str = "" # 分支编号,可选,与 tenpo_cd 搭配使用
class OrderShippingFeeRequest(BaseModel):