@pisell/pisellos 0.0.29 → 0.0.30

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.
@@ -1031,6 +1031,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
1031
1031
  var allCartItems = _this7.store.cart.getItems();
1032
1032
  cartItems.forEach(function (item) {
1033
1033
  if (timeSlots) {
1034
+ var _item$_origin$resourc2;
1034
1035
  // 如果传递了 timeSlots,代表是第二种资源,则直接拿 timeSlots 去匹配
1035
1036
  var res = _this7.autoSelectAccountResources({
1036
1037
  holder_id: item.holder_id,
@@ -1038,6 +1039,13 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
1038
1039
  timeSlots: timeSlots,
1039
1040
  countMap: selectResourcesMap
1040
1041
  });
1042
+ // 如果购物车里已经有同类型的 form_id 的资源了,则不处理
1043
+ if ((_item$_origin$resourc2 = item._origin.resources) !== null && _item$_origin$resourc2 !== void 0 && _item$_origin$resourc2.some(function (n) {
1044
+ var _res$selectedResource;
1045
+ return n.form_id === (res === null || res === void 0 || (_res$selectedResource = res.selectedResource) === null || _res$selectedResource === void 0 ? void 0 : _res$selectedResource.form_id);
1046
+ })) {
1047
+ return;
1048
+ }
1041
1049
  if (res !== null && res !== void 0 && res.selectedResource) {
1042
1050
  if (!selectResourcesMap[res.selectedResource.id]) {
1043
1051
  selectResourcesMap[res.selectedResource.id] = 1;
@@ -1067,6 +1075,13 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
1067
1075
  return n.code === resources_code;
1068
1076
  })) === null || _productResources$fin === void 0 ? void 0 : _productResources$fin.renderList;
1069
1077
  if (targetRenderList && targetRenderList.length > 0) {
1078
+ var _item$_origin$resourc3;
1079
+ // 如果购物车里已经有同类型的 form_id 的资源了,则不处理
1080
+ if ((_item$_origin$resourc3 = item._origin.resources) !== null && _item$_origin$resourc3 !== void 0 && _item$_origin$resourc3.some(function (n) {
1081
+ return n.form_id === targetRenderList[0].form_id;
1082
+ })) {
1083
+ return;
1084
+ }
1070
1085
  var targetResource = targetRenderList[0];
1071
1086
  targetResource.capacity = 1;
1072
1087
  _this7.store.cart.updateItem({
@@ -559,7 +559,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
559
559
  const cartItems = this.store.cart.getCartByAccount(account.getId());
560
560
  const allCartItems = this.store.cart.getItems();
561
561
  cartItems.forEach((item) => {
562
- var _a;
562
+ var _a, _b, _c;
563
563
  if (timeSlots) {
564
564
  const res = this.autoSelectAccountResources({
565
565
  holder_id: item.holder_id,
@@ -567,6 +567,12 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
567
567
  timeSlots,
568
568
  countMap: selectResourcesMap
569
569
  });
570
+ if ((_a = item._origin.resources) == null ? void 0 : _a.some((n) => {
571
+ var _a2;
572
+ return n.form_id === ((_a2 = res == null ? void 0 : res.selectedResource) == null ? void 0 : _a2.form_id);
573
+ })) {
574
+ return;
575
+ }
570
576
  if (res == null ? void 0 : res.selectedResource) {
571
577
  if (!selectResourcesMap[res.selectedResource.id]) {
572
578
  selectResourcesMap[res.selectedResource.id] = 1;
@@ -591,8 +597,11 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
591
597
  }
592
598
  } else {
593
599
  const productResources = (0, import_resources.getResourcesByProduct)(resourcesMap, item, allCartItems);
594
- const targetRenderList = (_a = productResources.find((n) => n.code === resources_code)) == null ? void 0 : _a.renderList;
600
+ const targetRenderList = (_b = productResources.find((n) => n.code === resources_code)) == null ? void 0 : _b.renderList;
595
601
  if (targetRenderList && targetRenderList.length > 0) {
602
+ if ((_c = item._origin.resources) == null ? void 0 : _c.some((n) => n.form_id === targetRenderList[0].form_id)) {
603
+ return;
604
+ }
596
605
  const targetResource = targetRenderList[0];
597
606
  targetResource.capacity = 1;
598
607
  this.store.cart.updateItem({
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "0.0.29",
4
+ "version": "0.0.30",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",