@pisell/private-materials 3.4.2 → 3.4.4

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 (167) 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 +4 -4
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +7 -7
  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 +187 -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.d.ts +1 -0
  19. package/es/components/Sales/Checkout/utils.js +9 -2
  20. package/es/components/Sales/Event/Detail.d.ts +1 -0
  21. package/es/components/Sales/Event/Detail.js +45 -11
  22. package/es/components/Sales/Event/serve.d.ts +10 -0
  23. package/es/components/Sales/Event/serve.js +25 -0
  24. package/es/components/Sales/Summary/index.d.ts +10 -0
  25. package/es/components/Sales/Summary/index.js +17 -2
  26. package/es/components/Sales/Summary/serve.d.ts +1 -0
  27. package/es/components/Sales/Summary/serve.js +6 -0
  28. package/es/components/Sales/Summary/utils.d.ts +16 -1
  29. package/es/components/Sales/Summary/utils.js +43 -1
  30. package/es/components/appointmentBooking/components/Content/index.js +15 -1
  31. package/es/components/appointmentBooking/components/Deposit/index.d.ts +6 -0
  32. package/es/components/appointmentBooking/components/Deposit/index.js +27 -7
  33. package/es/components/appointmentBooking/deposit/components/PolicyModal/index.js +25 -20
  34. package/es/components/appointmentBooking/deposit/index.js +4 -2
  35. package/es/components/booking/components/TabProduct/tabs/index.js +1 -5
  36. package/es/components/booking/components/browserSelect/index.js +1 -1
  37. package/es/components/booking/components/footer/index.js +32 -24
  38. package/es/components/booking/forms/model.js +5 -5
  39. package/es/components/booking/info/service/addService/utils.d.ts +1 -1
  40. package/es/components/booking/info/service/like/index.js +1 -1
  41. package/es/components/booking/info/utils.js +1 -1
  42. package/es/components/booking/info2/service/addService/utils.d.ts +1 -1
  43. package/es/components/booking/info2/utilsByBooking.js +9 -3
  44. package/es/components/booking/materiels/startTime/index.js +1 -1
  45. package/es/components/booking/notes/NoteBlock/NoteItem/index.js +1 -1
  46. package/es/components/booking/notes/NoteBlock/index.js +11 -11
  47. package/es/components/booking/notes/model.js +5 -5
  48. package/es/components/booking/payments/model.js +5 -5
  49. package/es/components/booking/utils.d.ts +2 -2
  50. package/es/components/eftposPay/amount.d.ts +1 -1
  51. package/es/components/eftposPay/device.d.ts +1 -1
  52. package/es/components/eftposPay/hooks.d.ts +2 -2
  53. package/es/components/eftposPay/store/index.d.ts +5 -5
  54. package/es/components/eventBooking/components/Provider/Cart/ContinueButton/index.js +29 -17
  55. package/es/components/eventBooking/components/Provider/Cart/Deposit/index.d.ts +2 -0
  56. package/es/components/eventBooking/components/Provider/Cart/Deposit/index.js +17 -0
  57. package/es/components/eventBooking/components/Provider/Cart/Item/Total.js +10 -6
  58. package/es/components/eventBooking/components/Provider/Cart/Item/index.js +4 -2
  59. package/es/components/eventBooking/components/bookingDetailModal/index.js +6 -3
  60. package/es/components/eventBooking/locales.d.ts +24 -0
  61. package/es/components/eventBooking/locales.js +27 -3
  62. package/es/components/listComponent/index.js +5 -5
  63. package/es/components/pay/toC/PaymentMethods/GlobePayAliPayH5/index.js +18 -3
  64. package/es/components/pay/toC/PaymentMethods/MWCreditCard/TDSPay/ThreedsLoading/index.d.ts +1 -1
  65. package/es/components/pay/toC/PaymentMethods/MWCreditCard/TDSPay/ThreedsLoading/index.js +7 -2
  66. package/es/components/pay/toC/PaymentMethods/MWCreditCard/TDSPay/ThreedsLoading/index.less +8 -0
  67. package/es/components/pay/toC/PaymentMethods/MWCreditCard/tds2.js +44 -18
  68. package/es/components/pay/toC/PaymentMethods/SuperPayAliPayH5/index.js +18 -3
  69. package/es/components/pay/toC/locales.d.ts +3 -0
  70. package/es/components/pay/toC/locales.js +3 -0
  71. package/es/components/productExtension/card/index.js +3 -3
  72. package/es/components/productExtension/fields/Actor/CutOffTime/index.js +1 -1
  73. package/es/components/productExtension/fields/Forms/index.js +12 -12
  74. package/es/components/productExtension/fields/SelectProducts/ProductItemPreview/index.js +1 -1
  75. package/es/components/productExtension/fields/SelectProducts/server.js +2 -2
  76. package/es/components/productExtension/fields/SelectResourcesTable/server.js +2 -2
  77. package/es/components/productExtension/server.js +2 -2
  78. package/es/components/ruleSetting/ruleBorder/index.js +1 -1
  79. package/es/components/schedules/calendar/index.js +4 -4
  80. package/es/components/schedules/calendar/serve.js +2 -2
  81. package/es/components/schedules/components/CurrentDay/index.js +5 -5
  82. package/es/components/schedules/components/CurrentDay/serve.js +2 -2
  83. package/es/components/schedules/components/DropdownSort/index.js +1 -1
  84. package/es/components/schedules/components/ResourceList/index.js +1 -1
  85. package/es/components/schedules/components/Search/index.js +5 -5
  86. package/es/components/schedules/model.js +5 -5
  87. package/es/components/schedules/openHours/index.js +1 -1
  88. package/es/components/schedules/openHours/serve.js +2 -2
  89. package/es/components/schedules/products/ProductDetailDrawer/ProductDetail/MaxParticipantsModule/index.js +1 -1
  90. package/es/components/schedules/products/ProductDetailDrawer/ProductDetail/ResourcesModule/index.js +5 -5
  91. package/es/components/schedules/products/ProductDetailDrawer/ProductDetail/SchedulesModule/index.js +4 -4
  92. package/es/components/schedules/products/ProductDetailDrawer/index.js +3 -3
  93. package/es/components/schedules/products/serve.js +2 -2
  94. package/es/components/schedules/products/utils.js +5 -5
  95. package/es/components/schedules/resources/detail/detailContent.js +2 -2
  96. package/es/components/schedules/resources/detail/index.js +10 -10
  97. package/es/components/schedules/resources/list/index.js +2 -2
  98. package/es/components/schedules/resources/relationProduct/index.js +1 -1
  99. package/es/components/schedules/resources/serve.js +2 -2
  100. package/es/components/schedules/schedules/ScheduleDetailDrawer/index.js +9 -9
  101. package/es/components/schedules/utils.d.ts +1 -1
  102. package/es/components/schedules/utils.js +4 -4
  103. package/es/components/selectModal/index.js +2 -2
  104. package/es/components/ticketBooking/components/menuBar/index.js +38 -2
  105. package/es/components/ticketBooking/components/menuBar/index.less +8 -0
  106. package/es/components/ticketBooking/locales.d.ts +3 -0
  107. package/es/components/ticketBooking/locales.js +6 -3
  108. package/es/hooks/useComponents.js +1 -1
  109. package/es/utils/index.d.ts +1 -1
  110. package/lib/components/Sales/Cart/index.js +1 -0
  111. package/lib/components/Sales/Cart/utils.d.ts +40 -0
  112. package/lib/components/Sales/Cart/utils.js +129 -0
  113. package/lib/components/Sales/Checkout/index.d.ts +4 -0
  114. package/lib/components/Sales/Checkout/index.js +39 -7
  115. package/lib/components/Sales/Checkout/serve.d.ts +13 -0
  116. package/lib/components/Sales/Checkout/serve.js +7 -2
  117. package/lib/components/Sales/Checkout/utils.d.ts +1 -0
  118. package/lib/components/Sales/Checkout/utils.js +5 -2
  119. package/lib/components/Sales/Event/Detail.d.ts +1 -0
  120. package/lib/components/Sales/Event/Detail.js +37 -12
  121. package/lib/components/Sales/Event/serve.d.ts +10 -0
  122. package/lib/components/Sales/Event/serve.js +7 -0
  123. package/lib/components/Sales/Summary/index.d.ts +10 -0
  124. package/lib/components/Sales/Summary/index.js +7 -1
  125. package/lib/components/Sales/Summary/serve.d.ts +1 -0
  126. package/lib/components/Sales/Summary/serve.js +32 -0
  127. package/lib/components/Sales/Summary/utils.d.ts +16 -1
  128. package/lib/components/Sales/Summary/utils.js +30 -1
  129. package/lib/components/appointmentBooking/components/Content/index.js +6 -1
  130. package/lib/components/appointmentBooking/components/Deposit/index.d.ts +6 -0
  131. package/lib/components/appointmentBooking/components/Deposit/index.js +36 -4
  132. package/lib/components/appointmentBooking/deposit/components/PolicyModal/index.js +8 -4
  133. package/lib/components/appointmentBooking/deposit/index.js +4 -2
  134. package/lib/components/booking/components/footer/index.js +24 -11
  135. package/lib/components/booking/info/service/addService/utils.d.ts +1 -1
  136. package/lib/components/booking/info/utils.js +3 -1
  137. package/lib/components/booking/info2/service/addService/utils.d.ts +1 -1
  138. package/lib/components/booking/info2/utilsByBooking.js +4 -1
  139. package/lib/components/booking/utils.d.ts +2 -2
  140. package/lib/components/eftposPay/amount.d.ts +1 -1
  141. package/lib/components/eftposPay/device.d.ts +1 -1
  142. package/lib/components/eftposPay/hooks.d.ts +2 -2
  143. package/lib/components/eftposPay/store/index.d.ts +5 -5
  144. package/lib/components/eventBooking/components/Provider/Cart/ContinueButton/index.js +16 -4
  145. package/lib/components/eventBooking/components/Provider/Cart/Deposit/index.d.ts +2 -0
  146. package/lib/components/eventBooking/components/Provider/Cart/Deposit/index.js +55 -0
  147. package/lib/components/eventBooking/components/Provider/Cart/Item/Total.js +8 -5
  148. package/lib/components/eventBooking/components/Provider/Cart/Item/index.js +4 -2
  149. package/lib/components/eventBooking/components/bookingDetailModal/index.js +4 -3
  150. package/lib/components/eventBooking/locales.d.ts +24 -0
  151. package/lib/components/eventBooking/locales.js +27 -3
  152. package/lib/components/pay/toC/PaymentMethods/GlobePayAliPayH5/index.js +13 -1
  153. package/lib/components/pay/toC/PaymentMethods/MWCreditCard/TDSPay/ThreedsLoading/index.d.ts +1 -1
  154. package/lib/components/pay/toC/PaymentMethods/MWCreditCard/TDSPay/ThreedsLoading/index.js +2 -2
  155. package/lib/components/pay/toC/PaymentMethods/MWCreditCard/TDSPay/ThreedsLoading/index.less +8 -0
  156. package/lib/components/pay/toC/PaymentMethods/MWCreditCard/tds2.js +66 -47
  157. package/lib/components/pay/toC/PaymentMethods/SuperPayAliPayH5/index.js +13 -1
  158. package/lib/components/pay/toC/locales.d.ts +3 -0
  159. package/lib/components/pay/toC/locales.js +3 -0
  160. package/lib/components/schedules/utils.d.ts +1 -1
  161. package/lib/components/schedules/utils.js +1 -1
  162. package/lib/components/ticketBooking/components/menuBar/index.js +42 -2
  163. package/lib/components/ticketBooking/components/menuBar/index.less +8 -0
  164. package/lib/components/ticketBooking/locales.d.ts +3 -0
  165. package/lib/components/ticketBooking/locales.js +6 -3
  166. package/lib/utils/index.d.ts +1 -1
  167. package/package.json +3 -3
