forked from yoone/API
refactor(service): 重构订单服务中的品牌属性检查逻辑
将硬编码的品牌检查逻辑改为直接存储品牌和其他属性值,提高代码的可维护性和扩展性
This commit is contained in:
parent
72cd20fcd6
commit
b7101ac866
|
|
@ -745,11 +745,13 @@ export class OrderService {
|
||||||
quantity: componentDetail.quantity * orderItem.quantity,
|
quantity: componentDetail.quantity * orderItem.quantity,
|
||||||
sku: componentDetail.product.sku,
|
sku: componentDetail.product.sku,
|
||||||
// 理论上直接存 product 的全部数据才是对的,因为这样我的数据才全面。
|
// 理论上直接存 product 的全部数据才是对的,因为这样我的数据才全面。
|
||||||
isYoone: attrsObj?.['brand']?.name === 'yoone',
|
brand: attrsObj?.['brand']?.name,
|
||||||
isZyn: attrsObj?.['brand']?.name === 'zyn',
|
version: attrsObj?.['version']?.name,
|
||||||
isZex: attrsObj?.['brand']?.name === 'zex',
|
|
||||||
isYooneNew: attrsObj?.['brand']?.name === 'yoone' && attrsObj?.['version']?.name === 'new',
|
|
||||||
strength: attrsObj?.['strength']?.name,
|
strength: attrsObj?.['strength']?.name,
|
||||||
|
flavor: attrsObj?.['flavor']?.name,
|
||||||
|
humidity: attrsObj?.['humidity']?.name,
|
||||||
|
size: attrsObj?.['size']?.name,
|
||||||
|
category: componentDetail.product.category.name,
|
||||||
});
|
});
|
||||||
return orderSale
|
return orderSale
|
||||||
}).filter(v => v !== null)
|
}).filter(v => v !== null)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue