@pisell/private-materials 3.0.199 → 3.0.200

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 (193) hide show
  1. package/build/lowcode/index.js +1 -1
  2. package/build/lowcode/meta.js +1 -1
  3. package/build/lowcode/preview.js +7 -7
  4. package/build/lowcode/render/default/view.css +1 -1
  5. package/build/lowcode/render/default/view.js +10 -10
  6. package/build/lowcode/view.css +1 -1
  7. package/build/lowcode/view.js +11 -11
  8. package/es/components/booking/components/customSelect/index.d.ts +1 -0
  9. package/es/components/booking/components/customSelect/index.js +6 -2
  10. package/es/components/booking/components/footer/AppointmentProductModal/index.d.ts +3 -0
  11. package/es/components/booking/components/footer/AppointmentProductModal/index.js +38 -0
  12. package/es/components/booking/components/footer/AppointmentProductModal/index.less +0 -0
  13. package/es/components/booking/components/footer/amount.js +45 -22
  14. package/es/components/booking/components/footer/index.js +84 -40
  15. package/es/components/booking/components/footer/utils.js +243 -32
  16. package/es/components/booking/info/addServiceVariant/index.js +8 -1
  17. package/es/components/booking/info/clientVariant/vertical/SelectDrawer.d.ts +1 -0
  18. package/es/components/booking/info/clientVariant/vertical/SelectDrawer.js +14 -13
  19. package/es/components/booking/info/clientVariant/vertical/index.js +33 -4
  20. package/es/components/booking/info/dateRange/index.d.ts +5 -0
  21. package/es/components/booking/info/dateRange/index.js +98 -0
  22. package/es/components/booking/info/dateRange/index.less +21 -0
  23. package/es/components/booking/info/main.js +20 -8
  24. package/es/components/booking/info/model.js +3 -0
  25. package/es/components/booking/info/pet/ChangePetModal/index.d.ts +4 -0
  26. package/es/components/booking/info/pet/ChangePetModal/index.js +119 -0
  27. package/es/components/booking/info/pet/ChangePetModal/index.less +4 -0
  28. package/es/components/booking/info/pet/index.js +54 -5
  29. package/es/components/booking/info/service/addService/index.js +142 -22
  30. package/es/components/booking/info/service/addService/index.less +13 -3
  31. package/es/components/booking/info/service/addService/utils.d.ts +11 -2
  32. package/es/components/booking/info/service/addService/utils.js +49 -24
  33. package/es/components/booking/info/service/editService/index.js +246 -44
  34. package/es/components/booking/info/service/editService/index.less +18 -13
  35. package/es/components/booking/info/service2/Lists.d.ts +3 -0
  36. package/es/components/booking/info/service2/Lists.js +158 -0
  37. package/es/components/booking/info/service2/hooks/useSelectPet.d.ts +6 -0
  38. package/es/components/booking/info/service2/hooks/useSelectPet.js +54 -0
  39. package/es/components/booking/info/service2/index.d.ts +3 -0
  40. package/es/components/booking/info/service2/index.js +58 -0
  41. package/es/components/booking/info/service2/status.d.ts +31 -0
  42. package/es/components/booking/info/service2/status.js +78 -0
  43. package/es/components/booking/info/service2/utils.d.ts +145 -0
  44. package/es/components/booking/info/service2/utils.js +438 -0
  45. package/es/components/booking/info/utils.d.ts +9 -0
  46. package/es/components/booking/info/utils.js +13 -0
  47. package/es/components/booking/locales.d.ts +60 -0
  48. package/es/components/booking/locales.js +75 -3
  49. package/es/components/booking/materiels/holder/index.d.ts +7 -0
  50. package/es/components/booking/materiels/holder/index.js +51 -0
  51. package/es/components/booking/model.d.ts +4 -1
  52. package/es/components/booking/model.js +4 -2
  53. package/es/components/booking/utils.d.ts +12 -3
  54. package/es/components/booking/utils.js +139 -23
  55. package/es/components/eftpos/form/index.js +6 -12
  56. package/es/components/eftpos/group/index.d.ts +2 -1
  57. package/es/components/eftpos/group/index.js +2 -1
  58. package/es/components/eftpos/index.js +2 -2
  59. package/es/components/eftposPay/helper.d.ts +0 -1
  60. package/es/components/eftposPay/helper.js +0 -14
  61. package/es/components/eftposPay/tyro/index.js +20 -51
  62. package/es/components/shoppingCart/Provider.d.ts +3 -0
  63. package/es/components/shoppingCart/Provider.js +86 -0
  64. package/es/components/shoppingCart/components/Cart/Product.d.ts +4 -0
  65. package/es/components/shoppingCart/components/Cart/Product.js +96 -0
  66. package/es/components/shoppingCart/components/Cart/index.d.ts +4 -0
  67. package/es/components/shoppingCart/components/Cart/index.js +72 -0
  68. package/es/components/shoppingCart/components/Cart/index.less +68 -0
  69. package/es/components/shoppingCart/components/Empty/index.d.ts +4 -0
  70. package/es/components/shoppingCart/components/Empty/index.js +14 -0
  71. package/es/components/shoppingCart/components/Empty/index.less +19 -0
  72. package/es/components/shoppingCart/components/Render/index.d.ts +4 -0
  73. package/es/components/shoppingCart/components/Render/index.js +68 -0
  74. package/es/components/shoppingCart/components/Render/index.less +2 -0
  75. package/es/components/shoppingCart/components/SelectHolderModal/index.d.ts +4 -0
  76. package/es/components/shoppingCart/components/SelectHolderModal/index.js +124 -0
  77. package/es/components/shoppingCart/components/SelectHolderModal/index.less +32 -0
  78. package/es/components/shoppingCart/hooks/useAddService.d.ts +3 -0
  79. package/es/components/shoppingCart/hooks/useAddService.js +23 -0
  80. package/es/components/shoppingCart/hooks/useClearCart.d.ts +3 -0
  81. package/es/components/shoppingCart/hooks/useClearCart.js +54 -0
  82. package/es/components/shoppingCart/hooks/useContext.d.ts +1 -0
  83. package/es/components/shoppingCart/hooks/useContext.js +5 -0
  84. package/es/components/shoppingCart/index.d.ts +4 -0
  85. package/es/components/shoppingCart/index.js +24 -0
  86. package/es/components/shoppingCart/locales.d.ts +33 -0
  87. package/es/components/shoppingCart/locales.js +38 -0
  88. package/es/components/shoppingCart/mock.d.ts +40 -0
  89. package/es/components/shoppingCart/mock.js +40 -0
  90. package/es/components/shoppingCart/status.d.ts +2 -0
  91. package/es/components/shoppingCart/status.js +22 -0
  92. package/es/components/shoppingCart/type.d.ts +39 -0
  93. package/es/components/shoppingCart/type.js +1 -0
  94. package/es/components/shoppingCart/utils.d.ts +63 -0
  95. package/es/components/shoppingCart/utils.js +119 -0
  96. package/es/index.d.ts +1 -0
  97. package/es/index.js +2 -1
  98. package/lib/components/booking/components/customSelect/index.d.ts +1 -0
  99. package/lib/components/booking/components/customSelect/index.js +6 -2
  100. package/lib/components/booking/components/footer/AppointmentProductModal/index.d.ts +3 -0
  101. package/lib/components/booking/components/footer/AppointmentProductModal/index.js +60 -0
  102. package/lib/components/booking/components/footer/AppointmentProductModal/index.less +0 -0
  103. package/lib/components/booking/components/footer/amount.js +26 -8
  104. package/lib/components/booking/components/footer/index.js +25 -4
  105. package/lib/components/booking/components/footer/utils.js +157 -31
  106. package/lib/components/booking/info/addServiceVariant/index.js +5 -0
  107. package/lib/components/booking/info/clientVariant/vertical/SelectDrawer.d.ts +1 -0
  108. package/lib/components/booking/info/clientVariant/vertical/SelectDrawer.js +8 -7
  109. package/lib/components/booking/info/clientVariant/vertical/index.js +36 -10
  110. package/lib/components/booking/info/dateRange/index.d.ts +5 -0
  111. package/lib/components/booking/info/dateRange/index.js +111 -0
  112. package/lib/components/booking/info/dateRange/index.less +21 -0
  113. package/lib/components/booking/info/main.js +11 -4
  114. package/lib/components/booking/info/model.js +3 -0
  115. package/lib/components/booking/info/pet/ChangePetModal/index.d.ts +4 -0
  116. package/lib/components/booking/info/pet/ChangePetModal/index.js +111 -0
  117. package/lib/components/booking/info/pet/ChangePetModal/index.less +4 -0
  118. package/lib/components/booking/info/pet/index.js +61 -25
  119. package/lib/components/booking/info/service/addService/index.js +107 -34
  120. package/lib/components/booking/info/service/addService/index.less +13 -3
  121. package/lib/components/booking/info/service/addService/utils.d.ts +11 -2
  122. package/lib/components/booking/info/service/addService/utils.js +31 -10
  123. package/lib/components/booking/info/service/editService/index.js +283 -125
  124. package/lib/components/booking/info/service/editService/index.less +18 -13
  125. package/lib/components/booking/info/service2/Lists.d.ts +3 -0
  126. package/lib/components/booking/info/service2/Lists.js +113 -0
  127. package/lib/components/booking/info/service2/hooks/useSelectPet.d.ts +6 -0
  128. package/lib/components/booking/info/service2/hooks/useSelectPet.js +50 -0
  129. package/lib/components/booking/info/service2/index.d.ts +3 -0
  130. package/lib/components/booking/info/service2/index.js +75 -0
  131. package/lib/components/booking/info/service2/status.d.ts +31 -0
  132. package/lib/components/booking/info/service2/status.js +81 -0
  133. package/lib/components/booking/info/service2/utils.d.ts +145 -0
  134. package/lib/components/booking/info/service2/utils.js +322 -0
  135. package/lib/components/booking/info/utils.d.ts +9 -0
  136. package/lib/components/booking/info/utils.js +6 -0
  137. package/lib/components/booking/locales.d.ts +60 -0
  138. package/lib/components/booking/locales.js +63 -3
  139. package/lib/components/booking/materiels/holder/index.d.ts +7 -0
  140. package/lib/components/booking/materiels/holder/index.js +65 -0
  141. package/lib/components/booking/model.d.ts +4 -1
  142. package/lib/components/booking/model.js +4 -2
  143. package/lib/components/booking/utils.d.ts +12 -3
  144. package/lib/components/booking/utils.js +87 -15
  145. package/lib/components/eftpos/form/index.js +6 -12
  146. package/lib/components/eftpos/group/index.d.ts +2 -1
  147. package/lib/components/eftpos/group/index.js +1 -0
  148. package/lib/components/eftpos/index.js +2 -2
  149. package/lib/components/eftposPay/helper.d.ts +0 -1
  150. package/lib/components/eftposPay/helper.js +0 -21
  151. package/lib/components/eftposPay/tyro/index.js +7 -36
  152. package/lib/components/shoppingCart/Provider.d.ts +3 -0
  153. package/lib/components/shoppingCart/Provider.js +110 -0
  154. package/lib/components/shoppingCart/components/Cart/Product.d.ts +4 -0
  155. package/lib/components/shoppingCart/components/Cart/Product.js +89 -0
  156. package/lib/components/shoppingCart/components/Cart/index.d.ts +4 -0
  157. package/lib/components/shoppingCart/components/Cart/index.js +77 -0
  158. package/lib/components/shoppingCart/components/Cart/index.less +68 -0
  159. package/lib/components/shoppingCart/components/Empty/index.d.ts +4 -0
  160. package/lib/components/shoppingCart/components/Empty/index.js +43 -0
  161. package/lib/components/shoppingCart/components/Empty/index.less +19 -0
  162. package/lib/components/shoppingCart/components/Render/index.d.ts +4 -0
  163. package/lib/components/shoppingCart/components/Render/index.js +79 -0
  164. package/lib/components/shoppingCart/components/Render/index.less +2 -0
  165. package/lib/components/shoppingCart/components/SelectHolderModal/index.d.ts +4 -0
  166. package/lib/components/shoppingCart/components/SelectHolderModal/index.js +116 -0
  167. package/lib/components/shoppingCart/components/SelectHolderModal/index.less +32 -0
  168. package/lib/components/shoppingCart/hooks/useAddService.d.ts +3 -0
  169. package/lib/components/shoppingCart/hooks/useAddService.js +55 -0
  170. package/lib/components/shoppingCart/hooks/useClearCart.d.ts +3 -0
  171. package/lib/components/shoppingCart/hooks/useClearCart.js +71 -0
  172. package/lib/components/shoppingCart/hooks/useContext.d.ts +1 -0
  173. package/lib/components/shoppingCart/hooks/useContext.js +31 -0
  174. package/lib/components/shoppingCart/index.d.ts +4 -0
  175. package/lib/components/shoppingCart/index.js +60 -0
  176. package/lib/components/shoppingCart/locales.d.ts +33 -0
  177. package/lib/components/shoppingCart/locales.js +56 -0
  178. package/lib/components/shoppingCart/mock.d.ts +40 -0
  179. package/lib/components/shoppingCart/mock.js +76 -0
  180. package/lib/components/shoppingCart/status.d.ts +2 -0
  181. package/lib/components/shoppingCart/status.js +60 -0
  182. package/lib/components/shoppingCart/type.d.ts +39 -0
  183. package/lib/components/shoppingCart/type.js +17 -0
  184. package/lib/components/shoppingCart/utils.d.ts +63 -0
  185. package/lib/components/shoppingCart/utils.js +92 -0
  186. package/lib/index.d.ts +1 -0
  187. package/lib/index.js +3 -0
  188. package/lowcode/shopping-cart/meta.ts +98 -0
  189. package/package.json +4 -4
  190. package/es/components/eftpos/receipt/index.d.ts +0 -24
  191. package/es/components/eftpos/receipt/index.js +0 -96
  192. package/lib/components/eftpos/receipt/index.d.ts +0 -24
  193. package/lib/components/eftpos/receipt/index.js +0 -88
