@pisell/private-materials 3.3.43 → 3.3.44
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/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/meta.js +1 -1
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +5 -5
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +5 -5
- package/es/businessModel/SalesModel/index.d.ts +0 -1
- package/es/components/Sales/Summary/utils.d.ts +1 -1
- package/es/components/appointmentBooking/components/Cart/ContinueButton/index.js +4 -25
- package/es/components/appointmentBooking/components/Cart/Item/Total.d.ts +0 -1
- package/es/components/appointmentBooking/components/Cart/Item/index.js +31 -16
- package/es/components/appointmentBooking/components/Cart/index.d.ts +0 -1
- package/es/components/appointmentBooking/components/Content/index.js +39 -20
- package/es/components/appointmentBooking/components/Date/index.js +2 -13
- package/es/components/appointmentBooking/components/Deposit/index.d.ts +0 -1
- package/es/components/appointmentBooking/components/Footer/index.d.ts +0 -1
- package/es/components/appointmentBooking/components/Form/index.js +76 -167
- package/es/components/appointmentBooking/components/Form/utils.d.ts +8 -0
- package/es/components/appointmentBooking/components/Form/utils.js +36 -0
- package/es/components/appointmentBooking/components/Guest/components/InformationOptionsModal/index.d.ts +0 -1
- package/es/components/appointmentBooking/components/Header/index.js +78 -46
- package/es/components/appointmentBooking/components/Resource/index.js +92 -115
- package/es/components/appointmentBooking/components/Services/index.js +19 -4
- package/es/components/appointmentBooking/components/TimeSlicing/index.js +20 -27
- package/es/components/appointmentBooking/components/Voucher/index.d.ts +0 -1
- package/es/components/appointmentBooking/context.js +50 -3
- package/es/components/appointmentBooking/deposit/index.d.ts +0 -1
- package/es/components/appointmentBooking/hooks.d.ts +1 -2
- package/es/components/appointmentBooking/hooks.js +377 -269
- package/es/components/appointmentBooking/utils.d.ts +91 -2
- package/es/components/appointmentBooking/utils.js +350 -61
- package/es/components/booking/components/footer/amount.d.ts +24 -0
- package/es/components/booking/forms/sendModal/useSendModal.d.ts +0 -1
- package/es/components/booking/hooks/useClearCart.d.ts +0 -1
- package/es/components/booking/info/dateRange/index.d.ts +0 -1
- package/es/components/booking/info/service/Lists.d.ts +0 -1
- package/es/components/booking/info/service/addService/index.d.ts +11 -0
- package/es/components/booking/info/service/editService/BookingList/index.d.ts +0 -1
- package/es/components/booking/info/service/serviceItem/index.d.ts +0 -1
- package/es/components/booking/info/service/serviceList/index.d.ts +0 -1
- package/es/components/booking/info/service2/Lists.d.ts +0 -1
- package/es/components/booking/info/service2/utils.d.ts +244 -0
- package/es/components/booking/info/utils.d.ts +50 -0
- package/es/components/booking/info2/service/addService/index.d.ts +12 -0
- package/es/components/booking/info2/service/editService/index.d.ts +7 -0
- package/es/components/booking/info2/service/serviceItem/index.d.ts +0 -1
- package/es/components/booking/info2/service/serviceList/index.d.ts +0 -1
- package/es/components/booking/utils.d.ts +172 -0
- package/es/components/eftposPay/amount.d.ts +1 -1
- package/es/components/eftposPay/component/fail/failCustom.d.ts +1 -0
- package/es/components/eftposPay/component/fail/index.d.ts +1 -0
- package/es/components/eftposPay/component/fail/unknow.d.ts +1 -0
- package/es/components/eftposPay/device.d.ts +1 -1
- package/es/components/eftposPay/hooks.d.ts +1 -1
- package/es/components/eftposPay/index.d.ts +1 -0
- package/es/components/eftposPay/pay.d.ts +1 -0
- package/es/components/eftposPay/store/index.d.ts +2 -2
- package/es/components/eftposPay/windcave/windcave.d.ts +1 -0
- package/es/components/eventBooking/components/ErrorTip/index.d.ts +0 -1
- package/es/components/eventBooking/components/Provider/Cart/Item/Total.d.ts +0 -1
- package/es/components/eventBooking/components/Provider/Cart/Item/index.d.ts +0 -1
- package/es/components/eventBooking/components/Provider/Cart/index.d.ts +0 -1
- package/es/components/eventBooking/components/Provider/Content/index.d.ts +0 -1
- package/es/components/eventBooking/components/Provider/EmptyHolderModal/index.d.ts +0 -1
- package/es/components/eventBooking/components/Provider/Event/index.d.ts +0 -1
- package/es/components/eventBooking/components/Provider/Footer/index.d.ts +0 -1
- package/es/components/eventBooking/components/Provider/Header/index.d.ts +0 -1
- package/es/components/eventBooking/components/Provider/InformationOptionsModal/index.d.ts +0 -1
- package/es/components/eventBooking/components/Provider/OrderProductModal/index.d.ts +0 -1
- package/es/components/eventBooking/components/Provider/RemoveOptionConfirmModal.d.ts +0 -1
- package/es/components/eventBooking/components/Provider/Resource/index.d.ts +0 -1
- package/es/components/eventBooking/components/Provider/SelectHolderModal.d.ts +0 -1
- package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/CallToBook/index.d.ts +0 -1
- package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/WeekItem/index.d.ts +0 -1
- package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/index.d.ts +0 -1
- package/es/components/eventBooking/components/bookingDetailModal/components/BookingOptions.d.ts +0 -1
- package/es/components/eventBooking/components/bookingDetailModal/components/Resource.d.ts +0 -1
- package/es/components/eventBooking/components/bookingDetailModal/components/Schedule.d.ts +0 -1
- package/es/components/eventBooking/components/scheduleCalendar/calendarItem.d.ts +0 -1
- package/es/components/eventBooking/components/scheduleCalendar/components/ScheduleTimeItem/index.d.ts +0 -1
- package/es/components/eventBooking/index.d.ts +0 -1
- package/es/components/pay/toC/PaymentMethods/StripePay/Stripe/components/SetupForm/index.d.ts +0 -1
- package/es/components/pay/toC/PaymentMethods/StripePay/Stripe/index.d.ts +0 -1
- package/es/components/pay/toC/WalletPassBlock/components/WalletUseList/index.d.ts +0 -1
- package/es/components/pisellSelectCustomerModal/RightPanel/Add/PhoneField/index.d.ts +0 -1
- package/es/components/pisellSelectCustomerModal/RightPanel/Add/index.d.ts +0 -1
- package/es/components/pisellSelectCustomerModal/RightPanel/List/index.d.ts +0 -1
- package/es/components/pisellSelectCustomerModal/RightPanel/index.d.ts +0 -1
- package/es/components/pisellSelectCustomerModal/index.d.ts +0 -1
- package/es/components/productExtension/fields/Actor/index.d.ts +0 -1
- package/es/components/productExtension/fields/SelectProducts/index.d.ts +0 -1
- package/es/components/productExtension/fields/SelectResourcesTable/index.d.ts +0 -1
- package/es/components/productExtension/index.d.ts +0 -1
- package/es/components/productSelect/components/TabProduct/index.d.ts +0 -1
- package/es/components/productSelect/components/productGroup/index.d.ts +11 -7
- package/es/components/productSelect/components/productGroup/index.js +32 -19
- package/es/components/productSelect/components/productGroup/index.less +17 -3
- package/es/components/productSelect/index.d.ts +3 -2
- package/es/components/productSelect/index.js +20 -6
- package/es/components/productSelect/index.less +7 -0
- package/es/components/shoppingCart/components/Cart/index.d.ts +0 -1
- package/es/components/shoppingCart/components/Empty/index.d.ts +0 -1
- package/es/components/shoppingCart/components/Render/index.d.ts +0 -1
- package/es/components/shoppingCart/hooks/useAddService.d.ts +0 -1
- package/es/components/shoppingCart/hooks/useClearCart.d.ts +0 -1
- package/es/components/shoppingCart/index.d.ts +0 -1
- package/es/components/ticketBooking/components/addServiceVariant/addService.d.ts +9 -0
- package/es/components/ticketBooking/components/addServiceVariant/addService.js +11 -3
- package/es/components/ticketBooking/components/timeBar/index.d.ts +0 -1
- package/es/components/ticketBooking/utils/index.d.ts +14 -0
- package/es/components/wallet/hooks/useWalletCard.d.ts +0 -1
- package/es/components/workSpaceList/components/Modal/index.d.ts +0 -1
- package/lib/businessModel/SalesModel/index.d.ts +0 -1
- package/lib/components/Sales/Summary/utils.d.ts +1 -1
- package/lib/components/appointmentBooking/components/Cart/ContinueButton/index.js +0 -5
- package/lib/components/appointmentBooking/components/Cart/Item/Total.d.ts +0 -1
- package/lib/components/appointmentBooking/components/Cart/Item/index.js +35 -16
- package/lib/components/appointmentBooking/components/Cart/index.d.ts +0 -1
- package/lib/components/appointmentBooking/components/Content/index.js +37 -21
- package/lib/components/appointmentBooking/components/Date/index.js +0 -6
- package/lib/components/appointmentBooking/components/Deposit/index.d.ts +0 -1
- package/lib/components/appointmentBooking/components/Footer/index.d.ts +0 -1
- package/lib/components/appointmentBooking/components/Form/index.js +56 -108
- package/lib/components/appointmentBooking/components/Form/utils.d.ts +8 -0
- package/lib/components/appointmentBooking/components/Form/utils.js +49 -0
- package/lib/components/appointmentBooking/components/Guest/components/InformationOptionsModal/index.d.ts +0 -1
- package/lib/components/appointmentBooking/components/Header/index.js +49 -19
- package/lib/components/appointmentBooking/components/Resource/index.js +51 -69
- package/lib/components/appointmentBooking/components/Services/index.js +16 -3
- package/lib/components/appointmentBooking/components/TimeSlicing/index.js +1 -7
- package/lib/components/appointmentBooking/components/Voucher/index.d.ts +0 -1
- package/lib/components/appointmentBooking/context.js +52 -4
- package/lib/components/appointmentBooking/deposit/index.d.ts +0 -1
- package/lib/components/appointmentBooking/hooks.d.ts +1 -2
- package/lib/components/appointmentBooking/hooks.js +153 -57
- package/lib/components/appointmentBooking/utils.d.ts +91 -2
- package/lib/components/appointmentBooking/utils.js +210 -50
- package/lib/components/booking/components/footer/amount.d.ts +24 -0
- package/lib/components/booking/forms/sendModal/useSendModal.d.ts +0 -1
- package/lib/components/booking/hooks/useClearCart.d.ts +0 -1
- package/lib/components/booking/info/dateRange/index.d.ts +0 -1
- package/lib/components/booking/info/service/Lists.d.ts +0 -1
- package/lib/components/booking/info/service/addService/index.d.ts +11 -0
- package/lib/components/booking/info/service/editService/BookingList/index.d.ts +0 -1
- package/lib/components/booking/info/service/serviceItem/index.d.ts +0 -1
- package/lib/components/booking/info/service/serviceList/index.d.ts +0 -1
- package/lib/components/booking/info/service2/Lists.d.ts +0 -1
- package/lib/components/booking/info/service2/utils.d.ts +244 -0
- package/lib/components/booking/info/utils.d.ts +50 -0
- package/lib/components/booking/info2/service/addService/index.d.ts +12 -0
- package/lib/components/booking/info2/service/editService/index.d.ts +7 -0
- package/lib/components/booking/info2/service/serviceItem/index.d.ts +0 -1
- package/lib/components/booking/info2/service/serviceList/index.d.ts +0 -1
- package/lib/components/booking/utils.d.ts +172 -0
- package/lib/components/eftposPay/amount.d.ts +1 -1
- package/lib/components/eftposPay/component/fail/failCustom.d.ts +1 -0
- package/lib/components/eftposPay/component/fail/index.d.ts +1 -0
- package/lib/components/eftposPay/component/fail/unknow.d.ts +1 -0
- package/lib/components/eftposPay/device.d.ts +1 -1
- package/lib/components/eftposPay/hooks.d.ts +1 -1
- package/lib/components/eftposPay/index.d.ts +1 -0
- package/lib/components/eftposPay/pay.d.ts +1 -0
- package/lib/components/eftposPay/store/index.d.ts +2 -2
- package/lib/components/eftposPay/windcave/windcave.d.ts +1 -0
- package/lib/components/eventBooking/components/ErrorTip/index.d.ts +0 -1
- package/lib/components/eventBooking/components/Provider/Cart/Item/Total.d.ts +0 -1
- package/lib/components/eventBooking/components/Provider/Cart/Item/index.d.ts +0 -1
- package/lib/components/eventBooking/components/Provider/Cart/index.d.ts +0 -1
- package/lib/components/eventBooking/components/Provider/Content/index.d.ts +0 -1
- package/lib/components/eventBooking/components/Provider/EmptyHolderModal/index.d.ts +0 -1
- package/lib/components/eventBooking/components/Provider/Event/index.d.ts +0 -1
- package/lib/components/eventBooking/components/Provider/Footer/index.d.ts +0 -1
- package/lib/components/eventBooking/components/Provider/Header/index.d.ts +0 -1
- package/lib/components/eventBooking/components/Provider/InformationOptionsModal/index.d.ts +0 -1
- package/lib/components/eventBooking/components/Provider/OrderProductModal/index.d.ts +0 -1
- package/lib/components/eventBooking/components/Provider/RemoveOptionConfirmModal.d.ts +0 -1
- package/lib/components/eventBooking/components/Provider/Resource/index.d.ts +0 -1
- package/lib/components/eventBooking/components/Provider/SelectHolderModal.d.ts +0 -1
- package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/CallToBook/index.d.ts +0 -1
- package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/WeekItem/index.d.ts +0 -1
- package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/index.d.ts +0 -1
- package/lib/components/eventBooking/components/bookingDetailModal/components/BookingOptions.d.ts +0 -1
- package/lib/components/eventBooking/components/bookingDetailModal/components/Resource.d.ts +0 -1
- package/lib/components/eventBooking/components/bookingDetailModal/components/Schedule.d.ts +0 -1
- package/lib/components/eventBooking/components/scheduleCalendar/calendarItem.d.ts +0 -1
- package/lib/components/eventBooking/components/scheduleCalendar/components/ScheduleTimeItem/index.d.ts +0 -1
- package/lib/components/eventBooking/index.d.ts +0 -1
- package/lib/components/pay/toC/PaymentMethods/StripePay/Stripe/components/SetupForm/index.d.ts +0 -1
- package/lib/components/pay/toC/PaymentMethods/StripePay/Stripe/index.d.ts +0 -1
- package/lib/components/pay/toC/WalletPassBlock/components/WalletUseList/index.d.ts +0 -1
- package/lib/components/pisellSelectCustomerModal/RightPanel/Add/PhoneField/index.d.ts +0 -1
- package/lib/components/pisellSelectCustomerModal/RightPanel/Add/index.d.ts +0 -1
- package/lib/components/pisellSelectCustomerModal/RightPanel/List/index.d.ts +0 -1
- package/lib/components/pisellSelectCustomerModal/RightPanel/index.d.ts +0 -1
- package/lib/components/pisellSelectCustomerModal/index.d.ts +0 -1
- package/lib/components/productExtension/fields/Actor/index.d.ts +0 -1
- package/lib/components/productExtension/fields/SelectProducts/index.d.ts +0 -1
- package/lib/components/productExtension/fields/SelectResourcesTable/index.d.ts +0 -1
- package/lib/components/productExtension/index.d.ts +0 -1
- package/lib/components/productSelect/components/TabProduct/index.d.ts +0 -1
- package/lib/components/productSelect/components/productGroup/index.d.ts +11 -7
- package/lib/components/productSelect/components/productGroup/index.js +12 -10
- package/lib/components/productSelect/components/productGroup/index.less +17 -3
- package/lib/components/productSelect/index.d.ts +3 -2
- package/lib/components/productSelect/index.js +17 -3
- package/lib/components/productSelect/index.less +7 -0
- package/lib/components/shoppingCart/components/Cart/index.d.ts +0 -1
- package/lib/components/shoppingCart/components/Empty/index.d.ts +0 -1
- package/lib/components/shoppingCart/components/Render/index.d.ts +0 -1
- package/lib/components/shoppingCart/hooks/useAddService.d.ts +0 -1
- package/lib/components/shoppingCart/hooks/useClearCart.d.ts +0 -1
- package/lib/components/shoppingCart/index.d.ts +0 -1
- package/lib/components/ticketBooking/components/addServiceVariant/addService.d.ts +9 -0
- package/lib/components/ticketBooking/components/addServiceVariant/addService.js +9 -1
- package/lib/components/ticketBooking/components/timeBar/index.d.ts +0 -1
- package/lib/components/ticketBooking/utils/index.d.ts +14 -0
- package/lib/components/wallet/hooks/useWalletCard.d.ts +0 -1
- package/lib/components/workSpaceList/components/Modal/index.d.ts +0 -1
- package/lowcode/product-select/meta.ts +18 -34
- package/package.json +2 -2
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @title: 更新表单数据
|
|
3
|
+
* @description:
|
|
4
|
+
* @return {*}
|
|
5
|
+
* @Author: WangHan
|
|
6
|
+
* @Date: 2025-05-26 16:58
|
|
7
|
+
*/
|
|
8
|
+
export var updateRelationForms = function updateRelationForms(carts, currentCart, values) {
|
|
9
|
+
var _cartItem$_origin;
|
|
10
|
+
if (!(currentCart !== null && currentCart !== void 0 && currentCart.cart_id)) return [];
|
|
11
|
+
var cartItem = carts === null || carts === void 0 ? void 0 : carts.find(function (item) {
|
|
12
|
+
return (item === null || item === void 0 ? void 0 : item._id) === (currentCart === null || currentCart === void 0 ? void 0 : currentCart.cart_id);
|
|
13
|
+
});
|
|
14
|
+
var oldLists = (cartItem === null || cartItem === void 0 || (_cartItem$_origin = cartItem._origin) === null || _cartItem$_origin === void 0 ? void 0 : _cartItem$_origin.relation_forms) || [];
|
|
15
|
+
var newData = {
|
|
16
|
+
form_id: Number(values === null || values === void 0 ? void 0 : values.form_id),
|
|
17
|
+
form_record_id: values === null || values === void 0 ? void 0 : values.form_record_id
|
|
18
|
+
};
|
|
19
|
+
var exist = oldLists.find(function (item) {
|
|
20
|
+
return item.form_id === (newData === null || newData === void 0 ? void 0 : newData.form_id);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
// 如果在目前的数组中找到form_id相同的,则更新form_record_ids参数,否则新增一条数据
|
|
24
|
+
if (exist) {
|
|
25
|
+
var _exist$form_record_id;
|
|
26
|
+
if (!(exist !== null && exist !== void 0 && (_exist$form_record_id = exist.form_record_ids) !== null && _exist$form_record_id !== void 0 && _exist$form_record_id.includes(newData.form_record_id))) {
|
|
27
|
+
exist.form_record_ids.push(newData.form_record_id);
|
|
28
|
+
}
|
|
29
|
+
} else {
|
|
30
|
+
oldLists.push({
|
|
31
|
+
form_id: newData.form_id,
|
|
32
|
+
form_record_ids: [newData.form_record_id]
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
return oldLists;
|
|
36
|
+
};
|
|
@@ -1,34 +1,41 @@
|
|
|
1
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
2
|
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
3
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
|
+
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; }
|
|
6
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
7
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
3
8
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
4
9
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
5
10
|
import React, { useMemo } from 'react';
|
|
6
11
|
import { locales } from '@pisell/utils';
|
|
7
12
|
import ProgressBar from "../../../eventBooking/components/progressBar";
|
|
8
13
|
import { useAppointmentBookingContext } from "../../context";
|
|
9
|
-
import { useShopDiscount,
|
|
14
|
+
import { useShopDiscount, useAppointmentBookingStep, useAppointmentBookingSetting, useAppointmentBookingProduct, contextUtils } from "../../hooks";
|
|
10
15
|
import useEngineContext from "../../../../hooks/useEngineContext";
|
|
16
|
+
import { getResourceTitle } from "../../utils";
|
|
11
17
|
import "./index.less";
|
|
12
18
|
var Header = function Header() {
|
|
13
19
|
var _currentStep$step3;
|
|
14
|
-
var
|
|
15
|
-
currentStep =
|
|
16
|
-
appointmentBooking =
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
+
var _ref = useAppointmentBookingContext(),
|
|
21
|
+
currentStep = _ref.currentStep,
|
|
22
|
+
appointmentBooking = _ref.appointmentBooking,
|
|
23
|
+
setTimes = _ref.setTimes,
|
|
24
|
+
carts = _ref.carts,
|
|
25
|
+
currentStepParams = _ref.currentStepParams,
|
|
26
|
+
currentSelectedResources = _ref.currentSelectedResources;
|
|
20
27
|
var shopDiscount = useShopDiscount();
|
|
21
28
|
var context = useEngineContext();
|
|
22
|
-
var
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
var _useAppointmentBookin = useAppointmentBookingStep(),
|
|
30
|
+
stepList = _useAppointmentBookin.stepList,
|
|
31
|
+
updateStep = _useAppointmentBookin.updateStep,
|
|
32
|
+
removeStep = _useAppointmentBookin.removeStep;
|
|
33
|
+
var _useAppointmentBookin2 = useAppointmentBookingSetting(),
|
|
34
|
+
setOtherData = _useAppointmentBookin2.setOtherData,
|
|
35
|
+
getOtherData = _useAppointmentBookin2.getOtherData;
|
|
36
|
+
var _useAppointmentBookin3 = useAppointmentBookingProduct(),
|
|
37
|
+
checkProductType = _useAppointmentBookin3.checkProductType;
|
|
38
|
+
var utils = contextUtils();
|
|
32
39
|
|
|
33
40
|
/**
|
|
34
41
|
* @title: 获取资源名称
|
|
@@ -44,13 +51,15 @@ var Header = function Header() {
|
|
|
44
51
|
if (!key) return '';
|
|
45
52
|
|
|
46
53
|
// 选择资源则获取资源列表的第一个名称
|
|
47
|
-
if (key
|
|
48
|
-
var
|
|
49
|
-
var
|
|
54
|
+
if (key.startsWith('select-resource')) {
|
|
55
|
+
var _currentSelectedResou;
|
|
56
|
+
var currentResource = currentSelectedResources === null || currentSelectedResources === void 0 || (_currentSelectedResou = currentSelectedResources[0]) === null || _currentSelectedResou === void 0 ? void 0 : _currentSelectedResou.currentSelectedResource;
|
|
57
|
+
var resourceItem = (currentResource === null || currentResource === void 0 ? void 0 : currentResource.resourceItem) || {};
|
|
58
|
+
var name = getResourceTitle(appointmentBooking, resourceItem === null || resourceItem === void 0 ? void 0 : resourceItem.code, utils, resourceItem);
|
|
50
59
|
return locales.getText('pisell2.event.select.category')(name);
|
|
51
60
|
}
|
|
52
61
|
return (currentStep === null || currentStep === void 0 || (_currentStep$step2 = currentStep.step) === null || _currentStep$step2 === void 0 ? void 0 : _currentStep$step2.description) || '';
|
|
53
|
-
}, [currentStep === null || currentStep === void 0 || (_currentStep$step3 = currentStep.step) === null || _currentStep$step3 === void 0 ? void 0 : _currentStep$step3.key,
|
|
62
|
+
}, [currentStep === null || currentStep === void 0 || (_currentStep$step3 = currentStep.step) === null || _currentStep$step3 === void 0 ? void 0 : _currentStep$step3.key, currentSelectedResources]);
|
|
54
63
|
|
|
55
64
|
/**
|
|
56
65
|
* @title: 返回
|
|
@@ -60,9 +69,9 @@ var Header = function Header() {
|
|
|
60
69
|
* @Date: 2025-01-18 22:28
|
|
61
70
|
*/
|
|
62
71
|
var handleBack = /*#__PURE__*/function () {
|
|
63
|
-
var
|
|
72
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
64
73
|
var _currentStep$step4;
|
|
65
|
-
var key, types, _carts$, type,
|
|
74
|
+
var key, types, _carts$, type, form_key, booking_form, prevStepData, currentStepData, _key;
|
|
66
75
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
67
76
|
while (1) switch (_context.prev = _context.next) {
|
|
68
77
|
case 0:
|
|
@@ -99,40 +108,63 @@ var Header = function Header() {
|
|
|
99
108
|
if (key === 'select-time') {
|
|
100
109
|
setTimes([]);
|
|
101
110
|
}
|
|
102
|
-
if (key === 'fill-form') {
|
|
103
|
-
setOtherData('booking_form', {});
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
// // 5. 判断是否需要跳过资源步骤
|
|
107
|
-
// const isHasForm = stepList?.some((item: any) => item.key === 'fill-form');
|
|
108
|
-
// const shouldCheckSkip =
|
|
109
|
-
// (isHasForm && key === 'fill-form') || key === 'select-time';
|
|
110
111
|
|
|
111
|
-
//
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
// }
|
|
118
|
-
// }
|
|
112
|
+
// 5. 清空表单数据
|
|
113
|
+
if (key.startsWith('fill-form')) {
|
|
114
|
+
form_key = 'booking_form';
|
|
115
|
+
booking_form = getOtherData(form_key);
|
|
116
|
+
setOtherData(form_key, _objectSpread(_objectSpread({}, booking_form), {}, _defineProperty({}, key, {})));
|
|
117
|
+
}
|
|
119
118
|
|
|
120
119
|
// 如果前一步是资源步骤,并且被跳过了,则清空资源
|
|
121
|
-
resourceStep = stepList[
|
|
122
|
-
if (resourceStep
|
|
123
|
-
|
|
124
|
-
}
|
|
120
|
+
// const resourceStep = stepList[currentStep?.index - 1];
|
|
121
|
+
// if (resourceStep?.isSkip && resourceStep?.key === 'select-resource') {
|
|
122
|
+
// appointmentBooking.deleteCartItemInfo('resource');
|
|
123
|
+
// }
|
|
125
124
|
|
|
126
125
|
// 6. 默认回退一步
|
|
127
126
|
appointmentBooking.back();
|
|
128
|
-
prevStepData = stepList[(
|
|
129
|
-
currentStepData = stepList[
|
|
127
|
+
prevStepData = stepList[(currentStepParams === null || currentStepParams === void 0 ? void 0 : currentStepParams.index) - 1];
|
|
128
|
+
currentStepData = stepList[currentStepParams === null || currentStepParams === void 0 ? void 0 : currentStepParams.index];
|
|
130
129
|
if (currentStepData !== null && currentStepData !== void 0 && currentStepData.isSkip || prevStepData !== null && prevStepData !== void 0 && prevStepData.isSkip) {
|
|
131
130
|
_key = currentStepData !== null && currentStepData !== void 0 && currentStepData.isSkip ? currentStepData === null || currentStepData === void 0 ? void 0 : currentStepData.key : prevStepData === null || prevStepData === void 0 ? void 0 : prevStepData.key;
|
|
131
|
+
if (_key === 'select-resource') {
|
|
132
|
+
appointmentBooking.deleteCartItemInfo('resource');
|
|
133
|
+
}
|
|
132
134
|
updateStep(_key, {
|
|
133
135
|
isSkip: false
|
|
134
136
|
});
|
|
135
137
|
}
|
|
138
|
+
|
|
139
|
+
// 如果前一步是选择服务步骤,则移除表单和资源开头的步骤, 防止每个商品配置的资源不一样,导致步骤会有上次的数据
|
|
140
|
+
if ((prevStepData === null || prevStepData === void 0 ? void 0 : prevStepData.key) === 'select-service') {
|
|
141
|
+
stepList.forEach(function (item) {
|
|
142
|
+
if (item.key.startsWith('select-resource_') || item.key.startsWith('fill-form_')) {
|
|
143
|
+
removeStep(item.key);
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
// 如果当前步骤是选择资源,则清空表单步骤,不然表单步骤会累加
|
|
149
|
+
if ((currentStepData === null || currentStepData === void 0 ? void 0 : currentStepData.key) === 'select-resource') {
|
|
150
|
+
stepList.forEach(function (item) {
|
|
151
|
+
if (item.key.startsWith('fill-form_')) {
|
|
152
|
+
removeStep(item.key);
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
// 再次将步骤更新为false, 增加这个判断为了跳过那一步没有设置holder,但是直接后退了
|
|
158
|
+
// if (
|
|
159
|
+
// resourceStep?.isSkip &&
|
|
160
|
+
// (resourceStep?.key === 'select-resource' ||
|
|
161
|
+
// resourceStep?.key === 'select-service')
|
|
162
|
+
// ) {
|
|
163
|
+
// updateStep(resourceStep?.key, {
|
|
164
|
+
// index: currentStep?.index,
|
|
165
|
+
// isSkip: false,
|
|
166
|
+
// });
|
|
167
|
+
// }
|
|
136
168
|
case 18:
|
|
137
169
|
case "end":
|
|
138
170
|
return _context.stop();
|
|
@@ -140,7 +172,7 @@ var Header = function Header() {
|
|
|
140
172
|
}, _callee);
|
|
141
173
|
}));
|
|
142
174
|
return function handleBack() {
|
|
143
|
-
return
|
|
175
|
+
return _ref2.apply(this, arguments);
|
|
144
176
|
};
|
|
145
177
|
}();
|
|
146
178
|
|
|
@@ -17,11 +17,9 @@ import React, { useState, useEffect, useMemo, forwardRef, useImperativeHandle }
|
|
|
17
17
|
import { Skeleton } from 'antd';
|
|
18
18
|
import ResourceDisplay from "../../../eventBooking/components/resourceDisplay";
|
|
19
19
|
import { PisellCustomCheckboxGroup } from '@pisell/materials';
|
|
20
|
-
import { useAppointmentBookingResource, useIsSkipResourceStep, useAppointmentBookingStep
|
|
20
|
+
import { useAppointmentBookingResource, useIsSkipResourceStep, useAppointmentBookingStep } from "../../hooks";
|
|
21
21
|
import { useAppointmentBookingContext } from "../../context";
|
|
22
|
-
import {
|
|
23
|
-
import { checkResource, checkHolder } from "../../components/Cart/utils";
|
|
24
|
-
import { scrollToFirstErrorCard } from "./utils";
|
|
22
|
+
import { currentAppointmentBoard, currentRenderLists, updateCartResources } from "../../utils";
|
|
25
23
|
import guestsImg from "../../assets/guests.svg";
|
|
26
24
|
import { isMobile, locales } from '@pisell/utils';
|
|
27
25
|
import "./index.less";
|
|
@@ -30,99 +28,33 @@ var Resource = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
30
28
|
_useState2 = _slicedToArray(_useState, 2),
|
|
31
29
|
selectedResource = _useState2[0],
|
|
32
30
|
setSelectedResource = _useState2[1];
|
|
33
|
-
var
|
|
34
|
-
appointmentBooking =
|
|
35
|
-
carts =
|
|
36
|
-
resourceOtherParams =
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
var _useAppointmentBookin2 = useAppointmentBookingResource(),
|
|
43
|
-
getResourceList = _useAppointmentBookin2.getResourceList,
|
|
44
|
-
autoSelectAllProductResources = _useAppointmentBookin2.autoSelectAllProductResources,
|
|
45
|
-
getResourceTimeSlot = _useAppointmentBookin2.getResourceTimeSlot;
|
|
31
|
+
var _ref = useAppointmentBookingContext(),
|
|
32
|
+
appointmentBooking = _ref.appointmentBooking,
|
|
33
|
+
carts = _ref.carts,
|
|
34
|
+
resourceOtherParams = _ref.resourceOtherParams,
|
|
35
|
+
currentStep = _ref.currentStep,
|
|
36
|
+
setResourceOtherParams = _ref.setResourceOtherParams,
|
|
37
|
+
currentStepParams = _ref.currentStepParams;
|
|
38
|
+
var _useAppointmentBookin = useAppointmentBookingResource(),
|
|
39
|
+
getResourceList = _useAppointmentBookin.getResourceList;
|
|
46
40
|
var _useIsSkipResourceSte = useIsSkipResourceStep(),
|
|
47
41
|
checkSkipResourceStep = _useIsSkipResourceSte.checkSkipResourceStep;
|
|
48
|
-
var
|
|
49
|
-
updateStep =
|
|
50
|
-
nextStep =
|
|
51
|
-
var _useAppointmentBookin4 = useAppointmentBookingLogin(),
|
|
52
|
-
openLoginModal = _useAppointmentBookin4.openLoginModal,
|
|
53
|
-
isLogin = _useAppointmentBookin4.isLogin;
|
|
54
|
-
var _useAppointmentBookin5 = useAppointmentBookingAccount(),
|
|
55
|
-
getHolders = _useAppointmentBookin5.getHolders,
|
|
56
|
-
checkAccount = _useAppointmentBookin5.checkAccount;
|
|
57
|
-
var _useAppointmentBookin6 = useAppointmentBookingSetting(),
|
|
58
|
-
isFormSubject = _useAppointmentBookin6.isFormSubject;
|
|
59
|
-
var utils = contextUtils();
|
|
42
|
+
var _useAppointmentBookin2 = useAppointmentBookingStep(),
|
|
43
|
+
updateStep = _useAppointmentBookin2.updateStep,
|
|
44
|
+
nextStep = _useAppointmentBookin2.nextStep;
|
|
60
45
|
useImperativeHandle(ref, function () {
|
|
61
46
|
return {
|
|
62
47
|
next: function () {
|
|
63
48
|
var _next2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
64
|
-
var _appointmentBooking$s;
|
|
65
|
-
var result, resultCarts, stepList, accountLists, checkResult;
|
|
66
49
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
67
50
|
while (1) switch (_context.prev = _context.next) {
|
|
68
51
|
case 0:
|
|
69
|
-
result = checkResource({
|
|
70
|
-
carts: carts,
|
|
71
|
-
resources: resources
|
|
72
|
-
});
|
|
73
|
-
if (result) {
|
|
74
|
-
setCarts(result);
|
|
75
|
-
}
|
|
76
|
-
setIsErrorHolder(!!result);
|
|
77
|
-
|
|
78
|
-
// 验证购物车是否有资源
|
|
79
|
-
if (!result) {
|
|
80
|
-
_context.next = 6;
|
|
81
|
-
break;
|
|
82
|
-
}
|
|
83
|
-
scrollToFirstErrorCard();
|
|
84
|
-
return _context.abrupt("return");
|
|
85
|
-
case 6:
|
|
86
|
-
resultCarts = formatCartsResources(carts, resources, setPolicyIds);
|
|
87
|
-
stepList = (appointmentBooking === null || appointmentBooking === void 0 || (_appointmentBooking$s = appointmentBooking.store) === null || _appointmentBooking$s === void 0 || (_appointmentBooking$s = _appointmentBooking$s.step) === null || _appointmentBooking$s === void 0 || (_appointmentBooking$s = _appointmentBooking$s.store) === null || _appointmentBooking$s === void 0 ? void 0 : _appointmentBooking$s.stepList) || [];
|
|
88
|
-
_context.next = 10;
|
|
89
|
-
return appointmentBooking.getAccounts();
|
|
90
|
-
case 10:
|
|
91
|
-
accountLists = _context.sent;
|
|
92
|
-
checkResult = checkHasFormStep({
|
|
93
|
-
setIsErrorHolder: setIsErrorHolder,
|
|
94
|
-
nextStep: nextStep,
|
|
95
|
-
hasResourceFormId: (resultCarts === null || resultCarts === void 0 ? void 0 : resultCarts.length) > 0,
|
|
96
|
-
currentStep: currentStep,
|
|
97
|
-
stepList: stepList,
|
|
98
|
-
appointmentBooking: appointmentBooking,
|
|
99
|
-
locales: locales,
|
|
100
|
-
openLoginModal: openLoginModal,
|
|
101
|
-
utils: utils,
|
|
102
|
-
accountLists: accountLists,
|
|
103
|
-
getHolders: getHolders,
|
|
104
|
-
checkHolder: checkHolder,
|
|
105
|
-
checkAccount: checkAccount,
|
|
106
|
-
setCarts: setCarts,
|
|
107
|
-
carts: carts,
|
|
108
|
-
isFormSubject: isFormSubject,
|
|
109
|
-
isLogin: isLogin
|
|
110
|
-
});
|
|
111
|
-
if (!checkResult) {
|
|
112
|
-
_context.next = 14;
|
|
113
|
-
break;
|
|
114
|
-
}
|
|
115
|
-
return _context.abrupt("return");
|
|
116
|
-
case 14:
|
|
117
52
|
// 清空资源分配失败数据
|
|
118
53
|
setResourceOtherParams(_objectSpread(_objectSpread({}, resourceOtherParams), {}, {
|
|
119
54
|
errorList: null
|
|
120
55
|
}));
|
|
121
|
-
|
|
122
|
-
// 获取时间切片
|
|
123
|
-
getResourceTimeSlot();
|
|
124
56
|
nextStep();
|
|
125
|
-
case
|
|
57
|
+
case 2:
|
|
126
58
|
case "end":
|
|
127
59
|
return _context.stop();
|
|
128
60
|
}
|
|
@@ -143,24 +75,17 @@ var Resource = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
143
75
|
useEffect(function () {
|
|
144
76
|
// 检查是否可以跳过资源选择步骤
|
|
145
77
|
var checkAndSkipResourceStep = /*#__PURE__*/function () {
|
|
146
|
-
var
|
|
78
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
147
79
|
var _currentStep$step, _resources, skipResourceStep, key;
|
|
148
80
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
149
81
|
while (1) switch (_context2.prev = _context2.next) {
|
|
150
82
|
case 0:
|
|
151
83
|
_context2.prev = 0;
|
|
152
84
|
// 获取资源列表数据
|
|
153
|
-
_resources = getResourceList(); //
|
|
85
|
+
_resources = getResourceList(); // 检测资源步骤是否跳过
|
|
154
86
|
_context2.next = 4;
|
|
155
|
-
return autoSelectAllProductResources();
|
|
156
|
-
case 4:
|
|
157
|
-
// 根据自动分配之后的资源重新拉取资源列表
|
|
158
|
-
getResourceList();
|
|
159
|
-
|
|
160
|
-
// 检测资源步骤是否跳过
|
|
161
|
-
_context2.next = 7;
|
|
162
87
|
return checkSkipResourceStep();
|
|
163
|
-
case
|
|
88
|
+
case 4:
|
|
164
89
|
skipResourceStep = _context2.sent;
|
|
165
90
|
// 更新步骤是否有跳过标识
|
|
166
91
|
key = currentStep === null || currentStep === void 0 || (_currentStep$step = currentStep.step) === null || _currentStep$step === void 0 ? void 0 : _currentStep$step.key;
|
|
@@ -169,58 +94,110 @@ var Resource = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
169
94
|
isSkip: skipResourceStep
|
|
170
95
|
});
|
|
171
96
|
if (!skipResourceStep) {
|
|
172
|
-
_context2.next =
|
|
97
|
+
_context2.next = 9;
|
|
173
98
|
break;
|
|
174
99
|
}
|
|
175
100
|
return _context2.abrupt("return", true);
|
|
176
|
-
case
|
|
101
|
+
case 9:
|
|
177
102
|
return _context2.abrupt("return", false);
|
|
178
|
-
case
|
|
179
|
-
_context2.prev =
|
|
103
|
+
case 12:
|
|
104
|
+
_context2.prev = 12;
|
|
180
105
|
_context2.t0 = _context2["catch"](0);
|
|
181
|
-
case
|
|
106
|
+
case 14:
|
|
182
107
|
case "end":
|
|
183
108
|
return _context2.stop();
|
|
184
109
|
}
|
|
185
|
-
}, _callee2, null, [[0,
|
|
110
|
+
}, _callee2, null, [[0, 12]]);
|
|
186
111
|
}));
|
|
187
112
|
return function checkAndSkipResourceStep() {
|
|
188
|
-
return
|
|
113
|
+
return _ref2.apply(this, arguments);
|
|
189
114
|
};
|
|
190
115
|
}();
|
|
191
116
|
checkAndSkipResourceStep();
|
|
192
|
-
}, []);
|
|
117
|
+
}, [currentStepParams.key]);
|
|
193
118
|
var anyResource = [{
|
|
194
119
|
id: 0,
|
|
195
120
|
image: guestsImg,
|
|
196
121
|
title: locales.getText('pisell2.appointment.any.professional'),
|
|
197
122
|
subtitle: locales.getText('pisell2.appointment.for.maximum.availability')
|
|
198
123
|
}];
|
|
199
|
-
var
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
renderList: []
|
|
207
|
-
};
|
|
208
|
-
}
|
|
124
|
+
var appointmentBoard = useMemo(function () {
|
|
125
|
+
return currentAppointmentBoard(currentStepParams.key, resources, appointmentBooking);
|
|
126
|
+
}, [currentStepParams.key, resources]);
|
|
127
|
+
var renderLists = useMemo(function () {
|
|
128
|
+
// 如果购物车有多个,则不显示左侧内容
|
|
129
|
+
if (carts.length > 1 || !(carts !== null && carts !== void 0 && carts.length)) {
|
|
130
|
+
return [];
|
|
209
131
|
}
|
|
210
|
-
|
|
132
|
+
return currentRenderLists(resources, appointmentBoard === null || appointmentBoard === void 0 ? void 0 : appointmentBoard.form_code);
|
|
133
|
+
}, [resources, appointmentBoard === null || appointmentBoard === void 0 ? void 0 : appointmentBoard.form_code, carts]);
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* @title: 获取自动分派
|
|
137
|
+
* @description:
|
|
138
|
+
* @return {*}
|
|
139
|
+
* @Author: WangHan
|
|
140
|
+
* @Date: 2025-05-26 15:10
|
|
141
|
+
*/
|
|
142
|
+
useEffect(function () {
|
|
143
|
+
var autoSelectResources = /*#__PURE__*/function () {
|
|
144
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
145
|
+
var res, cartItem;
|
|
146
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
147
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
148
|
+
case 0:
|
|
149
|
+
if (appointmentBoard !== null && appointmentBoard !== void 0 && appointmentBoard.form_code) {
|
|
150
|
+
_context3.next = 2;
|
|
151
|
+
break;
|
|
152
|
+
}
|
|
153
|
+
return _context3.abrupt("return");
|
|
154
|
+
case 2:
|
|
155
|
+
_context3.next = 4;
|
|
156
|
+
return appointmentBooking.autoSelectAllProductResources(appointmentBoard === null || appointmentBoard === void 0 ? void 0 : appointmentBoard.form_code);
|
|
157
|
+
case 4:
|
|
158
|
+
res = _context3.sent;
|
|
159
|
+
setResourceOtherParams(_objectSpread(_objectSpread({}, resourceOtherParams), res));
|
|
160
|
+
|
|
161
|
+
// 自动分派之后获取重新获取资源列表数据;
|
|
162
|
+
getResourceList();
|
|
163
|
+
cartItem = carts === null || carts === void 0 ? void 0 : carts[0];
|
|
164
|
+
appointmentBooking.updateCart(_objectSpread({
|
|
165
|
+
_id: cartItem === null || cartItem === void 0 ? void 0 : cartItem._id
|
|
166
|
+
}, cartItem));
|
|
167
|
+
case 9:
|
|
168
|
+
case "end":
|
|
169
|
+
return _context3.stop();
|
|
170
|
+
}
|
|
171
|
+
}, _callee3);
|
|
172
|
+
}));
|
|
173
|
+
return function autoSelectResources() {
|
|
174
|
+
return _ref3.apply(this, arguments);
|
|
175
|
+
};
|
|
176
|
+
}();
|
|
177
|
+
autoSelectResources();
|
|
178
|
+
}, [appointmentBoard]);
|
|
211
179
|
var resourcesResult = useMemo(function () {
|
|
212
|
-
|
|
213
|
-
|
|
180
|
+
// 如果是必选资源,则不显示随机分配选项
|
|
181
|
+
var _anyResource = appointmentBoard !== null && appointmentBoard !== void 0 && appointmentBoard.isRequired ? [] : [].concat(anyResource);
|
|
182
|
+
return _anyResource.concat(renderLists || []);
|
|
183
|
+
}, [renderLists, appointmentBoard]);
|
|
214
184
|
var _onClick = function onClick(e) {
|
|
215
185
|
setSelectedResource(e.id);
|
|
216
186
|
if (e.id) {
|
|
217
187
|
var _carts$;
|
|
218
188
|
return appointmentBooking.updateCart({
|
|
219
189
|
_id: carts === null || carts === void 0 || (_carts$ = carts[0]) === null || _carts$ === void 0 ? void 0 : _carts$._id,
|
|
220
|
-
resources: [e
|
|
190
|
+
resources: updateCartResources(carts === null || carts === void 0 ? void 0 : carts[0], e)
|
|
221
191
|
});
|
|
222
192
|
}
|
|
223
193
|
};
|
|
194
|
+
useEffect(function () {
|
|
195
|
+
var _carts$2;
|
|
196
|
+
var selectedResource = carts === null || carts === void 0 || (_carts$2 = carts[0]) === null || _carts$2 === void 0 || (_carts$2 = _carts$2._origin) === null || _carts$2 === void 0 || (_carts$2 = _carts$2.resources) === null || _carts$2 === void 0 ? void 0 : _carts$2.find(function (item) {
|
|
197
|
+
return (item === null || item === void 0 ? void 0 : item.form_id) === (appointmentBoard === null || appointmentBoard === void 0 ? void 0 : appointmentBoard.form_id);
|
|
198
|
+
});
|
|
199
|
+
setSelectedResource((selectedResource === null || selectedResource === void 0 ? void 0 : selectedResource.id) || 0);
|
|
200
|
+
}, [carts, appointmentBoard === null || appointmentBoard === void 0 ? void 0 : appointmentBoard.form_id]);
|
|
224
201
|
return /*#__PURE__*/React.createElement("div", {
|
|
225
202
|
className: 'appointment-resource-wrap'
|
|
226
203
|
}, !(resourcesResult !== null && resourcesResult !== void 0 && resourcesResult.length) ? /*#__PURE__*/React.createElement(Skeleton, {
|
|
@@ -13,7 +13,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
13
13
|
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; }
|
|
14
14
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
15
15
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
16
|
-
import React, { useState, useEffect, forwardRef, useImperativeHandle } from 'react';
|
|
16
|
+
import React, { useState, useEffect, forwardRef, useImperativeHandle, useMemo } from 'react';
|
|
17
17
|
import dayjs from 'dayjs';
|
|
18
18
|
import { isMobile, locales } from '@pisell/utils';
|
|
19
19
|
import ProductSelect from "../../../productSelect";
|
|
@@ -38,7 +38,8 @@ var Services = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
38
38
|
nextStep = _useAppointmentBookin3.nextStep;
|
|
39
39
|
var _ref2 = useAppointmentBookingContext(),
|
|
40
40
|
currentStep = _ref2.currentStep,
|
|
41
|
-
setLoading = _ref2.setLoading
|
|
41
|
+
setLoading = _ref2.setLoading,
|
|
42
|
+
carts = _ref2.carts;
|
|
42
43
|
var _useState = useState(null),
|
|
43
44
|
_useState2 = _slicedToArray(_useState, 2),
|
|
44
45
|
products = _useState2[0],
|
|
@@ -54,7 +55,7 @@ var Services = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
54
55
|
setTimeout(function () {
|
|
55
56
|
nextStep();
|
|
56
57
|
setLoading(false);
|
|
57
|
-
},
|
|
58
|
+
}, 500);
|
|
58
59
|
}
|
|
59
60
|
};
|
|
60
61
|
});
|
|
@@ -215,6 +216,18 @@ var Services = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
215
216
|
return _ref3.apply(this, arguments);
|
|
216
217
|
};
|
|
217
218
|
}();
|
|
219
|
+
var productListSetting = useMemo(function () {
|
|
220
|
+
var _context$engine, _productListBlock;
|
|
221
|
+
var _ref4 = ((_context$engine = context.engine) === null || _context$engine === void 0 ? void 0 : _context$engine.props) || {},
|
|
222
|
+
customPageData = _ref4.customPageData;
|
|
223
|
+
var productListBlock;
|
|
224
|
+
if (Array.isArray(customPageData === null || customPageData === void 0 ? void 0 : customPageData.block)) {
|
|
225
|
+
productListBlock = customPageData.block.find(function (b) {
|
|
226
|
+
return 'product_list' === b.type;
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
return ((_productListBlock = productListBlock) === null || _productListBlock === void 0 ? void 0 : _productListBlock.setting) || {};
|
|
230
|
+
}, [context]);
|
|
218
231
|
return /*#__PURE__*/React.createElement("div", {
|
|
219
232
|
className: "appointment-service-wrap"
|
|
220
233
|
}, /*#__PURE__*/React.createElement(ProductSelect, {
|
|
@@ -231,7 +244,9 @@ var Services = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
231
244
|
tabItemActiveBg: 'var(--theme-color)',
|
|
232
245
|
categoryTextColor: '#1B1B1B',
|
|
233
246
|
cardSelectedBg: 'var(--theme-color)'
|
|
234
|
-
}
|
|
247
|
+
},
|
|
248
|
+
productListSetting: productListSetting,
|
|
249
|
+
selectedItems: carts
|
|
235
250
|
}));
|
|
236
251
|
});
|
|
237
252
|
export default Services;
|