@pisell/pisellos 2.1.61 → 2.1.62

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
  }
@@ -349,8 +349,10 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
349
349
 
350
350
  // 对扁平化后的列表按价格降序排序(用于应用优惠券时优先选择高价商品)
351
351
  var sortedFlattenedList = flattenedList.sort(function (a, b) {
352
- var priceA = new Decimal(a.price || '0');
353
- var priceB = new Decimal(b.price || '0');
352
+ var _ref3, _a$original_price, _ref4, _b$original_price;
353
+ // 子商品优先使用 original_price,主商品使用 price
354
+ var priceA = new Decimal(a.type === 'bundle' ? (_ref3 = (_a$original_price = a.original_price) !== null && _a$original_price !== void 0 ? _a$original_price : a.price) !== null && _ref3 !== void 0 ? _ref3 : '0' : a.price || '0');
355
+ var priceB = new Decimal(b.type === 'bundle' ? (_ref4 = (_b$original_price = b.original_price) !== null && _b$original_price !== void 0 ? _b$original_price : b.price) !== null && _ref4 !== void 0 ? _ref4 : '0' : b.price || '0');
354
356
  if (priceA.equals(priceB)) {
355
357
  // 价格相同时,主商品优先
356
358
  if (a.type !== b.type) {
@@ -597,8 +599,8 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
597
599
  var _product$discount_lis5, _product7, _product7$every;
598
600
  // 主商品:判断自身是否手动折扣
599
601
  isManualDiscount = typeof product.isManualDiscount === 'boolean' ? product.isManualDiscount : product.total != product.origin_total && (product.bundle || []).every(function (item) {
600
- var _ref3;
601
- return !((_ref3 = item.discount_list || []) !== null && _ref3 !== void 0 && _ref3.length);
602
+ var _ref5;
603
+ return !((_ref5 = item.discount_list || []) !== null && _ref5 !== void 0 && _ref5.length);
602
604
  }) && (!((_product$discount_lis5 = product.discount_list) !== null && _product$discount_lis5 !== void 0 && _product$discount_lis5.length) || ((_product7 = product) === null || _product7 === void 0 || (_product7 = _product7.discount_list) === null || _product7 === void 0 || (_product7$every = _product7.every) === null || _product7$every === void 0 ? void 0 : _product7$every.call(_product7, function (item) {
603
605
  return item.type === 'product';
604
606
  })));
@@ -608,8 +610,8 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
608
610
  if (parentProduct) {
609
611
  var _parentProduct$discou, _parentProduct$discou2, _parentProduct$discou3;
610
612
  isManualDiscount = typeof parentProduct.isManualDiscount === 'boolean' ? parentProduct.isManualDiscount : parentProduct.total != parentProduct.origin_total && (parentProduct.bundle || []).every(function (item) {
611
- var _ref4;
612
- return !((_ref4 = item.discount_list || []) !== null && _ref4 !== void 0 && _ref4.length);
613
+ var _ref6;
614
+ return !((_ref6 = item.discount_list || []) !== null && _ref6 !== void 0 && _ref6.length);
613
615
  }) && (!((_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) {
614
616
  return item.type === 'product';
615
617
  })));
@@ -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
  }
@@ -241,8 +241,12 @@ var RulesModule = class extends import_BaseModule.BaseModule {
241
241
  const flattenedList = flattenProductsWithBundle(productList);
242
242
  const sortedFlattenedList = flattenedList.sort((a, b) => {
243
243
  var _a, _b;
244
- const priceA = new import_decimal.default(a.price || "0");
245
- const priceB = new import_decimal.default(b.price || "0");
244
+ const priceA = new import_decimal.default(
245
+ a.type === "bundle" ? a.original_price ?? a.price ?? "0" : a.price || "0"
246
+ );
247
+ const priceB = new import_decimal.default(
248
+ b.type === "bundle" ? b.original_price ?? b.price ?? "0" : b.price || "0"
249
+ );
246
250
  if (priceA.equals(priceB)) {
247
251
  if (a.type !== b.type) {
248
252
  return a.type === "main" ? -1 : 1;
@@ -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.61",
4
+ "version": "2.1.62",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",