@pisell/private-materials 3.3.86 → 3.3.87

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 (154) 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 +13 -13
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +2 -2
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +8 -8
  11. package/es/components/Sales/Cart/index.js +5 -1
  12. package/es/components/Sales/Cart/utils.d.ts +40 -0
  13. package/es/components/Sales/Cart/utils.js +167 -0
  14. package/es/components/Sales/Checkout/index.d.ts +4 -0
  15. package/es/components/Sales/Checkout/index.js +52 -8
  16. package/es/components/Sales/Checkout/serve.d.ts +13 -0
  17. package/es/components/Sales/Checkout/serve.js +16 -2
  18. package/es/components/Sales/Checkout/utils.js +7 -1
  19. package/es/components/Sales/Summary/index.d.ts +10 -0
  20. package/es/components/Sales/Summary/index.js +17 -2
  21. package/es/components/Sales/Summary/serve.d.ts +1 -0
  22. package/es/components/Sales/Summary/serve.js +6 -0
  23. package/es/components/Sales/Summary/utils.d.ts +15 -0
  24. package/es/components/Sales/Summary/utils.js +43 -1
  25. package/es/components/appointmentBooking/components/Deposit/index.d.ts +6 -0
  26. package/es/components/appointmentBooking/components/Deposit/index.js +27 -7
  27. package/es/components/appointmentBooking/components/Voucher/index.js +1 -1
  28. package/es/components/appointmentBooking/deposit/components/PolicyModal/index.js +25 -20
  29. package/es/components/appointmentBooking/deposit/index.js +4 -2
  30. package/es/components/appointmentBooking/locales.d.ts +3 -0
  31. package/es/components/appointmentBooking/locales.js +3 -0
  32. package/es/components/booking/addons/model.d.ts +1 -10
  33. package/es/components/booking/components/TabProduct/tabs/index.js +5 -1
  34. package/es/components/booking/components/browserSelect/index.js +1 -1
  35. package/es/components/booking/components/footer/utils.js +4 -5
  36. package/es/components/booking/forms/model.d.ts +1 -10
  37. package/es/components/booking/forms/model.js +5 -5
  38. package/es/components/booking/forms/sendModal/useSendModal.d.ts +1 -1
  39. package/es/components/booking/info/model.d.ts +1 -10
  40. package/es/components/booking/info/service/addService/index.js +3 -3
  41. package/es/components/booking/info/service/like/index.js +1 -1
  42. package/es/components/booking/materiels/startTime/index.js +1 -1
  43. package/es/components/booking/model.d.ts +1 -9
  44. package/es/components/booking/notes/NoteBlock/NoteItem/index.js +1 -1
  45. package/es/components/booking/notes/NoteBlock/index.js +11 -11
  46. package/es/components/booking/notes/model.d.ts +1 -10
  47. package/es/components/booking/notes/model.js +5 -5
  48. package/es/components/booking/payments/model.d.ts +1 -10
  49. package/es/components/booking/payments/model.js +5 -5
  50. package/es/components/eventBooking/components/Provider/Cart/ContinueButton/index.js +29 -17
  51. package/es/components/eventBooking/components/Provider/Cart/Deposit/index.d.ts +2 -0
  52. package/es/components/eventBooking/components/Provider/Cart/Deposit/index.js +17 -0
  53. package/es/components/eventBooking/components/Provider/Cart/Item/Total.js +10 -6
  54. package/es/components/eventBooking/components/Provider/Cart/Item/index.js +4 -2
  55. package/es/components/eventBooking/components/bookingDetailModal/index.js +3 -1
  56. package/es/components/eventBooking/locales.d.ts +24 -0
  57. package/es/components/eventBooking/locales.js +27 -3
  58. package/es/components/listComponent/index.js +5 -5
  59. package/es/components/pay/toC/model.d.ts +1 -9
  60. package/es/components/productExtension/card/index.js +3 -3
  61. package/es/components/productExtension/fields/Actor/CutOffTime/index.js +1 -1
  62. package/es/components/productExtension/fields/Forms/index.js +12 -12
  63. package/es/components/productExtension/fields/SelectProducts/ProductItemPreview/index.js +1 -1
  64. package/es/components/productExtension/fields/SelectProducts/server.js +2 -2
  65. package/es/components/productExtension/fields/SelectResourcesTable/server.js +2 -2
  66. package/es/components/productExtension/server.js +2 -2
  67. package/es/components/ruleSetting/ruleBorder/index.js +1 -1
  68. package/es/components/schedules/calendar/index.js +4 -4
  69. package/es/components/schedules/calendar/serve.js +2 -2
  70. package/es/components/schedules/components/CurrentDay/index.js +5 -5
  71. package/es/components/schedules/components/CurrentDay/serve.js +2 -2
  72. package/es/components/schedules/components/DropdownSort/index.js +1 -1
  73. package/es/components/schedules/components/ResourceList/index.js +1 -1
  74. package/es/components/schedules/components/Search/index.js +5 -5
  75. package/es/components/schedules/model.d.ts +1 -9
  76. package/es/components/schedules/model.js +5 -5
  77. package/es/components/schedules/openHours/index.js +1 -1
  78. package/es/components/schedules/openHours/serve.js +2 -2
  79. package/es/components/schedules/products/ProductDetailDrawer/ProductDetail/MaxParticipantsModule/index.js +1 -1
  80. package/es/components/schedules/products/ProductDetailDrawer/ProductDetail/ResourcesModule/index.js +5 -5
  81. package/es/components/schedules/products/ProductDetailDrawer/ProductDetail/SchedulesModule/index.js +4 -4
  82. package/es/components/schedules/products/ProductDetailDrawer/index.js +3 -3
  83. package/es/components/schedules/products/serve.js +2 -2
  84. package/es/components/schedules/products/utils.js +5 -5
  85. package/es/components/schedules/resources/detail/detailContent.js +2 -2
  86. package/es/components/schedules/resources/detail/index.js +10 -10
  87. package/es/components/schedules/resources/list/index.js +2 -2
  88. package/es/components/schedules/resources/relationProduct/index.js +1 -1
  89. package/es/components/schedules/resources/serve.js +2 -2
  90. package/es/components/schedules/schedules/ScheduleDetailDrawer/index.js +9 -9
  91. package/es/components/schedules/utils.d.ts +1 -1
  92. package/es/components/schedules/utils.js +4 -4
  93. package/es/components/selectModal/index.js +2 -2
  94. package/es/components/ticketBooking/components/addServiceVariant/addService.js +3 -4
  95. package/es/components/wallet/Detail/model.d.ts +1 -13
  96. package/es/components/wallet/DiscountCard/model.d.ts +1 -14
  97. package/es/components/wallet/PointCard/model.d.ts +1 -13
  98. package/es/components/wallet/RechargeableCard/model.d.ts +1 -29
  99. package/es/components/wallet/Voucher/model.d.ts +1 -13
  100. package/es/components/wallet/model.d.ts +1 -9
  101. package/es/hooks/useComponents.js +1 -1
  102. package/es/utils/index.d.ts +1 -1
  103. package/lib/components/Sales/Cart/index.js +1 -0
  104. package/lib/components/Sales/Cart/utils.d.ts +40 -0
  105. package/lib/components/Sales/Cart/utils.js +117 -0
  106. package/lib/components/Sales/Checkout/index.d.ts +4 -0
  107. package/lib/components/Sales/Checkout/index.js +39 -7
  108. package/lib/components/Sales/Checkout/serve.d.ts +13 -0
  109. package/lib/components/Sales/Checkout/serve.js +7 -2
  110. package/lib/components/Sales/Checkout/utils.js +2 -0
  111. package/lib/components/Sales/Summary/index.d.ts +10 -0
  112. package/lib/components/Sales/Summary/index.js +7 -1
  113. package/lib/components/Sales/Summary/serve.d.ts +1 -0
  114. package/lib/components/Sales/Summary/serve.js +32 -0
  115. package/lib/components/Sales/Summary/utils.d.ts +15 -0
  116. package/lib/components/Sales/Summary/utils.js +30 -1
  117. package/lib/components/appointmentBooking/components/Deposit/index.d.ts +6 -0
  118. package/lib/components/appointmentBooking/components/Deposit/index.js +36 -4
  119. package/lib/components/appointmentBooking/components/Voucher/index.js +1 -1
  120. package/lib/components/appointmentBooking/deposit/components/PolicyModal/index.js +8 -4
  121. package/lib/components/appointmentBooking/deposit/index.js +4 -2
  122. package/lib/components/appointmentBooking/locales.d.ts +3 -0
  123. package/lib/components/appointmentBooking/locales.js +3 -0
  124. package/lib/components/booking/addons/model.d.ts +1 -10
  125. package/lib/components/booking/components/footer/utils.js +2 -5
  126. package/lib/components/booking/components/voucher/index.js +21 -9
  127. package/lib/components/booking/forms/model.d.ts +1 -10
  128. package/lib/components/booking/forms/sendModal/useSendModal.d.ts +1 -1
  129. package/lib/components/booking/info/model.d.ts +1 -10
  130. package/lib/components/booking/info/service/addService/index.js +1 -1
  131. package/lib/components/booking/model.d.ts +1 -9
  132. package/lib/components/booking/notes/model.d.ts +1 -10
  133. package/lib/components/booking/payments/model.d.ts +1 -10
  134. package/lib/components/eventBooking/components/Provider/Cart/ContinueButton/index.js +16 -3
  135. package/lib/components/eventBooking/components/Provider/Cart/Deposit/index.d.ts +2 -0
  136. package/lib/components/eventBooking/components/Provider/Cart/Deposit/index.js +55 -0
  137. package/lib/components/eventBooking/components/Provider/Cart/Item/Total.js +8 -5
  138. package/lib/components/eventBooking/components/Provider/Cart/Item/index.js +4 -2
  139. package/lib/components/eventBooking/components/bookingDetailModal/index.js +1 -1
  140. package/lib/components/eventBooking/locales.d.ts +24 -0
  141. package/lib/components/eventBooking/locales.js +27 -3
  142. package/lib/components/pay/toC/model.d.ts +1 -9
  143. package/lib/components/schedules/model.d.ts +1 -9
  144. package/lib/components/schedules/utils.d.ts +1 -1
  145. package/lib/components/schedules/utils.js +1 -1
  146. package/lib/components/ticketBooking/components/addServiceVariant/addService.js +5 -3
  147. package/lib/components/wallet/Detail/model.d.ts +1 -13
  148. package/lib/components/wallet/DiscountCard/model.d.ts +1 -14
  149. package/lib/components/wallet/PointCard/model.d.ts +1 -13
  150. package/lib/components/wallet/RechargeableCard/model.d.ts +1 -29
  151. package/lib/components/wallet/Voucher/model.d.ts +1 -13
  152. package/lib/components/wallet/model.d.ts +1 -9
  153. package/lib/utils/index.d.ts +1 -1
  154. package/package.json +4 -4
