@pisell/private-materials 3.2.21 → 3.2.23

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 (183) 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 +8 -8
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +8 -8
  11. package/es/components/appointmentBooking/assets/guests.svg +1 -0
  12. package/es/components/appointmentBooking/components/Cart/ContinueButton/index.js +83 -104
  13. package/es/components/appointmentBooking/components/Cart/Item/Total.js +1 -0
  14. package/es/components/appointmentBooking/components/Cart/Item/index.js +36 -17
  15. package/es/components/appointmentBooking/components/Cart/Item/index.less +7 -4
  16. package/es/components/appointmentBooking/components/Cart/index.d.ts +0 -1
  17. package/es/components/appointmentBooking/components/Content/index.js +11 -11
  18. package/es/components/appointmentBooking/components/Date/index.js +49 -32
  19. package/es/components/appointmentBooking/components/Date/index.less +5 -0
  20. package/es/components/appointmentBooking/components/Guest/index.js +8 -21
  21. package/es/components/appointmentBooking/components/Header/index.js +44 -7
  22. package/es/components/appointmentBooking/components/Resource/index.d.ts +1 -1
  23. package/es/components/appointmentBooking/components/Resource/index.js +28 -20
  24. package/es/components/appointmentBooking/components/Resource/index.less +5 -0
  25. package/es/components/appointmentBooking/components/Services/index.js +20 -9
  26. package/es/components/appointmentBooking/components/TimeSlicing/index.js +47 -32
  27. package/es/components/appointmentBooking/components/TimeSlicing/index.less +4 -0
  28. package/es/components/appointmentBooking/components/Voucher/index.d.ts +4 -0
  29. package/es/components/appointmentBooking/components/Voucher/index.js +238 -0
  30. package/es/components/appointmentBooking/components/Voucher/index.less +26 -0
  31. package/es/components/appointmentBooking/context.d.ts +2 -0
  32. package/es/components/appointmentBooking/context.js +7 -1
  33. package/es/components/appointmentBooking/hooks.d.ts +46 -9
  34. package/es/components/appointmentBooking/hooks.js +162 -121
  35. package/es/components/appointmentBooking/index.js +12 -7
  36. package/es/components/appointmentBooking/locales.d.ts +57 -0
  37. package/es/components/appointmentBooking/locales.js +60 -3
  38. package/es/components/appointmentBooking/utils.d.ts +19 -0
  39. package/es/components/appointmentBooking/utils.js +71 -2
  40. package/es/components/booking/addons/index.js +1 -0
  41. package/es/components/booking/components/TabProduct/index.d.ts +1 -0
  42. package/es/components/booking/components/TabProduct/productItem/index.d.ts +1 -0
  43. package/es/components/booking/components/footer/index.js +5 -1
  44. package/es/components/booking/components/footer/utils.js +18 -2
  45. package/es/components/booking/components/voucher/index.d.ts +3 -0
  46. package/es/components/booking/components/voucher/index.js +238 -0
  47. package/es/components/booking/components/voucher/index.less +88 -0
  48. package/es/components/booking/components/voucher/pisellGoodPassCard/index.d.ts +47 -0
  49. package/es/components/booking/components/voucher/pisellGoodPassCard/index.js +115 -0
  50. package/es/components/booking/components/voucher/pisellGoodPassCard/index.less +52 -0
  51. package/es/components/booking/hooks/useIsBooking4Shop.d.ts +1 -0
  52. package/es/components/booking/hooks/useIsBooking4Shop.js +10 -0
  53. package/es/components/booking/info/clientVariant/hooks/useClientFn.d.ts +1 -0
  54. package/es/components/booking/info/date/index.d.ts +1 -0
  55. package/es/components/booking/info/dateRange/index.d.ts +1 -0
  56. package/es/components/booking/info/notes/index.d.ts +1 -0
  57. package/es/components/booking/info/service/actions/index.d.ts +1 -0
  58. package/es/components/booking/info/service/editService/BookingList/index.d.ts +1 -0
  59. package/es/components/booking/info/service/serviceItem/index.d.ts +1 -0
  60. package/es/components/booking/info/service/serviceList/index.d.ts +1 -0
  61. package/es/components/booking/info/service2/Lists.d.ts +1 -0
  62. package/es/components/booking/info/utils.js +1 -1
  63. package/es/components/booking/info2/service/actions/index.d.ts +1 -0
  64. package/es/components/booking/info2/service/editService/index.js +9 -0
  65. package/es/components/booking/info2/service/serviceItem/index.d.ts +1 -0
  66. package/es/components/booking/info2/service/serviceList/index.d.ts +1 -0
  67. package/es/components/booking/locales.d.ts +18 -0
  68. package/es/components/booking/locales.js +21 -3
  69. package/es/components/booking/materiels/duration/index.d.ts +1 -0
  70. package/es/components/booking/materiels/holder/index.d.ts +1 -0
  71. package/es/components/booking/materiels/startTime/index.d.ts +1 -0
  72. package/es/components/booking/payments/index.js +1 -0
  73. package/es/components/booking/utils.d.ts +2 -2
  74. package/es/components/eftposPay/hooks.d.ts +2 -2
  75. package/es/components/eftposPay/store/index.d.ts +6 -6
  76. package/es/components/eventBooking/components/Provider/Cart/index.d.ts +0 -1
  77. package/es/components/eventBooking/components/Provider/Content/index.d.ts +0 -1
  78. package/es/components/eventBooking/components/Provider/Information/index.d.ts +3 -0
  79. package/es/components/productExtension/fields/Actor/index.d.ts +1 -0
  80. package/es/components/productExtension/fields/SelectProducts/index.d.ts +1 -0
  81. package/es/components/shoppingCart/components/Cart/Product.js +3 -0
  82. package/es/components/shoppingCart/components/Cart/index.d.ts +1 -0
  83. package/es/components/shoppingCart/components/Empty/index.d.ts +1 -0
  84. package/es/components/shoppingCart/components/Render/index.d.ts +1 -0
  85. package/es/components/shoppingCart/hooks/useAddService.d.ts +1 -0
  86. package/es/components/shoppingCart/hooks/useClearCart.js +4 -3
  87. package/es/components/shoppingCart/index.d.ts +1 -0
  88. package/es/components/shoppingCart/type.d.ts +1 -0
  89. package/es/components/wallet/Detail/index.js +20 -14
  90. package/es/components/wallet/Voucher/index.js +1 -0
  91. package/es/components/wallet/index.js +15 -1
  92. package/es/components/wallet/locales.d.ts +3 -0
  93. package/es/components/wallet/locales.js +3 -0
  94. package/es/components/wallet/model.d.ts +1 -1
  95. package/es/components/wallet/utils/formatUtils.js +1 -1
  96. package/es/components/walletList/index.js +5 -1
  97. package/lib/components/appointmentBooking/assets/guests.svg +1 -0
  98. package/lib/components/appointmentBooking/components/Cart/ContinueButton/index.js +37 -27
  99. package/lib/components/appointmentBooking/components/Cart/Item/Total.js +1 -0
  100. package/lib/components/appointmentBooking/components/Cart/Item/index.js +24 -11
  101. package/lib/components/appointmentBooking/components/Cart/Item/index.less +7 -4
  102. package/lib/components/appointmentBooking/components/Cart/index.d.ts +0 -1
  103. package/lib/components/appointmentBooking/components/Content/index.js +3 -5
  104. package/lib/components/appointmentBooking/components/Date/index.js +53 -47
  105. package/lib/components/appointmentBooking/components/Date/index.less +5 -0
  106. package/lib/components/appointmentBooking/components/Guest/index.js +6 -5
  107. package/lib/components/appointmentBooking/components/Header/index.js +25 -3
  108. package/lib/components/appointmentBooking/components/Resource/index.d.ts +1 -1
  109. package/lib/components/appointmentBooking/components/Resource/index.js +16 -17
  110. package/lib/components/appointmentBooking/components/Resource/index.less +5 -0
  111. package/lib/components/appointmentBooking/components/Services/index.js +21 -2
  112. package/lib/components/appointmentBooking/components/TimeSlicing/index.js +23 -21
  113. package/lib/components/appointmentBooking/components/TimeSlicing/index.less +4 -0
  114. package/lib/components/appointmentBooking/components/Voucher/index.d.ts +4 -0
  115. package/lib/components/appointmentBooking/components/Voucher/index.js +221 -0
  116. package/lib/components/appointmentBooking/components/Voucher/index.less +26 -0
  117. package/lib/components/appointmentBooking/context.d.ts +2 -0
  118. package/lib/components/appointmentBooking/context.js +4 -1
  119. package/lib/components/appointmentBooking/hooks.d.ts +46 -9
  120. package/lib/components/appointmentBooking/hooks.js +36 -43
  121. package/lib/components/appointmentBooking/index.js +11 -7
  122. package/lib/components/appointmentBooking/locales.d.ts +57 -0
  123. package/lib/components/appointmentBooking/locales.js +60 -3
  124. package/lib/components/appointmentBooking/utils.d.ts +19 -0
  125. package/lib/components/appointmentBooking/utils.js +42 -2
  126. package/lib/components/booking/addons/index.js +1 -1
  127. package/lib/components/booking/components/TabProduct/index.d.ts +1 -0
  128. package/lib/components/booking/components/TabProduct/productItem/index.d.ts +1 -0
  129. package/lib/components/booking/components/footer/index.js +2 -1
  130. package/lib/components/booking/components/footer/utils.js +4 -1
  131. package/lib/components/booking/components/voucher/index.d.ts +3 -0
  132. package/lib/components/booking/components/voucher/index.js +222 -0
  133. package/lib/components/booking/components/voucher/index.less +88 -0
  134. package/lib/components/booking/components/voucher/pisellGoodPassCard/index.d.ts +47 -0
  135. package/lib/components/booking/components/voucher/pisellGoodPassCard/index.js +109 -0
  136. package/lib/components/booking/components/voucher/pisellGoodPassCard/index.less +52 -0
  137. package/lib/components/booking/hooks/useIsBooking4Shop.d.ts +1 -0
  138. package/lib/components/booking/hooks/useIsBooking4Shop.js +51 -0
  139. package/lib/components/booking/info/clientVariant/hooks/useClientFn.d.ts +1 -0
  140. package/lib/components/booking/info/date/index.d.ts +1 -0
  141. package/lib/components/booking/info/dateRange/index.d.ts +1 -0
  142. package/lib/components/booking/info/notes/index.d.ts +1 -0
  143. package/lib/components/booking/info/service/actions/index.d.ts +1 -0
  144. package/lib/components/booking/info/service/editService/BookingList/index.d.ts +1 -0
  145. package/lib/components/booking/info/service/serviceItem/index.d.ts +1 -0
  146. package/lib/components/booking/info/service/serviceList/index.d.ts +1 -0
  147. package/lib/components/booking/info/service2/Lists.d.ts +1 -0
  148. package/lib/components/booking/info/utils.js +1 -1
  149. package/lib/components/booking/info2/service/actions/index.d.ts +1 -0
  150. package/lib/components/booking/info2/service/editService/index.js +8 -0
  151. package/lib/components/booking/info2/service/serviceItem/index.d.ts +1 -0
  152. package/lib/components/booking/info2/service/serviceList/index.d.ts +1 -0
  153. package/lib/components/booking/locales.d.ts +18 -0
  154. package/lib/components/booking/locales.js +21 -3
  155. package/lib/components/booking/materiels/duration/index.d.ts +1 -0
  156. package/lib/components/booking/materiels/holder/index.d.ts +1 -0
  157. package/lib/components/booking/materiels/startTime/index.d.ts +1 -0
  158. package/lib/components/booking/payments/index.js +1 -1
  159. package/lib/components/booking/utils.d.ts +2 -2
  160. package/lib/components/eftposPay/hooks.d.ts +2 -2
  161. package/lib/components/eftposPay/store/index.d.ts +6 -6
  162. package/lib/components/eventBooking/components/Provider/Cart/index.d.ts +0 -1
  163. package/lib/components/eventBooking/components/Provider/Content/index.d.ts +0 -1
  164. package/lib/components/eventBooking/components/Provider/Information/index.d.ts +3 -0
  165. package/lib/components/productExtension/fields/Actor/index.d.ts +1 -0
  166. package/lib/components/productExtension/fields/SelectProducts/index.d.ts +1 -0
  167. package/lib/components/shoppingCart/components/Cart/Product.js +1 -0
  168. package/lib/components/shoppingCart/components/Cart/index.d.ts +1 -0
  169. package/lib/components/shoppingCart/components/Empty/index.d.ts +1 -0
  170. package/lib/components/shoppingCart/components/Render/index.d.ts +1 -0
  171. package/lib/components/shoppingCart/hooks/useAddService.d.ts +1 -0
  172. package/lib/components/shoppingCart/hooks/useClearCart.js +3 -2
  173. package/lib/components/shoppingCart/index.d.ts +1 -0
  174. package/lib/components/shoppingCart/type.d.ts +1 -0
  175. package/lib/components/wallet/Detail/index.js +6 -1
  176. package/lib/components/wallet/Voucher/index.js +1 -0
  177. package/lib/components/wallet/index.js +15 -1
  178. package/lib/components/wallet/locales.d.ts +3 -0
  179. package/lib/components/wallet/locales.js +3 -0
  180. package/lib/components/wallet/model.d.ts +1 -1
  181. package/lib/components/wallet/utils/formatUtils.js +1 -1
  182. package/lib/components/walletList/index.js +6 -2
  183. package/package.json +3 -3
