@pisell/pisellos 0.0.411 → 0.0.413

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.
@@ -49,5 +49,5 @@ export declare class Product extends BaseModule implements Module {
49
49
  getCategories(): ProductCategory[];
50
50
  setOtherParams(key: string, value: any): void;
51
51
  getOtherParams(): any;
52
- getProductType(): "normal" | "duration" | "session";
52
+ getProductType(): "duration" | "session" | "normal";
53
53
  }
@@ -675,7 +675,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
675
675
  // 收集该折扣卡适用的商品(排除被其他专属折扣卡占用的商品)
676
676
  var applicableProducts = [];
677
677
  sortedFlattenedList.forEach(function (flatItem) {
678
- var _flatItem$parentProdu2;
678
+ var _flatItem$parentProdu2, _product$price, _ref5, _flatItem$original_pr;
679
679
  // 🔥 检查该商品是否被其他专属折扣卡占用
680
680
  var occupyingDiscountId = occupiedItems.get(flatItem._id);
681
681
  if (occupyingDiscountId !== undefined && occupyingDiscountId !== discount.id) {
@@ -701,10 +701,14 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
701
701
  // 对于 bundle 子商品,quantity 需要乘以主商品的购买数量
702
702
  var quantity = flatItem.type === 'main' ? product.quantity || 1 : (product.num || 1) * (((_flatItem$parentProdu2 = flatItem.parentProduct) === null || _flatItem$parentProdu2 === void 0 ? void 0 : _flatItem$parentProdu2.quantity) || 1);
703
703
 
704
+ // 对于主商品:使用 price
705
+ // 对于子商品:优先使用 flatItem.original_price,否则使用 flatItem.price
706
+ var originalAmount = flatItem.type === 'main' ? Number((_product$price = product.price) !== null && _product$price !== void 0 ? _product$price : 0) : Number((_ref5 = (_flatItem$original_pr = flatItem.original_price) !== null && _flatItem$original_pr !== void 0 ? _flatItem$original_pr : flatItem.price) !== null && _ref5 !== void 0 ? _ref5 : 0);
707
+
704
708
  // 传递 parentQuantity 用于差值处理时判断是否是真正的"数量为1"
705
709
  var productData = {
706
710
  productId: flatItem._id,
707
- amount: Number(product.price || 0),
711
+ amount: originalAmount,
708
712
  quantity: quantity
709
713
  };
710
714
 
@@ -947,8 +951,8 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
947
951
  var _product$discount_lis5, _product11, _product11$every;
948
952
  // 主商品:判断自身是否手动折扣
949
953
  isManualDiscount = typeof product.isManualDiscount === 'boolean' ? product.isManualDiscount : product.total != product.origin_total && (product.bundle || []).every(function (item) {
950
- var _ref5;
951
- return !((_ref5 = item.discount_list || []) !== null && _ref5 !== void 0 && _ref5.length);
954
+ var _ref6;
955
+ return !((_ref6 = item.discount_list || []) !== null && _ref6 !== void 0 && _ref6.length);
952
956
  }) && (!((_product$discount_lis5 = product.discount_list) !== null && _product$discount_lis5 !== void 0 && _product$discount_lis5.length) || ((_product11 = product) === null || _product11 === void 0 || (_product11 = _product11.discount_list) === null || _product11 === void 0 || (_product11$every = _product11.every) === null || _product11$every === void 0 ? void 0 : _product11$every.call(_product11, function (item) {
953
957
  return item.type === 'product';
954
958
  })));
@@ -958,8 +962,8 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
958
962
  if (parentProduct) {
959
963
  var _parentProduct$discou, _parentProduct$discou2, _parentProduct$discou3;
960
964
  isManualDiscount = typeof parentProduct.isManualDiscount === 'boolean' ? parentProduct.isManualDiscount : parentProduct.total != parentProduct.origin_total && (parentProduct.bundle || []).every(function (item) {
961
- var _ref6;
962
- return !((_ref6 = item.discount_list || []) !== null && _ref6 !== void 0 && _ref6.length);
965
+ var _ref7;
966
+ return !((_ref7 = item.discount_list || []) !== null && _ref7 !== void 0 && _ref7.length);
963
967
  }) && (!((_parentProduct$discou = parentProduct.discount_list) !== null && _parentProduct$discou !== void 0 && _parentProduct$discou.length) || (parentProduct === null || parentProduct === void 0 || (_parentProduct$discou2 = parentProduct.discount_list) === null || _parentProduct$discou2 === void 0 || (_parentProduct$discou3 = _parentProduct$discou2.every) === null || _parentProduct$discou3 === void 0 ? void 0 : _parentProduct$discou3.call(_parentProduct$discou2, function (item) {
964
968
  return item.type === 'product';
965
969
  })));
@@ -919,8 +919,9 @@ export var getSurcharge = function getSurcharge(_ref10, options) {
919
919
  mainQuantity: mainQuantity // 主商品的mainQuantity等于自己的quantity
920
920
  });
921
921
  }
922
+ var arr = (item === null || item === void 0 ? void 0 : item.bundle) || (item === null || item === void 0 ? void 0 : item.bundles) || [];
922
923
  // 遍历子商品 原价商品符合附加费条件
923
- var _iterator6 = _createForOfIteratorHelper((item === null || item === void 0 ? void 0 : item.bundle) || []),
924
+ var _iterator6 = _createForOfIteratorHelper(arr),
924
925
  _step6;
925
926
  try {
926
927
  for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
@@ -1169,7 +1170,8 @@ function resetItemsSurchargeSideEffects(_ref12) {
1169
1170
  for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
1170
1171
  var item = _step10.value;
1171
1172
  resetItem(item);
1172
- var _iterator11 = _createForOfIteratorHelper((item === null || item === void 0 ? void 0 : item.bundle) || []),
1173
+ var arr = (item === null || item === void 0 ? void 0 : item.bundle) || (item === null || item === void 0 ? void 0 : item.bundles) || [];
1174
+ var _iterator11 = _createForOfIteratorHelper(arr),
1173
1175
  _step11;
1174
1176
  try {
1175
1177
  for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) {
@@ -311,7 +311,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
311
311
  date: string;
312
312
  status: string;
313
313
  week: string;
314
- weekNum: 0 | 1 | 2 | 3 | 4 | 5 | 6;
314
+ weekNum: 0 | 2 | 1 | 3 | 5 | 4 | 6;
315
315
  }[]>;
316
316
  submitTimeSlot(timeSlots: TimeSliceItem): void;
317
317
  private getScheduleDataByIds;
@@ -357,7 +357,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
357
357
  };
358
358
  setOtherData(key: string, value: any): void;
359
359
  getOtherData(key: string): any;
360
- getProductTypeById(id: number): Promise<"duration" | "session" | "normal">;
360
+ getProductTypeById(id: number): Promise<"normal" | "duration" | "session">;
361
361
  /**
362
362
  * 提供给 UI 的方法,减轻 UI 层的计算压力,UI 层只需要传递 cartItemId 和 resourceCode 即返回对应的 renderList
363
363
  *
@@ -123,7 +123,7 @@ export declare class BookingTicketImpl extends BaseModule implements Module {
123
123
  * 获取当前的客户搜索条件
124
124
  * @returns 当前搜索条件
125
125
  */
126
- getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
126
+ getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
127
127
  /**
128
128
  * 获取客户列表状态(包含滚动加载相关状态)
129
129
  * @returns 客户状态
@@ -49,5 +49,5 @@ export declare class Product extends BaseModule implements Module {
49
49
  getCategories(): ProductCategory[];
50
50
  setOtherParams(key: string, value: any): void;
51
51
  getOtherParams(): any;
52
- getProductType(): "normal" | "duration" | "session";
52
+ getProductType(): "duration" | "session" | "normal";
53
53
  }
@@ -487,9 +487,10 @@ var RulesModule = class extends import_BaseModule.BaseModule {
487
487
  };
488
488
  }
489
489
  const quantity = flatItem.type === "main" ? product.quantity || 1 : (product.num || 1) * (((_a = flatItem.parentProduct) == null ? void 0 : _a.quantity) || 1);
490
+ const originalAmount = flatItem.type === "main" ? Number(product.price ?? 0) : Number(flatItem.original_price ?? flatItem.price ?? 0);
490
491
  const productData = {
491
492
  productId: flatItem._id,
492
- amount: Number(product.price || 0),
493
+ amount: originalAmount,
493
494
  quantity
494
495
  };
495
496
  if (flatItem.type === "bundle") {
@@ -559,7 +559,8 @@ var getSurcharge = ({ service, addons, bookingDetail, bookingId }, options) => {
559
559
  // 主商品的mainQuantity等于自己的quantity
560
560
  });
561
561
  }
562
- for (let bundleItem of (item == null ? void 0 : item.bundle) || []) {
562
+ const arr = (item == null ? void 0 : item.bundle) || (item == null ? void 0 : item.bundles) || [];
563
+ for (let bundleItem of arr) {
563
564
  if (getBundleItemIsOriginalPrice(bundleItem) && isProductMatchSurchargeCondition(
564
565
  {
565
566
  isCustomItem: false,
@@ -735,7 +736,8 @@ function resetItemsSurchargeSideEffects({ service, addons }) {
735
736
  if (Array.isArray(service)) {
736
737
  for (let item of service) {
737
738
  resetItem(item);
738
- for (let bundleItem of (item == null ? void 0 : item.bundle) || [])
739
+ const arr = (item == null ? void 0 : item.bundle) || (item == null ? void 0 : item.bundles) || [];
740
+ for (let bundleItem of arr)
739
741
  resetItem(bundleItem);
740
742
  for (let relationDetail of (item == null ? void 0 : item.relation_details) || [])
741
743
  resetItem(relationDetail);
@@ -311,7 +311,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
311
311
  date: string;
312
312
  status: string;
313
313
  week: string;
314
- weekNum: 0 | 1 | 2 | 3 | 4 | 5 | 6;
314
+ weekNum: 0 | 2 | 1 | 3 | 5 | 4 | 6;
315
315
  }[]>;
316
316
  submitTimeSlot(timeSlots: TimeSliceItem): void;
317
317
  private getScheduleDataByIds;
@@ -357,7 +357,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
357
357
  };
358
358
  setOtherData(key: string, value: any): void;
359
359
  getOtherData(key: string): any;
360
- getProductTypeById(id: number): Promise<"duration" | "session" | "normal">;
360
+ getProductTypeById(id: number): Promise<"normal" | "duration" | "session">;
361
361
  /**
362
362
  * 提供给 UI 的方法,减轻 UI 层的计算压力,UI 层只需要传递 cartItemId 和 resourceCode 即返回对应的 renderList
363
363
  *
@@ -123,7 +123,7 @@ export declare class BookingTicketImpl extends BaseModule implements Module {
123
123
  * 获取当前的客户搜索条件
124
124
  * @returns 当前搜索条件
125
125
  */
126
- getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
126
+ getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
127
127
  /**
128
128
  * 获取客户列表状态(包含滚动加载相关状态)
129
129
  * @returns 客户状态
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "0.0.411",
4
+ "version": "0.0.413",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",