@@ -14,6 +14,7 @@ interface EventDetailContextType {
14
14
  currentBookingOption: any;
15
15
  selectEventDetailProductDetail: (productDetail: any) => void;
16
16
  checkBeforeSelectEventDetail: () => boolean;
17
+ getProductDetailRequest: any;
17
18
  }
18
19
  interface EventDetailProviderProps {
19
20
  children: React.ReactNode;
@@ -196,20 +196,44 @@ var EventDetailProvider = ({
196
196
  }
197
197
  }
198
198
  );
199
+ const getProductDetailRequest = (0, import_ahooks.useRequest)(import_serve.getProductDetailApi, {
200
+ manual: true,
201
+ loadingDelay: 200
202
+ });
199
203
  const selectEventDetailBookingOptions = (id) => {
200
- var _a;
204
+ var _a, _b, _c;
201
205
  const { introduction, bookingOptions } = detailRef.current || {};
202
206
  const option = (_a = bookingOptions == null ? void 0 : bookingOptions.filter((v) => v.value === id)) == null ? void 0 : _a[0];
203
- _setDetail({
204
- introduction: {
205
- ...introduction,
206
- price: option.price,
207
- origin_price: option.original_price
208
- },
209
- selectedProduct: option
210
- // 选中的活动关联的商品
211
- });
212
- _setCurrentBookingOption(id);
207
+ const setSelectedData = (data) => {
208
+ _setDetail({
209
+ introduction: {
210
+ ...introduction,
211
+ price: data == null ? void 0 : data.price,
212
+ origin_price: data == null ? void 0 : data.original_price
213
+ },
214
+ selectedProduct: data
215
+ // 选中的活动关联的商品
216
+ });
217
+ _setCurrentBookingOption(id);
218
+ };
219
+ if (((_b = option == null ? void 0 : option._originData) == null ? void 0 : _b.is_eject) === 0) {
220
+ getProductDetailRequest.runAsync(id, {
221
+ open_deposit: 1,
222
+ front_end_cache_id: ((_c = introduction == null ? void 0 : introduction._originData) == null ? void 0 : _c.id) + "_" + id
223
+ }).then((res) => {
224
+ var _a2;
225
+ const custom_deposit_data = (_a2 = res == null ? void 0 : res.data) == null ? void 0 : _a2.custom_deposit_data;
226
+ const newOption = { ...option };
227
+ if (custom_deposit_data && newOption._originData) {
228
+ newOption._originData.custom_deposit_data = custom_deposit_data;
229
+ }
230
+ setSelectedData(newOption);
231
+ }).catch(() => {
232
+ setSelectedData(option);
233
+ });
234
+ } else {
235
+ setSelectedData(option);
236
+ }
213
237
  };
