@pisell/pisellos 2.1.95 → 2.1.97

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.
@@ -27,6 +27,7 @@ export declare class RulesModule extends BaseModule implements Module, RulesModu
27
27
  productList: any[];
28
28
  unavailableReason?: UnavailableReason;
29
29
  };
30
+ filterDiscountListByType(discountList: Discount[], type: string): Discount[];
30
31
  private getUnavailableReason;
31
32
  calcDiscount({ discountList, productList, holders, isFormSubject, }: {
32
33
  discountList: Discount[];
@@ -201,6 +201,13 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
201
201
  unavailableReason: unavailableReason
202
202
  };
203
203
  }
204
+ }, {
205
+ key: "filterDiscountListByType",
206
+ value: function filterDiscountListByType(discountList, type) {
207
+ return (discountList || []).filter(function (item) {
208
+ return item.type === type || item.tag === type;
209
+ });
210
+ }
204
211
 
205
212
  // 获取券不可用的原因
206
213
  }, {
@@ -1048,26 +1055,34 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
1048
1055
  }),
1049
1056
  price: product.price
1050
1057
  }), {}, {
1051
- discount_list: []
1058
+ discount_list: _this3.filterDiscountListByType(product.discount_list, 'promotion')
1052
1059
  }))]);
1053
1060
  } else {
1054
- var _product$main_product, _product$main_product2;
1061
+ var _ref8, _product$_promotion$f, _product13, _product$origin_total, _product$main_product, _product$main_product2;
1062
+ var total = product.inPromotion ? (_ref8 = (_product$_promotion$f = (_product13 = product) === null || _product13 === void 0 || (_product13 = _product13._promotion) === null || _product13 === void 0 ? void 0 : _product13.finalPrice) !== null && _product$_promotion$f !== void 0 ? _product$_promotion$f : product.origin_total) !== null && _ref8 !== void 0 ? _ref8 : product.total : (_product$origin_total = product.origin_total) !== null && _product$origin_total !== void 0 ? _product$origin_total : product.total;
1063
+ if ((product.discount_list || []).some(function (item) {
1064
+ return item.type === 'promotion';
1065
+ })) {
1066
+ var _product$total;
1067
+ total = (_product$total = product.total) !== null && _product$total !== void 0 ? _product$total : product.origin_total;
1068
+ }
1055
1069
  processedProductsMap.set(product._id, [_this3.hooks.setProduct(originProduct, _objectSpread(_objectSpread({}, isManualDiscount ? {
1056
1070
  price: product.price,
1057
1071
  main_product_selling_price: (_product$main_product = product.main_product_selling_price) !== null && _product$main_product !== void 0 ? _product$main_product : product.price
1058
1072
  } : {
1059
1073
  _id: product._id.split('___')[0] + '___' + index,
1060
- total: product.origin_total || product.total,
1074
+ total: total,
1061
1075
  price: product.price,
1062
1076
  main_product_selling_price: (_product$main_product2 = product.main_product_selling_price) !== null && _product$main_product2 !== void 0 ? _product$main_product2 : product.price
1063
1077
  }), {}, {
1064
- discount_list: []
1078
+ discount_list: _this3.filterDiscountListByType(product.discount_list, 'promotion')
1065
1079
  }))]);
1066
1080
  }
