@pisell/private-materials 3.0.194 → 3.0.196
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.
- package/build/lowcode/index.js +1 -1
- package/build/lowcode/meta.js +1 -1
- package/build/lowcode/preview.js +142 -150
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +10 -10
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +11 -11
- package/es/components/booking/components/customSelect/index.d.ts +1 -0
- package/es/components/booking/components/customSelect/index.js +6 -2
- package/es/components/booking/components/footer/AppointmentProductModal/index.d.ts +3 -0
- package/es/components/booking/components/footer/AppointmentProductModal/index.js +37 -0
- package/es/components/booking/components/footer/AppointmentProductModal/index.less +0 -0
- package/es/components/booking/components/footer/amount.js +45 -22
- package/es/components/booking/components/footer/index.js +84 -40
- package/es/components/booking/components/footer/utils.js +218 -32
- package/es/components/booking/info/addServiceVariant/index.js +8 -1
- package/es/components/booking/info/clientVariant/vertical/SelectDrawer.d.ts +1 -0
- package/es/components/booking/info/clientVariant/vertical/SelectDrawer.js +14 -13
- package/es/components/booking/info/clientVariant/vertical/index.js +33 -4
- package/es/components/booking/info/dateRange/index.d.ts +5 -0
- package/es/components/booking/info/dateRange/index.js +98 -0
- package/es/components/booking/info/dateRange/index.less +21 -0
- package/es/components/booking/info/main.js +20 -8
- package/es/components/booking/info/model.js +3 -0
- package/es/components/booking/info/pet/ChangePetModal/index.d.ts +4 -0
- package/es/components/booking/info/pet/ChangePetModal/index.js +118 -0
- package/es/components/booking/info/pet/ChangePetModal/index.less +4 -0
- package/es/components/booking/info/pet/index.js +54 -5
- package/es/components/booking/info/service/addService/index.js +127 -20
- package/es/components/booking/info/service/addService/index.less +13 -3
- package/es/components/booking/info/service/addService/utils.d.ts +11 -2
- package/es/components/booking/info/service/addService/utils.js +49 -24
- package/es/components/booking/info/service/editService/index.js +232 -41
- package/es/components/booking/info/service/editService/index.less +18 -13
- package/es/components/booking/info/service2/Lists.d.ts +3 -0
- package/es/components/booking/info/service2/Lists.js +158 -0
- package/es/components/booking/info/service2/hooks/useSelectPet.d.ts +6 -0
- package/es/components/booking/info/service2/hooks/useSelectPet.js +54 -0
- package/es/components/booking/info/service2/index.d.ts +3 -0
- package/es/components/booking/info/service2/index.js +58 -0
- package/es/components/booking/info/service2/status.d.ts +31 -0
- package/es/components/booking/info/service2/status.js +78 -0
- package/es/components/booking/info/service2/utils.d.ts +145 -0
- package/es/components/booking/info/service2/utils.js +436 -0
- package/es/components/booking/info/utils.d.ts +9 -0
- package/es/components/booking/info/utils.js +13 -0
- package/es/components/booking/locales.d.ts +60 -0
- package/es/components/booking/locales.js +75 -3
- package/es/components/booking/materiels/holder/index.d.ts +7 -0
- package/es/components/booking/materiels/holder/index.js +51 -0
- package/es/components/booking/model.d.ts +4 -1
- package/es/components/booking/model.js +4 -2
- package/es/components/booking/utils.d.ts +12 -3
- package/es/components/booking/utils.js +126 -22
- package/es/components/eftpos/form/index.js +6 -12
- package/es/components/eftpos/group/index.d.ts +2 -1
- package/es/components/eftpos/group/index.js +2 -1
- package/es/components/eftpos/index.js +2 -2
- package/es/components/eftposPay/tyro/index.js +17 -40
- package/es/components/shoppingCart/Provider.d.ts +3 -0
- package/es/components/shoppingCart/Provider.js +86 -0
- package/es/components/shoppingCart/components/Cart/Product.d.ts +4 -0
- package/es/components/shoppingCart/components/Cart/Product.js +96 -0
- package/es/components/shoppingCart/components/Cart/index.d.ts +4 -0
- package/es/components/shoppingCart/components/Cart/index.js +72 -0
- package/es/components/shoppingCart/components/Cart/index.less +68 -0
- package/es/components/shoppingCart/components/Empty/index.d.ts +4 -0
- package/es/components/shoppingCart/components/Empty/index.js +14 -0
- package/es/components/shoppingCart/components/Empty/index.less +19 -0
- package/es/components/shoppingCart/components/Render/index.d.ts +4 -0
- package/es/components/shoppingCart/components/Render/index.js +68 -0
- package/es/components/shoppingCart/components/Render/index.less +2 -0
- package/es/components/shoppingCart/components/SelectHolderModal/index.d.ts +4 -0
- package/es/components/shoppingCart/components/SelectHolderModal/index.js +124 -0
- package/es/components/shoppingCart/components/SelectHolderModal/index.less +32 -0
- package/es/components/shoppingCart/hooks/useAddService.d.ts +3 -0
- package/es/components/shoppingCart/hooks/useAddService.js +23 -0
- package/es/components/shoppingCart/hooks/useClearCart.d.ts +3 -0
- package/es/components/shoppingCart/hooks/useClearCart.js +54 -0
- package/es/components/shoppingCart/hooks/useContext.d.ts +1 -0
- package/es/components/shoppingCart/hooks/useContext.js +5 -0
- package/es/components/shoppingCart/index.d.ts +4 -0
- package/es/components/shoppingCart/index.js +24 -0
- package/es/components/shoppingCart/locales.d.ts +33 -0
- package/es/components/shoppingCart/locales.js +38 -0
- package/es/components/shoppingCart/mock.d.ts +40 -0
- package/es/components/shoppingCart/mock.js +40 -0
- package/es/components/shoppingCart/status.d.ts +2 -0
- package/es/components/shoppingCart/status.js +22 -0
- package/es/components/shoppingCart/type.d.ts +39 -0
- package/es/components/shoppingCart/type.js +1 -0
- package/es/components/shoppingCart/utils.d.ts +63 -0
- package/es/components/shoppingCart/utils.js +119 -0
- package/es/index.d.ts +1 -0
- package/es/index.js +2 -1
- package/lib/components/booking/components/customSelect/index.d.ts +1 -0
- package/lib/components/booking/components/customSelect/index.js +6 -2
- package/lib/components/booking/components/footer/AppointmentProductModal/index.d.ts +3 -0
- package/lib/components/booking/components/footer/AppointmentProductModal/index.js +59 -0
- package/lib/components/booking/components/footer/AppointmentProductModal/index.less +0 -0
- package/lib/components/booking/components/footer/amount.js +26 -8
- package/lib/components/booking/components/footer/index.js +25 -4
- package/lib/components/booking/components/footer/utils.js +144 -31
- package/lib/components/booking/info/addServiceVariant/index.js +5 -0
- package/lib/components/booking/info/clientVariant/vertical/SelectDrawer.d.ts +1 -0
- package/lib/components/booking/info/clientVariant/vertical/SelectDrawer.js +8 -7
- package/lib/components/booking/info/clientVariant/vertical/index.js +36 -10
- package/lib/components/booking/info/dateRange/index.d.ts +5 -0
- package/lib/components/booking/info/dateRange/index.js +111 -0
- package/lib/components/booking/info/dateRange/index.less +21 -0
- package/lib/components/booking/info/main.js +11 -4
- package/lib/components/booking/info/model.js +3 -0
- package/lib/components/booking/info/pet/ChangePetModal/index.d.ts +4 -0
- package/lib/components/booking/info/pet/ChangePetModal/index.js +110 -0
- package/lib/components/booking/info/pet/ChangePetModal/index.less +4 -0
- package/lib/components/booking/info/pet/index.js +61 -25
- package/lib/components/booking/info/service/addService/index.js +95 -28
- package/lib/components/booking/info/service/addService/index.less +13 -3
- package/lib/components/booking/info/service/addService/utils.d.ts +11 -2
- package/lib/components/booking/info/service/addService/utils.js +31 -10
- package/lib/components/booking/info/service/editService/index.js +271 -122
- package/lib/components/booking/info/service/editService/index.less +18 -13
- package/lib/components/booking/info/service2/Lists.d.ts +3 -0
- package/lib/components/booking/info/service2/Lists.js +113 -0
- package/lib/components/booking/info/service2/hooks/useSelectPet.d.ts +6 -0
- package/lib/components/booking/info/service2/hooks/useSelectPet.js +50 -0
- package/lib/components/booking/info/service2/index.d.ts +3 -0
- package/lib/components/booking/info/service2/index.js +75 -0
- package/lib/components/booking/info/service2/status.d.ts +31 -0
- package/lib/components/booking/info/service2/status.js +81 -0
- package/lib/components/booking/info/service2/utils.d.ts +145 -0
- package/lib/components/booking/info/service2/utils.js +320 -0
- package/lib/components/booking/info/utils.d.ts +9 -0
- package/lib/components/booking/info/utils.js +6 -0
- package/lib/components/booking/locales.d.ts +60 -0
- package/lib/components/booking/locales.js +63 -3
- package/lib/components/booking/materiels/holder/index.d.ts +7 -0
- package/lib/components/booking/materiels/holder/index.js +65 -0
- package/lib/components/booking/model.d.ts +4 -1
- package/lib/components/booking/model.js +4 -2
- package/lib/components/booking/utils.d.ts +12 -3
- package/lib/components/booking/utils.js +79 -15
- package/lib/components/eftpos/form/index.js +6 -12
- package/lib/components/eftpos/group/index.d.ts +2 -1
- package/lib/components/eftpos/group/index.js +1 -0
- package/lib/components/eftpos/index.js +2 -2
- package/lib/components/eftposPay/tyro/index.js +5 -26
- package/lib/components/shoppingCart/Provider.d.ts +3 -0
- package/lib/components/shoppingCart/Provider.js +110 -0
- package/lib/components/shoppingCart/components/Cart/Product.d.ts +4 -0
- package/lib/components/shoppingCart/components/Cart/Product.js +89 -0
- package/lib/components/shoppingCart/components/Cart/index.d.ts +4 -0
- package/lib/components/shoppingCart/components/Cart/index.js +77 -0
- package/lib/components/shoppingCart/components/Cart/index.less +68 -0
- package/lib/components/shoppingCart/components/Empty/index.d.ts +4 -0
- package/lib/components/shoppingCart/components/Empty/index.js +43 -0
- package/lib/components/shoppingCart/components/Empty/index.less +19 -0
- package/lib/components/shoppingCart/components/Render/index.d.ts +4 -0
- package/lib/components/shoppingCart/components/Render/index.js +79 -0
- package/lib/components/shoppingCart/components/Render/index.less +2 -0
- package/lib/components/shoppingCart/components/SelectHolderModal/index.d.ts +4 -0
- package/lib/components/shoppingCart/components/SelectHolderModal/index.js +116 -0
- package/lib/components/shoppingCart/components/SelectHolderModal/index.less +32 -0
- package/lib/components/shoppingCart/hooks/useAddService.d.ts +3 -0
- package/lib/components/shoppingCart/hooks/useAddService.js +55 -0
- package/lib/components/shoppingCart/hooks/useClearCart.d.ts +3 -0
- package/lib/components/shoppingCart/hooks/useClearCart.js +71 -0
- package/lib/components/shoppingCart/hooks/useContext.d.ts +1 -0
- package/lib/components/shoppingCart/hooks/useContext.js +31 -0
- package/lib/components/shoppingCart/index.d.ts +4 -0
- package/lib/components/shoppingCart/index.js +60 -0
- package/lib/components/shoppingCart/locales.d.ts +33 -0
- package/lib/components/shoppingCart/locales.js +56 -0
- package/lib/components/shoppingCart/mock.d.ts +40 -0
- package/lib/components/shoppingCart/mock.js +76 -0
- package/lib/components/shoppingCart/status.d.ts +2 -0
- package/lib/components/shoppingCart/status.js +60 -0
- package/lib/components/shoppingCart/type.d.ts +39 -0
- package/lib/components/shoppingCart/type.js +17 -0
- package/lib/components/shoppingCart/utils.d.ts +63 -0
- package/lib/components/shoppingCart/utils.js +92 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +3 -0
- package/lowcode/shopping-cart/meta.ts +98 -0
- package/package.json +4 -4
- package/es/components/eftpos/receipt/index.d.ts +0 -24
- package/es/components/eftpos/receipt/index.js +0 -96
- package/lib/components/eftpos/receipt/index.d.ts +0 -24
- package/lib/components/eftpos/receipt/index.js +0 -88
|
@@ -4,9 +4,13 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
4
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
5
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
6
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 dayjs from "dayjs";
|
|
7
8
|
import { flexibleObj, isNowTime, getNowTime } from "../../utils";
|
|
8
9
|
import { isWalkIn } from "../../utils";
|
|
9
10
|
import { getSumCapacity } from "../../info2/utilsByBooking";
|
|
11
|
+
import { getDays } from "../../utils";
|
|
12
|
+
import { appointmentTypes } from "../../info/service2/status";
|
|
13
|
+
import { isDayBooking, formatDayTime } from "../../info/service2/utils";
|
|
10
14
|
var formatNote = function formatNote(data) {
|
|
11
15
|
var _data$notes;
|
|
12
16
|
return ((_data$notes = data.notes) === null || _data$notes === void 0 ? void 0 : _data$notes.orderNote) || "";
|
|
@@ -76,7 +80,7 @@ var getSubType = function getSubType(item) {
|
|
|
76
80
|
var _item$duration;
|
|
77
81
|
var _type = (_item$duration = item.duration) === null || _item$duration === void 0 ? void 0 : _item$duration.type;
|
|
78
82
|
// 目前不支持跨天
|
|
79
|
-
if (_type
|
|
83
|
+
if (_type) {
|
|
80
84
|
return _type;
|
|
81
85
|
}
|
|
82
86
|
return 'minutes';
|
|
@@ -117,6 +121,135 @@ var formatResource = function formatResource(service) {
|
|
|
117
121
|
}
|
|
118
122
|
};
|
|
119
123
|
|
|
124
|
+
/**
|
|
125
|
+
* @title: 格式化子预约的holder数据
|
|
126
|
+
* @description:
|
|
127
|
+
* @param {any} state
|
|
128
|
+
* @param {any} item
|
|
129
|
+
* @param {any} values
|
|
130
|
+
* @return {*}
|
|
131
|
+
* @Author: WangHan
|
|
132
|
+
* @Date: 2024-12-07 14:52
|
|
133
|
+
*/
|
|
134
|
+
var formatHolders = function formatHolders(state, item, values) {
|
|
135
|
+
var _state$bookingConfig, _state$bookingConfig$, _state$bookingConfig$2, _state$bookingConfig$3, _item$_extend;
|
|
136
|
+
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;
|
|
137
|
+
var obj = {
|
|
138
|
+
customer_id: values.customer_id,
|
|
139
|
+
form_id: form_id,
|
|
140
|
+
form_record: [((_item$_extend = item._extend) === null || _item$_extend === void 0 ? void 0 : _item$_extend.holder_id) || 0]
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
// 连锁加盟子店铺 增加参数
|
|
144
|
+
if (state.isFranchisee) {
|
|
145
|
+
obj.is_source_shop = 1;
|
|
146
|
+
}
|
|
147
|
+
return obj;
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* @title: 格式化商品数据
|
|
152
|
+
* @description:
|
|
153
|
+
* @param {any} item
|
|
154
|
+
* @return {*}
|
|
155
|
+
* @Author: WangHan
|
|
156
|
+
* @Date: 2024-12-07 14:21
|
|
157
|
+
*/
|
|
158
|
+
var formatProducts = function formatProducts(item) {
|
|
159
|
+
var _item$_extend2, _item$_extend2$other;
|
|
160
|
+
var total = Number(item._extend.total);
|
|
161
|
+
var origin_total = Number(item._extend.origin_total);
|
|
162
|
+
var discount_amount = origin_total - total;
|
|
163
|
+
|
|
164
|
+
// 加价时type使用change_price
|
|
165
|
+
var discount_type = discount_amount < 0 ? 'change_price' : 'discount';
|
|
166
|
+
return {
|
|
167
|
+
"num": item._extend.quantity,
|
|
168
|
+
"price": item._extend.price,
|
|
169
|
+
"product_id": (item === null || item === void 0 ? void 0 : item.product_id) || item.id,
|
|
170
|
+
"discount_amount": discount_amount,
|
|
171
|
+
"product_discount_reason": item._extend.discount_reason || '',
|
|
172
|
+
"is_charge_tax": item.is_charge_tax,
|
|
173
|
+
"note": (item === null || item === void 0 ? void 0 : item.note) || '',
|
|
174
|
+
"discountway": item._extend.discountway || "num",
|
|
175
|
+
"discount_per": item._extend.discount_per,
|
|
176
|
+
"discount_type": item._extend.discount_type || discount_type,
|
|
177
|
+
"order_detail_id": item._extend.order_detail_id || 0,
|
|
178
|
+
"product_bundle": formatProductBundle((_item$_extend2 = item._extend) === null || _item$_extend2 === void 0 ? void 0 : (_item$_extend2$other = _item$_extend2.other) === null || _item$_extend2$other === void 0 ? void 0 : _item$_extend2$other.bundle),
|
|
179
|
+
"bundle_edit": item._extend.bundle_edit
|
|
180
|
+
};
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* @title: 格式化跨日预约下的普通商品
|
|
185
|
+
* @description:
|
|
186
|
+
* @param {any} data
|
|
187
|
+
* @param {any} booking_item
|
|
188
|
+
* @return {*}
|
|
189
|
+
* @Author: WangHan
|
|
190
|
+
* @Date: 2024-12-07 14:48
|
|
191
|
+
*/
|
|
192
|
+
var formatDayRelationProducts = function formatDayRelationProducts(data, booking_item) {
|
|
193
|
+
var list = data.service.value;
|
|
194
|
+
|
|
195
|
+
// 过滤出卡片中的普通商品
|
|
196
|
+
var relation_products = list === null || list === void 0 ? void 0 : list.filter(function (item) {
|
|
197
|
+
var _item$_extend3;
|
|
198
|
+
var holderId = (_item$_extend3 = item._extend) === null || _item$_extend3 === void 0 ? void 0 : _item$_extend3.holder_id;
|
|
199
|
+
var bookingHolderId = booking_item._extend.holder_id;
|
|
200
|
+
var isAppointment = appointmentTypes.includes(item.extension_type);
|
|
201
|
+
return holderId && holderId === bookingHolderId && !isAppointment;
|
|
202
|
+
});
|
|
203
|
+
relation_products = relation_products.map(function (item) {
|
|
204
|
+
return formatProducts(item);
|
|
205
|
+
});
|
|
206
|
+
return relation_products || [];
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* @title: 格式化跨日预约商品列表
|
|
211
|
+
* @description:
|
|
212
|
+
* @param {any} data
|
|
213
|
+
* @return {*}
|
|
214
|
+
* @Author: WangHan
|
|
215
|
+
* @Date: 2024-12-17 11:06
|
|
216
|
+
*/
|
|
217
|
+
var formatAppointmentProductLists = function formatAppointmentProductLists(data) {
|
|
218
|
+
try {
|
|
219
|
+
var _Array$from;
|
|
220
|
+
var list = data.service.value;
|
|
221
|
+
|
|
222
|
+
// 找出预约商品
|
|
223
|
+
list = list.filter(function (item) {
|
|
224
|
+
var _item$_extend4;
|
|
225
|
+
return ((_item$_extend4 = item._extend) === null || _item$_extend4 === void 0 ? void 0 : _item$_extend4.holder_id) && appointmentTypes.includes(item.extension_type);
|
|
226
|
+
});
|
|
227
|
+
|
|
228
|
+
// 对预约商品列表根据holder_id进行分组
|
|
229
|
+
var groupMap = new Map();
|
|
230
|
+
list.forEach(function (item) {
|
|
231
|
+
var _item$_extend5;
|
|
232
|
+
var key = (_item$_extend5 = item._extend) === null || _item$_extend5 === void 0 ? void 0 : _item$_extend5.holder_id; // 分组键
|
|
233
|
+
if (!groupMap.has(key)) {
|
|
234
|
+
groupMap.set(key, []);
|
|
235
|
+
}
|
|
236
|
+
groupMap.get(key).push(item);
|
|
237
|
+
});
|
|
238
|
+
|
|
239
|
+
// 处理每个分组
|
|
240
|
+
groupMap.forEach(function (group) {
|
|
241
|
+
// 只给第一个数据增加 relation_products
|
|
242
|
+
group[0].relation_products = formatDayRelationProducts(data, group[0]);
|
|
243
|
+
});
|
|
244
|
+
|
|
245
|
+
// 将分组的结果还原为数组
|
|
246
|
+
var result = (_Array$from = Array.from(groupMap.values())) === null || _Array$from === void 0 ? void 0 : _Array$from.reduce(function (acc, group) {
|
|
247
|
+
return acc.concat(group);
|
|
248
|
+
}, []);
|
|
249
|
+
return result || [];
|
|
250
|
+
} catch (error) {}
|
|
251
|
+
};
|
|
252
|
+
|
|
120
253
|
/**
|
|
121
254
|
* @title: 预约商品信息
|
|
122
255
|
* @description:
|
|
@@ -125,42 +258,60 @@ var formatResource = function formatResource(service) {
|
|
|
125
258
|
* @Author: zhiwei.Wang
|
|
126
259
|
* @Date: 2024-02-19 09:26
|
|
127
260
|
*/
|
|
128
|
-
var formatBookings = function formatBookings(data) {
|
|
261
|
+
var formatBookings = function formatBookings(data, values) {
|
|
262
|
+
// 是否是跨日预约
|
|
263
|
+
var isDay = isDayBooking(data);
|
|
129
264
|
var list = data.service.value;
|
|
265
|
+
|
|
266
|
+
// 格式化跨日预约商品列表
|
|
267
|
+
if (isDay) {
|
|
268
|
+
list = formatAppointmentProductLists(data);
|
|
269
|
+
}
|
|
270
|
+
var dayParams = {
|
|
271
|
+
relation_products: []
|
|
272
|
+
};
|
|
130
273
|
var eventOtherParams = data.eventOtherParams;
|
|
131
274
|
var bookings = [];
|
|
275
|
+
console.log(list, 'wh_result11');
|
|
132
276
|
bookings = list.map(function (item) {
|
|
133
|
-
var _item$_extend, _item$_extend$other;
|
|
134
277
|
var start_date = item._extend.startDate.format('YYYY-MM-DD');
|
|
135
278
|
var end_date = item._extend.endDate.format('YYYY-MM-DD');
|
|
136
279
|
var end_time = item._extend.endDate.format("HH:mm");
|
|
137
280
|
var start_time = item._extend.startDate.format("HH:mm");
|
|
281
|
+
|
|
138
282
|
// 更新当前时间
|
|
139
283
|
if (isNowTime(item._extend.start_time)) {
|
|
140
284
|
start_time = getNowTime();
|
|
141
285
|
}
|
|
142
|
-
var total = Number(item._extend.total);
|
|
143
|
-
var origin_total = Number(item._extend.origin_total);
|
|
144
|
-
var discount_amount = origin_total - total;
|
|
145
286
|
|
|
146
|
-
//
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
287
|
+
// 跨日预约下的普通商品
|
|
288
|
+
if (isDay) {
|
|
289
|
+
var _item$_extend6, _item$_extend7, _item$_extend8, _item$_extend9;
|
|
290
|
+
var startDate = ((_item$_extend6 = item._extend) === null || _item$_extend6 === void 0 ? void 0 : _item$_extend6.startDate) || ((_item$_extend7 = item._extend) === null || _item$_extend7 === void 0 ? void 0 : _item$_extend7.start_date);
|
|
291
|
+
var endDate = ((_item$_extend8 = item._extend) === null || _item$_extend8 === void 0 ? void 0 : _item$_extend8.endDate) || ((_item$_extend9 = item._extend) === null || _item$_extend9 === void 0 ? void 0 : _item$_extend9.end_date);
|
|
292
|
+
var _formatDayTime = formatDayTime({
|
|
293
|
+
startDate: startDate,
|
|
294
|
+
endDate: endDate
|
|
295
|
+
}),
|
|
296
|
+
startDateTime = _formatDayTime.startDateTime,
|
|
297
|
+
endDateTime = _formatDayTime.endDateTime;
|
|
298
|
+
|
|
299
|
+
// 根据营业日时间更新时间
|
|
300
|
+
start_date = dayjs(startDateTime).format('YYYY-MM-DD');
|
|
301
|
+
start_time = dayjs(startDateTime).format('HH:mm');
|
|
302
|
+
end_date = dayjs(endDateTime).format('YYYY-MM-DD');
|
|
303
|
+
end_time = dayjs(endDateTime).format('HH:mm');
|
|
304
|
+
dayParams.relation_products = (item === null || item === void 0 ? void 0 : item.relation_products) || [];
|
|
305
|
+
dayParams.holder = formatHolders(data, item, values);
|
|
306
|
+
dayParams.duration = getDays({
|
|
307
|
+
_extend: {
|
|
308
|
+
start_date: startDateTime,
|
|
309
|
+
end_date: endDateTime
|
|
310
|
+
}
|
|
311
|
+
}, 'minutes');
|
|
312
|
+
}
|
|
313
|
+
return _objectSpread(_objectSpread({
|
|
314
|
+
"product": formatProducts(item),
|
|
164
315
|
"relation_products": formatRelationDetails(item._extend.relation_details),
|
|
165
316
|
'id': item.booking_id || 0,
|
|
166
317
|
"relation_id": item._extend.relation_id || 0,
|
|
@@ -169,12 +320,12 @@ var formatBookings = function formatBookings(data) {
|
|
|
169
320
|
"is_all": false,
|
|
170
321
|
"schedule_id": item._extend.schedule_id || 0,
|
|
171
322
|
"end_time": end_time,
|
|
172
|
-
"sub_type": getSubType(item),
|
|
323
|
+
"sub_type": isDay ? 'days' : getSubType(item),
|
|
173
324
|
"select_date": start_date,
|
|
174
325
|
"start_time": start_time,
|
|
175
326
|
"end_date": end_date,
|
|
176
327
|
"start_date": start_date,
|
|
177
|
-
"duration": flexibleObj.getValue(item._extend.duration),
|
|
328
|
+
"duration": isDay ? 0 : flexibleObj.getValue(item._extend.duration),
|
|
178
329
|
"number": item._extend.capacity ? getSumCapacity({
|
|
179
330
|
cacheItem: item
|
|
180
331
|
}) : item._extend.number || 1,
|
|
@@ -182,11 +333,34 @@ var formatBookings = function formatBookings(data) {
|
|
|
182
333
|
"metadata": item._extend.capacity ? {
|
|
183
334
|
capacity: item._extend.capacity
|
|
184
335
|
} : undefined
|
|
185
|
-
}, eventOtherParams || {});
|
|
336
|
+
}, eventOtherParams || {}), dayParams);
|
|
186
337
|
});
|
|
187
338
|
return bookings;
|
|
188
339
|
};
|
|
189
340
|
|
|
341
|
+
/**
|
|
342
|
+
* @title: 普通商品
|
|
343
|
+
* @description:
|
|
344
|
+
* @param {any} data
|
|
345
|
+
* @return {*}
|
|
346
|
+
* @Author: WangHan
|
|
347
|
+
* @Date: 2024-12-06 21:26
|
|
348
|
+
*/
|
|
349
|
+
var formatRelationProducts = function formatRelationProducts(data) {
|
|
350
|
+
var _data$service;
|
|
351
|
+
var list = ((_data$service = data.service) === null || _data$service === void 0 ? void 0 : _data$service.value) || [];
|
|
352
|
+
// open items 下的商品
|
|
353
|
+
list = list.filter(function (item) {
|
|
354
|
+
var _item$_extend10;
|
|
355
|
+
return !((_item$_extend10 = item._extend) !== null && _item$_extend10 !== void 0 && _item$_extend10.holder_id);
|
|
356
|
+
});
|
|
357
|
+
var relationProducts = [];
|
|
358
|
+
relationProducts = list.map(function (item) {
|
|
359
|
+
return formatProducts(item);
|
|
360
|
+
});
|
|
361
|
+
return relationProducts;
|
|
362
|
+
};
|
|
363
|
+
|
|
190
364
|
/**
|
|
191
365
|
* @title: 预约主体信息
|
|
192
366
|
* @description:
|
|
@@ -197,8 +371,8 @@ var formatBookings = function formatBookings(data) {
|
|
|
197
371
|
* @Date: 2024-02-19 09:26
|
|
198
372
|
*/
|
|
199
373
|
var formatHolder = function formatHolder(state, values) {
|
|
200
|
-
var _state$
|
|
201
|
-
var form_id = (state === null || state === void 0 ? void 0 : (_state$
|
|
374
|
+
var _state$bookingConfig2, _state$bookingConfig3, _state$bookingConfig4, _state$bookingConfig5, _state$pet$value, _state$pet, _state$pet$originValu, _state$pet$originValu2;
|
|
375
|
+
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;
|
|
202
376
|
var petValue = ((_state$pet$value = state.pet.value) === null || _state$pet$value === void 0 ? void 0 : _state$pet$value[form_id]) || [];
|
|
203
377
|
var obj = {
|
|
204
378
|
customer_id: values.customer_id,
|
|
@@ -230,9 +404,12 @@ export var formatValues = function formatValues(state) {
|
|
|
230
404
|
bookings: [],
|
|
231
405
|
customer_id: 1,
|
|
232
406
|
customer_name: "",
|
|
233
|
-
holder: {}
|
|
407
|
+
holder: {},
|
|
408
|
+
relation_products: [],
|
|
409
|
+
metadata: {}
|
|
234
410
|
};
|
|
235
|
-
|
|
411
|
+
var isDay = isDayBooking(state);
|
|
412
|
+
if (!state.bookingId || isDay) {
|
|
236
413
|
// 备注
|
|
237
414
|
values.shop_note = formatNote(state);
|
|
238
415
|
}
|
|
@@ -251,9 +428,13 @@ export var formatValues = function formatValues(state) {
|
|
|
251
428
|
|
|
252
429
|
// 主体
|
|
253
430
|
values.holder = formatHolder(state, values);
|
|
431
|
+
if (isDay) {
|
|
432
|
+
// 父预约商品
|
|
433
|
+
values.relation_products = formatRelationProducts(state);
|
|
434
|
+
}
|
|
254
435
|
|
|
255
436
|
// 服务
|
|
256
|
-
values.bookings = formatBookings(state);
|
|
437
|
+
values.bookings = formatBookings(state, values);
|
|
257
438
|
|
|
258
439
|
// 日期
|
|
259
440
|
if ((_values = values) !== null && _values !== void 0 && (_values$bookings = _values.bookings) !== null && _values$bookings !== void 0 && (_values$bookings$ = _values$bookings[0]) !== null && _values$bookings$ !== void 0 && _values$bookings$.select_date && !(state !== null && state !== void 0 && state.bookingId)) {
|
|
@@ -263,5 +444,10 @@ export var formatValues = function formatValues(state) {
|
|
|
263
444
|
startTime = "".concat(startTime || '00:00', ":00");
|
|
264
445
|
values.schedule_date = "".concat(values.bookings[0].select_date, " ").concat(startTime);
|
|
265
446
|
}
|
|
447
|
+
|
|
448
|
+
// 跨日预约增加多余参数区分
|
|
449
|
+
if (isDay) {
|
|
450
|
+
values.metadata.is_multiday_appointment = 1;
|
|
451
|
+
}
|
|
266
452
|
return values;
|
|
267
453
|
};
|
|
@@ -24,13 +24,20 @@ var AddServiceVariant = function AddServiceVariant(props) {
|
|
|
24
24
|
service: _objectSpread(_objectSpread({}, stateRef.current.service), payload)
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
|
+
|
|
28
|
+
// 更新日期
|
|
29
|
+
if (type === 'setDate') {
|
|
30
|
+
setGlobalState({
|
|
31
|
+
date: _objectSpread(_objectSpread({}, stateRef.current.date), payload)
|
|
32
|
+
});
|
|
33
|
+
}
|
|
27
34
|
};
|
|
28
35
|
var Cpt = AddService;
|
|
29
36
|
if (isBooking4Shop((_context$appHelper$ut = context.appHelper.utils.store) === null || _context$appHelper$ut === void 0 ? void 0 : (_context$appHelper$ut2 = _context$appHelper$ut.getState) === null || _context$appHelper$ut2 === void 0 ? void 0 : (_context$appHelper$ut3 = _context$appHelper$ut2.call(_context$appHelper$ut)) === null || _context$appHelper$ut3 === void 0 ? void 0 : (_context$appHelper$ut4 = _context$appHelper$ut3.global) === null || _context$appHelper$ut4 === void 0 ? void 0 : (_context$appHelper$ut5 = _context$appHelper$ut4.globalConfig) === null || _context$appHelper$ut5 === void 0 ? void 0 : _context$appHelper$ut5.id, props === null || props === void 0 ? void 0 : (_props$globalState = props.globalState) === null || _props$globalState === void 0 ? void 0 : _props$globalState.renderType)) {
|
|
30
37
|
Cpt = AddService2;
|
|
31
38
|
}
|
|
32
39
|
return /*#__PURE__*/React.createElement(Cpt, {
|
|
33
|
-
renderMode:
|
|
40
|
+
renderMode: 'current',
|
|
34
41
|
dispatch: dispatch,
|
|
35
42
|
state: globalState,
|
|
36
43
|
drawerProps: {
|
|
@@ -19,6 +19,7 @@ interface SelectDrawerProps {
|
|
|
19
19
|
modalOpen: boolean;
|
|
20
20
|
franchiseeLoading?: number;
|
|
21
21
|
showHeader?: boolean;
|
|
22
|
+
showWalkIn?: boolean;
|
|
22
23
|
}
|
|
23
24
|
declare const _default: React.ForwardRefExoticComponent<SelectDrawerProps & React.RefAttributes<unknown>>;
|
|
24
25
|
export default _default;
|
|
@@ -99,7 +99,8 @@ var SelectDrawer = function SelectDrawer(props, ref) {
|
|
|
99
99
|
handleAddPet = props.handleAddPet,
|
|
100
100
|
modalOpen = props.modalOpen,
|
|
101
101
|
franchiseeLoading = props.franchiseeLoading,
|
|
102
|
-
showHeader = props.showHeader
|
|
102
|
+
showHeader = props.showHeader,
|
|
103
|
+
showWalkIn = props.showWalkIn;
|
|
103
104
|
var form = (formData === null || formData === void 0 ? void 0 : formData[0]) || {};
|
|
104
105
|
var valList = (childrenValue === null || childrenValue === void 0 ? void 0 : childrenValue[form.id]) || defaultArr;
|
|
105
106
|
var _useState = useState(valList),
|
|
@@ -107,13 +108,6 @@ var SelectDrawer = function SelectDrawer(props, ref) {
|
|
|
107
108
|
_value = _useState2[0],
|
|
108
109
|
setValue = _useState2[1];
|
|
109
110
|
var clientRef = useRef();
|
|
110
|
-
useEffect(function () {
|
|
111
|
-
setValue(valList.map(function (item) {
|
|
112
|
-
return _objectSpread(_objectSpread({}, item), {}, {
|
|
113
|
-
id: item.id || item.form_record_id
|
|
114
|
-
});
|
|
115
|
-
}));
|
|
116
|
-
}, [valList]);
|
|
117
111
|
var searchRef = useRef();
|
|
118
112
|
|
|
119
113
|
// 是否打开弹窗
|
|
@@ -125,6 +119,13 @@ var SelectDrawer = function SelectDrawer(props, ref) {
|
|
|
125
119
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
126
120
|
search = _useState6[0],
|
|
127
121
|
_setSearch = _useState6[1];
|
|
122
|
+
useEffect(function () {
|
|
123
|
+
setValue(valList.map(function (item) {
|
|
124
|
+
return _objectSpread(_objectSpread({}, item), {}, {
|
|
125
|
+
id: item.id || item.form_record_id
|
|
126
|
+
});
|
|
127
|
+
}));
|
|
128
|
+
}, [valList, open]);
|
|
128
129
|
useEffect(function () {
|
|
129
130
|
if (!modalOpen) {
|
|
130
131
|
setOpen(false);
|
|
@@ -168,12 +169,12 @@ var SelectDrawer = function SelectDrawer(props, ref) {
|
|
|
168
169
|
if (getIsWalkIn(item === null || item === void 0 ? void 0 : item.id)) {
|
|
169
170
|
return locales.getText('pisell2.text.select-a-customer');
|
|
170
171
|
}
|
|
171
|
-
var firstLastName = item.first_name || item.last_name ? "".concat(item.first_name, " ").concat(item.last_name) :
|
|
172
|
+
var firstLastName = item.first_name || item.last_name ? "".concat(item.first_name, " ").concat(item.last_name) : '';
|
|
172
173
|
return item.name || (item.display_name || '').trim() || (item.nickname || '').trim() || firstLastName.trim() || '';
|
|
173
174
|
}, [locales.localeMap]);
|
|
174
175
|
var handleAddClient = function handleAddClient() {
|
|
175
176
|
handleCreateItem(function () {
|
|
176
|
-
_setSearch(
|
|
177
|
+
_setSearch('');
|
|
177
178
|
});
|
|
178
179
|
};
|
|
179
180
|
var handleChildrenValueChange = /*#__PURE__*/function () {
|
|
@@ -311,7 +312,7 @@ var SelectDrawer = function SelectDrawer(props, ref) {
|
|
|
311
312
|
}();
|
|
312
313
|
return /*#__PURE__*/React.createElement(Drawer, {
|
|
313
314
|
showGoBack: showHeader,
|
|
314
|
-
title: showHeader && locales.getText(
|
|
315
|
+
title: showHeader && locales.getText('pisell2.text.select-customer'),
|
|
315
316
|
open: open,
|
|
316
317
|
onClose: closeDrawer,
|
|
317
318
|
header: /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Input, {
|
|
@@ -351,13 +352,13 @@ var SelectDrawer = function SelectDrawer(props, ref) {
|
|
|
351
352
|
}, /*#__PURE__*/React.createElement(ActionItem, {
|
|
352
353
|
title: locales.getText('pisell2.text.create-new-customer'),
|
|
353
354
|
onClick: handleAddClient
|
|
354
|
-
}), /*#__PURE__*/React.createElement(ActionItem, {
|
|
355
|
+
}), showWalkIn ? /*#__PURE__*/React.createElement(ActionItem, {
|
|
355
356
|
title: "Walk-In",
|
|
356
357
|
onClick: function onClick() {
|
|
357
358
|
handleSelectClient([]);
|
|
358
359
|
closeDrawer();
|
|
359
360
|
}
|
|
360
|
-
})), /*#__PURE__*/React.createElement(Spin, {
|
|
361
|
+
}) : null), /*#__PURE__*/React.createElement(Spin, {
|
|
361
362
|
spinning: !!loading,
|
|
362
363
|
delay: 500
|
|
363
364
|
}, !!options.length ? options.map(function (item) {
|
|
@@ -32,14 +32,17 @@ import useEngineContext from "../../../../../hooks/useEngineContext";
|
|
|
32
32
|
import { formatAddFormValues } from "../../../forms/format";
|
|
33
33
|
import { moveItemToFront } from "../../utils";
|
|
34
34
|
import { request } from "../../../utils";
|
|
35
|
+
import { isDayBooking, isOpenDeletePet } from "../../service2/utils";
|
|
36
|
+
import ChangePetModal from "../../pet/ChangePetModal";
|
|
35
37
|
var VerticalClient = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
36
|
-
var _context$appHelper, _context$appHelper$ut, _context$appHelper$ut2, _context$appHelper$ut3, _state$bookingConfig2, _state$bookingConfig3, _state$bookingConfig8, _state$bookingConfig9, _state$bookingConfig10, _state$bookingConfig11, _state$pet3, _state$pet4, _state$pet6, _state$pet6$formData, _state$pet6$formData$, _state$pet8, _state$client$value4, _state$bookingConfig17, _state$bookingConfig18, _state$bookingConfig19, _state$pet9, _state$pet9$formData, _state$bookingConfig20, _state$bookingConfig21, _state$client$value5, _state$client$value6, _state$client$value7, _state$client$value8, _state$client$value9, _context$appHelper2, _context$appHelper2$u, _context$appHelper2$u2, _state$bookingConfig22, _state$client6;
|
|
38
|
+
var _context$appHelper, _context$appHelper$ut, _context$appHelper$ut2, _context$appHelper$ut3, _state$bookingConfig2, _state$bookingConfig3, _state$bookingConfig8, _state$bookingConfig9, _state$bookingConfig10, _state$bookingConfig11, _state$pet3, _state$pet4, _state$pet6, _state$pet6$formData, _state$pet6$formData$, _state$pet8, _state$client$value4, _state$bookingConfig17, _state$bookingConfig18, _state$bookingConfig19, _state$pet9, _state$pet9$formData, _state$bookingConfig20, _state$bookingConfig21, _state$service2, _state$client$value5, _state$client$value6, _state$client$value7, _state$client$value8, _state$client$value9, _context$appHelper2, _context$appHelper2$u, _context$appHelper2$u2, _state$bookingConfig22, _state$client6;
|
|
37
39
|
var globalState = props.globalState,
|
|
38
40
|
setGlobalState = props.setGlobalState;
|
|
39
41
|
var modalRef = useRef();
|
|
40
42
|
var state = globalState;
|
|
41
43
|
var stateRef = useRef(state);
|
|
42
44
|
var prevCustomerId = useRef(null);
|
|
45
|
+
var changePetRef = useRef(null);
|
|
43
46
|
var context = useEngineContext();
|
|
44
47
|
var _useState = useState(true),
|
|
45
48
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -93,6 +96,13 @@ var VerticalClient = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
93
96
|
pet: _objectSpread(_objectSpread({}, stateRef.current.pet), payload)
|
|
94
97
|
});
|
|
95
98
|
}
|
|
99
|
+
|
|
100
|
+
// 设置服务
|
|
101
|
+
if (type === 'setService') {
|
|
102
|
+
setGlobalState({
|
|
103
|
+
service: _objectSpread(_objectSpread({}, stateRef.current.service), payload)
|
|
104
|
+
});
|
|
105
|
+
}
|
|
96
106
|
};
|
|
97
107
|
var boardConfig = useMemo(function () {
|
|
98
108
|
var _state$bookingConfig, _state$bookingConfig$, _state$bookingConfig$2;
|
|
@@ -110,6 +120,21 @@ var VerticalClient = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
110
120
|
}
|
|
111
121
|
}, [state === null || state === void 0 ? void 0 : (_state$bookingConfig8 = state.bookingConfig) === null || _state$bookingConfig8 === void 0 ? void 0 : (_state$bookingConfig9 = _state$bookingConfig8.config) === null || _state$bookingConfig9 === void 0 ? void 0 : (_state$bookingConfig10 = _state$bookingConfig9.basic) === null || _state$bookingConfig10 === void 0 ? void 0 : (_state$bookingConfig11 = _state$bookingConfig10.appointment_customer) === null || _state$bookingConfig11 === void 0 ? void 0 : _state$bookingConfig11.type, state === null || state === void 0 ? void 0 : state.modalOpen]);
|
|
112
122
|
var handleSelectPet = function handleSelectPet(val) {
|
|
123
|
+
// 跨日预约,更改表单的时候打开弹窗提示
|
|
124
|
+
if (isDayBooking(state)) {
|
|
125
|
+
var _isOpenDeletePet = isOpenDeletePet(state, val),
|
|
126
|
+
ids = _isOpenDeletePet.ids,
|
|
127
|
+
lists = _isOpenDeletePet.lists;
|
|
128
|
+
if ((ids === null || ids === void 0 ? void 0 : ids.length) > 0 && (lists === null || lists === void 0 ? void 0 : lists.length) > 0) {
|
|
129
|
+
var _changePetRef$current, _state$service;
|
|
130
|
+
(_changePetRef$current = changePetRef.current) === null || _changePetRef$current === void 0 ? void 0 : _changePetRef$current.open({
|
|
131
|
+
ids: ids,
|
|
132
|
+
setGlobalState: setGlobalState,
|
|
133
|
+
service: ((_state$service = state.service) === null || _state$service === void 0 ? void 0 : _state$service.value) || [],
|
|
134
|
+
state: state
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
}
|
|
113
138
|
setGlobalState({
|
|
114
139
|
pet: _objectSpread(_objectSpread({}, state.pet), {}, {
|
|
115
140
|
edit: true,
|
|
@@ -246,7 +271,8 @@ var VerticalClient = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
246
271
|
}, [isWalkIn, formId, (_state$client$value4 = state.client.value) === null || _state$client$value4 === void 0 ? void 0 : _state$client$value4.id, currentPetValue, boardConfig]);
|
|
247
272
|
var petRender = useMemo(function () {
|
|
248
273
|
var _state$bookingConfig14, _state$bookingConfig15, _state$bookingConfig16;
|
|
249
|
-
|
|
274
|
+
// 跨日预约需要显示pet
|
|
275
|
+
if ((state !== null && state !== void 0 && state.disabledEdit || boardConfig.type !== 'form') && !isDayBooking(state)) {
|
|
250
276
|
return null;
|
|
251
277
|
}
|
|
252
278
|
return /*#__PURE__*/React.createElement(React.Fragment, null, !(currentPetValue !== null && currentPetValue !== void 0 && currentPetValue.length) && !isHasFormRecord && !isWalkIn && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Empty, {
|
|
@@ -291,7 +317,7 @@ var VerticalClient = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
291
317
|
},
|
|
292
318
|
previewItemTitleRender: previewItemTitleRender
|
|
293
319
|
}));
|
|
294
|
-
}, [isWalkIn, isHasFormRecord, state === null || state === void 0 ? void 0 : state.disabledEdit, boardConfig.type, state === null || state === void 0 ? void 0 : (_state$bookingConfig17 = state.bookingConfig) === null || _state$bookingConfig17 === void 0 ? void 0 : (_state$bookingConfig18 = _state$bookingConfig17.holder) === null || _state$bookingConfig18 === void 0 ? void 0 : (_state$bookingConfig19 = _state$bookingConfig18.form) === null || _state$bookingConfig19 === void 0 ? void 0 : _state$bookingConfig19.title, (_state$pet9 = state.pet) === null || _state$pet9 === void 0 ? void 0 : (_state$pet9$formData = _state$pet9.formData) === null || _state$pet9$formData === void 0 ? void 0 : _state$pet9$formData[0], state, petDispatch, handleOpenModal, handleOpenClientModal, previewItemTitleRender, handleAddPet, currentPetValue, formId, state === null || state === void 0 ? void 0 : (_state$bookingConfig20 = state.bookingConfig) === null || _state$bookingConfig20 === void 0 ? void 0 : (_state$bookingConfig21 = _state$bookingConfig20.holder) === null || _state$bookingConfig21 === void 0 ? void 0 : _state$bookingConfig21.data_range]);
|
|
320
|
+
}, [isWalkIn, isHasFormRecord, state === null || state === void 0 ? void 0 : state.disabledEdit, boardConfig.type, state === null || state === void 0 ? void 0 : (_state$bookingConfig17 = state.bookingConfig) === null || _state$bookingConfig17 === void 0 ? void 0 : (_state$bookingConfig18 = _state$bookingConfig17.holder) === null || _state$bookingConfig18 === void 0 ? void 0 : (_state$bookingConfig19 = _state$bookingConfig18.form) === null || _state$bookingConfig19 === void 0 ? void 0 : _state$bookingConfig19.title, (_state$pet9 = state.pet) === null || _state$pet9 === void 0 ? void 0 : (_state$pet9$formData = _state$pet9.formData) === null || _state$pet9$formData === void 0 ? void 0 : _state$pet9$formData[0], state, petDispatch, handleOpenModal, handleOpenClientModal, previewItemTitleRender, handleAddPet, currentPetValue, formId, state === null || state === void 0 ? void 0 : (_state$bookingConfig20 = state.bookingConfig) === null || _state$bookingConfig20 === void 0 ? void 0 : (_state$bookingConfig21 = _state$bookingConfig20.holder) === null || _state$bookingConfig21 === void 0 ? void 0 : _state$bookingConfig21.data_range, (_state$service2 = state.service) === null || _state$service2 === void 0 ? void 0 : _state$service2.value]);
|
|
295
321
|
var handleOpenClient = function handleOpenClient() {
|
|
296
322
|
if (!isWalkIn || state !== null && state !== void 0 && state.disableEventBookingEdit) {
|
|
297
323
|
return;
|
|
@@ -386,7 +412,10 @@ var VerticalClient = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
386
412
|
loadMore: loadMore,
|
|
387
413
|
showPet: (boardConfig === null || boardConfig === void 0 ? void 0 : boardConfig.type) === 'form',
|
|
388
414
|
handleAddPet: handleAddPet,
|
|
389
|
-
franchiseeLoading: franchiseeLoading
|
|
415
|
+
franchiseeLoading: franchiseeLoading,
|
|
416
|
+
showWalkIn: !isDayBooking(state)
|
|
417
|
+
}), /*#__PURE__*/React.createElement(ChangePetModal, {
|
|
418
|
+
ref: changePetRef
|
|
390
419
|
}));
|
|
391
420
|
});
|
|
392
421
|
export default VerticalClient;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
4
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
5
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
6
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
+
import React, { useEffect, useMemo, useState } from 'react';
|
|
8
|
+
import { CalendarOutlined } from '@ant-design/icons';
|
|
9
|
+
import classNames from 'classnames';
|
|
10
|
+
import dayjs from 'dayjs';
|
|
11
|
+
import { DatePicker, Page } from '@pisell/materials';
|
|
12
|
+
import "./index.less";
|
|
13
|
+
|
|
14
|
+
// 禁用之前的日期
|
|
15
|
+
export var disabledDate = function disabledDate(current, position, currentDate) {
|
|
16
|
+
if (position === 'start') {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
if (position === 'end' && current.endOf('day') && currentDate !== null && currentDate !== void 0 && currentDate[0]) {
|
|
20
|
+
// 结束日期最大 = 开始日期 + 8个月
|
|
21
|
+
var endDisabled = currentDate === null || currentDate === void 0 ? void 0 : currentDate[0].add(8, 'months').format('YYYY-MM-DD');
|
|
22
|
+
return dayjs(endDisabled) < current.startOf('day') || current.startOf('day') <= (currentDate === null || currentDate === void 0 ? void 0 : currentDate[0]);
|
|
23
|
+
}
|
|
24
|
+
return current && current <= (currentDate === null || currentDate === void 0 ? void 0 : currentDate[0]);
|
|
25
|
+
};
|
|
26
|
+
var DateRange = function DateRange(_ref) {
|
|
27
|
+
var state = _ref.state,
|
|
28
|
+
dispatch = _ref.dispatch,
|
|
29
|
+
key = _ref.key;
|
|
30
|
+
var _useState = useState([]),
|
|
31
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
32
|
+
value = _useState2[0],
|
|
33
|
+
setValue = _useState2[1];
|
|
34
|
+
useEffect(function () {
|
|
35
|
+
var _state$date, _state$date2;
|
|
36
|
+
var lists = [(_state$date = state.date) === null || _state$date === void 0 ? void 0 : _state$date.value, (_state$date2 = state.date) === null || _state$date2 === void 0 ? void 0 : _state$date2.end_date];
|
|
37
|
+
setValue(lists);
|
|
38
|
+
console.log('lists', lists);
|
|
39
|
+
}, [state.date]);
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* @title: 点击确定
|
|
43
|
+
* @description:
|
|
44
|
+
* @param {any} e
|
|
45
|
+
* @return {*}
|
|
46
|
+
* @Author: WangHan
|
|
47
|
+
* @Date: 2024-12-12 15:39
|
|
48
|
+
*/
|
|
49
|
+
var dateChange = function dateChange(e) {
|
|
50
|
+
dispatch({
|
|
51
|
+
type: 'setDate',
|
|
52
|
+
payload: {
|
|
53
|
+
value: e[0],
|
|
54
|
+
end_date: e[1],
|
|
55
|
+
edit: true
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* @title: 格式化语言
|
|
62
|
+
* @description:
|
|
63
|
+
* @param {*} useMemo
|
|
64
|
+
* @return {*}
|
|
65
|
+
* @Author: WangHan
|
|
66
|
+
* @Date: 2024-12-09 17:47
|
|
67
|
+
*/
|
|
68
|
+
var formatLocale = useMemo(function () {
|
|
69
|
+
var locale = state === null || state === void 0 ? void 0 : state.locale;
|
|
70
|
+
var isEn = locale === 'en' || locale === 'en-US';
|
|
71
|
+
var _format = isEn ? 'DD/MM/YYYY' : 'YYYY-MM-DD';
|
|
72
|
+
return _format;
|
|
73
|
+
}, [state === null || state === void 0 ? void 0 : state.locale, state.date]);
|
|
74
|
+
return useMemo(function () {
|
|
75
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
76
|
+
className: classNames('pisell-lowcode__booking-service-header-date-range', {
|
|
77
|
+
'pisell-lowcode__booking-service-header-date-range-terminal': state.isTerminalDayBookingPage
|
|
78
|
+
})
|
|
79
|
+
}, /*#__PURE__*/React.createElement(Page, null, /*#__PURE__*/React.createElement(DatePicker.RangePicker, {
|
|
80
|
+
key: key,
|
|
81
|
+
inputReadOnly: true,
|
|
82
|
+
allowClear: false,
|
|
83
|
+
size: "large",
|
|
84
|
+
style: {
|
|
85
|
+
width: '100%',
|
|
86
|
+
padding: 0
|
|
87
|
+
},
|
|
88
|
+
suffixIcon: !state.disabledEdit ? /*#__PURE__*/React.createElement(CalendarOutlined, null) : null,
|
|
89
|
+
disabledDate: disabledDate,
|
|
90
|
+
value: [value[0], value[1]],
|
|
91
|
+
onChange: dateChange,
|
|
92
|
+
format: formatLocale,
|
|
93
|
+
isHideCustomSelect: true,
|
|
94
|
+
endDateDays: 1
|
|
95
|
+
}))));
|
|
96
|
+
}, [value, state.disabledEdit, state === null || state === void 0 ? void 0 : state.locale]);
|
|
97
|
+
};
|
|
98
|
+
export default DateRange;
|