@pisell/pisellos 0.0.349 → 0.0.350

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.
@@ -49,5 +49,5 @@ export declare class Product extends BaseModule implements Module {
49
49
  getCategories(): ProductCategory[];
50
50
  setOtherParams(key: string, value: any): void;
51
51
  getOtherParams(): any;
52
- getProductType(): "normal" | "duration" | "session";
52
+ getProductType(): "duration" | "session" | "normal";
53
53
  }
@@ -404,7 +404,7 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
404
404
  key: "scanCode",
405
405
  value: function () {
406
406
  var _scanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(code, customerId) {
407
- var _this$store$discount3, resultDiscountList, rulesModule, withScanList, _ref2, newProductList, newDiscountList, isAvailable, _this$options$otherPa6;
407
+ var _this$store$discount3, resultDiscountList, rulesModule, withScanList, currentSelectedDiscountList, _ref2, newProductList, newDiscountList, isAvailable, _this$options$otherPa6;
408
408
  return _regeneratorRuntime().wrap(function _callee7$(_context7) {
409
409
  while (1) switch (_context7.prev = _context7.next) {
410
410
  case 0:
@@ -447,7 +447,25 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
447
447
  return _objectSpread(_objectSpread({}, item), {}, {
448
448
  isScan: true
449
449
  });
450
+ }); // 如果扫回来的券当前有选中的,则不进行计算
451
+ currentSelectedDiscountList = this.getDiscountList().filter(function (n) {
452
+ return n.isSelected;
450
453
  });
454
+ if (!(currentSelectedDiscountList.length && currentSelectedDiscountList.some(function (n) {
455
+ return withScanList.some(function (m) {
456
+ return m.id === n.id;
457
+ });
458
+ }))) {
459
+ _context7.next = 16;
460
+ break;
461
+ }
462
+ return _context7.abrupt("return", {
463
+ type: "clientCalc",
464
+ isAvailable: true,
465
+ productList: this.store.productList || [],
466
+ discountList: this.getDiscountList()
467
+ });
468
+ case 16:
451
469
  _ref2 = rulesModule.isDiscountListAvailable({
452
470
  productList: this.store.productList || [],
453
471
  oldDiscountList: this.getDiscountList(),
@@ -458,27 +476,27 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
458
476
  discountList: this.getDiscountList()
459
477
  }, newProductList = _ref2.productList, newDiscountList = _ref2.discountList, isAvailable = _ref2.isAvailable;
460
478
  if (!isAvailable) {
461
- _context7.next = 21;
479
+ _context7.next = 24;
462
480
  break;
463
481
  }
464
482
  this.setDiscountList(newDiscountList || []);
465
483
  this.store.originalDiscountList = newDiscountList || [];
466
484
  this.setProductList(newProductList || []);
467
485
  if (!(this.isWalkIn() && resultDiscountList.length && ((_this$options$otherPa6 = this.options.otherParams) === null || _this$options$otherPa6 === void 0 ? void 0 : _this$options$otherPa6.platform) === 'shop')) {
468
- _context7.next = 21;
486
+ _context7.next = 24;
469
487
  break;
470
488
  }
471
- _context7.next = 21;
489
+ _context7.next = 24;
472
490
  return this.getCustomerWallet(resultDiscountList[0].customer_id);
473
- case 21:
491
+ case 24:
474
492
  return _context7.abrupt("return", {
475
493
  type: "clientCalc",
476
494
  isAvailable: isAvailable || false,
477
495
  productList: newProductList || this.store.productList || [],
478
496
  discountList: newDiscountList || this.getDiscountList()
479
497
  });
480
- case 24:
481
- _context7.prev = 24;
498
+ case 27:
499
+ _context7.prev = 27;
482
500
  _context7.t1 = _context7["catch"](0);
483
501
  console.error('[ShopDiscount] 扫码出错:', _context7.t1);
484
502
  return _context7.abrupt("return", {
@@ -487,11 +505,11 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
487
505
  productList: this.store.productList || [],
488
506
  discountList: this.getDiscountList()
489
507
  });
490
- case 28:
508
+ case 31:
491
509
  case "end":
492
510
  return _context7.stop();
493
511
  }
494
- }, _callee7, this, [[0, 24]]);
512
+ }, _callee7, this, [[0, 27]]);
495
513
  }));
496
514
  function scanCode(_x5, _x6) {
497
515
  return _scanCode.apply(this, arguments);
@@ -49,5 +49,5 @@ export declare class Product extends BaseModule implements Module {
49
49
  getCategories(): ProductCategory[];
50
50
  setOtherParams(key: string, value: any): void;
51
51
  getOtherParams(): any;
52
- getProductType(): "normal" | "duration" | "session";
52
+ getProductType(): "duration" | "session" | "normal";
53
53
  }
@@ -270,6 +270,15 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
270
270
  isScan: true
271
271
  };
272
272
  });
273
+ const currentSelectedDiscountList = this.getDiscountList().filter((n) => n.isSelected);
274
+ if (currentSelectedDiscountList.length && currentSelectedDiscountList.some((n) => withScanList.some((m) => m.id === n.id))) {
275
+ return {
276
+ type: "clientCalc",
277
+ isAvailable: true,
278
+ productList: this.store.productList || [],
279
+ discountList: this.getDiscountList()
280
+ };
281
+ }
273
282
  const {
274
283
  productList: newProductList,
275
284
  discountList: newDiscountList,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "0.0.349",
4
+ "version": "0.0.350",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",