1067
1081
  } else {
1082
+ var _flatItem$bundleItem8;
1068
1083
  // bundle子商品:保存到扁平化Map
1069
1084
  processedFlatItemsMap.set(flatItem._id, [_objectSpread(_objectSpread({}, flatItem), {}, {
1070
- discount_list: [],
1085
+ discount_list: _this3.filterDiscountListByType(((_flatItem$bundleItem8 = flatItem.bundleItem) === null || _flatItem$bundleItem8 === void 0 ? void 0 : _flatItem$bundleItem8.discount_list) || [], 'promotion'),
1071
1086
  price: isManualDiscount ? flatItem.bundleItem.price : flatItem.bundleItem.original_price,
1072
1087
  processed: true
1073
1088
  })]);
@@ -1094,13 +1109,13 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
1094
1109
  // 主商品:保持原有逻辑
1095
1110
  if (splitCount < totalQuantity && isNeedSplit) {
1096
1111
  arr.push(_this3.hooks.setProduct(originProduct, {
1097
- discount_list: [],
1112
+ discount_list: _this3.filterDiscountListByType(product.discount_list, 'promotion'),
1098
1113
  quantity: totalQuantity - splitCount,
1099
1114
  _id: product._id.split('___')[0]
1100
1115
  }));
1101
1116
  }
1102
1117
  for (var i = 0; i < splitCount; i++) {
1103
- var _product$discount_lis10, _originProduct, _selectedDiscount$met, _selectedDiscount$met2;
1118
+ var _originProduct, _selectedDiscount$met, _selectedDiscount$met2;
1104
1119
  // 如果用过折扣卡,也就不存在拆分的情况了,这里直接使用上面计算出来的折扣卡
1105
1120
  var _selectedDiscount = selectedDiscountCard || applicableDiscounts[i];
1106
1121
  // 标记优惠券为已使用
@@ -1112,7 +1127,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
1112
1127
  // 优先从 origin_total拿,可能会拿不到(比如用户端预约在没有配置 original_price 的情况下)
1113
1128
  var productOriginTotal = product.origin_total || product.total || 0;
1114
1129
  // 如果当前 product 有 discount_list,则先从 origin_total 拿
1115
- if ((_product$discount_lis10 = product.discount_list) !== null && _product$discount_lis10 !== void 0 && _product$discount_lis10.length && product.origin_total) {
1130
+ if (_this3.filterDiscountListByType(product.discount_list, 'promotion').length && product.origin_total) {
1116
1131
  productOriginTotal = product.origin_total;
1117
1132
  }
1118
1133
  // 如果originProduct?._productInit?.original_price为 0,product.origin_total可能为空,此时取 product.total
@@ -1164,19 +1179,18 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
1164
1179
  };
1165
1180
  appliedProducts.push(discountDetail);
1166
1181
  appliedDiscountProducts.set(_selectedDiscount.id, appliedProducts);
1167
- var total = targetProductTotal;
1182
+ var _total = targetProductTotal;
1168
1183
  if (product.options) {
1169
- total = product.options.reduce(function (accumulator, currentValue) {
1184
+ _total = product.options.reduce(function (accumulator, currentValue) {
1170
1185
  var currentPrice = new Decimal(currentValue.price || 0);
1171
1186
  var currentNum = new Decimal(currentValue.num || 0);
1172
1187
  return accumulator.add(currentPrice.mul(currentNum));
1173
- }, new Decimal(total)).toNumber();
1188
+ }, new Decimal(_total)).toNumber();
1174
1189
  }
1175
1190
 
1176
1191
  // 记录应用了优惠券的商品
1177
1192
  // 后续更新价格改为 getProductTotalPrice getProductOriginTotalPrice逻辑
1178
1193
  if (product.isClient) {
1179
- debugger;
1180
1194
  arr.push(_this3.hooks.setProduct(originProduct, {
1181
1195
  discount_list: [discountDetail],
1182
1196
  price: _selectedDiscount.tag === 'good_pass' ? 0 : product.price,
@@ -1190,15 +1204,15 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
1190
1204
  }),
1191
1205
  variant: originProduct._productInit.variant,
1192
1206
  original_price: new Decimal(product.price || 0).toNumber(),
1193
- total: total
1207
+ total: _total
1194
1208
  }));
1195
1209
  } else {
1196
1210
  arr.push(_this3.hooks.setProduct(originProduct, {
1197
- discount_list: [discountDetail],
1211
+ discount_list: _this3.filterDiscountListByType(product.discount_list, 'promotion').concat([discountDetail]),
1198
1212
  _id: product._id.split('___')[0] + "___" + _selectedDiscount.id + index,
1199
1213
  price: _selectedDiscount.tag === 'good_pass' ? 0 : product.price,
1200
1214
  quantity: isNeedSplit ? 1 : product.quantity,
1201
- total: total,
1215
+ total: _total,
1202
1216
  origin_total: productOriginTotal,
1203
1217
  main_product_selling_price: targetProductTotal
1204
1218
  }));
@@ -1253,7 +1267,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
1253
1267
  price: 0,
1254
1268
  // 商品券价格为0
1255
1269
  total: 0,
1256
- discount_list: [_discountDetail],
1270
+ discount_list: _this3.filterDiscountListByType(flatItem.discount_list, 'promotion').concat([_discountDetail]),
1257
1271
  processed: true,
1258
1272
  _discountId: _selectedDiscount2.id
1259
1273
  }));
@@ -1266,7 +1280,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
1266
1280
  _id: "".concat(flatItem._id, "_split_rest"),
