@pisell/pisellos 0.0.422 → 0.0.423

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -678,8 +678,10 @@ var getDiscountAmount = function getDiscountAmount(discounts) {
678
678
  * 获取主商品加价减价后的总价 (主商品价格 + 子商品加价减价)
679
679
  */
680
680
  var getMainProductTotal = function getMainProductTotal(item) {
681
- var _ref7, _ref8, _item$main_product_se, _item$metadata;
681
+ var _ref7, _ref8, _item$main_product_se, _item$metadata, _item$_origin3, _item$_originData$pro;
682
682
  var total = new Decimal((_ref7 = (_ref8 = (_item$main_product_se = item === null || item === void 0 ? void 0 : item.main_product_selling_price) !== null && _item$main_product_se !== void 0 ? _item$main_product_se : item === null || item === void 0 || (_item$metadata = item.metadata) === null || _item$metadata === void 0 ? void 0 : _item$metadata.main_product_selling_price) !== null && _ref8 !== void 0 ? _ref8 : item.price) !== null && _ref7 !== void 0 ? _ref7 : 0);
683
+ var mainProductDiscountAmount = getDiscountAmount((item === null || item === void 0 || (_item$_origin3 = item._origin) === null || _item$_origin3 === void 0 || (_item$_origin3 = _item$_origin3.product) === null || _item$_origin3 === void 0 ? void 0 : _item$_origin3.discount_list) || (item === null || item === void 0 || (_item$_originData$pro = item._originData.product) === null || _item$_originData$pro === void 0 ? void 0 : _item$_originData$pro.discount_list) || []);
684
+ total = total.minus(mainProductDiscountAmount);
683
685
 
684
686
  // 单规格
685
687
  if (item !== null && item !== void 0 && item.option && Array.isArray(item === null || item === void 0 ? void 0 : item.option)) {
@@ -409,8 +409,10 @@ var getDiscountAmount = (discounts) => {
409
409
  }, new import_decimal.default(0)).toNumber();
410
410
  };
411
411
  var getMainProductTotal = (item) => {
412
- var _a;
412
+ var _a, _b, _c, _d;
413
413
  let total = new import_decimal.default((item == null ? void 0 : item.main_product_selling_price) ?? ((_a = item == null ? void 0 : item.metadata) == null ? void 0 : _a.main_product_selling_price) ?? item.price ?? 0);
414
+ const mainProductDiscountAmount = getDiscountAmount(((_c = (_b = item == null ? void 0 : item._origin) == null ? void 0 : _b.product) == null ? void 0 : _c.discount_list) || ((_d = item == null ? void 0 : item._originData.product) == null ? void 0 : _d.discount_list) || []);
415
+ total = total.minus(mainProductDiscountAmount);
414
416
  if ((item == null ? void 0 : item.option) && Array.isArray(item == null ? void 0 : item.option)) {
415
417
  total = total.add(item == null ? void 0 : item.option.reduce((t, option) => {
416
418
  return t.add(new import_decimal.default(option.price || 0).mul(option.num || 1));
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "0.0.422",
4
+ "version": "0.0.423",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",