@@ -41,6 +41,7 @@ var import_useEngineContext = __toESM(require("../../../hooks/useEngineContext")
41
41
  var import_ahooks = require("ahooks");
42
42
  var import_serve = require("./serve");
43
43
  var import_Cart = require("../Cart");
44
+ var import_utils = require("../../appointmentBooking/utils");
44
45
  var defaultState = {};
45
46
  var CheckoutContext = (0, import_react.createContext)(
46
47
  void 0
@@ -54,6 +55,7 @@ var CheckoutProvider = ({
54
55
  const { updateDisabledCartItem } = (0, import_Cart.useCart)();
55
56
  const checkoutCallback = (0, import_react.useRef)(null);
56
57
  const checkRef = (0, import_react.useRef)(null);
58
+ const payRef = (0, import_react.useRef)(null);
57
59
  const checkBeforeBooking = (0, import_ahooks.useRequest)(import_serve.checkBeforeBookingApi, {
58
60
  manual: true,
59
61
  onSuccess: (res) => {
@@ -76,6 +78,17 @@ var CheckoutProvider = ({
76
78
  checkoutCallback.current({ success: false, err });
77
79
  }
78
80
  });
81
+ const freePay = (0, import_ahooks.useRequest)(import_serve.freePayApi, {
82
+ manual: true,
83
+ onSuccess: (res) => {
84
+ var _a, _b;
85
+ if (res == null ? void 0 : res.status) {
86
+ goPaymentFinish((_a = payRef.current) == null ? void 0 : _a.order_id, (_b = payRef.current) == null ? void 0 : _b.total_amount);
87
+ } else {
88
+ (0, import_utils.Toast)(res == null ? void 0 : res.message);
89
+ }
90
+ }
91
+ });
79
92
  const onCheckBeforeBooking = (data2) => {
80
93
  return new Promise((resolve) => {
81
94
  checkRef.current = (res) => {
@@ -94,21 +107,40 @@ var CheckoutProvider = ({
94
107
  createBooking.runAsync(data2);
95
108
  });
96
109
  };
110
+ const goPaymentFinish = (order_id, amount) => {
111
+ var _a;
112
+ const url = `/payment-finish/success?order_id=${order_id}&amount=${Number(
113
+ amount
114
+ )}`;
115
+ (_a = utils == null ? void 0 : utils.history) == null ? void 0 : _a.replace(url);
116
+ };
97
117
  const onPay = (payProps) => {
98
- utils.action({
99
- type: "pisell1.payment",
100
- data: payProps,
101
- callback: (e) => {
102
- checkoutCallback.current && checkoutCallback.current(e);
118
+ payRef.current = payProps;
119
+ const { is_deposit, deposit_amount, total_amount } = payProps;
120
+ const _total = is_deposit ? deposit_amount || 0 : total_amount || 0;
121
+ if (_total > 0) {
122
+ utils.action({
123
+ type: "pisell1.payment",
124
+ data: { ...payProps, total_amount: _total },
125
+ callback: (e) => {
126
+ checkoutCallback.current && checkoutCallback.current(e);
127
+ }
128
+ });
129
+ } else {
130
+ if (is_deposit) {
131
+ goPaymentFinish(payProps.order_id, _total);
132
+ return;
103
133
  }
104
- });
134
+ freePay.runAsync(payProps.order_id);
135
+ }
105
136
  };
106
137
  const contextValue = {
107
138
  onCheckBeforeBooking,
108
139
  onCheckout,
109
140
  onPay,
110
141
  createBooking,
111
- checkBeforeBooking
142
+ checkBeforeBooking,
143
+ freePay
112
144
  };
113
145
  return /* @__PURE__ */ import_react.default.createElement(CheckoutContext.Provider, { value: contextValue }, children);
114
146
  };
@@ -1,2 +1,15 @@
1
+ /**
2
+ * @title: 下单前置校验接口
3
+ * @param {any} data
4
+ */
1
5
  export declare const checkBeforeBookingApi: (data: any) => Promise<any>;
6
+ /**
7
+ * @title: 创建订单
8
+ * @param {any} data
9
+ */
2
10
  export declare const createBookingApi: (data: any) => Promise<any>;
11
+ /**
12
+ * @title: 免费支付
13
+ * @param {string} orderId
14
+ */
15
+ export declare const freePayApi: (orderId: string) => Promise<any>;
@@ -20,7 +20,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  var serve_exports = {};
21
21
  __export(serve_exports, {
22
22
  checkBeforeBookingApi: () => checkBeforeBookingApi,
23
- createBookingApi: () => createBookingApi
23
+ createBookingApi: () => createBookingApi,
24
+ freePayApi: () => freePayApi
24
25
  });
25
26
  module.exports = __toCommonJS(serve_exports);
26
27
  var import_utils = require("../../../utils");
@@ -30,8 +31,12 @@ var checkBeforeBookingApi = (data) => {
30
31
  var createBookingApi = (data) => {
31
32
  return import_utils.request.getRequest().post("/h5/eventbookingv2/order", data);
32
33
  };
34
+ var freePayApi = (orderId) => {
35
+ return import_utils.request.getRequest().post(`/h5/pay/order/free-pay/${orderId}`, {});
36
+ };
33
37
  // Annotate the CommonJS export names for ESM import in node:
34
38
  0 && (module.exports = {
35
39
  checkBeforeBookingApi,
36
- createBookingApi
40
+ createBookingApi,
41
+ freePayApi
37
42
  });
@@ -79,6 +79,8 @@ var formatValues = (state, excludeDisabled, otherValue) => {
79
79
  } else {
80
80
  data = state.cartData.cartItems;
81
81
  }
82
+ const is_deposit = data.find((v) => v.deposit) ? 1 : 0;
83
+ values.is_deposit = is_deposit;
82
84
  values.bookings = formatBookings(data);
83
85
  return values;
84
86
  };
@@ -7,6 +7,16 @@ interface SummaryContextType {
7
7
  taxTitle?: string;
8
8
  totalTaxFee?: string;
9
9
  isPriceIncludeTax?: 0 | 1;
10
+ deposit?: {
11
+ total: string;
12
+ protocols: any[];
13
+ hasDeposit: boolean;
14
+ };
15
+ isAgreeDepositPolicy: boolean;
16
+ setIsAgreeDepositPolicy: (value: boolean) => void;
17
+ getDepositProtocol: (params: {
18
+ id: string;
19
+ }) => Promise<any>;
10
20
  }
11
21
  interface SummaryProviderProps {
12
22
  children: React.ReactNode;
@@ -39,6 +39,7 @@ var import_react = __toESM(require("react"));
39
39
  var import_Cart = require("../Cart");
40
40
  var import_utils = require("./utils");
41
41
  var import_Init = require("../Init");
42
+ var import_serve = require("./serve");
42
43
  var defaultState = {};
43
44
  var SummaryContext = (0, import_react.createContext)(
44
45
  void 0
@@ -48,6 +49,7 @@ var SummaryProvider = ({
48
49
  }) => {
49
50
  const { cartData } = (0, import_Cart.useCart)();
50
51
  const { initData } = (0, import_Init.useInit)();
52
+ const [isAgreeDepositPolicy, setIsAgreeDepositPolicy] = (0, import_react.useState)(false);
51
53
  const summaryData = (0, import_react.useMemo)(() => {
52
54
  return (0, import_utils.calculatePriceDetails)(
53
55
  (initData == null ? void 0 : initData.shop) || {},
@@ -61,7 +63,11 @@ var SummaryProvider = ({
61
63
  total: summaryData.total,
62
64
  taxTitle: summaryData.taxTitle,
63
65
  totalTaxFee: summaryData.totalTaxFee,
64
- isPriceIncludeTax: summaryData.isPriceIncludeTax
66
+ isPriceIncludeTax: summaryData.isPriceIncludeTax,
67
+ deposit: summaryData.deposit,
68
+ isAgreeDepositPolicy,
69
+ setIsAgreeDepositPolicy,
70
+ getDepositProtocol: import_serve.getDepositProtocolApi
65
71
  };
66
72
  return /* @__PURE__ */ import_react.default.createElement(SummaryContext.Provider, { value: contextValue }, children);
67
73
  };
@@ -0,0 +1 @@
1
+ export declare const getDepositProtocolApi: (id: string) => Promise<any>;
@@ -0,0 +1,32 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/components/Sales/Summary/serve.ts
20
+ var serve_exports = {};
21
+ __export(serve_exports, {
22
+ getDepositProtocolApi: () => getDepositProtocolApi
23
+ });
24
+ module.exports = __toCommonJS(serve_exports);
25
+ var import_utils = require("../../../utils");
26
+ var getDepositProtocolApi = (id) => {
27
+ return import_utils.request.getRequest().get(`/h5/shop-policy/${id}`, {});
28
+ };
29
+ // Annotate the CommonJS export names for ESM import in node:
30
+ 0 && (module.exports = {
31
+ getDepositProtocolApi
32
+ });
@@ -10,6 +10,11 @@ interface PriceDetail {
10
10
  taxTitle?: string;
11
11
  totalTaxFee?: string;
12
12
  isPriceIncludeTax?: 0 | 1;
13
+ deposit?: {
14
+ total: string;
15
+ protocols: any[];
16
+ hasDeposit: boolean;
17
+ };
13
18
  }
14
19
  /**
15
20
  * 计算商品小计(不含其他费用)
@@ -33,4 +38,14 @@ export declare const calculateTaxFee: (shopInfo: any, items: CartItem[]) => "0.0
33
38
  * @returns 价格明细对象
34
39
  */
35
40
  export declare const calculatePriceDetails: (shopInfo: any, items: CartItem[]) => PriceDetail;
41
+ /**
42
+ * @title: 计算定金
43
+ * @param items - 购物车商品数组
44
+ * @returns 定金字符串,保留2位小数
45
+ */
46
+ export declare const calculateDeposit: (items: CartItem[]) => {
47
+ total: string;
48
+ protocols: any[];
49
+ hasDeposit: never;
50
+ } | undefined;
36
51
  export {};
@@ -29,6 +29,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
29
29
  // src/components/Sales/Summary/utils.ts
30
30
  var utils_exports = {};
31
31
  __export(utils_exports, {
32
+ calculateDeposit: () => calculateDeposit,
32
33
  calculatePriceDetails: () => calculatePriceDetails,
33
34
  calculateSubtotal: () => calculateSubtotal,
34
35
  calculateTaxFee: () => calculateTaxFee
@@ -65,16 +66,44 @@ var calculatePriceDetails = (shopInfo, items) => {
65
66
  const totalTaxFee = new import_decimal.default(calculateTaxFee(shopInfo, items));
66
67
  console.log("totalTaxFee", totalTaxFee.toFixed(2));
67
68
  const total = (shopInfo == null ? void 0 : shopInfo.is_price_include_tax) ? subtotal : subtotal.plus(totalTaxFee);
69
+ const deposit = calculateDeposit(items);
68
70
  return {
69
71
  subtotal: subtotal.toFixed(2),
70
72
  total: total.toFixed(2),
71
73
  taxTitle: shopInfo == null ? void 0 : shopInfo.tax_title,
72
74
  totalTaxFee: totalTaxFee.toFixed(2),
73
- isPriceIncludeTax: shopInfo == null ? void 0 : shopInfo.is_price_include_tax
75
+ isPriceIncludeTax: shopInfo == null ? void 0 : shopInfo.is_price_include_tax,
76
+ deposit
74
77
  };
75
78
  };
79
+ var calculateDeposit = (items) => {
80
+ if (!(items == null ? void 0 : items.length)) {
81
+ return void 0;
82
+ }
83
+ const protocols = [];
84
+ let hasDeposit = false;
85
+ const total = items.reduce((sum, item) => {
86
+ var _a, _b, _c;
87
+ if (item == null ? void 0 : item.deposit) {
88
+ hasDeposit = true;
89
+ const cartItemTotalPrice = new import_decimal.default(((_a = item == null ? void 0 : item.deposit) == null ? void 0 : _a.total) || 0);
90
+ (_c = (_b = item == null ? void 0 : item.deposit) == null ? void 0 : _b.protocols) == null ? void 0 : _c.forEach((protocol) => {
91
+ if (protocols.findIndex((p) => p.id === protocol.id) === -1) {
92
+ protocols.push(protocol);
93
+ }
94
+ });
95
+ return sum.plus(cartItemTotalPrice);
96
+ }
97
+ return sum;
98
+ }, new import_decimal.default(0));
99
+ if (hasDeposit) {
100
+ return { total: total.toFixed(2), protocols, hasDeposit };
101
+ }
102
+ return void 0;
103
+ };
76
104
  // Annotate the CommonJS export names for ESM import in node:
77
105
  0 && (module.exports = {
106
+ calculateDeposit,
78
107
  calculatePriceDetails,
79
108
  calculateSubtotal,
80
109
  calculateTaxFee
@@ -1,3 +1,9 @@
1
1
  import './index.less';
2
+ export declare const DepositContent: (props: {
3
+ isAgreeDepositPolicy: boolean;
4
+ setIsAgreeDepositPolicy: (value: boolean) => void;
5
+ deposit: any;
6
+ depositProtocolRequest?: any;
7
+ }) => JSX.Element;
2
8
  declare const Deposit: () => JSX.Element;
3
9
  export default Deposit;
@@ -29,6 +29,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
29
29
  // src/components/appointmentBooking/components/Deposit/index.tsx
30
30
  var Deposit_exports = {};
31
31
  __export(Deposit_exports, {
32
+ DepositContent: () => DepositContent,
32
33
  default: () => Deposit_default
33
34
  });
34
35
  module.exports = __toCommonJS(Deposit_exports);
@@ -38,9 +39,13 @@ var import_deposit = __toESM(require("../../deposit"));
38
39
  var import_context = require("../../context");
39
40
  var import_utils = require("@pisell/utils");
40
41
  var import_index = require("./index.less");
41
- var Deposit = () => {
42
- const { setIsAgreeDepositPolicy, isAgreeDepositPolicy, summary } = (0, import_context.useAppointmentBookingContext)();
43
- const { deposit } = summary;
42
+ var DepositContent = (props) => {
43
+ const {
44
+ isAgreeDepositPolicy,
45
+ setIsAgreeDepositPolicy,
46
+ deposit,
47
+ depositProtocolRequest
48
+ } = props;
44
49
  return /* @__PURE__ */ import_react.default.createElement("div", { className: "appointment-deposit-wrap" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "appointment-deposit-top" }, /* @__PURE__ */ import_react.default.createElement("span", null, import_utils.locales.getText("pisell2.appointment.deposit")), /* @__PURE__ */ import_react.default.createElement(
45
50
  import_materials.PisellText.Amount,
46
51
  {
@@ -54,8 +59,35 @@ var Deposit = () => {
54
59
  total: deposit == null ? void 0 : deposit.total,
55
60
  protocols: deposit == null ? void 0 : deposit.protocols,
56
61
  isAgreePolicy: isAgreeDepositPolicy,
57
- onChange: (value) => setIsAgreeDepositPolicy(value)
62
+ onChange: (value) => setIsAgreeDepositPolicy(value),
63
+ depositProtocolRequest
58
64
  }
59
65
  ));
60
66
  };
67
+ var Deposit = () => {
68
+ const {
69
+ setIsAgreeDepositPolicy,
70
+ isAgreeDepositPolicy,
71
+ summary,
72
+ appointmentBooking
73
+ } = (0, import_context.useAppointmentBookingContext)();
74
+ const { deposit } = summary;
75
+ const depositProtocolRequest = (id) => {
76
+ var _a;
77
+ return (_a = appointmentBooking == null ? void 0 : appointmentBooking.getProtocol) == null ? void 0 : _a.call(appointmentBooking, id);
78
+ };
79
+ return /* @__PURE__ */ import_react.default.createElement(
80
+ DepositContent,
81
+ {
82
+ isAgreeDepositPolicy: !!isAgreeDepositPolicy,
83
+ setIsAgreeDepositPolicy,
84
+ deposit,
85
+ depositProtocolRequest
86
+ }
87
+ );
88
+ };
61
89
  var Deposit_default = Deposit;
90
+ // Annotate the CommonJS export names for ESM import in node:
91
+ 0 && (module.exports = {
92
+ DepositContent
93
+ });
@@ -140,7 +140,7 @@ var VoucherCard = (props) => {
140
140
  setCode("");
141
141
  } else {
142
142
  (0, import_materials.PisellToast)({
143
- content: import_utils.locales.getText("pisell2.text.goodpass.code-invalid")
143
+ content: val.type === "server" ? import_utils.locales.getText("pisell2.text.goodpass.code-invalid") : import_utils.locales.getText("pisell2.text.goodpass.code-invalid-cart")
144
144
  });
145
145
  }
146
146
  };
@@ -36,7 +36,6 @@ var import_react = __toESM(require("react"));
36
36
  var import_antd = require("antd");
37
37
  var import_materials = require("@pisell/materials");
38
38
  var import_utils = require("@pisell/utils");
39
- var import_context = require("../../../context");
40
39
  var import_index = require("./index.less");
41
40
  var DepositModal = (props) => {
42
41
  const {
@@ -45,9 +44,10 @@ var DepositModal = (props) => {
45
44
  item,
46
45
  onChange,
47
46
  onConfirm,
48
- isHideCheckout = true
47
+ isHideCheckout = true,
48
+ depositProtocolRequest
49
+ // 定金协议请求
49
50
  } = props;
50
- const { appointmentBooking } = (0, import_context.useAppointmentBookingContext)();
51
51
  const [policy, setPolicy] = (0, import_react.useState)(null);
52
52
  const [loading, setLoading] = (0, import_react.useState)(false);
53
53
  const [disabled, setDisabled] = (0, import_react.useState)(false);
@@ -55,9 +55,13 @@ var DepositModal = (props) => {
55
55
  setDisabled(!isHideCheckout);
56
56
  }, [isHideCheckout]);
57
57
  const getPolicy = async (id) => {
58
+ if (!depositProtocolRequest) {
59
+ console.error("depositProtocolRequest is not defined");
60
+ return;
61
+ }
58
62
  setLoading(true);
59
63
  try {
60
- const { data } = await appointmentBooking.getProtocol(id);
64
+ const { data } = await (depositProtocolRequest == null ? void 0 : depositProtocolRequest(id));
61
65
  setPolicy(data);
62
66
  onChange && onChange(data);
63
67
  } catch (error) {
@@ -48,7 +48,8 @@ var Deposit = (props) => {
48
48
  title,
49
49
  isAgreePolicy = true,
50
50
  isShowTitle = true,
51
- onChange
51
+ onChange,
52
+ depositProtocolRequest
52
53
  } = props;
53
54
  const context = (0, import_useEngineContext.default)();
54
55
  const [visible, setVisible] = (0, import_react.useState)(false);
@@ -102,7 +103,8 @@ var Deposit = (props) => {
102
103
  {
103
104
  open: visible,
104
105
  onCancel: () => setVisible(false),
105
- item: policyItem
106
+ item: policyItem,
107
+ depositProtocolRequest
106
108
  }
107
109
  ));
108
110
  };
@@ -114,6 +114,7 @@ declare const _default: {
114
114
  'pisell2.text.goodpass.code': string;
115
115
  'pisell2.text.goodpass.enter-code': string;
116
116
  'pisell2.text.goodpass.code-invalid': string;
117
+ 'pisell2.text.goodpass.code-invalid-cart': string;
117
118
  'pisell2.text.goodpass.login': string;
118
119
  'pisell2.text.goodpass.login-tip': string;
119
120
  };
@@ -232,6 +233,7 @@ declare const _default: {
232
233
  'pisell2.text.goodpass.code': string;
233
234
  'pisell2.text.goodpass.enter-code': string;
234
235
  'pisell2.text.goodpass.code-invalid': string;
236
+ 'pisell2.text.goodpass.code-invalid-cart': string;
235
237
  'pisell2.text.goodpass.login': string;
236
238
  'pisell2.text.goodpass.login-tip': string;
237
239
  };
@@ -350,6 +352,7 @@ declare const _default: {
350
352
  'pisell2.text.goodpass.code': string;
351
353
  'pisell2.text.goodpass.enter-code': string;
352
354
  'pisell2.text.goodpass.code-invalid': string;
355
+ 'pisell2.text.goodpass.code-invalid-cart': string;
353
356
  'pisell2.text.goodpass.login': string;
354
357
  'pisell2.text.goodpass.login-tip': string;
355
358
  };
@@ -138,6 +138,7 @@ var locales_default = {
138
138
  "pisell2.text.goodpass.code": "Code",
139
139
  "pisell2.text.goodpass.enter-code": "Enter Code",
140
140
  "pisell2.text.goodpass.code-invalid": "Current code is invalid",
141
+ "pisell2.text.goodpass.code-invalid-cart": "No eligible items in the cart",
141
142
  "pisell2.text.goodpass.login": "Login",
142
143
  "pisell2.text.goodpass.login-tip": " for member benefit Or use account credit"
143
144
  },
@@ -256,6 +257,7 @@ var locales_default = {
256
257
  "pisell2.text.goodpass.code": "券码",
257
258
  "pisell2.text.goodpass.enter-code": "请输入券码",
258
259
  "pisell2.text.goodpass.code-invalid": "当前券码不可用",
260
+ "pisell2.text.goodpass.code-invalid-cart": "当前购物车中无可用商品",
259
261
  "pisell2.text.goodpass.login": "登录",
260
262
  "pisell2.text.goodpass.login-tip": "以获取会员福利或使用账户积分"
261
263
  },
@@ -374,6 +376,7 @@ var locales_default = {
374
376
  "pisell2.text.goodpass.code": "券碼",
375
377
  "pisell2.text.goodpass.enter-code": "請輸入券碼",
376
378
  "pisell2.text.goodpass.code-invalid": "當前券碼不可用",
379
+ "pisell2.text.goodpass.code-invalid-cart": "當前購物車中無可用商品",
377
380
  "pisell2.text.goodpass.login": "登錄",
378
381
  "pisell2.text.goodpass.login-tip": "以獲取會員福利或使用賬戶積分"
379
382
  }
@@ -1,10 +1 @@
1
- /// <reference types="react" />
2
- import { FormState } from "../model";
3
- export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
4
- state: FormState;
5
- } & {
6
- dispatch: (params: {
7
- type: string;
8
- payload: any;
9
- }) => void;
10
- }>;
1
+ export declare const Provider: any, Context: any;
@@ -257,7 +257,7 @@ var formatAppointmentProductLists = (data) => {
257
257
  let list = data.service.value;
258
258
  list = list.filter((item) => {
259
259
  var _a2;
260
- return ((_a2 = item._extend) == null ? void 0 : _a2.holder_id) && import_status.appointmentTypes.includes(item.extension_type);
260
+ return ((_a2 = item._extend) == null ? void 0 : _a2.holder_id) && !(0, import_utils4.isNormalProductByDurationSchedule)(item);
261
261
  });
262
262
  const groupMap = /* @__PURE__ */ new Map();
263
263
  list.forEach((item) => {
@@ -361,10 +361,7 @@ var formatBookings = (data, values) => {
361
361
  var formatRelationProducts = (data) => {
362
362
  var _a;
363
363
  let list = ((_a = data.service) == null ? void 0 : _a.value) || [];
364
- list = list.filter((item) => {
365
- var _a2;
366
- return !((_a2 = item._extend) == null ? void 0 : _a2.holder_id);
367
- });
364
+ list = list.filter((item) => (0, import_utils4.isNormalProductByDurationSchedule)(item));
368
365
  let relationProducts = [];
369
366
  relationProducts = list.map((item) => {
370
367
  return formatProducts(item);
@@ -67,13 +67,17 @@ var VoucherCard = (props) => {
67
67
  const isBooking4Shop = (0, import_useIsBooking4Shop.useIsBooking4Shop)(state);
68
68
  const shopDiscount = pisellos.getModule("shopDiscount");
69
69
  services = state.service;
70
- (0, import_ahooks.useDebounceEffect)(() => {
71
- if (isBooking4Shop) {
72
- shopDiscount.setCustomer(state.client.value);
70
+ (0, import_ahooks.useDebounceEffect)(
71
+ () => {
72
+ if (isBooking4Shop) {
73
+ shopDiscount.setCustomer(state.client.value);
74
+ }
75
+ },
76
+ [(_b = state.client.value) == null ? void 0 : _b.id, isBooking4Shop],
77
+ {
78
+ wait: 200
73
79
  }
74
- }, [(_b = state.client.value) == null ? void 0 : _b.id, isBooking4Shop], {
75
- wait: 200
76
- });
80
+ );
77
81
  (0, import_react.useEffect)(() => {
78
82
  if (isBooking4Shop) {
79
83
  shopDiscount.setProductList([
@@ -116,7 +120,9 @@ var VoucherCard = (props) => {
116
120
  }, [state.addons.value]);
117
121
  const disabled = (0, import_react.useMemo)(() => {
118
122
  var _a2;
119
- if (["paid", "partially_paid"].includes((_a2 = state.bookingDetail) == null ? void 0 : _a2.payment_status) && [...addonsMemo, ...serviceMemo].every((item) => item.booking_id)) {
123
+ if (["paid", "partially_paid"].includes(
124
+ (_a2 = state.bookingDetail) == null ? void 0 : _a2.payment_status
125
+ ) && [...addonsMemo, ...serviceMemo].every((item) => item.booking_id)) {
120
126
  return true;
121
127
  }
122
128
  return false;
@@ -173,9 +179,15 @@ var VoucherCard = (props) => {
173
179
  );
174
180
  return () => {
175
181
  shopDiscount.clear();
176
- pisellos.effects.off(ShopDiscountHooks.onCustomerChange, onScanCustomerChange);
182
+ pisellos.effects.off(
183
+ ShopDiscountHooks.onCustomerChange,
184
+ onScanCustomerChange
185
+ );
177
186
  pisellos.effects.off(ShopDiscountHooks.onLoadPrepareCalcResult, fn);
178
- pisellos.effects.off(ShopDiscountHooks.onDiscountListChange, onDiscountListChange);
187
+ pisellos.effects.off(
188
+ ShopDiscountHooks.onDiscountListChange,
189
+ onDiscountListChange
190
+ );
179
191
  };
180
192
  }, [state.bookingId, isBooking4Shop, fn]);
181
193
  const productListToValue = (0, import_ahooks.useMemoizedFn)((list, edit) => {
@@ -1,10 +1 @@
1
- /// <reference types="react" />
2
- import { FormState } from "../model";
3
- export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
4
- state: FormState;
5
- } & {
6
- dispatch: (params: {
7
- type: string;
8
- payload: any;
9
- }) => void;
10
- }>;
1
+ export declare const Provider: any, Context: any;
@@ -4,6 +4,6 @@ declare const useSendModal: (bookingId?: number) => {
4
4
  setOpen: import("react").Dispatch<import("react").SetStateAction<boolean>>;
5
5
  handleOpen: () => void;
6
6
  handleValuesChange: (val: any) => void;
7
- handleOk: (values: SendModalValues) => Promise<any>;
7
+ handleOk: (values: SendModalValues) => Promise<boolean | undefined>;
8
8
  };
9
9
  export default useSendModal;
@@ -1,14 +1,5 @@
1
- /// <reference types="react" />
2
- import { FormState } from '../model';
3
1
  export declare const walkInData: {
4
2
  id: number;
5
3
  nickname: string;
6
4
  };
7
- export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
8
- state: FormState;
9
- } & {
10
- dispatch: (params: {
11
- type: string;
12
- payload: any;
13
- }) => void;
14
- }>;
5
+ export declare const Provider: any, Context: any;
@@ -264,7 +264,7 @@ var Info = (props) => {
264
264
  if ((0, import_utils3.isDaysBooking)(state)) {
265
265
  if (!(0, import_utils3.holderId)(state)) {
266
266
  _list = _list.filter(
267
- (item) => !import_status.appointmentTypes.includes(item.extension_type)
267
+ (item) => (0, import_utils3.isNormalProductByDurationSchedule)(item)
268
268
  );
269
269
  }
270
270
  }
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export interface FormState {
3
2
  amountSymbol: string;
4
3
  apis: {
@@ -105,11 +104,4 @@ export declare const walkInData: {
105
104
  id: number;
106
105
  nickname: string;
107
106
  };
108
- export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
109
- state: FormState;
110
- } & {
111
- dispatch: (params: {
112
- type: string;
113
- payload: any;
114
- }) => void;
115
- }>;
107
+ export declare const Provider: any, Context: any;
@@ -1,10 +1 @@
1
- /// <reference types="react" />
2
- import { FormState } from "../model";
3
- export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
4
- state: FormState;
5
- } & {
6
- dispatch: (params: {
7
- type: string;
8
- payload: any;
9
- }) => void;
10
- }>;
1
+ export declare const Provider: any, Context: any;