@pisell/pisellos 2.0.50 → 2.0.51

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.
@@ -441,7 +441,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
441
441
  productOriginTotal = product.total;
442
442
  }
443
443
  // 如果当前 product 有 discount_list,则必须从 origin_total 拿
444
- if ((_product$discount_lis10 = product.discount_list) !== null && _product$discount_lis10 !== void 0 && _product$discount_lis10.length) {
444
+ if ((_product$discount_lis10 = product.discount_list) !== null && _product$discount_lis10 !== void 0 && _product$discount_lis10.length && product.origin_total) {
445
445
  productOriginTotal = product.origin_total;
446
446
  }
447
447
 
@@ -2182,12 +2182,12 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
2182
2182
  value: 10
2183
2183
  };
2184
2184
  resource.startTime = timeSlots.start_at.format('YYYY-MM-DD HH:mm');
2185
- // 找到resource.times里最早的end_at
2185
+ // 找到resource.times里最晚的end_at
2186
2186
  var targetResourceTimes = allResources === null || allResources === void 0 || (_allResources$find = allResources.find(function (n) {
2187
2187
  return n.id === resource.id;
2188
2188
  })) === null || _allResources$find === void 0 ? void 0 : _allResources$find.times;
2189
2189
  var resourcesEndTime = targetResourceTimes.reduce(function (acc, curr) {
2190
- return dayjs(curr.end_at).isBefore(dayjs(acc.end_at)) ? curr : acc;
2190
+ return dayjs(curr.end_at).isAfter(dayjs(acc.end_at)) ? curr : acc;
2191
2191
  }, targetResourceTimes[0]);
2192
2192
 
2193
2193
  // 将 operating_day_boundary 转换为与 resourcesEndTime.end_at 相同日期的完整日期时间
@@ -301,7 +301,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
301
301
  if (Number(((_g = originProduct == null ? void 0 : originProduct._productInit) == null ? void 0 : _g.original_price) || 0) > 0 && product.origin_total && product.total && product.origin_total !== product.total) {
302
302
  productOriginTotal = product.total;
303
303
  }
304
- if ((_h = product.discount_list) == null ? void 0 : _h.length) {
304
+ if (((_h = product.discount_list) == null ? void 0 : _h.length) && product.origin_total) {
305
305
  productOriginTotal = product.origin_total;
306
306
  }
307
307
  const targetProductTotal = selectedDiscount2.tag === "good_pass" ? new import_decimal.default(productOriginTotal).minus(new import_decimal.default(product.price || 0)).toNumber() : new import_decimal.default(100).minus(selectedDiscount2.par_value || 0).div(100).mul(new import_decimal.default(productOriginTotal)).toNumber();
@@ -1510,7 +1510,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1510
1510
  )) == null ? void 0 : _c.times;
1511
1511
  const resourcesEndTime = targetResourceTimes.reduce(
1512
1512
  (acc, curr) => {
1513
- return (0, import_dayjs.default)(curr.end_at).isBefore((0, import_dayjs.default)(acc.end_at)) ? curr : acc;
1513
+ return (0, import_dayjs.default)(curr.end_at).isAfter((0, import_dayjs.default)(acc.end_at)) ? curr : acc;
1514
1514
  },
1515
1515
  targetResourceTimes[0]
1516
1516
  );
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "2.0.50",
4
+ "version": "2.0.51",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",