@pisell/private-materials 3.0.201 → 3.0.203

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. package/build/lowcode/assets-daily.json +11 -11
  2. package/build/lowcode/assets-dev.json +2 -2
  3. package/build/lowcode/assets-prod.json +11 -11
  4. package/build/lowcode/index.js +1 -1
  5. package/build/lowcode/meta.js +1 -1
  6. package/build/lowcode/preview.js +142 -142
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +12 -27
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +18 -33
  11. package/es/components/booking/addons/model.d.ts +1 -1
  12. package/es/components/booking/components/footer/amount.js +5 -4
  13. package/es/components/booking/components/footer/utils.js +49 -29
  14. package/es/components/booking/forms/model.d.ts +1 -1
  15. package/es/components/booking/info/Provider.d.ts +0 -0
  16. package/es/components/booking/info/Provider.js +54 -0
  17. package/es/components/booking/info/clientVariant/vertical/index.js +93 -7
  18. package/es/components/booking/info/main.js +10 -9
  19. package/es/components/booking/info/pet/ChangePetModal/index.js +38 -23
  20. package/es/components/booking/info/service/addService/index.js +70 -99
  21. package/es/components/booking/info/service/addService/utils.d.ts +1 -0
  22. package/es/components/booking/info/service/addService/utils.js +55 -3
  23. package/es/components/booking/info/service/editService/BookingList/index.d.ts +5 -0
  24. package/es/components/booking/info/service/editService/BookingList/index.js +39 -0
  25. package/es/components/booking/info/service/editService/EditTabs/index.d.ts +3 -0
  26. package/es/components/booking/info/service/editService/EditTabs/index.js +35 -0
  27. package/es/components/booking/info/service/editService/index.js +234 -142
  28. package/es/components/booking/info/service/serve.d.ts +10 -0
  29. package/es/components/booking/info/service/serve.js +28 -0
  30. package/es/components/booking/info/service/serviceManager/distributeDiscount.d.ts +11 -0
  31. package/es/components/booking/info/service/serviceManager/distributeDiscount.js +55 -0
  32. package/es/components/booking/info/service/serviceManager/index.d.ts +20 -0
  33. package/es/components/booking/info/service/serviceManager/index.js +277 -0
  34. package/es/components/booking/info/service/serviceManager/utils.d.ts +0 -0
  35. package/es/components/booking/info/service/serviceManager/utils.js +0 -0
  36. package/es/components/booking/info/service2/Group/utils.d.ts +14 -0
  37. package/es/components/booking/info/service2/Group/utils.js +146 -0
  38. package/es/components/booking/info/service2/Lists.js +27 -33
  39. package/es/components/booking/info/service2/index.d.ts +4 -1
  40. package/es/components/booking/info/service2/index.js +5 -6
  41. package/es/components/booking/info/service2/status.js +1 -1
  42. package/es/components/booking/info/service2/utils.d.ts +95 -3
  43. package/es/components/booking/info/service2/utils.js +678 -52
  44. package/es/components/booking/info/utils.d.ts +11 -0
  45. package/es/components/booking/info/utils.js +24 -0
  46. package/es/components/booking/locales.d.ts +6 -0
  47. package/es/components/booking/locales.js +9 -3
  48. package/es/components/booking/model.d.ts +1 -0
  49. package/es/components/booking/notes/index.d.ts +1 -1
  50. package/es/components/booking/notes/model.d.ts +1 -1
  51. package/es/components/booking/payments/index.d.ts +1 -1
  52. package/es/components/booking/payments/model.d.ts +1 -1
  53. package/es/components/booking/utils.js +5 -4
  54. package/es/components/eftpos/hooks.d.ts +4 -4
  55. package/es/components/eftposPay/amount.d.ts +1 -1
  56. package/es/components/eftposPay/component/step/index.d.ts +6 -6
  57. package/es/components/eftposPay/component/step/step.d.ts +4 -4
  58. package/es/components/eftposPay/hooks.d.ts +1 -1
  59. package/es/components/eftposPay/store/index.d.ts +1 -1
  60. package/es/components/eftposPay/tyro/hooks.d.ts +2 -2
  61. package/es/components/eftposPay/windcave/helper.d.ts +1 -1
  62. package/es/components/schedules/index.d.ts +1 -1
  63. package/es/components/schedules/model.d.ts +1 -1
  64. package/es/components/shoppingCart/components/Cart/Product.js +11 -39
  65. package/es/components/shoppingCart/components/Render/index.js +8 -7
  66. package/es/components/shoppingCart/components/SelectHolderModal/index.js +12 -4
  67. package/es/components/shoppingCart/hooks/useClearCart.js +10 -5
  68. package/es/components/shoppingCart/type.d.ts +1 -1
  69. package/es/components/shoppingCart/utils.js +2 -5
  70. package/lib/components/booking/addons/model.d.ts +1 -1
  71. package/lib/components/booking/components/footer/amount.js +4 -3
  72. package/lib/components/booking/components/footer/utils.js +28 -28
  73. package/lib/components/booking/forms/model.d.ts +1 -1
  74. package/lib/components/booking/info/Provider.d.ts +0 -0
  75. package/lib/components/booking/info/Provider.js +0 -0
  76. package/lib/components/booking/info/clientVariant/vertical/index.js +51 -1
  77. package/lib/components/booking/info/main.js +6 -5
  78. package/lib/components/booking/info/pet/ChangePetModal/index.js +33 -23
  79. package/lib/components/booking/info/service/addService/index.js +50 -92
  80. package/lib/components/booking/info/service/addService/utils.d.ts +1 -0
  81. package/lib/components/booking/info/service/addService/utils.js +27 -0
  82. package/lib/components/booking/info/service/editService/BookingList/index.d.ts +5 -0
  83. package/lib/components/booking/info/service/editService/BookingList/index.js +55 -0
  84. package/lib/components/booking/info/service/editService/EditTabs/index.d.ts +3 -0
  85. package/lib/components/booking/info/service/editService/EditTabs/index.js +75 -0
  86. package/lib/components/booking/info/service/editService/index.js +309 -234
  87. package/lib/components/booking/info/service/serve.d.ts +10 -0
  88. package/lib/components/booking/info/service/serve.js +7 -2
  89. package/lib/components/booking/info/service/serviceManager/distributeDiscount.d.ts +11 -0
  90. package/lib/components/booking/info/service/serviceManager/distributeDiscount.js +70 -0
  91. package/lib/components/booking/info/service/serviceManager/index.d.ts +20 -0
  92. package/lib/components/booking/info/service/serviceManager/index.js +207 -0
  93. package/lib/components/booking/info/service/serviceManager/utils.d.ts +0 -0
  94. package/lib/components/booking/info/service/serviceManager/utils.js +0 -0
  95. package/lib/components/booking/info/service2/Group/utils.d.ts +14 -0
  96. package/lib/components/booking/info/service2/Group/utils.js +142 -0
  97. package/lib/components/booking/info/service2/Lists.js +14 -12
  98. package/lib/components/booking/info/service2/index.d.ts +4 -1
  99. package/lib/components/booking/info/service2/index.js +5 -5
  100. package/lib/components/booking/info/service2/status.js +1 -1
  101. package/lib/components/booking/info/service2/utils.d.ts +95 -3
  102. package/lib/components/booking/info/service2/utils.js +404 -48
  103. package/lib/components/booking/info/utils.d.ts +11 -0
  104. package/lib/components/booking/info/utils.js +35 -0
  105. package/lib/components/booking/locales.d.ts +6 -0
  106. package/lib/components/booking/locales.js +9 -3
  107. package/lib/components/booking/model.d.ts +1 -0
  108. package/lib/components/booking/notes/index.d.ts +1 -1
  109. package/lib/components/booking/notes/model.d.ts +1 -1
  110. package/lib/components/booking/payments/index.d.ts +1 -1
  111. package/lib/components/booking/payments/model.d.ts +1 -1
  112. package/lib/components/booking/utils.js +3 -4
  113. package/lib/components/eftpos/hooks.d.ts +4 -4
  114. package/lib/components/eftposPay/amount.d.ts +1 -1
  115. package/lib/components/eftposPay/component/step/index.d.ts +6 -6
  116. package/lib/components/eftposPay/component/step/step.d.ts +4 -4
  117. package/lib/components/eftposPay/hooks.d.ts +1 -1
  118. package/lib/components/eftposPay/store/index.d.ts +1 -1
  119. package/lib/components/eftposPay/tyro/hooks.d.ts +2 -2
  120. package/lib/components/eftposPay/windcave/helper.d.ts +1 -1
  121. package/lib/components/schedules/index.d.ts +1 -1
  122. package/lib/components/schedules/model.d.ts +1 -1
  123. package/lib/components/shoppingCart/components/Cart/Product.js +6 -22
  124. package/lib/components/shoppingCart/components/Render/index.js +6 -10
  125. package/lib/components/shoppingCart/components/SelectHolderModal/index.js +12 -4
  126. package/lib/components/shoppingCart/hooks/useClearCart.js +4 -9
  127. package/lib/components/shoppingCart/type.d.ts +1 -1
  128. package/lib/components/shoppingCart/utils.js +2 -8
  129. package/package.json +4 -4
