基础路径:
/store/app/storeOrder
无需新增接口、无需新增请求/响应字段,沿用原有confirm→computed→create→ 支付。
confirm → computed → create → 支付
后端在 computed / create 内部按购物车商品 + 活动表配置自动匹配满减/折扣,直接体现在 payPrice 里。
与改造前完全一致,不用传活动 ID,不用调 /promotion/list 等接口。
// 算价
const res = await computed({
orderKey,
addressId,
useIntegral,
couponUserId,
})
this.payPrice = res.data.payPrice
// 下单
await create({ orderKey, addressId, payType, useIntegral, couponUserId, mark })
多店仍用 confirmMultiStore → computedMultiStore → createMultiStore,参数不变。
IFsStorePromotionComputeService.autoApplyBestPromotion:
| 活动表配置 | 处理 |
|---|---|
manual_status=1 且时间在有效期内 |
才参与 |
scope_type 1/2/3 |
全场 / 分类 / 指定商品 |
tier_type 1 |
金额满减(可 is_capped 上不封顶) |
tier_type 2 |
件数折扣 |
limit_per_user |
仅统计已支付 usage |
is_stackable=0 |
已选优惠券时跳过该活动 |
在可用活动中取优惠金额最大的一条,扣减顺序:积分 → 满减 → 优惠券。
| 模块 | 类 |
|---|---|
| 小程序入口 | fs-user-app → StoreOrderScrmAmountService |
| 算价扣减 | FsStoreOrderScrmServiceImpl.subtractAutoPromotionDiscount |
| 自动匹配 | FsStorePromotionComputeServiceImpl.autoApplyBestPromotion |
| 下单落库 | createOrder 写订单 promotion_* + usage |
执行 docs/sql/fs_store_promotion_init.sql(活动表 + 订单扩展字段)。