214
238
  const selectEventDetailProductDetail = (productDetail) => {
215
239
  _setDetail({ productDetail });
@@ -233,7 +257,8 @@ var EventDetailProvider = ({
233
257
  getEventDetailSelectDate,
234
258
  currentBookingOption,
235
259
  selectEventDetailProductDetail,
236
- checkBeforeSelectEventDetail
260
+ checkBeforeSelectEventDetail,
261
+ getProductDetailRequest
237
262
  };
238
263
  return /* @__PURE__ */ import_react.default.createElement(EventDetailContext.Provider, { value: contextValue }, children);
239
264
  };
@@ -37,3 +37,13 @@ export declare const getProductPrice: (params: {
37
37
  customer_id: number;
38
38
  schedule_date?: string;
39
39
  }) => Promise<any>;
40
+ /**
41
+ * 获取商品详情
42
+ * @param id 商品id
43
+ * @param params 参数
44
+ * @returns
45
+ */
46
+ export declare const getProductDetailApi: (id: number, params: {
47
+ open_deposit?: string | number;
48
+ front_end_cache_id?: string;
49
+ }) => Promise<any>;
@@ -24,6 +24,7 @@ __export(serve_exports, {
24
24
  getEventDetailSelectDateApi: () => getEventDetailSelectDateApi,
25
25
  getEventDetailTeacherApi: () => getEventDetailTeacherApi,
26
26
  getEventListApi: () => getEventListApi,
27
+ getProductDetailApi: () => getProductDetailApi,
27
28
  getProductPrice: () => getProductPrice
28
29
  });
29
30
  module.exports = __toCommonJS(serve_exports);
@@ -46,6 +47,11 @@ var getEventDetailSelectDateApi = (id, params) => {
46
47
  });
