@pisell/pisellos 0.0.127 → 0.0.129

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.
@@ -69,6 +69,9 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
69
69
  if (!this.request) {
70
70
  throw new Error("bookingByStep解决方案需要 request 插件支持");
71
71
  }
72
+ if (!this.shopStore) {
73
+ throw new Error("SummaryModule 需要 shopStore 插件支持");
74
+ }
72
75
  let targetCacheData = {};
73
76
  this.cacheId = (_a = this.otherParams) == null ? void 0 : _a.cacheId;
74
77
  if ((_b = this.otherParams) == null ? void 0 : _b.cacheId) {
@@ -821,7 +824,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
821
824
  const cartItems = this.store.cart.getItems().filter((n) => !(0, import_utils4.isNormalProduct)(n._productOrigin));
822
825
  const arr = [];
823
826
  cartItems.forEach((cartItem) => {
824
- var _a, _b, _c;
827
+ var _a, _b, _c, _d, _e, _f, _g, _h;
825
828
  let selectedResources = [];
826
829
  const formatCapacity = (0, import_resources.formatDefaultCapacitys)({
827
830
  capacity: (_a = cartItem._productOrigin) == null ? void 0 : _a.capacity,
@@ -858,9 +861,9 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
858
861
  const resourcesUseableMap = {};
859
862
  productResources.forEach((n) => {
860
863
  n.renderList = n.renderList.sort((a, b) => {
861
- var _a2, _b2, _c2, _d;
864
+ var _a2, _b2, _c2, _d2;
862
865
  const aIsCombined = ((_b2 = (_a2 = a.metadata) == null ? void 0 : _a2.combined_resource) == null ? void 0 : _b2.status) === 1;
863
- const bIsCombined = ((_d = (_c2 = b.metadata) == null ? void 0 : _c2.combined_resource) == null ? void 0 : _d.status) === 1;
866
+ const bIsCombined = ((_d2 = (_c2 = b.metadata) == null ? void 0 : _c2.combined_resource) == null ? void 0 : _d2.status) === 1;
864
867
  if (aIsCombined && !bIsCombined)
865
868
  return 1;
866
869
  if (!aIsCombined && bIsCombined)
@@ -900,17 +903,22 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
900
903
  });
901
904
  });
902
905
  } else {
906
+ const hasFlexibleDuration = ((_e = (_d = cartItem._productOrigin) == null ? void 0 : _d.duration) == null ? void 0 : _e.type) === "flexible";
907
+ const operating_day_boundary = (_h = (_g = (_f = this.shopStore.get("core")) == null ? void 0 : _f.core) == null ? void 0 : _g.operating_day_boundary) == null ? void 0 : _h.time;
903
908
  productResources.forEach((item) => {
904
909
  item.renderList = item.renderList.filter((n) => {
905
- var _a2, _b2;
910
+ var _a2, _b2, _c2;
906
911
  const recordCount = n.capacity || 0;
907
912
  if (n.onlyComputed)
908
913
  return false;
909
914
  const timeSlots = (0, import_resources.getTimeSlicesByResource)({
910
915
  resource: n,
911
- duration: ((_b2 = (_a2 = cartItem._productOrigin) == null ? void 0 : _a2.duration) == null ? void 0 : _b2.value) || 0,
916
+ duration: ((_b2 = (_a2 = cartItem._productOrigin) == null ? void 0 : _a2.duration) == null ? void 0 : _b2.value) || 10,
912
917
  split: 10,
913
- currentDate: dateRange[0].date
918
+ currentDate: dateRange[0].date,
919
+ hasFlexibleDuration,
920
+ cut_off_time: (_c2 = cartItem._productOrigin) == null ? void 0 : _c2.cut_off_time,
921
+ operating_day_boundary
914
922
  });
915
923
  return recordCount >= currentCapacity && timeSlots.length > 0;
916
924
  });
@@ -1037,7 +1045,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1037
1045
  return false;
1038
1046
  const timeSlots = (0, import_resources.getTimeSlicesByResource)({
1039
1047
  resource: n,
1040
- duration: ((_b2 = (_a2 = cartItem._productOrigin) == null ? void 0 : _a2.duration) == null ? void 0 : _b2.value) || 0,
1048
+ duration: ((_b2 = (_a2 = cartItem._productOrigin) == null ? void 0 : _a2.duration) == null ? void 0 : _b2.value) || 10,
1041
1049
  split: 10,
1042
1050
  currentDate: dateRange[0].date
1043
1051
  });
@@ -1155,7 +1163,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1155
1163
  }
1156
1164
  let duration = accountCartItems.reduce((acc, n) => {
1157
1165
  var _a2, _b2;
1158
- return acc + (((_b2 = (_a2 = n._productOrigin) == null ? void 0 : _a2.duration) == null ? void 0 : _b2.value) ?? 0);
1166
+ return acc + (((_b2 = (_a2 = n._productOrigin) == null ? void 0 : _a2.duration) == null ? void 0 : _b2.value) || 10);
1159
1167
  }, 0);
1160
1168
  let AllResources = [];
1161
1169
  if (dateRange == null ? void 0 : dateRange.length) {
@@ -1287,7 +1295,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1287
1295
  const selectForCartResources = (cartItems2) => {
1288
1296
  let recordTimeSlots = (0, import_lodash_es.cloneDeep)(timeSlots);
1289
1297
  cartItems2.forEach((item, index) => {
1290
- var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
1298
+ var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
1291
1299
  const formatCapacity = (0, import_resources.formatDefaultCapacitys)({
1292
1300
  capacity: (_a2 = item._productOrigin) == null ? void 0 : _a2.capacity,
1293
1301
  product_bundle: item._origin.product.product_bundle
@@ -1308,12 +1316,12 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1308
1316
  const resourceBookingType = (currentResourceConfig == null ? void 0 : currentResourceConfig.type) || "single";
1309
1317
  if (index !== 0 && recordTimeSlots && resourceBookingType === "single" && ((_e = item._productOrigin) == null ? void 0 : _e.duration)) {
1310
1318
  let start_at = (0, import_dayjs.default)(recordTimeSlots.end_time).add(
1311
- ((_g = (_f = item._productOrigin) == null ? void 0 : _f.duration) == null ? void 0 : _g.value) ?? 0,
1312
- ((_i = (_h = item._productOrigin) == null ? void 0 : _h.duration) == null ? void 0 : _i.type) ?? "minutes"
1319
+ ((_g = (_f = item._productOrigin) == null ? void 0 : _f.duration) == null ? void 0 : _g.value) || 10,
1320
+ "minutes"
1313
1321
  );
1314
1322
  let end_at = start_at.add(
1315
- ((_k = (_j = item._productOrigin) == null ? void 0 : _j.duration) == null ? void 0 : _k.value) ?? 0,
1316
- ((_m = (_l = item._productOrigin) == null ? void 0 : _l.duration) == null ? void 0 : _m.type) ?? "minutes"
1323
+ ((_i = (_h = item._productOrigin) == null ? void 0 : _h.duration) == null ? void 0 : _i.value) || 10,
1324
+ "minutes"
1317
1325
  );
1318
1326
  recordTimeSlots = {
1319
1327
  start_time: start_at.format("HH:mm"),
@@ -1366,7 +1374,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1366
1374
  const allCartItems = (0, import_lodash_es.cloneDeep)(this.store.cart.getItems());
1367
1375
  let selectedResources = [];
1368
1376
  const resources2 = (0, import_lodash_es.cloneDeep)(
1369
- ((_o = (_n = item._productOrigin) == null ? void 0 : _n.product_resource) == null ? void 0 : _o.resources) || []
1377
+ ((_k = (_j = item._productOrigin) == null ? void 0 : _j.product_resource) == null ? void 0 : _k.resources) || []
1370
1378
  );
1371
1379
  const currentResourcesRenderList = [];
1372
1380
  resources2.forEach((n) => {
@@ -1377,7 +1385,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1377
1385
  const recordCount = (m.capacity || 0) - (selectResourcesMap[m.id] || 0);
1378
1386
  const timeSlots2 = (0, import_resources.getTimeSlicesByResource)({
1379
1387
  resource: m,
1380
- duration: ((_a4 = item == null ? void 0 : item.duration) == null ? void 0 : _a4.value) || 0,
1388
+ duration: ((_a4 = item == null ? void 0 : item.duration) == null ? void 0 : _a4.value) || 10,
1381
1389
  split: 10,
1382
1390
  currentDate: dateRange[0].date
1383
1391
  });
@@ -1414,11 +1422,11 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1414
1422
  return recordCount >= currentCapacity;
1415
1423
  });
1416
1424
  });
1417
- const targetRenderList = (_p = productResources.find(
1425
+ const targetRenderList = (_l = productResources.find(
1418
1426
  (n) => n.code === resources_code
1419
- )) == null ? void 0 : _p.renderList;
1427
+ )) == null ? void 0 : _l.renderList;
1420
1428
  if (targetRenderList && targetRenderList.length > 0) {
1421
- if ((_q = item._origin.resources) == null ? void 0 : _q.some(
1429
+ if ((_m = item._origin.resources) == null ? void 0 : _m.some(
1422
1430
  (n) => n.form_id === targetRenderList[0].form_id
1423
1431
  )) {
1424
1432
  return;
@@ -1464,7 +1472,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1464
1472
  }
1465
1473
  // 从购物车中获取已经分配好第一步资源的所有时间片
1466
1474
  getTimeSlotByAllResources(resources_code) {
1467
- var _a, _b, _c, _d, _e, _f;
1475
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
1468
1476
  let dateRange = this.store.date.getDateRange();
1469
1477
  const resources = [];
1470
1478
  const cartItems = this.store.cart.getItems().filter((n) => !(0, import_utils4.isNormalProduct)(n._productOrigin));
@@ -1474,7 +1482,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1474
1482
  let maxCutOffTime = void 0;
1475
1483
  let maxCutOffTimeValue = (0, import_dayjs.default)();
1476
1484
  cartItems.forEach((item) => {
1477
- var _a2, _b2, _c2, _d2, _e2, _f2, _g, _h, _i;
1485
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2;
1478
1486
  (_c2 = (_b2 = (_a2 = item._productOrigin) == null ? void 0 : _a2.product_resource) == null ? void 0 : _b2.resources) == null ? void 0 : _c2.forEach((n) => {
1479
1487
  if (n.code === resources_code) {
1480
1488
  resources.push(...n.renderList || []);
@@ -1484,10 +1492,10 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1484
1492
  if (item.resource_id) {
1485
1493
  resourceIds.push(item.resource_id);
1486
1494
  }
1487
- resourcesTypeId = (_g = (_f2 = (_e2 = (_d2 = item == null ? void 0 : item._productOrigin) == null ? void 0 : _d2.product_resource) == null ? void 0 : _e2.resources) == null ? void 0 : _f2.find(
1495
+ resourcesTypeId = (_g2 = (_f2 = (_e2 = (_d2 = item == null ? void 0 : item._productOrigin) == null ? void 0 : _d2.product_resource) == null ? void 0 : _e2.resources) == null ? void 0 : _f2.find(
1488
1496
  (n) => n.code === resources_code
1489
- )) == null ? void 0 : _g.id;
1490
- if (((_h = item._productOrigin) == null ? void 0 : _h.cut_off_time) && ((_i = item._productOrigin) == null ? void 0 : _i.cut_off_time.type) === "advance") {
1497
+ )) == null ? void 0 : _g2.id;
1498
+ if (((_h2 = item._productOrigin) == null ? void 0 : _h2.cut_off_time) && ((_i2 = item._productOrigin) == null ? void 0 : _i2.cut_off_time.type) === "advance") {
1491
1499
  const currentCutOffTime = (0, import_dayjs.default)().add(
1492
1500
  item._productOrigin.cut_off_time.unit,
1493
1501
  item._productOrigin.cut_off_time.unit_type
@@ -1513,10 +1521,10 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1513
1521
  cartItems2.forEach((item) => {
1514
1522
  var _a2, _b2, _c2, _d2, _e2, _f2;
1515
1523
  if (isSingleResource) {
1516
- accountDuration += ((_b2 = (_a2 = item._productOrigin) == null ? void 0 : _a2.duration) == null ? void 0 : _b2.value) ?? 0;
1524
+ accountDuration += ((_b2 = (_a2 = item._productOrigin) == null ? void 0 : _a2.duration) == null ? void 0 : _b2.value) || 10;
1517
1525
  } else {
1518
- if (accountDuration < (((_d2 = (_c2 = item._productOrigin) == null ? void 0 : _c2.duration) == null ? void 0 : _d2.value) ?? 0)) {
1519
- accountDuration = ((_f2 = (_e2 = item._productOrigin) == null ? void 0 : _e2.duration) == null ? void 0 : _f2.value) ?? 0;
1526
+ if (accountDuration < (((_d2 = (_c2 = item._productOrigin) == null ? void 0 : _c2.duration) == null ? void 0 : _d2.value) || 10)) {
1527
+ accountDuration = ((_f2 = (_e2 = item._productOrigin) == null ? void 0 : _e2.duration) == null ? void 0 : _f2.value) || 10;
1520
1528
  }
1521
1529
  }
1522
1530
  });
@@ -1552,6 +1560,11 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1552
1560
  ];
1553
1561
  }
1554
1562
  const resourcesUseableMap = {};
1563
+ const hasFlexibleDuration = cartItems.some((item) => {
1564
+ var _a2, _b2;
1565
+ return ((_b2 = (_a2 = item._productOrigin) == null ? void 0 : _a2.duration) == null ? void 0 : _b2.type) === "flexible";
1566
+ });
1567
+ const operating_day_boundary = (_i = (_h = (_g = this.shopStore.get("core")) == null ? void 0 : _g.core) == null ? void 0 : _h.operating_day_boundary) == null ? void 0 : _i.time;
1555
1568
  const timeSlots = (0, import_resources.getTimeSlicesByResources)({
1556
1569
  resourceIds,
1557
1570
  resourcesMap,
@@ -1559,13 +1572,17 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1559
1572
  currentDate: dateRange[0].date,
1560
1573
  split: 10,
1561
1574
  resourcesUseableMap,
1562
- cut_off_time: maxCutOffTime
1575
+ cut_off_time: maxCutOffTime,
1576
+ hasFlexibleDuration,
1577
+ operating_day_boundary
1563
1578
  });
1564
1579
  return timeSlots;
1565
1580
  }
1566
- // 提交时间切片,绑定到对应购物车的商品上,更新购物车
1581
+ // 提交时间切片,绑定到对应购物车的商品上,更新购物车---只有 duration 商品
1567
1582
  submitTimeSlot(timeSlots) {
1583
+ var _a, _b, _c;
1568
1584
  const cartItems = this.store.cart.getItems().filter((n) => !(0, import_utils4.isNormalProduct)(n._productOrigin));
1585
+ const allResources = this.store.date.getResourcesListByDate(timeSlots.start_at.format("YYYY-MM-DD"));
1569
1586
  const itemsByAccount = cartItems.reduce(
1570
1587
  (acc, item) => {
1571
1588
  const holderId = item.holder_id;
@@ -1577,25 +1594,46 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1577
1594
  },
1578
1595
  {}
1579
1596
  );
1597
+ const operating_day_boundary = (_c = (_b = (_a = this.shopStore.get("core")) == null ? void 0 : _a.core) == null ? void 0 : _b.operating_day_boundary) == null ? void 0 : _c.time;
1580
1598
  Object.values(itemsByAccount).forEach((accountItems) => {
1581
1599
  let currentStartTime = timeSlots.start_at.format("YYYY-MM-DD HH:mm");
1582
1600
  accountItems.forEach((item, index) => {
1583
- var _a;
1601
+ var _a2;
1584
1602
  const newResources = (0, import_lodash_es.cloneDeep)(item._origin.resources);
1585
1603
  newResources.forEach((resource) => {
1586
- var _a2, _b, _c, _d;
1587
- resource.startTime = currentStartTime;
1588
- resource.endTime = (0, import_dayjs.default)(currentStartTime).add(
1589
- ((_b = (_a2 = item._productOrigin) == null ? void 0 : _a2.duration) == null ? void 0 : _b.value) ?? 0,
1590
- ((_d = (_c = item._productOrigin) == null ? void 0 : _c.duration) == null ? void 0 : _d.type) ?? "minutes"
1591
- ).format("YYYY-MM-DD HH:mm");
1592
- delete resource.times;
1604
+ var _a3, _b2, _c2, _d, _e;
1605
+ if (((_b2 = (_a3 = item._productOrigin) == null ? void 0 : _a3.duration) == null ? void 0 : _b2.type) === "flexible") {
1606
+ item.duration = {
1607
+ type: "minutes",
1608
+ value: 10
1609
+ };
1610
+ resource.startTime = timeSlots.start_at.format("YYYY-MM-DD HH:mm");
1611
+ const targetResourceTimes = (_c2 = allResources == null ? void 0 : allResources.find((n) => n.id === resource.id)) == null ? void 0 : _c2.times;
1612
+ const resourcesEndTime = targetResourceTimes.reduce((acc, curr) => {
1613
+ return (0, import_dayjs.default)(curr.end_at).isBefore((0, import_dayjs.default)(acc.end_at)) ? curr : acc;
1614
+ }, targetResourceTimes[0]);
1615
+ const endTime = (0, import_dayjs.default)(resourcesEndTime.end_at).isBefore((0, import_dayjs.default)(operating_day_boundary)) ? resourcesEndTime.end_at : operating_day_boundary;
1616
+ let formattedEndTime;
1617
+ if (typeof endTime === "string" && endTime.includes(":") && !endTime.includes(" ") && !endTime.includes("T")) {
1618
+ const currentDate = timeSlots.start_at.format("YYYY-MM-DD");
1619
+ formattedEndTime = (0, import_dayjs.default)(`${currentDate} ${endTime}`);
1620
+ } else {
1621
+ formattedEndTime = (0, import_dayjs.default)(endTime);
1622
+ }
1623
+ resource.endTime = formattedEndTime.format("YYYY-MM-DD HH:mm");
1624
+ } else {
1625
+ resource.startTime = currentStartTime;
1626
+ resource.endTime = (0, import_dayjs.default)(currentStartTime).add(
1627
+ ((_e = (_d = item._productOrigin) == null ? void 0 : _d.duration) == null ? void 0 : _e.value) || 10,
1628
+ "minutes"
1629
+ ).format("YYYY-MM-DD HH:mm");
1630
+ }
1593
1631
  });
1594
1632
  this.store.cart.updateItem({
1595
1633
  _id: item._id,
1596
1634
  resources: newResources
1597
1635
  });
1598
- if (index < accountItems.length - 1 && ((_a = newResources == null ? void 0 : newResources[0]) == null ? void 0 : _a.resourceType) === "single") {
1636
+ if (index < accountItems.length - 1 && ((_a2 = newResources == null ? void 0 : newResources[0]) == null ? void 0 : _a2.resourceType) === "single") {
1599
1637
  currentStartTime = newResources[0].endTime;
1600
1638
  }
1601
1639
  });
@@ -1758,7 +1796,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1758
1796
  account
1759
1797
  }) {
1760
1798
  const { bundle, options, origin, product_variant_id, rowKey, quantity = 1 } = product || {};
1761
- const productData = { ...origin, product_variant_id };
1799
+ const productData = { ...origin, product_variant_id, rowKey };
1762
1800
  if (!account) {
1763
1801
  const activeAccount = this.getActiveAccount();
1764
1802
  if (activeAccount) {
@@ -1777,7 +1815,10 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1777
1815
  product: {
1778
1816
  ...targetCartItem._productOrigin,
1779
1817
  quantity: (targetCartItem.num || 1) + quantity
1780
- }
1818
+ },
1819
+ bundle: targetCartItem._bundleOrigin,
1820
+ options: targetCartItem._optionsOrigin,
1821
+ quantity: (targetCartItem.num || 1) + quantity
1781
1822
  });
1782
1823
  return;
1783
1824
  }
@@ -1940,7 +1981,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1940
1981
  return false;
1941
1982
  const timeSlots = (0, import_resources.getTimeSlicesByResource)({
1942
1983
  resource: n,
1943
- duration: ((_b2 = (_a2 = cartItem._productOrigin) == null ? void 0 : _a2.duration) == null ? void 0 : _b2.value) || 0,
1984
+ duration: ((_b2 = (_a2 = cartItem._productOrigin) == null ? void 0 : _a2.duration) == null ? void 0 : _b2.value) || 10,
1944
1985
  split: 10,
1945
1986
  currentDate: dateRange[0].date
1946
1987
  });
@@ -2038,11 +2079,16 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
2038
2079
  startDate = (0, import_dayjs.default)().format("YYYY-MM-DD");
2039
2080
  }
2040
2081
  const endDateAfterMonth = (0, import_dayjs.default)().add(1, "month").format("YYYY-MM-DD");
2082
+ let tempEndDate = endDateAfterMonth;
2041
2083
  if ((0, import_dayjs.default)(startDate).add(7, "day").isAfter((0, import_dayjs.default)(endDateAfterMonth), "day")) {
2042
- endDate = (0, import_dayjs.default)(startDate).add(7, "day").format("YYYY-MM-DD");
2084
+ tempEndDate = (0, import_dayjs.default)(startDate).add(7, "day").format("YYYY-MM-DD");
2043
2085
  } else {
2044
- endDate = endDateAfterMonth;
2086
+ tempEndDate = endDateAfterMonth;
2087
+ }
2088
+ if ((0, import_dayjs.default)(tempEndDate).isBefore((0, import_dayjs.default)(endDate), "day")) {
2089
+ tempEndDate = endDate || "";
2045
2090
  }
2091
+ endDate = tempEndDate;
2046
2092
  let tempProducts;
2047
2093
  tempProducts = (_a = this.store.currentProduct) == null ? void 0 : _a.getData();
2048
2094
  const schedule = (_b = this.store.currentProduct) == null ? void 0 : _b.getOtherParams()["schedule"];
@@ -79,7 +79,7 @@ export declare const formatResources: ({ booking, resources, }: {
79
79
  * @return {*}
80
80
  * @Author: zhiwei.Wang
81
81
  */
82
- export declare const getTimeSlicesByResource: ({ resource, duration, split, currentDate, capacity, resourcesUseableMap, cut_off_time, }: {
82
+ export declare const getTimeSlicesByResource: ({ resource, duration, split, currentDate, capacity, resourcesUseableMap, cut_off_time, hasFlexibleDuration, operating_day_boundary }: {
83
83
  resource: ResourceItem;
84
84
  duration: number;
85
85
  split: number;
@@ -96,6 +96,8 @@ export declare const getTimeSlicesByResource: ({ resource, duration, split, curr
96
96
  unit: number;
97
97
  } | undefined;
98
98
  } | undefined;
99
+ hasFlexibleDuration?: boolean | undefined;
100
+ operating_day_boundary?: string | undefined;
99
101
  }) => TimeSliceItem[];
100
102
  /**
101
103
  * @title: 获取时间切片列表的交集
@@ -133,7 +135,7 @@ export declare const mergeSubResourcesTimeSlices: (resources: ResourceItem[], re
133
135
  * @return {*}
134
136
  * @Author: zhiwei.Wang
135
137
  */
136
- export declare const getTimeSlicesByResources: ({ resourceIds, resourcesMap, duration, currentDate, split, capacity, resourcesUseableMap, cut_off_time, }: {
138
+ export declare const getTimeSlicesByResources: ({ resourceIds, resourcesMap, duration, currentDate, split, capacity, resourcesUseableMap, cut_off_time, hasFlexibleDuration, operating_day_boundary }: {
137
139
  resourceIds: number[];
138
140
  resourcesMap: any;
139
141
  duration: number;
@@ -151,6 +153,8 @@ export declare const getTimeSlicesByResources: ({ resourceIds, resourcesMap, dur
151
153
  unit: number;
152
154
  } | undefined;
153
155
  } | undefined;
156
+ hasFlexibleDuration?: boolean | undefined;
157
+ operating_day_boundary?: string | undefined;
154
158
  }) => any[];
155
159
  /**
156
160
  * @title: 获取其他人的已选资源
@@ -333,12 +333,13 @@ var getTimeSlicesByResource = ({
333
333
  currentDate = (0, import_dayjs.default)(),
334
334
  capacity,
335
335
  resourcesUseableMap = {},
336
- cut_off_time
336
+ cut_off_time,
337
+ hasFlexibleDuration,
338
+ operating_day_boundary
337
339
  }) => {
338
340
  const { times } = resource;
339
341
  const timeSlices = [];
340
342
  times.forEach((time) => {
341
- const today = (0, import_dayjs.default)(currentDate).format("YYYY-MM-DD");
342
343
  const startTime = (0, import_dayjs.default)(`${time.start_at}`);
343
344
  const endTime = (0, import_dayjs.default)(`${time.end_at}`);
344
345
  let currentStart = startTime;
@@ -365,6 +366,9 @@ var getTimeSlicesByResource = ({
365
366
  resourcesUseableMap[resource.id] = _status.usable;
366
367
  }
367
368
  if (_status.usable) {
369
+ if (hasFlexibleDuration && operating_day_boundary && timeSlice.start_time >= operating_day_boundary) {
370
+ break;
371
+ }
368
372
  timeSlices.push({
369
373
  ...timeSlice,
370
374
  // 这里需要补充这个时间段内是否可预约
@@ -422,7 +426,9 @@ var getTimeSlicesByResources = ({
422
426
  split,
423
427
  capacity,
424
428
  resourcesUseableMap,
425
- cut_off_time
429
+ cut_off_time,
430
+ hasFlexibleDuration,
431
+ operating_day_boundary
426
432
  }) => {
427
433
  let resources = getResourcesByIds(resourcesMap, resourceIds);
428
434
  mergeSubResourcesTimeSlices(resources, resourcesMap);
@@ -446,7 +452,9 @@ var getTimeSlicesByResources = ({
446
452
  currentDate,
447
453
  capacity,
448
454
  resourcesUseableMap,
449
- cut_off_time
455
+ cut_off_time,
456
+ hasFlexibleDuration,
457
+ operating_day_boundary
450
458
  })
451
459
  );
452
460
  },
@@ -118,7 +118,8 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
118
118
  this.loadPrepareConfig({
119
119
  customerId: customer.id,
120
120
  action: "create",
121
- with_good_pass: 1
121
+ with_good_pass: 1,
122
+ with_discount_card: 1
122
123
  });
123
124
  }
124
125
  );
@@ -303,11 +304,11 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
303
304
  // 获取客户钱包信息
304
305
  async getCustomerWallet(id) {
305
306
  try {
306
- const result = await this.request.get(`/customer/info/wallet/${id}`, {
307
- wallet_pass_tags: ["good_pass"]
307
+ const result = await this.request.get(`/customer/info/${id}`, {
308
+ with_trashed: 1
308
309
  });
309
310
  if (result == null ? void 0 : result.data) {
310
- const { wallet_pass_list, ...customer } = result.data;
311
+ const { ...customer } = result.data;
311
312
  this.setCustomer(customer);
312
313
  await this.core.effects.emit(
313
314
  import_types.ShopDiscountHooks.onScanCustomerChange,
@@ -326,7 +327,8 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
326
327
  const goodPassList = await ((_b = this.store.discount) == null ? void 0 : _b.loadPrepareConfig({
327
328
  customer_id: customerId,
328
329
  action: "create",
329
- with_good_pass: 1
330
+ with_good_pass: 1,
331
+ with_discount_card: 1
330
332
  }));
331
333
  const scanDiscount = (_c = this.getDiscountList()) == null ? void 0 : _c.filter(
332
334
  (item) => item.isScan
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "0.0.127",
4
+ "version": "0.0.129",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",