@pisell/private-materials 6.5.27 → 6.6.2
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/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/addService/utils.d.ts +1 -1
- 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 +9 -1
- 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/hooks/useWalletPass.d.ts +1 -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/pisellSelectCustomerModal/RightPanel/serve.js +1 -5
- 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 +421 -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/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/addService/utils.d.ts +1 -1
- 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 +9 -1
- 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/hooks/useWalletPass.d.ts +1 -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/pisellSelectCustomerModal/RightPanel/serve.js +1 -8
- 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 +281 -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
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
3
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
4
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
2
5
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
3
6
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
7
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
@@ -24,6 +27,8 @@ import AlertTriangle from '@pisell/icon/es/AlertTriangle';
|
|
|
24
27
|
import { getAutoAllocationStorage } from "../editService/utils";
|
|
25
28
|
import { getNoResource2 } from "../../../mock";
|
|
26
29
|
import { cloneDeep } from 'lodash';
|
|
30
|
+
import { updateAppointmentServicePrice } from "../../../info/service2/utils";
|
|
31
|
+
import { getMultiDayPrices } from "../../../info/utils";
|
|
27
32
|
export var getUsableTime = function getUsableTime(cacheItem) {
|
|
28
33
|
try {
|
|
29
34
|
var items = [];
|
|
@@ -124,6 +129,7 @@ export var getTimeObj = function getTimeObj(_ref4) {
|
|
|
124
129
|
state = _ref4.state,
|
|
125
130
|
useDuration = _ref4.useDuration,
|
|
126
131
|
durationProps = _ref4.durationProps;
|
|
132
|
+
var isMultiDay = isMultiDayProduct(cacheItem);
|
|
127
133
|
var flexibleOption = getFlexibleOption({
|
|
128
134
|
cacheItem: cacheItem,
|
|
129
135
|
useStartTime: useStartTime,
|
|
@@ -132,9 +138,7 @@ export var getTimeObj = function getTimeObj(_ref4) {
|
|
|
132
138
|
// state,
|
|
133
139
|
durationProps: durationProps
|
|
134
140
|
});
|
|
135
|
-
var obj = sliceDayIntoFiveMinutes((_state$bookingConfig2 = state.bookingConfig) === null || _state$bookingConfig2 === void 0 || (_state$bookingConfig2 = _state$bookingConfig2.config) === null || _state$bookingConfig2 === void 0 || (_state$bookingConfig2 = _state$bookingConfig2.basic) === null || _state$bookingConfig2 === void 0 ? void 0 : _state$bookingConfig2.service_time, locales.locale);
|
|
136
|
-
// 80ms -> 0ms
|
|
137
|
-
|
|
141
|
+
var obj = sliceDayIntoFiveMinutes((_state$bookingConfig2 = state.bookingConfig) === null || _state$bookingConfig2 === void 0 || (_state$bookingConfig2 = _state$bookingConfig2.config) === null || _state$bookingConfig2 === void 0 || (_state$bookingConfig2 = _state$bookingConfig2.basic) === null || _state$bookingConfig2 === void 0 ? void 0 : _state$bookingConfig2.service_time, locales.locale, isMultiDay);
|
|
138
142
|
var timeSlices = _toConsumableArray(obj.timeSlices);
|
|
139
143
|
var durationSlicesBasedOnTime = _toConsumableArray(obj.durationSlicesBasedOnTime);
|
|
140
144
|
|
|
@@ -148,7 +152,7 @@ export var getTimeObj = function getTimeObj(_ref4) {
|
|
|
148
152
|
return d.value === useDuration;
|
|
149
153
|
})) {
|
|
150
154
|
durationSlicesBasedOnTime.unshift({
|
|
151
|
-
label: getDiscountTime(useDuration),
|
|
155
|
+
label: getDiscountTime(useDuration, isMultiDay),
|
|
152
156
|
value: useDuration,
|
|
153
157
|
//@ts-ignore
|
|
154
158
|
disabled: true
|
|
@@ -522,6 +526,65 @@ var getIsAutoClose = function getIsAutoClose(cacheItem) {
|
|
|
522
526
|
});
|
|
523
527
|
};
|
|
524
528
|
|
|
529
|
+
/**
|
|
530
|
+
* @title: 是否是跨日商品
|
|
531
|
+
* @description:
|
|
532
|
+
* @param {any} cacheItem
|
|
533
|
+
* @return {*}
|
|
534
|
+
*/
|
|
535
|
+
export var isMultiDayProduct = function isMultiDayProduct(product) {
|
|
536
|
+
var _product$duration;
|
|
537
|
+
return (product === null || product === void 0 || (_product$duration = product.duration) === null || _product$duration === void 0 ? void 0 : _product$duration.type) === 'days';
|
|
538
|
+
};
|
|
539
|
+
export var getMultiDay = /*#__PURE__*/function () {
|
|
540
|
+
var _ref12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref11) {
|
|
541
|
+
var start_date, end_date, state, cacheItem, _cacheItem, _yield$updateAppointm, multiDayPrices, price;
|
|
542
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
543
|
+
while (1) switch (_context.prev = _context.next) {
|
|
544
|
+
case 0:
|
|
545
|
+
start_date = _ref11.start_date, end_date = _ref11.end_date, state = _ref11.state, cacheItem = _ref11.cacheItem;
|
|
546
|
+
_cacheItem = cacheItem || state.service.cacheItem; // 跨日预约报价单
|
|
547
|
+
if (!isMultiDayProduct(_cacheItem)) {
|
|
548
|
+
_context.next = 11;
|
|
549
|
+
break;
|
|
550
|
+
}
|
|
551
|
+
_context.next = 5;
|
|
552
|
+
return updateAppointmentServicePrice(state, {
|
|
553
|
+
start_date: start_date,
|
|
554
|
+
end_date: end_date,
|
|
555
|
+
product_id: _cacheItem.product_id
|
|
556
|
+
});
|
|
557
|
+
case 5:
|
|
558
|
+
_yield$updateAppointm = _context.sent;
|
|
559
|
+
multiDayPrices = _yield$updateAppointm.multiDayPrices;
|
|
560
|
+
price = _yield$updateAppointm.price;
|
|
561
|
+
// // 获取商品总价
|
|
562
|
+
// let _total = getProductTotalPrice(_cacheItem);
|
|
563
|
+
|
|
564
|
+
// // 用于折扣 可修改
|
|
565
|
+
// _cacheItem._extend.total = _total;
|
|
566
|
+
|
|
567
|
+
// // 用于储存原价
|
|
568
|
+
// _cacheItem._extend.origin_total = _total;
|
|
569
|
+
|
|
570
|
+
_cacheItem._extend.multiDayPrices = getMultiDayPrices(multiDayPrices || []);
|
|
571
|
+
if (!(multiDayPrices !== null && multiDayPrices !== void 0 && multiDayPrices.length)) {
|
|
572
|
+
_cacheItem._extend.price = price;
|
|
573
|
+
}
|
|
574
|
+
return _context.abrupt("return", _cacheItem);
|
|
575
|
+
case 11:
|
|
576
|
+
return _context.abrupt("return", _cacheItem);
|
|
577
|
+
case 12:
|
|
578
|
+
case "end":
|
|
579
|
+
return _context.stop();
|
|
580
|
+
}
|
|
581
|
+
}, _callee);
|
|
582
|
+
}));
|
|
583
|
+
return function getMultiDay(_x) {
|
|
584
|
+
return _ref12.apply(this, arguments);
|
|
585
|
+
};
|
|
586
|
+
}();
|
|
587
|
+
|
|
525
588
|
/**
|
|
526
589
|
* @title: 预生成服务的 extend
|
|
527
590
|
* @description:
|
|
@@ -530,11 +593,10 @@ var getIsAutoClose = function getIsAutoClose(cacheItem) {
|
|
|
530
593
|
* @Author: zhiwei.Wang
|
|
531
594
|
* @Date: 2024-06-01 13:25
|
|
532
595
|
*/
|
|
533
|
-
export var getProductExtend = function getProductExtend(
|
|
534
|
-
var cacheItem =
|
|
535
|
-
state =
|
|
536
|
-
isDisabledTime =
|
|
537
|
-
console.time('console.time getProductExtend');
|
|
596
|
+
export var getProductExtend = function getProductExtend(_ref13) {
|
|
597
|
+
var cacheItem = _ref13.cacheItem,
|
|
598
|
+
state = _ref13.state,
|
|
599
|
+
isDisabledTime = _ref13.isDisabledTime;
|
|
538
600
|
// 有endDate 说明是在编辑已经保存过的商品, 没有则是编辑还没保存过的商品
|
|
539
601
|
var isNew = cacheItem.new || !cacheItem._extend.endDate;
|
|
540
602
|
var _cacheItem = _objectSpread({}, cacheItem);
|
|
@@ -544,6 +606,12 @@ export var getProductExtend = function getProductExtend(_ref11) {
|
|
|
544
606
|
// const resourcesOrigin = state.s;
|
|
545
607
|
|
|
546
608
|
_cacheItem._data = {};
|
|
609
|
+
if (isMultiDayProduct(cacheItem)) {
|
|
610
|
+
var _cacheItem$_extend2;
|
|
611
|
+
_cacheItem._extend.holder_id = (cacheItem === null || cacheItem === void 0 || (_cacheItem$_extend2 = cacheItem._extend) === null || _cacheItem$_extend2 === void 0 ? void 0 : _cacheItem$_extend2.holder_id) || [];
|
|
612
|
+
// _cacheItem._extend.end_date = state.date.end_date;
|
|
613
|
+
_cacheItem._extend.sub_type = 'days';
|
|
614
|
+
}
|
|
547
615
|
|
|
548
616
|
// 新商品
|
|
549
617
|
if (isNew) {
|
|
@@ -589,6 +657,10 @@ export var getProductExtend = function getProductExtend(_ref11) {
|
|
|
589
657
|
resources: _cacheItem._data.resources
|
|
590
658
|
});
|
|
591
659
|
|
|
660
|
+
// let currentResource = _cacheItem._resources.find(
|
|
661
|
+
// (d: any) => d.form_record_id == cacheItem._extend.resource
|
|
662
|
+
// );
|
|
663
|
+
|
|
592
664
|
// 再次计算, 灵活时长
|
|
593
665
|
if (getDuration(_cacheItem === null || _cacheItem === void 0 ? void 0 : _cacheItem.duration)) {
|
|
594
666
|
_cacheItem._data.timeObj = getTimeObj({
|
|
@@ -602,9 +674,7 @@ export var getProductExtend = function getProductExtend(_ref11) {
|
|
|
602
674
|
_cacheItem._extend.duration = (_cacheItem$_data$time = _cacheItem._data.timeObj) === null || _cacheItem$_data$time === void 0 || (_cacheItem$_data$time = _cacheItem$_data$time.durationSlicesBasedOnTime) === null || _cacheItem$_data$time === void 0 || (_cacheItem$_data$time = _cacheItem$_data$time[0]) === null || _cacheItem$_data$time === void 0 ? void 0 : _cacheItem$_data$time.value;
|
|
603
675
|
|
|
604
676
|
// 计算服务的开始和结束时间
|
|
605
|
-
var _getServiceTimes = getServiceTimes(
|
|
606
|
-
_extend: _cacheItem._extend
|
|
607
|
-
}),
|
|
677
|
+
var _getServiceTimes = getServiceTimes(_cacheItem),
|
|
608
678
|
startDate = _getServiceTimes.startDate,
|
|
609
679
|
endDate = _getServiceTimes.endDate;
|
|
610
680
|
_cacheItem._extend.endDate = endDate;
|
|
@@ -674,8 +744,7 @@ export var getProductExtend = function getProductExtend(_ref11) {
|
|
|
674
744
|
});
|
|
675
745
|
// }
|
|
676
746
|
}
|
|
677
|
-
console.
|
|
678
|
-
// 100ms -> 45ms
|
|
747
|
+
console.log('_cacheItem_cacheItem', _cacheItem);
|
|
679
748
|
return _cacheItem;
|
|
680
749
|
};
|
|
681
750
|
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
+
import React, { useContext, useEffect } from 'react';
|
|
8
|
+
import { locales } from '@pisell/utils';
|
|
9
|
+
import ContactInfo from "../../../../../plus/contactInfo";
|
|
10
|
+
import { Context } from "../../../info/model";
|
|
11
|
+
var ContactInfoMode = function ContactInfoMode() {
|
|
12
|
+
var _state$client$value6, _state$contacts_info3, _state$contacts_info4;
|
|
13
|
+
var _useContext = useContext(Context),
|
|
14
|
+
state = _useContext.state,
|
|
15
|
+
dispatch = _useContext.dispatch;
|
|
16
|
+
console.log('state>>>>>>>>>', state);
|
|
17
|
+
useEffect(function () {
|
|
18
|
+
var _state$contacts_info, _state$client$value, _state$client$value2, _state$contacts_info2;
|
|
19
|
+
// 如果客户id发生变化,则获取客户信息中的ContactInfo,如果不存在,则使用客户信息填充ContactInfo
|
|
20
|
+
console.log('state>>>>>>>>>111', state === null || state === void 0 || (_state$contacts_info = state.contacts_info) === null || _state$contacts_info === void 0 ? void 0 : _state$contacts_info.client_id);
|
|
21
|
+
console.log('state>>>>>>>>>222', (_state$client$value = state.client.value) === null || _state$client$value === void 0 ? void 0 : _state$client$value.id);
|
|
22
|
+
if (((_state$client$value2 = state.client.value) === null || _state$client$value2 === void 0 ? void 0 : _state$client$value2.id) != (state === null || state === void 0 || (_state$contacts_info2 = state.contacts_info) === null || _state$contacts_info2 === void 0 ? void 0 : _state$contacts_info2.client_id)) {
|
|
23
|
+
var _state$client$value3;
|
|
24
|
+
var contactInfo = (_state$client$value3 = state.client.value) === null || _state$client$value3 === void 0 || (_state$client$value3 = _state$client$value3.contacts_info) === null || _state$client$value3 === void 0 ? void 0 : _state$client$value3.value;
|
|
25
|
+
if (!contactInfo) {
|
|
26
|
+
var _state$client, _state$client$value4;
|
|
27
|
+
var _ref = ((_state$client = state.client) === null || _state$client === void 0 ? void 0 : _state$client.value) || {},
|
|
28
|
+
first_name = _ref.first_name,
|
|
29
|
+
last_name = _ref.last_name,
|
|
30
|
+
phone = _ref.phone,
|
|
31
|
+
country_calling_code = _ref.country_calling_code,
|
|
32
|
+
country_code = _ref.country_code,
|
|
33
|
+
email = _ref.email;
|
|
34
|
+
dispatch({
|
|
35
|
+
type: 'setContactsInfo',
|
|
36
|
+
payload: {
|
|
37
|
+
value: {
|
|
38
|
+
first_name: first_name || '',
|
|
39
|
+
last_name: last_name || '',
|
|
40
|
+
phone: {
|
|
41
|
+
phone: phone || '',
|
|
42
|
+
country_calling_code: country_calling_code || '',
|
|
43
|
+
country_code: country_code || ''
|
|
44
|
+
},
|
|
45
|
+
email: email || ''
|
|
46
|
+
},
|
|
47
|
+
client_id: (_state$client$value4 = state.client.value) === null || _state$client$value4 === void 0 ? void 0 : _state$client$value4.id
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
} else {
|
|
51
|
+
var _state$client$value5;
|
|
52
|
+
dispatch({
|
|
53
|
+
type: 'setContactsInfo',
|
|
54
|
+
payload: {
|
|
55
|
+
value: _objectSpread({}, contactInfo || {}),
|
|
56
|
+
client_id: (_state$client$value5 = state.client.value) === null || _state$client$value5 === void 0 ? void 0 : _state$client$value5.id
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}, [(_state$client$value6 = state.client.value) === null || _state$client$value6 === void 0 ? void 0 : _state$client$value6.id, state === null || state === void 0 || (_state$contacts_info3 = state.contacts_info) === null || _state$contacts_info3 === void 0 ? void 0 : _state$contacts_info3.client_id]);
|
|
62
|
+
var handleSave = function handleSave(value) {
|
|
63
|
+
dispatch({
|
|
64
|
+
type: 'setContactsInfo',
|
|
65
|
+
payload: {
|
|
66
|
+
value: value,
|
|
67
|
+
edit: true
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
72
|
+
style: {
|
|
73
|
+
marginTop: '24px'
|
|
74
|
+
}
|
|
75
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
76
|
+
className: "pisell-lowcode__booking-contact-info-title",
|
|
77
|
+
style: {
|
|
78
|
+
fontSize: '16px',
|
|
79
|
+
fontWeight: 500,
|
|
80
|
+
marginBottom: '8px'
|
|
81
|
+
}
|
|
82
|
+
}, locales.getText('pisell2.booking.text.contact-info.title')), /*#__PURE__*/React.createElement(ContactInfo, {
|
|
83
|
+
dataSource: ((_state$contacts_info4 = state.contacts_info) === null || _state$contacts_info4 === void 0 ? void 0 : _state$contacts_info4.value) || null,
|
|
84
|
+
isShowDelete: false,
|
|
85
|
+
isShowAvatar: false,
|
|
86
|
+
isShowPhone: true,
|
|
87
|
+
isShowEmail: true,
|
|
88
|
+
style: {
|
|
89
|
+
padding: '14px 0 14px 14px'
|
|
90
|
+
},
|
|
91
|
+
onSave: handleSave
|
|
92
|
+
}));
|
|
93
|
+
};
|
|
94
|
+
export default ContactInfoMode;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './index.less';
|
|
3
|
+
declare type HolderValue = string | number;
|
|
4
|
+
interface HolderProps {
|
|
5
|
+
state: any;
|
|
6
|
+
cacheItem?: any;
|
|
7
|
+
value?: HolderValue | HolderValue[] | null;
|
|
8
|
+
onChange?: (val: HolderValue | HolderValue[] | null) => void;
|
|
9
|
+
dispatch?: any;
|
|
10
|
+
}
|
|
11
|
+
declare const Holder: React.FC<HolderProps>;
|
|
12
|
+
export default Holder;
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
3
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
4
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
5
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
6
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
7
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
8
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
9
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
10
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
11
|
+
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
|
12
|
+
import { Button, Row, Col } from 'antd';
|
|
13
|
+
import { locales } from '@pisell/utils';
|
|
14
|
+
import HolderList from "../../../../../../plus/selectHolder/components/HolderList";
|
|
15
|
+
import "./index.less";
|
|
16
|
+
import HolderItem from "../../../../../../plus/selectHolder/components/HolderItem";
|
|
17
|
+
import { selectHolderModal, SelectHolderModal } from "../../../../utils/selectHolderModal";
|
|
18
|
+
import { Iconfont } from '@pisell/materials';
|
|
19
|
+
var LinkButton = Button;
|
|
20
|
+
var normalizeValue = function normalizeValue(val) {
|
|
21
|
+
if (Array.isArray(val)) {
|
|
22
|
+
return val.filter(function (item) {
|
|
23
|
+
return item !== undefined && item !== null;
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
if (val === undefined || val === null || val === '') return [];
|
|
27
|
+
return [val];
|
|
28
|
+
};
|
|
29
|
+
var Holder = function Holder(_ref) {
|
|
30
|
+
var _state$bookingConfig, _holderConfig$form, _state$bookingConfig2, _cacheItem$_extend, _state$pet4, _state$pet5, _state$bookingConfig4;
|
|
31
|
+
var state = _ref.state,
|
|
32
|
+
cacheItem = _ref.cacheItem,
|
|
33
|
+
value = _ref.value,
|
|
34
|
+
onChange = _ref.onChange,
|
|
35
|
+
dispatch = _ref.dispatch;
|
|
36
|
+
var holderConfig = (state === null || state === void 0 || (_state$bookingConfig = state.bookingConfig) === null || _state$bookingConfig === void 0 ? void 0 : _state$bookingConfig.holder) || {};
|
|
37
|
+
var title = (holderConfig === null || holderConfig === void 0 || (_holderConfig$form = holderConfig.form) === null || _holderConfig$form === void 0 ? void 0 : _holderConfig$form.title) || (holderConfig === null || holderConfig === void 0 ? void 0 : holderConfig.title) || locales.getText('pisell2.text.holder');
|
|
38
|
+
var isRequired = (state === null || state === void 0 || (_state$bookingConfig2 = state.bookingConfig) === null || _state$bookingConfig2 === void 0 || (_state$bookingConfig2 = _state$bookingConfig2.config) === null || _state$bookingConfig2 === void 0 || (_state$bookingConfig2 = _state$bookingConfig2.basic) === null || _state$bookingConfig2 === void 0 ? void 0 : _state$bookingConfig2.subject_require) === 'require';
|
|
39
|
+
var maxSelectedCount = (cacheItem === null || cacheItem === void 0 || (_cacheItem$_extend = cacheItem._extend) === null || _cacheItem$_extend === void 0 ? void 0 : _cacheItem$_extend.quantity) || 1;
|
|
40
|
+
var selectType = maxSelectedCount > 1 ? 'multiple' : 'single';
|
|
41
|
+
var _useState = useState(function () {
|
|
42
|
+
return normalizeValue(value);
|
|
43
|
+
}),
|
|
44
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
45
|
+
selectedValues = _useState2[0],
|
|
46
|
+
setSelectedValues = _useState2[1];
|
|
47
|
+
useEffect(function () {
|
|
48
|
+
var next = normalizeValue(value);
|
|
49
|
+
setSelectedValues(next);
|
|
50
|
+
}, [value]);
|
|
51
|
+
var holderOptions = useMemo(function () {
|
|
52
|
+
var _state$pet, _state$bookingConfig3, _state$pet2, _state$pet3;
|
|
53
|
+
var holdersFromState = Array.isArray(state === null || state === void 0 || (_state$pet = state.pet) === null || _state$pet === void 0 ? void 0 : _state$pet.holders) ? state.pet.holders : [];
|
|
54
|
+
var formId = (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.form_id) || 0;
|
|
55
|
+
var holdersFromValue = Array.isArray(state === null || state === void 0 || (_state$pet2 = state.pet) === null || _state$pet2 === void 0 || (_state$pet2 = _state$pet2.value) === null || _state$pet2 === void 0 ? void 0 : _state$pet2[formId]) ? state === null || state === void 0 || (_state$pet3 = state.pet) === null || _state$pet3 === void 0 || (_state$pet3 = _state$pet3.value) === null || _state$pet3 === void 0 ? void 0 : _state$pet3[formId] : [];
|
|
56
|
+
var rawList = holdersFromState.length > 0 ? holdersFromState : holdersFromValue;
|
|
57
|
+
return rawList.map(function (item) {
|
|
58
|
+
var id = (item === null || item === void 0 ? void 0 : item.id) || (item === null || item === void 0 ? void 0 : item.form_record_id) || (item === null || item === void 0 ? void 0 : item.value);
|
|
59
|
+
if (id === undefined || id === null) return null;
|
|
60
|
+
return {
|
|
61
|
+
label: (item === null || item === void 0 ? void 0 : item.main_field) || (item === null || item === void 0 ? void 0 : item.label) || (item === null || item === void 0 ? void 0 : item.name) || locales.getText('pisell-select-holder-please-select'),
|
|
62
|
+
value: id,
|
|
63
|
+
avatar: item === null || item === void 0 ? void 0 : item.avatar,
|
|
64
|
+
subtitle: (item === null || item === void 0 ? void 0 : item.subtitle) || (item === null || item === void 0 ? void 0 : item.second_field) || (item === null || item === void 0 ? void 0 : item.sub_field)
|
|
65
|
+
};
|
|
66
|
+
}).filter(Boolean);
|
|
67
|
+
}, [state === null || state === void 0 || (_state$pet4 = state.pet) === null || _state$pet4 === void 0 ? void 0 : _state$pet4.holders, state === null || state === void 0 || (_state$pet5 = state.pet) === null || _state$pet5 === void 0 ? void 0 : _state$pet5.value, state === null || state === void 0 || (_state$bookingConfig4 = state.bookingConfig) === null || _state$bookingConfig4 === void 0 ? void 0 : _state$bookingConfig4.config]);
|
|
68
|
+
var displayConfig = useMemo(function () {
|
|
69
|
+
return {
|
|
70
|
+
direction: 'vertical',
|
|
71
|
+
selectType: selectType,
|
|
72
|
+
showAvatar: true,
|
|
73
|
+
showTitle: true,
|
|
74
|
+
showSubtitle: Boolean(holderOptions.some(function (option) {
|
|
75
|
+
return option.subtitle;
|
|
76
|
+
}))
|
|
77
|
+
};
|
|
78
|
+
}, [holderOptions, selectType]);
|
|
79
|
+
var selectedSummary = useMemo(function () {
|
|
80
|
+
if (!maxSelectedCount) return '';
|
|
81
|
+
var label = locales.getText('pisell-select-holder-selected').replace(/[::]\s*$/, '');
|
|
82
|
+
return "".concat(selectedValues.length, "/").concat(maxSelectedCount, " ").concat(label);
|
|
83
|
+
}, [selectedValues.length, maxSelectedCount]);
|
|
84
|
+
var handleApply = useCallback(function (nextValues) {
|
|
85
|
+
onChange === null || onChange === void 0 || onChange(nextValues);
|
|
86
|
+
}, [onChange, selectType]);
|
|
87
|
+
var handleEdit = useCallback( /*#__PURE__*/function () {
|
|
88
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(event) {
|
|
89
|
+
var _state$bookingConfig5, _cacheItem$_extend2;
|
|
90
|
+
var holderConfig, currentMaxSelectedCount, result;
|
|
91
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
92
|
+
while (1) switch (_context.prev = _context.next) {
|
|
93
|
+
case 0:
|
|
94
|
+
event === null || event === void 0 || event.preventDefault();
|
|
95
|
+
|
|
96
|
+
// 获取 maxSelectedCount
|
|
97
|
+
holderConfig = (state === null || state === void 0 || (_state$bookingConfig5 = state.bookingConfig) === null || _state$bookingConfig5 === void 0 ? void 0 : _state$bookingConfig5.holder) || {};
|
|
98
|
+
currentMaxSelectedCount = (holderConfig === null || holderConfig === void 0 ? void 0 : holderConfig.maxSelectedCount) || (cacheItem === null || cacheItem === void 0 || (_cacheItem$_extend2 = cacheItem._extend) === null || _cacheItem$_extend2 === void 0 ? void 0 : _cacheItem$_extend2.quantity) || 1; // 调用 selectHolderModal
|
|
99
|
+
_context.next = 5;
|
|
100
|
+
return selectHolderModal({
|
|
101
|
+
state: state,
|
|
102
|
+
dispatch: dispatch,
|
|
103
|
+
initialValue: selectedValues.length > 0 ? selectedValues : undefined,
|
|
104
|
+
maxSelectedCount: currentMaxSelectedCount
|
|
105
|
+
});
|
|
106
|
+
case 5:
|
|
107
|
+
result = _context.sent;
|
|
108
|
+
if (result && result.length > 0) {
|
|
109
|
+
// 处理返回结果(统一返回数组)
|
|
110
|
+
setSelectedValues(result);
|
|
111
|
+
handleApply(result);
|
|
112
|
+
}
|
|
113
|
+
case 7:
|
|
114
|
+
case "end":
|
|
115
|
+
return _context.stop();
|
|
116
|
+
}
|
|
117
|
+
}, _callee);
|
|
118
|
+
}));
|
|
119
|
+
return function (_x) {
|
|
120
|
+
return _ref2.apply(this, arguments);
|
|
121
|
+
};
|
|
122
|
+
}(), [selectedValues, state, dispatch, handleApply]);
|
|
123
|
+
var handleClear = useCallback(function (event) {
|
|
124
|
+
event === null || event === void 0 || event.preventDefault();
|
|
125
|
+
// 更新选中值
|
|
126
|
+
setSelectedValues([]);
|
|
127
|
+
// 调用 onChange
|
|
128
|
+
handleApply([]);
|
|
129
|
+
}, [handleApply]);
|
|
130
|
+
var clearDisabled = useMemo(function () {
|
|
131
|
+
return (selectedValues === null || selectedValues === void 0 ? void 0 : selectedValues.length) === 0;
|
|
132
|
+
}, [selectedValues]);
|
|
133
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Col, {
|
|
134
|
+
span: 24
|
|
135
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
136
|
+
className: "booking-holder-field"
|
|
137
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
138
|
+
className: "booking-holder-field__header"
|
|
139
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
140
|
+
className: "booking-holder-field__title"
|
|
141
|
+
}, isRequired && /*#__PURE__*/React.createElement("span", {
|
|
142
|
+
className: "booking-holder-field__required"
|
|
143
|
+
}, "*"), /*#__PURE__*/React.createElement("span", null, title), maxSelectedCount ? /*#__PURE__*/React.createElement("span", {
|
|
144
|
+
className: "booking-holder-field__count"
|
|
145
|
+
}, selectedSummary) : null), /*#__PURE__*/React.createElement("div", {
|
|
146
|
+
className: "booking-holder-field__actions"
|
|
147
|
+
}, /*#__PURE__*/React.createElement(LinkButton, {
|
|
148
|
+
type: "link",
|
|
149
|
+
size: "small",
|
|
150
|
+
className: "booking-holder-field__action-button",
|
|
151
|
+
onClick: handleEdit
|
|
152
|
+
}, /*#__PURE__*/React.createElement(Iconfont, {
|
|
153
|
+
type: "pisell2-edit-05"
|
|
154
|
+
}), /*#__PURE__*/React.createElement("span", null, locales.getText('pisell2.text.edit'))), /*#__PURE__*/React.createElement(LinkButton, {
|
|
155
|
+
type: "link",
|
|
156
|
+
size: "small",
|
|
157
|
+
disabled: clearDisabled,
|
|
158
|
+
className: "booking-holder-field__action-button",
|
|
159
|
+
onClick: handleClear
|
|
160
|
+
}, /*#__PURE__*/React.createElement(Iconfont, {
|
|
161
|
+
type: "pisell2-delete_wght300_24px"
|
|
162
|
+
}), /*#__PURE__*/React.createElement("span", null, locales.getText('pisell2.booking.info.text.clear'))))), selectedValues.length === 0 ? /*#__PURE__*/React.createElement(Row, null, /*#__PURE__*/React.createElement(Col, {
|
|
163
|
+
span: 8,
|
|
164
|
+
xs: 24,
|
|
165
|
+
sm: 12,
|
|
166
|
+
md: 8,
|
|
167
|
+
lg: 8,
|
|
168
|
+
onClick: handleEdit
|
|
169
|
+
}, /*#__PURE__*/React.createElement(HolderItem, {
|
|
170
|
+
item: {
|
|
171
|
+
label: locales.getText('pisell2.booking.info.text.add-holder'),
|
|
172
|
+
value: null
|
|
173
|
+
},
|
|
174
|
+
isAddItem: true
|
|
175
|
+
}))) : /*#__PURE__*/React.createElement(HolderList, {
|
|
176
|
+
dataSource: selectedValues.map(function (item) {
|
|
177
|
+
var option = holderOptions.find(function (opt) {
|
|
178
|
+
return opt.value === item;
|
|
179
|
+
});
|
|
180
|
+
return {
|
|
181
|
+
label: (option === null || option === void 0 ? void 0 : option.label) || '',
|
|
182
|
+
value: item
|
|
183
|
+
};
|
|
184
|
+
}),
|
|
185
|
+
selectedValues: selectedValues,
|
|
186
|
+
displayConfig: displayConfig,
|
|
187
|
+
allowAdd: false,
|
|
188
|
+
onClick: function onClick() {
|
|
189
|
+
return handleEdit();
|
|
190
|
+
}
|
|
191
|
+
}))), /*#__PURE__*/React.createElement(SelectHolderModal, null));
|
|
192
|
+
};
|
|
193
|
+
export default Holder;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
.booking-holder-field {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
gap: 16px;
|
|
5
|
+
|
|
6
|
+
&__header {
|
|
7
|
+
display: flex;
|
|
8
|
+
align-items: center;
|
|
9
|
+
justify-content: space-between;
|
|
10
|
+
flex-wrap: wrap;
|
|
11
|
+
gap: 8px;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
&__title {
|
|
15
|
+
display: flex;
|
|
16
|
+
align-items: center;
|
|
17
|
+
gap: 8px;
|
|
18
|
+
font-weight: 600;
|
|
19
|
+
font-size: 14px;
|
|
20
|
+
line-height: 20px;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
&__required {
|
|
24
|
+
color: #ff4d4f;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
&__count {
|
|
28
|
+
color: #667085;
|
|
29
|
+
font-size: 12px;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
&__actions {
|
|
33
|
+
display: flex;
|
|
34
|
+
align-items: center;
|
|
35
|
+
gap: 12px;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
&__action-button {
|
|
39
|
+
padding: 0;
|
|
40
|
+
border: none;
|
|
41
|
+
background: transparent;
|
|
42
|
+
color: #7f56d9;
|
|
43
|
+
font-size: 12px;
|
|
44
|
+
line-height: 16px;
|
|
45
|
+
cursor: pointer;
|
|
46
|
+
span {
|
|
47
|
+
text-decoration: underline;
|
|
48
|
+
text-underline-offset: 4px;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
&:hover {
|
|
52
|
+
color: #6941c6;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
&:disabled,
|
|
56
|
+
&.booking-holder-field__action--disabled {
|
|
57
|
+
cursor: not-allowed;
|
|
58
|
+
opacity: 0.5;
|
|
59
|
+
color: #c2a9f1;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|