@pisell/pisellos 2.2.198 → 2.2.199

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.
Files changed (42) hide show
  1. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +7 -3
  2. package/dist/modules/Cart/utils/cartProduct.js +11 -1
  3. package/dist/modules/Cart/utils/changePrice.js +11 -11
  4. package/dist/modules/Order/index.js +155 -104
  5. package/dist/modules/Order/types.d.ts +1 -0
  6. package/dist/modules/Order/utils.d.ts +33 -2
  7. package/dist/modules/Order/utils.js +112 -55
  8. package/dist/modules/SalesSummary/utils.js +97 -63
  9. package/dist/server/index.d.ts +3 -0
  10. package/dist/server/index.js +294 -190
  11. package/dist/server/modules/order/index.d.ts +8 -0
  12. package/dist/server/modules/order/index.js +536 -317
  13. package/dist/server/modules/order/types.d.ts +2 -0
  14. package/dist/solution/BaseSales/index.js +2 -1
  15. package/dist/solution/BaseSales/types.d.ts +1 -0
  16. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +19 -4
  17. package/dist/solution/BookingByStep/index.d.ts +1 -1
  18. package/dist/solution/ScanOrder/types.d.ts +1 -0
  19. package/dist/solution/ScanOrder/utils.js +26 -9
  20. package/dist/solution/VenueBooking/index.js +2 -1
  21. package/lib/model/strategy/adapter/promotion/index.js +49 -0
  22. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +4 -1
  23. package/lib/modules/Cart/utils/cartProduct.js +11 -1
  24. package/lib/modules/Cart/utils/changePrice.js +12 -20
  25. package/lib/modules/Order/index.js +58 -6
  26. package/lib/modules/Order/types.d.ts +1 -0
  27. package/lib/modules/Order/utils.d.ts +33 -2
  28. package/lib/modules/Order/utils.js +44 -9
  29. package/lib/modules/SalesSummary/utils.js +41 -44
  30. package/lib/server/index.d.ts +3 -0
  31. package/lib/server/index.js +82 -3
  32. package/lib/server/modules/order/index.d.ts +8 -0
  33. package/lib/server/modules/order/index.js +106 -4
  34. package/lib/server/modules/order/types.d.ts +2 -0
  35. package/lib/solution/BaseSales/index.js +2 -1
  36. package/lib/solution/BaseSales/types.d.ts +1 -0
  37. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +15 -1
  38. package/lib/solution/BookingByStep/index.d.ts +1 -1
  39. package/lib/solution/ScanOrder/types.d.ts +1 -0
  40. package/lib/solution/ScanOrder/utils.js +28 -10
  41. package/lib/solution/VenueBooking/index.js +2 -1
  42. package/package.json +1 -1
@@ -75,6 +75,7 @@ function createEmptySummary() {
75
75
  shipping_tax_fee: "0.00",
76
76
  tax_fee: "0.00",
77
77
  surcharge_fee: "0.00",
78
+ surcharges: [],
78
79
  discount_amount: "0.00",
79
80
  deposit_amount: "0.00",
80
81
  expect_amount: "0.00",
@@ -436,16 +437,33 @@ function normalizeOrderProduct(product) {
436
437
  };
437
438
  });
438
439
  }
439
- const normalizedBundle = bundleInput.map((item) => ({
440
- ...item,
441
- bundle_id: item.bundle_id ?? item.id,
442
- bundle_product_id: item.bundle_product_id ?? item._bundle_product_id,
443
- bundle_group_id: item.bundle_group_id ?? item.group_id,
444
- bundle_selling_price: item.bundle_selling_price ?? item.price ?? "0.00",
445
- price: item.price ?? item.custom_price ?? item.bundle_selling_price ?? "0.00",
446
- price_type: item.price_type ?? item.custom_price_type ?? "",
447
- price_type_ext: item.price_type_ext ?? item.custom_price_type_ext ?? ""
448
- }));
440
+ const normalizedBundle = bundleInput.map((item) => {
441
+ const magnitudeSource = {
442
+ ...item,
443
+ // 计算 markdown 净额时,只把真实毛价交给 helper;若只有 bundle_selling_price,
444
+ // helper 会按历史净额兜底,避免 option 二次扣减。
445
+ price: item.price ?? item.custom_price
446
+ };
447
+ const normalizedItem = {
448
+ ...item,
449
+ bundle_id: item.bundle_id ?? item.id,
450
+ bundle_product_id: item.bundle_product_id ?? item._bundle_product_id,
451
+ bundle_group_id: item.bundle_group_id ?? item.group_id,
452
+ // price 保留毛价(markdown 仍为 5),由 price_type 决定符号。
453
+ price: item.price ?? item.custom_price ?? item.bundle_selling_price ?? "0.00",
454
+ price_type: item.price_type ?? item.custom_price_type ?? "",
455
+ price_type_ext: item.price_type_ext ?? item.custom_price_type_ext ?? ""
456
+ };
457
+ normalizedItem.bundle_selling_price = (0, import_utils.getBundleSellingMagnitude)(magnitudeSource).toFixed(2);
458
+ if (normalizedItem.price_type === "markdown" && (normalizedItem.price_type_ext === "" || normalizedItem.price_type_ext === void 0 || normalizedItem.price_type_ext === null)) {
459
+ normalizedItem.custom_price = normalizedItem.custom_price ?? normalizedItem.price;
460
+ normalizedItem.price = normalizedItem.bundle_selling_price;
461
+ }
462
+ if ((normalizedItem.price_type === "markdown" || normalizedItem.price_type === "markup") && (normalizedItem.price_type_ext === "" || normalizedItem.price_type_ext === void 0 || normalizedItem.price_type_ext === null)) {
463
+ delete normalizedItem.original_total;
464
+ }
465
+ return normalizedItem;
466
+ });
449
467
  const normalizedOptions = (0, import_utils.normalizeProductSkuOptions)((_e = product.product_sku) == null ? void 0 : _e.option);
450
468
  const optionSum = (0, import_utils.sumOptionUnitPrice)(normalizedOptions);
451
469
  const productSku = {
@@ -1395,7 +1395,8 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
1395
1395
  getOrderProducts() {
1396
1396
  if (!this.store.order)
1397
1397
  throw new Error("order 模块未初始化");
1398
- return this.store.order.getOrderProducts();
1398
+ const products = this.store.order.getOrderProducts();
1399
+ return products;
1399
1400
  }
1400
1401
  async getSummary() {
1401
1402
  this.logMethodStart("getSummary");
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "2.2.198",
4
+ "version": "2.2.199",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",