@@ -0,0 +1,438 @@
1
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
4
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
6
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
7
+ import { getNoResource } from "../../mock";
8
+ import { getErrorList } from "../../utils";
9
+ import { locales } from "@pisell/utils";
10
+ import dayjs from 'dayjs';
11
+ import { appointmentTypes, openingTime } from "./status";
12
+ import localeTexts from "../../locales";
13
+ locales.init(localeTexts, localStorage.getItem('umi_locale') || 'en');
14
+ export var formatActiveKey = function formatActiveKey(lists, platform) {
15
+ if (!(lists !== null && lists !== void 0 && lists.length)) return [];
16
+
17
+ // 管理端默认打开最后一个holder
18
+ if (platform === 'shop') {
19
+ var _lists2;
20
+ return [(_lists2 = lists[lists.length - 1]) === null || _lists2 === void 0 ? void 0 : _lists2.key];
21
+ }
22
+
23
+ // 其他端默认打开所有
24
+ return lists === null || lists === void 0 ? void 0 : lists.map(function (cart) {
25
+ return cart === null || cart === void 0 ? void 0 : cart.key;
26
+ });
27
+ };
28
+
29
+ /**
30
+ * @title: 获取资源名称
31
+ * @description:
32
+ * @param {any} id
33
+ * @param {any} state
34
+ * @return {*}
35
+ * @Author: WangHan
36
+ * @Date: 2024-11-29 18:02
37
+ */
38
+ export var getResourceItem = function getResourceItem(id, state) {
39
+ var _state$service$resour;
40
+ if (id === 0) {
41
+ return getNoResource();
42
+ }
43
+ return (_state$service$resour = state.service.resources) === null || _state$service$resour === void 0 ? void 0 : _state$service$resour.find(function (d) {
44
+ return d.form_record_id === id;
45
+ });
46
+ };
47
+ var errorTypes = {
48
+ product: locales.getText('pisell2.text.status.service-error-1'),
49
+ time: locales.getText('pisell2.text.status.service-error-2'),
50
+ maxLimit: locales.getText('pisell2.text.status.service-error-3'),
51
+ limit: locales.getText('pisell2.text.status.service-error-3')
52
+ };
53
+
54
+ /**
55
+ * @title: 错误提示
56
+ * @description:
57
+ * @param {any} service
58
+ * @param {any} resourceItem
59
+ * @return {*}
60
+ * @Author: WangHan
61
+ * @Date: 2024-11-29 18:41
62
+ */
63
+ export var getErrorMessage = function getErrorMessage(service, resourceItem, isDay) {
64
+ var errorList = getErrorList(resourceItem, service, isDay);
65
+ var errorMessage = '';
66
+ if (!service.id) {
67
+ return errorList[0].label;
68
+ }
69
+ if (errorList.length) {
70
+ if (errorList.length > 1) {
71
+ errorMessage = "".concat(errorList.length, " ").concat(locales.getText('pisell2.text.warnings'));
72
+ } else {
73
+ errorMessage = (resourceItem === null || resourceItem === void 0 ? void 0 : resourceItem.labelText) + ' ' + errorTypes[errorList[0].type];
74
+ }
75
+ }
76
+ return errorMessage;
77
+ };
78
+
79
+ /**
80
+ * @title: 格式化主体列表
81
+ * @description:
82
+ * @param {any} lists
83
+ * @param {boolean} isOpenGroup
84
+ * @return {*}
85
+ * @Author: WangHan
86
+ * @Date: 2024-12-04 11:27
87
+ */
88
+ export var formatHolderLists = function formatHolderLists(lists) {
89
+ var isOpenGroup = true;
90
+ var _lists = lists === null || lists === void 0 ? void 0 : lists.map(function (item) {
91
+ return _objectSpread(_objectSpread({}, item), {}, {
92
+ id: (item === null || item === void 0 ? void 0 : item.id) || (item === null || item === void 0 ? void 0 : item.form_record_id),
93
+ key: (item === null || item === void 0 ? void 0 : item.id) || (item === null || item === void 0 ? void 0 : item.form_record_id),
94
+ label: locales.getText('pisell2.text.cart.of')(item === null || item === void 0 ? void 0 : item.main_field)
95
+ });
96
+ });
97
+
98
+ // 开启了分组并且是管理端,则增加open items分组
99
+ if (isOpenGroup) {
100
+ var defaults = [{
101
+ key: 0,
102
+ id: 0,
103
+ label: locales.getText('pisell2.text.open.items'),
104
+ main_field: locales.getText('pisell2.text.open.items')
105
+ }];
106
+ return defaults.concat(_lists);
107
+ }
108
+ return _lists;
109
+ };
110
+
111
+ /**
112
+ * @title: pets数据加 open items
113
+ * @description:
114
+ * @param {any} state
115
+ * @return {*}
116
+ * @Author: WangHan
117
+ * @Date: 2024-12-03 11:40
118
+ */
119
+ var getHolderLists = function getHolderLists(state) {
120
+ var _state$bookingConfig, _state$bookingConfig$, _state$bookingConfig$2, _state$bookingConfig$3, _state$pet, _state$pet$value;
121
+ var form_id = (state === null || state === void 0 ? void 0 : (_state$bookingConfig = state.bookingConfig) === null || _state$bookingConfig === void 0 ? void 0 : (_state$bookingConfig$ = _state$bookingConfig.config) === null || _state$bookingConfig$ === void 0 ? void 0 : (_state$bookingConfig$2 = _state$bookingConfig$.basic) === null || _state$bookingConfig$2 === void 0 ? void 0 : (_state$bookingConfig$3 = _state$bookingConfig$2.appointment_subject) === null || _state$bookingConfig$3 === void 0 ? void 0 : _state$bookingConfig$3.form_id) || 0;
122
+ var petLists = (state === null || state === void 0 ? void 0 : (_state$pet = state.pet) === null || _state$pet === void 0 ? void 0 : (_state$pet$value = _state$pet.value) === null || _state$pet$value === void 0 ? void 0 : _state$pet$value[form_id]) || [];
123
+ var _lists = formatHolderLists(petLists);
124
+ return _lists;
125
+ };
126
+
127
+ /**
128
+ * @title: 获取pet名称
129
+ * @description:
130
+ * @param {any} state
131
+ * @param {number} id
132
+ * @return {*}
133
+ * @Author: WangHan
134
+ * @Date: 2024-12-03 11:42
135
+ */
136
+ var getHolderName = function getHolderName(state, id) {
137
+ var holderLists = getHolderLists(state);
138
+ if (!holderLists.length || !id) return '';
139
+ var resource = holderLists.find(function (d) {
140
+ return (d === null || d === void 0 ? void 0 : d.id) === id;
141
+ });
142
+ return resource === null || resource === void 0 ? void 0 : resource.main_field;
143
+ };
144
+
145
+ /**
146
+ * @title: 是否是预约商品
147
+ * @description:
148
+ * @return {*}
149
+ * @Author: WangHan
150
+ * @Date: 2024-12-06 11:24
151
+ */
152
+ export var isAppointment = function isAppointment(item, state) {
153
+ return appointmentTypes.includes(item === null || item === void 0 ? void 0 : item.extension_type) && isDayBooking(state);
154
+ };
155
+
156
+ /**
157
+ * @title: 格式化商品数据
158
+ * @description:
159
+ * @param {any} lists
160
+ * @return {*}
161
+ * @Author: WangHan
162
+ * @Date: 2024-11-29 17:36
163
+ */
164
+ export var formatProducts = function formatProducts(lists, state) {
165
+ if (!(lists !== null && lists !== void 0 && lists.length)) return [];
166
+ console.log(lists, 'wh_lists');
167
+ try {
168
+ return lists.map(function (item) {
169
+ var _item$_extend, _item$_extend3, _item$_extend3$other, _item$_extend4, _item$_extend4$other, _item$_extend5, _item$_extend5$other, _resourceItem, _item$_extend6;
170
+ var _isAppointment = isAppointment(item, state);
171
+ var clientTitle = getHolderName(state, item === null || item === void 0 ? void 0 : (_item$_extend = item._extend) === null || _item$_extend === void 0 ? void 0 : _item$_extend.holder_id);
172
+ var resourceItem = {};
173
+ var errorMessage = '';
174
+ if (_isAppointment) {
175
+ var _item$_extend2;
176
+ resourceItem = getResourceItem(item === null || item === void 0 ? void 0 : (_item$_extend2 = item._extend) === null || _item$_extend2 === void 0 ? void 0 : _item$_extend2.resource, state);
177
+ errorMessage = getErrorMessage(item, resourceItem, isDayBooking(state));
178
+ }
179
+ return _objectSpread(_objectSpread({}, item), {}, {
180
+ note: (item === null || item === void 0 ? void 0 : item.note) || '',
181
+ locale: state.locale,
182
+ symbol: state.amountSymbol,
183
+ total: item === null || item === void 0 ? void 0 : item._extend.total,
184
+ price: item === null || item === void 0 ? void 0 : item._extend.price,
185
+ origin_total: item === null || item === void 0 ? void 0 : item._extend.origin_total,
186
+ num: item === null || item === void 0 ? void 0 : item._extend.quantity,
187
+ bundle: item === null || item === void 0 ? void 0 : (_item$_extend3 = item._extend) === null || _item$_extend3 === void 0 ? void 0 : (_item$_extend3$other = _item$_extend3.other) === null || _item$_extend3$other === void 0 ? void 0 : _item$_extend3$other.bundle,
188
+ options: item === null || item === void 0 ? void 0 : (_item$_extend4 = item._extend) === null || _item$_extend4 === void 0 ? void 0 : (_item$_extend4$other = _item$_extend4.other) === null || _item$_extend4$other === void 0 ? void 0 : _item$_extend4$other.option,
189
+ product_option_string: item === null || item === void 0 ? void 0 : (_item$_extend5 = item._extend) === null || _item$_extend5 === void 0 ? void 0 : (_item$_extend5$other = _item$_extend5.other) === null || _item$_extend5$other === void 0 ? void 0 : _item$_extend5$other.product_option_string,
190
+ _showAction: false,
191
+ _actionText: locales.getText("page.booking.text.add-time"),
192
+ _errorMessage: errorMessage,
193
+ _extend: _objectSpread(_objectSpread({}, (item === null || item === void 0 ? void 0 : item._extend) || {}), {}, {
194
+ date: !_isAppointment ? null : state === null || state === void 0 ? void 0 : state.date,
195
+ relation_form_name: !_isAppointment ? '' : ((_resourceItem = resourceItem) === null || _resourceItem === void 0 ? void 0 : _resourceItem.labelText) || item.relation_form_name,
196
+ holder_title: clientTitle,
197
+ resource: !_isAppointment ? null : item === null || item === void 0 ? void 0 : (_item$_extend6 = item._extend) === null || _item$_extend6 === void 0 ? void 0 : _item$_extend6.resource,
198
+ relation_details: []
199
+ })
200
+ });
201
+ });
202
+ } catch (error) {}
203
+ };
204
+
205
+ /**
206
+ * @title: 禁用日期
207
+ * @description:
208
+ * @param {any} current
209
+ * @param {string} position
210
+ * @param {any} startDate
211
+ * @return {*}
212
+ * @Author: WangHan
213
+ * @Date: 2024-12-03 17:51
214
+ */
215
+ export var disabledDate = function disabledDate(current, position, currentDate) {
216
+ if (!dayjs(currentDate).isValid()) return;
217
+ if (position === 'start') {
218
+ return false;
219
+ }
220
+ if (position === 'end' && current.endOf('day') && currentDate) {
221
+ console.log(currentDate, current, position, 'currentDate');
222
+
223
+ // 结束日期最大 = 开始日期 + 8个月
224
+ var endDisabled = currentDate.add(8, 'months').format('YYYY-MM-DD');
225
+ return dayjs(endDisabled) < current.startOf('day') || current.startOf('day') <= currentDate;
226
+ }
227
+ return current && current <= currentDate;
228
+ };
229
+
230
+ /**
231
+ * @title: 是否是跨日预约
232
+ * @description:
233
+ * @param {any} state
234
+ * @return {*}
235
+ * @Author: WangHan
236
+ * @Date: 2024-12-04 09:49
237
+ */
238
+ export var isDayBooking = function isDayBooking(state) {
239
+ return (state === null || state === void 0 ? void 0 : state.renderType) === 'dayBooking';
240
+ };
241
+
242
+ /**
243
+ * @title: 是否是terminal上的跨日预约
244
+ * @description:
245
+ * @param {any} state
246
+ * @return {*}
247
+ * @Author: WangHan
248
+ * @Date: 2024-12-04 15:31
249
+ */
250
+ export var isTerminalDayBooking = function isTerminalDayBooking(state) {
251
+ return state.isTerminalDayBookingPage;
252
+ };
253
+ export var formatDayDate = function formatDayDate(_extend) {
254
+ // 默认选择的日期
255
+ var startDate = dayjs(_extend === null || _extend === void 0 ? void 0 : _extend.start_date).startOf('day');
256
+ var endDate = dayjs(_extend === null || _extend === void 0 ? void 0 : _extend.end_date).startOf('day');
257
+ return _objectSpread(_objectSpread({}, _extend), {}, {
258
+ start_date: startDate,
259
+ end_date: endDate
260
+ });
261
+ };
262
+
263
+ /**
264
+ * @title: 根据营业日时间格式化时间
265
+ * @description:
266
+ * @param {any} state
267
+ * @return {*}
268
+ * @Author: WangHan
269
+ * @Date: 2024-12-04 12:07
270
+ */
271
+ export var formatDayTime = function formatDayTime(_ref) {
272
+ var startDate = _ref.startDate,
273
+ endDate = _ref.endDate;
274
+ // 营业日时间
275
+ var shopOpeningTime = localStorage.getItem('shopOpeningHours') || '00:00';
276
+
277
+ // 默认选择的日期
278
+ var start_date = dayjs(startDate).format('YYYY-MM-DD');
279
+ var end_date = dayjs(endDate).format('YYYY-MM-DD');
280
+
281
+ // 更新后的日期
282
+ var result = {
283
+ startDateTime: dayjs("".concat(start_date, "T").concat(shopOpeningTime, ":00")),
284
+ // 结束日期根据营业日时间减去一分钟
285
+ endDateTime: dayjs("".concat(end_date, "T").concat(shopOpeningTime, ":00")).subtract(1, 'minute')
286
+ };
287
+ return result;
288
+ };
289
+ export var formatDateTime = function formatDateTime(start_date, end_date) {
290
+ var _openingTime = openingTime();
291
+
292
+ // 开始时间 + 营业日时间
293
+ var startDate = "".concat(start_date, " ").concat(_openingTime);
294
+ var endDate = "".concat(end_date, " ").concat(_openingTime);
295
+ var date = {
296
+ value: dayjs(startDate),
297
+ end_date: dayjs(endDate).subtract(1, 'minute')
298
+ };
299
+ return date;
300
+ };
301
+
302
+ /**
303
+ * @title: 初始化日期
304
+ * @description:
305
+ * @return {*}
306
+ * @Author: WangHan
307
+ * @Date: 2024-12-06 17:24
308
+ */
309
+ export var initDate = function initDate() {
310
+ var startDate = dayjs().format('YYYY-MM-DD');
311
+ var endDate = dayjs().add(1, 'days').format('YYYY-MM-DD');
312
+ var date = formatDateTime(startDate, endDate);
313
+ return date;
314
+ };
315
+
316
+ /**
317
+ * @title: 是否有预约商品
318
+ * @description:
319
+ * @return {*}
320
+ * @Author: WangHan
321
+ * @Date: 2024-12-12 15:47
322
+ */
323
+ export var isHasDayAppointmentProduct = function isHasDayAppointmentProduct(state) {
324
+ var _state$bookingConfig2, _state$bookingConfig3, _state$bookingConfig4, _state$bookingConfig5, _state$service, _state$pet2, _state$pet2$value;
325
+ var form_id = (state === null || state === void 0 ? void 0 : (_state$bookingConfig2 = state.bookingConfig) === null || _state$bookingConfig2 === void 0 ? void 0 : (_state$bookingConfig3 = _state$bookingConfig2.config) === null || _state$bookingConfig3 === void 0 ? void 0 : (_state$bookingConfig4 = _state$bookingConfig3.basic) === null || _state$bookingConfig4 === void 0 ? void 0 : (_state$bookingConfig5 = _state$bookingConfig4.appointment_subject) === null || _state$bookingConfig5 === void 0 ? void 0 : _state$bookingConfig5.form_id) || 0;
326
+ var services = ((_state$service = state.service) === null || _state$service === void 0 ? void 0 : _state$service.value) || [];
327
+ var pets = ((_state$pet2 = state.pet) === null || _state$pet2 === void 0 ? void 0 : (_state$pet2$value = _state$pet2.value) === null || _state$pet2$value === void 0 ? void 0 : _state$pet2$value[form_id]) || [];
328
+
329
+ // 没有任何一个预约商品则提示
330
+ var appointmentServices = services.filter(function (d) {
331
+ return appointmentTypes.includes(d.extension_type);
332
+ });
333
+ if (!appointmentServices.length) return true;
334
+ var _pets = pets === null || pets === void 0 ? void 0 : pets.map(function (d) {
335
+ var holderProducts = services.filter(function (d) {
336
+ var _d$_extend;
337
+ return ((_d$_extend = d._extend) === null || _d$_extend === void 0 ? void 0 : _d$_extend.holder_id) == d.form_record_id;
338
+ });
339
+ return _objectSpread(_objectSpread({}, d), {}, {
340
+ // 如果该购物车中没选择任何商品,则不需要验证,所以直接用1来填充
341
+ // services: !holderProducts?.length ? [1] : holderProducts?.filter((d: any) => appointmentTypes.includes(d.extension_type))
342
+ services: services.filter(function (item) {
343
+ var _item$_extend7;
344
+ return ((_item$_extend7 = item._extend) === null || _item$_extend7 === void 0 ? void 0 : _item$_extend7.holder_id) == d.form_record_id && appointmentTypes.includes(item.extension_type);
345
+ })
346
+ });
347
+ });
348
+ _pets = _pets.filter(function (d) {
349
+ return !d.services.length;
350
+ });
351
+ return _pets.length > 0;
352
+ };
353
+
354
+ /**
355
+ * @title: 过滤出如果是预约商品,则只获取跨日的预约商品
356
+ * @description:
357
+ * @param {any} lists
358
+ * @return {*}
359
+ * @Author: WangHan
360
+ * @Date: 2024-12-13 16:44
361
+ */
362
+ export var getDayProducts = function getDayProducts(holderId, lists, isTerminal) {
363
+ var _lists = lists || [];
364
+
365
+ // 普通商品列表, terminal进入页面直接获取了商品列表数据,所以选择了表单之后不会再次触发该方法
366
+ if (!holderId && !isTerminal) {
367
+ _lists = _lists.filter(function (item) {
368
+ return !appointmentTypes.includes(item === null || item === void 0 ? void 0 : item.extension_type);
369
+ });
370
+ } else {
371
+ // 普通商品 + 跨日预约商品列表
372
+ _lists = _lists.filter(function (item) {
373
+ var _item$duration;
374
+ return !appointmentTypes.includes(item === null || item === void 0 ? void 0 : item.extension_type) || appointmentTypes.includes(item === null || item === void 0 ? void 0 : item.extension_type) && ((_item$duration = item.duration) === null || _item$duration === void 0 ? void 0 : _item$duration.type) === 'days';
375
+ });
376
+ }
377
+ return _lists;
378
+ };
379
+
380
+ /**
381
+ * @title: 判断是否打开删除宠物弹窗
382
+ * @description:
383
+ * @param {any} state
384
+ * @param {any} newVal
385
+ * @return {*}
386
+ * @Author: WangHan
387
+ * @Date: 2024-12-16 16:12
388
+ */
389
+ export var isOpenDeletePet = function isOpenDeletePet(state, newVal) {
390
+ var _state$bookingConfig6, _state$bookingConfig7, _state$bookingConfig8, _state$bookingConfig9, _state$pet3, _state$pet3$value, _state$service3;
391
+ var form_id = (state === null || state === void 0 ? void 0 : (_state$bookingConfig6 = state.bookingConfig) === null || _state$bookingConfig6 === void 0 ? void 0 : (_state$bookingConfig7 = _state$bookingConfig6.config) === null || _state$bookingConfig7 === void 0 ? void 0 : (_state$bookingConfig8 = _state$bookingConfig7.basic) === null || _state$bookingConfig8 === void 0 ? void 0 : (_state$bookingConfig9 = _state$bookingConfig8.appointment_subject) === null || _state$bookingConfig9 === void 0 ? void 0 : _state$bookingConfig9.form_id) || 0;
392
+ var oldPets = (state === null || state === void 0 ? void 0 : (_state$pet3 = state.pet) === null || _state$pet3 === void 0 ? void 0 : (_state$pet3$value = _state$pet3.value) === null || _state$pet3$value === void 0 ? void 0 : _state$pet3$value[form_id]) || [];
393
+ var newPets = (newVal === null || newVal === void 0 ? void 0 : newVal[form_id]) || [];
394
+
395
+ // 被删除的表单
396
+ var deletePets = oldPets.filter(function (item) {
397
+ return !newPets.some(function (newItem) {
398
+ return newItem.form_record_id === item.form_record_id;
399
+ });
400
+ });
401
+
402
+ // 被删除的表单中是否有预约商品
403
+ var servicePets = deletePets.map(function (item) {
404
+ var _state$service2, _state$service2$value;
405
+ return _objectSpread(_objectSpread({}, item), {}, {
406
+ services: (_state$service2 = state.service) === null || _state$service2 === void 0 ? void 0 : (_state$service2$value = _state$service2.value) === null || _state$service2$value === void 0 ? void 0 : _state$service2$value.filter(function (d) {
407
+ var _d$_extend2;
408
+ return ((_d$_extend2 = d._extend) === null || _d$_extend2 === void 0 ? void 0 : _d$_extend2.holder_id) == item.form_record_id;
409
+ })
410
+ });
411
+ });
412
+
413
+ // 查找被删除的表单中是否有对应的商品数据
414
+ var lists = servicePets.filter(function (item) {
415
+ var _item$services;
416
+ return ((_item$services = item.services) === null || _item$services === void 0 ? void 0 : _item$services.length) > 0;
417
+ });
418
+ console.log(deletePets, (_state$service3 = state.service) === null || _state$service3 === void 0 ? void 0 : _state$service3.value, lists, 'wh98888888');
419
+ return {
420
+ ids: lists.map(function (item) {
421
+ return item.form_record_id;
422
+ }),
423
+ lists: lists
424
+ };
425
+ };
426
+
427
+ /**
428
+ * @title: 当前选中的表单id
429
+ * @description:
430
+ * @param {any} state
431
+ * @return {*}
432
+ * @Author: WangHan
433
+ * @Date: 2024-12-17 14:40
434
+ */
435
+ export var holderId = function holderId(state) {
436
+ var _state$activeCartId;
437
+ return Number((state === null || state === void 0 ? void 0 : (_state$activeCartId = state.activeCartId) === null || _state$activeCartId === void 0 ? void 0 : _state$activeCartId[0]) || 0);
438
+ };
@@ -22,3 +22,12 @@ export declare const isInterval: (time1: number, time2: number, interval?: numbe
22
22
  */
23
23
  export declare const formatServiceListByTime: (list: any[]) => any[];
24
24
  export declare const isBooking4Shop: (shopId: number, renderType?: string) => boolean;
25
+ /**
26
+ * @title: 是否是跨日预约
27
+ * @description:
28
+ * @param {number} shopId
29
+ * @return {*}
30
+ * @Author: WangHan
31
+ * @Date: 2024-11-29 11:19
32
+ */
33
+ export declare const isDayBooking: (shopId: number) => boolean;
@@ -90,4 +90,17 @@ export var isBooking4Shop = function isBooking4Shop(shopId, renderType) {
90
90
  }
91
91
  var booking4Shops = [1350, 1401, 3013, 7154, 7572, 7007, 8119, 7320, 7362, 6497, 6087, 6303, 6726, 8191];
92
92
  return booking4Shops.includes(shopId);
93
+ };
94
+
95
+ /**
96
+ * @title: 是否是跨日预约
97
+ * @description:
98
+ * @param {number} shopId
99
+ * @return {*}
100
+ * @Author: WangHan
101
+ * @Date: 2024-11-29 11:19
102
+ */
103
+ export var isDayBooking = function isDayBooking(shopId) {
104
+ var dayBookingShops = [9];
105
+ return dayBookingShops.includes(shopId);
93
106
  };
