@pisell/pisellos 3.0.18 → 3.0.19

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.
@@ -542,16 +542,18 @@ export var getProductDeposit = function getProductDeposit(params) {
542
542
 
543
543
  // 判定商品是否有定金规则
544
544
  if ((product === null || product === void 0 || (_product$custom_depos2 = product.custom_deposit_data) === null || _product$custom_depos2 === void 0 ? void 0 : _product$custom_depos2.has_deposit) == 1) {
545
- var protocols = [];
546
545
  var total = new Decimal(0);
547
546
  var _ref2 = (product === null || product === void 0 ? void 0 : product.custom_deposit_data) || {},
548
547
  deposit_fixed = _ref2.deposit_fixed,
549
548
  deposit_percentage = _ref2.deposit_percentage,
550
- deposit_policy_data = _ref2.deposit_policy_data;
551
- // 协议数据
552
- protocols.push.apply(protocols, _toConsumableArray(deposit_policy_data || []));
549
+ deposit_policy_data = _ref2.deposit_policy_data,
550
+ self_deposit_policy_ids = _ref2.self_deposit_policy_ids;
551
+ // 所有协议数据
552
+ var allProtocols = deposit_policy_data || [];
553
553
  // 是否存在定金,主商品has_deposit为1,但是自身没有定金设置,需要判定子商品是否存在定金,如果不存在最终判定也是不存在定金
554
554
  var productHasDeposit = false;
555
+ // 关联的定金协议id
556
+ var protocolIds = [];
555
557
 
556
558
  // 判断主商品是否有定金规则
557
559
  if (typeof deposit_fixed === 'string' && typeof deposit_percentage === 'string') {
@@ -564,19 +566,22 @@ export var getProductDeposit = function getProductDeposit(params) {
564
566
  result = _handleProductDeposit.result;
565
567
  if (result) {
566
568
  total = depositTotal;
569
+ protocolIds.push.apply(protocolIds, _toConsumableArray(self_deposit_policy_ids || []));
567
570
  productHasDeposit = true;
568
571
  }
569
572
  } else {
570
573
  if (bundle !== null && bundle !== void 0 && bundle.length) {
571
- total = bundle.reduce(function (accumulator, currentBundleProduct) {
574
+ total = bundle.reduce(function (accumulator, currBundleProduct) {
575
+ var depositData = currBundleProduct === null || currBundleProduct === void 0 ? void 0 : currBundleProduct.custom_deposit_data;
572
576
  var _handleProductDeposit2 = handleProductDeposit({
573
- depositData: currentBundleProduct === null || currentBundleProduct === void 0 ? void 0 : currentBundleProduct.custom_deposit_data,
574
- total: currentBundleProduct.price,
575
- num: currentBundleProduct.num
577
+ depositData: depositData,
578
+ total: currBundleProduct === null || currBundleProduct === void 0 ? void 0 : currBundleProduct.price,
579
+ num: (currBundleProduct === null || currBundleProduct === void 0 ? void 0 : currBundleProduct.num) || 1
576
580
  }),
577
581
  depositTotal = _handleProductDeposit2.depositTotal,
578
582
  result = _handleProductDeposit2.result;
579
583
  if (result) {
584
+ protocolIds.push.apply(protocolIds, _toConsumableArray((depositData === null || depositData === void 0 ? void 0 : depositData.self_deposit_policy_ids) || []));
580
585
  productHasDeposit = true;
581
586
  return accumulator.plus(depositTotal);
582
587
  }
@@ -585,6 +590,10 @@ export var getProductDeposit = function getProductDeposit(params) {
585
590
  }
586
591
  }
587
592
  if (productHasDeposit) {
593
+ var ids = new Set(protocolIds);
594
+ var protocols = allProtocols.filter(function (item) {
595
+ return ids.has(item.id);
596
+ });
588
597
  return {
589
598
  total: total.toNumber(),
590
599
  protocols: protocols
@@ -44,6 +44,7 @@ export interface Discount {
44
44
  balance: string;
45
45
  format_title: Formattitle;
46
46
  product: Product;
47
+ type: "product" | 'good_pass';
47
48
  resource_id?: number;
48
49
  savedAmount?: number;
49
50
  isEditMode?: boolean;
@@ -168,6 +168,8 @@ export interface ProductData {
168
168
  deposit_fixed?: string;
169
169
  /** 定金百分比 */
170
170
  deposit_percentage?: string;
171
+ /** 关联的定金协议id */
172
+ self_deposit_policy_ids?: number[];
171
173
  /** 定金协议数据 */
172
174
  deposit_policy_data?: Array<{
173
175
  /** 定金协议id */
@@ -25,7 +25,8 @@ export declare class RulesModule extends BaseModule implements Module, RulesModu
25
25
  productList: any[];
26
26
  }, options?: {
27
27
  isSelected?: boolean;
28
- discountId: number;
28
+ discountId?: number;
29
+ scan?: boolean;
29
30
  }): DiscountResult;
30
31
  destroy(): Promise<void>;
31
32
  clear(): Promise<void>;
@@ -111,6 +111,8 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
111
111
  var result = this.calcDiscount({
112
112
  discountList: mergedDiscountList,
113
113
  productList: _toConsumableArray(productList)
114
+ }, {
115
+ scan: true
114
116
  });
115
117
 
116
118
  // 检查是否有产品使用了新折扣
@@ -214,7 +216,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
214
216
 
215
217
  // 编辑的商品 使用了优惠券不可用
216
218
  var isAvailableProduct = !(product !== null && product !== void 0 && product.booking_id && product !== null && product !== void 0 && (_product$discount_lis = product.discount_list) !== null && _product$discount_lis !== void 0 && _product$discount_lis.length && product !== null && product !== void 0 && (_product$discount_lis2 = product.discount_list) !== null && _product$discount_lis2 !== void 0 && _product$discount_lis2.every(function (discount) {
217
- return discount.id;
219
+ return discount.id && discount.type === 'good_pass';
218
220
  }));
219
221
 
220
222
  // 判断优惠券是否适用于该商品
@@ -244,7 +246,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
244
246
  var _product$discount_lis3, _product$discount_lis4, _product$discount_lis5;
245
247
  var product = _this3.hooks.getProduct(originProduct);
246
248
  if (product !== null && product !== void 0 && product.booking_id && (_product$discount_lis3 = product.discount_list) !== null && _product$discount_lis3 !== void 0 && _product$discount_lis3.length && product !== null && product !== void 0 && (_product$discount_lis4 = product.discount_list) !== null && _product$discount_lis4 !== void 0 && _product$discount_lis4.every(function (discount) {
247
- return discount.id;
249
+ return discount.id && discount.type === 'good_pass';
248
250
  })) {
249
251
  processedProductsMap.set(product._id, originProduct);
250
252
  return;
@@ -308,7 +310,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
308
310
  }
309
311
  return;
310
312
  }
311
- if (applicableDiscounts.length && product.booking_id && typeof selectedDiscount.isManualSelect === 'undefined') {
313
+ if (applicableDiscounts.length && product.booking_id && typeof selectedDiscount.isManualSelect === 'undefined' && !(options !== null && options !== void 0 && options.scan)) {
312
314
  return;
313
315
  }
314
316
 
@@ -366,7 +368,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
366
368
  var product = _this3.hooks.getProduct(originProduct);
367
369
  var getDefaultProduct = function getDefaultProduct() {
368
370
  if (product.isClient) {
369
- _this3.hooks.setProduct(originProduct, {
371
+ return _this3.hooks.setProduct(originProduct, {
370
372
  discount_list: [],
371
373
  price: product.price,
372
374
  origin_total: getProductOriginTotalPrice({
@@ -385,7 +387,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
385
387
  })
386
388
  });
387
389
  } else {
388
- _this3.hooks.setProduct(originProduct, {
390
+ return _this3.hooks.setProduct(originProduct, {
389
391
  discount_list: [],
390
392
  total: product.total,
391
393
  origin_total: product.origin_total,
@@ -112,8 +112,9 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
112
112
  throw new Error("\u6A21\u5757 ".concat(step, " \u4E0D\u5B58\u5728"));
113
113
  }
114
114
  });
115
+ this.loadAllSchedule();
115
116
  this.core.effects.emit(BookingByStepHooks.onInited, {});
116
- case 15:
117
+ case 16:
117
118
  case "end":
118
119
  return _context.stop();
119
120
  }
@@ -306,7 +307,11 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
306
307
  while (1) switch (_context4.prev = _context4.next) {
307
308
  case 0:
308
309
  _context4.next = 2;
309
- return this.request.get("/schedule?num=999");
310
+ return this.request.get("/schedule", {
311
+ num: 999
312
+ }, {
313
+ useCache: true
314
+ });
310
315
  case 2:
311
316
  scheduleList = _context4.sent;
312
317
  this.store.schedule.setScheduleList(((_scheduleList$data = scheduleList.data) === null || _scheduleList$data === void 0 ? void 0 : _scheduleList$data.list) || []);
@@ -1069,72 +1074,75 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
1069
1074
  if (n.resource) allOriginResources.push.apply(allOriginResources, _toConsumableArray(n.resource));
1070
1075
  });
1071
1076
  }
1072
- // 更新购物车后,需要判定购物车里是否存在多个账号选择了相同资源的情况,如果是,且资源是单个预约,则要把选择了相同资源的 product._origin.resources 给去除
1073
- var cartItems = this.store.cart.getItems();
1074
- cartItems.forEach(function (item) {
1075
- if (item._id !== targetCartItem._id) {
1076
- var _item$_origin$resourc;
1077
- var resources = (_item$_origin$resourc = item._origin.resources) === null || _item$_origin$resourc === void 0 ? void 0 : _item$_origin$resourc.filter(function (m) {
1078
- // 检查当前资源是否与目标资源的任何资源匹配
1079
- return !targetCartItem._origin.resources.some(function (targetRes) {
1080
- // 如果新更新进来的资源不是单个预约,其实就不需要检测了资源重叠了,但是需要检测资源 capacity 是否足够
1081
- if (targetRes.resourceType !== 'single') {
1082
- var _item$_productOrigin2;
1083
- var _formatCapacity = formatDefaultCapacitys({
1084
- capacity: (_item$_productOrigin2 = item._productOrigin) === null || _item$_productOrigin2 === void 0 ? void 0 : _item$_productOrigin2.capacity,
1085
- product_bundle: item._origin.product.product_bundle
1086
- });
1087
- var _currentCapacity = getSumCapacity({
1088
- capacity: _formatCapacity
1089
- });
1090
- var originResource = allOriginResources.find(function (n) {
1091
- return n.id === targetRes.id;
1092
- });
1093
- if (currentResourcesCapacityMap[targetRes.id] + _currentCapacity > (originResource === null || originResource === void 0 ? void 0 : originResource.capacity)) {
1094
- return true;
1077
+ // 只有在更新资源的时候做这个判断,其他情况下不做处理
1078
+ if (params.resources) {
1079
+ // 更新购物车后,需要判定购物车里是否存在多个账号选择了相同资源的情况,如果是,且资源是单个预约,则要把选择了相同资源的 product._origin.resources 给去除
1080
+ var cartItems = this.store.cart.getItems();
1081
+ cartItems.forEach(function (item) {
1082
+ if (item._id !== targetCartItem._id) {
1083
+ var _item$_origin$resourc;
1084
+ var resources = (_item$_origin$resourc = item._origin.resources) === null || _item$_origin$resourc === void 0 ? void 0 : _item$_origin$resourc.filter(function (m) {
1085
+ // 检查当前资源是否与目标资源的任何资源匹配
1086
+ return !targetCartItem._origin.resources.some(function (targetRes) {
1087
+ // 如果新更新进来的资源不是单个预约,其实就不需要检测了资源重叠了,但是需要检测资源 capacity 是否足够
1088
+ if (targetRes.resourceType !== 'single') {
1089
+ var _item$_productOrigin2;
1090
+ var _formatCapacity = formatDefaultCapacitys({
1091
+ capacity: (_item$_productOrigin2 = item._productOrigin) === null || _item$_productOrigin2 === void 0 ? void 0 : _item$_productOrigin2.capacity,
1092
+ product_bundle: item._origin.product.product_bundle
1093
+ });
1094
+ var _currentCapacity = getSumCapacity({
1095
+ capacity: _formatCapacity
1096
+ });
1097
+ var originResource = allOriginResources.find(function (n) {
1098
+ return n.id === targetRes.id;
1099
+ });
1100
+ if (currentResourcesCapacityMap[targetRes.id] + _currentCapacity > (originResource === null || originResource === void 0 ? void 0 : originResource.capacity)) {
1101
+ return true;
1102
+ }
1103
+ currentResourcesCapacityMap[targetRes.id] += _currentCapacity;
1104
+ return false;
1105
+ }
1106
+ if (item.holder_id !== (targetCartItem === null || targetCartItem === void 0 ? void 0 : targetCartItem.holder_id)) {
1107
+ var _targetRes$metadata$c, _m$metadata$combined_;
1108
+ // 检查主资源ID是否匹配
1109
+ if (targetRes.id === m.id) return true;
1110
+ // 检查组合资源的情况
1111
+ if (((_targetRes$metadata$c = targetRes.metadata.combined_resource) === null || _targetRes$metadata$c === void 0 ? void 0 : _targetRes$metadata$c.status) === 1 && (
1112
+ // 如果现在选择的是组合资源,需要判断
1113
+ // 1、当前其他购物车里是否选了当前组合资源的子资源
1114
+ // 2、如果其他购物车里的商品也是组合资源,出了组合资源本身的 id 需要判断,还需要判断子资源的 id 是否有交集
1115
+ targetRes.metadata.combined_resource.resource_ids.includes(m.id) || targetRes.metadata.combined_resource.resource_ids.some(function (n) {
1116
+ return m.metadata.combined_resource.resource_ids.includes(n);
1117
+ }))) return true;
1118
+ if (((_m$metadata$combined_ = m.metadata.combined_resource) === null || _m$metadata$combined_ === void 0 ? void 0 : _m$metadata$combined_.status) === 1 && m.metadata.combined_resource.resource_ids.includes(targetRes.id)) return true;
1095
1119
  }
1096
- currentResourcesCapacityMap[targetRes.id] += _currentCapacity;
1097
1120
  return false;
1098
- }
1099
- if (item.holder_id !== (targetCartItem === null || targetCartItem === void 0 ? void 0 : targetCartItem.holder_id)) {
1100
- var _targetRes$metadata$c, _m$metadata$combined_;
1101
- // 检查主资源ID是否匹配
1102
- if (targetRes.id === m.id) return true;
1103
- // 检查组合资源的情况
1104
- if (((_targetRes$metadata$c = targetRes.metadata.combined_resource) === null || _targetRes$metadata$c === void 0 ? void 0 : _targetRes$metadata$c.status) === 1 && (
1105
- // 如果现在选择的是组合资源,需要判断
1106
- // 1、当前其他购物车里是否选了当前组合资源的子资源
1107
- // 2、如果其他购物车里的商品也是组合资源,出了组合资源本身的 id 需要判断,还需要判断子资源的 id 是否有交集
1108
- targetRes.metadata.combined_resource.resource_ids.includes(m.id) || targetRes.metadata.combined_resource.resource_ids.some(function (n) {
1109
- return m.metadata.combined_resource.resource_ids.includes(n);
1110
- }))) return true;
1111
- if (((_m$metadata$combined_ = m.metadata.combined_resource) === null || _m$metadata$combined_ === void 0 ? void 0 : _m$metadata$combined_.status) === 1 && m.metadata.combined_resource.resource_ids.includes(targetRes.id)) return true;
1112
- }
1113
- return false;
1114
- });
1115
- });
1116
- // session 类商品应该只调用清空 resource 的方法
1117
- if (item.start_time) {
1118
- var start_time = item.start_time;
1119
- var end_time = item.end_time;
1120
- var start_date = item.start_date;
1121
- var end_date = item.end_date;
1122
- _this5.store.cart.updateItem({
1123
- _id: item._id,
1124
- resources: resources,
1125
- date: {
1126
- startTime: dayjs("".concat(start_date, " ").concat(start_time)).format('YYYY-MM-DD HH:mm'),
1127
- endTime: dayjs("".concat(end_date, " ").concat(end_time)).format('YYYY-MM-DD HH:mm')
1128
- }
1129
- });
1130
- } else {
1131
- _this5.store.cart.updateItem({
1132
- _id: item._id,
1133
- resources: resources
1121
+ });
1134
1122
  });
1123
+ // session 类商品应该只调用清空 resource 的方法
1124
+ if (item.start_time) {
1125
+ var start_time = item.start_time;
1126
+ var end_time = item.end_time;
1127
+ var start_date = item.start_date;
1128
+ var end_date = item.end_date;
1129
+ _this5.store.cart.updateItem({
1130
+ _id: item._id,
1131
+ resources: resources,
1132
+ date: {
1133
+ startTime: dayjs("".concat(start_date, " ").concat(start_time)).format('YYYY-MM-DD HH:mm'),
1134
+ endTime: dayjs("".concat(end_date, " ").concat(end_time)).format('YYYY-MM-DD HH:mm')
1135
+ }
1136
+ });
1137
+ } else {
1138
+ _this5.store.cart.updateItem({
1139
+ _id: item._id,
1140
+ resources: resources
1141
+ });
1142
+ }
1135
1143
  }
1136
- }
1137
- });
1144
+ });
1145
+ }
1138
1146
  }
1139
1147
 
1140
1148
  // 删除购物车里某个商品
@@ -1745,16 +1753,17 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
1745
1753
  };
1746
1754
  }
1747
1755
  if (recordTimeSlots) {
1748
- var _item$_productOrigin4;
1756
+ var _item$_productOrigin4, _item$_productOrigin5;
1749
1757
  // 同一账号下,如果当前商品不是第一个,则需要根据上一个商品的 end_time 和 duration 计算出当前商品的 start_time 和 end_time
1750
1758
  // 前提:当前资源是单个预约才需要这么做
1751
1759
  var currentResourceConfig = (_item$_productOrigin4 = item._productOrigin) === null || _item$_productOrigin4 === void 0 || (_item$_productOrigin4 = _item$_productOrigin4.product_resource) === null || _item$_productOrigin4 === void 0 || (_item$_productOrigin4 = _item$_productOrigin4.resources) === null || _item$_productOrigin4 === void 0 ? void 0 : _item$_productOrigin4.find(function (n) {
1752
1760
  return n.code === resources_code;
1753
1761
  });
1754
- if (index !== 0 && recordTimeSlots && (currentResourceConfig === null || currentResourceConfig === void 0 ? void 0 : currentResourceConfig.type) === 'single') {
1755
- var _item$_productOrigin$, _item$_productOrigin5, _ref9, _item$_productOrigin6, _item$_productOrigin$2, _item$_productOrigin7, _ref10, _item$_productOrigin8;
1756
- var start_at = dayjs(recordTimeSlots.end_time).add((_item$_productOrigin$ = (_item$_productOrigin5 = item._productOrigin) === null || _item$_productOrigin5 === void 0 || (_item$_productOrigin5 = _item$_productOrigin5.duration) === null || _item$_productOrigin5 === void 0 ? void 0 : _item$_productOrigin5.value) !== null && _item$_productOrigin$ !== void 0 ? _item$_productOrigin$ : 0, (_ref9 = (_item$_productOrigin6 = item._productOrigin) === null || _item$_productOrigin6 === void 0 || (_item$_productOrigin6 = _item$_productOrigin6.duration) === null || _item$_productOrigin6 === void 0 ? void 0 : _item$_productOrigin6.type) !== null && _ref9 !== void 0 ? _ref9 : 'minutes');
1757
- var end_at = start_at.add((_item$_productOrigin$2 = (_item$_productOrigin7 = item._productOrigin) === null || _item$_productOrigin7 === void 0 || (_item$_productOrigin7 = _item$_productOrigin7.duration) === null || _item$_productOrigin7 === void 0 ? void 0 : _item$_productOrigin7.value) !== null && _item$_productOrigin$2 !== void 0 ? _item$_productOrigin$2 : 0, (_ref10 = (_item$_productOrigin8 = item._productOrigin) === null || _item$_productOrigin8 === void 0 || (_item$_productOrigin8 = _item$_productOrigin8.duration) === null || _item$_productOrigin8 === void 0 ? void 0 : _item$_productOrigin8.type) !== null && _ref10 !== void 0 ? _ref10 : 'minutes');
1762
+ // 只有 duration 类商品需要这个操作
1763
+ if (index !== 0 && recordTimeSlots && (currentResourceConfig === null || currentResourceConfig === void 0 ? void 0 : currentResourceConfig.type) === 'single' && (_item$_productOrigin5 = item._productOrigin) !== null && _item$_productOrigin5 !== void 0 && _item$_productOrigin5.duration) {
1764
+ var _item$_productOrigin$, _item$_productOrigin6, _ref9, _item$_productOrigin7, _item$_productOrigin$2, _item$_productOrigin8, _ref10, _item$_productOrigin9;
1765
+ var start_at = dayjs(recordTimeSlots.end_time).add((_item$_productOrigin$ = (_item$_productOrigin6 = item._productOrigin) === null || _item$_productOrigin6 === void 0 || (_item$_productOrigin6 = _item$_productOrigin6.duration) === null || _item$_productOrigin6 === void 0 ? void 0 : _item$_productOrigin6.value) !== null && _item$_productOrigin$ !== void 0 ? _item$_productOrigin$ : 0, (_ref9 = (_item$_productOrigin7 = item._productOrigin) === null || _item$_productOrigin7 === void 0 || (_item$_productOrigin7 = _item$_productOrigin7.duration) === null || _item$_productOrigin7 === void 0 ? void 0 : _item$_productOrigin7.type) !== null && _ref9 !== void 0 ? _ref9 : 'minutes');
1766
+ var end_at = start_at.add((_item$_productOrigin$2 = (_item$_productOrigin8 = item._productOrigin) === null || _item$_productOrigin8 === void 0 || (_item$_productOrigin8 = _item$_productOrigin8.duration) === null || _item$_productOrigin8 === void 0 ? void 0 : _item$_productOrigin8.value) !== null && _item$_productOrigin$2 !== void 0 ? _item$_productOrigin$2 : 0, (_ref10 = (_item$_productOrigin9 = item._productOrigin) === null || _item$_productOrigin9 === void 0 || (_item$_productOrigin9 = _item$_productOrigin9.duration) === null || _item$_productOrigin9 === void 0 ? void 0 : _item$_productOrigin9.type) !== null && _ref10 !== void 0 ? _ref10 : 'minutes');
1758
1767
  recordTimeSlots = {
1759
1768
  start_time: start_at.format('HH:mm'),
1760
1769
  end_time: end_at.format('HH:mm'),
@@ -1796,12 +1805,12 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
1796
1805
  errorList.push(item._id);
1797
1806
  }
1798
1807
  } else {
1799
- var _item$_productOrigin9, _productResources$fin;
1808
+ var _item$_productOrigin10, _productResources$fin;
1800
1809
  // 这里必须每次循环重新读,避免前一次循环操作了购物车,导致数据变更
1801
1810
  var allCartItems = cloneDeep(_this8.store.cart.getItems());
1802
1811
  // 如果没有传递 timeSlots,代表是第一种资源,则直接拿商品的 duration,到资源列表里找一个公共可用的
1803
1812
  var selectedResources = [];
1804
- var _resources = cloneDeep(((_item$_productOrigin9 = item._productOrigin) === null || _item$_productOrigin9 === void 0 || (_item$_productOrigin9 = _item$_productOrigin9.product_resource) === null || _item$_productOrigin9 === void 0 ? void 0 : _item$_productOrigin9.resources) || []);
1813
+ var _resources = cloneDeep(((_item$_productOrigin10 = item._productOrigin) === null || _item$_productOrigin10 === void 0 || (_item$_productOrigin10 = _item$_productOrigin10.product_resource) === null || _item$_productOrigin10 === void 0 ? void 0 : _item$_productOrigin10.resources) || []);
1805
1814
  var currentResourcesRenderList = [];
1806
1815
  _resources.forEach(function (n) {
1807
1816
  var _n$renderList;
@@ -1901,8 +1910,8 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
1901
1910
  var resourceIds = [];
1902
1911
  var resourcesTypeId = undefined;
1903
1912
  cartItems.forEach(function (item) {
1904
- var _item$_productOrigin10, _item$_productOrigin11;
1905
- (_item$_productOrigin10 = item._productOrigin) === null || _item$_productOrigin10 === void 0 || (_item$_productOrigin10 = _item$_productOrigin10.product_resource) === null || _item$_productOrigin10 === void 0 || (_item$_productOrigin10 = _item$_productOrigin10.resources) === null || _item$_productOrigin10 === void 0 || _item$_productOrigin10.forEach(function (n) {
1913
+ var _item$_productOrigin11, _item$_productOrigin12;
1914
+ (_item$_productOrigin11 = item._productOrigin) === null || _item$_productOrigin11 === void 0 || (_item$_productOrigin11 = _item$_productOrigin11.product_resource) === null || _item$_productOrigin11 === void 0 || (_item$_productOrigin11 = _item$_productOrigin11.resources) === null || _item$_productOrigin11 === void 0 || _item$_productOrigin11.forEach(function (n) {
1906
1915
  if (n.code === resources_code) {
1907
1916
  resources.push.apply(resources, _toConsumableArray(n.renderList || []));
1908
1917
  }
@@ -1913,9 +1922,9 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
1913
1922
  if (item.resource_id) {
1914
1923
  resourceIds.push(item.resource_id);
1915
1924
  }
1916
- resourcesTypeId = item === null || item === void 0 || (_item$_productOrigin11 = item._productOrigin) === null || _item$_productOrigin11 === void 0 || (_item$_productOrigin11 = _item$_productOrigin11.product_resource) === null || _item$_productOrigin11 === void 0 || (_item$_productOrigin11 = _item$_productOrigin11.resources) === null || _item$_productOrigin11 === void 0 || (_item$_productOrigin11 = _item$_productOrigin11.find(function (n) {
1925
+ resourcesTypeId = item === null || item === void 0 || (_item$_productOrigin12 = item._productOrigin) === null || _item$_productOrigin12 === void 0 || (_item$_productOrigin12 = _item$_productOrigin12.product_resource) === null || _item$_productOrigin12 === void 0 || (_item$_productOrigin12 = _item$_productOrigin12.resources) === null || _item$_productOrigin12 === void 0 || (_item$_productOrigin12 = _item$_productOrigin12.find(function (n) {
1917
1926
  return n.code === resources_code;
1918
- })) === null || _item$_productOrigin11 === void 0 ? void 0 : _item$_productOrigin11.id;
1927
+ })) === null || _item$_productOrigin12 === void 0 ? void 0 : _item$_productOrigin12.id;
1919
1928
  });
1920
1929
  // 保险起见,在这里如果 dateRange 里也有 resources 的话,也 push 进去
1921
1930
  if ((_dateRange = dateRange) !== null && _dateRange !== void 0 && (_dateRange = _dateRange[0]) !== null && _dateRange !== void 0 && (_dateRange = _dateRange.resource) !== null && _dateRange !== void 0 && _dateRange.length) {
@@ -1935,8 +1944,8 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
1935
1944
  var checkDuration = function checkDuration(cartItems) {
1936
1945
  var accountDuration = 0;
1937
1946
  cartItems.forEach(function (item) {
1938
- var _item$_productOrigin$3, _item$_productOrigin12;
1939
- accountDuration += (_item$_productOrigin$3 = (_item$_productOrigin12 = item._productOrigin) === null || _item$_productOrigin12 === void 0 || (_item$_productOrigin12 = _item$_productOrigin12.duration) === null || _item$_productOrigin12 === void 0 ? void 0 : _item$_productOrigin12.value) !== null && _item$_productOrigin$3 !== void 0 ? _item$_productOrigin$3 : 0;
1947
+ var _item$_productOrigin$3, _item$_productOrigin13;
1948
+ accountDuration += (_item$_productOrigin$3 = (_item$_productOrigin13 = item._productOrigin) === null || _item$_productOrigin13 === void 0 || (_item$_productOrigin13 = _item$_productOrigin13.duration) === null || _item$_productOrigin13 === void 0 ? void 0 : _item$_productOrigin13.value) !== null && _item$_productOrigin$3 !== void 0 ? _item$_productOrigin$3 : 0;
1940
1949
  });
1941
1950
  if (accountDuration > duration) {
1942
1951
  duration = accountDuration;
@@ -2006,9 +2015,9 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
2006
2015
  var _newResources$;
2007
2016
  var newResources = cloneDeep(item._origin.resources);
2008
2017
  newResources.forEach(function (resource) {
2009
- var _item$_productOrigin$4, _item$_productOrigin13, _ref11, _item$_productOrigin14;
2018
+ var _item$_productOrigin$4, _item$_productOrigin14, _ref11, _item$_productOrigin15;
2010
2019
  resource.startTime = currentStartTime;
2011
- resource.endTime = dayjs(currentStartTime).add((_item$_productOrigin$4 = (_item$_productOrigin13 = item._productOrigin) === null || _item$_productOrigin13 === void 0 || (_item$_productOrigin13 = _item$_productOrigin13.duration) === null || _item$_productOrigin13 === void 0 ? void 0 : _item$_productOrigin13.value) !== null && _item$_productOrigin$4 !== void 0 ? _item$_productOrigin$4 : 0, (_ref11 = (_item$_productOrigin14 = item._productOrigin) === null || _item$_productOrigin14 === void 0 || (_item$_productOrigin14 = _item$_productOrigin14.duration) === null || _item$_productOrigin14 === void 0 ? void 0 : _item$_productOrigin14.type) !== null && _ref11 !== void 0 ? _ref11 : 'minutes').format('YYYY-MM-DD HH:mm');
2020
+ resource.endTime = dayjs(currentStartTime).add((_item$_productOrigin$4 = (_item$_productOrigin14 = item._productOrigin) === null || _item$_productOrigin14 === void 0 || (_item$_productOrigin14 = _item$_productOrigin14.duration) === null || _item$_productOrigin14 === void 0 ? void 0 : _item$_productOrigin14.value) !== null && _item$_productOrigin$4 !== void 0 ? _item$_productOrigin$4 : 0, (_ref11 = (_item$_productOrigin15 = item._productOrigin) === null || _item$_productOrigin15 === void 0 || (_item$_productOrigin15 = _item$_productOrigin15.duration) === null || _item$_productOrigin15 === void 0 ? void 0 : _item$_productOrigin15.type) !== null && _ref11 !== void 0 ? _ref11 : 'minutes').format('YYYY-MM-DD HH:mm');
2012
2021
  delete resource.times;
2013
2022
  });
2014
2023
  _this10.store.cart.updateItem({
@@ -434,7 +434,7 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
434
434
  productList.forEach(function (item) {
435
435
  if (item.booking_id) {
436
436
  (item.discount_list || []).forEach(function (discount) {
437
- if (discount.id) {
437
+ if (discount.id && discount.type === 'good_pass') {
438
438
  var _discount$discount, _discount$discount2, _discount$discount3;
439
439
  editModeDiscountList.push(_objectSpread(_objectSpread({}, discount), {}, {
440
440
  isEditMode: true,
@@ -441,11 +441,16 @@ var getProductDeposit = (params) => {
441
441
  const { cartItem, product, bundle, options } = params;
442
442
  const num = (params == null ? void 0 : params.num) || 1;
443
443
  if (((_a = product == null ? void 0 : product.custom_deposit_data) == null ? void 0 : _a.has_deposit) == 1) {
444
- const protocols = [];
445
444
  let total = new import_decimal.default(0);
446
- const { deposit_fixed, deposit_percentage, deposit_policy_data } = (product == null ? void 0 : product.custom_deposit_data) || {};
447
- protocols.push(...deposit_policy_data || []);
445
+ const {
446
+ deposit_fixed,
447
+ deposit_percentage,
448
+ deposit_policy_data,
449
+ self_deposit_policy_ids
450
+ } = (product == null ? void 0 : product.custom_deposit_data) || {};
451
+ const allProtocols = deposit_policy_data || [];
448
452
  let productHasDeposit = false;
453
+ const protocolIds = [];
449
454
  if (typeof deposit_fixed === "string" && typeof deposit_percentage === "string") {
450
455
  const { depositTotal, result } = handleProductDeposit({
451
456
  depositData: product == null ? void 0 : product.custom_deposit_data,
@@ -454,17 +459,20 @@ var getProductDeposit = (params) => {
454
459
  });
455
460
  if (result) {
456
461
  total = depositTotal;
462
+ protocolIds.push(...self_deposit_policy_ids || []);
457
463
  productHasDeposit = true;
458
464
  }
459
465
  } else {
460
466
  if (bundle == null ? void 0 : bundle.length) {
461
- total = bundle.reduce((accumulator, currentBundleProduct) => {
467
+ total = bundle.reduce((accumulator, currBundleProduct) => {
468
+ const depositData = currBundleProduct == null ? void 0 : currBundleProduct.custom_deposit_data;
462
469
  const { depositTotal, result } = handleProductDeposit({
463
- depositData: currentBundleProduct == null ? void 0 : currentBundleProduct.custom_deposit_data,
464
- total: currentBundleProduct.price,
465
- num: currentBundleProduct.num
470
+ depositData,
471
+ total: currBundleProduct == null ? void 0 : currBundleProduct.price,
472
+ num: (currBundleProduct == null ? void 0 : currBundleProduct.num) || 1
466
473
  });
467
474
  if (result) {
475
+ protocolIds.push(...(depositData == null ? void 0 : depositData.self_deposit_policy_ids) || []);
468
476
  productHasDeposit = true;
469
477
  return accumulator.plus(depositTotal);
470
478
  }
@@ -473,6 +481,8 @@ var getProductDeposit = (params) => {
473
481
  }
474
482
  }
475
483
  if (productHasDeposit) {
484
+ const ids = new Set(protocolIds);
485
+ const protocols = allProtocols.filter((item) => ids.has(item.id));
476
486
  return { total: total.toNumber(), protocols };
477
487
  }
478
488
  return null;
@@ -44,6 +44,7 @@ export interface Discount {
44
44
  balance: string;
45
45
  format_title: Formattitle;
46
46
  product: Product;
47
+ type: "product" | 'good_pass';
47
48
  resource_id?: number;
48
49
  savedAmount?: number;
49
50
  isEditMode?: boolean;
@@ -168,6 +168,8 @@ export interface ProductData {
168
168
  deposit_fixed?: string;
169
169
  /** 定金百分比 */
170
170
  deposit_percentage?: string;
171
+ /** 关联的定金协议id */
172
+ self_deposit_policy_ids?: number[];
171
173
  /** 定金协议数据 */
172
174
  deposit_policy_data?: Array<{
173
175
  /** 定金协议id */
@@ -25,7 +25,8 @@ export declare class RulesModule extends BaseModule implements Module, RulesModu
25
25
  productList: any[];
26
26
  }, options?: {
27
27
  isSelected?: boolean;
28
- discountId: number;
28
+ discountId?: number;
29
+ scan?: boolean;
29
30
  }): DiscountResult;
30
31
  destroy(): Promise<void>;
31
32
  clear(): Promise<void>;
@@ -65,6 +65,8 @@ var RulesModule = class extends import_BaseModule.BaseModule {
65
65
  const result = this.calcDiscount({
66
66
  discountList: mergedDiscountList,
67
67
  productList: [...productList]
68
+ }, {
69
+ scan: true
68
70
  });
69
71
  let hasApplicableDiscount = false;
70
72
  const newDiscountIds = newDiscountList.map((discount) => discount.id);
@@ -134,7 +136,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
134
136
  var _a, _b, _c;
135
137
  const limitedData = discount == null ? void 0 : discount.limited_relation_product_data;
136
138
  const isLimitedProduct = limitedData.type === "product_all" || limitedData.product_ids && limitedData.product_ids.includes(product.id);
137
- const isAvailableProduct = !((product == null ? void 0 : product.booking_id) && ((_a = product == null ? void 0 : product.discount_list) == null ? void 0 : _a.length) && ((_b = product == null ? void 0 : product.discount_list) == null ? void 0 : _b.every((discount2) => discount2.id)));
139
+ const isAvailableProduct = !((product == null ? void 0 : product.booking_id) && ((_a = product == null ? void 0 : product.discount_list) == null ? void 0 : _a.length) && ((_b = product == null ? void 0 : product.discount_list) == null ? void 0 : _b.every((discount2) => discount2.id && discount2.type === "good_pass")));
138
140
  if (isAvailableProduct && isLimitedProduct) {
139
141
  (_c = discountApplicability.get(discount.id)) == null ? void 0 : _c.push(product.id);
140
142
  const applicableProducts = discountApplicableProducts.get(discount.id) || [];
@@ -154,7 +156,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
154
156
  sortedProductList.forEach((originProduct) => {
155
157
  var _a, _b, _c;
156
158
  const product = this.hooks.getProduct(originProduct);
157
- if ((product == null ? void 0 : product.booking_id) && ((_a = product.discount_list) == null ? void 0 : _a.length) && ((_b = product == null ? void 0 : product.discount_list) == null ? void 0 : _b.every((discount) => discount.id))) {
159
+ if ((product == null ? void 0 : product.booking_id) && ((_a = product.discount_list) == null ? void 0 : _a.length) && ((_b = product == null ? void 0 : product.discount_list) == null ? void 0 : _b.every((discount) => discount.id && discount.type === "good_pass"))) {
158
160
  processedProductsMap.set(product._id, originProduct);
159
161
  return;
160
162
  }
@@ -213,7 +215,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
213
215
  }
214
216
  return;
215
217
  }
216
- if (applicableDiscounts.length && product.booking_id && typeof selectedDiscount.isManualSelect === "undefined") {
218
+ if (applicableDiscounts.length && product.booking_id && typeof selectedDiscount.isManualSelect === "undefined" && !(options == null ? void 0 : options.scan)) {
217
219
  return;
218
220
  }
219
221
  usedDiscounts.set(selectedDiscount.id, true);
@@ -268,7 +270,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
268
270
  const product = this.hooks.getProduct(originProduct);
269
271
  const getDefaultProduct = () => {
270
272
  if (product.isClient) {
271
- this.hooks.setProduct(originProduct, {
273
+ return this.hooks.setProduct(originProduct, {
272
274
  discount_list: [],
273
275
  price: product.price,
274
276
  origin_total: (0, import_utils2.getProductOriginTotalPrice)({
@@ -287,7 +289,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
287
289
  })
288
290
  });
289
291
  } else {
290
- this.hooks.setProduct(originProduct, {
292
+ return this.hooks.setProduct(originProduct, {
291
293
  discount_list: [],
292
294
  total: product.total,
293
295
  origin_total: product.origin_total,
@@ -102,6 +102,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
102
102
  throw new Error(`模块 ${step} 不存在`);
103
103
  }
104
104
  });
105
+ this.loadAllSchedule();
105
106
  this.core.effects.emit(import_types.BookingByStepHooks.onInited, {});
106
107
  }
107
108
  // 初始化step
@@ -214,7 +215,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
214
215
  // 加载当前店铺下所有 schedule
215
216
  async loadAllSchedule() {
216
217
  var _a;
217
- const scheduleList = await this.request.get(`/schedule?num=999`);
218
+ const scheduleList = await this.request.get(`/schedule`, { num: 999 }, { useCache: true });
218
219
  this.store.schedule.setScheduleList(((_a = scheduleList.data) == null ? void 0 : _a.list) || []);
219
220
  }
220
221
  // ui 层提供日期的起始范围,返回一个起始范围内日期的可用情况
@@ -527,69 +528,71 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
527
528
  allOriginResources.push(...n.resource);
528
529
  });
529
530
  }
530
- const cartItems = this.store.cart.getItems();
531
- cartItems.forEach((item) => {
532
- var _a2;
533
- if (item._id !== targetCartItem._id) {
534
- const resources = (_a2 = item._origin.resources) == null ? void 0 : _a2.filter((m) => {
535
- return !targetCartItem._origin.resources.some((targetRes) => {
536
- var _a3, _b, _c;
537
- if (targetRes.resourceType !== "single") {
538
- const formatCapacity = (0, import_resources.formatDefaultCapacitys)({
539
- capacity: (_a3 = item._productOrigin) == null ? void 0 : _a3.capacity,
540
- product_bundle: item._origin.product.product_bundle
541
- });
542
- const currentCapacity = (0, import_resources.getSumCapacity)({ capacity: formatCapacity });
543
- const originResource = allOriginResources.find((n) => n.id === targetRes.id);
544
- if (currentResourcesCapacityMap[targetRes.id] + currentCapacity > (originResource == null ? void 0 : originResource.capacity)) {
545
- return true;
531
+ if (params.resources) {
532
+ const cartItems = this.store.cart.getItems();
533
+ cartItems.forEach((item) => {
534
+ var _a2;
535
+ if (item._id !== targetCartItem._id) {
536
+ const resources = (_a2 = item._origin.resources) == null ? void 0 : _a2.filter((m) => {
537
+ return !targetCartItem._origin.resources.some((targetRes) => {
538
+ var _a3, _b, _c;
539
+ if (targetRes.resourceType !== "single") {
540
+ const formatCapacity = (0, import_resources.formatDefaultCapacitys)({
541
+ capacity: (_a3 = item._productOrigin) == null ? void 0 : _a3.capacity,
542
+ product_bundle: item._origin.product.product_bundle
543
+ });
544
+ const currentCapacity = (0, import_resources.getSumCapacity)({ capacity: formatCapacity });
545
+ const originResource = allOriginResources.find((n) => n.id === targetRes.id);
546
+ if (currentResourcesCapacityMap[targetRes.id] + currentCapacity > (originResource == null ? void 0 : originResource.capacity)) {
547
+ return true;
548
+ }
549
+ currentResourcesCapacityMap[targetRes.id] += currentCapacity;
550
+ return false;
551
+ }
552
+ if (item.holder_id !== (targetCartItem == null ? void 0 : targetCartItem.holder_id)) {
553
+ if (targetRes.id === m.id)
554
+ return true;
555
+ if (((_b = targetRes.metadata.combined_resource) == null ? void 0 : _b.status) === 1 && // 如果现在选择的是组合资源,需要判断
556
+ // 1、当前其他购物车里是否选了当前组合资源的子资源
557
+ // 2、如果其他购物车里的商品也是组合资源,出了组合资源本身的 id 需要判断,还需要判断子资源的 id 是否有交集
558
+ (targetRes.metadata.combined_resource.resource_ids.includes(
559
+ m.id
560
+ ) || targetRes.metadata.combined_resource.resource_ids.some(
561
+ (n) => {
562
+ return m.metadata.combined_resource.resource_ids.includes(
563
+ n
564
+ );
565
+ }
566
+ )))
567
+ return true;
568
+ if (((_c = m.metadata.combined_resource) == null ? void 0 : _c.status) === 1 && m.metadata.combined_resource.resource_ids.includes(targetRes.id))
569
+ return true;
546
570
  }
547
- currentResourcesCapacityMap[targetRes.id] += currentCapacity;
548
571
  return false;
549
- }
550
- if (item.holder_id !== (targetCartItem == null ? void 0 : targetCartItem.holder_id)) {
551
- if (targetRes.id === m.id)
552
- return true;
553
- if (((_b = targetRes.metadata.combined_resource) == null ? void 0 : _b.status) === 1 && // 如果现在选择的是组合资源,需要判断
554
- // 1、当前其他购物车里是否选了当前组合资源的子资源
555
- // 2、如果其他购物车里的商品也是组合资源,出了组合资源本身的 id 需要判断,还需要判断子资源的 id 是否有交集
556
- (targetRes.metadata.combined_resource.resource_ids.includes(
557
- m.id
558
- ) || targetRes.metadata.combined_resource.resource_ids.some(
559
- (n) => {
560
- return m.metadata.combined_resource.resource_ids.includes(
561
- n
562
- );
563
- }
564
- )))
565
- return true;
566
- if (((_c = m.metadata.combined_resource) == null ? void 0 : _c.status) === 1 && m.metadata.combined_resource.resource_ids.includes(targetRes.id))
567
- return true;
568
- }
569
- return false;
570
- });
571
- });
572
- if (item.start_time) {
573
- const start_time = item.start_time;
574
- const end_time = item.end_time;
575
- const start_date = item.start_date;
576
- const end_date = item.end_date;
577
- this.store.cart.updateItem({
578
- _id: item._id,
579
- resources,
580
- date: {
581
- startTime: (0, import_dayjs.default)(`${start_date} ${start_time}`).format("YYYY-MM-DD HH:mm"),
582
- endTime: (0, import_dayjs.default)(`${end_date} ${end_time}`).format("YYYY-MM-DD HH:mm")
583
- }
584
- });
585
- } else {
586
- this.store.cart.updateItem({
587
- _id: item._id,
588
- resources
572
+ });
589
573
  });
574
+ if (item.start_time) {
575
+ const start_time = item.start_time;
576
+ const end_time = item.end_time;
577
+ const start_date = item.start_date;
578
+ const end_date = item.end_date;
579
+ this.store.cart.updateItem({
580
+ _id: item._id,
581
+ resources,
582
+ date: {
583
+ startTime: (0, import_dayjs.default)(`${start_date} ${start_time}`).format("YYYY-MM-DD HH:mm"),
584
+ endTime: (0, import_dayjs.default)(`${end_date} ${end_time}`).format("YYYY-MM-DD HH:mm")
585
+ }
586
+ });
587
+ } else {
588
+ this.store.cart.updateItem({
589
+ _id: item._id,
590
+ resources
591
+ });
592
+ }
590
593
  }
591
- }
592
- });
594
+ });
595
+ }
593
596
  }
594
597
  // 删除购物车里某个商品
595
598
  deleteCart(cartItemId) {
@@ -1114,7 +1117,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1114
1117
  const selectForCartResources = (cartItems2) => {
1115
1118
  let recordTimeSlots = (0, import_lodash_es.cloneDeep)(timeSlots);
1116
1119
  cartItems2.forEach((item, index) => {
1117
- var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
1120
+ var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
1118
1121
  const formatCapacity = (0, import_resources.formatDefaultCapacitys)({
1119
1122
  capacity: (_a2 = item._productOrigin) == null ? void 0 : _a2.capacity,
1120
1123
  product_bundle: item._origin.product.product_bundle
@@ -1130,14 +1133,14 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1130
1133
  }
1131
1134
  if (recordTimeSlots) {
1132
1135
  const currentResourceConfig = (_d = (_c = (_b = item._productOrigin) == null ? void 0 : _b.product_resource) == null ? void 0 : _c.resources) == null ? void 0 : _d.find((n) => n.code === resources_code);
1133
- if (index !== 0 && recordTimeSlots && (currentResourceConfig == null ? void 0 : currentResourceConfig.type) === "single") {
1136
+ if (index !== 0 && recordTimeSlots && (currentResourceConfig == null ? void 0 : currentResourceConfig.type) === "single" && ((_e = item._productOrigin) == null ? void 0 : _e.duration)) {
1134
1137
  let start_at = (0, import_dayjs.default)(recordTimeSlots.end_time).add(
1135
- ((_f = (_e = item._productOrigin) == null ? void 0 : _e.duration) == null ? void 0 : _f.value) ?? 0,
1136
- ((_h = (_g = item._productOrigin) == null ? void 0 : _g.duration) == null ? void 0 : _h.type) ?? "minutes"
1138
+ ((_g = (_f = item._productOrigin) == null ? void 0 : _f.duration) == null ? void 0 : _g.value) ?? 0,
1139
+ ((_i = (_h = item._productOrigin) == null ? void 0 : _h.duration) == null ? void 0 : _i.type) ?? "minutes"
1137
1140
  );
1138
1141
  let end_at = start_at.add(
1139
- ((_j = (_i = item._productOrigin) == null ? void 0 : _i.duration) == null ? void 0 : _j.value) ?? 0,
1140
- ((_l = (_k = item._productOrigin) == null ? void 0 : _k.duration) == null ? void 0 : _l.type) ?? "minutes"
1142
+ ((_k = (_j = item._productOrigin) == null ? void 0 : _j.duration) == null ? void 0 : _k.value) ?? 0,
1143
+ ((_m = (_l = item._productOrigin) == null ? void 0 : _l.duration) == null ? void 0 : _m.type) ?? "minutes"
1141
1144
  );
1142
1145
  recordTimeSlots = {
1143
1146
  start_time: start_at.format("HH:mm"),
@@ -1182,7 +1185,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1182
1185
  const allCartItems = (0, import_lodash_es.cloneDeep)(this.store.cart.getItems());
1183
1186
  let selectedResources = [];
1184
1187
  const resources2 = (0, import_lodash_es.cloneDeep)(
1185
- ((_n = (_m = item._productOrigin) == null ? void 0 : _m.product_resource) == null ? void 0 : _n.resources) || []
1188
+ ((_o = (_n = item._productOrigin) == null ? void 0 : _n.product_resource) == null ? void 0 : _o.resources) || []
1186
1189
  );
1187
1190
  const currentResourcesRenderList = [];
1188
1191
  resources2.forEach((n) => {
@@ -1230,11 +1233,11 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1230
1233
  return recordCount >= currentCapacity;
1231
1234
  });
1232
1235
  });
1233
- const targetRenderList = (_o = productResources.find(
1236
+ const targetRenderList = (_p = productResources.find(
1234
1237
  (n) => n.code === resources_code
1235
- )) == null ? void 0 : _o.renderList;
1238
+ )) == null ? void 0 : _p.renderList;
1236
1239
  if (targetRenderList && targetRenderList.length > 0) {
1237
- if ((_p = item._origin.resources) == null ? void 0 : _p.some(
1240
+ if ((_q = item._origin.resources) == null ? void 0 : _q.some(
1238
1241
  (n) => n.form_id === targetRenderList[0].form_id
1239
1242
  )) {
1240
1243
  return;
@@ -271,7 +271,7 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
271
271
  if (item.booking_id) {
272
272
  (item.discount_list || []).forEach((discount) => {
273
273
  var _a2, _b, _c;
274
- if (discount.id) {
274
+ if (discount.id && discount.type === "good_pass") {
275
275
  editModeDiscountList.push({
276
276
  ...discount,
277
277
  isEditMode: true,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "3.0.18",
4
+ "version": "3.0.19",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",