@@ -1,5 +1,5 @@
1
1
  import dayjs from 'dayjs';
2
- export declare const formatActiveKey: (lists: any[], platform: string) => any[];
2
+ export declare const formatActiveKey: (lists: any[], platform: string, isEdit: boolean) => any[];
3
3
  /**
4
4
  * @title: 获取资源名称
5
5
  * @description:
@@ -30,6 +30,7 @@ export declare const getErrorMessage: (service: any, resourceItem: any, isDay?:
30
30
  * @Date: 2024-12-04 11:27
31
31
  */
32
32
  export declare const formatHolderLists: (lists: any) => any;
33
+ export declare const isBookingProduct: (extension_type: any) => boolean;
33
34
  /**
34
35
  * @title: 是否是预约商品
35
36
  * @description:
@@ -37,7 +38,20 @@ export declare const formatHolderLists: (lists: any) => any;
37
38
  * @Author: WangHan
38
39
  * @Date: 2024-12-06 11:24
39
40
  */
40
- export declare const isAppointment: (item: any, state: any) => boolean;
41
+ export declare const isDayBookingProduct: (item: any, state: any) => boolean;
42
+ /**
43
+ * @title: 更新商品数据
44
+ * @description:
45
+ * @param {any} state
46
+ * @param {string} type
47
+ * @param {any} _id // 商品id
48
+ * @param {any} other
49
+ * @return {*}
50
+ * @Author: WangHan
51
+ * @Date: 2025-01-03 15:00
52
+ */
53
+ export declare const updateServices: (state: any, currentItem: any, type?: string, other?: any) => any;
54
+ export declare const formItems: (items: any[]) => any[];
41
55
  /**
42
56
  * @title: 格式化商品数据
43
57
  * @description:
@@ -46,7 +60,35 @@ export declare const isAppointment: (item: any, state: any) => boolean;
46
60
  * @Author: WangHan
47
61
  * @Date: 2024-11-29 17:36
48
62
  */