47
48
  };
48
49
  var getProductPrice = async (params) => import_utils.request.getRequest().post(`/h5/product/query/price`, params);
50
+ var getProductDetailApi = async (id, params) => {
51
+ return import_utils.request.getRequest().get(`/h5/product/standard/show/${id}`, params, {
52
+ useCache: true
53
+ });
54
+ };
49
55
  // Annotate the CommonJS export names for ESM import in node:
50
56
  0 && (module.exports = {
51
57
  getEventDetailBookingOptionsApi,
@@ -53,5 +59,6 @@ var getProductPrice = async (params) => import_utils.request.getRequest().post(`
53
59
  getEventDetailSelectDateApi,
54
60
  getEventDetailTeacherApi,
55
61
  getEventListApi,
62
+ getProductDetailApi,
56
63
  getProductPrice
57
64
  });
@@ -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
  * 计算商品小计(不含其他费用)
@@ -25,7 +30,7 @@ export declare const calculateSubtotal: (items: CartItem[]) => string;
25
30
  * @return {*}
26
31
  * @Author: xiangfeng.xue
27
32
  */
28
- export declare const calculateTaxFee: (shopInfo: any, items: CartItem[]) => "0.00" | Decimal;
33
+ export declare const calculateTaxFee: (shopInfo: any, items: CartItem[]) => Decimal | "0.00";
29
34
  /**
30
35
  * 计算所有价格明细
31
36
  * @param items - 购物车商品数组
@@ -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
@@ -190,6 +190,10 @@ var Layout = () => {
190
190
  if (isDateSelectedFirst && key === "select-date") return false;
191
191
  return key !== "confirm-information";
192
192
  }, [isDateSelectedFirst, (_e = currentStep == null ? void 0 : currentStep.step) == null ? void 0 : _e.key]);
193
+ const depositProtocolRequest = (id) => {
194
+ var _a2;
195
+ return (_a2 = appointmentBooking == null ? void 0 : appointmentBooking.getProtocol) == null ? void 0 : _a2.call(appointmentBooking, id);
196
+ };
193
197
  return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, !isRetailTemplate ? /* @__PURE__ */ import_react.default.createElement(import_Header.default, null) : null, /* @__PURE__ */ import_react.default.createElement(
194
198
  "div",
195
199
  {
@@ -214,7 +218,8 @@ var Layout = () => {
214
218
  onConfirm: () => closePolicy(true),
215
219
  item: policyParams == null ? void 0 : policyParams.content,
216
220
  onChange: () => setLoading(false),
217
- isHideCheckout: false
221
+ isHideCheckout: false,
222
+ depositProtocolRequest
218
223
  }
219
224
  ) : null);
220
225
  };
@@ -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
+ });
@@ -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
  };
@@ -54,7 +54,7 @@ var import_useIsBooking4Shop = require("../../hooks/useIsBooking4Shop");
54
54
  var import_utils4 = require("@pisell/utils");
55
55
  var import_dayjs = __toESM(require("dayjs"));
56
56
  var Footer = (props) => {
57
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
57
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
58
58
  const { state, buttons, dispatch, source } = props;
59
59
  const [showDetail, setShowDetail] = (0, import_react.useState)(false);
60
60
  const [loading, setLoading] = (0, import_react.useState)(false);
@@ -359,6 +359,12 @@ var Footer = (props) => {
359
359
  }
360
360
  });
361
361
  };
362
+ const paymentRefundedStatus = (0, import_react.useMemo)(() => {
363
+ var _a2;
364
+ return ["partially_refunded", "refunded"].includes(
365
+ (_a2 = state == null ? void 0 : state.bookingDetail) == null ? void 0 : _a2.payment_status
366
+ );
367
+ }, [state == null ? void 0 : state.bookingDetail]);
362
368
  const checkoutButton = (0, import_react.useMemo)(() => {
363
369
  let buttonType = "primary";
364
370
  if (transaction_habit_selection.type === "service_now_pay_later") {
@@ -608,7 +614,7 @@ var Footer = (props) => {
608
614
  }
609
615
  }, [state.bookingDetail, total.notPaidAmount]);
610
616
  const _buttons = (0, import_react.useMemo)(() => {
611
- if (state.appointment_status === "cancelled") {
617
+ if (state.appointment_status === "cancelled" || paymentRefundedStatus) {
612
618
  return [buttonMap.rebook];
613
619
  }
614
620
  if (source === "addons") {
@@ -674,6 +680,7 @@ var Footer = (props) => {
674
680
  isShowClearAll
675
681
  ]);
676
682
  const moreButton = (0, import_react.useMemo)(() => {
683
+ var _a2, _b2;
677
684
  let arr = [];
678
685
  if (!state.bookingId) {
679
686
  return [];
@@ -684,8 +691,11 @@ var Footer = (props) => {
684
691
  if (state.renderType === "eventBooking") {
685
692
  return [];
686
693
  }
694
+ if (((_a2 = state == null ? void 0 : state.bookingDetail) == null ? void 0 : _a2.payment_status) === "refunded") {
695
+ return [];
696
+ }
687
697
  if (_buttons.length !== 0) {
688
- if (state.bookingId && isShowPaymentLink) {
698
+ if (state.bookingId && isShowPaymentLink && ((_b2 = state == null ? void 0 : state.bookingDetail) == null ? void 0 : _b2.payment_status) !== "partially_refunded") {
689
699
  arr.push(actionMap.paymentLink);
690
700
  }
691
701
  }
@@ -708,7 +718,14 @@ var Footer = (props) => {
708
718
  arr.push(actionMap.rebook);
709
719
  }
710
720
  return arr;
711
- }, [state, total, isShowPaymentLink, source, _buttons.length]);
721
+ }, [
722
+ state,
723
+ total,
724
+ isShowPaymentLink,
725
+ source,
726
+ _buttons.length,
727
+ (_j = state == null ? void 0 : state.bookingDetail) == null ? void 0 : _j.payment_status
728
+ ]);
712
729
  const isOnlyDeposit = (0, import_react.useMemo)(() => {
713
730
  var _a2, _b2, _c2, _d2;
714
731
  if (((_a2 = state == null ? void 0 : state.bookingDetail) == null ? void 0 : _a2.deposit_payment_time) && ((_d2 = (_c2 = (_b2 = state == null ? void 0 : state.bookingDetail) == null ? void 0 : _b2.payment_types) == null ? void 0 : _c2.every) == null ? void 0 : _d2.call(
@@ -799,7 +816,7 @@ var Footer = (props) => {
799
816
  }, [
800
817
  state.bookingId,
801
818
  state.bookingDetail,
802
- (_j = state.addons) == null ? void 0 : _j.load,
819
+ (_k = state.addons) == null ? void 0 : _k.load,
803
820
  state.renderType
804
821
  ]);
805
822
  const menuChange = (e) => {
@@ -882,7 +899,7 @@ var Footer = (props) => {
882
899
  label: import_utils.locales.getText("pisell1.text.rounding")
883
900
  }
884
901
  ];
885
- }, [total, (_k = state.bookingDetail) == null ? void 0 : _k.surcharge, state, state.bookingId]);
902
+ }, [total, (_l = state.bookingDetail) == null ? void 0 : _l.surcharge, state, state.bookingId]);
886
903
  const orderTotalList = (0, import_react.useMemo)(() => {
887
904
  return [
888
905
  // 订单已付金额
@@ -916,11 +933,7 @@ var Footer = (props) => {
916
933
  label: import_utils.locales.getText("pisell2.text.refunded-amount")
917
934
  }
918
935
  ];
919
- }, [total, (_l = state.bookingDetail) == null ? void 0 : _l.surcharge, state, state.bookingId]);
920
- const paymentRefundedStatus = (0, import_react.useMemo)(() => {
921
- var _a2;
922
- return ["partially_refunded", "refunded"].includes((_a2 = state == null ? void 0 : state.bookingDetail) == null ? void 0 : _a2.payment_status);
923
- }, [state == null ? void 0 : state.bookingDetail]);
936
+ }, [total, (_m = state.bookingDetail) == null ? void 0 : _m.surcharge, state, state.bookingId]);
924
937
  return /* @__PURE__ */ import_react.default.createElement(import_antd.Skeleton, { title: false, round: true, loading: showFooter, active: true }, (hasGoodPassApp || hasDiscountCardApp) && ["addons", "info"].includes(source) && !paymentRefundedStatus ? /* @__PURE__ */ import_react.default.createElement(import_voucher.default, { state, dispatch, source }) : null, /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-footer-total" }, /* @__PURE__ */ import_react.default.createElement("span", { className: "pisell-lowcode__booking-footer-left" }, /* @__PURE__ */ import_react.default.createElement("span", { className: "pisell-lowcode__booking-footer-left-total" }, totalText), /* @__PURE__ */ import_react.default.createElement("span", { className: "pisell-lowcode__booking-footer-left-arrears" }, arrearsText)), /* @__PURE__ */ import_react.default.createElement(
925
938
  "span",
926
939
  {
@@ -6,7 +6,7 @@ export declare const getDurationProps: ({ cacheItem, useStartTime, currentResour
6
6
  type: string;
7
7
  value: number;
8
8
  };
9
- locale: string;
9
+ locale: any;
10
10
  slice: any;
11
11
  selectProps: {
12
12
  size: string;
@@ -143,7 +143,9 @@ var isBooking4Shop = (shopId, renderType) => {
143
143
  8872,
144
144
  6930,
145
145
  8824,
146
- 8913
146
+ 8913,
147
+ 8918,
148
+ 6413
147
149
  ];
148
150
  return booking4Shops.includes(shopId);
149
151
  };
@@ -7,7 +7,7 @@ export declare const getDurationProps: ({ cacheItem, useStartTime, currentResour
7
7
  type: string;
8
8
  value: number;
9
9
  };
10
- locale: string;
10
+ locale: any;
11
11
  slice: any;
12
12
  selectProps: {
13
13
  size: string;
@@ -69,7 +69,10 @@ var getResourceTimeIsUsable = (item, cacheItem, resourceItem) => {
69
69
  let timeEndDate = (0, import_dayjs.default)(time.end_date + " " + time.end_time).add(1, "second");
70
70
  let totalCount = getUseableEventCount(time.event_list, resourceItem.capacity);
71
71
  const currentCount = getSumCapacity({ cacheItem });
72
- const eventList = (time.event_list || []).filter((event) => event.id !== (cacheItem == null ? void 0 : cacheItem.booking_id));
72
+ let eventList = time.event_list || [];
73
+ if (cacheItem == null ? void 0 : cacheItem.booking_id) {
74
+ eventList = eventList.filter((event) => event.id !== (cacheItem == null ? void 0 : cacheItem.booking_id));
75
+ }
73
76
  let endDate = null;
74
77
  let isCalcCount = true;
75
78
  if (isFlexible) {
@@ -165,10 +165,10 @@ export declare const getProductTotalPrice: (item: any) => number;
165
165
  export declare const getDuration: (duration: number | {
166
166
  type: string;
167
167
  value: number;
168
- }) => number | "flexible" | {
168
+ }) => number | {
169
169
  type: string;
170
170
  value: number;
171
- };
171
+ } | "flexible";
172
172
  export declare const isWalkIn: (customer_id?: number | string) => boolean;
173
173
  export declare const getIsEdit: (state: any) => boolean;
174
174
  export {};
@@ -8,7 +8,7 @@ import { PosProps } from './const';
8
8
  */
9
9
  declare const _default: ({ className, onChange, onClose, formatAmount, isMobile, net, client }: {
10
10
  className?: string | undefined;
11
- onChange?: ((status: "success" | "page" | "print" | "fail" | "mark_tx_processed", params?: string | {
11
+ onChange?: ((status: "success" | "page" | "fail" | "print" | "mark_tx_processed", params?: string | {
12
12
  [keys: string]: unknown;
13
13
  } | undefined, other?: any) => void) | undefined;
14
14
  onClose: () => void;
@@ -10,7 +10,7 @@ import './device.less';
10
10
  declare const _default: ({ api, onChange, onClose, className, device_number, isMobile, net, client, formatAmount, }: {
11
11
  api: PayProps['api'];
12
12
  className?: string | undefined;
13
- onChange?: ((status: "success" | "page" | "print" | "fail" | "mark_tx_processed", params?: string | {
13
+ onChange?: ((status: "success" | "page" | "fail" | "print" | "mark_tx_processed", params?: string | {
14
14
  [keys: string]: unknown;
15
15
  } | undefined, other?: any) => void) | undefined;
16
16
  onClose: () => void;
@@ -15,11 +15,11 @@ export declare const useStoreRef: <T extends {
15
15
  readonly numRef: React.MutableRefObject<string | number | undefined>;
16
16
  readonly orderIdRef: React.MutableRefObject<string | number>;
17
17
  readonly modeRef: React.MutableRefObject<ModeEnum>;
18
- readonly statusRef: React.MutableRefObject<"success" | "loading" | "warn" | "fail" | "pedding" | "resove" | "reject" | "question">;
18
+ readonly statusRef: React.MutableRefObject<"success" | "warn" | "loading" | "fail" | "pedding" | "resove" | "reject" | "question">;
19
19
  readonly netRef: React.MutableRefObject<boolean | undefined>;
20
20
  readonly symbolRef: React.MutableRefObject<string>;
21
21
  readonly amountRef: React.MutableRefObject<string | number>;
22
- readonly eftposRef: React.MutableRefObject<"tyro" | "windcave" | "stripe" | "payo">;
22
+ readonly eftposRef: React.MutableRefObject<"payo" | "tyro" | "windcave" | "stripe">;
23
23
  readonly clientRef: React.MutableRefObject<ClientEnum>;
24
24
  readonly dataRef: React.MutableRefObject<import("./store").State>;
25
25
  };