@pisell/private-materials 3.4.4 → 3.4.6

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.
Files changed (65) hide show
  1. package/build/lowcode/assets-daily.json +11 -11
  2. package/build/lowcode/assets-dev.json +2 -2
  3. package/build/lowcode/assets-prod.json +11 -11
  4. package/build/lowcode/index.js +1 -1
  5. package/build/lowcode/meta.js +1 -1
  6. package/build/lowcode/preview.js +8 -8
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +3 -3
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +7 -7
  11. package/es/components/appointmentBooking/components/Cart/Item/index.js +1 -0
  12. package/es/components/appointmentBooking/components/Cart/Item/index.less +3 -3
  13. package/es/components/appointmentBooking/components/Cart/utils.js +8 -13
  14. package/es/components/appointmentBooking/components/Content/index.js +105 -19
  15. package/es/components/appointmentBooking/components/Content/index.less +1 -1
  16. package/es/components/appointmentBooking/components/Resource/index.js +1 -0
  17. package/es/components/appointmentBooking/components/Services/index.js +7 -2
  18. package/es/components/appointmentBooking/components/TimeSlicing/index.js +7 -3
  19. package/es/components/appointmentBooking/components/Voucher/index.js +10 -10
  20. package/es/components/appointmentBooking/hooks.js +28 -30
  21. package/es/components/appointmentBooking/index.js +14 -0
  22. package/es/components/appointmentBooking/index.less +1 -1
  23. package/es/components/booking/hooks/useIsBooking4Shop.d.ts +1 -1
  24. package/es/components/booking/hooks/useIsBooking4Shop.js +4 -3
  25. package/es/components/booking/info/addServiceVariant/index.js +2 -2
  26. package/es/components/booking/info/index.js +4 -4
  27. package/es/components/booking/info/utils.d.ts +1 -1
  28. package/es/components/booking/info/utils.js +4 -2
  29. package/es/components/booking/info2/service/addService/utils.js +38 -9
  30. package/es/components/booking/info2/service/addTimeModal/index.js +2 -2
  31. package/es/components/eventBooking/index.js +14 -0
  32. package/es/components/eventBooking/index.less +1 -1
  33. package/es/components/productSelect/components/TabProduct/index.js +103 -39
  34. package/es/components/productSelect/components/TabProduct/tabs/index.less +1 -0
  35. package/es/components/productSelect/index.d.ts +2 -0
  36. package/es/components/ticketBooking/components/addServiceVariant/addService.js +4 -4
  37. package/es/components/walletList/index.js +4 -4
  38. package/lib/components/appointmentBooking/components/Cart/Item/index.js +1 -0
  39. package/lib/components/appointmentBooking/components/Cart/Item/index.less +3 -3
  40. package/lib/components/appointmentBooking/components/Cart/utils.js +0 -10
  41. package/lib/components/appointmentBooking/components/Content/index.js +49 -7
  42. package/lib/components/appointmentBooking/components/Content/index.less +1 -1
  43. package/lib/components/appointmentBooking/components/Resource/index.js +1 -0
  44. package/lib/components/appointmentBooking/components/Services/index.js +6 -1
  45. package/lib/components/appointmentBooking/components/TimeSlicing/index.js +7 -3
  46. package/lib/components/appointmentBooking/components/Voucher/index.js +0 -11
  47. package/lib/components/appointmentBooking/hooks.js +5 -16
  48. package/lib/components/appointmentBooking/index.js +11 -0
  49. package/lib/components/appointmentBooking/index.less +1 -1
  50. package/lib/components/booking/hooks/useIsBooking4Shop.d.ts +1 -1
  51. package/lib/components/booking/hooks/useIsBooking4Shop.js +6 -4
  52. package/lib/components/booking/info/addServiceVariant/index.js +3 -2
  53. package/lib/components/booking/info/index.js +4 -3
  54. package/lib/components/booking/info/utils.d.ts +1 -1
  55. package/lib/components/booking/info/utils.js +2 -2
  56. package/lib/components/booking/info2/service/addService/utils.js +31 -10
  57. package/lib/components/booking/info2/service/addTimeModal/index.js +3 -2
  58. package/lib/components/eventBooking/index.js +11 -0
  59. package/lib/components/eventBooking/index.less +1 -1
  60. package/lib/components/productSelect/components/TabProduct/index.js +74 -37
  61. package/lib/components/productSelect/components/TabProduct/tabs/index.less +1 -0
  62. package/lib/components/productSelect/index.d.ts +2 -0
  63. package/lib/components/ticketBooking/components/addServiceVariant/addService.js +7 -6
  64. package/lib/components/walletList/index.js +3 -3
  65. package/package.json +3 -3
@@ -3,13 +3,13 @@ import Info2 from "../info2";
3
3
  import Info1 from "./main";
4
4
  import useEngineContext from "../../../hooks/useEngineContext";
5
5
  import { isBooking4Shop } from "./utils";
