@pisell/private-materials 3.4.7 → 3.4.9
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/index.js +1 -1
- package/build/lowcode/meta.js +1 -1
- package/build/lowcode/preview.js +8 -8
- package/build/lowcode/render/default/view.js +4 -4
- package/build/lowcode/view.js +7 -7
- package/es/components/appointmentBooking/components/Cart/utils.d.ts +56 -0
- package/es/components/appointmentBooking/components/Footer/index.d.ts +1 -0
- package/es/components/appointmentBooking/components/Guest/components/InformationOptionsModal/index.d.ts +1 -0
- package/es/components/booking/addons/model.d.ts +10 -1
- package/es/components/booking/components/TabProduct/tabs/index.js +1 -5
- package/es/components/booking/components/browserSelect/index.js +1 -1
- package/es/components/booking/components/customSelect/index.js +1 -0
- package/es/components/booking/components/tabPane/index.d.ts +4 -0
- package/es/components/booking/editBookingModal/index.js +58 -29
- package/es/components/booking/editBookingModal/serve.d.ts +1 -0
- package/es/components/booking/editBookingModal/serve.js +19 -11
- package/es/components/booking/forms/model.d.ts +10 -1
- package/es/components/booking/forms/model.js +5 -5
- package/es/components/booking/hooks/useClearCart.js +11 -8
- package/es/components/booking/hooks/useIsBooking4Shop.d.ts +1 -0
- package/es/components/booking/hooks/useQuotation.js +1 -1
- package/es/components/booking/info/addServiceVariant/index.d.ts +7 -0
- package/es/components/booking/info/client/index.js +3 -2
- package/es/components/booking/info/dateRange/index.d.ts +1 -0
- package/es/components/booking/info/hooks/useInfoHolder.js +16 -9
- package/es/components/booking/info/index.d.ts +4 -0
- package/es/components/booking/info/model.d.ts +10 -1
- package/es/components/booking/info/service/Lists.js +36 -26
- package/es/components/booking/info/service/like/index.js +1 -1
- package/es/components/booking/info/service2/Lists.d.ts +0 -1
- package/es/components/booking/info/service2/utils.js +20 -21
- package/es/components/booking/info2/index.js +1 -0
- package/es/components/booking/info2/service/addService/utils.js +7 -4
- package/es/components/booking/info2/service/addTimeModal/index.js +3 -0
- package/es/components/booking/info2/service/editService/Resources/index.js +5 -0
- package/es/components/booking/info2/service/editService/ResourcesV2/index.js +1 -1
- package/es/components/booking/info2/service/editService/index.js +266 -170
- package/es/components/booking/info2/service/index.js +19 -15
- package/es/components/booking/materiels/duration/index.js +9 -2
- package/es/components/booking/materiels/holder/index.d.ts +0 -1
- package/es/components/booking/materiels/startTime/index.js +1 -1
- package/es/components/booking/model.d.ts +9 -1
- package/es/components/booking/notes/NoteBlock/NoteItem/index.js +1 -1
- package/es/components/booking/notes/NoteBlock/index.js +11 -11
- package/es/components/booking/notes/model.d.ts +10 -1
- package/es/components/booking/notes/model.js +5 -5
- package/es/components/booking/payments/model.d.ts +10 -1
- package/es/components/booking/payments/model.js +5 -5
- package/es/components/eftposPay/component/step/index.d.ts +1 -0
- package/es/components/eventBooking/components/ErrorTip/index.d.ts +1 -0
- package/es/components/eventBooking/components/Provider/InformationOptionsModal/index.d.ts +1 -0
- package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/CallToBook/index.d.ts +1 -0
- package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/WeekItem/index.d.ts +1 -0
- package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/index.d.ts +1 -0
- package/es/components/eventBooking/components/scheduleCalendar/calendarItem.d.ts +1 -0
- package/es/components/listComponent/index.js +5 -5
- package/es/components/pay/toC/PaymentMethods/StripePay/Stripe/components/SetupForm/index.d.ts +1 -0
- package/es/components/pay/toC/WalletPassBlock/components/WalletUseList/index.d.ts +1 -0
- package/es/components/pay/toC/model.d.ts +9 -1
- package/es/components/productExtension/card/index.js +3 -3
- package/es/components/productExtension/fields/Actor/CutOffTime/index.js +1 -1
- package/es/components/productExtension/fields/Forms/index.js +12 -12
- package/es/components/productExtension/fields/SelectProducts/ProductItemPreview/index.js +1 -1
- package/es/components/productExtension/fields/SelectProducts/server.js +2 -2
- package/es/components/productExtension/fields/SelectResourcesTable/server.js +2 -2
- package/es/components/productExtension/server.js +2 -2
- package/es/components/ruleSetting/ruleBorder/index.js +1 -1
- package/es/components/schedules/calendar/index.js +4 -4
- package/es/components/schedules/calendar/serve.js +2 -2
- package/es/components/schedules/components/CurrentDay/index.d.ts +0 -1
- package/es/components/schedules/components/CurrentDay/index.js +5 -5
- package/es/components/schedules/components/CurrentDay/serve.js +2 -2
- package/es/components/schedules/components/DropdownSort/index.js +1 -1
- package/es/components/schedules/components/ResourceList/index.js +1 -1
- package/es/components/schedules/components/Search/index.js +5 -5
- package/es/components/schedules/model.d.ts +9 -1
- package/es/components/schedules/model.js +5 -5
- package/es/components/schedules/openHours/index.js +1 -1
- package/es/components/schedules/openHours/serve.js +2 -2
- package/es/components/schedules/products/ProductDetailDrawer/ProductDetail/MaxParticipantsModule/index.js +1 -1
- package/es/components/schedules/products/ProductDetailDrawer/ProductDetail/ResourcesModule/index.js +5 -5
- package/es/components/schedules/products/ProductDetailDrawer/ProductDetail/SchedulesModule/index.js +4 -4
- package/es/components/schedules/products/ProductDetailDrawer/index.js +3 -3
- package/es/components/schedules/products/index.d.ts +0 -1
- package/es/components/schedules/products/serve.js +2 -2
- package/es/components/schedules/products/utils.js +5 -5
- package/es/components/schedules/resources/detail/detailContent.js +2 -2
- package/es/components/schedules/resources/detail/index.js +10 -10
- package/es/components/schedules/resources/list/index.js +2 -2
- package/es/components/schedules/resources/relationProduct/index.js +1 -1
- package/es/components/schedules/resources/serve.js +2 -2
- package/es/components/schedules/schedules/ScheduleDetailDrawer/index.js +9 -9
- package/es/components/schedules/utils.js +4 -4
- package/es/components/selectModal/index.js +2 -2
- package/es/components/shoppingCart/components/Cart/Product.d.ts +1 -0
- package/es/components/shoppingCart/components/Cart/Product.js +48 -41
- package/es/components/shoppingCart/components/Cart/index.js +21 -18
- package/es/components/ticketBooking/components/addServiceVariant/addService.js +249 -158
- package/es/components/ticketBooking/components/timeBar/index.js +78 -71
- package/es/components/ticketBooking/locales.d.ts +174 -0
- package/es/components/ticketBooking/serve.d.ts +287 -0
- package/es/components/ticketBooking/utils/index.d.ts +25 -0
- package/es/components/ticketBooking/utils/index.js +18 -1
- package/es/components/wallet/Detail/model.d.ts +13 -1
- package/es/components/wallet/DiscountCard/model.d.ts +14 -1
- package/es/components/wallet/PointCard/model.d.ts +13 -1
- package/es/components/wallet/RechargeableCard/model.d.ts +29 -1
- package/es/components/wallet/Voucher/model.d.ts +13 -1
- package/es/components/wallet/model.d.ts +9 -1
- package/es/components/workSpaceList/components/Modal/index.d.ts +1 -0
- package/es/components/workSpaceList/components/SearchWorkspaceAndBase/index.d.ts +1 -0
- package/es/hooks/useComponents.js +1 -1
- package/lib/components/appointmentBooking/components/Cart/utils.d.ts +56 -0
- package/lib/components/appointmentBooking/components/Footer/index.d.ts +1 -0
- package/lib/components/appointmentBooking/components/Guest/components/InformationOptionsModal/index.d.ts +1 -0
- package/lib/components/booking/addons/model.d.ts +10 -1
- package/lib/components/booking/components/customSelect/index.js +1 -0
- package/lib/components/booking/components/tabPane/index.d.ts +4 -0
- package/lib/components/booking/editBookingModal/index.js +56 -21
- package/lib/components/booking/editBookingModal/serve.d.ts +1 -0
- package/lib/components/booking/editBookingModal/serve.js +12 -6
- package/lib/components/booking/forms/model.d.ts +10 -1
- package/lib/components/booking/hooks/useClearCart.js +16 -13
- package/lib/components/booking/hooks/useIsBooking4Shop.d.ts +1 -0
- package/lib/components/booking/hooks/useQuotation.js +1 -1
- package/lib/components/booking/info/addServiceVariant/index.d.ts +7 -0
- package/lib/components/booking/info/client/index.js +5 -4
- package/lib/components/booking/info/dateRange/index.d.ts +1 -0
- package/lib/components/booking/info/hooks/useInfoHolder.js +10 -9
- package/lib/components/booking/info/index.d.ts +4 -0
- package/lib/components/booking/info/model.d.ts +10 -1
- package/lib/components/booking/info/service/Lists.js +35 -23
- package/lib/components/booking/info/service2/Lists.d.ts +0 -1
- package/lib/components/booking/info/service2/utils.js +17 -17
- package/lib/components/booking/info2/service/addService/utils.js +5 -3
- package/lib/components/booking/info2/service/addTimeModal/index.js +3 -0
- package/lib/components/booking/info2/service/editService/Resources/index.js +2 -0
- package/lib/components/booking/info2/service/editService/ResourcesV2/index.js +1 -1
- package/lib/components/booking/info2/service/editService/index.js +139 -74
- package/lib/components/booking/info2/service/index.js +13 -9
- package/lib/components/booking/materiels/duration/index.js +7 -2
- package/lib/components/booking/materiels/holder/index.d.ts +0 -1
- package/lib/components/booking/model.d.ts +9 -1
- package/lib/components/booking/notes/model.d.ts +10 -1
- package/lib/components/booking/payments/model.d.ts +10 -1
- package/lib/components/eftposPay/component/step/index.d.ts +1 -0
- package/lib/components/eventBooking/components/ErrorTip/index.d.ts +1 -0
- package/lib/components/eventBooking/components/Provider/InformationOptionsModal/index.d.ts +1 -0
- package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/CallToBook/index.d.ts +1 -0
- package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/WeekItem/index.d.ts +1 -0
- package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/index.d.ts +1 -0
- package/lib/components/eventBooking/components/scheduleCalendar/calendarItem.d.ts +1 -0
- package/lib/components/pay/toC/PaymentMethods/StripePay/Stripe/components/SetupForm/index.d.ts +1 -0
- package/lib/components/pay/toC/WalletPassBlock/components/WalletUseList/index.d.ts +1 -0
- package/lib/components/pay/toC/model.d.ts +9 -1
- package/lib/components/schedules/components/CurrentDay/index.d.ts +0 -1
- package/lib/components/schedules/model.d.ts +9 -1
- package/lib/components/schedules/products/index.d.ts +0 -1
- package/lib/components/schedules/utils.js +1 -1
- package/lib/components/shoppingCart/components/Cart/Product.d.ts +1 -0
- package/lib/components/shoppingCart/components/Cart/Product.js +31 -21
- package/lib/components/shoppingCart/components/Cart/index.js +18 -15
- package/lib/components/ticketBooking/components/addServiceVariant/addService.js +196 -127
- package/lib/components/ticketBooking/components/timeBar/index.js +95 -88
- package/lib/components/ticketBooking/locales.d.ts +174 -0
- package/lib/components/ticketBooking/serve.d.ts +287 -0
- package/lib/components/ticketBooking/utils/index.d.ts +25 -0
- package/lib/components/ticketBooking/utils/index.js +22 -0
- package/lib/components/wallet/Detail/model.d.ts +13 -1
- package/lib/components/wallet/DiscountCard/model.d.ts +14 -1
- package/lib/components/wallet/PointCard/model.d.ts +13 -1
- package/lib/components/wallet/RechargeableCard/model.d.ts +29 -1
- package/lib/components/wallet/Voucher/model.d.ts +13 -1
- package/lib/components/wallet/model.d.ts +9 -1
- package/lib/components/workSpaceList/components/Modal/index.d.ts +1 -0
- package/lib/components/workSpaceList/components/SearchWorkspaceAndBase/index.d.ts +1 -0
- package/package.json +3 -3
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { CalendarDataItem, ScheduleItem } from "./type";
|
|
2
3
|
import dayjs from "dayjs";
|
|
3
4
|
export interface FormState {
|
|
@@ -68,4 +69,11 @@ export interface FormState {
|
|
|
68
69
|
};
|
|
69
70
|
setGlobalState: Function | null;
|
|
70
71
|
}
|
|
71
|
-
export declare const Provider: any, Context:
|
|
72
|
+
export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
|
|
73
|
+
state: FormState;
|
|
74
|
+
} & {
|
|
75
|
+
dispatch: (params: {
|
|
76
|
+
type: string;
|
|
77
|
+
payload: any;
|
|
78
|
+
}) => void;
|
|
79
|
+
}>;
|
|
@@ -37,6 +37,7 @@ var import_materials = require("@pisell/materials");
|
|
|
37
37
|
var import_useClearCart = __toESM(require("../../hooks/useClearCart"));
|
|
38
38
|
var import_useContext = require("../../hooks/useContext");
|
|
39
39
|
var import_useAddService = __toESM(require("../../hooks/useAddService"));
|
|
40
|
+
var import_ahooks = require("ahooks");
|
|
40
41
|
var Product = (props) => {
|
|
41
42
|
const { id, lists, isAdd = true } = props;
|
|
42
43
|
const { state, onAction, onChange } = (0, import_useContext.useContext)();
|
|
@@ -54,10 +55,10 @@ var Product = (props) => {
|
|
|
54
55
|
isShowEditProduct
|
|
55
56
|
} = state;
|
|
56
57
|
const clearCart = (0, import_useClearCart.default)(id);
|
|
57
|
-
const handleChange = (item, type, other) => {
|
|
58
|
+
const handleChange = (0, import_ahooks.useMemoizedFn)((item, type, other) => {
|
|
58
59
|
if (disabledEdit && !(other == null ? void 0 : other.disabled)) return;
|
|
59
60
|
onChange(item, type, other);
|
|
60
|
-
};
|
|
61
|
+
});
|
|
61
62
|
const productParams = (0, import_react.useMemo)(() => {
|
|
62
63
|
return {
|
|
63
64
|
isShowNote,
|
|
@@ -81,24 +82,33 @@ var Product = (props) => {
|
|
|
81
82
|
isShowChangeHolder,
|
|
82
83
|
isShowEditProduct
|
|
83
84
|
]);
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
85
|
+
(0, import_ahooks.useTrackedEffect)(
|
|
86
|
+
(changes) => {
|
|
87
|
+
console.log("Index of changed dependencies: ", changes);
|
|
88
|
+
},
|
|
89
|
+
[clearCart, lists, productParams, hideAddBtn, isAdd, platform]
|
|
90
|
+
);
|
|
91
|
+
return (0, import_react.useMemo)(() => {
|
|
92
|
+
console.log("render cart");
|
|
93
|
+
return /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__shopping-cart-content" }, clearCart, lists == null ? void 0 : lists.map((item) => {
|
|
94
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
95
|
+
import_materials.ProductCard,
|
|
96
|
+
{
|
|
97
|
+
key: item._id,
|
|
98
|
+
dataSource: item,
|
|
99
|
+
onAction: (e) => onAction == null ? void 0 : onAction(e),
|
|
100
|
+
onDelete: (e) => handleChange(e, "delete", item),
|
|
101
|
+
onNote: (e) => handleChange(e, "note", { note: e.note }),
|
|
102
|
+
onLike: (e) => handleChange(e, "like", { like_status: e.like_status }),
|
|
103
|
+
onEditProduct: (e) => handleChange == null ? void 0 : handleChange(e, "edit_product"),
|
|
104
|
+
onCard: (e) => handleChange == null ? void 0 : handleChange(e, "view"),
|
|
105
|
+
onChangeResource: (e) => handleChange(item, "change_resource", e),
|
|
106
|
+
onChangeHolder: (e) => handleChange(item, "change_holder", e),
|
|
107
|
+
onAddHolder: (e) => handleChange(item, "add_holder", e),
|
|
108
|
+
...productParams
|
|
109
|
+
}
|
|
110
|
+
);
|
|
111
|
+
}), !hideAddBtn && platform !== "h5" && isAdd ? (0, import_useAddService.default)(id, "more") : null);
|
|
112
|
+
}, [clearCart, lists, productParams, hideAddBtn, isAdd, platform]);
|
|
103
113
|
};
|
|
104
114
|
var Product_default = Product;
|
|
@@ -66,20 +66,23 @@ var Cart = () => {
|
|
|
66
66
|
};
|
|
67
67
|
});
|
|
68
68
|
}, [carts, platform]);
|
|
69
|
-
return
|
|
70
|
-
|
|
71
|
-
{
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
69
|
+
return (0, import_react.useMemo)(() => {
|
|
70
|
+
console.log("render cart 22222");
|
|
71
|
+
return /* @__PURE__ */ import_react.default.createElement("div", { className: (0, import_classnames.default)("pisell-lowcode__shopping-cart") }, isProductList ? /* @__PURE__ */ import_react.default.createElement(import_Product.default, { id: void 0, lists: state == null ? void 0 : state.products }) : /* @__PURE__ */ import_react.default.createElement(
|
|
72
|
+
import_materials.Collapse,
|
|
73
|
+
{
|
|
74
|
+
items: cartsMap,
|
|
75
|
+
showHeader: true,
|
|
76
|
+
panelBackground: "#ffffff",
|
|
77
|
+
collapsible: platform !== "shop" ? "disabled" : "-",
|
|
78
|
+
accordion: platform === "shop",
|
|
79
|
+
onChange: (key) => {
|
|
80
|
+
updateState({ activeKey: key });
|
|
81
|
+
onActiveKey(key);
|
|
82
|
+
},
|
|
83
|
+
...collapseParams
|
|
84
|
+
}
|
|
85
|
+
));
|
|
86
|
+
}, [isProductList, cartsMap, platform, collapseParams, state == null ? void 0 : state.products]);
|
|
84
87
|
};
|
|
85
88
|
var Cart_default = Cart;
|
|
@@ -48,7 +48,7 @@ var import_utils6 = require("../../utils");
|
|
|
48
48
|
var import_notAvailable = __toESM(require("../notAvailable"));
|
|
49
49
|
var import_dayjs = __toESM(require("dayjs"));
|
|
50
50
|
var AddSerivce = (props) => {
|
|
51
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l
|
|
51
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
52
52
|
const { onEdit, state, dispatch, renderMode = "current" } = props;
|
|
53
53
|
const [loading, setLoading] = (0, import_react.useState)(true);
|
|
54
54
|
const context = (0, import_useEngineContext.default)();
|
|
@@ -70,6 +70,17 @@ var AddSerivce = (props) => {
|
|
|
70
70
|
const [currentProduct, setCurrentProduct] = (0, import_react.useState)(null);
|
|
71
71
|
const stateRef = (0, import_react.useRef)(state);
|
|
72
72
|
stateRef.current = state;
|
|
73
|
+
(0, import_react.useEffect)(() => {
|
|
74
|
+
return () => {
|
|
75
|
+
Object.values(debounceTimersRef.current).forEach((timer) => {
|
|
76
|
+
if (timer) clearTimeout(timer);
|
|
77
|
+
});
|
|
78
|
+
debounceTimersRef.current = {};
|
|
79
|
+
};
|
|
80
|
+
}, []);
|
|
81
|
+
const pendingCacheValuesRef = (0, import_react.useRef)({});
|
|
82
|
+
const clickCountRef = (0, import_react.useRef)({});
|
|
83
|
+
const debounceTimersRef = (0, import_react.useRef)({});
|
|
73
84
|
const menuList = (0, import_react.useMemo)(() => {
|
|
74
85
|
var _a2, _b2, _c2;
|
|
75
86
|
return ((_c2 = (_b2 = (_a2 = state == null ? void 0 : state.bookingConfig) == null ? void 0 : _a2.config) == null ? void 0 : _b2.menu_list_tab) == null ? void 0 : _c2.menu_list) || [];
|
|
@@ -202,16 +213,199 @@ var AddSerivce = (props) => {
|
|
|
202
213
|
}
|
|
203
214
|
});
|
|
204
215
|
};
|
|
216
|
+
const executeCacheValues = (0, import_ahooks.useMemoizedFn)((productId, originalCacheValues, item, originalCallback) => {
|
|
217
|
+
const clickCount = clickCountRef.current[productId] || 1;
|
|
218
|
+
const finalCacheValues = {
|
|
219
|
+
...originalCacheValues,
|
|
220
|
+
quantity: clickCount
|
|
221
|
+
};
|
|
222
|
+
delete pendingCacheValuesRef.current[productId];
|
|
223
|
+
delete clickCountRef.current[productId];
|
|
224
|
+
delete debounceTimersRef.current[productId];
|
|
225
|
+
originalCallback(finalCacheValues, "", item, true);
|
|
226
|
+
});
|
|
227
|
+
const debouncedExecuteCacheValues = (0, import_ahooks.useMemoizedFn)((productId, cacheValues, item, callback) => {
|
|
228
|
+
if (debounceTimersRef.current[productId]) {
|
|
229
|
+
clearTimeout(debounceTimersRef.current[productId]);
|
|
230
|
+
}
|
|
231
|
+
debounceTimersRef.current[productId] = setTimeout(() => {
|
|
232
|
+
executeCacheValues(productId, cacheValues, item, callback);
|
|
233
|
+
}, 0);
|
|
234
|
+
});
|
|
205
235
|
const handleSelectProduct = (0, import_ahooks.useMemoizedFn)(
|
|
206
236
|
(item, type = "select") => {
|
|
237
|
+
var _a2, _b2, _c2;
|
|
207
238
|
const isSession = (0, import_utils2.isSessionProduct)(item);
|
|
208
239
|
const isEject = (0, import_utils2.getIsEject)(item, type);
|
|
209
240
|
const isOnlySession = (0, import_utils2.getIsOnlySession)(item);
|
|
210
241
|
let lock = false;
|
|
242
|
+
let cacheValues = null;
|
|
211
243
|
if (isEject) {
|
|
212
244
|
setCurrentProduct(item);
|
|
213
245
|
} else {
|
|
214
246
|
setCurrentProduct(null);
|
|
247
|
+
if (!isSession && (0, import_utils4.isNormalProductByDurationSchedule)(item)) {
|
|
248
|
+
cacheValues = {
|
|
249
|
+
bundle: [],
|
|
250
|
+
key: item.id,
|
|
251
|
+
option: [],
|
|
252
|
+
product_id: item.id,
|
|
253
|
+
product_variant_id: 0,
|
|
254
|
+
quantity: 1,
|
|
255
|
+
rowKey: item.id,
|
|
256
|
+
session: null,
|
|
257
|
+
unique: "08974625397",
|
|
258
|
+
_originalItem: item
|
|
259
|
+
// 保存原始商品信息
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
const callback = async (e, extension_type, detail, notShowToast) => {
|
|
264
|
+
var _a3, _b3, _c3, _d2, _e2, _f2, _g2;
|
|
265
|
+
setCurrentProduct(null);
|
|
266
|
+
if (lock) {
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
269
|
+
lock = true;
|
|
270
|
+
setTimeout(() => {
|
|
271
|
+
lock = false;
|
|
272
|
+
}, 2e3);
|
|
273
|
+
if (!isBooking4) {
|
|
274
|
+
const data = await createBookingData({
|
|
275
|
+
product: { ...detail || item, _params: e }
|
|
276
|
+
});
|
|
277
|
+
createBooking({ booking: data });
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
280
|
+
const _detail = detail || item;
|
|
281
|
+
const other = JSON.parse(JSON.stringify(e));
|
|
282
|
+
other.session = e.session;
|
|
283
|
+
let cacheItem = {
|
|
284
|
+
..._detail,
|
|
285
|
+
product_id: item.id,
|
|
286
|
+
_id: (0, import_utils.getUniqueId)(),
|
|
287
|
+
_key: e.key,
|
|
288
|
+
_extend: {
|
|
289
|
+
start_date: state.date.value,
|
|
290
|
+
quantity: (e == null ? void 0 : e.quantity) || 1,
|
|
291
|
+
price: _detail.price,
|
|
292
|
+
product_name: item.title,
|
|
293
|
+
other
|
|
294
|
+
},
|
|
295
|
+
new: 1
|
|
296
|
+
};
|
|
297
|
+
let _total = (0, import_utils2.getProductTotalPrice)(cacheItem);
|
|
298
|
+
cacheItem._extend.total = _total;
|
|
299
|
+
cacheItem._extend.origin_total = _total;
|
|
300
|
+
const _isEdit = !!state.service.cacheItem;
|
|
301
|
+
if (_isEdit) {
|
|
302
|
+
cacheItem._id = (_a3 = state.service.cacheItem) == null ? void 0 : _a3._id;
|
|
303
|
+
cacheItem.new = 0;
|
|
304
|
+
}
|
|
305
|
+
if (renderMode === "current") {
|
|
306
|
+
cacheItem.currentDefaultTime = state.date.value.format("HH:mm");
|
|
307
|
+
}
|
|
308
|
+
cacheItem = (0, import_utils3.getProductExtend)({
|
|
309
|
+
cacheItem,
|
|
310
|
+
state,
|
|
311
|
+
isDisabledTime: true
|
|
312
|
+
});
|
|
313
|
+
if (state.renderType === "eventBooking") {
|
|
314
|
+
cacheItem.autoClose = false;
|
|
315
|
+
}
|
|
316
|
+
if (cacheItem.autoClose) {
|
|
317
|
+
cacheItem.autoClose = false;
|
|
318
|
+
cacheItem._serviceKey = (0, import_utils6.genServiceKey)(cacheItem);
|
|
319
|
+
let { list: _list, quantity } = (0, import_utils6.addService)(
|
|
320
|
+
[...state.service.value],
|
|
321
|
+
cacheItem,
|
|
322
|
+
state
|
|
323
|
+
);
|
|
324
|
+
if (!notShowToast) {
|
|
325
|
+
(_b3 = Toast == null ? void 0 : Toast.success) == null ? void 0 : _b3.call(
|
|
326
|
+
Toast,
|
|
327
|
+
/* @__PURE__ */ import_react.default.createElement("div", { className: "add-toast-wrap" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "add-toast-title" }, cacheItem.title), /* @__PURE__ */ import_react.default.createElement("div", { className: "add-toast-quantity" }, import_utils.locales.getText("pisell2.ticket-booking.in-cart")(
|
|
328
|
+
quantity || 1
|
|
329
|
+
)))
|
|
330
|
+
);
|
|
331
|
+
}
|
|
332
|
+
(0, import_utils6.addServiceScroll)(e.rowKey, cacheItem);
|
|
333
|
+
try {
|
|
334
|
+
if (((_g2 = (_f2 = (_e2 = (_d2 = (_c3 = context.appHelper.utils.store) == null ? void 0 : _c3.getState) == null ? void 0 : _d2.call(_c3)) == null ? void 0 : _e2.global) == null ? void 0 : _f2.globalConfig) == null ? void 0 : _g2.id) === 2155) {
|
|
335
|
+
const val = _list == null ? void 0 : _list.map((s) => {
|
|
336
|
+
return {
|
|
337
|
+
product_id: s == null ? void 0 : s.product_id,
|
|
338
|
+
detailId: s == null ? void 0 : s.id,
|
|
339
|
+
detailProductId: s == null ? void 0 : s.product_id,
|
|
340
|
+
product_name: s == null ? void 0 : s.title,
|
|
341
|
+
price: s == null ? void 0 : s.price,
|
|
342
|
+
_id: s == null ? void 0 : s._id,
|
|
343
|
+
_key: s == null ? void 0 : s._key,
|
|
344
|
+
_serviceKey: s == null ? void 0 : s._serviceKey
|
|
345
|
+
};
|
|
346
|
+
});
|
|
347
|
+
const sendData = {
|
|
348
|
+
product_id: item == null ? void 0 : item.id,
|
|
349
|
+
detailId: _detail == null ? void 0 : _detail.id,
|
|
350
|
+
detailProductId: _detail == null ? void 0 : _detail.product_id,
|
|
351
|
+
product_name: item == null ? void 0 : item.title,
|
|
352
|
+
price: _detail == null ? void 0 : _detail.price,
|
|
353
|
+
serviceVal: val
|
|
354
|
+
};
|
|
355
|
+
(0, import_utils.sendWarningLog)({
|
|
356
|
+
title: "addService",
|
|
357
|
+
content: [
|
|
358
|
+
{ key: "添加数据", value: JSON.stringify(sendData) },
|
|
359
|
+
{
|
|
360
|
+
key: "日期",
|
|
361
|
+
value: (0, import_dayjs.default)().format("YYYY-MM-DD HH:mm:ss")
|
|
362
|
+
}
|
|
363
|
+
]
|
|
364
|
+
});
|
|
365
|
+
}
|
|
366
|
+
} catch (error) {
|
|
367
|
+
}
|
|
368
|
+
dispatch({
|
|
369
|
+
type: "setService",
|
|
370
|
+
payload: {
|
|
371
|
+
addModal: false,
|
|
372
|
+
value: _list,
|
|
373
|
+
edit: true,
|
|
374
|
+
changeService: false
|
|
375
|
+
}
|
|
376
|
+
});
|
|
377
|
+
} else {
|
|
378
|
+
dispatch({
|
|
379
|
+
type: "setService",
|
|
380
|
+
payload: {
|
|
381
|
+
editModal: true,
|
|
382
|
+
cacheItem,
|
|
383
|
+
addModal: !cacheItem.autoClose,
|
|
384
|
+
changeService: false
|
|
385
|
+
}
|
|
386
|
+
});
|
|
387
|
+
onEdit == null ? void 0 : onEdit(cacheItem);
|
|
388
|
+
}
|
|
389
|
+
};
|
|
390
|
+
if (cacheValues) {
|
|
391
|
+
const productId = item.id.toString();
|
|
392
|
+
if (pendingCacheValuesRef.current[productId]) {
|
|
393
|
+
clickCountRef.current[productId] = (clickCountRef.current[productId] || 1) + 1;
|
|
394
|
+
} else {
|
|
395
|
+
pendingCacheValuesRef.current[productId] = cacheValues;
|
|
396
|
+
clickCountRef.current[productId] = 1;
|
|
397
|
+
}
|
|
398
|
+
const cacheItem = (0, import_utils6.createSimpleCacheItem)(item, cacheValues, state);
|
|
399
|
+
const detail = (_a2 = state.service.value) == null ? void 0 : _a2.find((val) => (0, import_utils6.isSameProduct)(val, cacheItem));
|
|
400
|
+
const originalQuantity = ((_b2 = detail == null ? void 0 : detail._extend) == null ? void 0 : _b2.quantity) || 0;
|
|
401
|
+
(_c2 = Toast == null ? void 0 : Toast.success) == null ? void 0 : _c2.call(
|
|
402
|
+
Toast,
|
|
403
|
+
/* @__PURE__ */ import_react.default.createElement("div", { className: "add-toast-wrap" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "add-toast-title" }, item.title), /* @__PURE__ */ import_react.default.createElement("div", { className: "add-toast-quantity" }, import_utils.locales.getText("pisell2.ticket-booking.in-cart")(
|
|
404
|
+
(clickCountRef.current[productId] || 1) + originalQuantity
|
|
405
|
+
)))
|
|
406
|
+
);
|
|
407
|
+
debouncedExecuteCacheValues(productId, cacheValues, item, callback);
|
|
408
|
+
return;
|
|
215
409
|
}
|
|
216
410
|
state.action({
|
|
217
411
|
type: "pisell1.handleOpenProductModal",
|
|
@@ -233,131 +427,7 @@ var AddSerivce = (props) => {
|
|
|
233
427
|
onCancel: () => {
|
|
234
428
|
setCurrentProduct(null);
|
|
235
429
|
},
|
|
236
|
-
callback
|
|
237
|
-
var _a2, _b2, _c2, _d2, _e2, _f2, _g2;
|
|
238
|
-
setCurrentProduct(null);
|
|
239
|
-
if (lock) {
|
|
240
|
-
return;
|
|
241
|
-
}
|
|
242
|
-
lock = true;
|
|
243
|
-
setTimeout(() => {
|
|
244
|
-
lock = false;
|
|
245
|
-
}, 2e3);
|
|
246
|
-
if (!isBooking4) {
|
|
247
|
-
const data = await createBookingData({
|
|
248
|
-
product: { ...detail || item, _params: e }
|
|
249
|
-
});
|
|
250
|
-
createBooking({ booking: data });
|
|
251
|
-
return;
|
|
252
|
-
}
|
|
253
|
-
const _detail = detail || item;
|
|
254
|
-
const other = JSON.parse(JSON.stringify(e));
|
|
255
|
-
other.session = e.session;
|
|
256
|
-
let cacheItem = {
|
|
257
|
-
..._detail,
|
|
258
|
-
product_id: item.id,
|
|
259
|
-
_id: (0, import_utils.getUniqueId)(),
|
|
260
|
-
_key: e.key,
|
|
261
|
-
_extend: {
|
|
262
|
-
start_date: state.date.value,
|
|
263
|
-
quantity: (e == null ? void 0 : e.quantity) || 1,
|
|
264
|
-
price: _detail.price,
|
|
265
|
-
product_name: item.title,
|
|
266
|
-
other
|
|
267
|
-
},
|
|
268
|
-
new: 1
|
|
269
|
-
};
|
|
270
|
-
let _total = (0, import_utils2.getProductTotalPrice)(cacheItem);
|
|
271
|
-
cacheItem._extend.total = _total;
|
|
272
|
-
cacheItem._extend.origin_total = _total;
|
|
273
|
-
const _isEdit = !!state.service.cacheItem;
|
|
274
|
-
if (_isEdit) {
|
|
275
|
-
cacheItem._id = (_a2 = state.service.cacheItem) == null ? void 0 : _a2._id;
|
|
276
|
-
cacheItem.new = 0;
|
|
277
|
-
}
|
|
278
|
-
if (renderMode === "current") {
|
|
279
|
-
cacheItem.currentDefaultTime = state.date.value.format("HH:mm");
|
|
280
|
-
}
|
|
281
|
-
cacheItem = (0, import_utils3.getProductExtend)({
|
|
282
|
-
cacheItem,
|
|
283
|
-
state,
|
|
284
|
-
isDisabledTime: true
|
|
285
|
-
});
|
|
286
|
-
if (state.renderType === "eventBooking") {
|
|
287
|
-
cacheItem.autoClose = false;
|
|
288
|
-
}
|
|
289
|
-
if (cacheItem.autoClose) {
|
|
290
|
-
cacheItem.autoClose = false;
|
|
291
|
-
cacheItem._serviceKey = (0, import_utils6.genServiceKey)(cacheItem);
|
|
292
|
-
let { list: _list, quantity } = (0, import_utils6.addService)(
|
|
293
|
-
[...state.service.value],
|
|
294
|
-
cacheItem,
|
|
295
|
-
state
|
|
296
|
-
);
|
|
297
|
-
(_b2 = Toast == null ? void 0 : Toast.success) == null ? void 0 : _b2.call(
|
|
298
|
-
Toast,
|
|
299
|
-
/* @__PURE__ */ import_react.default.createElement("div", { className: "add-toast-wrap" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "add-toast-title" }, cacheItem.title), /* @__PURE__ */ import_react.default.createElement("div", { className: "add-toast-quantity" }, import_utils.locales.getText("pisell2.ticket-booking.in-cart")(
|
|
300
|
-
quantity || 1
|
|
301
|
-
)))
|
|
302
|
-
);
|
|
303
|
-
(0, import_utils6.addServiceScroll)(e.rowKey, cacheItem);
|
|
304
|
-
try {
|
|
305
|
-
if (((_g2 = (_f2 = (_e2 = (_d2 = (_c2 = context.appHelper.utils.store) == null ? void 0 : _c2.getState) == null ? void 0 : _d2.call(_c2)) == null ? void 0 : _e2.global) == null ? void 0 : _f2.globalConfig) == null ? void 0 : _g2.id) === 2155) {
|
|
306
|
-
const val = _list == null ? void 0 : _list.map((s) => {
|
|
307
|
-
return {
|
|
308
|
-
product_id: s == null ? void 0 : s.product_id,
|
|
309
|
-
detailId: s == null ? void 0 : s.id,
|
|
310
|
-
detailProductId: s == null ? void 0 : s.product_id,
|
|
311
|
-
product_name: s == null ? void 0 : s.title,
|
|
312
|
-
price: s == null ? void 0 : s.price,
|
|
313
|
-
_id: s == null ? void 0 : s._id,
|
|
314
|
-
_key: s == null ? void 0 : s._key,
|
|
315
|
-
_serviceKey: s == null ? void 0 : s._serviceKey
|
|
316
|
-
};
|
|
317
|
-
});
|
|
318
|
-
const sendData = {
|
|
319
|
-
product_id: item == null ? void 0 : item.id,
|
|
320
|
-
detailId: _detail == null ? void 0 : _detail.id,
|
|
321
|
-
detailProductId: _detail == null ? void 0 : _detail.product_id,
|
|
322
|
-
product_name: item == null ? void 0 : item.title,
|
|
323
|
-
price: _detail == null ? void 0 : _detail.price,
|
|
324
|
-
serviceVal: val
|
|
325
|
-
};
|
|
326
|
-
(0, import_utils.sendWarningLog)({
|
|
327
|
-
title: "addService",
|
|
328
|
-
content: [
|
|
329
|
-
{ key: "添加数据", value: JSON.stringify(sendData) },
|
|
330
|
-
{
|
|
331
|
-
key: "日期",
|
|
332
|
-
value: (0, import_dayjs.default)().format("YYYY-MM-DD HH:mm:ss")
|
|
333
|
-
}
|
|
334
|
-
]
|
|
335
|
-
});
|
|
336
|
-
}
|
|
337
|
-
} catch (error) {
|
|
338
|
-
}
|
|
339
|
-
dispatch({
|
|
340
|
-
type: "setService",
|
|
341
|
-
payload: {
|
|
342
|
-
addModal: false,
|
|
343
|
-
value: _list,
|
|
344
|
-
edit: true,
|
|
345
|
-
changeService: false
|
|
346
|
-
}
|
|
347
|
-
});
|
|
348
|
-
} else {
|
|
349
|
-
dispatch({
|
|
350
|
-
type: "setService",
|
|
351
|
-
payload: {
|
|
352
|
-
editModal: true,
|
|
353
|
-
cacheItem,
|
|
354
|
-
addModal: !cacheItem.autoClose,
|
|
355
|
-
changeService: false
|
|
356
|
-
}
|
|
357
|
-
});
|
|
358
|
-
onEdit == null ? void 0 : onEdit(cacheItem);
|
|
359
|
-
}
|
|
360
|
-
}
|
|
430
|
+
callback
|
|
361
431
|
});
|
|
362
432
|
}
|
|
363
433
|
);
|
|
@@ -415,7 +485,6 @@ var AddSerivce = (props) => {
|
|
|
415
485
|
}
|
|
416
486
|
return null;
|
|
417
487
|
}, [
|
|
418
|
-
(_n = (_m = state.service) == null ? void 0 : _m.cacheItem) == null ? void 0 : _n.autoClose,
|
|
419
488
|
state.service.addModal,
|
|
420
489
|
import_utils.locales,
|
|
421
490
|
renderList,
|