Merge pull request 'fix_record_import_typebuying_price_item' (#326) from fix_record_import_typebuying_price_item into @hera/dev

Reviewed-on: daoyoucloud/tachycode#326
Reviewed-by: sealday <zhanglin@daoyoucloud.com>
This commit is contained in:
sealday 2024-03-08 11:47:44 +08:00
commit 33ed1e07b9

View File

@ -269,8 +269,10 @@ export class RecordService {
spec: size, spec: size,
}, },
}); });
const product_category = product.category_id + 99999; const product_id = product.id;
priceRuleArr.push({ id: product_category, unit_price: porduct_item.price }); const exist = priceRuleArr.findIndex((rule) => rule.id === product_id) > -1;
// 规则去重
!exist && priceRuleArr.push({ id: product_id, unit_price: porduct_item.price });
const fee = values.data.complements.filter( const fee = values.data.complements.filter(
(item) => item.associate.name === porduct_item.name && item.associate.size === porduct_item.size, (item) => item.associate.name === porduct_item.name && item.associate.size === porduct_item.size,
); );