@pisell/pisellos 1.0.74 → 1.0.76

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.
@@ -141,9 +141,16 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
141
141
  sortedList = (productsData.data.list || []).slice().sort(function (a, b) {
142
142
  return Number(b.sort) - Number(a.sort);
143
143
  });
144
+ if (sortedList.length) {
145
+ sortedList.forEach(function (n) {
146
+ if (n.is_eject !== 1 && n['schedule.ids'] && n['schedule.ids'].length) {
147
+ n.is_eject = 1;
148
+ }
149
+ });
150
+ }
144
151
  this.addProduct(sortedList);
145
152
  return _context3.abrupt("return", sortedList);
146
- case 10:
153
+ case 11:
147
154
  case "end":
148
155
  return _context3.stop();
149
156
  }
@@ -1197,7 +1197,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
1197
1197
  date: date
1198
1198
  });
1199
1199
  // 如果 quantity 大于 1,且是预约商品,则进入购物车拆散成多条数据
1200
- if (addItemParams.quantity > 1 && !isNormalProduct(productData.origin)) {
1200
+ if (addItemParams.quantity > 1 && !isNormalProduct(productData)) {
1201
1201
  for (var i = 0; i < addItemParams.quantity; i++) {
1202
1202
  var newAddItemParams = cloneDeep(addItemParams);
1203
1203
  newAddItemParams.quantity = 1;
@@ -2735,7 +2735,9 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
2735
2735
  key: "checkMaxDurationCapacity",
2736
2736
  value: function checkMaxDurationCapacity() {
2737
2737
  var _this15 = this;
2738
- var cartItems = cloneDeep(this.store.cart.getItems());
2738
+ var cartItems = this.store.cart.getItems().filter(function (item) {
2739
+ return !isNormalProduct(item._productOrigin);
2740
+ });
2739
2741
  if (cartItems.length === 0) return {
2740
2742
  success: true,
2741
2743
  minAvailableCount: 0
@@ -320,7 +320,7 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
320
320
  key: "scanCode",
321
321
  value: function () {
322
322
  var _scanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(code, customerId) {
323
- var _this$store$discount3, resultDiscountList, rulesModule, withScanList, _ref2, newProductList, newDiscountList, isAvailable, _this$options$otherPa6;
323
+ var _this$store$discount3, resultDiscountList, rulesModule, withScanList, currentSelectedDiscountList, _ref2, newProductList, newDiscountList, isAvailable, _this$options$otherPa6;
324
324
  return _regeneratorRuntime().wrap(function _callee5$(_context5) {
325
325
  while (1) switch (_context5.prev = _context5.next) {
326
326
  case 0:
@@ -363,7 +363,25 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
363
363
  return _objectSpread(_objectSpread({}, item), {}, {
364
364
  isScan: true
365
365
  });
366
+ }); // 如果扫回来的券当前有选中的,则不进行计算
367
+ currentSelectedDiscountList = this.getDiscountList().filter(function (n) {
368
+ return n.isSelected;
366
369
  });
370
+ if (!(currentSelectedDiscountList.length && currentSelectedDiscountList.some(function (n) {
371
+ return withScanList.some(function (m) {
372
+ return m.id === n.id;
373
+ });
374
+ }))) {
375
+ _context5.next = 16;
376
+ break;
377
+ }
378
+ return _context5.abrupt("return", {
379
+ type: "clientCalc",
380
+ isAvailable: true,
381
+ productList: this.store.productList || [],
382
+ discountList: this.getDiscountList()
383
+ });
384
+ case 16:
367
385
  _ref2 = rulesModule.isDiscountListAvailable({
368
386
  productList: this.store.productList || [],
369
387
  oldDiscountList: this.getDiscountList(),
@@ -374,27 +392,27 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
374
392
  discountList: this.getDiscountList()
375
393
  }, newProductList = _ref2.productList, newDiscountList = _ref2.discountList, isAvailable = _ref2.isAvailable;
376
394
  if (!isAvailable) {
377
- _context5.next = 21;
395
+ _context5.next = 24;
378
396
  break;
379
397
  }
380
398
  this.setDiscountList(newDiscountList || []);
381
399
  this.store.originalDiscountList = newDiscountList || [];
382
400
  this.setProductList(newProductList || []);
383
401
  if (!(this.isWalkIn() && resultDiscountList.length && ((_this$options$otherPa6 = this.options.otherParams) === null || _this$options$otherPa6 === void 0 ? void 0 : _this$options$otherPa6.platform) === 'shop')) {
384
- _context5.next = 21;
402
+ _context5.next = 24;
385
403
  break;
386
404
  }
387
- _context5.next = 21;
405
+ _context5.next = 24;
388
406
  return this.getCustomerWallet(resultDiscountList[0].customer_id);
389
- case 21:
407
+ case 24:
390
408
  return _context5.abrupt("return", {
391
409
  type: "clientCalc",
392
410
  isAvailable: isAvailable || false,
393
411
  productList: newProductList || this.store.productList || [],
394
412
  discountList: newDiscountList || this.getDiscountList()
395
413
  });
396
- case 24:
397
- _context5.prev = 24;
414
+ case 27:
415
+ _context5.prev = 27;
398
416
  _context5.t1 = _context5["catch"](0);
399
417
  console.error('[ShopDiscount] 扫码出错:', _context5.t1);
400
418
  return _context5.abrupt("return", {
@@ -403,11 +421,11 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
403
421
  productList: this.store.productList || [],
404
422
  discountList: this.getDiscountList()
405
423
  });
406
- case 28:
424
+ case 31:
407
425
  case "end":
408
426
  return _context5.stop();
409
427
  }
410
- }, _callee5, this, [[0, 24]]);
428
+ }, _callee5, this, [[0, 27]]);
411
429
  }));
412
430
  function scanCode(_x4, _x5) {
413
431
  return _scanCode.apply(this, arguments);
@@ -103,6 +103,13 @@ var ProductList = class extends import_BaseModule.BaseModule {
103
103
  { useCache: true }
104
104
  );
105
105
  const sortedList = (productsData.data.list || []).slice().sort((a, b) => Number(b.sort) - Number(a.sort));
106
+ if (sortedList.length) {
107
+ sortedList.forEach((n) => {
108
+ if (n.is_eject !== 1 && n["schedule.ids"] && n["schedule.ids"].length) {
109
+ n.is_eject = 1;
110
+ }
111
+ });
112
+ }
106
113
  this.addProduct(sortedList);
107
114
  return sortedList;
108
115
  }
@@ -637,7 +637,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
637
637
  addItemParams.account = account;
638
638
  }
