@pisell/private-materials 3.0.201 → 3.0.203

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 (129) 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 +142 -142
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +12 -27
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +18 -33
  11. package/es/components/booking/addons/model.d.ts +1 -1
  12. package/es/components/booking/components/footer/amount.js +5 -4
  13. package/es/components/booking/components/footer/utils.js +49 -29
  14. package/es/components/booking/forms/model.d.ts +1 -1
  15. package/es/components/booking/info/Provider.d.ts +0 -0
  16. package/es/components/booking/info/Provider.js +54 -0
  17. package/es/components/booking/info/clientVariant/vertical/index.js +93 -7
  18. package/es/components/booking/info/main.js +10 -9
  19. package/es/components/booking/info/pet/ChangePetModal/index.js +38 -23
  20. package/es/components/booking/info/service/addService/index.js +70 -99
  21. package/es/components/booking/info/service/addService/utils.d.ts +1 -0
  22. package/es/components/booking/info/service/addService/utils.js +55 -3
  23. package/es/components/booking/info/service/editService/BookingList/index.d.ts +5 -0
  24. package/es/components/booking/info/service/editService/BookingList/index.js +39 -0
  25. package/es/components/booking/info/service/editService/EditTabs/index.d.ts +3 -0
  26. package/es/components/booking/info/service/editService/EditTabs/index.js +35 -0
  27. package/es/components/booking/info/service/editService/index.js +234 -142
  28. package/es/components/booking/info/service/serve.d.ts +10 -0
  29. package/es/components/booking/info/service/serve.js +28 -0
  30. package/es/components/booking/info/service/serviceManager/distributeDiscount.d.ts +11 -0
  31. package/es/components/booking/info/service/serviceManager/distributeDiscount.js +55 -0
  32. package/es/components/booking/info/service/serviceManager/index.d.ts +20 -0
  33. package/es/components/booking/info/service/serviceManager/index.js +277 -0
  34. package/es/components/booking/info/service/serviceManager/utils.d.ts +0 -0
  35. package/es/components/booking/info/service/serviceManager/utils.js +0 -0
  36. package/es/components/booking/info/service2/Group/utils.d.ts +14 -0
  37. package/es/components/booking/info/service2/Group/utils.js +146 -0
  38. package/es/components/booking/info/service2/Lists.js +27 -33
  39. package/es/components/booking/info/service2/index.d.ts +4 -1
  40. package/es/components/booking/info/service2/index.js +5 -6
  41. package/es/components/booking/info/service2/status.js +1 -1
  42. package/es/components/booking/info/service2/utils.d.ts +95 -3
  43. package/es/components/booking/info/service2/utils.js +678 -52
  44. package/es/components/booking/info/utils.d.ts +11 -0
  45. package/es/components/booking/info/utils.js +24 -0
  46. package/es/components/booking/locales.d.ts +6 -0
  47. package/es/components/booking/locales.js +9 -3
  48. package/es/components/booking/model.d.ts +1 -0
  49. package/es/components/booking/notes/index.d.ts +1 -1
  50. package/es/components/booking/notes/model.d.ts +1 -1
  51. package/es/components/booking/payments/index.d.ts +1 -1
  52. package/es/components/booking/payments/model.d.ts +1 -1
  53. package/es/components/booking/utils.js +5 -4
  54. package/es/components/eftpos/hooks.d.ts +4 -4
  55. package/es/components/eftposPay/amount.d.ts +1 -1
  56. package/es/components/eftposPay/component/step/index.d.ts +6 -6
  57. package/es/components/eftposPay/component/step/step.d.ts +4 -4
  58. package/es/components/eftposPay/hooks.d.ts +1 -1
  59. package/es/components/eftposPay/store/index.d.ts +1 -1
  60. package/es/components/eftposPay/tyro/hooks.d.ts +2 -2
  61. package/es/components/eftposPay/windcave/helper.d.ts +1 -1
  62. package/es/components/schedules/index.d.ts +1 -1
  63. package/es/components/schedules/model.d.ts +1 -1
  64. package/es/components/shoppingCart/components/Cart/Product.js +11 -39
  65. package/es/components/shoppingCart/components/Render/index.js +8 -7
  66. package/es/components/shoppingCart/components/SelectHolderModal/index.js +12 -4
  67. package/es/components/shoppingCart/hooks/useClearCart.js +10 -5
  68. package/es/components/shoppingCart/type.d.ts +1 -1
  69. package/es/components/shoppingCart/utils.js +2 -5
  70. package/lib/components/booking/addons/model.d.ts +1 -1
  71. package/lib/components/booking/components/footer/amount.js +4 -3
  72. package/lib/components/booking/components/footer/utils.js +28 -28
  73. package/lib/components/booking/forms/model.d.ts +1 -1
  74. package/lib/components/booking/info/Provider.d.ts +0 -0
  75. package/lib/components/booking/info/Provider.js +0 -0
  76. package/lib/components/booking/info/clientVariant/vertical/index.js +51 -1
  77. package/lib/components/booking/info/main.js +6 -5
  78. package/lib/components/booking/info/pet/ChangePetModal/index.js +33 -23
  79. package/lib/components/booking/info/service/addService/index.js +50 -92
  80. package/lib/components/booking/info/service/addService/utils.d.ts +1 -0
  81. package/lib/components/booking/info/service/addService/utils.js +27 -0
  82. package/lib/components/booking/info/service/editService/BookingList/index.d.ts +5 -0
  83. package/lib/components/booking/info/service/editService/BookingList/index.js +55 -0
  84. package/lib/components/booking/info/service/editService/EditTabs/index.d.ts +3 -0
  85. package/lib/components/booking/info/service/editService/EditTabs/index.js +75 -0
  86. package/lib/components/booking/info/service/editService/index.js +309 -234
  87. package/lib/components/booking/info/service/serve.d.ts +10 -0
  88. package/lib/components/booking/info/service/serve.js +7 -2
  89. package/lib/components/booking/info/service/serviceManager/distributeDiscount.d.ts +11 -0
  90. package/lib/components/booking/info/service/serviceManager/distributeDiscount.js +70 -0
  91. package/lib/components/booking/info/service/serviceManager/index.d.ts +20 -0
  92. package/lib/components/booking/info/service/serviceManager/index.js +207 -0
  93. package/lib/components/booking/info/service/serviceManager/utils.d.ts +0 -0
  94. package/lib/components/booking/info/service/serviceManager/utils.js +0 -0
  95. package/lib/components/booking/info/service2/Group/utils.d.ts +14 -0
  96. package/lib/components/booking/info/service2/Group/utils.js +142 -0
  97. package/lib/components/booking/info/service2/Lists.js +14 -12
  98. package/lib/components/booking/info/service2/index.d.ts +4 -1
  99. package/lib/components/booking/info/service2/index.js +5 -5
  100. package/lib/components/booking/info/service2/status.js +1 -1
  101. package/lib/components/booking/info/service2/utils.d.ts +95 -3
  102. package/lib/components/booking/info/service2/utils.js +404 -48
  103. package/lib/components/booking/info/utils.d.ts +11 -0
  104. package/lib/components/booking/info/utils.js +35 -0
  105. package/lib/components/booking/locales.d.ts +6 -0
  106. package/lib/components/booking/locales.js +9 -3
  107. package/lib/components/booking/model.d.ts +1 -0
  108. package/lib/components/booking/notes/index.d.ts +1 -1
  109. package/lib/components/booking/notes/model.d.ts +1 -1
  110. package/lib/components/booking/payments/index.d.ts +1 -1
  111. package/lib/components/booking/payments/model.d.ts +1 -1
  112. package/lib/components/booking/utils.js +3 -4
  113. package/lib/components/eftpos/hooks.d.ts +4 -4
  114. package/lib/components/eftposPay/amount.d.ts +1 -1
  115. package/lib/components/eftposPay/component/step/index.d.ts +6 -6
  116. package/lib/components/eftposPay/component/step/step.d.ts +4 -4
  117. package/lib/components/eftposPay/hooks.d.ts +1 -1
  118. package/lib/components/eftposPay/store/index.d.ts +1 -1
  119. package/lib/components/eftposPay/tyro/hooks.d.ts +2 -2
  120. package/lib/components/eftposPay/windcave/helper.d.ts +1 -1
  121. package/lib/components/schedules/index.d.ts +1 -1
  122. package/lib/components/schedules/model.d.ts +1 -1
  123. package/lib/components/shoppingCart/components/Cart/Product.js +6 -22
  124. package/lib/components/shoppingCart/components/Render/index.js +6 -10
  125. package/lib/components/shoppingCart/components/SelectHolderModal/index.js +12 -4
  126. package/lib/components/shoppingCart/hooks/useClearCart.js +4 -9
  127. package/lib/components/shoppingCart/type.d.ts +1 -1
  128. package/lib/components/shoppingCart/utils.js +2 -8
  129. package/package.json +4 -4