@@ -33,6 +33,11 @@ declare const _default: {
33
33
  'pisell2.text.start_time': string;
34
34
  'pisell2.text.duration': string;
35
35
  'pisell2.text.resource': string;
36
+ 'pisell2.text.end_time': string;
37
+ 'pisell2.text.start_date': string;
38
+ 'pisell2.text.end_date': string;
39
+ 'pisell2.text.quantity': string;
40
+ 'pisell2.text.holder': string;
36
41
  'pisell2.text.warnings': string;
37
42
  'pisell2.text.order-notes': string;
38
43
  'pisell2.text.add-order-notes': string;
@@ -48,6 +53,7 @@ declare const _default: {
48
53
  'pisell2.text.updated': string;
49
54
  'pisell2.text.appointment-updated': string;
50
55
  'pisell2.text.please-create-an-appointment-first': string;
56
+ 'pisell2.text.day': (val: number) => string;
51
57
  'pisell2.text.min': string;
52
58
  'pisell2.text.h': string;
53
59
  'pisell2.text.other': string;
@@ -218,6 +224,20 @@ declare const _default: {
218
224
  'pisell2.booking.info.text.create-new': string;
219
225
  'pisell2.booking.info.text.form-agreement-yes': string;
220
226
  'pisell2.booking.info.text.form-agreement-no': string;
227
+ 'pisell2.text.open.items': string;
228
+ 'pisell2.text.cart.of': (val: any) => string;
229
+ 'pisell2.text.no.selected': string;
230
+ 'pisell2.text.select.items': string;
231
+ 'pisell2.text.edit-select-service': string;
232
+ 'pisell2.text.missing.reservation.title': string;
233
+ 'pisell2.text.missing.reservation.content': string;
234
+ 'pisell2.text.confirm': string;
235
+ 'pisell2.text.cancel': string;
236
+ 'pisell2.text.change.pet.title': string;
237
+ 'pisell2.text.change.pet.content': string;
238
+ 'pisell2.text.change.pet.content1': string;
239
+ 'pisell2.text.change.pet.confirm': string;
240
+ 'pisell2.text.change.pet.cancel': string;
221
241
  };
222
242
  'zh-CN': {
223
243
  'pisell2.text.refunded-amount': string;
@@ -256,6 +276,11 @@ declare const _default: {
256
276
  'pisell2.text.discount': string;
257
277
  'pisell2.text.discount-reason': string;
258
278
  'pisell2.text.start_time': string;
279
+ 'pisell2.text.end_time': string;
280
+ 'pisell2.text.start_date': string;
281
+ 'pisell2.text.end_date': string;
282
+ 'pisell2.text.quantity': string;
283
+ 'pisell2.text.holder': string;
259
284
  'pisell2.text.duration': string;
260
285
  'pisell2.text.resource': string;
261
286
  'pisell2.text.warnings': string;
@@ -275,6 +300,7 @@ declare const _default: {
275
300
  'pisell2.text.appointment-updated': string;
276
301
  'pisell2.text.updated': string;
277
302
  'pisell2.text.please-create-an-appointment-first': string;
303
+ 'pisell2.text.day': (val: number) => string;
278
304
  'pisell2.text.min': string;
279
305
  'pisell2.text.h': string;
280
306
  'pisell2.text.other': string;
@@ -438,6 +464,20 @@ declare const _default: {
438
464
  'pisell2.booking.info.text.create-new': string;
439
465
  'pisell2.booking.info.text.form-agreement-yes': string;
440
466
  'pisell2.booking.info.text.form-agreement-no': string;
467
+ 'pisell2.text.open.items': string;
468
+ 'pisell2.text.cart.of': (val: any) => string;
469
+ 'pisell2.text.no.selected': string;
470
+ 'pisell2.text.select.items': string;
471
+ 'pisell2.text.edit-select-service': string;
472
+ 'pisell2.text.missing.reservation.title': string;
473
+ 'pisell2.text.missing.reservation.content': string;
474
+ 'pisell2.text.confirm': string;
475
+ 'pisell2.text.cancel': string;
476
+ 'pisell2.text.change.pet.title': string;
477
+ 'pisell2.text.change.pet.content': string;
478
+ 'pisell2.text.change.pet.content1': string;
479
+ 'pisell2.text.change.pet.confirm': string;
480
+ 'pisell2.text.change.pet.cancel': string;
441
481
  };
442
482
  'zh-HK': {
443
483
  'pisell2.text.refunded-amount': string;
@@ -476,6 +516,11 @@ declare const _default: {
476
516
  'pisell2.text.discount': string;
477
517
  'pisell2.text.discount-reason': string;
478
518
  'pisell2.text.start_time': string;
519
+ 'pisell2.text.end_time': string;
520
+ 'pisell2.text.start_date': string;
521
+ 'pisell2.text.end_date': string;
522
+ 'pisell2.text.quantity': string;
523
+ 'pisell2.text.holder': string;
479
524
  'pisell2.text.duration': string;
480
525
  'pisell2.text.resource': string;
481
526
  'pisell2.text.warnings': string;
@@ -493,6 +538,7 @@ declare const _default: {
493
538
  'pisell2.text.appointment-updated': string;
494
539
  'pisell2.text.updated': string;
495
540
  'pisell2.text.please-create-an-appointment-first': string;
541
+ 'pisell2.text.day': (val: number) => string;
496
542
  'pisell2.text.min': string;
497
543
  'pisell2.text.h': string;
498
544
  'pisell2.text.other': string;
@@ -658,6 +704,20 @@ declare const _default: {
658
704
  'pisell2.booking.info.text.create-new': string;
659
705
  'pisell2.booking.info.text.form-agreement-yes': string;
660
706
  'pisell2.booking.info.text.form-agreement-no': string;
707
+ 'pisell2.text.open.items': string;
708
+ 'pisell2.text.cart.of': (val: any) => string;
709
+ 'pisell2.text.no.selected': string;
710
+ 'pisell2.text.select.items': string;
711
+ 'pisell2.text.edit-select-service': string;
712
+ 'pisell2.text.missing.reservation.title': string;
713
+ 'pisell2.text.missing.reservation.content': string;
714
+ 'pisell2.text.confirm': string;
715
+ 'pisell2.text.cancel': string;
716
+ 'pisell2.text.change.pet.title': string;
717
+ 'pisell2.text.change.pet.content': string;
718
+ 'pisell2.text.change.pet.content1': string;
719
+ 'pisell2.text.change.pet.confirm': string;
720
+ 'pisell2.text.change.pet.cancel': string;
661
721
  };
662
722
  };
663
723
  export default _default;