@pisell/pisellos 2.0.67 → 2.1.2

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 (96) hide show
  1. package/dist/core/index.js +1 -2
  2. package/dist/effects/index.d.ts +3 -4
  3. package/dist/effects/index.js +6 -15
  4. package/dist/modules/AccountList/index.d.ts +1 -7
  5. package/dist/modules/AccountList/index.js +14 -81
  6. package/dist/modules/AccountList/types.d.ts +0 -28
  7. package/dist/modules/AccountList/types.js +0 -8
  8. package/dist/modules/Cart/utils/changePrice.d.ts +2 -2
  9. package/dist/modules/Cart/utils/changePrice.js +1 -1
  10. package/dist/modules/ProductList/index.d.ts +3 -14
  11. package/dist/modules/ProductList/index.js +33 -67
  12. package/dist/modules/ProductList/types.d.ts +0 -1
  13. package/dist/modules/Rules/index.js +14 -27
  14. package/dist/modules/Rules/types.d.ts +0 -1
  15. package/dist/modules/index.d.ts +0 -1
  16. package/dist/modules/index.js +0 -1
  17. package/dist/plugins/window.d.ts +0 -1
  18. package/dist/solution/BookingByStep/index.js +50 -34
  19. package/dist/solution/BookingByStep/types.d.ts +3 -2
  20. package/dist/solution/BookingByStep/utils/resources.js +12 -4
  21. package/dist/solution/BuyTickets/index.d.ts +2 -2
  22. package/dist/solution/BuyTickets/index.js +1 -1
  23. package/dist/solution/ShopDiscount/index.js +2 -4
  24. package/dist/solution/index.d.ts +0 -1
  25. package/dist/solution/index.js +0 -1
  26. package/dist/types/index.d.ts +1 -3
  27. package/lib/core/index.js +1 -1
  28. package/lib/effects/index.d.ts +3 -4
  29. package/lib/effects/index.js +1 -4
  30. package/lib/modules/AccountList/index.d.ts +1 -7
  31. package/lib/modules/AccountList/index.js +0 -27
  32. package/lib/modules/AccountList/types.d.ts +0 -28
  33. package/lib/modules/Cart/utils/changePrice.d.ts +2 -2
  34. package/lib/modules/Cart/utils/changePrice.js +1 -1
  35. package/lib/modules/ProductList/index.d.ts +3 -14
  36. package/lib/modules/ProductList/index.js +14 -54
  37. package/lib/modules/ProductList/types.d.ts +0 -1
  38. package/lib/modules/Rules/index.js +12 -20
  39. package/lib/modules/Rules/types.d.ts +0 -1
  40. package/lib/modules/index.d.ts +0 -1
  41. package/lib/modules/index.js +0 -2
  42. package/lib/plugins/window.d.ts +0 -1
  43. package/lib/solution/BookingByStep/index.js +39 -27
  44. package/lib/solution/BookingByStep/types.d.ts +3 -2
  45. package/lib/solution/BookingByStep/utils/resources.js +12 -4
  46. package/lib/solution/BuyTickets/index.d.ts +2 -2
  47. package/lib/solution/BuyTickets/index.js +1 -1
  48. package/lib/solution/ShopDiscount/index.js +1 -2
  49. package/lib/solution/index.d.ts +0 -1
  50. package/lib/solution/index.js +0 -2
  51. package/lib/types/index.d.ts +1 -3
  52. package/package.json +1 -1
  53. package/dist/modules/Customer/constants.d.ts +0 -7
  54. package/dist/modules/Customer/constants.js +0 -12
  55. package/dist/modules/Customer/index.d.ts +0 -122
  56. package/dist/modules/Customer/index.js +0 -697
  57. package/dist/modules/Customer/types.d.ts +0 -146
  58. package/dist/modules/Customer/types.js +0 -41
  59. package/dist/solution/BookingTicket/index.d.ts +0 -172
  60. package/dist/solution/BookingTicket/index.js +0 -665
  61. package/dist/solution/BookingTicket/types.d.ts +0 -68
  62. package/dist/solution/BookingTicket/types.js +0 -43
  63. package/dist/solution/BookingTicket/utils/scan/cloudSearch.d.ts +0 -22
  64. package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +0 -159
  65. package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts +0 -16
  66. package/dist/solution/BookingTicket/utils/scan/handleScan.js +0 -174
  67. package/dist/solution/BookingTicket/utils/scan/index.d.ts +0 -81
  68. package/dist/solution/BookingTicket/utils/scan/index.js +0 -285
  69. package/dist/solution/BookingTicket/utils/scan/scanCache.d.ts +0 -78
  70. package/dist/solution/BookingTicket/utils/scan/scanCache.js +0 -305
  71. package/dist/utils/task.d.ts +0 -40
  72. package/dist/utils/task.js +0 -171
  73. package/dist/utils/watch.d.ts +0 -102
  74. package/dist/utils/watch.js +0 -294
  75. package/lib/modules/Customer/constants.d.ts +0 -7
  76. package/lib/modules/Customer/constants.js +0 -39
  77. package/lib/modules/Customer/index.d.ts +0 -122
  78. package/lib/modules/Customer/index.js +0 -440
  79. package/lib/modules/Customer/types.d.ts +0 -146
  80. package/lib/modules/Customer/types.js +0 -37
  81. package/lib/solution/BookingTicket/index.d.ts +0 -172
  82. package/lib/solution/BookingTicket/index.js +0 -399
  83. package/lib/solution/BookingTicket/types.d.ts +0 -68
  84. package/lib/solution/BookingTicket/types.js +0 -72
  85. package/lib/solution/BookingTicket/utils/scan/cloudSearch.d.ts +0 -22
  86. package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +0 -117
  87. package/lib/solution/BookingTicket/utils/scan/handleScan.d.ts +0 -16
  88. package/lib/solution/BookingTicket/utils/scan/handleScan.js +0 -125
  89. package/lib/solution/BookingTicket/utils/scan/index.d.ts +0 -81
  90. package/lib/solution/BookingTicket/utils/scan/index.js +0 -210
  91. package/lib/solution/BookingTicket/utils/scan/scanCache.d.ts +0 -78
  92. package/lib/solution/BookingTicket/utils/scan/scanCache.js +0 -231
  93. package/lib/utils/task.d.ts +0 -40
  94. package/lib/utils/task.js +0 -109
  95. package/lib/utils/watch.d.ts +0 -102
  96. package/lib/utils/watch.js +0 -217
