下单接口支持其他店铺
/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:
@@ -176,9 +176,10 @@ async def order_get_shipping_fee(payload: OrderShippingFeeRequest) -> ApiRespons
|
||||
"""计算订单运费与手续费。
|
||||
|
||||
规则:
|
||||
- 官方店铺(supplier 为空)运费: 按官方部分商品总额套阶梯价(440/385/0)
|
||||
- 官方店铺(店铺标识为空)运费: 按官方部分商品总额套阶梯价(440/385/0)
|
||||
* 订单中无任何官方商品时,官方运费 0
|
||||
- 加盟店运费(supplier 非空,同名视为同一家): 每家统一 800 日元
|
||||
- 加盟店运费(店铺标识非空,同标识视为同一家): 每家统一 800 日元
|
||||
* 店铺标识优先取 tenpo_cd(与 other_shop_list 中的 tenpo_cd 一致),未提供时回退取 supplier
|
||||
- 通贩手续费: 按全部商品(含官方+加盟店)总额套阶梯价(240/0)
|
||||
"""
|
||||
official_amount = 0
|
||||
@@ -187,10 +188,11 @@ async def order_get_shipping_fee(payload: OrderShippingFeeRequest) -> ApiRespons
|
||||
for item in payload.item_list:
|
||||
subtotal = item.goods_number * item.goods_price
|
||||
goods_amount += subtotal
|
||||
if item.supplier == "":
|
||||
shop_key = item.tenpo_cd or item.supplier
|
||||
if shop_key == "":
|
||||
official_amount += subtotal
|
||||
else:
|
||||
franchise_stores.add(item.supplier)
|
||||
franchise_stores.add(shop_key)
|
||||
|
||||
official_shipping_fee = get_shipping_fee(official_amount) if official_amount > 0 else 0
|
||||
franchise_shipping_fee = get_franchise_shipping_fee(len(franchise_stores))
|
||||
|
||||
Reference in New Issue
Block a user