1267
1281
  num: normalNum,
1268
1282
  quantity: normalNum,
1269
- discount_list: [],
1283
+ discount_list: _this3.filterDiscountListByType(flatItem.discount_list, 'promotion'),
1270
1284
  processed: true
1271
1285
  }));
1272
1286
  }
@@ -1294,7 +1308,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
1294
1308
  _targetProductTotal = getDiscountAmount(_selectedDiscount3, _productOriginTotal, _productOriginTotal);
1295
1309
  fixedAmountPerItem = new Decimal(_productOriginTotal).minus(_targetProductTotal).toNumber();
1296
1310
  }
1297
- debugger;
1311
+
1298
1312
  // 🔥 使用当前的 _id 作为唯一标识
1299
1313
  var _uniqueId = flatItem._id;
1300
1314
  var _discountDetail2 = {
@@ -1328,7 +1342,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
1328
1342
  processedItems.push(_objectSpread(_objectSpread({}, flatItem), {}, {
1329
1343
  total: _targetProductTotal,
1330
1344
  price: new Decimal(_productOriginTotal || 0).minus(fixedAmountPerItem).toNumber(),
1331
- discount_list: [_discountDetail2],
1345
+ discount_list: _this3.filterDiscountListByType(flatItem.discount_list, 'promotion').concat([_discountDetail2]),
1332
1346
  processed: true
1333
1347
  }));
1334
1348
  }