49
- export declare const formatProducts: (lists: any[], state: any) => any[] | undefined;
63
+ export declare const formatProducts: (lists: any[], state: any, isRenderGroup?: boolean) => {
64
+ id: any;
65
+ _id: any;
66
+ name: any;
67
+ price: any;
68
+ total: any;
69
+ origin_total: any;
70
+ num: any;
71
+ image: any;
72
+ isShowNote: boolean;
73
+ note: any;
74
+ like_status: any;
75
+ bundle: any;
76
+ options: any;
77
+ errorMessage: string;
78
+ product_option_string: any;
79
+ discount_reason: any;
80
+ resource_id: any;
81
+ relation_form_name: any;
82
+ holder_title: any;
83
+ start_date: any;
84
+ end_date: any;
85
+ holder_id: any;
86
+ isNormalProduct: boolean;
87
+ locale: any;
88
+ symbol: any;
89
+ items: any[];
90
+ _origin: any;
91
+ }[];
50
92
  /**
51
93
  * @title: 禁用日期
52
94
  * @description:
@@ -121,6 +163,24 @@ export declare const isHasDayAppointmentProduct: (state: any) => boolean;
121
163
  * @Date: 2024-12-13 16:44
122
164
  */
123
165
  export declare const getDayProducts: (holderId: number, lists: any, isTerminal?: boolean) => any;
166
+ /**
167
+ * @title: 格式化表单数据
168
+ * @description:
169
+ * @param {any} state
170
+ * @return {*}
171
+ * @Author: WangHan
172
+ * @Date: 2024-12-30 22:19
173
+ */
174
+ export declare const getPets: (state: any) => any;
175
+ /**
176
+ * @title: 得出预约商品
177
+ * @description:
178
+ * @param {any} state
179
+ * @return {*}
180
+ * @Author: WangHan
181
+ * @Date: 2024-12-30 22:26
182
+ */
183
+ export declare const getAppointmentService: (state: any) => any;
124
184
  /**
125
185
  * @title: 判断是否打开删除宠物弹窗
126
186
  * @description:
@@ -143,3 +203,35 @@ export declare const isOpenDeletePet: (state: any, newVal: any) => {
143
203
  * @Date: 2024-12-17 14:40
144
204
  */
145
205
  export declare const holderId: (state: any) => number;
206
+ /**
207
+ * @title: 更新套餐的价格
208
+ * @description:
209
+ * @param {any} currentValue
210
+ * @param {any} newBundleData
211
+ * @return {*}
212
+ * @Author: WangHan
213
+ * @Date: 2024-12-31 15:16
214
+ */
215
+ export declare function updateNormalBundlePrice(currentValue: any, newBundleData: any): any[];
216
+ /**
217
+ * @title: 更新预约商品报价单
218
+ * @description:
219
+ * @param {any} state
220
+ * @param {any} cacheItem
221
+ * @return {*}
222
+ * @Author: WangHan
223
+ * @Date: 2024-12-25 16:41
224
+ */
225
+ export declare const updateAppointmentServicePrice: (state: any, { start_date, end_date, product_id }: any) => Promise<{
226
+ multiDayPrices: any;
227
+ price: number;
228
+ }>;
229
+ /**
230
+ * @title: 更新普通商品报价单价格
231
+ * @description:
232
+ * @param {any} state
233
+ * @return {*}
234
+ * @Author: WangHan
235
+ * @Date: 2024-12-24 11:32
236
+ */
237
+ export declare const updateServicePrice: (state: any) => never[] | Promise<any>;
@@ -30,22 +30,30 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  var utils_exports = {};
31
31
  __export(utils_exports, {
32
32
  disabledDate: () => disabledDate,
33
+ formItems: () => formItems,
33
34
  formatActiveKey: () => formatActiveKey,
34
35
  formatDateTime: () => formatDateTime,
35
36
  formatDayDate: () => formatDayDate,
36
37
  formatDayTime: () => formatDayTime,
37
38
  formatHolderLists: () => formatHolderLists,
38
39
  formatProducts: () => formatProducts,
40
+ getAppointmentService: () => getAppointmentService,
39
41
  getDayProducts: () => getDayProducts,
40
42
  getErrorMessage: () => getErrorMessage,
43
+ getPets: () => getPets,
41
44
  getResourceItem: () => getResourceItem,
42
45
  holderId: () => holderId,
43
46
  initDate: () => initDate,
44
- isAppointment: () => isAppointment,
47
+ isBookingProduct: () => isBookingProduct,
45
48
  isDayBooking: () => isDayBooking,
49
+ isDayBookingProduct: () => isDayBookingProduct,
46
50
  isHasDayAppointmentProduct: () => isHasDayAppointmentProduct,
47
51
  isOpenDeletePet: () => isOpenDeletePet,
48
- isTerminalDayBooking: () => isTerminalDayBooking
52
+ isTerminalDayBooking: () => isTerminalDayBooking,
53
+ updateAppointmentServicePrice: () => updateAppointmentServicePrice,
54
+ updateNormalBundlePrice: () => updateNormalBundlePrice,
55
+ updateServicePrice: () => updateServicePrice,
56
+ updateServices: () => updateServices
49
57
  });