@@ -28,7 +28,6 @@ import { RulesHooks } from "./types";
28
28
  import { uniqueById } from "../../solution/ShopDiscount/utils";
29
29
  import { getProductOriginTotalPrice, getProductTotalPrice } from "../Cart/utils";
30
30
  import Decimal from 'decimal.js';
31
- import { isBoolean } from 'lodash-es';
32
31
  export var RulesModule = /*#__PURE__*/function (_BaseModule) {
33
32
  _inherits(RulesModule, _BaseModule);
34
33
  var _super = _createSuper(RulesModule);
@@ -297,25 +296,19 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
297
296
 
298
297
  // 记录可抵扣的商品详情
299
298
  var applicableProducts = discountApplicableProducts.get(discount.id) || [];
300
- var discountType = discount.tag || discount.type;
301
- var productData = {
299
+ applicableProducts.push({
302
300
  amount: product.price,
303
- type: discountType,
304
- tag: discountType,
301
+ type: discount.tag || discount.type,
302
+ tag: discount.tag || discount.type,
305
303
  discount: {
306
304
  resource_id: discount.id,
307
305
  title: discount.format_title,
308
306
  original_amount: product.origin_total,
309
307
  pre_value: discount.par_value,
310
308
  product_id: originProduct.id
311
- }
312
- };
313
-
314
- // 如果 discount.tag 或者 discount.type 是 good_pass,则不需要添加 num 属性
315
- if (discountType !== 'good_pass') {
316
- productData.num = product.num || 1;
317
- }
318
- applicableProducts.push(productData);
309
+ },
310
+ num: product.num || 1
311
+ });
319
312
  discountApplicableProducts.set(discount.id, applicableProducts);
320
313
  }
321
314
  });
