@pisell/pisellos 2.2.132 → 2.2.133

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.
@@ -159,10 +159,11 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
159
159
  }
160
160
 
161
161
  // 合并新旧折扣列表,并计算折扣结果,注意,如果旧折扣里有 isEditMode 为 true 的优惠券,则不合并
162
+ // 保留之前扫码得到的商品券(isScan: true)
162
163
  var filteredOldDiscountList = oldDiscountList.filter(function (discount) {
163
- return !discount.isEditMode && discount.tag !== 'good_pass';
164
+ return !discount.isEditMode && (discount.tag !== 'good_pass' || discount.isScan);
164
165
  });
165
- var mergedDiscountList = uniqueById(uniqueById([].concat(_toConsumableArray(filteredOldDiscountList), _toConsumableArray(newDiscountList))), 'product_id');
166
+ var mergedDiscountList = uniqueById([].concat(_toConsumableArray(filteredOldDiscountList), _toConsumableArray(newDiscountList)));
166
167
  var result = this.calcDiscount({
167
168
  discountList: mergedDiscountList,
168
169
  productList: _toConsumableArray(productList),
@@ -480,7 +480,7 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
480
480
  this.setDiscountList(newDiscountList || []);
481
481
  this.store.originalDiscountList = newDiscountList || [];
482
482
  this.setProductList(newProductList || []);
483
- if (!(this.isWalkIn() && resultDiscountList.length && ((_this$options$otherPa6 = this.options.otherParams) === null || _this$options$otherPa6 === void 0 ? void 0 : _this$options$otherPa6.platform) === 'shop')) {
483
+ if (!(this.isWalkIn() && resultDiscountList.length && ((_this$options$otherPa6 = this.options.otherParams) === null || _this$options$otherPa6 === void 0 ? void 0 : _this$options$otherPa6.platform) === 'shop' && !((resultDiscountList[0].customer_id || 1) === 1))) {
484
484
  _context5.next = 24;
485
485
  break;
486
486
  }
@@ -0,0 +1,49 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // src/model/strategy/adapter/promotion/index.ts
30
+ var promotion_exports = {};
31
+ __export(promotion_exports, {
32
+ BUY_X_GET_Y_FREE_STRATEGY: () => import_examples.BUY_X_GET_Y_FREE_STRATEGY,
33
+ PromotionAdapter: () => import_adapter.PromotionAdapter,
34
+ PromotionEvaluator: () => import_evaluator.PromotionEvaluator,
35
+ X_ITEMS_FOR_Y_PRICE_STRATEGY: () => import_examples.X_ITEMS_FOR_Y_PRICE_STRATEGY,
36
+ default: () => import_adapter2.default
37
+ });
38
+ module.exports = __toCommonJS(promotion_exports);
39
+ var import_evaluator = require("./evaluator");
40
+ var import_adapter = require("./adapter");
41
+ var import_adapter2 = __toESM(require("./adapter"));
42
+ var import_examples = require("./examples");
43
+ // Annotate the CommonJS export names for ESM import in node:
44
+ 0 && (module.exports = {
45
+ BUY_X_GET_Y_FREE_STRATEGY,
46
+ PromotionAdapter,
47
+ PromotionEvaluator,
48
+ X_ITEMS_FOR_Y_PRICE_STRATEGY
49
+ });
@@ -105,12 +105,12 @@ var RulesModule = class extends import_BaseModule.BaseModule {
105
105
  };
106
106
  }
107
107
  const filteredOldDiscountList = oldDiscountList.filter(
108
- (discount) => !discount.isEditMode && discount.tag !== "good_pass"
109
- );
110
- const mergedDiscountList = (0, import_utils.uniqueById)(
111
- (0, import_utils.uniqueById)([...filteredOldDiscountList, ...newDiscountList]),
112
- "product_id"
108
+ (discount) => !discount.isEditMode && (discount.tag !== "good_pass" || discount.isScan)
113
109
  );
110
+ const mergedDiscountList = (0, import_utils.uniqueById)([
111
+ ...filteredOldDiscountList,
112
+ ...newDiscountList
113
+ ]);
114
114
  const result = this.calcDiscount(
115
115
  {
116
116
  discountList: mergedDiscountList,
@@ -322,7 +322,7 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
322
322
  this.setDiscountList(newDiscountList || []);
323
323
  this.store.originalDiscountList = newDiscountList || [];
324
324
  this.setProductList(newProductList || []);
325
- if (this.isWalkIn() && resultDiscountList.length && ((_c = this.options.otherParams) == null ? void 0 : _c.platform) === "shop") {
325
+ if (this.isWalkIn() && resultDiscountList.length && ((_c = this.options.otherParams) == null ? void 0 : _c.platform) === "shop" && !((resultDiscountList[0].customer_id || 1) === 1)) {
326
326
  await this.getCustomerWallet(
327
327
  resultDiscountList[0].customer_id
328
328
  );
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "2.2.132",
4
+ "version": "2.2.133",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",