@@ -1349,7 +1363,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
1349
1363
  var getDefaultProduct = function getDefaultProduct() {
1350
1364
  if (product.isClient) {
1351
1365
  return _this3.hooks.setProduct(originProduct, {
1352
- discount_list: [],
1366
+ discount_list: _this3.filterDiscountListByType(product.discount_list, 'promotion'),
1353
1367
  price: product.price,
1354
1368
  origin_total: getProductOriginTotalPrice({
1355
1369
  product: {
@@ -1370,7 +1384,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
1370
1384
  });
1371
1385
  } else {
1372
1386
  return _this3.hooks.setProduct(originProduct, {
1373
- discount_list: [],
1387
+ discount_list: _this3.filterDiscountListByType(product.discount_list, 'promotion'),
1374
1388
  total: product.total,
1375
1389
  origin_total: product.origin_total,
1376
1390
  price: product.price
@@ -1830,10 +1844,10 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
1830
1844
  return true; // 单独购买时可用
1831
1845
  }
1832
1846
  if (isBundleItem) {
1833
- var _flatItem$bundleItem8, _flatItem$bundleItem9;
1847
+ var _flatItem$bundleItem9, _flatItem$bundleItem10;
1834
1848
  // 套餐中购买时,判断是否为原价
1835
- var priceType = (_flatItem$bundleItem8 = flatItem.bundleItem) === null || _flatItem$bundleItem8 === void 0 ? void 0 : _flatItem$bundleItem8.price_type;
1836
- var priceTypeExt = (_flatItem$bundleItem9 = flatItem.bundleItem) === null || _flatItem$bundleItem9 === void 0 ? void 0 : _flatItem$bundleItem9.price_type_ext;
1849
+ var priceType = (_flatItem$bundleItem9 = flatItem.bundleItem) === null || _flatItem$bundleItem9 === void 0 ? void 0 : _flatItem$bundleItem9.price_type;
1850
+ var priceTypeExt = (_flatItem$bundleItem10 = flatItem.bundleItem) === null || _flatItem$bundleItem10 === void 0 ? void 0 : _flatItem$bundleItem10.price_type_ext;
1837
1851
  // original_price 对应:
1838
1852
  // 1. price_type: "markup" && price_type_ext: "product_price"
1839
1853
  // markup_price 对应:
@@ -1871,10 +1885,10 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
1871
1885
  return false; // 单独购买时不可用
1872
1886
  }
1873
1887
  if (isBundleItem) {
1874
- var _flatItem$bundleItem10, _flatItem$bundleItem11;
1888
+ var _flatItem$bundleItem11, _flatItem$bundleItem12;
1875
1889
  // 套餐中购买时,判断是否为原价
1876
- var _priceType = (_flatItem$bundleItem10 = flatItem.bundleItem) === null || _flatItem$bundleItem10 === void 0 ? void 0 : _flatItem$bundleItem10.price_type;
1877
- var _priceTypeExt = (_flatItem$bundleItem11 = flatItem.bundleItem) === null || _flatItem$bundleItem11 === void 0 ? void 0 : _flatItem$bundleItem11.price_type_ext;
1890
+ var _priceType = (_flatItem$bundleItem11 = flatItem.bundleItem) === null || _flatItem$bundleItem11 === void 0 ? void 0 : _flatItem$bundleItem11.price_type;
1891
+ var _priceTypeExt = (_flatItem$bundleItem12 = flatItem.bundleItem) === null || _flatItem$bundleItem12 === void 0 ? void 0 : _flatItem$bundleItem12.price_type_ext;
1878
1892
 
1879
1893
  // original_price 对应:
1880
1894
  // 1. price_type: "markup" && price_type_ext: "product_price"
@@ -205,7 +205,7 @@ export var ScheduleModule = /*#__PURE__*/function (_BaseModule) {
205
205
  }, {
206
206
  key: "getScheduleListByIds",
207
207
  value: function getScheduleListByIds(ids) {
208
- return this.store.scheduleList.filter(function (n) {
208
+ return (this.store.scheduleList || []).filter(function (n) {
209
209
  return ids.includes(n.id);
210
210
  });
211
211
  }
@@ -120,7 +120,7 @@ export var SummaryModule = /*#__PURE__*/function (_BaseModule) {
120
120
  case 0:
121
121
  shopInfo = ((_this$shopStore$get = this.shopStore.get('core')) === null || _this$shopStore$get === void 0 || (_this$shopStore$get = _this$shopStore$get.core) === null || _this$shopStore$get === void 0 ? void 0 : _this$shopStore$get.shop) || {};
122
122
  scheduleModule = this.core.getModule('appointmentBooking_schedule');
123
- needScheduleIds = this.store.surchargeList.map(function (item) {
123
+ needScheduleIds = (this.store.surchargeList || []).map(function (item) {
124
124
  return item.available_schedule_ids;
125
125
  }).flat();
126
126
  scheduleList = scheduleModule === null || scheduleModule === void 0 ? void 0 : scheduleModule.getScheduleListByIds(needScheduleIds);
@@ -210,7 +210,7 @@ export var SummaryModule = /*#__PURE__*/function (_BaseModule) {
210
210
  value: function getSurchargeforUtils(items) {
211
211
  // const surchargeList = this.store.surchargeList;
212
212
  var scheduleModule = this.core.getModule('appointmentBooking_schedule');
213
- var needScheduleIds = this.store.surchargeList.map(function (item) {
213
+ var needScheduleIds = (this.store.surchargeList || []).map(function (item) {
214
214
  return item.available_schedule_ids;
215
215
  }).flat();
216
216
  var scheduleList = scheduleModule === null || scheduleModule === void 0 ? void 0 : scheduleModule.getScheduleListByIds(needScheduleIds);
@@ -115,7 +115,7 @@ export declare class BookingTicketImpl extends BaseModule implements Module {
115
115
  * 获取当前的客户搜索条件
116
116
  * @returns 当前搜索条件
117
117
  */
118
- getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
118
+ getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
119
119
  /**
120
120
  * 获取客户列表状态(包含滚动加载相关状态)
121
121
  * @returns 客户状态
@@ -27,6 +27,7 @@ export declare class RulesModule extends BaseModule implements Module, RulesModu
27
27
  productList: any[];
28
28
  unavailableReason?: UnavailableReason;
29
29
  };
30
+ filterDiscountListByType(discountList: Discount[], type: string): Discount[];
30
31
  private getUnavailableReason;
31
32
  calcDiscount({ discountList, productList, holders, isFormSubject, }: {
32
33
  discountList: Discount[];
@@ -144,6 +144,9 @@ var RulesModule = class extends import_BaseModule.BaseModule {
144
144
  unavailableReason
145
145
  };
146
146
  }
147
+ filterDiscountListByType(discountList, type) {
148
+ return (discountList || []).filter((item) => item.type === type || item.tag === type);
149
+ }
147
150
  // 获取券不可用的原因
148
151
  getUnavailableReason(discountList, productList) {
149
152
  var _a;
@@ -567,7 +570,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
567
570
  });
568
571
  const processedFlatItemsMap = /* @__PURE__ */ new Map();
569
572
  sortedFlattenedList.forEach((flatItem, index) => {
570
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B;
573
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C;
571
574
  let product, originProduct;
572
575
  if (flatItem.type === "main") {
573
576
  product = flatItem.product;
@@ -730,10 +733,14 @@ var RulesModule = class extends import_BaseModule.BaseModule {
730
733
  }),
731
734
  price: product.price
732
735
  },
733
- discount_list: []
736
+ discount_list: this.filterDiscountListByType(product.discount_list, "promotion")
734
737
  })]
735
738
  );
736
739
  } else {
740
+ let total = product.inPromotion ? ((_u = product == null ? void 0 : product._promotion) == null ? void 0 : _u.finalPrice) ?? product.origin_total ?? product.total : product.origin_total ?? product.total;
741
+ if ((product.discount_list || []).some((item) => item.type === "promotion")) {
742
+ total = product.total ?? product.origin_total;
743
+ }
737
744
  processedProductsMap.set(
738
745
  product._id,
739
746
  [this.hooks.setProduct(originProduct, {
@@ -742,18 +749,18 @@ var RulesModule = class extends import_BaseModule.BaseModule {
742
749
  main_product_selling_price: product.main_product_selling_price ?? product.price
743
750
  } : {
744
751
  _id: product._id.split("___")[0] + "___" + index,
745
- total: product.origin_total || product.total,
752
+ total,
746
753
  price: product.price,
747
754
  main_product_selling_price: product.main_product_selling_price ?? product.price
748
755
  },
749
- discount_list: []
756
+ discount_list: this.filterDiscountListByType(product.discount_list, "promotion")
750
757
  })]
751
758
  );
752
759
  }
753
760
  } else {
754
761
  processedFlatItemsMap.set(flatItem._id, [{
755
762
  ...flatItem,
756
- discount_list: [],
763
+ discount_list: this.filterDiscountListByType(((_v = flatItem.bundleItem) == null ? void 0 : _v.discount_list) || [], "promotion"),
757
764
  price: isManualDiscount ? flatItem.bundleItem.price : flatItem.bundleItem.original_price,
758
765
  processed: true
759
766
  }]);
@@ -771,7 +778,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
771
778
  if (flatItem.type === "main") {
772
779
  if (splitCount < totalQuantity && isNeedSplit) {
773
780
  arr.push(this.hooks.setProduct(originProduct, {
774
- discount_list: [],
781
+ discount_list: this.filterDiscountListByType(product.discount_list, "promotion"),
775
782
  quantity: totalQuantity - splitCount,
776
783
  _id: product._id.split("___")[0]
777
784
  }));
@@ -781,10 +788,10 @@ var RulesModule = class extends import_BaseModule.BaseModule {
781
788
  usedDiscounts.set(selectedDiscount2.id, true);
782
789
  const appliedProducts = appliedDiscountProducts.get(selectedDiscount2.id) || [];
783
790
  let productOriginTotal = product.origin_total || product.total || 0;
784
- if (((_u = product.discount_list) == null ? void 0 : _u.length) && product.origin_total) {
791
+ if (this.filterDiscountListByType(product.discount_list, "promotion").length && product.origin_total) {
785
792
  productOriginTotal = product.origin_total;
786
793
  }
787
- if (Number(((_v = originProduct == null ? void 0 : originProduct._productInit) == null ? void 0 : _v.original_price) || 0) > 0 && product.origin_total && product.total && product.origin_total !== product.total) {
794
+ if (Number(((_w = originProduct == null ? void 0 : originProduct._productInit) == null ? void 0 : _w.original_price) || 0) > 0 && product.origin_total && product.total && product.origin_total !== product.total) {
788
795
  productOriginTotal = product.total;
789
796
  }
790
797
  const isOrderLevel = (0, import_utils.isOrderLevelFixedAmountDiscount)(selectedDiscount2);
@@ -807,9 +814,9 @@ var RulesModule = class extends import_BaseModule.BaseModule {
807
814
  amount,
808
815
  type: selectedDiscount2.tag === "product_discount_card" ? "discount_card" : discountType,
809
816
  discount: {
810
- discount_card_type: (_w = selectedDiscount2 == null ? void 0 : selectedDiscount2.metadata) == null ? void 0 : _w.discount_card_type,
817
+ discount_card_type: (_x = selectedDiscount2 == null ? void 0 : selectedDiscount2.metadata) == null ? void 0 : _x.discount_card_type,
811
818
  fixed_amount: amount,
812
- discount_calculation_mode: (_x = selectedDiscount2 == null ? void 0 : selectedDiscount2.metadata) == null ? void 0 : _x.discount_calculation_mode,
819
+ discount_calculation_mode: (_y = selectedDiscount2 == null ? void 0 : selectedDiscount2.metadata) == null ? void 0 : _y.discount_calculation_mode,
813
820
  resource_id: selectedDiscount2.id,
814
821
  title: selectedDiscount2.format_title,
815
822
  original_amount: product.price,
@@ -836,7 +843,6 @@ var RulesModule = class extends import_BaseModule.BaseModule {
836
843
  }, new import_decimal.default(total)).toNumber();
837
844
  }
838
845
  if (product.isClient) {
839
- debugger;
840
846
  arr.push(this.hooks.setProduct(originProduct, {
841
847
  discount_list: [discountDetail],
842
848
  price: selectedDiscount2.tag === "good_pass" ? 0 : product.price,
@@ -854,7 +860,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
854
860
  }));
855
861
  } else {
856
862
  arr.push(this.hooks.setProduct(originProduct, {
857
- discount_list: [discountDetail],
863
+ discount_list: this.filterDiscountListByType(product.discount_list, "promotion").concat([discountDetail]),
858
864
  _id: product._id.split("___")[0] + "___" + selectedDiscount2.id + index,
859
865
  price: selectedDiscount2.tag === "good_pass" ? 0 : product.price,
860
866
  quantity: isNeedSplit ? 1 : product.quantity,
@@ -879,7 +885,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
879
885
  type: "good_pass",
880
886
  discount: {
881
887
  fixed_amount: product.origin_total,
882
- discount_calculation_mode: (_y = selectedDiscount2 == null ? void 0 : selectedDiscount2.metadata) == null ? void 0 : _y.discount_calculation_mode,
888
+ discount_calculation_mode: (_z = selectedDiscount2 == null ? void 0 : selectedDiscount2.metadata) == null ? void 0 : _z.discount_calculation_mode,
883
889
  resource_id: selectedDiscount2.id,
884
890
  title: selectedDiscount2.format_title,
885
891
  original_amount: product.origin_total,
@@ -905,7 +911,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
905
911
  price: 0,
906
912
  // 商品券价格为0
907
913
  total: 0,
908
- discount_list: [discountDetail],
914
+ discount_list: this.filterDiscountListByType(flatItem.discount_list, "promotion").concat([discountDetail]),
909
915
  processed: true,
910
916
  _discountId: selectedDiscount2.id
911
917
  });
@@ -917,7 +923,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
917
923
  _id: `${flatItem._id}_split_rest`,
918
924
  num: normalNum,
919
925
  quantity: normalNum,
920
- discount_list: [],
926
+ discount_list: this.filterDiscountListByType(flatItem.discount_list, "promotion"),
921
927
  processed: true
922
928
  });
923
929
  }
@@ -943,15 +949,14 @@ var RulesModule = class extends import_BaseModule.BaseModule {
943
949
  );
944
950
  fixedAmountPerItem = new import_decimal.default(productOriginTotal).minus(targetProductTotal).toNumber();
945
951
  }
946
- debugger;
947
952
  const uniqueId = flatItem._id;
948
953
  const discountDetail = {
949
954
  amount: fixedAmountPerItem * (product.num || 1),
950
955
  type: selectedDiscount2.tag === "product_discount_card" ? "discount_card" : selectedDiscount2.tag,
951
956
  discount: {
952
- discount_card_type: (_z = selectedDiscount2 == null ? void 0 : selectedDiscount2.metadata) == null ? void 0 : _z.discount_card_type,
957
+ discount_card_type: (_A = selectedDiscount2 == null ? void 0 : selectedDiscount2.metadata) == null ? void 0 : _A.discount_card_type,
953
958
  fixed_amount: fixedAmountPerItem,
954
- discount_calculation_mode: (_A = selectedDiscount2 == null ? void 0 : selectedDiscount2.metadata) == null ? void 0 : _A.discount_calculation_mode,
959
+ discount_calculation_mode: (_B = selectedDiscount2 == null ? void 0 : selectedDiscount2.metadata) == null ? void 0 : _B.discount_calculation_mode,
955
960
  resource_id: selectedDiscount2.id,
956
961
  title: selectedDiscount2.format_title,
957
962
  original_amount: product.original_price,
@@ -966,7 +971,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
966
971
  // 🔥 order_level 分摊差值
967
972
  ...productDiscountDifference !== void 0 && { product_discount_difference: productDiscountDifference }
968
973
  },
969
- _num: (product.num || 1) * (((_B = flatItem == null ? void 0 : flatItem.parentProduct) == null ? void 0 : _B.num) || 1)
974
+ _num: (product.num || 1) * (((_C = flatItem == null ? void 0 : flatItem.parentProduct) == null ? void 0 : _C.num) || 1)
970
975
  };
971
976
  const appliedProducts = appliedDiscountProducts.get(selectedDiscount2.id) || [];
972
977
  appliedProducts.push(discountDetail);
@@ -975,7 +980,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
975
980
  ...flatItem,
976
981
  total: targetProductTotal,
977
982
  price: new import_decimal.default(productOriginTotal || 0).minus(fixedAmountPerItem).toNumber(),
978
- discount_list: [discountDetail],
983
+ discount_list: this.filterDiscountListByType(flatItem.discount_list, "promotion").concat([discountDetail]),
979
984
  processed: true
980
985
  });
981
986
  }
@@ -991,7 +996,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
991
996
  const getDefaultProduct = () => {
992
997
  if (product.isClient) {
993
998
  return this.hooks.setProduct(originProduct, {
994
- discount_list: [],
999
+ discount_list: this.filterDiscountListByType(product.discount_list, "promotion"),
995
1000
  price: product.price,
996
1001
  origin_total: (0, import_utils2.getProductOriginTotalPrice)({
997
1002
  product: {
@@ -1012,7 +1017,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
1012
1017
  });
1013
1018
  } else {
1014
1019
  return this.hooks.setProduct(originProduct, {
1015
- discount_list: [],
1020
+ discount_list: this.filterDiscountListByType(product.discount_list, "promotion"),
1016
1021
  total: product.total,
1017
1022
  origin_total: product.origin_total,
1018
1023
  price: product.price
@@ -135,7 +135,7 @@ var ScheduleModule = class extends import_BaseModule.BaseModule {
135
135
  return dates;
136
136
  }
137
137
  getScheduleListByIds(ids) {
138
- return this.store.scheduleList.filter((n) => ids.includes(n.id));
138
+ return (this.store.scheduleList || []).filter((n) => ids.includes(n.id));
139
139
  }
140
140
  setAvailabilityScheduleDateList(list) {
141
141
  this.store.availabilityDateList = list;
@@ -77,7 +77,7 @@ var SummaryModule = class extends import_BaseModule.BaseModule {
77
77
  var _a, _b, _c;
78
78
  const shopInfo = ((_b = (_a = this.shopStore.get("core")) == null ? void 0 : _a.core) == null ? void 0 : _b.shop) || {};
79
79
  const scheduleModule = this.core.getModule("appointmentBooking_schedule");
80
- const needScheduleIds = this.store.surchargeList.map((item) => item.available_schedule_ids).flat();
80
+ const needScheduleIds = (this.store.surchargeList || []).map((item) => item.available_schedule_ids).flat();
81
81
  const scheduleList = scheduleModule == null ? void 0 : scheduleModule.getScheduleListByIds(needScheduleIds);
82
82
  const scheduleById = {};
83
83
  if (Array.isArray(scheduleList)) {
@@ -120,7 +120,7 @@ var SummaryModule = class extends import_BaseModule.BaseModule {
120
120
  }
121
121
  getSurchargeforUtils(items) {
122
122
  const scheduleModule = this.core.getModule("appointmentBooking_schedule");
123
- const needScheduleIds = this.store.surchargeList.map((item) => item.available_schedule_ids).flat();
123
+ const needScheduleIds = (this.store.surchargeList || []).map((item) => item.available_schedule_ids).flat();
124
124
  const scheduleList = scheduleModule == null ? void 0 : scheduleModule.getScheduleListByIds(needScheduleIds);
125
125
  const scheduleById = {};
126
126
  if (Array.isArray(scheduleList)) {
@@ -115,7 +115,7 @@ export declare class BookingTicketImpl extends BaseModule implements Module {
115
115
  * 获取当前的客户搜索条件
116
116
  * @returns 当前搜索条件
117
117
  */
118
- getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
118
+ getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
119
119
  /**
120
120
  * 获取客户列表状态(包含滚动加载相关状态)
121
121
  * @returns 客户状态
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "2.1.95",
4
+ "version": "2.1.97",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",