@@ -337,10 +330,10 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
337
330
  var applicableDiscounts = sortedDiscountList.filter(function (discount) {
338
331
  var _product$discount_lis6;
339
332
  // 如果商品价格为 0,其实不需要使用任何优惠券,直接 return true
340
- // 商品券时主商品价格小于等于0不可用
341
- if ((Number(product.price) <= 0 || !product.price) && (discount.tag || discount.type) === 'good_pass') return false;
342
- // 折扣卡时总价小于等于0时不可用
343
- if ((Number(product.total) <= 0 || !product.total) && !((_product$discount_lis6 = product.discount_list) !== null && _product$discount_lis6 !== void 0 && _product$discount_lis6.find(function (n) {
333
+ // 商品券时主商品价格为0不可用
334
+ if ((Number(product.price) === 0 || !product.price) && (discount.tag || discount.type) === 'good_pass') return false;
335
+ // 折扣卡时总价为0时不可用
336
+ if ((Number(product.total) === 0 || !product.total) && !((_product$discount_lis6 = product.discount_list) !== null && _product$discount_lis6 !== void 0 && _product$discount_lis6.find(function (n) {
344
337
  var _n$discount;
345
338
  return ((_n$discount = n.discount) === null || _n$discount === void 0 ? void 0 : _n$discount.resource_id) === discount.id;
346
339
  })) && (discount.tag || discount.type) !== 'good_pass') return false;
@@ -380,8 +373,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
380
373
  }
381
374
 
382
375
  // 如果没有适用的优惠券,或者手动折扣,则不适用优惠券
383
- // 自定义商品:如果未开启适用折扣卡(product.vouchersApplicable),则不适用优惠券
384
- if (applicableDiscounts.length === 0 || isManualDiscount || isBoolean(product.vouchersApplicable) && !product.vouchersApplicable) {
376
+ if (applicableDiscounts.length === 0 || isManualDiscount) {
385
377
  if (product.isClient) {
386
378
  processedProductsMap.set(product._id, [_this3.hooks.setProduct(originProduct, _objectSpread(_objectSpread({}, isManualDiscount ? {} : {
387
379
  origin_total: getProductOriginTotalPrice({
@@ -457,23 +449,18 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
457
449
 
458
450
  // 计算使用折扣卡/商品券以后,单个商品的总 total
459
451
  var targetProductTotal = _selectedDiscount.tag === 'good_pass' ? new Decimal(productOriginTotal).minus(new Decimal(product.price || 0)).toNumber() : new Decimal(100).minus(_selectedDiscount.par_value || 0).div(100).mul(new Decimal(productOriginTotal)).toNumber();
460
- var discountType = _selectedDiscount.tag === 'product_discount_card' ? 'discount_card' : _selectedDiscount.tag;
461
452
  var discountDetail = {
462
453
  amount: new Decimal(productOriginTotal).minus(new Decimal(targetProductTotal)).toNumber(),
463
- type: discountType,
454
+ type: _selectedDiscount.tag === 'product_discount_card' ? 'discount_card' : _selectedDiscount.tag,
464
455
  discount: {
465
456
  resource_id: _selectedDiscount.id,
466
457
  title: _selectedDiscount.format_title,
467
458
  original_amount: productOriginTotal,
468
459
  product_id: originProduct.id,
469
460
  percent: _selectedDiscount.par_value
470
- }
461
+ },
462
+ num: product.num || 1
471
463
  };
472
-
473
- // 如果 discount.tag 或者 discount.type 是 good_pass,则不需要添加 num 属性
474
- if ((_selectedDiscount.tag || _selectedDiscount.type) !== 'good_pass') {
475
- discountDetail.num = product.num || 1;
476
- }
477
464
  appliedProducts.push(discountDetail);
478
465
  appliedDiscountProducts.set(_selectedDiscount.id, appliedProducts);
479
466
 
@@ -39,7 +39,6 @@ type ProductDetail = {
39
39
  original_price?: number | string;
40
40
  num?: number;
41
41
  quantity: number;
42
- vouchersApplicable?: boolean;
43
42
  };
44
43
  export interface RulesParamsHooks {
45
44
  getProduct: (product: Record<string, any>) => ProductDetail;
@@ -3,7 +3,6 @@ export * from './ProductList';
3
3
  export * from './Cart';
4
4
  export * from './Account';
5
5
  export * from './AccountList';
6
- export * from './Customer';
7
6
  export * from './Date';
8
7
  export * from './Guests';
9
8
  export * from './Order';
@@ -3,7 +3,6 @@ export * from "./ProductList";
3
3
  export * from "./Cart";
4
4
  export * from "./Account";
5
5
  export * from "./AccountList";
6
- export * from "./Customer";
7
6
  export * from "./Date";
8
7
  export * from "./Guests";
9
8
  export * from "./Order";
@@ -13,7 +13,6 @@ export interface WindowPlugin extends Plugin {
13
13
  navigator: Partial<Navigator>;
14
14
  document: Partial<Document>;
15
15
  history: History;
16
- interaction?: any;
17
16
  }
18
17
  /**
19
18
  * 简单的 Storage 接口实现
@@ -701,6 +701,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
701
701
  _params$useCache,
702
702
  useCache,
703
703
  tempProducts,
704
+ _this$store$currentPr,
704
705
  dateRange,
705
706
  tempStartDate,
706
707
  tempEndDate,
@@ -732,8 +733,8 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
732
733
  }
733
734
  // 如果当前打开了某个的商品详情弹窗,则应该默认用这个商品
734
735
  if (this.store.currentProduct) {
735
- tempProducts = [_objectSpread(_objectSpread({}, this.store.currentProduct.getData()), {}, {
736
- _schedule: this.store.currentProduct.getOtherParams()['schedule']
736
+ tempProducts = [_objectSpread(_objectSpread({}, this.store.currentProduct), {}, {
737
+ _schedule: (_this$store$currentPr = this.store.currentProductMeta) === null || _this$store$currentPr === void 0 ? void 0 : _this$store$currentPr['schedule']
737
738
  })];
738
739
  }
739
740
  dateRange = this.store.date.getDateRange();
@@ -2286,41 +2287,42 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
2286
2287
  key: "openProductDetail",
2287
2288
  value: function () {
2288
2289
  var _openProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(productId) {
2289
- var targetProduct, targetProductData, newScheduleArr, dateRange;
2290
+ var targetProductData, newScheduleArr, dateRange;
2290
2291
  return _regeneratorRuntime().wrap(function _callee25$(_context25) {
2291
2292
  while (1) switch (_context25.prev = _context25.next) {
2292
2293
  case 0:
2293
2294
  _context25.next = 2;
2294
2295
  return this.store.products.getProduct(productId);
2295
2296
  case 2:
2296
- targetProduct = _context25.sent;
2297
- if (!targetProduct) {
2298
- _context25.next = 16;
2297
+ targetProductData = _context25.sent;
2298
+ if (!targetProductData) {
2299
+ _context25.next = 17;
2299
2300
  break;
2300
2301
  }
2301
- targetProductData = targetProduct.getData();
2302
- this.store.currentProduct = targetProduct;
2302
+ this.store.currentProduct = targetProductData;
2303
+ this.store.currentProductMeta = {};
2303
2304
  // 资源预加载,如果是 duration 类型的商品,且是先选日期的流程,在这里预拉取资源数据
2304
2305
  if (!targetProductData['schedule.ids']) {
2305
- _context25.next = 11;
2306
+ _context25.next = 12;
2306
2307
  break;
2307
2308
  }
2308
2309
  newScheduleArr = this.getScheduleDataByIds(targetProductData['schedule.ids']);
2309
- targetProduct.setOtherParams('schedule', newScheduleArr);
2310
- _context25.next = 16;
2310
+ if (!this.store.currentProductMeta) this.store.currentProductMeta = {};
2311
+ this.store.currentProductMeta.schedule = newScheduleArr;
2312
+ _context25.next = 17;
2311
2313
  break;
2312
- case 11:
2314
+ case 12:
2313
2315
  if (!targetProductData.duration) {
2314
- _context25.next = 16;
2316
+ _context25.next = 17;
2315
2317
  break;
2316
2318
  }
2317
2319
  dateRange = this.store.date.getDateRange(); // 如果不是先选日期的流程 duration 商品就啥也不做
2318
2320
  if (dateRange !== null && dateRange !== void 0 && dateRange.length) {
2319
- _context25.next = 15;
2321
+ _context25.next = 16;
2320
2322
  break;
2321
2323
  }
2322
2324
  return _context25.abrupt("return");
2323
- case 15:
2325
+ case 16:
2324
2326
  // this.store.date.getResourceDates({
2325
2327
  // query: {
2326
2328
  // start_date: dateRange[0].date,
@@ -2333,7 +2335,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
2333
2335
  endDate: dateRange[dateRange.length - 1].date,
2334
2336
  products: [targetProductData]
2335
2337
  });
2336
- case 16:
2338
+ case 17:
2337
2339
  case "end":
2338
2340
  return _context25.stop();
2339
2341
  }
@@ -2347,8 +2349,9 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
2347
2349
  }, {
2348
2350
  key: "closeProductDetail",
2349
2351
  value: function closeProductDetail() {
2350
- var _this$store$currentPr;
2351
- (_this$store$currentPr = this.store.currentProduct) === null || _this$store$currentPr === void 0 || _this$store$currentPr.setOtherParams('schedule', []);
2352
+ if (this.store.currentProductMeta) {
2353
+ this.store.currentProductMeta.schedule = [];
2354
+ }
2352
2355
  this.store.currentProduct = undefined;
2353
2356
  }
2354
2357
  }, {
@@ -2361,7 +2364,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
2361
2364
  product = _ref10.product;
2362
2365
  var targetProduct = this.store.currentProduct;
2363
2366
  // 如果外面传递了product 优先用外面的
2364
- var targetProductData = product || (targetProduct === null || targetProduct === void 0 ? void 0 : targetProduct.getData());
2367
+ var targetProductData = product || targetProduct;
2365
2368
  var targetSchedules = [];
2366
2369
  // 如果外面传递了 scheduleIds,优先取入参
2367
2370
  if (scheduleIds !== null && scheduleIds !== void 0 && scheduleIds.length) {
@@ -2376,7 +2379,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
2376
2379
  var cartItems = cloneDeep(this.store.cart.getItems());
2377
2380
  var resourcesMap = getResourcesMap((targetResourceDate === null || targetResourceDate === void 0 ? void 0 : targetResourceDate.resource) || []);
2378
2381
  var selectedResources = getOthersSelectedResources(cartItems, '', resourcesMap);
2379
- var productResources = getResourcesByProduct(resourcesMap, resources || ((_this$store$currentPr2 = this.store.currentProduct) === null || _this$store$currentPr2 === void 0 || (_this$store$currentPr2 = _this$store$currentPr2.getData()) === null || _this$store$currentPr2 === void 0 || (_this$store$currentPr2 = _this$store$currentPr2.product_resource) === null || _this$store$currentPr2 === void 0 ? void 0 : _this$store$currentPr2.resources) || [], selectedResources, 1);
2382
+ var productResources = getResourcesByProduct(resourcesMap, resources || ((_this$store$currentPr2 = this.store.currentProduct) === null || _this$store$currentPr2 === void 0 || (_this$store$currentPr2 = _this$store$currentPr2.product_resource) === null || _this$store$currentPr2 === void 0 ? void 0 : _this$store$currentPr2.resources) || [], selectedResources, 1);
2380
2383
  var minTimeMaxTime = calcMinTimeMaxTimeBySchedules(targetSchedules, {}, date);
2381
2384
  var scheduleTimeSlots = getAllSortedDateRanges(minTimeMaxTime);
2382
2385
  // 当前所有待选择资源的集合,先提出来,提升性能
@@ -2496,22 +2499,34 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
2496
2499
  key: "getProductTypeById",
2497
2500
  value: function () {
2498
2501
  var _getProductTypeById = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(id) {
2499
- var product;
2502
+ var productData, _productData$schedule;
2500
2503
  return _regeneratorRuntime().wrap(function _callee26$(_context26) {
2501
2504
  while (1) switch (_context26.prev = _context26.next) {
2502
2505
  case 0:
2503
2506
  _context26.next = 2;
2504
2507
  return this.store.products.getProduct(id);
2505
2508
  case 2:
2506
- product = _context26.sent;
2507
- if (!product) {
2508
- _context26.next = 5;
2509
+ productData = _context26.sent;
2510
+ if (!productData) {
2511
+ _context26.next = 9;
2509
2512
  break;
2510
2513
  }
2511
- return _context26.abrupt("return", product.getProductType());
2512
- case 5:
2513
- return _context26.abrupt("return", 'normal');
2514
+ if (!productData.duration) {
2515
+ _context26.next = 6;
2516
+ break;
2517
+ }
2518
+ return _context26.abrupt("return", 'duration');
2514
2519
  case 6:
2520
+ if (!((_productData$schedule = productData['schedule.ids']) !== null && _productData$schedule !== void 0 && _productData$schedule.length)) {
2521
+ _context26.next = 8;
2522
+ break;
2523
+ }
2524
+ return _context26.abrupt("return", 'session');
2525
+ case 8:
2526
+ return _context26.abrupt("return", 'normal');
2527
+ case 9:
2528
+ return _context26.abrupt("return", 'normal');
2529
+ case 10:
2515
2530
  case "end":
2516
2531
  return _context26.stop();
2517
2532
  }
@@ -2683,7 +2698,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
2683
2698
  key: "getAvailableDateForSessionOptimize",
2684
2699
  value: function () {
2685
2700
  var _getAvailableDateForSessionOptimize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28() {
2686
- var _this$store$currentPr3, _this$store$currentPr4, _this$store$currentPr5, _tempProducts, _this$store$currentPr6;
2701
+ var _this$store$currentPr3, _this$store$currentPr4, _tempProducts;
2687
2702
  var params,
2688
2703
  startDate,
2689
2704
  endDate,
@@ -2729,7 +2744,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
2729
2744
  endDate = tempEndDate;
2730
2745
 
2731
2746
  // 先去读缓存结果,因为正常 UI 调用的是 7 天,而下面我会直接计算 30 天(最少也是 14 天),所以先去读缓存结果,如果缓存结果存在,则直接返回
2732
- cache = (_this$store$currentPr3 = this.store.currentProduct) === null || _this$store$currentPr3 === void 0 ? void 0 : _this$store$currentPr3.getOtherParams()['timeSlotBySchedule'];
2747
+ cache = (_this$store$currentPr3 = this.store.currentProductMeta) === null || _this$store$currentPr3 === void 0 ? void 0 : _this$store$currentPr3['timeSlotBySchedule'];
2733
2748
  if (!cache) {
2734
2749
  _context29.next = 13;
2735
2750
  break;
@@ -2745,8 +2760,8 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
2745
2760
  });
2746
2761
  case 13:
2747
2762
  // 如果当前打开了某个的商品详情弹窗,则应该默认用这个商品
2748
- tempProducts = (_this$store$currentPr4 = this.store.currentProduct) === null || _this$store$currentPr4 === void 0 ? void 0 : _this$store$currentPr4.getData();
2749
- schedule = (_this$store$currentPr5 = this.store.currentProduct) === null || _this$store$currentPr5 === void 0 ? void 0 : _this$store$currentPr5.getOtherParams()['schedule'];
2763
+ tempProducts = this.store.currentProduct;
2764
+ schedule = (_this$store$currentPr4 = this.store.currentProductMeta) === null || _this$store$currentPr4 === void 0 ? void 0 : _this$store$currentPr4['schedule'];
2750
2765
  filteredSchedule = filterScheduleByDateRange(schedule, startDate || '', endDate || ''); // 1.后端返回的数据,确定资源在每一天的可用和使用情况
2751
2766
  tempResourceIds = getResourcesIdsByProduct(tempProducts);
2752
2767
  _context29.next = 19;
@@ -2906,17 +2921,18 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
2906
2921
  this.store.date.setDateList(dates);
2907
2922
 
2908
2923
  // 缓存这次结果,以防后面他小幅度范围内去修改天数
2909
- (_this$store$currentPr6 = this.store.currentProduct) === null || _this$store$currentPr6 === void 0 || _this$store$currentPr6.setOtherParams('timeSlotBySchedule', {
2924
+ if (!this.store.currentProductMeta) this.store.currentProductMeta = {};
2925
+ this.store.currentProductMeta.timeSlotBySchedule = {
2910
2926
  dateList: dates,
2911
2927
  firstAvailableDate: firstAvailableDate,
2912
2928
  startDate: startDate,
2913
2929
  endDate: dayjs(currentDate).format('YYYY-MM-DD')
2914
- });
2930
+ };
2915
2931
  return _context29.abrupt("return", {
2916
2932
  dateList: dates,
2917
2933
  firstAvailableDate: firstAvailableDate
2918
2934
  });
2919
- case 38:
2935
+ case 39:
2920
2936
  case "end":
2921
2937
  return _context29.stop();
2922
2938
  }
@@ -1,4 +1,4 @@
1
- import { ProductList, CartModule, Product, AccountModule, AccountListModule, DateModule, GuestListModule, OrderModule, PaymentModule, ResourceListModule, StepModule, SummaryModule, ScheduleModule } from '../../modules';
1
+ import { ProductList, CartModule, ProductData, AccountModule, AccountListModule, DateModule, GuestListModule, OrderModule, PaymentModule, ResourceListModule, StepModule, SummaryModule, ScheduleModule } from '../../modules';
2
2
  export interface BookingByStepState {
3
3
  cart: CartModule;
4
4
  summary: SummaryModule;
@@ -11,7 +11,8 @@ export interface BookingByStepState {
11
11
  accountList: AccountListModule;
12
12
  order: OrderModule;
13
13
  payment: PaymentModule;
14
- currentProduct?: Product;
14
+ currentProduct?: ProductData;
15
+ currentProductMeta?: Record<string, any>;
15
16
  schedule: ScheduleModule;
16
17
  }
17
18
  export declare function createModule<T extends keyof BookingByStepState>(moduleName: T, solutionName: string, name?: string, version?: string): BookingByStepState[T];
@@ -281,7 +281,9 @@ export var getResourcesByProduct = function getResourcesByProduct(resourcesMap,
281
281
  onlyComputed: true,
282
282
  // 是否是只用来计算用,组合资源里,假设商品只关联了组合资源没关联子资源,需要通过这个计算来在后面从 renderList 里删除这个资源
283
283
  metadata: _objectSpread(_objectSpread({}, resourcesMap[id].metadata), {}, {
284
- combined_resource: resourcesMap[id].combined_resource
284
+ combined_resource: resourcesMap[id].combined_resource,
285
+ form_name: item.title,
286
+ resource_name: resourcesMap[id].main_field
285
287
  })
286
288
  }));
287
289
  }
@@ -292,7 +294,9 @@ export var getResourcesByProduct = function getResourcesByProduct(resourcesMap,
292
294
  resourceType: item.type,
293
295
  children: combiningResources,
294
296
  metadata: _objectSpread(_objectSpread({}, resourcesMap[d].metadata), {}, {
295
- combined_resource: resourcesMap[d].combined_resource
297
+ combined_resource: resourcesMap[d].combined_resource,
298
+ form_name: item.title,
299
+ resource_name: resourcesMap[d].main_field
296
300
  })
297
301
  }));
298
302
  }
@@ -315,7 +319,9 @@ export var getResourcesByProduct = function getResourcesByProduct(resourcesMap,
315
319
  onlyComputed: true,
316
320
  // 是否是只用来计算用,组合资源里,假设商品只关联了组合资源没关联子资源,需要通过这个计算来在后面从 renderList 里删除这个资源
317
321
  metadata: _objectSpread(_objectSpread({}, resourcesMap[id].metadata), {}, {
318
- combined_resource: resourcesMap[id].combined_resource
322
+ combined_resource: resourcesMap[id].combined_resource,
323
+ form_name: item.title,
324
+ resource_name: resourcesMap[id].main_field
319
325
  })
320
326
  }));
321
327
  }
@@ -327,7 +333,9 @@ export var getResourcesByProduct = function getResourcesByProduct(resourcesMap,
327
333
  is_default: 1,
328
334
  children: combiningResources,
329
335
  metadata: _objectSpread(_objectSpread({}, resourcesMap[d].metadata), {}, {
330
- combined_resource: resourcesMap[d].combined_resource
336
+ combined_resource: resourcesMap[d].combined_resource,
337
+ form_name: item.title,
338
+ resource_name: resourcesMap[d].main_field
331
339
  })
332
340
  }));
333
341
  }
@@ -1,5 +1,5 @@
1
1
  import { Module, PisellCore } from '../../types';
2
- import { Product, ProductData } from '../../modules/';
2
+ import { ProductData } from '../../modules/';
3
3
  import { BaseModule } from '../../modules/BaseModule';
4
4
  export * from './types';
5
5
  export declare class BuyTicketsImpl extends BaseModule implements Module {
@@ -16,7 +16,7 @@ export declare class BuyTicketsImpl extends BaseModule implements Module {
16
16
  loadProductsByCategory(categoryId: number): Promise<void>;
17
17
  destroy(): Promise<void>;
18
18
  getProducts(): Promise<ProductData[]>;
19
- getProduct(id: number): Promise<Product>;
19
+ getProduct(id: number): Promise<ProductData>;
20
20
  listSubmit(data: Record<string, any>): Promise<{
21
21
  status: boolean;
22
22
  data: any;
@@ -238,7 +238,7 @@ export var BuyTicketsImpl = /*#__PURE__*/function (_BaseModule) {
238
238
  }
239
239
  return _context6.abrupt("return", otherProduct);
240
240
  case 10:
241
- return _context6.abrupt("return", Promise.reject('Not fund product for id: ' + id));
241
+ throw new Error("Product not found: ".concat(id));
242
242
  case 11:
243
243
  case "end":
244
244
  return _context6.stop();
@@ -29,7 +29,6 @@ import { ShopDiscountHooks } from "./types";
29
29
  import { DiscountModule } from "../../modules/Discount";
30
30
  import { RulesModule } from "../../modules/Rules";
31
31
  import Decimal from 'decimal.js';
32
- import { isBoolean } from 'lodash-es';
33
32
  export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
34
33
  _inherits(ShopDiscountImpl, _BaseModule);
35
34
  var _super = _createSuper(ShopDiscountImpl);
@@ -496,9 +495,8 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
496
495
  return n.id === id;
497
496
  });
498
497
  var product = (_this3$hooks2 = _this3.hooks) === null || _this3$hooks2 === void 0 ? void 0 : _this3$hooks2.getProduct(targetProduct);
499
- // 如果 product.total 是小于等于0有可能是她已经用过商品券或者折扣卡导致的,或者本身就是负数价格,所以此时还需要判断 origin_total 是否小于等于0
500
- // 如果 product.vouchersApplicable是布尔值,并且是 false,也当做免费商品处理,此商品不可用优惠券或折扣卡
501
- return Number(product === null || product === void 0 ? void 0 : product.total) <= 0 && (Number(product === null || product === void 0 ? void 0 : product.origin_total) <= 0 || !(product !== null && product !== void 0 && product.origin_total)) || isBoolean(product === null || product === void 0 ? void 0 : product.vouchersApplicable) && !(product !== null && product !== void 0 && product.vouchersApplicable);
498
+ // 如果 product.total 0有可能是她已经用过商品券或者折扣卡导致的 0,所以此时还需要判断 origin_total 是否为 0
499
+ return Number(product === null || product === void 0 ? void 0 : product.total) === 0 && (Number(product === null || product === void 0 ? void 0 : product.origin_total) === 0 || !(product !== null && product !== void 0 && product.origin_total));
502
500
  };
503
501
  var allUsedProductIds = newDiscountList.map(function (n) {
504
502
  var _n$appliedProductDeta;
@@ -1,4 +1,3 @@
1
1
  export * from './BuyTickets';
2
2
  export * from './BookingByStep';
3
- export * from './BookingTicket';
4
3
  export * from './ShopDiscount';
@@ -1,4 +1,3 @@
1
1
  export * from "./BuyTickets";
2
2
  export * from "./BookingByStep";
3
- export * from "./BookingTicket";
4
3
  export * from "./ShopDiscount";
@@ -38,9 +38,7 @@ export interface PisellCore {
38
38
  getModuleExports: <T = any>(name: string) => T | null;
39
39
  hasModule: (name: string) => boolean;
40
40
  effects: {
41
- on: (event: string, callback: (payload: any) => void) => () => void;
42
- once: (event: string, callback: (payload: any) => void) => () => void;
43
- off: (event: string, callback: (payload: any) => void) => void;
41
+ on: (event: string, callback: (payload: any) => void) => void;
44
42
  emit: (event: string, payload: any, value?: any) => Promise<{
45
43
  status: boolean;
46
44
  data: any;
package/lib/core/index.js CHANGED
@@ -61,7 +61,7 @@ var PisellOSCore = class {
61
61
  console.log(`${prefix} ${message}`);
62
62
  break;
63
63
  case "warn":
64
- console.log(`%c${prefix}%c ${message}`, "color: #f59e0b; font-weight: bold;", "color: #f59e0b;");
64
+ console.warn(`${prefix} ${message}`);
65
65
  break;
66
66
  case "error":
67
67
  console.error(`${prefix} ${message}`);
@@ -2,17 +2,16 @@ type EffectCallback = (payload: any) => void | Promise<void | {
2
2
  status: boolean;
3
3
  message?: string;
4
4
  }>;
5
- type UnsubscribeFunction = () => void;
6
5
  declare class EffectsManager {
7
6
  private listeners;
8
- on(event: string, callback: EffectCallback): UnsubscribeFunction;
7
+ on(event: string, callback: EffectCallback): void;
9
8
  off(event: string, callback: EffectCallback): void;
10
9
  offByModuleDestroy(module: string): void;
11
- once(event: string, callback: EffectCallback): UnsubscribeFunction;
10
+ once(event: string, callback: EffectCallback): void;
12
11
  emit(event: string, payload: any): Promise<{
13
12
  status: boolean;
14
13
  data: any;
15
14
  }>;
16
15
  clear(): void;
17
16
  }
18
- export { EffectsManager, UnsubscribeFunction };
17
+ export { EffectsManager };
@@ -31,9 +31,6 @@ var EffectsManager = class {
31
31
  if (!this.listeners.has(event))
32
32
  this.listeners.set(event, /* @__PURE__ */ new Set());
33
33
  (_a = this.listeners.get(event)) == null ? void 0 : _a.add(callback);
34
- return () => {
35
- this.off(event, callback);
36
- };
37
34
  }
38
35
  off(event, callback) {
39
36
  var _a;
@@ -52,7 +49,7 @@ var EffectsManager = class {
52
49
  await callback(payload);
53
50
  this.off(event, wrapper);
54
51
  };
55
- return this.on(event, wrapper);
52
+ this.on(event, wrapper);
56
53
  }
57
54
  async emit(event, payload) {
58
55
  const callbacks = this.listeners.get(event);
@@ -1,7 +1,7 @@
1
1
  import { Module, PisellCore, ModuleOptions } from '../../types';
2
2
  import { AccountModule, Account } from '../Account';
3
3
  import { BaseModule } from '../BaseModule';
4
- import { IFetchHolderAccountsParams, IHolder, IGetCustomerListParams } from './types';
4
+ import { IFetchHolderAccountsParams, IHolder } from './types';
5
5
  export declare class AccountListModule extends BaseModule implements Module {
6
6
  protected defaultName: string;
7
7
  protected defaultVersion: string;
@@ -37,12 +37,6 @@ export declare class AccountListModule extends BaseModule implements Module {
37
37
  customerId: number;
38
38
  type?: 'unshift' | 'push';
39
39
  }): Promise<AccountModule[]>;
40
- /**
41
- * 获取客户列表
42
- * @param params 查询参数
43
- * @returns 客户列表
44
- */
45
- getCustomerList(params?: IGetCustomerListParams): Promise<any>;
46
40
  /**
47
41
  * 获取holder类型账户列表
48
42
  * @param params
@@ -288,33 +288,6 @@ var AccountListModule = class extends import_BaseModule.BaseModule {
288
288
  );
289
289
  return accountModules;
290
290
  }
291
- /**
292
- * 获取客户列表
293
- * @param params 查询参数
294
- * @returns 客户列表
295
- */
296
- async getCustomerList(params = {}) {
297
- const url = "/customer/es/data";
298
- const { page = 1, pageSize = 20, keyword, ...otherParams } = params;
299
- try {
300
- this.store.isLoading = true;
301
- this.store.error = null;
302
- const queryParams = {
303
- page,
304
- pageSize,
305
- ...keyword && { keyword },
306
- ...otherParams
307
- };
308
- const res = await this.request.get(url, queryParams);
309
- return (res == null ? void 0 : res.data) || [];
310
- } catch (error) {
311
- console.error("Failed to fetch customer list:", error);
312
- this.store.error = error instanceof Error ? error.message : "Failed to fetch customer list";
313
- throw error;
314
- } finally {
315
- this.store.isLoading = false;
316
- }
317
- }
318
291
  /**
319
292
  * 获取holder类型账户列表
320
293
  * @param params
@@ -67,31 +67,3 @@ export interface IHolder {
67
67
  main_field: string;
68
68
  customer_cover?: string;
69
69
  }
70
- /**
71
- * 获取客户列表参数
72
- */
73
- export interface IGetCustomerListParams {
74
- /** 页码 */
75
- page?: number;
76
- /** 每页数量 */
77
- pageSize?: number;
78
- /** 搜索关键词 */
79
- keyword?: string;
80
- /** 其他筛选参数 */
81
- [key: string]: any;
82
- }
83
- /**
84
- * 客户数据
85
- */
86
- export interface ICustomer {
87
- /** 客户ID */
88
- id: string | number;
89
- /** 客户姓名 */
90
- name: string;
91
- /** 客户电话 */
92
- phone?: string;
93
- /** 客户邮箱 */
94
- email?: string;
95
- /** 其他客户信息 */
96
- [key: string]: any;
97
- }
@@ -1,3 +1,3 @@
1
- import { Product } from "../../Product";
1
+ import { ProductData } from "../../Product";
2
2
  import { CartItem, IUpdateItemParams } from "../types";
3
- export declare function updateAllCartItemPrice(cartItems: CartItem[], priceData: any, getProduct: (id: number) => Promise<Product | undefined>, updateCart: (item: IUpdateItemParams) => void, updateItemInitInfo: (item: IUpdateItemParams) => void): Promise<void>;
3
+ export declare function updateAllCartItemPrice(cartItems: CartItem[], priceData: any, getProduct: (id: number) => Promise<ProductData | undefined>, updateCart: (item: IUpdateItemParams) => void, updateItemInitInfo: (item: IUpdateItemParams) => void): Promise<void>;
@@ -40,7 +40,7 @@ async function updateAllCartItemPrice(cartItems, priceData, getProduct, updateCa
40
40
  const cartProduct = await getProduct(
41
41
  item.id
42
42
  );
43
- let productInfo = cartProduct == null ? void 0 : cartProduct.getData();
43
+ let productInfo = cartProduct;
44
44
  if (!productInfo) {
45
45
  productInfo = item._productOrigin;
46
46
  }