fix(订单服务): 修正套餐类型判断逻辑并添加注释

将isPackage的判断从子产品改为父产品类型,与业务逻辑一致
添加externalOrderItemId的注释说明
This commit is contained in:
tikkhun 2026-01-17 09:35:24 +08:00
parent 8766cf4a4c
commit 72cd20fcd6
1 changed files with 2 additions and 2 deletions

View File

@ -737,14 +737,14 @@ export class OrderService {
const orderSale = plainToClass(OrderSale, { const orderSale = plainToClass(OrderSale, {
orderId: orderItem.orderId, orderId: orderItem.orderId,
siteId: orderItem.siteId, siteId: orderItem.siteId,
externalOrderItemId: orderItem.externalOrderItemId, externalOrderItemId: orderItem.externalOrderItemId,// 原始 itemId
parentProductId: product.id, // 父产品 ID 用于统计套餐 如果是单品则不记录 parentProductId: product.id, // 父产品 ID 用于统计套餐 如果是单品则不记录
productId: componentDetail.product.id, productId: componentDetail.product.id,
isPackage: product.type === 'bundle',// 这里是否是套餐取决于父产品
name: componentDetail.product.name, name: componentDetail.product.name,
quantity: componentDetail.quantity * orderItem.quantity, quantity: componentDetail.quantity * orderItem.quantity,
sku: componentDetail.product.sku, sku: componentDetail.product.sku,
// 理论上直接存 product 的全部数据才是对的,因为这样我的数据才全面。 // 理论上直接存 product 的全部数据才是对的,因为这样我的数据才全面。
isPackage: componentDetail.product.type === 'bundle',
isYoone: attrsObj?.['brand']?.name === 'yoone', isYoone: attrsObj?.['brand']?.name === 'yoone',
isZyn: attrsObj?.['brand']?.name === 'zyn', isZyn: attrsObj?.['brand']?.name === 'zyn',
isZex: attrsObj?.['brand']?.name === 'zex', isZex: attrsObj?.['brand']?.name === 'zex',