@pisell/private-materials 6.5.26 → 6.6.1
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 +2 -2
- package/build/lowcode/preview.js +146 -165
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +9 -9
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +9 -9
- package/es/components/appointmentBooking/components/Cart/Item/index.d.ts +1 -1
- package/es/components/appointmentBooking/components/Cart/Item/index.js +4 -2
- package/es/components/appointmentBooking/components/ConfirmInformation/index.js +273 -76
- package/es/components/appointmentBooking/components/ConfirmInformation/index.less +15 -0
- package/es/components/appointmentBooking/hooks.d.ts +1 -0
- package/es/components/appointmentBooking/hooks.js +30 -30
- package/es/components/appointmentBooking/locales.d.ts +3 -0
- package/es/components/appointmentBooking/locales.js +9 -6
- package/es/components/booking/components/actionButtons/index.js +34 -20
- package/es/components/booking/components/customSelect/index.js +1 -1
- package/es/components/booking/components/footer/amount.js +25 -8
- package/es/components/booking/components/footer/index.js +66 -33
- package/es/components/booking/components/footer/utils.d.ts +7 -0
- package/es/components/booking/components/footer/utils.js +126 -99
- package/es/components/booking/components/voucher/index.js +25 -9
- package/es/components/booking/dashboard/serve.js +1 -6
- package/es/components/booking/forms/footer.js +24 -10
- package/es/components/booking/forms/sendModal/useSendModal.d.ts +1 -1
- package/es/components/booking/forms/serve.js +2 -12
- package/es/components/booking/hooks/useQuotation.js +69 -21
- package/es/components/booking/info/client/index.js +28 -13
- package/es/components/booking/info/client/serve.js +2 -11
- package/es/components/booking/info/clientVariant/hooks/useClientFn.js +16 -10
- package/es/components/booking/info/clientVariant/vertical/SelectDrawer.js +10 -2
- package/es/components/booking/info/clientVariant/vertical/index.js +1 -1
- package/es/components/booking/info/hooks/useHolderConfig.d.ts +1 -0
- package/es/components/booking/info/hooks/useHolderConfig.js +9 -2
- package/es/components/booking/info/main.js +3 -2
- package/es/components/booking/info/model.js +5 -0
- package/es/components/booking/info/pet/serve.js +1 -6
- package/es/components/booking/info/service/Lists.d.ts +1 -1
- package/es/components/booking/info/service/Lists.js +10 -4
- package/es/components/booking/info/service/addTimeModal/serve.js +1 -11
- package/es/components/booking/info/service/serve.d.ts +14 -0
- package/es/components/booking/info/service/serve.js +25 -18
- package/es/components/booking/info/service2/Group/utils.js +2 -0
- package/es/components/booking/info/service2/utils.d.ts +1 -33
- package/es/components/booking/info/service2/utils.js +92 -56
- package/es/components/booking/info/utils.js +5 -0
- package/es/components/booking/info2/cartClientCard/index.js +49 -9
- package/es/components/booking/info2/index.js +3 -2
- package/es/components/booking/info2/serve.js +1 -6
- package/es/components/booking/info2/service/addService/index.js +146 -89
- package/es/components/booking/info2/service/addService/utils.d.ts +8 -0
- package/es/components/booking/info2/service/addService/utils.js +83 -14
- package/es/components/booking/info2/service/contactInfoMode/index.d.ts +2 -0
- package/es/components/booking/info2/service/contactInfoMode/index.js +94 -0
- package/es/components/booking/info2/service/editService/Holder/index.d.ts +12 -0
- package/es/components/booking/info2/service/editService/Holder/index.js +193 -0
- package/es/components/booking/info2/service/editService/Holder/index.less +63 -0
- package/es/components/booking/info2/service/editService/index.js +313 -57
- package/es/components/booking/info2/utilsByBooking.js +19 -14
- package/es/components/booking/locales.d.ts +36 -0
- package/es/components/booking/locales.js +48 -3
- package/es/components/booking/model.d.ts +4 -0
- package/es/components/booking/model.js +3 -0
- package/es/components/booking/utils/confirmHolderModal.d.ts +13 -0
- package/es/components/booking/utils/confirmHolderModal.js +318 -0
- package/es/components/booking/utils/confirmHolderModal.less +40 -0
- package/es/components/booking/utils/selectHolderModal.d.ts +24 -0
- package/es/components/booking/utils/selectHolderModal.js +407 -0
- package/es/components/booking/utils.d.ts +16 -7
- package/es/components/booking/utils.js +26 -37
- package/es/components/checkout/PaymentModal.js +61 -30
- package/es/components/checkout/components/CashPaymentModule/index.js +1 -7
- package/es/components/checkout/components/ScrollableList/index.js +0 -1
- package/es/components/checkout/locales.d.ts +3 -0
- package/es/components/checkout/locales.js +3 -0
- package/es/components/eftposPay/linkly/index.js +64 -2
- package/es/components/eftposPay/tyro/index.js +12 -0
- package/es/components/list/List.js +3 -0
- package/es/components/pay/toB/components/MX51/index.js +14 -44
- package/es/components/pay/toB/types/index.d.ts +0 -12
- package/es/components/pay/toB/types/index.js +0 -4
- package/es/components/shoppingCart/components/Cart/Product.js +6 -3
- package/es/components/shoppingCart/type.d.ts +1 -0
- package/es/components/ticketBooking/components/ProductDisplayAdapter/index.less +0 -12
- package/es/components/ticketBooking/components/addServiceVariant/MultiDayTimeSelectModal.d.ts +18 -0
- package/es/components/ticketBooking/components/addServiceVariant/MultiDayTimeSelectModal.js +119 -0
- package/es/components/ticketBooking/components/addServiceVariant/MultiDayTimeSelectModal.less +0 -0
- package/es/components/ticketBooking/components/addServiceVariant/addService.d.ts +0 -2
- package/es/components/ticketBooking/components/addServiceVariant/addService.js +419 -794
- package/es/components/ticketBooking/components/addServiceVariant/index.d.ts +0 -2
- package/es/components/ticketBooking/components/addServiceVariant/index.js +4 -4
- package/es/components/ticketBooking/components/addServiceVariant/utils.js +1 -2
- package/es/components/ticketBooking/components/menuBar/index.js +109 -12
- package/es/components/ticketBooking/components/ticketBooking/index.d.ts +2 -4
- package/es/components/ticketBooking/components/ticketBooking/index.js +32 -61
- package/es/components/ticketBooking/components/ticketBooking/index.less +2 -1
- package/es/components/ticketBooking/components/timeBar/index.d.ts +0 -1
- package/es/components/ticketBooking/components/timeBar/index.js +1 -4
- package/es/components/ticketBooking/hooks/pisellos/useProducts.d.ts +0 -4
- package/es/components/ticketBooking/hooks/pisellos/useProducts.js +122 -170
- package/es/components/ticketBooking/index.d.ts +0 -1
- package/es/components/ticketBooking/index.js +0 -2
- package/es/components/ticketBooking/serve.js +17 -119
- package/es/components/ticketBooking/utils/index.d.ts +7 -1
- package/es/components/ticketBooking/utils/index.js +44 -28
- package/es/hooks/useEngineContext.d.ts +0 -1
- package/es/hooks/useEngineContext.js +0 -7
- package/es/index.d.ts +4 -0
- package/es/index.js +5 -1
- package/es/plus/clientCard/locales.js +3 -3
- package/es/plus/clinetSearch/index.js +28 -30
- package/es/plus/clinetSearch/locales.d.ts +3 -0
- package/es/plus/clinetSearch/locales.js +7 -4
- package/es/plus/clinetSearch/types.d.ts +12 -0
- package/es/plus/contactInfo/components/Avatar/index.d.ts +10 -0
- package/es/plus/contactInfo/components/Avatar/index.js +30 -0
- package/es/plus/contactInfo/components/SwipeAction/index.d.ts +46 -0
- package/es/plus/contactInfo/components/SwipeAction/index.js +360 -0
- package/es/plus/contactInfo/components/SwipeAction/index.less +74 -0
- package/es/plus/contactInfo/index.d.ts +6 -0
- package/es/plus/contactInfo/index.js +198 -0
- package/es/plus/contactInfo/index.less +621 -0
- package/es/plus/contactInfo/locales.d.ts +15 -0
- package/es/plus/contactInfo/locales.js +14 -0
- package/es/plus/contactInfo/types.d.ts +91 -0
- package/es/plus/contactInfo/types.js +1 -0
- package/es/plus/contactInfo/utils.d.ts +7 -0
- package/es/plus/contactInfo/utils.js +50 -0
- package/es/plus/contactInfoModal/ContactInfoContent.d.ts +3 -0
- package/es/plus/contactInfoModal/ContactInfoContent.js +74 -0
- package/es/plus/contactInfoModal/index.d.ts +41 -0
- package/es/plus/contactInfoModal/index.js +155 -0
- package/es/plus/contactInfoModal/index.less +19 -0
- package/es/plus/contactInfoModal/locales.d.ts +66 -0
- package/es/plus/contactInfoModal/locales.js +65 -0
- package/es/plus/productSelect/ProductCard/SkuCard/components/CardWrapper/index.js +1 -1
- package/es/plus/productSelect/ProductCard/index.js +1 -1
- package/es/plus/selectHolder/components/ErrorTip/index.d.ts +3 -0
- package/es/plus/selectHolder/components/ErrorTip/index.js +14 -0
- package/es/plus/selectHolder/components/ErrorTip/index.less +51 -0
- package/es/plus/selectHolder/components/HolderItem/index.d.ts +6 -0
- package/es/plus/selectHolder/components/HolderItem/index.js +77 -0
- package/es/plus/selectHolder/components/HolderItem/index.less +105 -0
- package/es/plus/selectHolder/components/HolderList/index.d.ts +30 -0
- package/es/plus/selectHolder/components/HolderList/index.js +43 -0
- package/es/plus/selectHolder/index.d.ts +7 -0
- package/es/plus/selectHolder/index.js +273 -0
- package/es/plus/selectHolder/index.less +137 -0
- package/es/plus/selectHolder/locales.d.ts +24 -0
- package/es/plus/selectHolder/locales.js +29 -0
- package/es/plus/selectHolder/types.d.ts +104 -0
- package/es/plus/selectHolder/types.js +1 -0
- package/es/plus/selectHolder/utils.d.ts +9 -0
- package/es/plus/selectHolder/utils.js +16 -0
- package/es/pro/comprehensiveSearch/components/searchSection/locales.js +3 -3
- package/es/pro/comprehensiveSearch/locales.js +1 -1
- package/es/pro/multiDayTimeSelect/MultiDayTimeSelect.d.ts +9 -0
- package/es/pro/multiDayTimeSelect/MultiDayTimeSelect.js +357 -0
- package/es/pro/multiDayTimeSelect/MultiDayTimeSelect.less +8 -0
- package/es/pro/multiDayTimeSelect/index.d.ts +3 -0
- package/es/pro/multiDayTimeSelect/index.js +1 -0
- package/es/pro/multiDayTimeSelect/types.d.ts +28 -0
- package/es/pro/multiDayTimeSelect/types.js +1 -0
- package/es/pro/skuDetailModal/types.d.ts +1 -0
- package/lib/components/appointmentBooking/components/Cart/Item/index.d.ts +1 -1
- package/lib/components/appointmentBooking/components/Cart/Item/index.js +6 -3
- package/lib/components/appointmentBooking/components/ConfirmInformation/index.js +156 -13
- package/lib/components/appointmentBooking/components/ConfirmInformation/index.less +15 -0
- package/lib/components/appointmentBooking/hooks.d.ts +1 -0
- package/lib/components/appointmentBooking/hooks.js +73 -35
- package/lib/components/appointmentBooking/locales.d.ts +3 -0
- package/lib/components/appointmentBooking/locales.js +6 -3
- package/lib/components/booking/components/actionButtons/index.js +11 -2
- package/lib/components/booking/components/customSelect/index.js +1 -1
- package/lib/components/booking/components/footer/amount.js +23 -6
- package/lib/components/booking/components/footer/index.js +26 -5
- package/lib/components/booking/components/footer/utils.d.ts +7 -0
- package/lib/components/booking/components/footer/utils.js +120 -82
- package/lib/components/booking/components/voucher/index.js +10 -1
- package/lib/components/booking/dashboard/serve.js +1 -6
- package/lib/components/booking/forms/footer.js +29 -11
- package/lib/components/booking/forms/sendModal/useSendModal.d.ts +1 -1
- package/lib/components/booking/forms/serve.js +2 -12
- package/lib/components/booking/hooks/useQuotation.js +45 -13
- package/lib/components/booking/info/client/index.js +14 -1
- package/lib/components/booking/info/client/serve.js +2 -13
- package/lib/components/booking/info/clientVariant/hooks/useClientFn.js +7 -2
- package/lib/components/booking/info/clientVariant/vertical/SelectDrawer.js +11 -4
- package/lib/components/booking/info/clientVariant/vertical/index.js +34 -17
- package/lib/components/booking/info/hooks/useHolderConfig.d.ts +1 -0
- package/lib/components/booking/info/hooks/useHolderConfig.js +8 -3
- package/lib/components/booking/info/main.js +5 -4
- package/lib/components/booking/info/model.js +5 -0
- package/lib/components/booking/info/pet/serve.js +1 -6
- package/lib/components/booking/info/service/Lists.d.ts +1 -1
- package/lib/components/booking/info/service/Lists.js +5 -3
- package/lib/components/booking/info/service/addTimeModal/serve.js +1 -7
- package/lib/components/booking/info/service/serve.d.ts +14 -0
- package/lib/components/booking/info/service/serve.js +8 -17
- package/lib/components/booking/info/service2/Group/utils.js +2 -0
- package/lib/components/booking/info/service2/utils.d.ts +1 -33
- package/lib/components/booking/info/service2/utils.js +38 -29
- package/lib/components/booking/info/utils.js +4 -0
- package/lib/components/booking/info2/cartClientCard/index.js +34 -5
- package/lib/components/booking/info2/index.js +11 -5
- package/lib/components/booking/info2/serve.js +1 -6
- package/lib/components/booking/info2/service/addService/index.js +22 -3
- package/lib/components/booking/info2/service/addService/utils.d.ts +8 -0
- package/lib/components/booking/info2/service/addService/utils.js +48 -11
- package/lib/components/booking/info2/service/contactInfoMode/index.d.ts +2 -0
- package/lib/components/booking/info2/service/contactInfoMode/index.js +111 -0
- package/lib/components/booking/info2/service/editService/Holder/index.d.ts +12 -0
- package/lib/components/booking/info2/service/editService/Holder/index.js +199 -0
- package/lib/components/booking/info2/service/editService/Holder/index.less +63 -0
- package/lib/components/booking/info2/service/editService/index.js +254 -32
- package/lib/components/booking/info2/utilsByBooking.js +26 -19
- package/lib/components/booking/locales.d.ts +36 -0
- package/lib/components/booking/locales.js +42 -3
- package/lib/components/booking/model.d.ts +4 -0
- package/lib/components/booking/model.js +3 -0
- package/lib/components/booking/utils/confirmHolderModal.d.ts +13 -0
- package/lib/components/booking/utils/confirmHolderModal.js +253 -0
- package/lib/components/booking/utils/confirmHolderModal.less +40 -0
- package/lib/components/booking/utils/selectHolderModal.d.ts +24 -0
- package/lib/components/booking/utils/selectHolderModal.js +319 -0
- package/lib/components/booking/utils.d.ts +16 -7
- package/lib/components/booking/utils.js +18 -21
- package/lib/components/checkout/PaymentModal.js +41 -18
- package/lib/components/checkout/components/CashPaymentModule/index.js +1 -7
- package/lib/components/checkout/components/ScrollableList/index.js +0 -1
- package/lib/components/checkout/locales.d.ts +3 -0
- package/lib/components/checkout/locales.js +3 -0
- package/lib/components/eftposPay/linkly/index.js +31 -1
- package/lib/components/eftposPay/tyro/index.js +12 -0
- package/lib/components/list/List.js +3 -0
- package/lib/components/pay/toB/components/MX51/index.js +12 -37
- package/lib/components/pay/toB/types/index.d.ts +0 -12
- package/lib/components/shoppingCart/components/Cart/Product.js +7 -3
- package/lib/components/shoppingCart/type.d.ts +1 -0
- package/lib/components/ticketBooking/components/ProductDisplayAdapter/index.less +0 -12
- package/lib/components/ticketBooking/components/addServiceVariant/MultiDayTimeSelectModal.d.ts +18 -0
- package/lib/components/ticketBooking/components/addServiceVariant/MultiDayTimeSelectModal.js +118 -0
- package/lib/components/ticketBooking/components/addServiceVariant/MultiDayTimeSelectModal.less +0 -0
- package/lib/components/ticketBooking/components/addServiceVariant/addService.d.ts +0 -2
- package/lib/components/ticketBooking/components/addServiceVariant/addService.js +279 -313
- package/lib/components/ticketBooking/components/addServiceVariant/index.d.ts +0 -2
- package/lib/components/ticketBooking/components/addServiceVariant/index.js +5 -3
- package/lib/components/ticketBooking/components/addServiceVariant/utils.js +1 -2
- package/lib/components/ticketBooking/components/menuBar/index.js +42 -6
- package/lib/components/ticketBooking/components/ticketBooking/index.d.ts +2 -4
- package/lib/components/ticketBooking/components/ticketBooking/index.js +12 -49
- package/lib/components/ticketBooking/components/ticketBooking/index.less +2 -1
- package/lib/components/ticketBooking/components/timeBar/index.d.ts +0 -1
- package/lib/components/ticketBooking/components/timeBar/index.js +1 -3
- package/lib/components/ticketBooking/hooks/pisellos/useProducts.d.ts +0 -4
- package/lib/components/ticketBooking/hooks/pisellos/useProducts.js +69 -98
- package/lib/components/ticketBooking/index.d.ts +0 -1
- package/lib/components/ticketBooking/index.js +0 -2
- package/lib/components/ticketBooking/serve.js +15 -117
- package/lib/components/ticketBooking/utils/index.d.ts +7 -1
- package/lib/components/ticketBooking/utils/index.js +29 -23
- package/lib/hooks/useEngineContext.d.ts +0 -1
- package/lib/hooks/useEngineContext.js +2 -10
- package/lib/index.d.ts +4 -0
- package/lib/index.js +12 -0
- package/lib/plus/clientCard/locales.js +3 -3
- package/lib/plus/clinetSearch/index.js +17 -8
- package/lib/plus/clinetSearch/locales.d.ts +3 -0
- package/lib/plus/clinetSearch/locales.js +7 -4
- package/lib/plus/clinetSearch/types.d.ts +12 -0
- package/lib/plus/contactInfo/components/Avatar/index.d.ts +10 -0
- package/lib/plus/contactInfo/components/Avatar/index.js +56 -0
- package/lib/plus/contactInfo/components/SwipeAction/index.d.ts +46 -0
- package/lib/plus/contactInfo/components/SwipeAction/index.js +373 -0
- package/lib/plus/contactInfo/components/SwipeAction/index.less +74 -0
- package/lib/plus/contactInfo/index.d.ts +6 -0
- package/lib/plus/contactInfo/index.js +226 -0
- package/lib/plus/contactInfo/index.less +621 -0
- package/lib/plus/contactInfo/locales.d.ts +15 -0
- package/lib/plus/contactInfo/locales.js +38 -0
- package/lib/plus/contactInfo/types.d.ts +91 -0
- package/lib/plus/contactInfo/types.js +17 -0
- package/lib/plus/contactInfo/utils.d.ts +7 -0
- package/lib/plus/contactInfo/utils.js +64 -0
- package/lib/plus/contactInfoModal/ContactInfoContent.d.ts +3 -0
- package/lib/plus/contactInfoModal/ContactInfoContent.js +129 -0
- package/lib/plus/contactInfoModal/index.d.ts +41 -0
- package/lib/plus/contactInfoModal/index.js +139 -0
- package/lib/plus/contactInfoModal/index.less +19 -0
- package/lib/plus/contactInfoModal/locales.d.ts +66 -0
- package/lib/plus/contactInfoModal/locales.js +89 -0
- package/lib/plus/productSelect/ProductCard/SkuCard/components/CardWrapper/index.js +1 -1
- package/lib/plus/productSelect/ProductCard/index.js +1 -1
- package/lib/plus/selectHolder/components/ErrorTip/index.d.ts +3 -0
- package/lib/plus/selectHolder/components/ErrorTip/index.js +30 -0
- package/lib/plus/selectHolder/components/ErrorTip/index.less +51 -0
- package/lib/plus/selectHolder/components/HolderItem/index.d.ts +6 -0
- package/lib/plus/selectHolder/components/HolderItem/index.js +101 -0
- package/lib/plus/selectHolder/components/HolderItem/index.less +105 -0
- package/lib/plus/selectHolder/components/HolderList/index.d.ts +30 -0
- package/lib/plus/selectHolder/components/HolderList/index.js +63 -0
- package/lib/plus/selectHolder/index.d.ts +7 -0
- package/lib/plus/selectHolder/index.js +223 -0
- package/lib/plus/selectHolder/index.less +137 -0
- package/lib/plus/selectHolder/locales.d.ts +24 -0
- package/lib/plus/selectHolder/locales.js +47 -0
- package/lib/plus/selectHolder/types.d.ts +104 -0
- package/lib/plus/selectHolder/types.js +17 -0
- package/lib/plus/selectHolder/utils.d.ts +9 -0
- package/lib/plus/selectHolder/utils.js +34 -0
- package/lib/pro/comprehensiveSearch/components/searchSection/locales.js +3 -3
- package/lib/pro/comprehensiveSearch/locales.js +1 -1
- package/lib/pro/multiDayTimeSelect/MultiDayTimeSelect.d.ts +9 -0
- package/lib/pro/multiDayTimeSelect/MultiDayTimeSelect.js +304 -0
- package/lib/pro/multiDayTimeSelect/MultiDayTimeSelect.less +8 -0
- package/lib/pro/multiDayTimeSelect/index.d.ts +3 -0
- package/lib/{hooks/printer.js → pro/multiDayTimeSelect/index.js} +6 -31
- package/lib/pro/multiDayTimeSelect/types.d.ts +28 -0
- package/lib/pro/multiDayTimeSelect/types.js +17 -0
- package/lib/pro/skuDetailModal/types.d.ts +1 -0
- package/lowcode/contact-info/fragments/cardStyle.ts +68 -0
- package/lowcode/contact-info/fragments/nameStyle.ts +33 -0
- package/lowcode/contact-info/fragments/pisellAvatar.ts +103 -0
- package/lowcode/contact-info/fragments/textStyle.ts +33 -0
- package/lowcode/contact-info/meta.ts +199 -0
- package/lowcode/contact-info-modal/meta.ts +98 -0
- package/lowcode/event-select-holder/meta.ts +2 -2
- package/lowcode/select-holder/meta.ts +220 -0
- package/lowcode/select-holder/snippets.ts +41 -0
- package/package.json +13 -11
- package/es/hooks/printer.d.ts +0 -4
- package/es/hooks/printer.js +0 -35
- package/lib/hooks/printer.d.ts +0 -4
|
@@ -20,21 +20,24 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
20
20
|
import { getUniqueId, locales, sendWarningLog } from '@pisell/utils';
|
|
21
21
|
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
22
22
|
import { useMemoizedFn } from 'ahooks';
|
|
23
|
-
import useEngineContext
|
|
24
|
-
import { isSessionProduct, request, getProductTotalPrice, getIsEject, getIsOnlySession } from "../../../booking/utils";
|
|
25
|
-
import { getProductExtend } from "../../../booking/info2/service/addService/utils";
|
|
26
|
-
import { holderId,
|
|
23
|
+
import useEngineContext from "../../../../hooks/useEngineContext";
|
|
24
|
+
import { isSessionProduct, request, getProductTotalPrice, getIsEject, getIsOnlySession, isWalkIn } from "../../../booking/utils";
|
|
25
|
+
import { getMultiDay, getProductExtend, isMultiDayProduct } from "../../../booking/info2/service/addService/utils";
|
|
26
|
+
import { holderId, isNormalProductByDurationSchedule } from "../../../booking/info/service2/utils";
|
|
27
27
|
import { isBooking4Shop } from "../../../booking/info/utils";
|
|
28
28
|
import { useService } from "../../../booking/info/service/serviceManager";
|
|
29
29
|
import ProductDisplayAdapter, { resolveProductDisplayConfig } from "../ProductDisplayAdapter";
|
|
30
30
|
import "./index.less";
|
|
31
|
-
import { addService, addServiceScroll, genServiceKey, getIsShowNumber, isSameProduct } from "../../utils";
|
|
31
|
+
import { addService, addServiceScroll, createSimpleCacheItem, genHolderKey, genServiceKey, getIsShowNumber, isSameProduct } from "../../utils";
|
|
32
32
|
import NotAvailable from "../notAvailable";
|
|
33
33
|
import dayjs from 'dayjs';
|
|
34
34
|
import { useProducts } from "../../hooks/pisellos";
|
|
35
35
|
import { createCacheItem, genValues, isBundle, isOption, setHandleSetService } from "./utils";
|
|
36
36
|
import { useToast } from '@pisell/materials';
|
|
37
37
|
import { useIsActive } from "../../context/IsActiveContext";
|
|
38
|
+
import { concatBookings, createBookingItemsByGroup } from "../../../booking/info/service2/Group/utils";
|
|
39
|
+
import MultiDayTimeSelectModal from "./MultiDayTimeSelectModal";
|
|
40
|
+
import { selectHolderModal, SelectHolderModal } from "../../../booking/utils/selectHolderModal";
|
|
38
41
|
var productListLayout = {
|
|
39
42
|
grid: true,
|
|
40
43
|
config: '12:12'
|
|
@@ -48,19 +51,15 @@ var productListSetting = {
|
|
|
48
51
|
isStock: 0
|
|
49
52
|
};
|
|
50
53
|
var AddSerivce = function AddSerivce(props) {
|
|
51
|
-
var _context$appHelper, _context$appHelper$ge, _context$appHelper$ut, _context$appHelper$ut2, _context$appHelper$ut3, _state$
|
|
54
|
+
var _context$appHelper, _context$appHelper$ge, _context$appHelper$ut, _context$appHelper$ut2, _context$appHelper$ut3, _state$bookingConfig2, _state$client2;
|
|
52
55
|
var onEdit = props.onEdit,
|
|
53
56
|
state = props.state,
|
|
54
57
|
dispatch = props.dispatch,
|
|
55
58
|
_props$renderMode = props.renderMode,
|
|
56
59
|
renderMode = _props$renderMode === void 0 ? 'current' : _props$renderMode,
|
|
57
|
-
onPrerenderComplete = props.onPrerenderComplete,
|
|
58
|
-
onGetProductsReady = props.onGetProductsReady,
|
|
59
60
|
productDisplayConfig = props.productDisplayConfig;
|
|
60
61
|
var context = useEngineContext();
|
|
61
|
-
var platform = usePlatform();
|
|
62
62
|
var notAvailableRef = useRef(null);
|
|
63
|
-
var isLoadedServiceRef = useRef(false);
|
|
64
63
|
request.setRequest(context.appHelper.utils.request);
|
|
65
64
|
var isActive = useIsActive();
|
|
66
65
|
var Toast = useToast();
|
|
@@ -81,43 +80,24 @@ var AddSerivce = function AddSerivce(props) {
|
|
|
81
80
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
82
81
|
firstLoading = _useState4[0],
|
|
83
82
|
setFirstLoading = _useState4[1];
|
|
83
|
+
var _useState5 = useState(false),
|
|
84
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
85
|
+
multiDayModalOpen = _useState6[0],
|
|
86
|
+
setMultiDayModalOpen = _useState6[1];
|
|
87
|
+
var _useState7 = useState(false),
|
|
88
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
89
|
+
multiDayModalLoading = _useState8[0],
|
|
90
|
+
setMultiDayModalLoading = _useState8[1];
|
|
91
|
+
var _useState9 = useState(null),
|
|
92
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
93
|
+
pendingMultiDayData = _useState10[0],
|
|
94
|
+
setPendingMultiDayData = _useState10[1];
|
|
84
95
|
var stateRef = useRef(state);
|
|
85
96
|
stateRef.current = state;
|
|
86
|
-
var prerenderCompletedRef = useRef(false);
|
|
87
|
-
var latestServiceValueRef = useRef((state === null || state === void 0 || (_state$service = state.service) === null || _state$service === void 0 ? void 0 : _state$service.value) || []);
|
|
88
|
-
var lastOperationTimeRef = useRef(0);
|
|
89
|
-
var isInFastClickMode = function isInFastClickMode() {
|
|
90
|
-
var now = Date.now();
|
|
91
|
-
return now - lastOperationTimeRef.current < 2000;
|
|
92
|
-
};
|
|
93
|
-
var getCurrentServiceValue = function getCurrentServiceValue() {
|
|
94
|
-
if (isInFastClickMode()) {
|
|
95
|
-
var _stateRef$current;
|
|
96
|
-
return latestServiceValueRef.current || ((_stateRef$current = stateRef.current) === null || _stateRef$current === void 0 || (_stateRef$current = _stateRef$current.service) === null || _stateRef$current === void 0 ? void 0 : _stateRef$current.value) || [];
|
|
97
|
-
} else {
|
|
98
|
-
var _state$service2;
|
|
99
|
-
var stateValue = (state === null || state === void 0 || (_state$service2 = state.service) === null || _state$service2 === void 0 ? void 0 : _state$service2.value) || [];
|
|
100
|
-
latestServiceValueRef.current = null;
|
|
101
|
-
return stateValue;
|
|
102
|
-
}
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
// useEffect(() => {
|
|
106
|
-
// if (!isInFastClickMode()) {
|
|
107
|
-
// latestServiceValueRef.current = null;
|
|
108
|
-
// }
|
|
109
|
-
// }, [state?.service?.value]);
|
|
110
|
-
|
|
111
97
|
var _useProducts = useProducts(notAvailableRef),
|
|
112
98
|
getProducts = _useProducts.getProducts,
|
|
113
99
|
products = _useProducts.products,
|
|
114
|
-
loading = _useProducts.loading
|
|
115
|
-
getScheduleTimePoints = _useProducts.getScheduleTimePoints;
|
|
116
|
-
useEffect(function () {
|
|
117
|
-
if (onGetProductsReady && getProducts) {
|
|
118
|
-
onGetProductsReady(getProducts);
|
|
119
|
-
}
|
|
120
|
-
}, []);
|
|
100
|
+
loading = _useProducts.loading;
|
|
121
101
|
useEffect(function () {
|
|
122
102
|
var timer = setTimeout(function () {
|
|
123
103
|
setFirstLoading(false);
|
|
@@ -136,12 +116,6 @@ var AddSerivce = function AddSerivce(props) {
|
|
|
136
116
|
debounceTimersRef.current = {};
|
|
137
117
|
};
|
|
138
118
|
}, []);
|
|
139
|
-
useEffect(function () {
|
|
140
|
-
if (!loading && !prerenderCompletedRef.current) {
|
|
141
|
-
onPrerenderComplete === null || onPrerenderComplete === void 0 || onPrerenderComplete();
|
|
142
|
-
prerenderCompletedRef.current = true;
|
|
143
|
-
}
|
|
144
|
-
}, [loading]);
|
|
145
119
|
|
|
146
120
|
// 处理商品添加后的列表归位
|
|
147
121
|
useEffect(function () {
|
|
@@ -171,30 +145,23 @@ var AddSerivce = function AddSerivce(props) {
|
|
|
171
145
|
return ((_state$client = state.client) === null || _state$client === void 0 || (_state$client = _state$client.value) === null || _state$client === void 0 ? void 0 : _state$client.id) || undefined;
|
|
172
146
|
}, [(_state$client2 = state.client) === null || _state$client2 === void 0 || (_state$client2 = _state$client2.value) === null || _state$client2 === void 0 ? void 0 : _state$client2.id]);
|
|
173
147
|
var scanAddService = useMemoizedFn(function (list, code) {
|
|
174
|
-
|
|
175
|
-
var newService = _toConsumableArray(stateRef.current.service.value || []);
|
|
148
|
+
var newService = _toConsumableArray(state.service.value);
|
|
176
149
|
list.forEach(function (item) {
|
|
177
150
|
if (isBundle(item) || isOption(item)) {
|
|
178
151
|
handleSelectProduct(item);
|
|
179
152
|
return;
|
|
180
153
|
}
|
|
181
154
|
var values = genValues(item, code);
|
|
182
|
-
var cacheItem = createCacheItem(item, values,
|
|
155
|
+
var cacheItem = createCacheItem(item, values, state);
|
|
183
156
|
cacheItem._serviceKey = genServiceKey(cacheItem);
|
|
157
|
+
cacheItem._holderKey = genHolderKey(cacheItem);
|
|
184
158
|
cacheItem.autoClose = false;
|
|
185
|
-
var _addService = addService(_toConsumableArray(newService), cacheItem,
|
|
159
|
+
var _addService = addService(_toConsumableArray(newService), cacheItem, state),
|
|
186
160
|
_list = _addService.list,
|
|
187
161
|
quantity = _addService.quantity;
|
|
188
162
|
handleAddToast(cacheItem.title, quantity);
|
|
189
163
|
newService = _list;
|
|
190
164
|
});
|
|
191
|
-
|
|
192
|
-
// 立即更新 stateRef
|
|
193
|
-
stateRef.current = _objectSpread(_objectSpread({}, stateRef.current), {}, {
|
|
194
|
-
service: _objectSpread(_objectSpread({}, stateRef.current.service), {}, {
|
|
195
|
-
value: newService
|
|
196
|
-
})
|
|
197
|
-
});
|
|
198
165
|
dispatch({
|
|
199
166
|
type: 'setService',
|
|
200
167
|
payload: {
|
|
@@ -208,90 +175,6 @@ var AddSerivce = function AddSerivce(props) {
|
|
|
208
175
|
setHandleSetService(scanAddService);
|
|
209
176
|
}
|
|
210
177
|
}, [isActive]);
|
|
211
|
-
|
|
212
|
-
/*
|
|
213
|
-
const removeNotAvailableService = (list: any) => {
|
|
214
|
-
if (!stateRef.current?.service?.value?.length) return;
|
|
215
|
-
const listMap = list.reduce((acc: any, cur: any) => {
|
|
216
|
-
acc[cur.id] = cur;
|
|
217
|
-
return acc;
|
|
218
|
-
}, {});
|
|
219
|
-
const newValue = (stateRef.current?.service?.value || []).filter(
|
|
220
|
-
(item: any) => listMap[item.product_id]
|
|
221
|
-
);
|
|
222
|
-
dispatch({
|
|
223
|
-
type: 'setService',
|
|
224
|
-
payload: {
|
|
225
|
-
value: newValue,
|
|
226
|
-
edit: true,
|
|
227
|
-
},
|
|
228
|
-
});
|
|
229
|
-
};
|
|
230
|
-
const getServices = async (params?: any) => {
|
|
231
|
-
setLoading(true);
|
|
232
|
-
// 活动预约如果没有绑定商品id不查询
|
|
233
|
-
if (
|
|
234
|
-
state.renderType === 'eventBooking' &&
|
|
235
|
-
!state.eventOtherParams?.productIds?.length
|
|
236
|
-
) {
|
|
237
|
-
dispatch({
|
|
238
|
-
type: 'setService',
|
|
239
|
-
payload: {
|
|
240
|
-
services: [],
|
|
241
|
-
},
|
|
242
|
-
});
|
|
243
|
-
setLoading(false);
|
|
244
|
-
return;
|
|
245
|
-
}
|
|
246
|
-
let data = await getProductList({
|
|
247
|
-
skip: 1,
|
|
248
|
-
num: 500,
|
|
249
|
-
// extension_type: state.productExtensionType,
|
|
250
|
-
exclude_extension_type: [
|
|
251
|
-
'product_party',
|
|
252
|
-
'product_event',
|
|
253
|
-
'product_series_event',
|
|
254
|
-
'product_package_ticket',
|
|
255
|
-
'ticket',
|
|
256
|
-
'event_item',
|
|
257
|
-
],
|
|
258
|
-
with: ['category'],
|
|
259
|
-
open_quotation: 1,
|
|
260
|
-
with_schedule: 1,
|
|
261
|
-
with_count: ['bundleGroup', 'optionGroup'],
|
|
262
|
-
order_by_string: 'sort:desc',
|
|
263
|
-
status: 'published',
|
|
264
|
-
schedule_date: params?.schedule_date,
|
|
265
|
-
schedule_datetime: params?.schedule_datetime,
|
|
266
|
-
customer_id: params?.customer_id,
|
|
267
|
-
menu_list_ids: params?.menu_list_ids,
|
|
268
|
-
_config: {
|
|
269
|
-
fullResult: true,
|
|
270
|
-
customResponse: true,
|
|
271
|
-
},
|
|
272
|
-
});
|
|
273
|
-
setLoading(false);
|
|
274
|
-
if (data?.code === 607100) {
|
|
275
|
-
// 第一次加载时,或者之前有数据
|
|
276
|
-
if (!isLoadedServiceRef.current || state.service?.services?.length) {
|
|
277
|
-
notAvailableRef.current?.open();
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
// 只有自动获取列表的时候才设置商品, 手动点击添加按钮的时候不设置
|
|
281
|
-
if (!state.service.addModal) {
|
|
282
|
-
setDefaultService(data?.data?.list);
|
|
283
|
-
}
|
|
284
|
-
removeNotAvailableService(data?.data?.list);
|
|
285
|
-
isLoadedServiceRef.current = true;
|
|
286
|
-
dispatch({
|
|
287
|
-
type: 'setService',
|
|
288
|
-
payload: {
|
|
289
|
-
services: data?.data?.list || [],
|
|
290
|
-
},
|
|
291
|
-
});
|
|
292
|
-
};
|
|
293
|
-
*/
|
|
294
|
-
|
|
295
178
|
var handleAddToast = function handleAddToast(title, quantity) {
|
|
296
179
|
var _Toast$success;
|
|
297
180
|
Toast === null || Toast === void 0 || (_Toast$success = Toast.success) === null || _Toast$success === void 0 || _Toast$success.call(Toast, /*#__PURE__*/React.createElement("div", {
|
|
@@ -317,7 +200,6 @@ var AddSerivce = function AddSerivce(props) {
|
|
|
317
200
|
|
|
318
201
|
// 执行原始的回调函数
|
|
319
202
|
originalCallback(finalCacheValues, '', item, true);
|
|
320
|
-
lastOperationTimeRef.current = Date.now();
|
|
321
203
|
});
|
|
322
204
|
|
|
323
205
|
// 为每个商品单独创建防抖函数
|
|
@@ -327,375 +209,426 @@ var AddSerivce = function AddSerivce(props) {
|
|
|
327
209
|
clearTimeout(debounceTimersRef.current[productId]);
|
|
328
210
|
}
|
|
329
211
|
|
|
330
|
-
// 从 localStorage 获取防抖时间配置,默认为 0
|
|
331
|
-
var debounceTime = Number(localStorage.getItem('pisell_service_add_debounce_time')) || 0;
|
|
332
|
-
|
|
333
212
|
// 创建新的防抖定时器
|
|
334
213
|
debounceTimersRef.current[productId] = setTimeout(function () {
|
|
335
214
|
executeCacheValues(productId, cacheValues, item, callback);
|
|
336
|
-
},
|
|
337
|
-
});
|
|
338
|
-
|
|
339
|
-
// 检查资源可用性
|
|
340
|
-
var checkResourceAvailability = useMemoizedFn(function (item) {
|
|
341
|
-
if (!isNormalProductByDurationSchedule(item)) {
|
|
342
|
-
var _state$service3;
|
|
343
|
-
if (!Array.isArray((_state$service3 = state.service) === null || _state$service3 === void 0 ? void 0 : _state$service3.resourcesOrigin) || !state.service.resourcesOrigin.length) {
|
|
344
|
-
dispatch({
|
|
345
|
-
type: 'setService',
|
|
346
|
-
payload: _objectSpread(_objectSpread({}, stateRef.current.service), {}, {
|
|
347
|
-
reloadResourceModal: true
|
|
348
|
-
})
|
|
349
|
-
});
|
|
350
|
-
return false;
|
|
351
|
-
}
|
|
352
|
-
}
|
|
353
|
-
return true;
|
|
354
|
-
});
|
|
355
|
-
|
|
356
|
-
// 创建缓存项
|
|
357
|
-
var createCacheItemFromParams = useMemoizedFn(function (item, params, detail) {
|
|
358
|
-
var _detail = detail || item;
|
|
359
|
-
var other = JSON.parse(JSON.stringify(params));
|
|
360
|
-
other.session = params.session;
|
|
361
|
-
var cacheItem = _objectSpread(_objectSpread({}, _detail), {}, {
|
|
362
|
-
product_id: item.id,
|
|
363
|
-
_id: getUniqueId(),
|
|
364
|
-
_key: params.key,
|
|
365
|
-
_extend: {
|
|
366
|
-
start_date: state.date.value,
|
|
367
|
-
quantity: (params === null || params === void 0 ? void 0 : params.quantity) || 1,
|
|
368
|
-
price: _detail.price,
|
|
369
|
-
product_name: item.title,
|
|
370
|
-
other: other
|
|
371
|
-
},
|
|
372
|
-
new: 1
|
|
373
|
-
});
|
|
374
|
-
var _total = getProductTotalPrice(cacheItem);
|
|
375
|
-
cacheItem._extend.total = _total;
|
|
376
|
-
cacheItem._extend.origin_total = _total;
|
|
377
|
-
var _isEdit = !!state.service.cacheItem;
|
|
378
|
-
if (_isEdit) {
|
|
379
|
-
var _state$service$cacheI;
|
|
380
|
-
cacheItem._id = (_state$service$cacheI = state.service.cacheItem) === null || _state$service$cacheI === void 0 ? void 0 : _state$service$cacheI._id;
|
|
381
|
-
cacheItem.new = 0;
|
|
382
|
-
}
|
|
383
|
-
if (renderMode === 'current') {
|
|
384
|
-
cacheItem.currentDefaultTime = state.date.value.format('HH:mm');
|
|
385
|
-
}
|
|
386
|
-
var isNormalProduct = isNormalProductByDurationSchedule(item);
|
|
387
|
-
cacheItem = isNormalProduct ? _objectSpread(_objectSpread({}, cacheItem), {}, {
|
|
388
|
-
autoClose: true
|
|
389
|
-
}) : getProductExtend({
|
|
390
|
-
cacheItem: cacheItem,
|
|
391
|
-
state: state,
|
|
392
|
-
isDisabledTime: true
|
|
393
|
-
});
|
|
394
|
-
if (state.renderType === 'eventBooking') {
|
|
395
|
-
cacheItem.autoClose = false;
|
|
396
|
-
}
|
|
397
|
-
return cacheItem;
|
|
398
|
-
});
|
|
399
|
-
|
|
400
|
-
// 生成商品唯一标识
|
|
401
|
-
var getProductKey = useMemoizedFn(function (item, cacheItem) {
|
|
402
|
-
// 使用 _serviceKey 来区分同一商品的不同规格/选项
|
|
403
|
-
return cacheItem._serviceKey || "".concat(item.id, "_").concat(cacheItem._key);
|
|
215
|
+
}, 0);
|
|
404
216
|
});
|
|
405
217
|
|
|
406
|
-
//
|
|
407
|
-
var
|
|
408
|
-
var
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
return
|
|
412
|
-
|
|
413
|
-
return (existingService === null || existingService === void 0 || (_existingService$_ext = existingService._extend) === null || _existingService$_ext === void 0 ? void 0 : _existingService$_ext.quantity) || 0;
|
|
414
|
-
});
|
|
415
|
-
|
|
416
|
-
// 处理自动关闭的服务添加(带防抖)
|
|
417
|
-
var processAutoCloseService = useMemoizedFn(function (cacheItem, item, detail, notShowToast) {
|
|
418
|
-
console.time('processAutoCloseService2');
|
|
419
|
-
cacheItem.autoClose = false;
|
|
420
|
-
cacheItem._serviceKey = genServiceKey(cacheItem);
|
|
421
|
-
var productKey = getProductKey(item, cacheItem);
|
|
422
|
-
|
|
423
|
-
// 如果已经有待处理的同商品,增加点击次数
|
|
424
|
-
if (pendingCacheValuesRef.current[productKey]) {
|
|
425
|
-
clickCountRef.current[productKey] = (clickCountRef.current[productKey] || 1) + 1;
|
|
426
|
-
} else {
|
|
427
|
-
// 第一次点击,初始化数据
|
|
428
|
-
pendingCacheValuesRef.current[productKey] = {
|
|
429
|
-
cacheItem: cacheItem,
|
|
430
|
-
item: item,
|
|
431
|
-
detail: detail,
|
|
432
|
-
notShowToast: notShowToast
|
|
433
|
-
};
|
|
434
|
-
clickCountRef.current[productKey] = 1;
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
// 立即显示 toast
|
|
438
|
-
// 显示:购物车中已有数量 + 当前累积点击次数
|
|
439
|
-
if (!notShowToast) {
|
|
440
|
-
var originalQuantity = getServiceQuantity(cacheItem);
|
|
441
|
-
var currentClickCount = clickCountRef.current[productKey] || 1;
|
|
442
|
-
var totalQuantity = originalQuantity + currentClickCount;
|
|
443
|
-
handleAddToast(cacheItem.title, totalQuantity);
|
|
444
|
-
}
|
|
445
|
-
|
|
446
|
-
// 清除旧的防抖定时器
|
|
447
|
-
if (debounceTimersRef.current[productKey]) {
|
|
448
|
-
clearTimeout(debounceTimersRef.current[productKey]);
|
|
449
|
-
}
|
|
450
|
-
|
|
451
|
-
// 从 localStorage 获取防抖时间配置,默认为 0
|
|
452
|
-
var debounceTime = Number(localStorage.getItem('pisell_service_add_debounce_time')) || 0;
|
|
453
|
-
|
|
454
|
-
// 创建新的防抖定时器
|
|
455
|
-
debounceTimersRef.current[productKey] = setTimeout(function () {
|
|
456
|
-
executeServiceDispatch(productKey);
|
|
457
|
-
}, debounceTime);
|
|
458
|
-
console.timeEnd('processAutoCloseService2');
|
|
459
|
-
// 5ms
|
|
460
|
-
});
|
|
461
|
-
|
|
462
|
-
// 执行实际的 dispatch 操作
|
|
463
|
-
var executeServiceDispatch = useMemoizedFn(function (productKey) {
|
|
464
|
-
console.time('executeServiceDispatch');
|
|
465
|
-
console.time('executeServiceDispatch1');
|
|
466
|
-
var pendingData = pendingCacheValuesRef.current[productKey];
|
|
467
|
-
if (!pendingData) return;
|
|
468
|
-
var cacheItem = pendingData.cacheItem,
|
|
469
|
-
item = pendingData.item,
|
|
470
|
-
detail = pendingData.detail;
|
|
471
|
-
var clickCount = clickCountRef.current[productKey] || 1;
|
|
472
|
-
|
|
473
|
-
// 更新 quantity 为累积的点击次数
|
|
474
|
-
var finalCacheItem = _objectSpread(_objectSpread({}, cacheItem), {}, {
|
|
475
|
-
_extend: _objectSpread(_objectSpread({}, cacheItem._extend), {}, {
|
|
476
|
-
quantity: clickCount
|
|
477
|
-
})
|
|
478
|
-
});
|
|
479
|
-
console.timeEnd('executeServiceDispatch1');
|
|
480
|
-
console.time('executeServiceDispatch addService');
|
|
481
|
-
// 使用 stateRef 获取最新的 service.value,避免竞态条件
|
|
482
|
-
var _addService2 = addService(_toConsumableArray(stateRef.current.service.value || []), finalCacheItem, stateRef.current),
|
|
483
|
-
_list = _addService2.list,
|
|
484
|
-
quantity = _addService2.quantity;
|
|
485
|
-
console.timeEnd('executeServiceDispatch addService');
|
|
486
|
-
console.time('executeServiceDispatch2');
|
|
487
|
-
window.dispatchEvent(new CustomEvent('onAddNewService', {
|
|
488
|
-
detail: {
|
|
489
|
-
cacheItem: finalCacheItem
|
|
490
|
-
}
|
|
491
|
-
}));
|
|
492
|
-
console.timeEnd('executeServiceDispatch2');
|
|
493
|
-
console.time('executeServiceDispatch3');
|
|
494
|
-
// 2155 日志记录
|
|
495
|
-
logServiceForSpecificShop(item, detail, _list);
|
|
496
|
-
|
|
497
|
-
// 立即更新 stateRef,减少竞态窗口
|
|
498
|
-
stateRef.current = _objectSpread(_objectSpread({}, stateRef.current), {}, {
|
|
499
|
-
service: _objectSpread(_objectSpread({}, stateRef.current.service), {}, {
|
|
500
|
-
value: _list
|
|
501
|
-
})
|
|
502
|
-
});
|
|
503
|
-
dispatch({
|
|
504
|
-
type: 'setService',
|
|
505
|
-
payload: {
|
|
506
|
-
addModal: false,
|
|
507
|
-
value: _list,
|
|
508
|
-
edit: true,
|
|
509
|
-
changeService: false
|
|
510
|
-
}
|
|
511
|
-
});
|
|
512
|
-
console.timeEnd('executeServiceDispatch3');
|
|
513
|
-
console.timeEnd('executeServiceDispatch');
|
|
514
|
-
|
|
515
|
-
// 清理缓存数据
|
|
516
|
-
delete pendingCacheValuesRef.current[productKey];
|
|
517
|
-
delete clickCountRef.current[productKey];
|
|
518
|
-
delete debounceTimersRef.current[productKey];
|
|
519
|
-
});
|
|
520
|
-
|
|
521
|
-
// 处理手动编辑的服务
|
|
522
|
-
var processManualEditService = useMemoizedFn(function (cacheItem) {
|
|
523
|
-
var _window$openBookingEd, _window;
|
|
524
|
-
(_window$openBookingEd = (_window = window).openBookingEditModal) === null || _window$openBookingEd === void 0 || _window$openBookingEd.call(_window);
|
|
525
|
-
dispatch({
|
|
526
|
-
type: 'setService',
|
|
527
|
-
payload: {
|
|
528
|
-
editModal: true,
|
|
529
|
-
cacheItem: cacheItem,
|
|
530
|
-
addModal: !cacheItem.autoClose,
|
|
531
|
-
changeService: false
|
|
532
|
-
}
|
|
533
|
-
});
|
|
534
|
-
onEdit === null || onEdit === void 0 || onEdit(cacheItem);
|
|
535
|
-
});
|
|
536
|
-
|
|
537
|
-
// 特定商店的日志记录
|
|
538
|
-
var logServiceForSpecificShop = useMemoizedFn(function (item, detail, _list) {
|
|
539
|
-
try {
|
|
540
|
-
var _context$appHelper$ut4, _context$appHelper$ut5;
|
|
541
|
-
if (((_context$appHelper$ut4 = context.appHelper.utils.store) === null || _context$appHelper$ut4 === void 0 || (_context$appHelper$ut5 = _context$appHelper$ut4.getState) === null || _context$appHelper$ut5 === void 0 || (_context$appHelper$ut5 = _context$appHelper$ut5.call(_context$appHelper$ut4)) === null || _context$appHelper$ut5 === void 0 || (_context$appHelper$ut5 = _context$appHelper$ut5.global) === null || _context$appHelper$ut5 === void 0 || (_context$appHelper$ut5 = _context$appHelper$ut5.globalConfig) === null || _context$appHelper$ut5 === void 0 ? void 0 : _context$appHelper$ut5.id) === 2155) {
|
|
542
|
-
var val = _list === null || _list === void 0 ? void 0 : _list.map(function (s) {
|
|
543
|
-
return {
|
|
544
|
-
product_id: s === null || s === void 0 ? void 0 : s.product_id,
|
|
545
|
-
detailId: s === null || s === void 0 ? void 0 : s.id,
|
|
546
|
-
detailProductId: s === null || s === void 0 ? void 0 : s.product_id,
|
|
547
|
-
product_name: s === null || s === void 0 ? void 0 : s.title,
|
|
548
|
-
price: s === null || s === void 0 ? void 0 : s.price,
|
|
549
|
-
_id: s === null || s === void 0 ? void 0 : s._id,
|
|
550
|
-
_key: s === null || s === void 0 ? void 0 : s._key,
|
|
551
|
-
_serviceKey: s === null || s === void 0 ? void 0 : s._serviceKey
|
|
552
|
-
};
|
|
553
|
-
});
|
|
554
|
-
var sendData = {
|
|
555
|
-
product_id: item === null || item === void 0 ? void 0 : item.id,
|
|
556
|
-
detailId: detail === null || detail === void 0 ? void 0 : detail.id,
|
|
557
|
-
detailProductId: detail === null || detail === void 0 ? void 0 : detail.product_id,
|
|
558
|
-
product_name: item === null || item === void 0 ? void 0 : item.title,
|
|
559
|
-
price: detail === null || detail === void 0 ? void 0 : detail.price,
|
|
560
|
-
serviceVal: val
|
|
561
|
-
};
|
|
562
|
-
sendWarningLog({
|
|
563
|
-
title: 'addService',
|
|
564
|
-
content: [{
|
|
565
|
-
key: '添加数据',
|
|
566
|
-
value: JSON.stringify(sendData)
|
|
567
|
-
}, {
|
|
568
|
-
key: '日期',
|
|
569
|
-
value: dayjs().format('YYYY-MM-DD HH:mm:ss')
|
|
570
|
-
}]
|
|
571
|
-
});
|
|
572
|
-
}
|
|
573
|
-
} catch (error) {}
|
|
574
|
-
});
|
|
575
|
-
|
|
576
|
-
// 处理非 booking4 的预约创建
|
|
577
|
-
var handleBookingCreation = useMemoizedFn( /*#__PURE__*/function () {
|
|
578
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(item, params, detail) {
|
|
579
|
-
var data;
|
|
580
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
581
|
-
while (1) switch (_context.prev = _context.next) {
|
|
218
|
+
// 处理添加服务的逻辑(提取为独立函数,方便跨日商品确认后调用)
|
|
219
|
+
var processAddService = useMemoizedFn( /*#__PURE__*/function () {
|
|
220
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(item, _detail, e, notShowToast, startDate, endDate) {
|
|
221
|
+
var _state$client3, _state$bookingConfig3;
|
|
222
|
+
var other, cacheItem, _total, _isEdit, _stateRef$current$ser, isMultiDay, getMultiDayCacheItem, res, _state$bookingConfig4, _addService2, _list, quantity, _context$appHelper$ut4, _context$appHelper$ut5, val, sendData, _window$openBookingEd, _window;
|
|
223
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
224
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
582
225
|
case 0:
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
226
|
+
other = JSON.parse(JSON.stringify(e));
|
|
227
|
+
other.session = e.session;
|
|
228
|
+
cacheItem = _objectSpread(_objectSpread({}, _detail), {}, {
|
|
229
|
+
product_id: item.id,
|
|
230
|
+
_id: getUniqueId(),
|
|
231
|
+
_key: e.key,
|
|
232
|
+
_extend: {
|
|
233
|
+
start_date: startDate,
|
|
234
|
+
quantity: (e === null || e === void 0 ? void 0 : e.quantity) || 1,
|
|
235
|
+
price: _detail.price,
|
|
236
|
+
product_name: item.title,
|
|
237
|
+
other: other,
|
|
238
|
+
end_date: endDate
|
|
239
|
+
},
|
|
240
|
+
new: 1
|
|
588
241
|
});
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
242
|
+
_total = getProductTotalPrice(cacheItem); // 用于折扣 可修改
|
|
243
|
+
cacheItem._extend.total = _total;
|
|
244
|
+
// 用于储存原价
|
|
245
|
+
cacheItem._extend.origin_total = _total;
|
|
246
|
+
_isEdit = !!stateRef.current.service.cacheItem;
|
|
247
|
+
if (_isEdit) {
|
|
248
|
+
cacheItem._id = (_stateRef$current$ser = stateRef.current.service.cacheItem) === null || _stateRef$current$ser === void 0 ? void 0 : _stateRef$current$ser._id;
|
|
249
|
+
cacheItem.new = 0;
|
|
250
|
+
}
|
|
251
|
+
// 渲染到当前位置模式时,默认无资源 时间默认取顶部设置的时间
|
|
252
|
+
if (renderMode === 'current') {
|
|
253
|
+
// cacheItem._extend.resource = 0;
|
|
254
|
+
cacheItem.currentDefaultTime = stateRef.current.date.value.format('HH:mm');
|
|
255
|
+
}
|
|
256
|
+
cacheItem = getProductExtend({
|
|
257
|
+
cacheItem: cacheItem,
|
|
258
|
+
state: stateRef.current,
|
|
259
|
+
isDisabledTime: true
|
|
593
260
|
});
|
|
594
|
-
|
|
261
|
+
isMultiDay = isMultiDayProduct(cacheItem);
|
|
262
|
+
getMultiDayCacheItem = /*#__PURE__*/function () {
|
|
263
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(isConcatBookings) {
|
|
264
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
265
|
+
while (1) switch (_context.prev = _context.next) {
|
|
266
|
+
case 0:
|
|
267
|
+
_context.next = 2;
|
|
268
|
+
return getMultiDay({
|
|
269
|
+
start_date: cacheItem._extend.start_date,
|
|
270
|
+
end_date: cacheItem._extend.end_date,
|
|
271
|
+
state: stateRef.current,
|
|
272
|
+
cacheItem: cacheItem
|
|
273
|
+
});
|
|
274
|
+
case 2:
|
|
275
|
+
cacheItem = _context.sent;
|
|
276
|
+
cacheItem = createBookingItemsByGroup(cacheItem);
|
|
277
|
+
if (isConcatBookings) {
|
|
278
|
+
cacheItem = concatBookings(cacheItem);
|
|
279
|
+
}
|
|
280
|
+
case 5:
|
|
281
|
+
case "end":
|
|
282
|
+
return _context.stop();
|
|
283
|
+
}
|
|
284
|
+
}, _callee);
|
|
285
|
+
}));
|
|
286
|
+
return function getMultiDayCacheItem(_x7) {
|
|
287
|
+
return _ref2.apply(this, arguments);
|
|
288
|
+
};
|
|
289
|
+
}(); // 如果没有 holder 数据,且此时要求选择 holder,则弹出 holder 弹窗
|
|
290
|
+
if (!(!isNormalProductByDurationSchedule(cacheItem) && (!cacheItem._extend.holder_id || !cacheItem._extend.holder_id.length) && !isWalkIn((_state$client3 = state.client) === null || _state$client3 === void 0 || (_state$client3 = _state$client3.value) === null || _state$client3 === void 0 ? void 0 : _state$client3.id) && (state === null || state === void 0 || (_state$bookingConfig3 = state.bookingConfig) === null || _state$bookingConfig3 === void 0 || (_state$bookingConfig3 = _state$bookingConfig3.config) === null || _state$bookingConfig3 === void 0 || (_state$bookingConfig3 = _state$bookingConfig3.basic) === null || _state$bookingConfig3 === void 0 || (_state$bookingConfig3 = _state$bookingConfig3.appointment_subject) === null || _state$bookingConfig3 === void 0 ? void 0 : _state$bookingConfig3.show_hold_on_add_cart) !== 0)) {
|
|
291
|
+
_context2.next = 22;
|
|
292
|
+
break;
|
|
293
|
+
}
|
|
294
|
+
_context2.next = 15;
|
|
295
|
+
return handleAddHolder(cacheItem);
|
|
296
|
+
case 15:
|
|
297
|
+
res = _context2.sent;
|
|
298
|
+
if (!(res && res.length > 0)) {
|
|
299
|
+
_context2.next = 20;
|
|
300
|
+
break;
|
|
301
|
+
}
|
|
302
|
+
cacheItem._extend.holder_id = res;
|
|
303
|
+
_context2.next = 22;
|
|
304
|
+
break;
|
|
305
|
+
case 20:
|
|
306
|
+
if (!((state === null || state === void 0 || (_state$bookingConfig4 = state.bookingConfig) === null || _state$bookingConfig4 === void 0 || (_state$bookingConfig4 = _state$bookingConfig4.config) === null || _state$bookingConfig4 === void 0 || (_state$bookingConfig4 = _state$bookingConfig4.basic) === null || _state$bookingConfig4 === void 0 ? void 0 : _state$bookingConfig4.subject_require) === 'require')) {
|
|
307
|
+
_context2.next = 22;
|
|
308
|
+
break;
|
|
309
|
+
}
|
|
310
|
+
return _context2.abrupt("return");
|
|
311
|
+
case 22:
|
|
312
|
+
if (stateRef.current.renderType === 'eventBooking') {
|
|
313
|
+
cacheItem.autoClose = false;
|
|
314
|
+
}
|
|
315
|
+
if (!cacheItem.autoClose) {
|
|
316
|
+
_context2.next = 36;
|
|
317
|
+
break;
|
|
318
|
+
}
|
|
319
|
+
cacheItem.autoClose = false;
|
|
320
|
+
cacheItem._serviceKey = genServiceKey(cacheItem);
|
|
321
|
+
if (!isMultiDay) {
|
|
322
|
+
_context2.next = 29;
|
|
323
|
+
break;
|
|
324
|
+
}
|
|
325
|
+
_context2.next = 29;
|
|
326
|
+
return getMultiDayCacheItem();
|
|
327
|
+
case 29:
|
|
328
|
+
_addService2 = addService(_toConsumableArray(stateRef.current.service.value), cacheItem, stateRef.current, isMultiDay), _list = _addService2.list, quantity = _addService2.quantity;
|
|
329
|
+
if (!notShowToast) {
|
|
330
|
+
handleAddToast(cacheItem.title, quantity || 1);
|
|
331
|
+
}
|
|
332
|
+
window.dispatchEvent(new CustomEvent('onAddNewService', {
|
|
333
|
+
detail: {
|
|
334
|
+
cacheItem: cacheItem
|
|
335
|
+
}
|
|
336
|
+
}));
|
|
337
|
+
try {
|
|
338
|
+
if (((_context$appHelper$ut4 = context.appHelper.utils.store) === null || _context$appHelper$ut4 === void 0 || (_context$appHelper$ut5 = _context$appHelper$ut4.getState) === null || _context$appHelper$ut5 === void 0 || (_context$appHelper$ut5 = _context$appHelper$ut5.call(_context$appHelper$ut4)) === null || _context$appHelper$ut5 === void 0 || (_context$appHelper$ut5 = _context$appHelper$ut5.global) === null || _context$appHelper$ut5 === void 0 || (_context$appHelper$ut5 = _context$appHelper$ut5.globalConfig) === null || _context$appHelper$ut5 === void 0 ? void 0 : _context$appHelper$ut5.id) === 2155) {
|
|
339
|
+
val = _list === null || _list === void 0 ? void 0 : _list.map(function (s) {
|
|
340
|
+
return {
|
|
341
|
+
product_id: s === null || s === void 0 ? void 0 : s.product_id,
|
|
342
|
+
detailId: s === null || s === void 0 ? void 0 : s.id,
|
|
343
|
+
detailProductId: s === null || s === void 0 ? void 0 : s.product_id,
|
|
344
|
+
product_name: s === null || s === void 0 ? void 0 : s.title,
|
|
345
|
+
price: s === null || s === void 0 ? void 0 : s.price,
|
|
346
|
+
_id: s === null || s === void 0 ? void 0 : s._id,
|
|
347
|
+
_key: s === null || s === void 0 ? void 0 : s._key,
|
|
348
|
+
_serviceKey: s === null || s === void 0 ? void 0 : s._serviceKey
|
|
349
|
+
};
|
|
350
|
+
});
|
|
351
|
+
sendData = {
|
|
352
|
+
product_id: item === null || item === void 0 ? void 0 : item.id,
|
|
353
|
+
detailId: _detail === null || _detail === void 0 ? void 0 : _detail.id,
|
|
354
|
+
detailProductId: _detail === null || _detail === void 0 ? void 0 : _detail.product_id,
|
|
355
|
+
product_name: item === null || item === void 0 ? void 0 : item.title,
|
|
356
|
+
price: _detail === null || _detail === void 0 ? void 0 : _detail.price,
|
|
357
|
+
serviceVal: val
|
|
358
|
+
};
|
|
359
|
+
sendWarningLog({
|
|
360
|
+
title: 'addService',
|
|
361
|
+
content: [{
|
|
362
|
+
key: '添加数据',
|
|
363
|
+
value: JSON.stringify(sendData)
|
|
364
|
+
}, {
|
|
365
|
+
key: '日期',
|
|
366
|
+
value: dayjs().format('YYYY-MM-DD HH:mm:ss')
|
|
367
|
+
}]
|
|
368
|
+
});
|
|
369
|
+
}
|
|
370
|
+
} catch (error) {}
|
|
371
|
+
dispatch({
|
|
372
|
+
type: 'setService',
|
|
373
|
+
payload: {
|
|
374
|
+
addModal: false,
|
|
375
|
+
value: _list,
|
|
376
|
+
edit: true,
|
|
377
|
+
changeService: false
|
|
378
|
+
}
|
|
379
|
+
});
|
|
380
|
+
_context2.next = 42;
|
|
381
|
+
break;
|
|
382
|
+
case 36:
|
|
383
|
+
(_window$openBookingEd = (_window = window).openBookingEditModal) === null || _window$openBookingEd === void 0 || _window$openBookingEd.call(_window);
|
|
384
|
+
if (!isMultiDay) {
|
|
385
|
+
_context2.next = 40;
|
|
386
|
+
break;
|
|
387
|
+
}
|
|
388
|
+
_context2.next = 40;
|
|
389
|
+
return getMultiDayCacheItem(true);
|
|
390
|
+
case 40:
|
|
391
|
+
dispatch({
|
|
392
|
+
type: 'setService',
|
|
393
|
+
payload: {
|
|
394
|
+
editModal: true,
|
|
395
|
+
cacheItem: cacheItem,
|
|
396
|
+
addModal: !cacheItem.autoClose,
|
|
397
|
+
changeService: false
|
|
398
|
+
}
|
|
399
|
+
});
|
|
400
|
+
onEdit === null || onEdit === void 0 || onEdit(cacheItem);
|
|
401
|
+
case 42:
|
|
595
402
|
case "end":
|
|
596
|
-
return
|
|
403
|
+
return _context2.stop();
|
|
597
404
|
}
|
|
598
|
-
},
|
|
405
|
+
}, _callee2);
|
|
599
406
|
}));
|
|
600
|
-
return function (_x, _x2, _x3) {
|
|
407
|
+
return function (_x, _x2, _x3, _x4, _x5, _x6) {
|
|
601
408
|
return _ref.apply(this, arguments);
|
|
602
409
|
};
|
|
603
410
|
}());
|
|
604
411
|
|
|
605
|
-
//
|
|
606
|
-
var
|
|
607
|
-
var
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
processManualEditService(cacheItem);
|
|
612
|
-
}
|
|
613
|
-
});
|
|
614
|
-
|
|
615
|
-
// 直接添加商品(不打开弹窗)
|
|
616
|
-
var handleDirectAddService = useMemoizedFn( /*#__PURE__*/function () {
|
|
617
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(item) {
|
|
618
|
-
var cacheItem;
|
|
619
|
-
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
620
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
412
|
+
// 处理跨日商品时间选择确认
|
|
413
|
+
var handleMultiDayConfirm = useMemoizedFn( /*#__PURE__*/function () {
|
|
414
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(startDate, endDate, duration) {
|
|
415
|
+
var item, detail, e, notShowToast;
|
|
416
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
417
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
621
418
|
case 0:
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
_context2.next = 5;
|
|
419
|
+
if (pendingMultiDayData) {
|
|
420
|
+
_context3.next = 2;
|
|
625
421
|
break;
|
|
626
422
|
}
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
423
|
+
return _context3.abrupt("return");
|
|
424
|
+
case 2:
|
|
425
|
+
setMultiDayModalLoading(true);
|
|
426
|
+
_context3.prev = 3;
|
|
427
|
+
item = pendingMultiDayData.item, detail = pendingMultiDayData.detail, e = pendingMultiDayData.e, notShowToast = pendingMultiDayData.notShowToast; // 使用选择的时间继续处理添加服务逻辑
|
|
428
|
+
_context3.next = 7;
|
|
429
|
+
return processAddService(item, detail, e, notShowToast, startDate, endDate);
|
|
430
|
+
case 7:
|
|
431
|
+
setPendingMultiDayData(null);
|
|
432
|
+
setMultiDayModalOpen(false);
|
|
433
|
+
_context3.next = 14;
|
|
434
|
+
break;
|
|
435
|
+
case 11:
|
|
436
|
+
_context3.prev = 11;
|
|
437
|
+
_context3.t0 = _context3["catch"](3);
|
|
438
|
+
console.error('添加跨日商品失败:', _context3.t0);
|
|
439
|
+
case 14:
|
|
440
|
+
_context3.prev = 14;
|
|
441
|
+
setMultiDayModalLoading(false);
|
|
442
|
+
return _context3.finish(14);
|
|
443
|
+
case 17:
|
|
647
444
|
case "end":
|
|
648
|
-
return
|
|
445
|
+
return _context3.stop();
|
|
649
446
|
}
|
|
650
|
-
},
|
|
447
|
+
}, _callee3, null, [[3, 11, 14, 17]]);
|
|
651
448
|
}));
|
|
652
|
-
return function (
|
|
653
|
-
return
|
|
449
|
+
return function (_x8, _x9, _x10) {
|
|
450
|
+
return _ref3.apply(this, arguments);
|
|
654
451
|
};
|
|
655
452
|
}());
|
|
656
453
|
|
|
657
|
-
//
|
|
658
|
-
var
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
454
|
+
// 处理跨日商品时间选择取消
|
|
455
|
+
var handleMultiDayCancel = useMemoizedFn(function () {
|
|
456
|
+
setMultiDayModalOpen(false);
|
|
457
|
+
setPendingMultiDayData(null);
|
|
458
|
+
});
|
|
459
|
+
// 处理添加 holder 的函数
|
|
460
|
+
var handleAddHolder = useMemoizedFn( /*#__PURE__*/function () {
|
|
461
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(cacheItem) {
|
|
462
|
+
var _stateRef$current, _cacheItem$_extend;
|
|
463
|
+
var holderConfig, currentMaxSelectedCount, result;
|
|
464
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
465
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
466
|
+
case 0:
|
|
467
|
+
// 获取 maxSelectedCount
|
|
468
|
+
holderConfig = ((_stateRef$current = stateRef.current) === null || _stateRef$current === void 0 || (_stateRef$current = _stateRef$current.bookingConfig) === null || _stateRef$current === void 0 ? void 0 : _stateRef$current.holder) || {};
|
|
469
|
+
currentMaxSelectedCount = (holderConfig === null || holderConfig === void 0 ? void 0 : holderConfig.maxSelectedCount) || (cacheItem === null || cacheItem === void 0 || (_cacheItem$_extend = cacheItem._extend) === null || _cacheItem$_extend === void 0 ? void 0 : _cacheItem$_extend.quantity) || 1; // 调用 selectHolderModal,所有逻辑都在内部处理
|
|
470
|
+
_context4.next = 4;
|
|
471
|
+
return selectHolderModal({
|
|
472
|
+
state: stateRef.current,
|
|
473
|
+
dispatch: dispatch,
|
|
474
|
+
maxSelectedCount: currentMaxSelectedCount
|
|
475
|
+
});
|
|
476
|
+
case 4:
|
|
477
|
+
result = _context4.sent;
|
|
478
|
+
return _context4.abrupt("return", result);
|
|
479
|
+
case 6:
|
|
480
|
+
case "end":
|
|
481
|
+
return _context4.stop();
|
|
482
|
+
}
|
|
483
|
+
}, _callee4);
|
|
484
|
+
}));
|
|
485
|
+
return function (_x11) {
|
|
486
|
+
return _ref4.apply(this, arguments);
|
|
487
|
+
};
|
|
488
|
+
}());
|
|
489
|
+
var handleSelectProduct = useMemoizedFn(function (item) {
|
|
490
|
+
var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'select';
|
|
491
|
+
if (!isNormalProductByDurationSchedule(item)) {
|
|
492
|
+
var _state$service;
|
|
493
|
+
if (!Array.isArray((_state$service = state.service) === null || _state$service === void 0 ? void 0 : _state$service.resourcesOrigin) || !state.service.resourcesOrigin.length) {
|
|
494
|
+
dispatch({
|
|
495
|
+
type: 'setService',
|
|
496
|
+
payload: _objectSpread(_objectSpread({}, stateRef.current.service), {}, {
|
|
497
|
+
reloadResourceModal: true
|
|
498
|
+
})
|
|
499
|
+
});
|
|
500
|
+
return;
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
var isSession = isSessionProduct(item);
|
|
504
|
+
// 是否有单规格 组合规格 套餐, 或者session商品 如果没有不需要打开弹窗
|
|
505
|
+
var isEject = getIsEject(item, type);
|
|
506
|
+
var isOnlySession = getIsOnlySession(item);
|
|
507
|
+
var lock = false;
|
|
508
|
+
// 对于不需要打开弹窗的商品, 直接模拟数据, 不走弹窗
|
|
509
|
+
var cacheValues = null;
|
|
510
|
+
if (isEject) {
|
|
511
|
+
setCurrentProduct(item);
|
|
512
|
+
} else {
|
|
513
|
+
setCurrentProduct(null);
|
|
514
|
+
if ((item === null || item === void 0 ? void 0 : item.extension_type) === 'normal') {
|
|
515
|
+
cacheValues = {
|
|
516
|
+
bundle: [],
|
|
517
|
+
key: item.id,
|
|
518
|
+
option: [],
|
|
519
|
+
product_id: item.id,
|
|
520
|
+
product_variant_id: 0,
|
|
521
|
+
quantity: 1,
|
|
522
|
+
rowKey: item.id,
|
|
523
|
+
session: null,
|
|
524
|
+
unique: '08974625397',
|
|
525
|
+
_originalItem: item // 保存原始商品信息
|
|
526
|
+
};
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
var callback = /*#__PURE__*/function () {
|
|
530
|
+
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(e, extension_type, detail, notShowToast) {
|
|
531
|
+
var data, _detail, isMultiDay;
|
|
532
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
533
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
663
534
|
case 0:
|
|
535
|
+
debugger;
|
|
664
536
|
setCurrentProduct(null);
|
|
665
|
-
|
|
666
|
-
|
|
537
|
+
// 防止选择商品弹窗多次触发callback
|
|
538
|
+
if (!lock) {
|
|
539
|
+
_context5.next = 4;
|
|
667
540
|
break;
|
|
668
541
|
}
|
|
669
|
-
|
|
670
|
-
return handleBookingCreation(item, e, detail);
|
|
542
|
+
return _context5.abrupt("return");
|
|
671
543
|
case 4:
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
544
|
+
lock = true;
|
|
545
|
+
|
|
546
|
+
// 2秒后解除
|
|
547
|
+
setTimeout(function () {
|
|
548
|
+
lock = false;
|
|
549
|
+
}, 2000);
|
|
550
|
+
if (isBooking4) {
|
|
551
|
+
_context5.next = 12;
|
|
552
|
+
break;
|
|
553
|
+
}
|
|
554
|
+
_context5.next = 9;
|
|
555
|
+
return createBookingData({
|
|
556
|
+
product: _objectSpread(_objectSpread({}, detail || item), {}, {
|
|
557
|
+
_params: e
|
|
558
|
+
})
|
|
559
|
+
});
|
|
560
|
+
case 9:
|
|
561
|
+
data = _context5.sent;
|
|
562
|
+
// 创建预约
|
|
563
|
+
createBooking({
|
|
564
|
+
booking: data
|
|
565
|
+
});
|
|
566
|
+
return _context5.abrupt("return");
|
|
567
|
+
case 12:
|
|
568
|
+
// info2 addService 逻辑
|
|
569
|
+
_detail = detail || item; // 判断是否是跨日商品,如果是,先打开时间选择弹窗
|
|
570
|
+
isMultiDay = isMultiDayProduct(_detail || item);
|
|
571
|
+
if (!isMultiDay) {
|
|
572
|
+
_context5.next = 18;
|
|
573
|
+
break;
|
|
574
|
+
}
|
|
575
|
+
// 保存待处理的数据
|
|
576
|
+
setPendingMultiDayData({
|
|
577
|
+
item: item,
|
|
578
|
+
detail: _detail,
|
|
579
|
+
e: e,
|
|
580
|
+
notShowToast: notShowToast
|
|
581
|
+
});
|
|
582
|
+
// 打开时间选择弹窗
|
|
583
|
+
setMultiDayModalOpen(true);
|
|
584
|
+
return _context5.abrupt("return");
|
|
585
|
+
case 18:
|
|
586
|
+
_context5.next = 20;
|
|
587
|
+
return processAddService(item, _detail, e, notShowToast, state.date.value);
|
|
588
|
+
case 20:
|
|
676
589
|
case "end":
|
|
677
|
-
return
|
|
590
|
+
return _context5.stop();
|
|
678
591
|
}
|
|
679
|
-
},
|
|
592
|
+
}, _callee5);
|
|
680
593
|
}));
|
|
681
|
-
return function (
|
|
682
|
-
return
|
|
594
|
+
return function callback(_x12, _x13, _x14, _x15) {
|
|
595
|
+
return _ref5.apply(this, arguments);
|
|
683
596
|
};
|
|
684
597
|
}();
|
|
685
|
-
});
|
|
686
598
|
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
599
|
+
// 如果不需要打开弹窗, 直接添加数据
|
|
600
|
+
if (cacheValues) {
|
|
601
|
+
var _stateRef$current$ser2, _detail$_extend, _Toast$success2;
|
|
602
|
+
var productId = item.id.toString();
|
|
603
|
+
|
|
604
|
+
// 如果已经有pending的同商品,增加点击次数
|
|
605
|
+
if (pendingCacheValuesRef.current[productId]) {
|
|
606
|
+
clickCountRef.current[productId] = (clickCountRef.current[productId] || 1) + 1;
|
|
607
|
+
} else {
|
|
608
|
+
// 第一次点击,初始化数据
|
|
609
|
+
pendingCacheValuesRef.current[productId] = cacheValues;
|
|
610
|
+
clickCountRef.current[productId] = 1;
|
|
611
|
+
}
|
|
612
|
+
var cacheItem = createSimpleCacheItem(item, cacheValues, state);
|
|
613
|
+
var detail = (_stateRef$current$ser2 = stateRef.current.service.value) === null || _stateRef$current$ser2 === void 0 ? void 0 : _stateRef$current$ser2.find(function (val) {
|
|
614
|
+
return isSameProduct(val, cacheItem);
|
|
615
|
+
});
|
|
616
|
+
var originalQuantity = (detail === null || detail === void 0 || (_detail$_extend = detail._extend) === null || _detail$_extend === void 0 ? void 0 : _detail$_extend.quantity) || 0;
|
|
617
|
+
Toast === null || Toast === void 0 || (_Toast$success2 = Toast.success) === null || _Toast$success2 === void 0 || _Toast$success2.call(Toast, /*#__PURE__*/React.createElement("div", {
|
|
618
|
+
className: "add-toast-wrap"
|
|
619
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
620
|
+
className: "add-toast-title"
|
|
621
|
+
}, item.title), /*#__PURE__*/React.createElement("div", {
|
|
622
|
+
className: "add-toast-quantity"
|
|
623
|
+
}, locales.getText('pisell2.ticket-booking.in-cart')((clickCountRef.current[productId] || 1) + originalQuantity))));
|
|
624
|
+
debouncedExecuteCacheValues(productId, cacheValues, item, callback);
|
|
625
|
+
return;
|
|
626
|
+
}
|
|
693
627
|
state.action({
|
|
694
628
|
type: 'pisell1.handleOpenProductModal',
|
|
695
629
|
data: {
|
|
696
630
|
id: item.id,
|
|
697
631
|
date: state.date.value.format('YYYY-MM-DD'),
|
|
698
|
-
productDetail: item,
|
|
699
632
|
showConfig: {
|
|
700
633
|
option: true,
|
|
701
634
|
session: isSession,
|
|
@@ -711,315 +644,11 @@ var AddSerivce = function AddSerivce(props) {
|
|
|
711
644
|
onCancel: function onCancel() {
|
|
712
645
|
setCurrentProduct(null);
|
|
713
646
|
},
|
|
714
|
-
callback:
|
|
647
|
+
callback: callback
|
|
715
648
|
});
|
|
716
649
|
});
|
|
717
|
-
|
|
718
|
-
// 处理产品选择
|
|
719
|
-
var handleSelectProduct = useMemoizedFn( /*#__PURE__*/function () {
|
|
720
|
-
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(item) {
|
|
721
|
-
var type,
|
|
722
|
-
_args4 = arguments;
|
|
723
|
-
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
724
|
-
while (1) switch (_context4.prev = _context4.next) {
|
|
725
|
-
case 0:
|
|
726
|
-
type = _args4.length > 1 && _args4[1] !== undefined ? _args4[1] : 'select';
|
|
727
|
-
console.time("handleSelectProduct2");
|
|
728
|
-
console.log(item, 'handleSelectProduct');
|
|
729
|
-
// 检查资源可用性
|
|
730
|
-
console.time("checkResourceAvailability");
|
|
731
|
-
if (checkResourceAvailability(item)) {
|
|
732
|
-
_context4.next = 6;
|
|
733
|
-
break;
|
|
734
|
-
}
|
|
735
|
-
return _context4.abrupt("return");
|
|
736
|
-
case 6:
|
|
737
|
-
console.timeEnd("checkResourceAvailability");
|
|
738
|
-
// 0ms
|
|
739
|
-
// 如果不需要打开详情弹窗,直接添加服务
|
|
740
|
-
if (!(!item.isOpenDetailModal && item.cartDetailValue)) {
|
|
741
|
-
_context4.next = 11;
|
|
742
|
-
break;
|
|
743
|
-
}
|
|
744
|
-
_context4.next = 10;
|
|
745
|
-
return handleDirectAddService(item);
|
|
746
|
-
case 10:
|
|
747
|
-
return _context4.abrupt("return");
|
|
748
|
-
case 11:
|
|
749
|
-
// 打开产品选择弹窗
|
|
750
|
-
openProductModal(item, type);
|
|
751
|
-
case 12:
|
|
752
|
-
case "end":
|
|
753
|
-
return _context4.stop();
|
|
754
|
-
}
|
|
755
|
-
}, _callee4);
|
|
756
|
-
}));
|
|
757
|
-
return function (_x9) {
|
|
758
|
-
return _ref4.apply(this, arguments);
|
|
759
|
-
};
|
|
760
|
-
}());
|
|
761
|
-
/**
|
|
762
|
-
const handleSelectProduct = useMemoizedFn(
|
|
763
|
-
(item: any, type: 'select' | 'detail' = 'select') => {
|
|
764
|
-
console.log(item, 'handleSelectProduct');
|
|
765
|
-
if (!isNormalProductByDurationSchedule(item)) {
|
|
766
|
-
if (
|
|
767
|
-
!Array.isArray(state.service?.resourcesOrigin) ||
|
|
768
|
-
!state.service.resourcesOrigin.length
|
|
769
|
-
) {
|
|
770
|
-
dispatch({
|
|
771
|
-
type: 'setService',
|
|
772
|
-
payload: {
|
|
773
|
-
...stateRef.current.service,
|
|
774
|
-
reloadResourceModal: true,
|
|
775
|
-
},
|
|
776
|
-
});
|
|
777
|
-
return;
|
|
778
|
-
}
|
|
779
|
-
}
|
|
780
|
-
const isSession = isSessionProduct(item);
|
|
781
|
-
// 是否有单规格 组合规格 套餐, 或者session商品 如果没有不需要打开弹窗
|
|
782
|
-
const isEject = getIsEject(item, type);
|
|
783
|
-
const isOnlySession = getIsOnlySession(item);
|
|
784
|
-
let lock = false;
|
|
785
|
-
// 对于不需要打开弹窗的商品, 直接模拟数据, 不走弹窗
|
|
786
|
-
let cacheValues = null;
|
|
787
|
-
if (isEject) {
|
|
788
|
-
setCurrentProduct(item);
|
|
789
|
-
} else {
|
|
790
|
-
setCurrentProduct(null);
|
|
791
|
-
if (item?.extension_type === 'normal') {
|
|
792
|
-
cacheValues = {
|
|
793
|
-
bundle: [],
|
|
794
|
-
key: item.id,
|
|
795
|
-
option: [],
|
|
796
|
-
product_id: item.id,
|
|
797
|
-
product_variant_id: 0,
|
|
798
|
-
quantity: 1,
|
|
799
|
-
rowKey: item.id,
|
|
800
|
-
session: null,
|
|
801
|
-
unique: '08974625397',
|
|
802
|
-
_originalItem: item, // 保存原始商品信息
|
|
803
|
-
};
|
|
804
|
-
}
|
|
805
|
-
}
|
|
806
|
-
const callback = async (
|
|
807
|
-
e: any,
|
|
808
|
-
extension_type: any,
|
|
809
|
-
detail: any,
|
|
810
|
-
notShowToast: boolean
|
|
811
|
-
) => {
|
|
812
|
-
setCurrentProduct(null);
|
|
813
|
-
// 防止选择商品弹窗多次触发callback
|
|
814
|
-
// if (lock) {
|
|
815
|
-
// return;
|
|
816
|
-
// }
|
|
817
|
-
lock = true;
|
|
818
|
-
// 2秒后解除
|
|
819
|
-
setTimeout(() => {
|
|
820
|
-
lock = false;
|
|
821
|
-
}, 2000);
|
|
822
|
-
if (!isBooking4) {
|
|
823
|
-
// info1 addService 逻辑
|
|
824
|
-
// 预生成预约数据
|
|
825
|
-
const data = await createBookingData({
|
|
826
|
-
product: { ...(detail || item), _params: e },
|
|
827
|
-
});
|
|
828
|
-
// 创建预约
|
|
829
|
-
createBooking({ booking: data });
|
|
830
|
-
return;
|
|
831
|
-
}
|
|
832
|
-
const _currentItem = detail || item;
|
|
833
|
-
// info2 addService 逻辑
|
|
834
|
-
const _detail = _currentItem;
|
|
835
|
-
const other = JSON.parse(JSON.stringify(e));
|
|
836
|
-
other.session = e.session;
|
|
837
|
-
let cacheItem: any = {
|
|
838
|
-
..._detail,
|
|
839
|
-
product_id: _currentItem.id,
|
|
840
|
-
_id: getUniqueId(),
|
|
841
|
-
_key: e.key,
|
|
842
|
-
_extend: {
|
|
843
|
-
start_date: state.date.value,
|
|
844
|
-
quantity: e?.quantity || 1,
|
|
845
|
-
price: _detail.price,
|
|
846
|
-
product_name: _currentItem.title,
|
|
847
|
-
other,
|
|
848
|
-
},
|
|
849
|
-
new: 1,
|
|
850
|
-
};
|
|
851
|
-
let _total = getProductTotalPrice(cacheItem);
|
|
852
|
-
// 用于折扣 可修改
|
|
853
|
-
cacheItem._extend.total = _total;
|
|
854
|
-
// 用于储存原价
|
|
855
|
-
cacheItem._extend.origin_total = _total;
|
|
856
|
-
const _isEdit = !!state.service.cacheItem;
|
|
857
|
-
if (_isEdit) {
|
|
858
|
-
cacheItem._id = state.service.cacheItem?._id;
|
|
859
|
-
cacheItem.new = 0;
|
|
860
|
-
}
|
|
861
|
-
// 渲染到当前位置模式时,默认无资源 时间默认取顶部设置的时间
|
|
862
|
-
if (renderMode === 'current') {
|
|
863
|
-
// cacheItem._extend.resource = 0;
|
|
864
|
-
cacheItem.currentDefaultTime = state.date.value.format('HH:mm');
|
|
865
|
-
}
|
|
866
|
-
cacheItem = getProductExtend({
|
|
867
|
-
cacheItem,
|
|
868
|
-
state,
|
|
869
|
-
isDisabledTime: true,
|
|
870
|
-
});
|
|
871
|
-
if (state.renderType === 'eventBooking') {
|
|
872
|
-
cacheItem.autoClose = false;
|
|
873
|
-
}
|
|
874
|
-
if (cacheItem.autoClose) {
|
|
875
|
-
cacheItem.autoClose = false;
|
|
876
|
-
cacheItem._serviceKey = genServiceKey(cacheItem);
|
|
877
|
-
const val = getCurrentServiceValue();
|
|
878
|
-
let { list: _list, quantity } = addService(
|
|
879
|
-
[...val],
|
|
880
|
-
cacheItem,
|
|
881
|
-
stateRef.current
|
|
882
|
-
);
|
|
883
|
-
// 更新ref以确保后续快速操作时使用最新值
|
|
884
|
-
latestServiceValueRef.current = _list;
|
|
885
|
-
lastOperationTimeRef.current = Date.now();
|
|
886
|
-
if (!notShowToast) {
|
|
887
|
-
handleAddToast(cacheItem.title, quantity || 1);
|
|
888
|
-
}
|
|
889
|
-
window.dispatchEvent(
|
|
890
|
-
new CustomEvent('onAddNewService', {
|
|
891
|
-
detail: {
|
|
892
|
-
cacheItem,
|
|
893
|
-
},
|
|
894
|
-
})
|
|
895
|
-
);
|
|
896
|
-
try {
|
|
897
|
-
if (
|
|
898
|
-
context.appHelper.utils.store?.getState?.()?.global?.globalConfig
|
|
899
|
-
?.id === 2155
|
|
900
|
-
) {
|
|
901
|
-
const val = _list?.map((s) => {
|
|
902
|
-
return {
|
|
903
|
-
product_id: s?.product_id,
|
|
904
|
-
detailId: s?.id,
|
|
905
|
-
detailProductId: s?.product_id,
|
|
906
|
-
product_name: s?.title,
|
|
907
|
-
price: s?.price,
|
|
908
|
-
_id: s?._id,
|
|
909
|
-
_key: s?._key,
|
|
910
|
-
_serviceKey: s?._serviceKey,
|
|
911
|
-
};
|
|
912
|
-
});
|
|
913
|
-
const sendData = {
|
|
914
|
-
product_id: _currentItem?.id,
|
|
915
|
-
detailId: _detail?.id,
|
|
916
|
-
detailProductId: _detail?.product_id,
|
|
917
|
-
product_name: _currentItem?.title,
|
|
918
|
-
price: _detail?.price,
|
|
919
|
-
serviceVal: val,
|
|
920
|
-
};
|
|
921
|
-
sendWarningLog({
|
|
922
|
-
title: 'addService',
|
|
923
|
-
content: [
|
|
924
|
-
{ key: '添加数据', value: JSON.stringify(sendData) },
|
|
925
|
-
{
|
|
926
|
-
key: '日期',
|
|
927
|
-
value: dayjs().format('YYYY-MM-DD HH:mm:ss'),
|
|
928
|
-
},
|
|
929
|
-
],
|
|
930
|
-
});
|
|
931
|
-
}
|
|
932
|
-
} catch (error) {}
|
|
933
|
-
dispatch({
|
|
934
|
-
type: 'setService',
|
|
935
|
-
payload: {
|
|
936
|
-
addModal: false,
|
|
937
|
-
value: _list,
|
|
938
|
-
edit: true,
|
|
939
|
-
changeService: false,
|
|
940
|
-
},
|
|
941
|
-
});
|
|
942
|
-
} else {
|
|
943
|
-
window.openBookingEditModal?.();
|
|
944
|
-
dispatch({
|
|
945
|
-
type: 'setService',
|
|
946
|
-
payload: {
|
|
947
|
-
editModal: true,
|
|
948
|
-
cacheItem: cacheItem,
|
|
949
|
-
addModal: !cacheItem.autoClose,
|
|
950
|
-
changeService: false,
|
|
951
|
-
},
|
|
952
|
-
});
|
|
953
|
-
onEdit?.(cacheItem);
|
|
954
|
-
}
|
|
955
|
-
};
|
|
956
|
-
// 如果不需要打开弹窗, 直接添加数据
|
|
957
|
-
if (cacheValues) {
|
|
958
|
-
const productId = item.id.toString();
|
|
959
|
-
// 如果已经有pending的同商品,增加点击次数
|
|
960
|
-
if (pendingCacheValuesRef.current[productId]) {
|
|
961
|
-
clickCountRef.current[productId] =
|
|
962
|
-
(clickCountRef.current[productId] || 1) + 1;
|
|
963
|
-
} else {
|
|
964
|
-
// 第一次点击,初始化数据
|
|
965
|
-
pendingCacheValuesRef.current[productId] = cacheValues;
|
|
966
|
-
clickCountRef.current[productId] = 1;
|
|
967
|
-
}
|
|
968
|
-
const cacheItem = createSimpleCacheItem(item, cacheValues, stateRef.current);
|
|
969
|
-
const detail = stateRef.current.service.value?.find((val: any) =>
|
|
970
|
-
isSameProduct(val, cacheItem)
|
|
971
|
-
);
|
|
972
|
-
const originalQuantity = detail?._extend?.quantity || 0;
|
|
973
|
-
Toast?.success?.(
|
|
974
|
-
<div className="add-toast-wrap">
|
|
975
|
-
<div className="add-toast-title">{item.title}</div>
|
|
976
|
-
<div className="add-toast-quantity">
|
|
977
|
-
{locales.getText('pisell2.ticket-booking.in-cart')(
|
|
978
|
-
(clickCountRef.current[productId] || 1) + originalQuantity
|
|
979
|
-
)}
|
|
980
|
-
</div>
|
|
981
|
-
</div>
|
|
982
|
-
);
|
|
983
|
-
debouncedExecuteCacheValues(productId, cacheValues, item, callback);
|
|
984
|
-
return;
|
|
985
|
-
}
|
|
986
|
-
state.action({
|
|
987
|
-
type: 'pisell1.handleOpenProductModal',
|
|
988
|
-
data: {
|
|
989
|
-
id: item.id,
|
|
990
|
-
date: state.date.value.format('YYYY-MM-DD'),
|
|
991
|
-
showConfig: {
|
|
992
|
-
option: true,
|
|
993
|
-
session: isSession,
|
|
994
|
-
variant: true,
|
|
995
|
-
package: true,
|
|
996
|
-
number: getIsShowNumber(item, state),
|
|
997
|
-
},
|
|
998
|
-
isOnlySession,
|
|
999
|
-
is_eject: isEject ? 1 : 0,
|
|
1000
|
-
customer_id: customerId,
|
|
1001
|
-
isOS: isSession,
|
|
1002
|
-
},
|
|
1003
|
-
onCancel: () => {
|
|
1004
|
-
setCurrentProduct(null);
|
|
1005
|
-
},
|
|
1006
|
-
callback,
|
|
1007
|
-
});
|
|
1008
|
-
}
|
|
1009
|
-
);
|
|
1010
|
-
*/
|
|
1011
650
|
var renderList = useMemo(function () {
|
|
1012
651
|
var _list = products || [];
|
|
1013
|
-
|
|
1014
|
-
// 跨日预约
|
|
1015
|
-
if (isDaysBooking(state)) {
|
|
1016
|
-
// 公共购物车下过滤掉预约商品
|
|
1017
|
-
if (!holderId(state)) {
|
|
1018
|
-
_list = _list.filter(function (item) {
|
|
1019
|
-
return isNormalProductByDurationSchedule(item);
|
|
1020
|
-
});
|
|
1021
|
-
}
|
|
1022
|
-
}
|
|
1023
652
|
return _list;
|
|
1024
653
|
}, [products, state === null || state === void 0 ? void 0 : state.activeCartId]);
|
|
1025
654
|
var currentDate = useMemo(function () {
|
|
@@ -1029,20 +658,7 @@ var AddSerivce = function AddSerivce(props) {
|
|
|
1029
658
|
return state.date.value.format('YYYY-MM-DD HH:mm:ss');
|
|
1030
659
|
}, [state.date.value]);
|
|
1031
660
|
useEffect(function () {
|
|
1032
|
-
if (renderMode === 'current' && state.bookingConfig
|
|
1033
|
-
getProducts({
|
|
1034
|
-
schedule_date: currentDate,
|
|
1035
|
-
customer_id: customerId,
|
|
1036
|
-
menu_list_ids: menuList,
|
|
1037
|
-
schedule_datetime: currentDatetime
|
|
1038
|
-
});
|
|
1039
|
-
getScheduleTimePoints({
|
|
1040
|
-
menu_list_ids: menuList
|
|
1041
|
-
});
|
|
1042
|
-
}
|
|
1043
|
-
}, [renderMode, customerId, menuList]);
|
|
1044
|
-
useEffect(function () {
|
|
1045
|
-
if (renderMode === 'current' && state.bookingConfig && platform === 'shop') {
|
|
661
|
+
if (renderMode === 'current' && state.bookingConfig) {
|
|
1046
662
|
getProducts({
|
|
1047
663
|
schedule_date: currentDate,
|
|
1048
664
|
customer_id: customerId,
|
|
@@ -1071,6 +687,7 @@ var AddSerivce = function AddSerivce(props) {
|
|
|
1071
687
|
}, [productDisplayConfig]);
|
|
1072
688
|
return useMemo(function () {
|
|
1073
689
|
if (renderMode === 'current') {
|
|
690
|
+
var _pendingMultiDayData$;
|
|
1074
691
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ProductDisplayAdapter, {
|
|
1075
692
|
config: finalDisplayConfig,
|
|
1076
693
|
dataSource: renderList,
|
|
@@ -1079,9 +696,17 @@ var AddSerivce = function AddSerivce(props) {
|
|
|
1079
696
|
onSelectProduct: handleSelectProduct
|
|
1080
697
|
}), /*#__PURE__*/React.createElement(NotAvailable, {
|
|
1081
698
|
ref: notAvailableRef
|
|
1082
|
-
})
|
|
699
|
+
}), /*#__PURE__*/React.createElement(MultiDayTimeSelectModal, {
|
|
700
|
+
open: multiDayModalOpen,
|
|
701
|
+
productName: pendingMultiDayData === null || pendingMultiDayData === void 0 || (_pendingMultiDayData$ = pendingMultiDayData.item) === null || _pendingMultiDayData$ === void 0 ? void 0 : _pendingMultiDayData$.title,
|
|
702
|
+
locale: state === null || state === void 0 ? void 0 : state.locale,
|
|
703
|
+
defaultStartDate: state.date.value,
|
|
704
|
+
loading: multiDayModalLoading,
|
|
705
|
+
onConfirm: handleMultiDayConfirm,
|
|
706
|
+
onCancel: handleMultiDayCancel
|
|
707
|
+
}), /*#__PURE__*/React.createElement(SelectHolderModal, null));
|
|
1083
708
|
}
|
|
1084
709
|
return null;
|
|
1085
|
-
}, [firstLoading, state.service.addModal, locales, renderList, state.amountSymbol, state.renderType, state === null || state === void 0 ? void 0 : state.activeCartId, holderId(state), loading, currentProduct, isBooking4, finalDisplayConfig]);
|
|
710
|
+
}, [firstLoading, state.service.addModal, locales, renderList, state.amountSymbol, state.renderType, state === null || state === void 0 ? void 0 : state.activeCartId, holderId(state), loading, currentProduct, isBooking4, finalDisplayConfig, multiDayModalOpen, pendingMultiDayData, multiDayModalLoading]);
|
|
1086
711
|
};
|
|
1087
712
|
export default AddSerivce;
|