@pisell/pisellos 0.0.161 → 0.0.164

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.
@@ -1410,17 +1410,27 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
1410
1410
  resources.push.apply(resources, _toConsumableArray(_this10.store.date.getResourcesListByDate(n.date) || []));
1411
1411
  });
1412
1412
  }
1413
+ var cartItems = this.store.cart.getItems().filter(function (n) {
1414
+ return !isNormalProduct(n._productOrigin);
1415
+ });
1416
+
1413
1417
  // 如果此时 resources 为空,视作购物车里已经有了 dateRange 数据,此时 dateList 里明确就是那一天的数据
1414
1418
  if (!resources.length) {
1415
- var dateList = this.store.date.getDateList();
1416
- dateList.forEach(function (n) {
1417
- if (n.resource) resources.push.apply(resources, _toConsumableArray(n.resource));
1419
+ // 如果此时购物车里已经有了开始时间,则直接取那天的数据即可
1420
+ var firstDateCartItem = cartItems === null || cartItems === void 0 ? void 0 : cartItems.find(function (n) {
1421
+ return n.start_date;
1418
1422
  });
1423
+ if (firstDateCartItem !== null && firstDateCartItem !== void 0 && firstDateCartItem.start_date) {
1424
+ var dateResources = this.store.date.getResourcesListByDate(firstDateCartItem.start_date);
1425
+ resources.push.apply(resources, _toConsumableArray(dateResources || []));
1426
+ } else {
1427
+ var dateList = this.store.date.getDateList();
1428
+ dateList.forEach(function (n) {
1429
+ if (n.resource) resources.push.apply(resources, _toConsumableArray(n.resource));
1430
+ });
1431
+ }
1419
1432
  }
1420
1433
  var resourcesMap = getResourcesMap(cloneDeep(resources));
1421
- var cartItems = this.store.cart.getItems().filter(function (n) {
1422
- return !isNormalProduct(n._productOrigin);
1423
- });
1424
1434
  var arr = [];
1425
1435
  cartItems.forEach(function (cartItem) {
1426
1436
  var _cartItem$_productOri;
@@ -820,15 +820,21 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
820
820
  resources.push(...this.store.date.getResourcesListByDate(n.date) || []);
821
821
  });
822
822
  }
823
+ const cartItems = this.store.cart.getItems().filter((n) => !(0, import_utils4.isNormalProduct)(n._productOrigin));
823
824
  if (!resources.length) {
824
- const dateList = this.store.date.getDateList();
825
- dateList.forEach((n) => {
826
- if (n.resource)
827
- resources.push(...n.resource);
828
- });
825
+ const firstDateCartItem = cartItems == null ? void 0 : cartItems.find((n) => n.start_date);
826
+ if (firstDateCartItem == null ? void 0 : firstDateCartItem.start_date) {
827
+ const dateResources = this.store.date.getResourcesListByDate(firstDateCartItem.start_date);
828
+ resources.push(...dateResources || []);
829
+ } else {
830
+ const dateList = this.store.date.getDateList();
831
+ dateList.forEach((n) => {
832
+ if (n.resource)
833
+ resources.push(...n.resource);
834
+ });
835
+ }
829
836
  }
830
837
  const resourcesMap = (0, import_utils.getResourcesMap)((0, import_lodash_es.cloneDeep)(resources));
831
- const cartItems = this.store.cart.getItems().filter((n) => !(0, import_utils4.isNormalProduct)(n._productOrigin));
832
838
  const arr = [];
833
839
  cartItems.forEach((cartItem) => {
834
840
  var _a, _b, _c, _d, _e, _f;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "0.0.161",
4
+ "version": "0.0.164",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",