@@ -94,11 +94,30 @@ var locales_default = {
94
94
  "pisell2.event.capacity.limit.reached.title": "Capacity limit reached",
95
95
  "pisell2.event.capacity.limit.reached.tip": "One or more events in your cart are no longer available due to full capacity. Please remove unavailable events from your cart to complete checkout.",
96
96
  "pisell2.appointment.booking.empty.service": "No service",
97
+ "pisell2.appointment.booking.empty.time": "No time",
97
98
  "pisell2.appointment.service.title": (val) => `${val} ${val > 1 ? "services" : "service"}`,
98
99
  "pisell2.appointment.add.guest": "Add guest",
99
100
  "pisell2.appointment.edit.service": "Edit services",
100
101
  "pisell2.appointment.remove.guest": "Remove guest",
101
- "pisell2.appointment.no.available.service": "No available times for this service. Please choose another."
102
+ "pisell2.appointment.no.available.service": "No available times for this service. Please choose another.",
103
+ "pisell2.appointment.max.guest": "Book a group appointment for up to 6 guests",
104
+ "pisell2.appointment.no.available.time": "No availability Try booking different time",
105
+ "pisell2.appointment.monday": "Mon",
106
+ "pisell2.appointment.tuesday": "Tue",
107
+ "pisell2.appointment.wednesday": "Wed",
108
+ "pisell2.appointment.thursday": "Thu",
109
+ "pisell2.appointment.friday": "Fri",
110
+ "pisell2.appointment.saturday": "Sat",
111
+ "pisell2.appointment.sunday": "Sun",
112
+ "pisell2.text.apply": "Apply",
113
+ "pisell2.text.goodpass": "GoodPass",
114
+ "pisell2.text.goodpass.product-vouchers": "Product Vouchers",
115
+ "pisell2.text.goodpass.view-more": "View More",
116
+ "pisell2.text.goodpass.code": "Code",
117
+ "pisell2.text.goodpass.enter-code": "Enter Code",
118
+ "pisell2.text.goodpass.code-invalid": "Current code is invalid",
119
+ "pisell2.text.goodpass.login": "Login",
120
+ "pisell2.text.goodpass.login-tip": " for member benefit Or use account credit"
102
121
  },