6
- import { Skeleton } from "antd";
6
+ import { Skeleton } from 'antd';
7
7
  var APP = function APP(props) {
8
- var _context$appHelper$ut, _context$appHelper$ut2, _context$appHelper$ut3, _context$appHelper$ut4;
8
+ var _context$appHelper$ut, _context$appHelper$ut2, _context$appHelper$ut3, _context$appHelper$ut4, _context$appHelper$ut5;
9
9
  var context = useEngineContext();
10
10
  var globalState = props.globalState;
11
- var isBooking4 = isBooking4Shop((_context$appHelper$ut = context.appHelper.utils.store) === null || _context$appHelper$ut === void 0 || (_context$appHelper$ut2 = _context$appHelper$ut.getState) === null || _context$appHelper$ut2 === void 0 || (_context$appHelper$ut2 = _context$appHelper$ut2.call(_context$appHelper$ut)) === null || _context$appHelper$ut2 === void 0 || (_context$appHelper$ut2 = _context$appHelper$ut2.global) === null || _context$appHelper$ut2 === void 0 || (_context$appHelper$ut2 = _context$appHelper$ut2.globalConfig) === null || _context$appHelper$ut2 === void 0 ? void 0 : _context$appHelper$ut2.id, globalState === null || globalState === void 0 ? void 0 : globalState.renderType);
12
- if (!((_context$appHelper$ut3 = context.appHelper.utils.store) !== null && _context$appHelper$ut3 !== void 0 && (_context$appHelper$ut4 = _context$appHelper$ut3.getState) !== null && _context$appHelper$ut4 !== void 0 && (_context$appHelper$ut4 = _context$appHelper$ut4.call(_context$appHelper$ut3)) !== null && _context$appHelper$ut4 !== void 0 && (_context$appHelper$ut4 = _context$appHelper$ut4.global) !== null && _context$appHelper$ut4 !== void 0 && (_context$appHelper$ut4 = _context$appHelper$ut4.globalConfig) !== null && _context$appHelper$ut4 !== void 0 && _context$appHelper$ut4.id)) {
11
+ var isBooking4 = isBooking4Shop((_context$appHelper$ut = context.appHelper.utils.store) === null || _context$appHelper$ut === void 0 || (_context$appHelper$ut2 = _context$appHelper$ut.getState) === null || _context$appHelper$ut2 === void 0 || (_context$appHelper$ut2 = _context$appHelper$ut2.call(_context$appHelper$ut)) === null || _context$appHelper$ut2 === void 0 || (_context$appHelper$ut2 = _context$appHelper$ut2.global) === null || _context$appHelper$ut2 === void 0 || (_context$appHelper$ut2 = _context$appHelper$ut2.globalConfig) === null || _context$appHelper$ut2 === void 0 ? void 0 : _context$appHelper$ut2.id, globalState === null || globalState === void 0 ? void 0 : globalState.renderType, (_context$appHelper$ut3 = context.appHelper.utils) === null || _context$appHelper$ut3 === void 0 ? void 0 : _context$appHelper$ut3.businessUtils);
12
+ if (!((_context$appHelper$ut4 = context.appHelper.utils.store) !== null && _context$appHelper$ut4 !== void 0 && (_context$appHelper$ut5 = _context$appHelper$ut4.getState) !== null && _context$appHelper$ut5 !== void 0 && (_context$appHelper$ut5 = _context$appHelper$ut5.call(_context$appHelper$ut4)) !== null && _context$appHelper$ut5 !== void 0 && (_context$appHelper$ut5 = _context$appHelper$ut5.global) !== null && _context$appHelper$ut5 !== void 0 && (_context$appHelper$ut5 = _context$appHelper$ut5.globalConfig) !== null && _context$appHelper$ut5 !== void 0 && _context$appHelper$ut5.id)) {
13
13
  return /*#__PURE__*/React.createElement("div", {
14
14
  style: {
15
15
  padding: 16
@@ -21,7 +21,7 @@ export declare const isInterval: (time1: number, time2: number, interval?: numbe
21
21
  * @Date: 2024-08-13 19:36
22
22
  */
23
23
  export declare const formatServiceListByTime: (list: any[]) => any[];
24
- export declare const isBooking4Shop: (shopId: number, renderType?: string) => boolean;
24
+ export declare const isBooking4Shop: (shopId: number, renderType?: string, businessUtils?: any) => any;
25
25
  declare type DataEntry = {
26
26
  total: number;
27
27
  origin_total: number;
@@ -91,12 +91,14 @@ export var formatServiceListByTime = function formatServiceListByTime(list) {
91
91
  return list;
92
92
  }
93
93
  };
94
- export var isBooking4Shop = function isBooking4Shop(shopId, renderType) {
94
+ export var isBooking4Shop = function isBooking4Shop(shopId, renderType, businessUtils) {
95
95
  if (renderType === 'eventBooking') {
96
96
  return false;
97
97
  }
98
98
  var booking4Shops = [8390, 1350, 1401, 3013, 7154, 7572, 7007, 8119, 7320, 7362, 6497, 6087, 6303, 6726, 8191, 6812, 6813, 6814, 7651, 8586, 8581, 9, 2155, 8030, 1749, 8194, 2327, 8609, 8610, 8782, 1285, 6124, 8727, 5538, 6988, 8872, 6930, 8824, 8913, 8918, 6413];
99
- return booking4Shops.includes(shopId);
99
+
100
+ // 固定的shopId 或者安装 Resource Kit 应用,则认为是booking4Shop
101
+ return booking4Shops.includes(shopId) || (businessUtils === null || businessUtils === void 0 ? void 0 : businessUtils.getAppByModal('resourcekit'));
100
102
  };
101
103
  function generateDateRange(start, end) {
102
104
  var dateRange = [];
@@ -370,7 +370,11 @@ export var getResourceByIds = function getResourceByIds(resourcesOriginMap, cach
370
370
  var _resources = _toConsumableArray((cacheItem === null || cacheItem === void 0 || (_cacheItem$product_re = cacheItem.product_resource) === null || _cacheItem$product_re === void 0 ? void 0 : _cacheItem$product_re.resources) || []);
371
371
  var _ref8 = extraParams || {},
372
372
  _ref8$extraResources = _ref8.extraResources,
373
- extraResources = _ref8$extraResources === void 0 ? [] : _ref8$extraResources;
373
+ extraResources = _ref8$extraResources === void 0 ? [] : _ref8$extraResources,
374
+ _ref8$resourcesOrigin = _ref8.resourcesOrigin,
375
+ resourcesOrigin = _ref8$resourcesOrigin === void 0 ? [] : _ref8$resourcesOrigin,
376
+ _ref8$resourceTab = _ref8.resourceTab,
377
+ resourceTab = _ref8$resourceTab === void 0 ? {} : _ref8$resourceTab;
374
378
  // 过滤出开启的资源
375
379
  _resources = _resources.filter(function (d) {
376
380
  return d.status == 1;
@@ -379,15 +383,29 @@ export var getResourceByIds = function getResourceByIds(resourcesOriginMap, cach
379
383
  _step2;
380
384
  try {
381
385
  var _loop3 = function _loop3() {
386
+ var _resourceTab$item$cod;
382
387
  var item = _step2.value;
383
388
  var form_id = item.id;
389
+ // resource_tab -> 每个资源类型 -> resource_display_scope { only_linked: '仅显示已关联资源' | all: '全部' } 默认值 ‘only_linked’
390
+ var isAllResource = (resourceTab === null || resourceTab === void 0 || (_resourceTab$item$cod = resourceTab[item.code]) === null || _resourceTab$item$cod === void 0 ? void 0 : _resourceTab$item$cod.resource_display_scope) === 'all';
384
391
 
385
392
  // 将未绑定的资源,也放入 SelectOption 列表,避免出现仅展示id的情况
386
- var extraResourceIds = extraResources.filter(function (_extraItem) {
387
- return _extraItem.form_id === form_id && !item.optional_resource.includes(_extraItem.id) && !item.default_resource.includes(_extraItem.id);
388
- }).map(function (_extraItem) {
389
- return _extraItem.id;
390
- });
393
+ var extraResourceIds = [];
394
+
395
+ // 如果设置了全部资源 需要把未关联的资源进行补全
396
+ if (isAllResource) {
397
+ extraResourceIds = (resourcesOrigin || []).filter(function (d) {
398
+ return d.form_code === item.code;
399
+ }).map(function (d) {
400
+ return d.id;
401
+ });
402
+ } else {
403
+ extraResourceIds = extraResources.filter(function (_extraItem) {
404
+ return _extraItem.form_id === form_id && !item.optional_resource.includes(_extraItem.id) && !item.default_resource.includes(_extraItem.id);
405
+ }).map(function (_extraItem) {
406
+ return _extraItem.id;
407
+ });
408
+ }
391
409
  extraResourceIds = Array.from(new Set(extraResourceIds));
392
410
 
393
411
  // 去重
@@ -415,7 +433,7 @@ export var getResourceByIds = function getResourceByIds(resourcesOriginMap, cach
415
433
  };
416
434
 
417
435
  // 可选项
418
- var optional_resource = [].concat(_toConsumableArray(item.optional_resource), _toConsumableArray(extraResourceIds)).map(function (d) {
436
+ var optional_resource = Array.from(new Set([].concat(_toConsumableArray(item.optional_resource), _toConsumableArray(extraResourceIds)))).map(function (d) {
419
437
  if (!resourcesOriginMap[d]) {
420
438
  return null;
421
439
  }
@@ -502,10 +520,13 @@ export var getProductExtend = function getProductExtend(_ref11) {
502
520
 
503
521
  // 资源总列表
504
522
  var resourcesOriginMap = state.service.resourcesOriginMap || {};
523
+ // const resourcesOrigin = state.s;
524
+
505
525
  _cacheItem._data = {};
506
526
 
507
527
  // 新商品
508
528
  if (isNew) {
529
+ var _state$bookingConfig3;
509
530
  // 时间切片
510
531
  _cacheItem._data.timeObj = getTimeObj({
511
532
  cacheItem: cacheItem,
@@ -520,7 +541,11 @@ export var getProductExtend = function getProductExtend(_ref11) {
520
541
  _cacheItem._data.capacitys = cacheItem.capacity;
521
542
 
522
543
  // 将商品关联的资源id还原资源列表
523
- _cacheItem._data.resourcesOrigin = getResourceByIds(resourcesOriginMap, cacheItem);
544
+ _cacheItem._data.resourcesOrigin = getResourceByIds(resourcesOriginMap, cacheItem, {
545
+ // 此数据用来控制 该商品所展示的资源是自身关联的, 还是全部的
546
+ resourceTab: state === null || state === void 0 || (_state$bookingConfig3 = state.bookingConfig) === null || _state$bookingConfig3 === void 0 || (_state$bookingConfig3 = _state$bookingConfig3.config) === null || _state$bookingConfig3 === void 0 ? void 0 : _state$bookingConfig3.resource_tab,
547
+ resourcesOrigin: state.service.resourcesOrigin
548
+ });
524
549
 
525
550
  // 默认容量
526
551
  _cacheItem._extend.capacity = setDefaultCapacitys({
@@ -592,6 +617,7 @@ export var getProductExtend = function getProductExtend(_ref11) {
592
617
  _cacheItem._data.capacitys = cacheItem.capacity;
593
618
  }
594
619
  if (!_cacheItem._data.resourcesOrigin) {
620
+ var _state$bookingConfig4;
595
621
  var extraResources = [];
596
622
  // 日历中可以将预约拖入未绑定的资源中,需要兼容未绑定资源的 selectOption展示
597
623
  if (Array.isArray(_cacheItem._extend.event_resources)) {
@@ -603,7 +629,10 @@ export var getProductExtend = function getProductExtend(_ref11) {
603
629
  });
604
630
  }
605
631
  _cacheItem._data.resourcesOrigin = getResourceByIds(resourcesOriginMap, cacheItem, {
606
- extraResources: extraResources
632
+ extraResources: extraResources,
633
+ // 此数据用来控制 该商品所展示的资源是自身关联的, 还是全部的
634
+ resourceTab: state === null || state === void 0 || (_state$bookingConfig4 = state.bookingConfig) === null || _state$bookingConfig4 === void 0 || (_state$bookingConfig4 = _state$bookingConfig4.config) === null || _state$bookingConfig4 === void 0 ? void 0 : _state$bookingConfig4.resource_tab,
635
+ resourcesOrigin: state.service.resourcesOrigin
607
636
  });
608
637
  }
609
638
  if (!_cacheItem._data.resources) {
@@ -498,7 +498,7 @@ var AddTimeModal = function AddTimeModal() {
498
498
  }();
499
499
  var handleSave = /*#__PURE__*/function () {
500
500
  var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
501
- var _context$appHelper$ut2, _context$appHelper$ut3;
501
+ var _context$appHelper$ut2, _context$appHelper$ut3, _context$appHelper$ut4;
502
502
  var loadingType,
503
503
  api,
504
504
  _args5 = arguments;
@@ -520,7 +520,7 @@ var AddTimeModal = function AddTimeModal() {
520
520
  case 5:
521
521
  loadingRef.current = true;
522
522
  setLoading(loadingType);
523
- api = isBooking4Shop((_context$appHelper$ut2 = context.appHelper.utils.store) === null || _context$appHelper$ut2 === void 0 || (_context$appHelper$ut3 = _context$appHelper$ut2.getState) === null || _context$appHelper$ut3 === void 0 || (_context$appHelper$ut3 = _context$appHelper$ut3.call(_context$appHelper$ut2)) === null || _context$appHelper$ut3 === void 0 || (_context$appHelper$ut3 = _context$appHelper$ut3.global) === null || _context$appHelper$ut3 === void 0 || (_context$appHelper$ut3 = _context$appHelper$ut3.globalConfig) === null || _context$appHelper$ut3 === void 0 ? void 0 : _context$appHelper$ut3.id, state.renderType) ? saveAddTimeProduct2 : saveAddTimeProduct;
523
+ api = isBooking4Shop((_context$appHelper$ut2 = context.appHelper.utils.store) === null || _context$appHelper$ut2 === void 0 || (_context$appHelper$ut3 = _context$appHelper$ut2.getState) === null || _context$appHelper$ut3 === void 0 || (_context$appHelper$ut3 = _context$appHelper$ut3.call(_context$appHelper$ut2)) === null || _context$appHelper$ut3 === void 0 || (_context$appHelper$ut3 = _context$appHelper$ut3.global) === null || _context$appHelper$ut3 === void 0 || (_context$appHelper$ut3 = _context$appHelper$ut3.globalConfig) === null || _context$appHelper$ut3 === void 0 ? void 0 : _context$appHelper$ut3.id, state.renderType, (_context$appHelper$ut4 = context.appHelper.utils) === null || _context$appHelper$ut4 === void 0 ? void 0 : _context$appHelper$ut4.businessUtils) ? saveAddTimeProduct2 : saveAddTimeProduct;
524
524
  _context5.prev = 8;
525
525
  _context5.next = 11;
526
526
  return api({
@@ -58,6 +58,20 @@ var Content = function Content() {
58
58
  }
59
59
  getResourceList.run(params);
60
60
  }, []);
61
+ useEffect(function () {
62
+ var setRealVH = function setRealVH() {
63
+ // window.innerHeight 会返回视口真实的高度(不包括工具栏)
64
+ var vh = window.innerHeight * 0.01;
65
+ document.documentElement.style.setProperty('--vh', "".concat(vh, "px"));
66
+ };
67
+
68
+ // 页面加载和窗口大小变化时都重新计算
69
+ setRealVH();
70
+ window.addEventListener('resize', setRealVH);
71
+ return function () {
72
+ window.removeEventListener('resize', setRealVH);
73
+ };
74
+ }, []);
61
75
  return /*#__PURE__*/React.createElement("div", {
62
76
  className: "event-booking-wrap ".concat(isMobile() ? 'event-booking-mobile-wrap' : '')
63
77
  }, /*#__PURE__*/React.createElement(Header, null), /*#__PURE__*/React.createElement(EventContent, null), isMobile() && (currentStepData === null || currentStepData === void 0 ? void 0 : currentStepData.key) !== 'select-category' ? /*#__PURE__*/React.createElement(Footer, null) : null);
@@ -15,7 +15,7 @@
15
15
 
16
16
  .event-booking-mobile-wrap {
17
17
  background: #ffffff;
18
- min-height: 100vh;
18
+ min-height: calc(var(--vh, 1vh) * 100);
19
19
  .pisell-section-headers-content {
20
20
  width: 100%;
21
21
  }
@@ -1,4 +1,4 @@
1
- var _excluded = ["showTab", "layout", "list", "onChange", "amountSymbol", "scrollDom", "value", "loading", "emptyDescription"];
1
+ var _excluded = ["showTab", "layout", "list", "onChange", "amountSymbol", "scrollDom", "offsetDom", "value", "loading", "emptyDescription"];
2
2
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
3
3
  function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
4
4
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
@@ -16,7 +16,24 @@ import { useMemoizedFn, useDebounceFn } from 'ahooks';
16
16
  import { locales } from '@pisell/utils';
17
17
  import Tabs from "./tabs";
18
18
  import ProductGroup, { ProductGroupSkeleton } from "../productGroup";
19
- var io = null;
19
+ // 获取元素相对于指定滚动容器的偏移量
20
+ var getOffsetTopRelativeToScrollContainer = function getOffsetTopRelativeToScrollContainer(targetElement, scrollContainer) {
21
+ if (!targetElement || !scrollContainer) return 0;
22
+
23
+ // 如果目标元素就是滚动容器本身,返回0
24
+ if (targetElement === scrollContainer) {
25
+ return 0;
26
+ }
27
+
28
+ // 使用getBoundingClientRect计算相对偏移量
29
+ var targetRect = targetElement.getBoundingClientRect();
30
+ var containerRect = scrollContainer.getBoundingClientRect();
31
+
32
+ // targetRect.top - containerRect.top 得到目标元素相对于容器顶部的可视距离
33
+ // 考虑容器已经滚动的距离 再加上scrollContainer.scrollTop
34
+ // 这样得到的是目标元素在容器内容中的绝对位置
35
+ return targetRect.top - containerRect.top + scrollContainer.scrollTop;
36
+ };
20
37
  var TabProduct = function TabProduct(props) {
21
38
  var _props$showTab = props.showTab,
22
39
  showTab = _props$showTab === void 0 ? true : _props$showTab,
@@ -26,6 +43,7 @@ var TabProduct = function TabProduct(props) {
26
43
  _props$amountSymbol = props.amountSymbol,
27
44
  amountSymbol = _props$amountSymbol === void 0 ? '$' : _props$amountSymbol,
28
45
  scrollDom = props.scrollDom,
46
+ offsetDom = props.offsetDom,
29
47
  currentProductId = props.value,
30
48
  loading = props.loading,
31
49
  emptyDescription = props.emptyDescription,
@@ -35,6 +53,8 @@ var TabProduct = function TabProduct(props) {
35
53
  _useState2 = _slicedToArray(_useState, 2),
36
54
  currentGroupId = _useState2[0],
37
55
  setCurrentGroupId = _useState2[1];
56
+ var tabLocatingRef = useRef(false);
57
+ var ioRef = useRef(null);
38
58
  useEffect(function () {
39
59
  if (list !== null && list !== void 0 && list.length) {
40
60
  setCurrentGroupId(list[0].id);
@@ -42,6 +62,11 @@ var TabProduct = function TabProduct(props) {
42
62
  handleObserver();
43
63
  });
44
64
  }
65
+
66
+ // 清理函数
67
+ return function () {
68
+ handleUnobserver();
69
+ };
45
70
  }, [list]);
46
71
 
47
72
  // 添加防抖的scroll函数
@@ -56,7 +81,7 @@ var TabProduct = function TabProduct(props) {
56
81
  var _marginTop = 270;
57
82
  var _marginBottom = window.innerHeight - 70 - 200 - 70;
58
83
  var _rootMargin = "".concat(_marginTop * -1, "px 0px ").concat(_marginBottom * -1, "px 0px");
59
- io = new IntersectionObserver(function (entries) {
84
+ ioRef.current = new IntersectionObserver(function (entries) {
60
85
  var enteringEntries = entries.filter(function (entry) {
61
86
  return entry.isIntersecting;
62
87
  });
@@ -66,20 +91,24 @@ var TabProduct = function TabProduct(props) {
66
91
  var topMostEntry = enteringEntries.reduce(function (top, current) {
67
92
  return current.boundingClientRect.top < top.boundingClientRect.top ? current : top;
68
93
  });
69
- var _topMostEntry$target$ = topMostEntry === null || topMostEntry === void 0 || (_topMostEntry$target = topMostEntry.target) === null || _topMostEntry$target === void 0 || (_topMostEntry$target = _topMostEntry$target.id) === null || _topMostEntry$target === void 0 ? void 0 : _topMostEntry$target.split('-'),
70
- _topMostEntry$target$2 = _slicedToArray(_topMostEntry$target$, 2),
71
- name = _topMostEntry$target$2[0],
72
- id = _topMostEntry$target$2[1];
73
- var newGroupId = Number(id);
74
- setCurrentGroupId(newGroupId);
75
- debouncedScroll.run(id);
76
- // tabsRef?.current?.scroll(id);
94
+ var targetId = topMostEntry === null || topMostEntry === void 0 || (_topMostEntry$target = topMostEntry.target) === null || _topMostEntry$target === void 0 ? void 0 : _topMostEntry$target.id;
95
+ if (targetId) {
96
+ var _targetId$split = targetId.split('-'),
97
+ _targetId$split2 = _slicedToArray(_targetId$split, 2),
98
+ name = _targetId$split2[0],
99
+ id = _targetId$split2[1];
100
+ var newGroupId = Number(id);
101
+ if (!tabLocatingRef.current && !isNaN(newGroupId)) {
102
+ setCurrentGroupId(newGroupId);
103
+ debouncedScroll.run(id);
104
+ }
105
+ }
77
106
  }
78
107
  }, {
79
108
  root: null,
80
109
  rootMargin: _rootMargin
81
110
  });
82
- if (list !== null && list !== void 0 && list.length) {
111
+ if (list !== null && list !== void 0 && list.length && ioRef.current) {
83
112
  var _iterator = _createForOfIteratorHelper(list),
84
113
  _step;
85
114
  try {
@@ -87,7 +116,7 @@ var TabProduct = function TabProduct(props) {
87
116
  var item = _step.value;
88
117
  var _item = document.querySelector("#list-".concat(item.id));
89
118
  if (_item) {
90
- io.observe(_item);
119
+ ioRef.current.observe(_item);
91
120
  }
92
121
  }
93
122
  } catch (err) {
@@ -98,7 +127,7 @@ var TabProduct = function TabProduct(props) {
98
127
  }
99
128
  });
100
129
  var handleUnobserver = useMemoizedFn(function () {
101
- if (list !== null && list !== void 0 && list.length && io) {
130
+ if (list !== null && list !== void 0 && list.length && ioRef.current) {
102
131
  var _iterator2 = _createForOfIteratorHelper(list),
103
132
  _step2;
104
133
  try {
@@ -106,7 +135,7 @@ var TabProduct = function TabProduct(props) {
106
135
  var item = _step2.value;
107
136
  var _item = document.querySelector("#list-".concat(item.id));
108
137
  if (_item) {
109
- io.unobserve(_item);
138
+ ioRef.current.unobserve(_item);
110
139
  }
111
140
  }
112
141
  } catch (err) {
@@ -115,6 +144,11 @@ var TabProduct = function TabProduct(props) {
115
144
  _iterator2.f();
116
145
  }
117
146
  }
147
+ // 断开观察器连接
148
+ if (ioRef.current) {
149
+ ioRef.current.disconnect();
150
+ ioRef.current = null;
151
+ }
118
152
  });
119
153
  var renderContent = function renderContent() {
120
154
  if (loading) {
@@ -130,7 +164,7 @@ var TabProduct = function TabProduct(props) {
130
164
  return list.map(function (item, i) {
131
165
  return /*#__PURE__*/React.createElement("div", {
132
166
  id: "list-".concat(item.id),
133
- key: i
167
+ key: "list-".concat(item.id)
134
168
  }, /*#__PURE__*/React.createElement(ProductGroup, _extends({
135
169
  onSelectProduct: onChange,
136
170
  currentProductId: currentProductId,
@@ -157,7 +191,7 @@ var TabProduct = function TabProduct(props) {
157
191
  shape: 'round'
158
192
  })));
159
193
  }, []);
160
- return /*#__PURE__*/React.createElement(React.Fragment, null, showTab ? /*#__PURE__*/React.createElement("div", {
194
+ return /*#__PURE__*/React.createElement(React.Fragment, null, showTab && list && list.length > 1 ? /*#__PURE__*/React.createElement("div", {
161
195
  className: "pisell-product-select-tabs-wrapper"
162
196
  }, loading ? tabSkeleton : /*#__PURE__*/React.createElement(Tabs, {
163
197
  ref: tabsRef,
@@ -165,31 +199,61 @@ var TabProduct = function TabProduct(props) {
165
199
  rowKey: 'id',
166
200
  tab: currentGroupId,
167
201
  onChange: function onChange(e) {
168
- var _document, _document2;
169
- var comWrapper = document.querySelector('.pisell-product-select-wrapper');
170
- var categoryDom = document.querySelector('.pisell-product-select-tabs-wrapper');
171
- var wrapperOffsetTop = comWrapper.offsetTop;
172
- var top = 0;
173
- if (categoryDom) {
174
- top = categoryDom.offsetHeight;
175
- }
176
- var dom = (_document = document) === null || _document === void 0 ? void 0 : _document.querySelector('#list-' + e);
177
- var main = (_document2 = document) === null || _document2 === void 0 ? void 0 : _document2.querySelector(scrollDom);
178
- if (dom && main) {
179
- var _list$;
180
- if (e === ((_list$ = list[0]) === null || _list$ === void 0 ? void 0 : _list$.id)) {
181
- main.scrollTop = 0;
182
- } else {
183
- main.scrollTop = dom.offsetTop - top - wrapperOffsetTop;
202
+ try {
203
+ var _document, _document2, _document3;
204
+ // 获取产品选择器包装容器
205
+ var productSelectWrapper = document.querySelector('.pisell-product-select-wrapper');
206
+ // 获取标签页包装容器
207
+ var tabsWrapper = document.querySelector('.pisell-product-select-tabs-wrapper');
208
+ // 计算标签页高度,用于滚动时的偏移
209
+ var tabsHeight = 0;
210
+ if (tabsWrapper) {
211
+ tabsHeight = tabsWrapper.offsetHeight;
184
212
  }
213
+
214
+ // 获取目标列表元素和滚动容器
215
+ var targetListElement = (_document = document) === null || _document === void 0 ? void 0 : _document.querySelector('#list-' + e);
216
+ var scrollContainer = scrollDom ? (_document2 = document) === null || _document2 === void 0 ? void 0 : _document2.querySelector(scrollDom) : null;
217
+ // 获取额外偏移元素(如固定头部等)
218
+ var offsetElement = offsetDom ? (_document3 = document) === null || _document3 === void 0 ? void 0 : _document3.querySelector(offsetDom) : null;
219
+ var extraOffset = offsetElement ? offsetElement.clientHeight : 0;
220
+
221
+ // 停止观察器,防止滚动时触发tab切换
222
+ handleUnobserver();
223
+ // 标记正在进行tab定位,避免滚动时的干扰
224
+ tabLocatingRef.current = true;
225
+ if (targetListElement && scrollContainer) {
226
+ var _list$;
227
+ if (e === ((_list$ = list[0]) === null || _list$ === void 0 ? void 0 : _list$.id)) {
228
+ // 如果是第一个tab,滚动到产品选择器包装容器的位置
229
+ if (productSelectWrapper) {
230
+ var wrapperOffsetTop = getOffsetTopRelativeToScrollContainer(productSelectWrapper, scrollContainer);
231
+ scrollContainer.scrollTop = wrapperOffsetTop - extraOffset;
232
+ }
233
+ } else {
234
+ // 其他tab,滚动到对应列表元素位置,需要减去标签页高度
235
+ var listOffsetTop = getOffsetTopRelativeToScrollContainer(targetListElement, scrollContainer);
236
+ scrollContainer.scrollTop = listOffsetTop - tabsHeight - extraOffset;
237
+ }
238
+ }
239
+
240
+ // 更新当前选中的分组ID
241
+ setCurrentGroupId(e);
242
+ // 触发防抖滚动
243
+ debouncedScroll.run(e);
244
+ // 延迟恢复观察器
245
+ setTimeout(function () {
246
+ tabLocatingRef.current = false;
247
+ handleObserver();
248
+ }, 500);
249
+ } catch (error) {
250
+ console.error('Tab onChange error:', error);
251
+ // 即使出错也要恢复状态
252
+ tabLocatingRef.current = false;
253
+ setCurrentGroupId(e);
185
254
  }
186
- handleUnobserver();
187
- setCurrentGroupId(e);
188
- setTimeout(function () {
189
- handleObserver();
190
- }, 1000);
191
255
  }
192
- })) : null, /*#__PURE__*/React.createElement("div", {
256
+ })) : /*#__PURE__*/React.createElement("p", null, /*#__PURE__*/React.createElement("br", null)), /*#__PURE__*/React.createElement("div", {
193
257
  className: "pisell-product-select-product-list"
194
258
  }, renderContent()));
195
259
  };
@@ -107,6 +107,7 @@
107
107
  text-overflow: ellipsis;
108
108
  overflow: hidden;
109
109
  white-space: nowrap;
110
+ user-select: none;
110
111
  }
111
112
 
112
113
  &:hover {
@@ -14,6 +14,8 @@ interface ProductSelectProps {
14
14
  value?: number;
15
15
  loading?: boolean;
16
16
  scrollDom?: string;
17
+ /** 某些设置了固定头部的情况 */
18
+ offsetDom?: string;
17
19
  style?: React.CSSProperties;
18
20
  emptyDescription?: string;
19
21
  token?: Partial<ProductSelectToken>;
@@ -33,7 +33,7 @@ import { addService, addServiceScroll, genServiceKey, getIsShowNumber } from "..
33
33
  import NotAvailable from "../notAvailable";
34
34
  import dayjs from 'dayjs';
35
35
  var AddSerivce = function AddSerivce(props) {
36
- var _context$appHelper, _context$appHelper$ut, _context$appHelper$ut2, _state$bookingConfig2, _state$client2, _state$service3, _state$service4;
36
+ var _context$appHelper, _context$appHelper$ut, _context$appHelper$ut2, _context$appHelper$ut3, _state$bookingConfig2, _state$client2, _state$service3, _state$service4;
37
37
  var onEdit = props.onEdit,
38
38
  state = props.state,
39
39
  dispatch = props.dispatch,
@@ -56,7 +56,7 @@ var AddSerivce = function AddSerivce(props) {
56
56
  }),
57
57
  createBookingData = _useService.createBookingData,
58
58
  createBooking = _useService.createBooking;
59
- var isBooking4 = isBooking4Shop((_context$appHelper$ut = context.appHelper.utils.store) === null || _context$appHelper$ut === void 0 || (_context$appHelper$ut2 = _context$appHelper$ut.getState) === null || _context$appHelper$ut2 === void 0 || (_context$appHelper$ut2 = _context$appHelper$ut2.call(_context$appHelper$ut)) === null || _context$appHelper$ut2 === void 0 || (_context$appHelper$ut2 = _context$appHelper$ut2.global) === null || _context$appHelper$ut2 === void 0 || (_context$appHelper$ut2 = _context$appHelper$ut2.globalConfig) === null || _context$appHelper$ut2 === void 0 ? void 0 : _context$appHelper$ut2.id, state === null || state === void 0 ? void 0 : state.renderType);
59
+ var isBooking4 = isBooking4Shop((_context$appHelper$ut = context.appHelper.utils.store) === null || _context$appHelper$ut === void 0 || (_context$appHelper$ut2 = _context$appHelper$ut.getState) === null || _context$appHelper$ut2 === void 0 || (_context$appHelper$ut2 = _context$appHelper$ut2.call(_context$appHelper$ut)) === null || _context$appHelper$ut2 === void 0 || (_context$appHelper$ut2 = _context$appHelper$ut2.global) === null || _context$appHelper$ut2 === void 0 || (_context$appHelper$ut2 = _context$appHelper$ut2.globalConfig) === null || _context$appHelper$ut2 === void 0 ? void 0 : _context$appHelper$ut2.id, state === null || state === void 0 ? void 0 : state.renderType, (_context$appHelper$ut3 = context.appHelper.utils) === null || _context$appHelper$ut3 === void 0 ? void 0 : _context$appHelper$ut3.businessUtils);
60
60
  var _useState3 = useState(null),
61
61
  _useState4 = _slicedToArray(_useState3, 2),
62
62
  currentProduct = _useState4[0],
@@ -291,7 +291,7 @@ var AddSerivce = function AddSerivce(props) {
291
291
  },
292
292
  callback: function () {
293
293
  var _callback = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(e, extension_type, detail) {
294
- var data, _detail, other, cacheItem, _total, _isEdit, _state$service$cacheI, _Toast$success, _addService, _list, quantity, _context$appHelper$ut3, _context$appHelper$ut4, val, sendData;
294
+ var data, _detail, other, cacheItem, _total, _isEdit, _state$service$cacheI, _Toast$success, _addService, _list, quantity, _context$appHelper$ut4, _context$appHelper$ut5, val, sendData;
295
295
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
296
296
  while (1) switch (_context3.prev = _context3.next) {
297
297
  case 0:
@@ -379,7 +379,7 @@ var AddSerivce = function AddSerivce(props) {
379
379
  }, locales.getText('pisell2.ticket-booking.in-cart')(quantity || 1))));
380
380
  addServiceScroll(e.rowKey, cacheItem);
381
381
  try {
382
- if (((_context$appHelper$ut3 = context.appHelper.utils.store) === null || _context$appHelper$ut3 === void 0 || (_context$appHelper$ut4 = _context$appHelper$ut3.getState) === null || _context$appHelper$ut4 === void 0 || (_context$appHelper$ut4 = _context$appHelper$ut4.call(_context$appHelper$ut3)) === null || _context$appHelper$ut4 === void 0 || (_context$appHelper$ut4 = _context$appHelper$ut4.global) === null || _context$appHelper$ut4 === void 0 || (_context$appHelper$ut4 = _context$appHelper$ut4.globalConfig) === null || _context$appHelper$ut4 === void 0 ? void 0 : _context$appHelper$ut4.id) === 2155) {
382
+ if (((_context$appHelper$ut4 = context.appHelper.utils.store) === null || _context$appHelper$ut4 === void 0 || (_context$appHelper$ut5 = _context$appHelper$ut4.getState) === null || _context$appHelper$ut5 === void 0 || (_context$appHelper$ut5 = _context$appHelper$ut5.call(_context$appHelper$ut4)) === null || _context$appHelper$ut5 === void 0 || (_context$appHelper$ut5 = _context$appHelper$ut5.global) === null || _context$appHelper$ut5 === void 0 || (_context$appHelper$ut5 = _context$appHelper$ut5.globalConfig) === null || _context$appHelper$ut5 === void 0 ? void 0 : _context$appHelper$ut5.id) === 2155) {
383
383
  val = _list === null || _list === void 0 ? void 0 : _list.map(function (s) {
384
384
  return {
385
385
  product_id: s === null || s === void 0 ? void 0 : s.product_id,
@@ -141,7 +141,7 @@ var DEFAULT_BALANCE = {
141
141
  discount_card_count: 0
142
142
  };
143
143
  var WalletList = Provider(function (props) {
144
- var _utils$getStore, _dvaStore$core, _store$getState;
144
+ var _utils$getStore, _context$engine, _store$getState;
145
145
  var _props$globalState = props.globalState,
146
146
  globalState = _props$globalState === void 0 ? {} : _props$globalState; // 接收globalState属性
147
147
  var _useContext = useContext(Context),
@@ -152,8 +152,8 @@ var WalletList = Provider(function (props) {
152
152
  constants = _ref.constants,
153
153
  utils = _ref.utils;
154
154
  var dvaStore = utils === null || utils === void 0 || (_utils$getStore = utils.getStore) === null || _utils$getStore === void 0 || (_utils$getStore = _utils$getStore.call(utils)) === null || _utils$getStore === void 0 ? void 0 : _utils$getStore.getState();
155
- locales.init(localeTexts, (dvaStore === null || dvaStore === void 0 || (_dvaStore$core = dvaStore.core) === null || _dvaStore$core === void 0 ? void 0 : _dvaStore$core.translateLocale) || 'en');
156
155
  // 添加组件挂载状态引用
156
+ locales.init(localeTexts, (context === null || context === void 0 || (_context$engine = context.engine) === null || _context$engine === void 0 || (_context$engine = _context$engine.props) === null || _context$engine === void 0 ? void 0 : _context$engine.locale) || 'en'); // 添加组件挂载状态引用
157
157
  var isMountedRef = useRef(true);
158
158
  var carouselRef = useRef(null);
159
159
  var store = utils.store;
@@ -587,7 +587,7 @@ var WalletList = Provider(function (props) {
587
587
  };
588
588
  }();
589
589
  var renderWalletCard = function renderWalletCard(item) {
590
- var _dvaStore$core2;
590
+ var _dvaStore$core;
591
591
  var code = item.code,
592
592
  shop = item.shop,
593
593
  wallet = item.wallet,
@@ -643,7 +643,7 @@ var WalletList = Provider(function (props) {
643
643
  iconImg: icon,
644
644
  symbol: symbol,
645
645
  cardNo: code,
646
- walletName: getLocalizedName(name, dvaStore === null || dvaStore === void 0 || (_dvaStore$core2 = dvaStore.core) === null || _dvaStore$core2 === void 0 ? void 0 : _dvaStore$core2.translateLocale),
646
+ walletName: getLocalizedName(name, dvaStore === null || dvaStore === void 0 || (_dvaStore$core = dvaStore.core) === null || _dvaStore$core === void 0 ? void 0 : _dvaStore$core.translateLocale),
647
647
  shopName: shopName,
648
648
  codeType: barcodetype,
649
649
  items: cardItems,
@@ -98,6 +98,7 @@ var CartItem = ({ onNext }) => {
98
98
  ...resourceOtherParams,
99
99
  errorList: null
100
100
  });
101
+ val.like_status = "like";
101
102
  appointmentBooking.updateCart({
102
103
  _id: e == null ? void 0 : e._id,
103
104
  resources: (0, import_utils2.updateCartResources)(e, val, currentSelectedResources)
@@ -1,5 +1,5 @@
1
1
  .appointment-cart-item-wrap {
2
- height: calc(100vh - 100px);
2
+ height: calc(var(--vh, 1vh) * 100 - 100px);
3
3
  display: flex;
4
4
  flex-direction: column;
5
5
 
@@ -39,7 +39,7 @@
39
39
  flex-direction: column;
40
40
  align-items: start;
41
41
 
42
- >div {
42
+ > div {
43
43
  display: flex;
44
44
  align-items: center;
45
45
  justify-content: space-between;
@@ -105,4 +105,4 @@
105
105
  flex: none;
106
106
  z-index: 10;
107
107
  }
108
- }
108
+ }
@@ -25,7 +25,6 @@ __export(utils_exports, {
25
25
  handleAddHolder: () => handleAddHolder
26
26
  });
27
27
  module.exports = __toCommonJS(utils_exports);
28
- var import_utils = require("../../utils");
29
28
  var checkLogin = async ({
30
29
  isLogin,
31
30
  openLoginModal,
@@ -38,16 +37,7 @@ var checkLogin = async ({
38
37
  if (!isLogin) {
39
38
  openLoginModal({
40
39
  callback: (status) => {
41
- var _a;
42
40
  if (status === "success") {
43
- if (!isFormSubject) {
44
- const user = JSON.parse(((_a = utils == null ? void 0 : utils.storage) == null ? void 0 : _a.get("customer")) || "{}");
45
- const currentUser = (0, import_utils.formatCustomer)(user);
46
- const meAccount = accountLists == null ? void 0 : accountLists.find((d) => !(d == null ? void 0 : d.isGuest));
47
- appointmentBooking.setLoginAccount(meAccount == null ? void 0 : meAccount.id, currentUser);
48
- } else {
49
- getHolders();
50
- }
51
41
  }
52
42
  }
53
43
  });