50
58
  module.exports = __toCommonJS(utils_exports);
51
59
  var import_mock = require("../../mock");
@@ -53,12 +61,17 @@ var import_utils = require("../../utils");
53
61
  var import_utils2 = require("@pisell/utils");
54
62
  var import_dayjs = __toESM(require("dayjs"));
55
63
  var import_status = require("./status");
64
+ var import_serve = require("../service/serve");
56
65
  var import_locales = __toESM(require("../../locales"));
66
+ var import_utils3 = require("./Group/utils");
57
67
  import_utils2.locales.init(import_locales.default, localStorage.getItem("umi_locale") || "en");
58
- var formatActiveKey = (lists, platform) => {
68
+ var formatActiveKey = (lists, platform, isEdit) => {
59
69
  var _a;
60
70
  if (!(lists == null ? void 0 : lists.length))
61
71
  return [];
72
+ if (lists.length === 1 && isEdit) {
73
+ return [];
74
+ }
62
75
  if (platform === "shop") {
63
76
  return [(_a = lists[lists.length - 1]) == null ? void 0 : _a.key];
64
77
  }
@@ -131,50 +144,185 @@ var getHolderName = (state, id) => {
131
144
  const resource = holderLists.find((d) => (d == null ? void 0 : d.id) === id);
132
145
  return resource == null ? void 0 : resource.main_field;
133
146
  };
134
- var isAppointment = (item, state) => {
135
- return import_status.appointmentTypes.includes(item == null ? void 0 : item.extension_type) && isDayBooking(state);
147
+ var isBookingProduct = (extension_type) => {
148
+ return import_status.appointmentTypes.includes(extension_type);
136
149
  };
137
- var formatProducts = (lists, state) => {
138
- if (!(lists == null ? void 0 : lists.length))
139
- return [];
140
- console.log(lists, "wh_lists");
141
- try {
142
- return lists.map((item) => {
143
- var _a, _b, _c, _d, _e, _f, _g, _h, _i;
144
- const _isAppointment = isAppointment(item, state);
145
- const clientTitle = getHolderName(state, (_a = item == null ? void 0 : item._extend) == null ? void 0 : _a.holder_id);
146
- let resourceItem = {};
147
- let errorMessage = "";
148
- if (_isAppointment) {
149
- resourceItem = getResourceItem((_b = item == null ? void 0 : item._extend) == null ? void 0 : _b.resource, state);
150
- errorMessage = getErrorMessage(item, resourceItem, isDayBooking(state));
150
+ var isDayBookingProduct = (item, state) => {
151
+ return isBookingProduct(item == null ? void 0 : item.extension_type) && isDayBooking(state);
152
+ };
153
+ var updateServices = (state, currentItem, type, other) => {
154
+ var _a;
155
+ let products = ((_a = state == null ? void 0 : state.service) == null ? void 0 : _a.value) || [];
156
+ const isGroup = (0, import_utils3.isGroupBooking)(currentItem._id);
157
+ if (type === "delete") {
158
+ let deleteIds = [];
159
+ if (isGroup) {
160
+ debugger;
161
+ deleteIds = (0, import_utils3.getProductByGroupId)(currentItem._id, products);
162
+ } else {
163
+ deleteIds = [currentItem._id];
164
+ }
165
+ products = products == null ? void 0 : products.filter((item) => !deleteIds.includes(item == null ? void 0 : item._id));
166
+ }
167
+ if (type === "delete_holders") {
168
+ products = products == null ? void 0 : products.filter((item) => {
169
+ var _a2;
170
+ return ((_a2 = item == null ? void 0 : item._extend) == null ? void 0 : _a2.holder_id) !== other;
171
+ });
172
+ }
173
+ if (type === "update_holders") {
174
+ products = products == null ? void 0 : products.map((item) => {
175
+ var _a2;
176
+ const ids = currentItem.map((d) => d._id);
177
+ if (ids == null ? void 0 : ids.includes(item == null ? void 0 : item._id)) {
178
+ let _extend = item._extend || {};
179
+ if (Array.isArray(other)) {
180
+ _extend.holder_id = (_a2 = other.find((other2) => (other2 == null ? void 0 : other2._id) === (item == null ? void 0 : item._id))) == null ? void 0 : _a2.holder_id;
181
+ } else {
182
+ _extend.holder_id = other;
183
+ }
184
+ return item;
151
185
  }
152
- return {
153
- ...item,
154
- note: (item == null ? void 0 : item.note) || "",
155
- locale: state.locale,
156
- symbol: state.amountSymbol,
157
- total: item == null ? void 0 : item._extend.total,
158
- price: item == null ? void 0 : item._extend.price,
159
- origin_total: item == null ? void 0 : item._extend.origin_total,
160
- num: item == null ? void 0 : item._extend.quantity,
161
- bundle: (_d = (_c = item == null ? void 0 : item._extend) == null ? void 0 : _c.other) == null ? void 0 : _d.bundle,
162
- options: (_f = (_e = item == null ? void 0 : item._extend) == null ? void 0 : _e.other) == null ? void 0 : _f.option,
163
- product_option_string: (_h = (_g = item == null ? void 0 : item._extend) == null ? void 0 : _g.other) == null ? void 0 : _h.product_option_string,
164
- _showAction: false,
165
- _actionText: import_utils2.locales.getText("page.booking.text.add-time"),
166
- _errorMessage: errorMessage,
167
- _extend: {
168
- ...(item == null ? void 0 : item._extend) || {},
169
- date: !_isAppointment ? null : state == null ? void 0 : state.date,
170
- relation_form_name: !_isAppointment ? "" : (resourceItem == null ? void 0 : resourceItem.labelText) || item.relation_form_name,
171
- holder_title: clientTitle,
172
- resource: !_isAppointment ? null : (_i = item == null ? void 0 : item._extend) == null ? void 0 : _i.resource,
173
- relation_details: []
186
+ return item;
187
+ });
188
+ } else {
189
+ products = products == null ? void 0 : products.map((item) => {
190
+ let updateIds = [];
191
+ if (isGroup) {
192
+ updateIds = (0, import_utils3.getProductByGroupId)(currentItem._id, products);
193
+ } else {
194
+ updateIds = [currentItem._id];
195
+ }
196
+ if (updateIds.includes(item._id)) {
197
+ if (type === "like") {
198
+ let _extend = item._extend || {};
199
+ _extend.like_status = other == null ? void 0 : other.like_status;
200
+ } else {
201
+ item = {
202
+ ...item,
203
+ ...other
204
+ };
174
205
  }
175
- };
206
+ return item;
207
+ }
208
+ return item;
176
209
  });
177
- } catch (error) {
210
+ }
211
+ return products;
212
+ };
213
+ var formatBundle = (bundle) => {
214
+ if (!(bundle == null ? void 0 : bundle.length))
215
+ return [];
216
+ return bundle.map((item) => {
217
+ return {
218
+ id: item == null ? void 0 : item.id,
219
+ title: item == null ? void 0 : item.title,
220
+ num: item == null ? void 0 : item.num,
221
+ price: item == null ? void 0 : item.price,
222
+ total: item == null ? void 0 : item.price,
223
+ price_type: item == null ? void 0 : item.price_type,
224
+ bundle_sum_price: item == null ? void 0 : item.bundle_sum_price,
225
+ bundle_sum_type: item == null ? void 0 : item.bundle_sum_type,
226
+ options: formatOptions(item == null ? void 0 : item.option)
227
+ };
228
+ });
229
+ };
230
+ var formatOptions = (options) => {
231
+ if (!(options == null ? void 0 : options.length))
232
+ return [];
233
+ return options.map((item) => {
234
+ return {
235
+ id: item == null ? void 0 : item.id,
236
+ name: item == null ? void 0 : item.name,
237
+ num: item == null ? void 0 : item.num,
238
+ price: item == null ? void 0 : item.price,
239
+ total: item == null ? void 0 : item.price,
240
+ origin_total: item == null ? void 0 : item.original_price
241
+ };
242
+ });
243
+ };
244
+ var formItems = (items) => {
245
+ return items.map((d) => {
246
+ return {
247
+ ...d,
248
+ start_date: d._extend.start_date,
249
+ end_date: d._extend.end_date,
250
+ num: d == null ? void 0 : d._extend.quantity,
251
+ total: d._extend.total,
252
+ origin_total: d._extend.origin_total
253
+ };
254
+ });
255
+ };
256
+ var formatProducts = (lists, state, isRenderGroup = true) => {
257
+ if (!(lists == null ? void 0 : lists.length))
258
+ return [];
259
+ console.log(lists, "wh9879");
260
+ const normalList = [];
261
+ const groupList = [];
262
+ const formItem = (item) => {
263
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
264
+ const _isDayBookingProduct = isDayBookingProduct(item, state);
265
+ const clientTitle = getHolderName(state, (_a = item == null ? void 0 : item._extend) == null ? void 0 : _a.holder_id);
266
+ const options = formatOptions((_c = (_b = item == null ? void 0 : item._extend) == null ? void 0 : _b.other) == null ? void 0 : _c.option);
267
+ const bundle = formatBundle((_e = (_d = item == null ? void 0 : item._extend) == null ? void 0 : _d.other) == null ? void 0 : _e.bundle);
268
+ const isNormalProduct = !import_status.appointmentTypes.includes(item == null ? void 0 : item.extension_type);
269
+ let resourceItem = {};
270
+ let errorMessage = "";
271
+ if (_isDayBookingProduct) {
272
+ resourceItem = getResourceItem((_f = item == null ? void 0 : item._extend) == null ? void 0 : _f.resource, state);
273
+ errorMessage = getErrorMessage(item, resourceItem, isDayBooking(state));
274
+ }
275
+ return {
276
+ id: item == null ? void 0 : item.id,
277
+ _id: item == null ? void 0 : item._id,
278
+ name: item == null ? void 0 : item.title,
279
+ price: (_g = item == null ? void 0 : item._extend) == null ? void 0 : _g.price,
280
+ total: (_h = item == null ? void 0 : item._extend) == null ? void 0 : _h.total,
281
+ origin_total: (_i = item == null ? void 0 : item._extend) == null ? void 0 : _i.origin_total,
282
+ num: item == null ? void 0 : item._extend.quantity,
283
+ image: item == null ? void 0 : item.cover,
284
+ isShowNote: true,
285
+ note: item == null ? void 0 : item.note,
286
+ like_status: (_j = item == null ? void 0 : item._extend) == null ? void 0 : _j.like_status,
287
+ bundle,
288
+ options,
289
+ errorMessage,
290
+ product_option_string: (_l = (_k = item == null ? void 0 : item._extend) == null ? void 0 : _k.other) == null ? void 0 : _l.product_option_string,
291
+ discount_reason: (_m = item == null ? void 0 : item._extend) == null ? void 0 : _m.discount_reason,
292
+ resource_id: isNormalProduct ? 0 : (_n = item == null ? void 0 : item._extend) == null ? void 0 : _n.resource,
293
+ relation_form_name: isNormalProduct ? "" : (resourceItem == null ? void 0 : resourceItem.labelText) || item.relation_form_name,
294
+ holder_title: clientTitle,
295
+ start_date: !isNormalProduct ? (_o = item == null ? void 0 : item._extend) == null ? void 0 : _o.start_date : "",
296
+ end_date: !isNormalProduct ? (_p = item == null ? void 0 : item._extend) == null ? void 0 : _p.end_date : "",
297
+ holder_id: ((_q = item == null ? void 0 : item._extend) == null ? void 0 : _q.holder_id) || 0,
298
+ isNormalProduct,
299
+ locale: state.locale,
300
+ symbol: state.amountSymbol,
301
+ items: formItems(((_r = item == null ? void 0 : item._extend) == null ? void 0 : _r.items) || []),
302
+ _origin: item
303
+ };
304
+ };
305
+ lists.forEach((item) => {
306
+ var _a;
307
+ if (!((_a = item == null ? void 0 : item._extend) == null ? void 0 : _a.groupId)) {
308
+ normalList.push(formItem(item));
309
+ } else {
310
+ groupList.push(item);
311
+ }
312
+ });
313
+ let groups = groupList.reduce((prev, item) => {
314
+ var _a;
315
+ const groupId = (_a = item == null ? void 0 : item._extend) == null ? void 0 : _a.groupId;
316
+ if (!prev[groupId]) {
317
+ prev[groupId] = [];
318
+ }
319
+ prev[groupId].push(item);
320
+ return prev;
321
+ }, {});
322
+ if (isRenderGroup) {
323
+ return Object.values(groups).map((d) => formItem((0, import_utils3.concatBookings)(d))).concat(normalList);
324
+ } else {
325
+ return lists == null ? void 0 : lists.map((item) => formItem(item));
178
326
  }
179
327
  };
180
328
  var disabledDate = (current, position, currentDate) => {
@@ -184,7 +332,6 @@ var disabledDate = (current, position, currentDate) => {
184
332
  return false;
185
333
  }
186
334
  if (position === "end" && current.endOf("day") && currentDate) {
187
- console.log(currentDate, current, position, "currentDate");
188
335
  const endDisabled = currentDate.add(8, "months").format("YYYY-MM-DD");
189
336
  return (0, import_dayjs.default)(endDisabled) < current.startOf("day") || current.startOf("day") <= currentDate;
190
337
  }
@@ -270,8 +417,20 @@ var getDayProducts = (holderId2, lists, isTerminal) => {
270
417
  }
271
418
  return _lists;
272
419
  };
420
+ var getPets = (state) => {
421
+ var _a, _b, _c, _d, _e, _f;
422
+ const form_id = ((_d = (_c = (_b = (_a = state == null ? void 0 : state.bookingConfig) == null ? void 0 : _a.config) == null ? void 0 : _b.basic) == null ? void 0 : _c.appointment_subject) == null ? void 0 : _d.form_id) || 0;
423
+ const pets = ((_f = (_e = state == null ? void 0 : state.pet) == null ? void 0 : _e.value) == null ? void 0 : _f[form_id]) || [];
424
+ return pets;
425
+ };
426
+ var getAppointmentService = (state) => {
427
+ var _a;
428
+ const services = ((_a = state.service) == null ? void 0 : _a.value) || [];
429
+ let lists = services.filter((item) => import_status.appointmentTypes.includes(item.extension_type));
430
+ return lists;
431
+ };
273
432
  var isOpenDeletePet = (state, newVal) => {
274
- var _a, _b, _c, _d, _e, _f, _g;
433
+ var _a, _b, _c, _d, _e, _f;
275
434
  const form_id = ((_d = (_c = (_b = (_a = state == null ? void 0 : state.bookingConfig) == null ? void 0 : _a.config) == null ? void 0 : _b.basic) == null ? void 0 : _c.appointment_subject) == null ? void 0 : _d.form_id) || 0;
276
435
  const oldPets = ((_f = (_e = state == null ? void 0 : state.pet) == null ? void 0 : _e.value) == null ? void 0 : _f[form_id]) || [];
277
436
  const newPets = (newVal == null ? void 0 : newVal[form_id]) || [];
@@ -290,7 +449,6 @@ var isOpenDeletePet = (state, newVal) => {
290
449
  var _a2;
291
450
  return ((_a2 = item.services) == null ? void 0 : _a2.length) > 0;
292
451
  });
293
- console.log(deletePets, (_g = state.service) == null ? void 0 : _g.value, lists, "wh98888888");
294
452
  return {
295
453
  ids: lists.map((item) => item.form_record_id),
296
454
  lists
@@ -300,23 +458,221 @@ var holderId = (state) => {
300
458
  var _a;
301
459
  return Number(((_a = state == null ? void 0 : state.activeCartId) == null ? void 0 : _a[0]) || 0);
302
460
  };
461
+ function calculateTotalPrice(data) {
462
+ const _price = data == null ? void 0 : data.reduce(
463
+ (total, item) => total + ((item == null ? void 0 : item.price) || (item == null ? void 0 : item.add_price)) * item.num,
464
+ 0
465
+ );
466
+ return parseFloat(_price);
467
+ }
468
+ function updateSinglePrice(currentValue, single) {
469
+ const _single = [];
470
+ for (let index = 0; index < currentValue.length; index++) {
471
+ const item = currentValue[index];
472
+ const currentIndex = single.findIndex(
473
+ (_single2) => _single2.id === item.id
474
+ );
475
+ if (currentIndex !== -1) {
476
+ item.add_price = single[currentIndex].add_price;
477
+ item.name = single[currentIndex].name;
478
+ _single.push(item);
479
+ }
480
+ }
481
+ return _single;
482
+ }
483
+ function updateBundlePrice(currentValue, [bundle, single]) {
484
+ var _a;
485
+ const _bundle = [];
486
+ for (let index = 0; index < currentValue.length; index++) {
487
+ const item = currentValue[index];
488
+ const currentIndex = bundle.findIndex(
489
+ (_bundle2) => _bundle2.id === item.id
490
+ );
491
+ if (currentIndex !== -1 && bundle[currentIndex]) {
492
+ item.title = bundle[currentIndex].title;
493
+ item.price_type = bundle[currentIndex].price_type;
494
+ item._price = bundle[currentIndex].price;
495
+ const bundle_sum_price = parseFloat(
496
+ bundle[currentIndex].price_type === "markdown" ? bundle[currentIndex].price * -1 : bundle[currentIndex].price
497
+ ).toFixed(2);
498
+ item.price = bundle_sum_price;
499
+ item.bundle_sum_price = bundle_sum_price;
500
+ if ((_a = item == null ? void 0 : item.option) == null ? void 0 : _a.length) {
501
+ const _option = JSON.parse(JSON.stringify(item.option));
502
+ item.option = updateSinglePrice(_option, single);
503
+ let optionPrice = 0;
504
+ optionPrice = calculateTotalPrice(item.option);
505
+ const bundle_sum_price2 = (parseFloat(
506
+ bundle[currentIndex].price_type === "markdown" ? bundle[currentIndex].price * -1 : bundle[currentIndex].price
507
+ ) + optionPrice).toFixed(2);
508
+ item.price = bundle_sum_price2;
509
+ item.bundle_sum_price = bundle_sum_price2;
510
+ }
511
+ _bundle.push(item);
512
+ }
513
+ }
514
+ return _bundle;
515
+ }
516
+ function flatData(newPackageData) {
517
+ var _a, _b, _c;
518
+ let bundle = [];
519
+ let single = [];
520
+ for (const group of newPackageData) {
521
+ if ((_a = group == null ? void 0 : group.bundle_item) == null ? void 0 : _a.length) {
522
+ for (const item of group.bundle_item) {
523
+ bundle.push(item);
524
+ }
525
+ }
526
+ }
527
+ for (const bundleItem of bundle) {
528
+ if ((_b = bundleItem == null ? void 0 : bundleItem.option_group) == null ? void 0 : _b.length) {
529
+ for (const group of bundleItem.option_group) {
530
+ if ((_c = group == null ? void 0 : group.option_item) == null ? void 0 : _c.length) {
531
+ for (const item of group.option_item) {
532
+ single.push(item);
533
+ }
534
+ }
535
+ }
536
+ }
537
+ }
538
+ return [bundle, single];
539
+ }
540
+ function updateNormalBundlePrice(currentValue, newBundleData) {
541
+ const _currentValue = JSON.parse(JSON.stringify(currentValue));
542
+ const _flatData = flatData(newBundleData);
543
+ const newValue = updateBundlePrice(_currentValue, _flatData);
544
+ return newValue;
545
+ }
546
+ var normalServicePrice = async (ids, state) => {
547
+ var _a, _b, _c, _d;
548
+ const services = ((_a = state.service) == null ? void 0 : _a.value) || [];
549
+ const customerId = ((_c = (_b = state == null ? void 0 : state.client) == null ? void 0 : _b.value) == null ? void 0 : _c.id) || 0;
550
+ let data = await state.apis.getServices({
551
+ skip: 1,
552
+ num: 500,
553
+ ids,
554
+ customer_id: customerId,
555
+ open_quotation: 1,
556
+ open_bundle: 1,
557
+ with: ["bundleGroup.bundleItem", "optionGroup.optionItem"],
558
+ _config: { abort: true }
559
+ });
560
+ if (!((_d = data == null ? void 0 : data.list) == null ? void 0 : _d.length))
561
+ return;
562
+ const _lists = services.map((item) => {
563
+ var _a2, _b2, _c2, _d2;
564
+ let obj = { ...item };
565
+ if (!import_status.appointmentTypes.includes(obj.extension_type)) {
566
+ const product = data.list.find((p) => p.id === (item == null ? void 0 : item.product_id));
567
+ let _extend = (obj == null ? void 0 : obj._extend) || {};
568
+ const other = (_extend == null ? void 0 : _extend.other) || {};
569
+ if (product) {
570
+ if (((_a2 = product == null ? void 0 : product.variant) == null ? void 0 : _a2.length) && (other == null ? void 0 : other.product_variant_id)) {
571
+ const _variant = (_b2 = product == null ? void 0 : product.variant) == null ? void 0 : _b2.find((v) => v.id === (other == null ? void 0 : other.product_variant_id));
572
+ obj._extend.price = Number(_variant == null ? void 0 : _variant.price);
573
+ obj._extend.other.price = Number(_variant == null ? void 0 : _variant.price);
574
+ } else {
575
+ obj._extend.price = Number(product == null ? void 0 : product.price);
576
+ }
577
+ if (((_c2 = other == null ? void 0 : other.bundle) == null ? void 0 : _c2.length) && ((_d2 = product == null ? void 0 : product.bundle_group) == null ? void 0 : _d2.length)) {
578
+ let _bundle = updateNormalBundlePrice(other.bundle, product == null ? void 0 : product.bundle_group);
579
+ obj._extend.other = {
580
+ ...other,
581
+ bundle: _bundle
582
+ };
583
+ }
584
+ obj._extend.total = (0, import_utils.getProductTotalPrice)(obj);
585
+ obj._extend.origin_total = (0, import_utils.getProductTotalPrice)(obj);
586
+ }
587
+ }
588
+ return obj;
589
+ });
590
+ return _lists;
591
+ };
592
+ var updateAppointmentServicePrice = async (state, { start_date, end_date, product_id }) => {
593
+ var _a, _b, _c, _d, _e, _f, _g, _h;
594
+ const defaultReturn = {
595
+ multiDayPrices: [],
596
+ price: Number((_c = (_b = (_a = state == null ? void 0 : state.service) == null ? void 0 : _a.cacheItem) == null ? void 0 : _b._extend) == null ? void 0 : _c.price) || 0
597
+ };
598
+ try {
599
+ const format = "YYYY-MM-DD";
600
+ const customer_id = ((_e = (_d = state == null ? void 0 : state.client) == null ? void 0 : _d.value) == null ? void 0 : _e.id) || 1;
601
+ const _product_id = product_id || ((_f = state.service.cacheItem) == null ? void 0 : _f.product_id) || 0;
602
+ let multi_day_price = null;
603
+ if (!product_id) {
604
+ console.log("updateAppointmentServicePrice", product_id);
605
+ return defaultReturn;
606
+ }
607
+ const startDate = (0, import_dayjs.default)(start_date).format(format);
608
+ const endDate = (0, import_dayjs.default)(end_date).subtract(1, "days").format(format);
609
+ const params = {
610
+ customer_id,
611
+ multi_day: { start: startDate, end: endDate }
612
+ };
613
+ const res = await (0, import_serve.postMultiDay)(_product_id, params);
614
+ const _prices = ((_g = res == null ? void 0 : res.data) == null ? void 0 : _g.multi_day_price) || [];
615
+ multi_day_price = _prices == null ? void 0 : _prices.map((p) => {
616
+ var _a2, _b2;
617
+ const startDate2 = (0, import_dayjs.default)((_a2 = p == null ? void 0 : p.multi_day) == null ? void 0 : _a2.start);
618
+ const endDate2 = (0, import_dayjs.default)((_b2 = p == null ? void 0 : p.multi_day) == null ? void 0 : _b2.end).add(1, "day");
619
+ let duration = (endDate2 == null ? void 0 : endDate2.diff(startDate2, "day")) || 1;
620
+ return {
621
+ total: Number(p == null ? void 0 : p.price),
622
+ origin_total: Number(p == null ? void 0 : p.price),
623
+ num: duration,
624
+ quotation_id: (p == null ? void 0 : p.quotation_id) || 0,
625
+ start_date: startDate2 == null ? void 0 : startDate2.format(format),
626
+ end_date: endDate2 == null ? void 0 : endDate2.format(format)
627
+ };
628
+ });
629
+ return {
630
+ multiDayPrices: multi_day_price,
631
+ price: Number((_h = res == null ? void 0 : res.data) == null ? void 0 : _h.price) || 0
632
+ };
633
+ } catch (error) {
634
+ console.log("updateAppointmentServicePrice", error);
635
+ }
636
+ return defaultReturn;
637
+ };
638
+ var updateServicePrice = (state) => {
639
+ var _a;
640
+ let services = ((_a = state.service) == null ? void 0 : _a.value) || [];
641
+ let normalServices = services == null ? void 0 : services.filter(
642
+ (item) => !import_status.appointmentTypes.includes(item.extension_type)
643
+ );
644
+ let newNormalIds = normalServices == null ? void 0 : normalServices.map((item) => (item == null ? void 0 : item.product_id) || (item == null ? void 0 : item.id));
645
+ newNormalIds = [...new Set(newNormalIds)];
646
+ if (newNormalIds == null ? void 0 : newNormalIds.length) {
647
+ return normalServicePrice(newNormalIds, state);
648
+ }
649
+ return [];
650
+ };
303
651
  // Annotate the CommonJS export names for ESM import in node:
304
652
  0 && (module.exports = {
305
653
  disabledDate,
654
+ formItems,
306
655
  formatActiveKey,
307
656
  formatDateTime,
308
657
  formatDayDate,
309
658
  formatDayTime,
310
659
  formatHolderLists,
311
660
  formatProducts,
661
+ getAppointmentService,
312
662
  getDayProducts,
313
663
  getErrorMessage,
664
+ getPets,
314
665
  getResourceItem,
315
666
  holderId,
316
667
  initDate,
317
- isAppointment,
668
+ isBookingProduct,
318
669
  isDayBooking,
670
+ isDayBookingProduct,
319
671
  isHasDayAppointmentProduct,
320
672
  isOpenDeletePet,
321
- isTerminalDayBooking
673
+ isTerminalDayBooking,
674
+ updateAppointmentServicePrice,
675
+ updateNormalBundlePrice,
676
+ updateServicePrice,
677
+ updateServices
322
678
  });