@pisell/pisellos 0.0.473 → 0.0.475

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.
@@ -1178,15 +1178,23 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
1178
1178
  discount_list: _this3.filterDiscountListByType(product.discount_list, 'promotion')
1179
1179
  }))]);
1180
1180
  } else {
1181
- var _product$main_product, _ref8, _product$_promotion$f, _product13, _product$main_product2;
1181
+ var _ref8, _product$_promotion$f, _product13, _product$origin_total, _product$price2;
1182
+ 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;
1183
+ var main_product_selling_price = (_product$price2 = product.price) !== null && _product$price2 !== void 0 ? _product$price2 : product.main_product_selling_price;
1184
+ if ((product.discount_list || []).some(function (item) {
1185
+ return item.type === 'promotion';
1186
+ }) || isBoolean(product.vouchersApplicable) && !product.vouchersApplicable) {
1187
+ var _product$total, _product$main_product;
1188
+ total = (_product$total = product.total) !== null && _product$total !== void 0 ? _product$total : product.origin_total;
1189
+ main_product_selling_price = (_product$main_product = product.main_product_selling_price) !== null && _product$main_product !== void 0 ? _product$main_product : main_product_selling_price;
1190
+ }
1182
1191
  processedProductsMap.set(product._id, [_this3.hooks.setProduct(originProduct, _objectSpread(_objectSpread({}, isManualDiscount ? {
1183
- price: product.price,
1184
- main_product_selling_price: (_product$main_product = product.main_product_selling_price) !== null && _product$main_product !== void 0 ? _product$main_product : product.price
1192
+ price: product.price
1185
1193
  } : {
1186
1194
  _id: product._id.split('___')[0] + '___' + index,
1187
- 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.total,
1195
+ total: total,
1188
1196
  price: product.price,
1189
- main_product_selling_price: (_product$main_product2 = product.main_product_selling_price) !== null && _product$main_product2 !== void 0 ? _product$main_product2 : product.price
1197
+ main_product_selling_price: main_product_selling_price
1190
1198
  }), {}, {
1191
1199
  discount_list: _this3.filterDiscountListByType(product.discount_list, 'promotion')
1192
1200
  }))]);
@@ -1334,13 +1342,13 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
1334
1342
  };
1335
1343
  appliedProducts.push(discountDetail);
1336
1344
  appliedDiscountProducts.set(currentSelectedDiscount.id, appliedProducts);
1337
- var total = targetProductTotal;
1345
+ var _total = targetProductTotal;
1338
1346
  if (product.options) {
1339
- total = product.options.reduce(function (accumulator, currentValue) {
1347
+ _total = product.options.reduce(function (accumulator, currentValue) {
1340
1348
  var currentPrice = new Decimal(currentValue.price || 0);
1341
1349
  var currentNum = new Decimal(currentValue.num || 0);
1342
1350
  return accumulator.add(currentPrice.mul(currentNum));
1343
- }, new Decimal(total)).toNumber();
1351
+ }, new Decimal(_total)).toNumber();
1344
1352
  }
1345
1353
 
1346
1354
  // 记录应用了优惠券的商品
@@ -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 | 2 | 1 | 3 | 5 | 4 | 6;
314
+ weekNum: 0 | 2 | 1 | 3 | 4 | 5 | 6;
315
315
  }[]>;
316
316
  submitTimeSlot(timeSlots: TimeSliceItem): void;
317
317
  private getScheduleDataByIds;
@@ -869,16 +869,21 @@ var RulesModule = class extends import_BaseModule.BaseModule {
869
869
  })
870
870
  ]);
871
871
  } else {
872
+ 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;
873
+ let main_product_selling_price = product.price ?? product.main_product_selling_price;
874
+ if ((product.discount_list || []).some((item) => item.type === "promotion") || (0, import_lodash_es.isBoolean)(product.vouchersApplicable) && !product.vouchersApplicable) {
875
+ total = product.total ?? product.origin_total;
876
+ main_product_selling_price = product.main_product_selling_price ?? main_product_selling_price;
877
+ }
872
878
  processedProductsMap.set(product._id, [
873
879
  this.hooks.setProduct(originProduct, {
874
880
  ...isManualDiscount ? {
875
- price: product.price,
876
- main_product_selling_price: product.main_product_selling_price ?? product.price
881
+ price: product.price
877
882
  } : {
878
883
  _id: product._id.split("___")[0] + "___" + index,
879
- 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,
884
+ total,
880
885
  price: product.price,
881
- main_product_selling_price: product.main_product_selling_price ?? product.price
886
+ main_product_selling_price
882
887
  },
883
888
  discount_list: this.filterDiscountListByType(product.discount_list, "promotion")
884
889
  })
@@ -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 | 2 | 1 | 3 | 5 | 4 | 6;
314
+ weekNum: 0 | 2 | 1 | 3 | 4 | 5 | 6;
315
315
  }[]>;
316
316
  submitTimeSlot(timeSlots: TimeSliceItem): void;
317
317
  private getScheduleDataByIds;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "0.0.473",
4
+ "version": "0.0.475",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",