@pisell/pisellos 2.1.131 → 2.1.132

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.
@@ -1,9 +0,0 @@
1
- // 导出评估器
2
- export { PromotionEvaluator } from "./evaluator";
3
-
4
- // 导出适配器
5
- export { PromotionAdapter } from "./adapter";
6
- export { default } from "./adapter";
7
-
8
- // 导出策略配置示例常量
9
- export { X_ITEMS_FOR_Y_PRICE_STRATEGY, BUY_X_GET_Y_FREE_STRATEGY } from "./examples";
@@ -85,7 +85,6 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
85
85
  key: "loadProducts",
86
86
  value: function () {
87
87
  var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_ref) {
88
- var _this$otherParams, _this$otherParams2;
89
88
  var _ref$category_ids, category_ids, _ref$product_ids, product_ids, _ref$collection, collection, _ref$menu_list_ids, menu_list_ids, paramsCustomerId, _ref$with_count, with_count, schedule_datetime, schedule_date, cacheId, with_schedule, userPlugin, customer_id, _userPlugin$get, productsData, sortedList;
90
89
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
91
90
  while (1) switch (_context3.prev = _context3.next) {
@@ -129,7 +128,8 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
129
128
  with_count: with_count,
130
129
  // client_schedule_ids: schedule_ids,
131
130
  schedule_date: schedule_date,
132
- application_code: ((_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams.channel) === 'online_store' ? 'online-store' : (_this$otherParams2 = this.otherParams) === null || _this$otherParams2 === void 0 ? void 0 : _this$otherParams2.channel,
131
+ // application_code: this.otherParams?.channel === 'online_store' ? 'online-store' : this.otherParams?.channel,
132
+ application_code: 'online-store',
133
133
  with_schedule: with_schedule,
134
134
  schedule_datetime: schedule_datetime,
135
135
  is_eject: 1
@@ -236,8 +236,10 @@ function getMainProductPaymentTotal(product) {
236
236
  for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
237
237
  var bundleItem = _step5.value;
238
238
  if (isBundleMarkupOrDiscount(bundleItem)) {
239
- var _ref3, _bundleItem$bundle_se;
240
- total = total.plus(toDecimal((_ref3 = (_bundleItem$bundle_se = bundleItem.bundle_selling_price) !== null && _bundleItem$bundle_se !== void 0 ? _bundleItem$bundle_se : bundleItem.price) !== null && _ref3 !== void 0 ? _ref3 : 0));
239
+ var _ref3, _bundleItem$bundle_se, _bundleItem$num;
240
+ var unit = toDecimal((_ref3 = (_bundleItem$bundle_se = bundleItem.bundle_selling_price) !== null && _bundleItem$bundle_se !== void 0 ? _bundleItem$bundle_se : bundleItem.price) !== null && _ref3 !== void 0 ? _ref3 : 0);
241
+ var qty = getSafeNum((_bundleItem$num = bundleItem.num) !== null && _bundleItem$num !== void 0 ? _bundleItem$num : bundleItem.quantity);
242
+ total = total.plus(unit.times(qty));
241
243
  }
242
244
  }
243
245
  } catch (err) {
@@ -305,10 +307,10 @@ function calculateProductsTax(products, taxRate, isPriceIncludeTax) {
305
307
  _step7;
306
308
  try {
307
309
  for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
308
- var _bundleItem$num, _ref4, _bundleItem$bundle_se2, _ref5, _ref6, _bundleItem$original_, _ref7, _bundleItem$is_charge, _ref8, _bundleItem$is_charge2;
310
+ var _bundleItem$num2, _ref4, _bundleItem$bundle_se2, _ref5, _ref6, _bundleItem$original_, _ref7, _bundleItem$is_charge, _ref8, _bundleItem$is_charge2;
309
311
  var bundleItem = _step7.value;
310
312
  if (!isBundleOriginalPrice(bundleItem)) continue;
311
- var bundleQuantity = new Decimal(getSafeNum((_bundleItem$num = bundleItem.num) !== null && _bundleItem$num !== void 0 ? _bundleItem$num : bundleItem.quantity));
313
+ var bundleQuantity = new Decimal(getSafeNum((_bundleItem$num2 = bundleItem.num) !== null && _bundleItem$num2 !== void 0 ? _bundleItem$num2 : bundleItem.quantity));
312
314
  var bundlePrice = toDecimal((_ref4 = (_bundleItem$bundle_se2 = bundleItem.bundle_selling_price) !== null && _bundleItem$bundle_se2 !== void 0 ? _bundleItem$bundle_se2 : bundleItem.price) !== null && _ref4 !== void 0 ? _ref4 : 0);
313
315
  var bundleOriginalPrice = toDecimal((_ref5 = (_ref6 = (_bundleItem$original_ = bundleItem.original_price) !== null && _bundleItem$original_ !== void 0 ? _bundleItem$original_ : bundleItem.product_price) !== null && _ref6 !== void 0 ? _ref6 : bundleItem.price) !== null && _ref5 !== void 0 ? _ref5 : 0);
314
316
  var bundleTaxPrecise = calculateSingleItemTax({
@@ -61,7 +61,7 @@ var ProductList = class extends import_BaseModule.BaseModule {
61
61
  cacheId,
62
62
  with_schedule
63
63
  }) {
64
- var _a, _b, _c;
64
+ var _a;
65
65
  let userPlugin = this.core.getPlugin("user");
66
66
  let customer_id = void 0;
67
67
  try {
@@ -95,7 +95,8 @@ var ProductList = class extends import_BaseModule.BaseModule {
95
95
  with_count,
96
96
  // client_schedule_ids: schedule_ids,
97
97
  schedule_date,
98
- application_code: ((_b = this.otherParams) == null ? void 0 : _b.channel) === "online_store" ? "online-store" : (_c = this.otherParams) == null ? void 0 : _c.channel,
98
+ // application_code: this.otherParams?.channel === 'online_store' ? 'online-store' : this.otherParams?.channel,
99
+ application_code: "online-store",
99
100
  with_schedule,
100
101
  schedule_datetime,
101
102
  is_eject: 1
@@ -210,7 +210,9 @@ function getMainProductPaymentTotal(product) {
210
210
  const bundleItems = product.product_bundle || [];
211
211
  for (const bundleItem of bundleItems) {
212
212
  if (isBundleMarkupOrDiscount(bundleItem)) {
213
- total = total.plus(toDecimal(bundleItem.bundle_selling_price ?? bundleItem.price ?? 0));
213
+ const unit = toDecimal(bundleItem.bundle_selling_price ?? bundleItem.price ?? 0);
214
+ const qty = getSafeNum(bundleItem.num ?? bundleItem.quantity);
215
+ total = total.plus(unit.times(qty));
214
216
  }
215
217
  }
216
218
  return import_decimal.default.max(total, 0);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "2.1.131",
4
+ "version": "2.1.132",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",