@@ -22,6 +22,16 @@ export declare const isInterval: (time1: number, time2: number, interval?: numbe
22
22
  */
23
23
  export declare const formatServiceListByTime: (list: any[]) => any[];
24
24
  export declare const isBooking4Shop: (shopId: number, renderType?: string) => boolean;
25
+ declare type DataEntry = {
26
+ total: number;
27
+ origin_total: number;
28
+ num: number;
29
+ quotation_id: number;
30
+ start_date: string;
31
+ end_date: string;
32
+ };
33
+ declare type ResultStructure = Record<string, Record<string, any>>;
34
+ export declare const getMultiDayPrices: (data: DataEntry[]) => ResultStructure;
25
35
  /**
26
36
  * @title: 是否是跨日预约
27
37
  * @description:
@@ -31,3 +41,4 @@ export declare const isBooking4Shop: (shopId: number, renderType?: string) => bo
31
41
  * @Date: 2024-11-29 11:19
32
42
  */
33
43
  export declare const isDayBooking: (shopId: number) => boolean;
44
+ export {};
@@ -4,6 +4,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
4
4
  function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
5
5
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
6
6
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
7
+ import dayjs from "dayjs";
7
8
  // 商品是套餐或单规格多规格
8
9
  export var getIsBundleOrCombination = function getIsBundleOrCombination(productDetail) {
9
10
  var _productDetail$bundle;
@@ -48,6 +49,10 @@ export var moveItemToFront = function moveItemToFront(arr, targetId) {
48
49
  */
49
50
  export var isInterval = function isInterval(time1, time2) {
50
51
  var interval = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1000;
52
+ // 相同的为复制的, 不影响
53
+ if (time2 === time1) {
54
+ return false;
55
+ }
51
56
  return Math.abs(time2 - time1) < interval;
52
57
  };
53
58
 
@@ -91,6 +96,25 @@ export var isBooking4Shop = function isBooking4Shop(shopId, renderType) {
91
96
  var booking4Shops = [1350, 1401, 3013, 7154, 7572, 7007, 8119, 7320, 7362, 6497, 6087, 6303, 6726, 8191];
92
97
  return booking4Shops.includes(shopId);
93
98
  };
99
+ function generateDateRange(start, end) {
100
+ var dateRange = [];
101
+ var currentDate = dayjs(start);
102
+ while (currentDate.isBefore(dayjs(end).add(1, "day"))) {
103
+ dateRange.push(currentDate.format("YYYY-MM-DD"));
104
+ currentDate = currentDate.add(1, "day");
105
+ }
106
+ return dateRange;
107
+ }
108
+ export var getMultiDayPrices = function getMultiDayPrices(data) {
109
+ var result = {};
110
+ data.forEach(function (entry) {
111
+ var dateRange = generateDateRange(entry.start_date, entry.end_date);
112
+ dateRange.forEach(function (date) {
113
+ result[date] = entry;
114
+ });
115
+ });
116
+ return result;
117
+ };
94
118
 
95
119
  /**
96
120
  * @title: 是否是跨日预约
@@ -238,6 +238,8 @@ declare const _default: {
238
238
  'pisell2.text.change.pet.content1': string;
239
239
  'pisell2.text.change.pet.confirm': string;
240
240
  'pisell2.text.change.pet.cancel': string;
241
+ 'pisell2.text.booking-list': string;
242
+ 'pisell2.text.edit-booking': string;
241
243
  };
242
244
  'zh-CN': {
243
245
  'pisell2.text.refunded-amount': string;
@@ -478,6 +480,8 @@ declare const _default: {
478
480
  'pisell2.text.change.pet.content1': string;
479
481
  'pisell2.text.change.pet.confirm': string;
480
482
  'pisell2.text.change.pet.cancel': string;
483
+ 'pisell2.text.booking-list': string;
484
+ 'pisell2.text.edit-booking': string;
481
485
  };
482
486
  'zh-HK': {
483
487
  'pisell2.text.refunded-amount': string;
@@ -718,6 +722,8 @@ declare const _default: {
718
722
  'pisell2.text.change.pet.content1': string;
719
723
  'pisell2.text.change.pet.confirm': string;
720
724
  'pisell2.text.change.pet.cancel': string;
725
+ 'pisell2.text.booking-list': string;
726
+ 'pisell2.text.edit-booking': string;
721
727
  };
722
728
  };
723
729
  export default _default;
@@ -274,7 +274,9 @@ export default {
274
274
  'pisell2.text.change.pet.content': 'Selecting “Keep” will move the items to Open Items. Selecting “Discard” will clear all items under the holder’s name.',
275
275
  'pisell2.text.change.pet.content1': 'Reservation-type items cannot be added to the Open Items cart and will be removed.',
276
276
  'pisell2.text.change.pet.confirm': 'Keep (Add to open items)',
277
- 'pisell2.text.change.pet.cancel': 'Discard (Clear items)'
277
+ 'pisell2.text.change.pet.cancel': 'Discard (Clear items)',
278
+ 'pisell2.text.booking-list': "List",
279
+ 'pisell2.text.edit-booking': "Edit"
278
280
  },
279
281
  'zh-CN': {
280
282
  'pisell2.text.refunded-amount': '已退金额',
@@ -555,7 +557,9 @@ export default {
555
557
  'pisell2.text.change.pet.content': '选择“保留”将商品添加到未分配商品(公共购物车)中;选择“不保留”将清空该持有人名下的所有商品。',
556
558
  'pisell2.text.change.pet.content1': '预约类商品无法添加到公共购物车,将会被删除。',
557
559
  'pisell2.text.change.pet.confirm': '保留(添加到未分配中)',
558
- 'pisell2.text.change.pet.cancel': '不保留(清空商品)'
560
+ 'pisell2.text.change.pet.cancel': '不保留(清空商品)',
561
+ 'pisell2.text.booking-list': "列表",
562
+ 'pisell2.text.edit-booking': "编辑"
559
563
  },
560
564
  'zh-HK': {
561
565
  'pisell2.text.refunded-amount': '已退金額',
@@ -836,6 +840,8 @@ export default {
836
840
  'pisell2.text.change.pet.content': '選擇“保留”將商品添加到未分配商品(公共購物車)中;選擇“不保留”將清空該持有人名下的所有商品。',
837
841
  'pisell2.text.change.pet.content1': '預約類商品無法添加到公共購物車,將會被刪除。',
838
842
  'pisell2.text.change.pet.confirm': '保留(添加到未分配中)',
839
- 'pisell2.text.change.pet.cancel': '不保留(清空商品)'
843
+ 'pisell2.text.change.pet.cancel': '不保留(清空商品)',
844
+ 'pisell2.text.booking-list': "列表",
845
+ 'pisell2.text.edit-booking': "編輯"
840
846
  }
841
847
  };
@@ -99,6 +99,7 @@ export interface FormState {
99
99
  loading: boolean;
100
100
  isTerminalDayBookingPage?: boolean;
101
101
  activeCartId?: any[];
102
+ isDayBooking: boolean;
102
103
  }
103
104
  export declare const walkInData: {
104
105
  id: number;
@@ -4,5 +4,5 @@ export interface InfoProps {
4
4
  globalState: any;
5
5
  setGlobalState: any;
6
6
  }
7
- declare const Notes: (props: any) => any;
7
+ declare const Notes: any;
8
8
  export default Notes;
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { FormState } from "../model";
3
- export declare const Provider: (ComponentUi: any) => (props: any) => any, Context: import("react").Context<{
3
+ export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
4
4
  state: FormState;
5
5
  } & {
6
6
  dispatch: (params: {
@@ -5,5 +5,5 @@ export interface InfoProps {
5
5
  globalState: any;
6
6
  setGlobalState: any;
7
7
  }
8
- declare const Payments: (props: any) => any;
8
+ declare const Payments: any;
9
9
  export default Payments;
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { FormState } from "../model";
3
- export declare const Provider: (ComponentUi: any) => (props: any) => any, Context: import("react").Context<{
3
+ export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
4
4
  state: FormState;
5
5
  } & {
6
6
  dispatch: (params: {
@@ -695,12 +695,15 @@ export var getServerItemExtend = function getServerItemExtend(state, cacheItem,
695
695
 
696
696
  // 跨日预约
697
697
  if (isDay) {
698
+ _extend.end_date = dayjs(_extend.start_date).add(_extend.duration, 'day');
698
699
  var _formatDayDate2 = formatDayDate(_extend),
699
700
  start_date = _formatDayDate2.start_date,
700
701
  end_date = _formatDayDate2.end_date;
701
702
  _extend = _objectSpread(_objectSpread({}, _extend), {}, {
702
703
  start_date: start_date,
703
- end_date: end_date
704
+ startDate: start_date,
705
+ end_date: end_date,
706
+ endDate: end_date
704
707
  });
705
708
  }
706
709
  return _extend;
@@ -709,8 +712,7 @@ export var getServerItemExtend = function getServerItemExtend(state, cacheItem,
709
712
  // 商品价格: (商品价格 + (套餐价格 + 单规格价格 * 单规格数量) * 套餐数量 + 单规格价格 * 单规格数量) * 商品数量
710
713
  export var getProductTotalPrice = function getProductTotalPrice(item) {
711
714
  var _item$_extend;
712
- var price = 0;
713
- price += Number(item._extend.price);
715
+ var price = Number(item._extend.price);
714
716
  var other = (_item$_extend = item._extend) === null || _item$_extend === void 0 ? void 0 : _item$_extend.other;
715
717
 
716
718
  // 多规格
@@ -730,7 +732,6 @@ export var getProductTotalPrice = function getProductTotalPrice(item) {
730
732
  return accumulator + Number(currentValue.price) * Number(currentValue.num);
731
733
  }, price);
732
734
  }
733
- price = price;
734
735
  return price;
735
736
  };
736
737
  /**
@@ -6,8 +6,8 @@ import { Eftpos } from './const';
6
6
  * @Date: 2024-08-20 13:23
7
7
  */
8
8
  export declare const usePairTerminalo: (type: Eftpos, params: {
9
- url?: string | undefined;
10
- version?: string | undefined;
9
+ url?: string;
10
+ version?: string;
11
11
  }) => ({ mid, tid, apiKey, posProductData, }: {
12
12
  mid: string;
13
13
  tid: string;
@@ -29,6 +29,6 @@ export declare const usePairTerminalo: (type: Eftpos, params: {
29
29
  * @Date: 2024-08-19 18:36
30
30
  */
31
31
  export declare const useTyro: (params: {
32
- url?: string | undefined;
33
- version?: string | undefined;
32
+ url?: string;
33
+ version?: string;
34
34
  }) => readonly [import("react").MutableRefObject<any>, boolean];
@@ -9,7 +9,7 @@ import { PosProps } from './const';
9
9
  */
10
10
  declare const _default: ({ className, onChange, onClose, formatAmount, isMobile, net, client }: {
11
11
  className?: string | undefined;
12
- onChange?: ((status: "page" | "success" | "fail", params?: string | {
12
+ onChange?: ((status: "page" | "success" | "print" | "fail" | "mark_tx_processed", params?: string | {
13
13
  [keys: string]: unknown;
14
14
  } | undefined, other?: any) => void) | undefined;
15
15
  onClose: () => void;
@@ -2,11 +2,11 @@ import React from 'react';
2
2
  import { StatusType } from '../../const';
3
3
  declare const _default: (props: {
4
4
  status: StatusType;
5
- warn?: string | undefined;
6
- text?: string | undefined;
7
- tip?: string | undefined;
8
- loading?: string | undefined;
9
- success?: string | undefined;
10
- fail?: string | undefined;
5
+ warn?: string;
6
+ text?: string;
7
+ tip?: string;
8
+ loading?: string;
9
+ success?: string;
10
+ fail?: string;
11
11
  }) => React.JSX.Element;
12
12
  export default _default;
@@ -1,9 +1,9 @@
1
1
  import React from 'react';
2
2
  declare const _default: (props: {
3
3
  status: string;
4
- pedding?: string | undefined;
5
- resolve?: string | undefined;
6
- reject?: string | undefined;
7
- className?: string | undefined;
4
+ pedding?: string;
5
+ resolve?: string;
6
+ reject?: string;
7
+ className?: string;
8
8
  }) => React.JSX.Element;
9
9
  export default _default;
@@ -30,5 +30,5 @@ export declare const useStoreRef: <T extends {
30
30
  * @Date: 2024-08-12 11:54
31
31
  */
32
32
  export declare const useFail: (index: number) => (res: {
33
- code?: "200" | "4004" | "701000" | "701001" | "701003" | "701004" | "701005" | "701006" | "701007" | "701008" | "701009" | "701010" | undefined;
33
+ code?: `${PayStatus}`;
34
34
  }, isMark?: boolean) => void;
@@ -297,7 +297,7 @@ export declare const backUpFree: (payload: Partial<State>) => {
297
297
  amount?: string | number | undefined;
298
298
  mode?: "refund" | "pay" | "fullPay" | "query" | undefined;
299
299
  order_id?: string | number | undefined;
300
- eftpos?: "payo" | "tyro" | "windcave" | "stripe" | undefined;
300
+ eftpos?: "tyro" | "windcave" | "payo" | "stripe" | undefined;
301
301
  action?: "amount" | "deviceList" | "pay" | undefined;
302
302
  key?: number | undefined;
303
303
  step?: number | undefined;
@@ -9,6 +9,6 @@
9
9
  * @Date: 2024-08-19 18:36
10
10
  */
11
11
  export declare const useTyro: (params: {
12
- url?: string | undefined;
13
- version?: string | undefined;
12
+ url?: string;
13
+ version?: string;
14
14
  }) => readonly [import("react").MutableRefObject<any>, boolean];
@@ -9,7 +9,7 @@ import XhrTimer from './timer';
9
9
  * @Date: 2024-08-12 10:29
10
10
  */
11
11
  export declare const useFail: () => (res: {
12
- code?: "200" | "4004" | "701000" | "701001" | "701003" | "701004" | "701005" | "701006" | "701007" | "701008" | "701009" | "701010" | undefined;
12
+ code?: `${PayStatus}`;
13
13
  }, isMark?: boolean) => void;
14
14
  /**
15
15
  * @title: 轮询 check 接口
@@ -1,3 +1,3 @@
1
1
  import "./index.less";
2
- declare const Schedules: (props: any) => any;
2
+ declare const Schedules: any;
3
3
  export default Schedules;
@@ -69,7 +69,7 @@ export interface FormState {
69
69
  };
70
70
  setGlobalState: Function | null;
71
71
  }
72
- export declare const Provider: (ComponentUi: any) => (props: any) => any, Context: import("react").Context<{
72
+ export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
73
73
  state: FormState;
74
74
  } & {
75
75
  dispatch: (params: {
@@ -1,20 +1,8 @@
1
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
1
  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
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
4
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
5
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
7
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
8
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
9
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
10
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
11
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
12
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
13
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
14
2
  import React, { useMemo } from 'react';
15
3
  import { ProductCard } from '@pisell/materials';
4
+ // import ProductCard from '../../../../../../materials/src/components/productCard';
16
5
  import useClearCart from "../../hooks/useClearCart";
17
- import { updateProduct } from "../../utils";
18
6
  import { useContext } from "../../hooks/useContext";
19
7
  import useAddService from "../../hooks/useAddService";
20
8
  var Product = function Product(props) {
@@ -22,10 +10,8 @@ var Product = function Product(props) {
22
10
  lists = props.lists;
23
11
  var _useContext = useContext(),
24
12
  state = _useContext.state,
25
- updateState = _useContext.updateState,
26
13
  _onAction = _useContext.onAction,
27
- onChange = _useContext.onChange,
28
- _onCard = _useContext.onCard;
14
+ onChange = _useContext.onChange;
29
15
  var disabledEdit = state.disabledEdit,
30
16
  isShowPackageNote = state.isShowPackageNote,
31
17
  isShowNote = state.isShowNote,
@@ -40,27 +26,9 @@ var Product = function Product(props) {
40
26
  * @Author: WangHan
41
27
  * @Date: 2024-11-28 22:02
42
28
  */
43
- var handleChange = function handleChange(item, type) {
29
+ var handleChange = function handleChange(item, type, other) {
44
30
  if (disabledEdit) return;
45
- var products = _toConsumableArray(state.products);
46
-
47
- // 删除商品
48
- if (type === 'delete') {
49
- products = products.filter(function (product) {
50
- return product._id !== item._id;
51
- });
52
- } else {
53
- products = products.map(function (product) {
54
- if (product._id === item._id) {
55
- return _objectSpread(_objectSpread({}, product), item);
56
- }
57
- return product;
58
- });
59
- }
60
-
61
- // 更新state
62
- updateState(updateProduct(state, products));
63
- onChange === null || onChange === void 0 ? void 0 : onChange(products);
31
+ onChange(item, type, other);
64
32
  };
65
33
  var productParams = useMemo(function () {
66
34
  return {
@@ -82,13 +50,17 @@ var Product = function Product(props) {
82
50
  return handleChange(e, 'delete');
83
51
  },
84
52
  onNote: function onNote(e) {
85
- return handleChange(e);
53
+ return handleChange(e, 'note', {
54
+ note: e.note
55
+ });
86
56
  },
87
57
  onLike: function onLike(e) {
88
- return handleChange(e);
58
+ return handleChange(e, 'like', {
59
+ like_status: e.like_status
60
+ });
89
61
  },
90
62
  onCard: function onCard(e) {
91
- return _onCard === null || _onCard === void 0 ? void 0 : _onCard(e);
63
+ return handleChange === null || handleChange === void 0 ? void 0 : handleChange(e, 'view');
92
64
  }
93
65
  }, productParams));
94
66
  }), !hideAddBtn ? useAddService(id, 'more') : null);
@@ -15,7 +15,7 @@ import "./index.less";
15
15
  var Content = function Content() {
16
16
  var _useContext = useContext(),
17
17
  state = _useContext.state,
18
- _onChange = _useContext.onChange;
18
+ onChange = _useContext.onChange;
19
19
  var selectPetRef = useRef();
20
20
  var _useState = useState([]),
21
21
  _useState2 = _slicedToArray(_useState, 2),
@@ -43,9 +43,12 @@ var Content = function Content() {
43
43
  // 不是编辑页面,有选择的holder,没有记录的holder,并且有商品数据
44
44
  if (_holders !== null && _holders !== void 0 && _holders.length && !(pet !== null && pet !== void 0 && pet.length) && products !== null && products !== void 0 && products.length && !isEdit) {
45
45
  if (_holders.length === 1) {
46
- var _holders$;
47
- var _products = formatService(products, (_holders$ = _holders[0]) === null || _holders$ === void 0 ? void 0 : _holders$.key);
48
- _onChange(_products);
46
+ var _holders$, _holders$2;
47
+ // const ids = products?.map((item: any) => item?._id);
48
+ onChange(products, 'update_holders', (_holders$ = _holders[0]) === null || _holders$ === void 0 ? void 0 : _holders$.key);
49
+ return;
50
+ var _products = formatService(products, (_holders$2 = _holders[0]) === null || _holders$2 === void 0 ? void 0 : _holders$2.key);
51
+ onChange(_products);
49
52
  } else {
50
53
  var _selectPetRef$current, _selectPetRef$current2;
51
54
  (_selectPetRef$current = selectPetRef.current) === null || _selectPetRef$current === void 0 ? void 0 : (_selectPetRef$current2 = _selectPetRef$current.open) === null || _selectPetRef$current2 === void 0 ? void 0 : _selectPetRef$current2.call(_selectPetRef$current, {
@@ -60,9 +63,7 @@ var Content = function Content() {
60
63
  className: classNames('pisell-lowcode__shopping-cart-wrap', className)
61
64
  }, isEmpty ? /*#__PURE__*/React.createElement(Empty, null) : /*#__PURE__*/React.createElement(Cart, null)), /*#__PURE__*/React.createElement(SelectHolderModal, {
62
65
  ref: selectPetRef,
63
- onChange: function onChange(e) {
64
- return _onChange(e);
65
- }
66
+ onChange: onChange
66
67
  }));
67
68
  };
68
69
  export default Content;
@@ -51,7 +51,7 @@ var SelectPetModal = function SelectPetModal(_ref, ref) {
51
51
  });
52
52
  var handleChange = function handleChange(e, index) {
53
53
  var _lists = _toConsumableArray(params === null || params === void 0 ? void 0 : params.service);
54
- _lists[index]._extend.holder_id = e;
54
+ _lists[index].holder_id = e;
55
55
  console.log(e, index, _lists, 'wh79876');
56
56
  setParams(_objectSpread(_objectSpread({}, params), {}, {
57
57
  service: _lists
@@ -82,12 +82,13 @@ var SelectPetModal = function SelectPetModal(_ref, ref) {
82
82
  return /*#__PURE__*/React.createElement("div", {
83
83
  className: "pisell-lowcode__booking-select-pet-item",
84
84
  key: item._id
85
- }, /*#__PURE__*/React.createElement("span", null, " ", item.title), /*#__PURE__*/React.createElement(Select, {
85
+ }, /*#__PURE__*/React.createElement("span", null, " ", item.name), /*#__PURE__*/React.createElement(Select, {
86
86
  defaultValue: (_options$ = options[0]) === null || _options$ === void 0 ? void 0 : _options$.value,
87
87
  onChange: function onChange(e) {
88
88
  return handleChange(e, index);
89
89
  },
90
- options: options
90
+ options: options,
91
+ popupMatchSelectWidth: false
91
92
  }));
92
93
  }));
93
94
  }, [params === null || params === void 0 ? void 0 : params.service, params === null || params === void 0 ? void 0 : params.pets]);
@@ -103,7 +104,14 @@ var SelectPetModal = function SelectPetModal(_ref, ref) {
103
104
  * @Date: 2024-12-03 17:05
104
105
  */
105
106
  var handleOk = function handleOk() {
106
- onChange(params === null || params === void 0 ? void 0 : params.service);
107
+ var service = params.service;
108
+ var holders = service === null || service === void 0 ? void 0 : service.map(function (item) {
109
+ return {
110
+ _id: item._id,
111
+ holder_id: item.holder_id
112
+ };
113
+ });
114
+ onChange(service, 'update_holders', holders);
107
115
  handleCancel();
108
116
  };
109
117
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(PisellModal, {
@@ -9,7 +9,6 @@ import classNames from 'classnames';
9
9
  import { Iconfont } from '@pisell/materials';
10
10
  import { useContext } from "./useContext";
11
11
  import { locales } from '@pisell/utils';
12
- import { updateProduct } from "../utils";
13
12
  var useClearCart = function useClearCart(key) {
14
13
  var _useContext = useContext(),
15
14
  state = _useContext.state,
@@ -32,16 +31,22 @@ var useClearCart = function useClearCart(key) {
32
31
  if (typeof key === 'undefined') {
33
32
  products = [];
34
33
  } else {
34
+ var _products;
35
+ var ids = (_products = products) === null || _products === void 0 ? void 0 : _products.map(function (item) {
36
+ return item === null || item === void 0 ? void 0 : item._id;
37
+ });
38
+ onChange(ids, 'delete_holders', key);
39
+ return;
35
40
  products = products.filter(function (item) {
36
- var _item$_extend;
37
- return (item === null || item === void 0 ? void 0 : (_item$_extend = item._extend) === null || _item$_extend === void 0 ? void 0 : _item$_extend.holder_id) !== key;
41
+ return (item === null || item === void 0 ? void 0 : item.holder_id) !== key;
38
42
  });
39
43
  }
40
44
 
41
45
  // 更新state
42
- updateState(updateProduct(state, products));
43
- onChange(products);
46
+ // updateState(updateProduct(state, products));
47
+ // onChange(products);
44
48
  };
49
+
45
50
  return !disabledEdit ? /*#__PURE__*/React.createElement("span", {
46
51
  className: classNames('pisell-lowcode__shopping-cart-clear-btn', {
47
52
  'pisell-lowcode__shopping-cart-clear-btn-empty': isProductList
@@ -17,7 +17,7 @@ export interface shoppingCartProps {
17
17
  defaultActiveKey?: string[] | number[];
18
18
  className?: string;
19
19
  onCard?: (e: any) => void;
20
- onChange?: (e: any) => void;
20
+ onChange?: (items: any, type?: string, other?: any) => void;
21
21
  onAddProduct?: (e?: any) => void;
22
22
  onActiveKey?: (e: any) => void;
23
23
  isShowImage?: boolean;
@@ -18,8 +18,7 @@ export var formatCartList = function formatCartList(state) {
18
18
  return holders === null || holders === void 0 ? void 0 : holders.map(function (holder) {
19
19
  return _objectSpread(_objectSpread({}, holder), {}, {
20
20
  products: products === null || products === void 0 ? void 0 : products.filter(function (product) {
21
- var _product$_extend;
22
- return (product === null || product === void 0 ? void 0 : (_product$_extend = product._extend) === null || _product$_extend === void 0 ? void 0 : _product$_extend.holder_id) === (holder === null || holder === void 0 ? void 0 : holder.key);
21
+ return (product === null || product === void 0 ? void 0 : product.holder_id) === (holder === null || holder === void 0 ? void 0 : holder.key);
23
22
  })
24
23
  });
25
24
  });
@@ -111,9 +110,7 @@ export var updateProduct = function updateProduct(state, newProducts) {
111
110
  export var formatService = function formatService(service, id) {
112
111
  return service.map(function (item) {
113
112
  return _objectSpread(_objectSpread({}, item), {}, {
114
- _extend: _objectSpread(_objectSpread({}, item._extend || {}), {}, {
115
- holder_id: id
116
- })
113
+ holder_id: id
117
114
  });
118
115
  });
119
116
  };
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { FormState } from "../model";
3
- export declare const Provider: (ComponentUi: any) => (props: any) => any, Context: import("react").Context<{
3
+ export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
4
4
  state: FormState;
5
5
  } & {
6
6
  dispatch: (params: {
@@ -44,8 +44,9 @@ var getProductAmount = (state, isEdit) => {
44
44
  if ((state == null ? void 0 : state.service) || (state == null ? void 0 : state.addons)) {
45
45
  for (let item of state == null ? void 0 : state.service.value) {
46
46
  if (isDay) {
47
- price += Number(item._extend.total) * Number(item._extend.quantity);
48
- const _duration = (0, import_utils3.isAppointment)(item, state) ? item._extend.duration : 0;
47
+ const quantity = item._extend.quantity || 1;
48
+ price += Number(item._extend.total) * Number(quantity);
49
+ const _duration = (0, import_utils3.isDayBookingProduct)(item, state) ? item._extend.duration : 0;
49
50
  duration += _duration;
50
51
  } else {
51
52
  price += Number(item._extend.total);
@@ -66,7 +67,7 @@ var getProductAmount = (state, isEdit) => {
66
67
  var _a2;
67
68
  let current = 0;
68
69
  if (isDay) {
69
- const _duration = (0, import_utils3.isAppointment)(cur, state) ? cur._extend.duration : 0;
70
+ const _duration = (0, import_utils3.isDayBookingProduct)(cur, state) ? cur._extend.duration : 0;
70
71
  current = _duration || 0;
71
72
  } else {
72
73
  current = import_utils.flexibleObj.getValue(((_a2 = cur._extend) == null ? void 0 : _a2.duration) || 0);