639
639
  this.addProductCheck({ date });
640
- if (addItemParams.quantity > 1 && !(0, import_utils5.isNormalProduct)(productData.origin)) {
640
+ if (addItemParams.quantity > 1 && !(0, import_utils5.isNormalProduct)(productData)) {
641
641
  for (let i = 0; i < addItemParams.quantity; i++) {
642
642
  const newAddItemParams = (0, import_lodash_es.cloneDeep)(addItemParams);
643
643
  newAddItemParams.quantity = 1;
@@ -1924,7 +1924,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1924
1924
  }
1925
1925
  checkMaxDurationCapacity() {
1926
1926
  var _a, _b;
1927
- const cartItems = (0, import_lodash_es.cloneDeep)(this.store.cart.getItems());
1927
+ const cartItems = this.store.cart.getItems().filter((item) => !(0, import_utils5.isNormalProduct)(item._productOrigin));
1928
1928
  if (cartItems.length === 0)
1929
1929
  return { success: true, minAvailableCount: 0 };
1930
1930
  const itemsWithTime = [];
@@ -233,6 +233,15 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
233
233
  isScan: true
234
234
  };
235
235
  });
236
+ const currentSelectedDiscountList = this.getDiscountList().filter((n) => n.isSelected);
237
+ if (currentSelectedDiscountList.length && currentSelectedDiscountList.some((n) => withScanList.some((m) => m.id === n.id))) {
238
+ return {
239
+ type: "clientCalc",
240
+ isAvailable: true,
241
+ productList: this.store.productList || [],
242
+ discountList: this.getDiscountList()
243
+ };
244
+ }
236
245
  const {
237
246
  productList: newProductList,
238
247
  discountList: newDiscountList,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "1.0.74",
4
+ "version": "1.0.76",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",