103
122
  "zh-CN": {
104
123
  "pisell2.event.calendar.limit.unavailable": "不可预约",
@@ -171,11 +190,30 @@ var locales_default = {
171
190
  "pisell2.event.capacity.limit.reached.title": "活动名额已满",
172
191
  "pisell2.event.capacity.limit.reached.tip": "购物车中有一个或多个活动已达预约上限,请将已满额的活动从购物车中移除后再完成结算。",
173
192
  "pisell2.appointment.booking.empty.service": "暂无服务",
193
+ "pisell2.appointment.booking.empty.time": "暂无时间",
174
194
  "pisell2.appointment.service.title": (val) => `${val}个服务`,
175
195
  "pisell2.appointment.add.guest": "添加预约人",
176
196
  "pisell2.appointment.edit.service": "编辑服务",
177
197
  "pisell2.appointment.remove.guest": "移除预约人",
178
- "pisell2.appointment.no.available.service": "此服务无可用时间,请选择其他服务。"
198
+ "pisell2.appointment.no.available.service": "此服务无可用时间,请选择其他服务。",
199
+ "pisell2.appointment.max.guest": "最多为6人预约",
200
+ "pisell2.appointment.no.available.time": "无可用 请选择其他时间",
201
+ "pisell2.appointment.monday": "周一",
202
+ "pisell2.appointment.tuesday": "周二",
203
+ "pisell2.appointment.wednesday": "周三",
204
+ "pisell2.appointment.thursday": "周四",
205
+ "pisell2.appointment.friday": "周五",
206
+ "pisell2.appointment.saturday": "周六",
207
+ "pisell2.appointment.sunday": "周日",
208
+ "pisell2.text.apply": "应用",
209
+ "pisell2.text.goodpass": "商品券",
210
+ "pisell2.text.goodpass.product-vouchers": "商品兑换券",
211
+ "pisell2.text.goodpass.view-more": "查看更多",
212
+ "pisell2.text.goodpass.code": "券码",
213
+ "pisell2.text.goodpass.enter-code": "请输入券码",
214
+ "pisell2.text.goodpass.code-invalid": "当前券码不可用",
215
+ "pisell2.text.goodpass.login": "登录",
216
+ "pisell2.text.goodpass.login-tip": "以获取会员福利或使用账户积分"
179
217
  },
180
218
  "zh-HK": {
181
219
  "pisell2.event.calendar.limit.unavailable": "不可預約",
@@ -248,10 +286,29 @@ var locales_default = {
248
286
  "pisell2.event.capacity.limit.reached.title": "活動名額已滿",
249
287
  "pisell2.event.capacity.limit.reached.tip": "購物車中有一個或多個活動已達預約上限,請將已滿額的活動從購物車中移除後再完成結算。",
250
288
  "pisell2.appointment.booking.empty.service": "暫無服務",
289
+ "pisell2.appointment.booking.empty.time": "暫無時間",
251
290
  "pisell2.appointment.service.title": (val) => `${val}个服務`,
252
291
  "pisell2.appointment.add.guest": "添加預約人",
253
292
  "pisell2.appointment.edit.service": "編輯服務",
254
293
  "pisell2.appointment.remove.guest": "移除預約人",
255
- "pisell2.appointment.no.available.service": "此服务无可用时间,请选择其他服务。"
294
+ "pisell2.appointment.no.available.service": "此服务无可用时间,请选择其他服务。",
295
+ "pisell2.appointment.max.guest": "最多为6人预约",
296
+ "pisell2.appointment.no.available.time": "無可用 請選擇其他時間",
297
+ "pisell2.appointment.monday": "周壹",
298
+ "pisell2.appointment.tuesday": "周二",
299
+ "pisell2.appointment.wednesday": "周三",
300
+ "pisell2.appointment.thursday": "周四",
301
+ "pisell2.appointment.friday": "周五",
302
+ "pisell2.appointment.saturday": "周六",
303
+ "pisell2.appointment.sunday": "周日",
304
+ "pisell2.text.apply": "應用",
305
+ "pisell2.text.goodpass": "商品券",
306
+ "pisell2.text.goodpass.product-vouchers": "商品兌換券",
307
+ "pisell2.text.goodpass.view-more": "查看更多",
308
+ "pisell2.text.goodpass.code": "券碼",
309
+ "pisell2.text.goodpass.enter-code": "請輸入券碼",
310
+ "pisell2.text.goodpass.code-invalid": "當前券碼不可用",
311
+ "pisell2.text.goodpass.login": "登錄",
312
+ "pisell2.text.goodpass.login-tip": "以獲取會員福利或使用賬戶積分"
256
313
  }
257
314
  };
@@ -56,3 +56,22 @@ export declare const formatCarts: (data: any[], resources: any[]) => any[];
56
56
  * @Date: 2025-04-14 11:16
57
57
  */
58
58
  export declare const sortResources: (resources: any[], resourceSort: any[]) => any[] | undefined;
59
+ export declare const getMeAccount: (val: any[]) => any;
60
+ export declare const formatCustomer: (val: any) => {
61
+ id: any;
62
+ username: string;
63
+ };
64
+ export declare const formatCurrentUser: () => {
65
+ id: any;
66
+ username: string;
67
+ };
68
+ /**
69
+ * @title: 检查是否有空的账户
70
+ * @description:
71
+ * @param {any} carts
72
+ * @param {any} accounts
73
+ * @return {*}
74
+ * @Author: WangHan
75
+ * @Date: 2025-04-15 17:05
76
+ */
77
+ export declare const isEmptyGuest: (carts: any[], accounts: any[]) => boolean;
@@ -31,16 +31,21 @@ var utils_exports = {};
31
31
  __export(utils_exports, {
32
32
  formatBackgroundColors: () => formatBackgroundColors,
33
33
  formatCarts: () => formatCarts,
34
+ formatCurrentUser: () => formatCurrentUser,
35
+ formatCustomer: () => formatCustomer,
34
36
  formatGuest: () => formatGuest,
35
37
  formatHolder: () => formatHolder,
36
38
  formatMonthDisplay: () => formatMonthDisplay,
39
+ getMeAccount: () => getMeAccount,
37
40
  getScheduleColors: () => getScheduleColors,
38
41
  getUsableSchedules: () => getUsableSchedules,
42
+ isEmptyGuest: () => isEmptyGuest,
39
43
  resourceTitle: () => resourceTitle,
40
44
  sortResources: () => sortResources
41
45
  });
42
46
  module.exports = __toCommonJS(utils_exports);
43
47
  var import_dayjs = __toESM(require("dayjs"));
48
+ var import_utils = require("@pisell/utils");
44
49
  var import_useEngineContext = __toESM(require("../../hooks/useEngineContext"));
45
50
  var formatBackgroundColors = (colors) => {
46
51
  let _colors = Array.from(new Set(colors.map((color) => color == null ? void 0 : color.toLocaleLowerCase()) || [])).filter((d) => !!d);
@@ -115,7 +120,6 @@ var formatCarts = (data, resources) => {
115
120
  const utils = context.appHelper.utils || {};
116
121
  const locale = ((_a = utils == null ? void 0 : utils.storage) == null ? void 0 : _a.get("umi_locale")) || "en-US";
117
122
  const symbol = (utils == null ? void 0 : utils.getSymbolic()) || "$";
118
- console.log(resources, data, "wh987utils");
119
123
  return data == null ? void 0 : data.map((d) => {
120
124
  var _a2, _b;
121
125
  const currentResource = resources.find((r) => (d == null ? void 0 : d._id) === (r == null ? void 0 : r._id));
@@ -133,7 +137,9 @@ var formatCarts = (data, resources) => {
133
137
  duration_type: d.duration.type,
134
138
  locale,
135
139
  symbol,
136
- resources: currentResources
140
+ resources: currentResources,
141
+ is_hide_like: true,
142
+ holder_title: ""
137
143
  };
138
144
  });
139
145
  };
@@ -166,15 +172,49 @@ var sortResources = (resources, resourceSort) => {
166
172
  console.log(error, "wh2222");
167
173
  }
168
174
  };
175
+ var getMeAccount = (val) => {
176
+ return val == null ? void 0 : val.find((d) => !(d == null ? void 0 : d.isGuest));
177
+ };
178
+ var formatCustomer = (val) => {
179
+ let currentUserName = `${(val == null ? void 0 : val.first_name) || ""}${(val == null ? void 0 : val.last_name) ? ` ${val == null ? void 0 : val.last_name}` : ""}`;
180
+ currentUserName = currentUserName || (val == null ? void 0 : val.nickname) || "Me";
181
+ return {
182
+ id: (val == null ? void 0 : val.id) || (0, import_utils.getUniqueId)(),
183
+ username: currentUserName
184
+ };
185
+ };
186
+ var formatCurrentUser = () => {
187
+ var _a, _b;
188
+ const context = (0, import_useEngineContext.default)();
189
+ const utils = context.appHelper.utils || {};
190
+ let userInfo = (_b = (_a = utils.getStore().getState()) == null ? void 0 : _a.global) == null ? void 0 : _b.userInfo;
191
+ const localUserInfo = JSON.parse(utils.storage.get("customer") || "{}");
192
+ userInfo = (userInfo == null ? void 0 : userInfo.id) ? userInfo : localUserInfo;
193
+ const customer = formatCustomer(userInfo);
194
+ return customer;
195
+ };
196
+ var isEmptyGuest = (carts, accounts) => {
197
+ for (const item of accounts) {
198
+ const hasMatch = carts.some((firstItem) => firstItem.holder_id === item.id);
199
+ if (!hasMatch) {
200
+ return true;
201
+ }
202
+ }
203
+ return false;
204
+ };
169
205
  // Annotate the CommonJS export names for ESM import in node:
170
206
  0 && (module.exports = {
171
207
  formatBackgroundColors,
172
208
  formatCarts,
209
+ formatCurrentUser,
210
+ formatCustomer,
173
211
  formatGuest,
174
212
  formatHolder,
175
213
  formatMonthDisplay,
214
+ getMeAccount,
176
215
  getScheduleColors,
177
216
  getUsableSchedules,
217
+ isEmptyGuest,
178
218
  resourceTitle,
179
219
  sortResources
180
220
  });
@@ -355,7 +355,7 @@ var Addons = (0, import_model.Provider)((props) => {
355
355
  if (!state.bookingId) {
356
356
  return null;
357
357
  }
358
- return /* @__PURE__ */ import_react.default.createElement(import_footer.default, { state, buttons: _footer, source: "addons" });
358
+ return /* @__PURE__ */ import_react.default.createElement(import_footer.default, { state, dispatch, buttons: _footer, source: "addons" });
359
359
  }, [state, _footer]);
360
360
  const editProductDetail = (item) => {
361
361
  if (state.disabledEdit) {
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import "./index.less";
2
3
  interface TabProductProps {
3
4
  list: any[];
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import './index.less';
2
3
  declare const ProductItem: ({ item, onClick, amountSymbol, style, className, }: any) => JSX.Element;
3
4
  export default ProductItem;
@@ -49,6 +49,7 @@ var import_amount = require("./amount");
49
49
  var import_index = require("./index.less");
50
50
  var import_serve2 = require("./serve");
51
51
  var import_utils4 = require("./utils");
52
+ var import_voucher = __toESM(require("../voucher"));
52
53
  var Footer = (props) => {
53
54
  var _a, _b, _c, _d, _e, _f, _g, _h, _i;
54
55
  const { state, buttons, dispatch, source } = props;
@@ -782,7 +783,7 @@ var Footer = (props) => {
782
783
  break;
783
784
  }
784
785
  };
785
- return /* @__PURE__ */ import_react.default.createElement(import_antd.Skeleton, { title: false, round: true, loading: showFooter, active: true }, /* @__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(
786
+ return /* @__PURE__ */ import_react.default.createElement(import_antd.Skeleton, { title: false, round: true, loading: showFooter, active: true }, /* @__PURE__ */ import_react.default.createElement(import_voucher.default, { state, dispatch }), /* @__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(
786
787
  "span",
787
788
  {
788
789
  className: "pisell-lowcode__booking-footer-right",
@@ -193,12 +193,13 @@ var formatProducts = (item) => {
193
193
  const total = Number(item._extend.total);
194
194
  const origin_total = Number(item._extend.origin_total);
195
195
  const discount_amount = origin_total - total;
196
+ const discount_list = (item == null ? void 0 : item.discount_list) || [];
196
197
  const discount_type = discount_amount < 0 ? "change_price" : "discount";
197
198
  return {
198
199
  "num": item._extend.quantity,
199
200
  "price": formatProductPrice(item),
200
201
  "product_id": (item == null ? void 0 : item.product_id) || item.id,
201
- "discount_amount": discount_amount,
202
+ "discount_amount": discount_list.length > 0 ? 0 : discount_amount,
202
203
  "product_discount_reason": item._extend.discount_reason || "",
203
204
  "is_charge_tax": item.is_charge_tax,
204
205
  "note": (item == null ? void 0 : item.note) || "",
@@ -210,6 +211,7 @@ var formatProducts = (item) => {
210
211
  "bundle_edit": item._extend.bundle_edit,
211
212
  "product_option_item": formatProductOption((_d = (_c = item._extend) == null ? void 0 : _c.other) == null ? void 0 : _d.option),
212
213
  "product_variant_id": ((_f = (_e = item._extend) == null ? void 0 : _e.other) == null ? void 0 : _f.product_variant_id) || 0,
214
+ "discount_list": discount_list,
213
215
  metadata: formatMetaData(item)
214
216
  };
215
217
  };
@@ -363,6 +365,7 @@ var formatValues = (state) => {
363
365
  ...values,
364
366
  ...customer
365
367
  };
368
+ debugger;
366
369
  values.holder = formatHolder(state, values);
367
370
  if (isDay) {
368
371
  values.relation_products = formatRelationProducts(state);
@@ -0,0 +1,3 @@
1
+ import './index.less';
2
+ declare const VoucherCard: (props: any) => JSX.Element | null;
3
+ export default VoucherCard;
@@ -0,0 +1,222 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // src/components/booking/components/voucher/index.tsx
30
+ var voucher_exports = {};
31
+ __export(voucher_exports, {
32
+ default: () => voucher_default
33
+ });
34
+ module.exports = __toCommonJS(voucher_exports);
35
+ var import_react = __toESM(require("react"));
36
+ var import_ChevronDown = __toESM(require("@pisell/icon/es/ChevronDown"));
37
+ var import_classnames = __toESM(require("classnames"));
38
+ var import_antd = require("antd");
39
+ var import_utils = require("@pisell/utils");
40
+ var import_useEngineContext = __toESM(require("../../../../hooks/useEngineContext"));
41
+ var import_materials = require("@pisell/materials");
42
+ var import_icons = require("@ant-design/icons");
43
+ var import_useIsBooking4Shop = require("../../hooks/useIsBooking4Shop");
44
+ var import_index = require("./index.less");
45
+ var ShopDiscountHooks = {
46
+ onInited: "shopDiscount:onInited",
47
+ onDestroy: "shopDiscount:onDestroy",
48
+ onLoadDiscountList: "shopDiscount:onLoadDiscountList",
49
+ onCustomerChange: "shopDiscount:onCustomerChange",
50
+ onDiscountListChange: "shopDiscount:onDiscountListChange",
51
+ onRulesListChange: "shopDiscount:onRulesListChange",
52
+ onLoadPrepareCalcResult: "shopDiscount:onLoadPrepareCalcResult"
53
+ };
54
+ var VoucherCard = (props) => {
55
+ var _a, _b;
56
+ const context = (0, import_useEngineContext.default)();
57
+ const [showDetail, setShowDetail] = (0, import_react.useState)(true);
58
+ const { state, dispatch } = props;
59
+ const { pisellos } = (_a = context.appHelper) == null ? void 0 : _a.utils;
60
+ const [code, setCode] = (0, import_react.useState)("");
61
+ const [discountList, setDisCountList] = (0, import_react.useState)([]);
62
+ const productRef = (0, import_react.useRef)(state.service.value);
63
+ const isBooking4Shop = (0, import_useIsBooking4Shop.useIsBooking4Shop)(state);
64
+ const shopDiscount = pisellos.getModule("shopDiscount");
65
+ const availableData = (0, import_react.useMemo)(() => {
66
+ if (!isBooking4Shop) return [];
67
+ const shopDiscount2 = pisellos.getModule("shopDiscount");
68
+ return discountList.filter((item) => !!item.isAvailable).map((discount) => {
69
+ return {
70
+ ...discount,
71
+ savedAmount: shopDiscount2.calcDiscountApplicableProductTotalPrice(discount)
72
+ };
73
+ });
74
+ }, [discountList, isBooking4Shop]);
75
+ (0, import_react.useEffect)(() => {
76
+ if (isBooking4Shop) {
77
+ shopDiscount.setCustomer(state.client.value);
78
+ }
79
+ }, [(_b = state.client.value) == null ? void 0 : _b.id, isBooking4Shop]);
80
+ (0, import_react.useEffect)(() => {
81
+ if (isBooking4Shop) {
82
+ shopDiscount.setProductList(state.service.value);
83
+ }
84
+ }, [state.service.value, isBooking4Shop]);
85
+ (0, import_react.useEffect)(() => {
86
+ if (productRef.current === state.service.value) {
87
+ return;
88
+ }
89
+ if (isBooking4Shop) {
90
+ const val = shopDiscount.calcDiscount(state.service.value);
91
+ console.log("input: ", state.service.value);
92
+ console.log("output: ", val);
93
+ productRef.current = val.productList;
94
+ dispatch({
95
+ type: "setService",
96
+ payload: {
97
+ value: val.productList
98
+ }
99
+ });
100
+ }
101
+ }, [state.service.value, isBooking4Shop]);
102
+ (0, import_react.useEffect)(() => {
103
+ if (!isBooking4Shop) return;
104
+ pisellos.effects.on(ShopDiscountHooks.onCustomerChange, (customer) => {
105
+ console.log(customer, "customerChange");
106
+ dispatch({
107
+ type: "setClient",
108
+ payload: {
109
+ value: customer
110
+ }
111
+ });
112
+ });
113
+ pisellos.effects.on(
114
+ ShopDiscountHooks.onLoadPrepareCalcResult,
115
+ (result) => {
116
+ dispatch({
117
+ type: "setService",
118
+ payload: {
119
+ value: result.productList
120
+ }
121
+ });
122
+ }
123
+ );
124
+ pisellos.effects.on(
125
+ ShopDiscountHooks.onDiscountListChange,
126
+ (discount) => {
127
+ console.log(discount, "discountChange");
128
+ setDisCountList(discount);
129
+ }
130
+ );
131
+ return () => {
132
+ shopDiscount.clear();
133
+ pisellos.effects.off(ShopDiscountHooks.onCustomerChange);
134
+ pisellos.effects.off(ShopDiscountHooks.onLoadPrepareCalcResult);
135
+ pisellos.effects.off(ShopDiscountHooks.onDiscountListChange);
136
+ };
137
+ }, [state.bookingId, isBooking4Shop]);
138
+ const onScanCode = async () => {
139
+ const val = await shopDiscount.scanCode(code);
140
+ console.log(val);
141
+ if (val == null ? void 0 : val.isAvailable) {
142
+ dispatch({
143
+ type: "setService",
144
+ payload: {
145
+ value: val.productList
146
+ }
147
+ });
148
+ } else {
149
+ (0, import_materials.PisellToast)({
150
+ content: import_utils.locales.getText("pisell2.text.goodpass.code-invalid")
151
+ });
152
+ }
153
+ };
154
+ if (!isBooking4Shop) return null;
155
+ return /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-footer-voucher-container" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "voucher-title" }, /* @__PURE__ */ import_react.default.createElement("span", { className: "voucher-title-left" }, import_utils.locales.getText("pisell2.text.goodpass")), /* @__PURE__ */ import_react.default.createElement(
156
+ "span",
157
+ {
158
+ className: "voucher-title-right",
159
+ onClick: () => {
160
+ console.log("showDetail: ", showDetail);
161
+ setShowDetail(!showDetail);
162
+ }
163
+ },
164
+ import_utils.locales.getText("pisell2.text.details"),
165
+ " ",
166
+ /* @__PURE__ */ import_react.default.createElement(
167
+ import_ChevronDown.default,
168
+ {
169
+ className: (0, import_classnames.default)("voucher-right-icon", {
170
+ show: showDetail
171
+ })
172
+ }
173
+ )
174
+ )), /* @__PURE__ */ import_react.default.createElement(
175
+ "div",
176
+ {
177
+ className: (0, import_classnames.default)("voucher-detail", {
178
+ show: showDetail
179
+ })
180
+ },
181
+ (availableData == null ? void 0 : availableData.length) > 0 ? /* @__PURE__ */ import_react.default.createElement(
182
+ import_materials.PisellGoodPassCard,
183
+ {
184
+ style: { width: "100%" },
185
+ dataSource: availableData,
186
+ onChange: (val) => {
187
+ const shopDiscount2 = pisellos.getModule("shopDiscount");
188
+ const detail = shopDiscount2.setDiscountSelected({
189
+ discountId: val.id,
190
+ isSelected: val.isSelected
191
+ });
192
+ console.log("setDiscountSelected:", detail);
193
+ dispatch({
194
+ type: "setService",
195
+ payload: {
196
+ value: detail.productList
197
+ }
198
+ });
199
+ }
200
+ }
201
+ ) : null,
202
+ /* @__PURE__ */ import_react.default.createElement("div", { className: "voucher-code-input-wrapper" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "voucher-code-input" }, /* @__PURE__ */ import_react.default.createElement("div", { style: { whiteSpace: "nowrap" } }, import_utils.locales.getText("pisell2.text.goodpass.code"), ":"), /* @__PURE__ */ import_react.default.createElement(
203
+ import_materials.PisellInput,
204
+ {
205
+ value: code,
206
+ onChange: (e) => {
207
+ var _a2;
208
+ setCode((_a2 = e.target) == null ? void 0 : _a2.value);
209
+ },
210
+ size: "small",
211
+ placeholder: import_utils.locales.getText("pisell2.text.goodpass.enter-code"),
212
+ suffix: /* @__PURE__ */ import_react.default.createElement(import_materials.PisellTooltip, { title: "" }, /* @__PURE__ */ import_react.default.createElement(
213
+ import_icons.QuestionCircleOutlined,
214
+ {
215
+ style: { color: "rgba(0,0,0,.45)" }
216
+ }
217
+ ))
218
+ }
219
+ )), /* @__PURE__ */ import_react.default.createElement(import_antd.Button, { size: "small", onClick: onScanCode, disabled: !code }, import_utils.locales.getText("pisell2.text.apply")))
220
+ ));
221
+ };
222
+ var voucher_default = VoucherCard;
@@ -0,0 +1,88 @@
1
+ .pisell-lowcode__booking-footer-voucher-container {
2
+ margin-bottom: 8px;
3
+ .voucher-title {
4
+ display: flex;
5
+ align-items: center;
6
+ justify-content: space-between;
7
+ margin-bottom: 10px;
8
+
9
+ .voucher-title-left {
10
+ color: var(--base-black, #000);
11
+ font-size: 18px;
12
+ font-style: normal;
13
+ font-weight: 600;
14
+ line-height: 28px;
15
+ display: flex;
16
+ flex-direction: column;
17
+ }
18
+
19
+ .voucher-title-right {
20
+ display: flex;
21
+ align-items: center;
22
+ justify-content: center;
23
+ gap: 4px;
24
+ color: #7f56d9;
25
+ cursor: pointer;
26
+ font-size: 18px;
27
+ font-style: normal;
28
+ font-weight: 500;
29
+ }
30
+
31
+ .voucher-right-icon {
32
+ font-size: 20px;
33
+ width: 24px;
34
+ height: 24px;
35
+ color: #7f56d9;
36
+ display: flex;
37
+ align-items: center;
38
+ justify-content: center;
39
+
40
+ &.show {
41
+ transform: rotate(180deg);
42
+ }
43
+ }
44
+ }
45
+
46
+ .voucher-detail {
47
+ width: 100%;
48
+ transition: 0.2s;
49
+ max-height: 0;
50
+ overflow: hidden;
51
+ display: flex;
52
+ flex-direction: column;
53
+
54
+ &.show {
55
+ max-height: unset;
56
+ }
57
+ }
58
+
59
+ .voucher-code-input-wrapper {
60
+ margin-top: 6px;
61
+ display: flex;
62
+ width: 100%;
63
+ height: 42px;
64
+ padding: 8px;
65
+ justify-content: space-between;
66
+ align-items: center;
67
+ gap: 8px;
68
+ flex-shrink: 0;
69
+ border-radius: 8px;
70
+ border: 1px solid var(--Gray-300, #d0d5dd);
71
+ background: #fff;
72
+ }
73
+
74
+ .voucher-code-input {
75
+ display: flex;
76
+ align-items: center;
77
+ > div {
78
+ color: var(--Gray-500, #667085);
79
+ text-align: center;
80
+ font-family: Inter;
81
+ font-size: 16px;
82
+ font-style: normal;
83
+ font-weight: 600;
84
+ line-height: 20px;
85
+ margin-right: 8px;
86
+ }
87
+ }
88
+ }
@@ -0,0 +1,47 @@
1
+ import React from 'react';
2
+ import './index.less';
3
+ interface ApplicableProductDetails {
4
+ amount: string;
5
+ type: string;
6
+ resource_id: number;
7
+ title: string;
8
+ original_amount: string;
9
+ }
10
+ interface Discount {
11
+ id: number;
12
+ product_name: string;
13
+ encoded: string;
14
+ code: string;
15
+ tag: string;
16
+ expire_time?: string;
17
+ product_id: number;
18
+ relation_type: string;
19
+ par_value: string;
20
+ used_par_value: string;
21
+ limit_status: string;
22
+ limited_relation_product_data: any;
23
+ balance: string;
24
+ format_title: any;
25
+ product: any;
26
+ savedAmount: number;
27
+ isDisabled: boolean;
28
+ isSelected?: boolean;
29
+ isAvailable?: boolean;
30
+ isUsed?: boolean;
31
+ applicableProductIds?: number[];
32
+ applicableProductDetails: ApplicableProductDetails[];
33
+ appliedProductDetails: any[];
34
+ }
35
+ export interface PisellGoodPassCardProps {
36
+ /**数据源 */
37
+ dataSource: Array<Discount>;
38
+ /**事件 */
39
+ onChange?: (current: {
40
+ id: string | number;
41
+ isSelected: boolean;
42
+ }) => void;
43
+ /**样式 */
44
+ style: React.CSSProperties;
45
+ }
46
+ declare const index: (props: PisellGoodPassCardProps) => JSX.Element;
47
+ export default index;