@pisell/pisellos 2.1.66 → 2.1.68

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(): "duration" | "session" | "normal";
52
+ getProductType(): "normal" | "duration" | "session";
53
53
  }
@@ -610,7 +610,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
610
610
  // 收集该折扣卡适用的商品(排除被其他专属折扣卡占用的商品)
611
611
  var applicableProducts = [];
612
612
  sortedFlattenedList.forEach(function (flatItem) {
613
- var _flatItem$parentProdu2;
613
+ var _flatItem$parentProdu2, _product$price, _ref5, _flatItem$original_pr;
614
614
  // 🔥 检查该商品是否被其他专属折扣卡占用
615
615
  var occupyingDiscountId = occupiedItems.get(flatItem._id);
616
616
  if (occupyingDiscountId !== undefined && occupyingDiscountId !== discount.id) {
@@ -636,10 +636,14 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
636
636
  // 对于 bundle 子商品,quantity 需要乘以主商品的购买数量
637
637
  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);
638
638
 
639
+ // 对于主商品:使用 price
640
+ // 对于子商品:优先使用 flatItem.original_price,否则使用 flatItem.price
641
+ 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);
642
+
639
643
  // 传递 parentQuantity 用于差值处理时判断是否是真正的"数量为1"
640
644
  var productData = {
641
645
  productId: flatItem._id,
642
- amount: Number(product.price || 0),
646
+ amount: originalAmount,
643
647
  quantity: quantity
644
648
  };
645
649
 
@@ -857,8 +861,8 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
857
861
  var _product$discount_lis5, _product11, _product11$every;
858
862
  // 主商品:判断自身是否手动折扣
859
863
  isManualDiscount = typeof product.isManualDiscount === 'boolean' ? product.isManualDiscount : product.total != product.origin_total && (product.bundle || []).every(function (item) {
860
- var _ref5;
861
- return !((_ref5 = item.discount_list || []) !== null && _ref5 !== void 0 && _ref5.length);
864
+ var _ref6;
865
+ return !((_ref6 = item.discount_list || []) !== null && _ref6 !== void 0 && _ref6.length);
862
866
  }) && (!((_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) {
863
867
  return item.type === 'product';
864
868
  })));
@@ -868,8 +872,8 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
868
872
  if (parentProduct) {
869
873
  var _parentProduct$discou, _parentProduct$discou2, _parentProduct$discou3;
870
874
  isManualDiscount = typeof parentProduct.isManualDiscount === 'boolean' ? parentProduct.isManualDiscount : parentProduct.total != parentProduct.origin_total && (parentProduct.bundle || []).every(function (item) {
871
- var _ref6;
872
- return !((_ref6 = item.discount_list || []) !== null && _ref6 !== void 0 && _ref6.length);
875
+ var _ref7;
876
+ return !((_ref7 = item.discount_list || []) !== null && _ref7 !== void 0 && _ref7.length);
873
877
  }) && (!((_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) {
874
878
  return item.type === 'product';
875
879
  })));
@@ -343,7 +343,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
343
343
  };
344
344
  setOtherData(key: string, value: any): void;
345
345
  getOtherData(key: string): any;
346
- getProductTypeById(id: number): Promise<"duration" | "session" | "normal">;
346
+ getProductTypeById(id: number): Promise<"normal" | "duration" | "session">;
347
347
  /**
348
348
  * 提供给 UI 的方法,减轻 UI 层的计算压力,UI 层只需要传递 cartItemId 和 resourceCode 即返回对应的 renderList
349
349
  *
@@ -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, "num" | "skip">;
118
+ getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
119
119
  /**
120
120
  * 获取客户列表状态(包含滚动加载相关状态)
121
121
  * @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(): "duration" | "session" | "normal";
52
+ getProductType(): "normal" | "duration" | "session";
53
53
  }
@@ -431,9 +431,10 @@ var RulesModule = class extends import_BaseModule.BaseModule {
431
431
  };
432
432
  }
433
433
  const quantity = flatItem.type === "main" ? product.quantity || 1 : (product.num || 1) * (((_a = flatItem.parentProduct) == null ? void 0 : _a.quantity) || 1);
434
+ const originalAmount = flatItem.type === "main" ? Number(product.price ?? 0) : Number(flatItem.original_price ?? flatItem.price ?? 0);
434
435
  const productData = {
435
436
  productId: flatItem._id,
436
- amount: Number(product.price || 0),
437
+ amount: originalAmount,
437
438
  quantity
438
439
  };
439
440
  if (flatItem.type === "bundle") {
@@ -343,7 +343,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
343
343
  };
344
344
  setOtherData(key: string, value: any): void;
345
345
  getOtherData(key: string): any;
346
- getProductTypeById(id: number): Promise<"duration" | "session" | "normal">;
346
+ getProductTypeById(id: number): Promise<"normal" | "duration" | "session">;
347
347
  /**
348
348
  * 提供给 UI 的方法,减轻 UI 层的计算压力,UI 层只需要传递 cartItemId 和 resourceCode 即返回对应的 renderList
349
349
  *
@@ -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, "num" | "skip">;
118
+ getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
119
119
  /**
120
120
  * 获取客户列表状态(包含滚动加载相关状态)
121
121
  * @returns 客户状态
@@ -122,12 +122,6 @@ var BookingTicketImpl = class extends import_BaseModule.BaseModule {
122
122
  throw error;
123
123
  }
124
124
  }
125
- /**
126
- * 初始化外设扫码结果监听
127
- */
128
- initPeripheralsListener() {
129
- this.scan.initPeripheralsListener();
130
- }
131
125
  /**
132
126
  * 获取商品列表(不加载到模块中)
133
127
  * @returns 商品列表
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "2.1.66",
4
+ "version": "2.1.68",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",