@pisell/pisellos 2.0.13 → 2.0.14

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.
@@ -550,6 +550,9 @@ export var getProductDeposit = function getProductDeposit(params) {
550
550
  deposit_policy_data = _ref2.deposit_policy_data;
551
551
  // 协议数据
552
552
  protocols.push.apply(protocols, _toConsumableArray(deposit_policy_data || []));
553
+ // 是否存在定金,主商品has_deposit为1,但是自身没有定金设置,需要判定子商品是否存在定金,如果不存在最终判定也是不存在定金
554
+ var productHasDeposit = false;
555
+
553
556
  // 判断主商品是否有定金规则
554
557
  if (typeof deposit_fixed === 'string' && typeof deposit_percentage === 'string') {
555
558
  var _handleProductDeposit = handleProductDeposit({
@@ -561,6 +564,7 @@ export var getProductDeposit = function getProductDeposit(params) {
561
564
  result = _handleProductDeposit.result;
562
565
  if (result) {
563
566
  total = depositTotal;
567
+ productHasDeposit = true;
564
568
  }
565
569
  } else {
566
570
  if (bundle !== null && bundle !== void 0 && bundle.length) {
@@ -573,16 +577,20 @@ export var getProductDeposit = function getProductDeposit(params) {
573
577
  depositTotal = _handleProductDeposit2.depositTotal,
574
578
  result = _handleProductDeposit2.result;
575
579
  if (result) {
580
+ productHasDeposit = true;
576
581
  return accumulator.plus(depositTotal);
577
582
  }
578
583
  return accumulator;
579
584
  }, new Decimal(0));
580
585
  }
581
586
  }
582
- return {
583
- total: total.toNumber(),
584
- protocols: protocols
585
- };
587
+ if (productHasDeposit) {
588
+ return {
589
+ total: total.toNumber(),
590
+ protocols: protocols
591
+ };
592
+ }
593
+ return null;
586
594
  }
587
595
  return null;
588
596
  };
@@ -110,7 +110,10 @@ var checkCapacity = function checkCapacity(_ref) {
110
110
  resource = _ref.resource,
111
111
  _ref$currentCount = _ref.currentCount,
112
112
  currentCount = _ref$currentCount === void 0 ? 1 : _ref$currentCount;
113
- if (currentCount > resource.capacity) {
113
+ // 单个预约:如果当前资源容量不足以满足需求的容量,且当前资源是没有被占用的,返回资源不可用标记,但在外部运算会通过 reason=capacityOnly 来处理组合资源可用
114
+ // 多个预约:只需判断容量是否足够
115
+ var isMultipleBooking = resource.resourceType === 'multiple';
116
+ if (currentCount > resource.capacity && (isMultipleBooking || !isMultipleBooking && event_list.length === 0)) {
114
117
  return {
115
118
  status: false,
116
119
  capacity: resource.capacity,
@@ -445,6 +445,7 @@ var getProductDeposit = (params) => {
445
445
  let total = new import_decimal.default(0);
446
446
  const { deposit_fixed, deposit_percentage, deposit_policy_data } = (product == null ? void 0 : product.custom_deposit_data) || {};
447
447
  protocols.push(...deposit_policy_data || []);
448
+ let productHasDeposit = false;
448
449
  if (typeof deposit_fixed === "string" && typeof deposit_percentage === "string") {
449
450
  const { depositTotal, result } = handleProductDeposit({
450
451
  depositData: product == null ? void 0 : product.custom_deposit_data,
@@ -453,6 +454,7 @@ var getProductDeposit = (params) => {
453
454
  });
454
455
  if (result) {
455
456
  total = depositTotal;
457
+ productHasDeposit = true;
456
458
  }
457
459
  } else {
458
460
  if (bundle == null ? void 0 : bundle.length) {
@@ -463,13 +465,17 @@ var getProductDeposit = (params) => {
463
465
  num: currentBundleProduct.num
464
466
  });
465
467
  if (result) {
468
+ productHasDeposit = true;
466
469
  return accumulator.plus(depositTotal);
467
470
  }
468
471
  return accumulator;
469
472
  }, new import_decimal.default(0));
470
473
  }
471
474
  }
472
- return { total: total.toNumber(), protocols };
475
+ if (productHasDeposit) {
476
+ return { total: total.toNumber(), protocols };
477
+ }
478
+ return null;
473
479
  }
474
480
  return null;
475
481
  };
@@ -82,7 +82,8 @@ var checkCapacity = ({
82
82
  resource,
83
83
  currentCount = 1
84
84
  }) => {
85
- if (currentCount > resource.capacity) {
85
+ const isMultipleBooking = resource.resourceType === "multiple";
86
+ if (currentCount > resource.capacity && (isMultipleBooking || !isMultipleBooking && event_list.length === 0)) {
86
87
  return {
87
88
  status: false,
88
89
  capacity: resource.capacity,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "2.0.13",
4
+ "version": "2.0.14",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",