@pisell/pisellos 0.0.142 → 0.0.144

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.
@@ -350,7 +350,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
350
350
 
351
351
  // 记录实际应用了优惠券的商品信息
352
352
  var appliedProducts = appliedDiscountProducts.get(selectedDiscount.id) || [];
353
- var targetProductPrice = selectedDiscount.tag === 'good_pass' ? '0' : new Decimal(selectedDiscount.par_value || 0).div(100).mul(new Decimal(product.price || 0)).toFixed(2);
353
+ var targetProductPrice = selectedDiscount.tag === 'good_pass' ? '0' : new Decimal(100).minus(selectedDiscount.par_value || 0).div(100).mul(new Decimal(product.price || 0)).toFixed(2);
354
354
  var discountDetail = {
355
355
  amount: selectedDiscount.tag === 'product_discount_card' ? new Decimal(product.price || 0).minus(new Decimal(targetProductPrice)).toNumber() : product.price,
356
356
  type: selectedDiscount.tag === 'product_discount_card' ? 'discount_card' : selectedDiscount.tag,
@@ -695,7 +695,6 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
695
695
  while (1) switch (_context12.prev = _context12.next) {
696
696
  case 0:
697
697
  params = _args12.length > 0 && _args12[0] !== undefined ? _args12[0] : {};
698
- debugger;
699
698
  // 开始日期如果小于今天,直接以今天当做开始日期
700
699
  products = params.products, startDate = params.startDate, endDate = params.endDate, type = params.type; // 前端传递的 startDate,可能是今天之前的,如果 startDate 小于今天 且 endDate 小于或等于今天,需要把 startDate 置为今天
701
700
  if (dayjs(startDate).isBefore(dayjs(), 'day') && (dayjs(endDate).isAfter(dayjs(), 'day') || dayjs(endDate).isSame(dayjs(), 'day'))) {
@@ -722,15 +721,15 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
722
721
  tempStartDate = startDate || (dateRange === null || dateRange === void 0 || (_dateRange$ = dateRange[0]) === null || _dateRange$ === void 0 ? void 0 : _dateRange$.date);
723
722
  tempEndDate = endDate || (dateRange === null || dateRange === void 0 || (_dateRange$2 = dateRange[1]) === null || _dateRange$2 === void 0 ? void 0 : _dateRange$2.date) || (dateRange === null || dateRange === void 0 || (_dateRange$3 = dateRange[0]) === null || _dateRange$3 === void 0 ? void 0 : _dateRange$3.date);
724
723
  if (tempProducts.length) {
725
- _context12.next = 12;
724
+ _context12.next = 11;
726
725
  break;
727
726
  }
728
727
  return _context12.abrupt("return", []);
729
- case 12:
728
+ case 11:
730
729
  // 在这里需要把能收集到的数据都收集上来,拼装好给 date 模块去查询
731
730
  _ref4 = getAvailableProductResources(tempProducts) || {}, resourceIds = _ref4.resourceIds, rules = _ref4.rules, resourcesMap = _ref4.resourcesMap;
732
731
  this.otherParams.currentResourcesMap = resourcesMap;
733
- _context12.next = 16;
732
+ _context12.next = 15;
734
733
  return this.store.date.getResourceDates({
735
734
  url: params.url,
736
735
  query: {
@@ -741,10 +740,10 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
741
740
  rules: rules,
742
741
  type: type
743
742
  });
744
- case 16:
743
+ case 15:
745
744
  res = _context12.sent;
746
745
  return _context12.abrupt("return", res);
747
- case 18:
746
+ case 17:
748
747
  case "end":
749
748
  return _context12.stop();
750
749
  }
@@ -251,7 +251,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
251
251
  }
252
252
  usedDiscounts.set(selectedDiscount.id, true);
253
253
  const appliedProducts = appliedDiscountProducts.get(selectedDiscount.id) || [];
254
- const targetProductPrice = selectedDiscount.tag === "good_pass" ? "0" : new import_decimal.default(selectedDiscount.par_value || 0).div(100).mul(new import_decimal.default(product.price || 0)).toFixed(2);
254
+ const targetProductPrice = selectedDiscount.tag === "good_pass" ? "0" : new import_decimal.default(100).minus(selectedDiscount.par_value || 0).div(100).mul(new import_decimal.default(product.price || 0)).toFixed(2);
255
255
  const discountDetail = {
256
256
  amount: selectedDiscount.tag === "product_discount_card" ? new import_decimal.default(product.price || 0).minus(new import_decimal.default(targetProductPrice)).toNumber() : product.price,
257
257
  type: selectedDiscount.tag === "product_discount_card" ? "discount_card" : selectedDiscount.tag,
@@ -388,7 +388,6 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
388
388
  // 获取商品/服务的可用日期
389
389
  async getAvailableDate(params = {}) {
390
390
  var _a, _b, _c;
391
- debugger;
392
391
  let { products, startDate, endDate, type } = params;
393
392
  if ((0, import_dayjs.default)(startDate).isBefore((0, import_dayjs.default)(), "day") && ((0, import_dayjs.default)(endDate).isAfter((0, import_dayjs.default)(), "day") || (0, import_dayjs.default)(endDate).isSame((0, import_dayjs.default)(), "day"))) {
394
393
  startDate = (0, import_dayjs.default)().format("YYYY-MM-DD");
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "0.0.142",
4
+ "version": "0.0.144",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",