@pisell/private-materials 6.3.70 → 6.3.72
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 +8 -8
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +7 -7
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +9 -9
- package/es/components/Sales/Cart/index.js +20 -3
- package/es/components/Sales/Cart/utils.d.ts +5 -0
- package/es/components/Sales/Cart/utils.js +16 -0
- package/es/components/Sales/Summary/utils.js +5 -4
- package/es/components/booking/addons/model.d.ts +1 -10
- package/es/components/booking/components/TabProduct/index.d.ts +0 -1
- package/es/components/booking/components/TabProduct/productItem/index.d.ts +0 -1
- package/es/components/booking/components/TabProduct/selectProductItem/index.d.ts +0 -1
- package/es/components/booking/components/collapsibleList/utils.d.ts +0 -1
- package/es/components/booking/components/emptyBooking/index.d.ts +0 -1
- package/es/components/booking/components/footer/FooterMenus/index.d.ts +0 -1
- package/es/components/booking/components/reloadResourceModal/index.d.ts +0 -1
- package/es/components/booking/components/voucher/index.js +8 -7
- package/es/components/booking/forms/model.d.ts +1 -10
- package/es/components/booking/forms/single/index.d.ts +0 -1
- package/es/components/booking/forms/table/index.d.ts +0 -1
- package/es/components/booking/info/clientVariant/hooks/useClientFn.d.ts +0 -1
- package/es/components/booking/info/date/index.d.ts +0 -1
- package/es/components/booking/info/model.d.ts +1 -10
- package/es/components/booking/info/notes/index.d.ts +0 -1
- package/es/components/booking/info/service/actions/index.d.ts +0 -1
- package/es/components/booking/info/service/addService/utils.d.ts +1 -1
- package/es/components/booking/info2/service/actions/index.d.ts +0 -1
- package/es/components/booking/info2/service/addService/utils.d.ts +1 -1
- package/es/components/booking/info2/service/contactInfoMode/index.d.ts +0 -1
- package/es/components/booking/materiels/contacts/index.d.ts +0 -1
- package/es/components/booking/materiels/duration/index.d.ts +0 -1
- package/es/components/booking/materiels/holder/index.d.ts +0 -1
- package/es/components/booking/materiels/startTime/index.d.ts +0 -1
- package/es/components/booking/model.d.ts +1 -9
- package/es/components/booking/notes/NoteBlock/NoteItem/index.d.ts +0 -1
- package/es/components/booking/notes/NoteBlock/index.d.ts +0 -1
- package/es/components/booking/notes/model.d.ts +1 -10
- package/es/components/booking/payments/model.d.ts +1 -10
- package/es/components/booking/utils.d.ts +2 -2
- package/es/components/eftpos/index.d.ts +0 -1
- package/es/components/eftpos/pos.d.ts +0 -1
- package/es/components/eftposPay/amount.d.ts +1 -2
- package/es/components/eftposPay/component/fail/failCustom.d.ts +0 -1
- package/es/components/eftposPay/component/fail/network.d.ts +0 -1
- package/es/components/eftposPay/component/fail/unknow.d.ts +0 -1
- package/es/components/eftposPay/component/manual/index.d.ts +0 -1
- package/es/components/eftposPay/component/signature/index.d.ts +0 -1
- package/es/components/eftposPay/device.d.ts +1 -1
- package/es/components/eftposPay/hooks.d.ts +2 -2
- package/es/components/eftposPay/pay.d.ts +0 -1
- package/es/components/eftposPay/payo/config.d.ts +0 -1
- package/es/components/eftposPay/store/index.d.ts +4 -4
- package/es/components/eftposPay/tip.d.ts +0 -1
- package/es/components/eftposPay/windcave/receiptAction.d.ts +0 -1
- package/es/components/eftposPay/windcave/windcave.d.ts +0 -1
- package/es/components/eventBooking/components/Provider/Cart/Deposit/index.d.ts +0 -1
- package/es/components/eventBooking/components/Provider/Cart/Item/index.js +2 -1
- package/es/components/eventBooking/components/Provider/Content/index.d.ts +0 -1
- package/es/components/eventBooking/components/Provider/Header/index.d.ts +0 -1
- package/es/components/eventBooking/components/Provider/SelectHolderModal.d.ts +0 -1
- package/es/components/eventBooking/components/Voucher/components/Voucher.d.ts +20 -0
- package/es/components/eventBooking/components/Voucher/components/Voucher.js +99 -0
- package/es/components/eventBooking/components/Voucher/components/index.less +124 -0
- package/es/components/eventBooking/components/Voucher/components/locales.d.ts +39 -0
- package/es/components/eventBooking/components/Voucher/components/locales.js +38 -0
- package/es/components/eventBooking/components/Voucher/hooks.d.ts +7 -0
- package/es/components/eventBooking/components/Voucher/hooks.js +212 -0
- package/es/components/eventBooking/components/Voucher/index.d.ts +2 -0
- package/es/components/eventBooking/components/Voucher/index.js +266 -0
- package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateStatus/index.d.ts +0 -1
- package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Status/index.d.ts +0 -1
- package/es/components/eventBooking/components/bookingDetailModal/components/Resource.d.ts +0 -1
- package/es/components/eventBooking/components/bookingDetailModal/components/Schedule.d.ts +0 -1
- package/es/components/eventBooking/components/scheduleCalendar/ProductItem/index.d.ts +0 -1
- package/es/components/kioskSkuDetail/index.d.ts +39 -0
- package/es/components/kioskSkuDetail/index.js +531 -0
- package/es/components/kioskSkuDetail/index.less +196 -0
- package/es/components/kioskSkuDetail/locales.d.ts +27 -0
- package/es/components/kioskSkuDetail/locales.js +26 -0
- package/es/components/login/index.d.ts +0 -1
- package/es/components/pay/toC/PaymentMethods/MWCreditCard/tds2.js +5 -0
- package/es/components/pay/toC/PaymentMethods/StripePay/Stripe/index.d.ts +0 -1
- package/es/components/pay/toC/model.d.ts +1 -9
- package/es/components/pisellSelectCustomerModal/RightPanel/Add/BirthdayField/index.d.ts +0 -1
- package/es/components/pisellSelectCustomerModal/RightPanel/Add/GenderField/index.d.ts +0 -1
- package/es/components/pisellSelectCustomerModal/RightPanel/Add/index.d.ts +0 -1
- package/es/components/productExtension/fields/Actor/index.d.ts +0 -1
- package/es/components/productExtension/fields/Forms/index.d.ts +0 -1
- package/es/components/productExtension/fields/SelectProducts/ProductItem/index.d.ts +0 -1
- package/es/components/productExtension/fields/SelectProducts/ProductItemPreview/index.d.ts +0 -1
- package/es/components/productExtension/fields/SelectProducts/index.d.ts +0 -1
- package/es/components/productExtension/fields/SelectResourcesTable/index.d.ts +0 -1
- package/es/components/ruleSetting/ruleBorder/index.d.ts +0 -1
- package/es/components/schedules/calendar/calendarItem.d.ts +0 -1
- package/es/components/schedules/calendar/index.d.ts +0 -1
- package/es/components/schedules/components/CurrentDay/index.d.ts +0 -1
- package/es/components/schedules/components/ScheduleDetailList/index.d.ts +0 -1
- package/es/components/schedules/components/ScheduleList/index.d.ts +0 -1
- package/es/components/schedules/model.d.ts +1 -9
- package/es/components/schedules/products/ProductDetailDrawer/ProductDetail/MaxParticipantsModule/index.d.ts +0 -1
- package/es/components/schedules/products/ProductDetailDrawer/ProductDetail/ResourcesModule/index.d.ts +0 -1
- package/es/components/schedules/products/ProductDetailDrawer/ProductDetail/index.d.ts +0 -1
- package/es/components/schedules/products/ProductDetailDrawer/ProductDetailByDate/index.d.ts +0 -1
- package/es/components/schedules/products/ProductDetailDrawer/index.d.ts +0 -1
- package/es/components/schedules/products/index.d.ts +0 -1
- package/es/components/schedules/products/list/ProductItem/index.d.ts +0 -1
- package/es/components/schedules/products/list/index.d.ts +0 -1
- package/es/components/schedules/resources/index.d.ts +0 -1
- package/es/components/schedules/resources/list/index.d.ts +0 -1
- package/es/components/schedules/schedules/AllSchedules/index.d.ts +0 -1
- package/es/components/schedules/schedules/ScheduleDetailDrawer/index.d.ts +0 -1
- package/es/components/schedules/schedules/index.d.ts +0 -1
- package/es/components/shoppingCart/components/Empty/index.d.ts +0 -1
- package/es/components/shoppingCart/components/Render/index.d.ts +0 -1
- package/es/components/shoppingCart/index.d.ts +0 -1
- package/es/components/walletList/index.js +7 -2
- package/es/hooks/usePaymentLogger.d.ts +0 -1
- package/es/index.d.ts +3 -1
- package/es/index.js +3 -1
- package/es/plus/saasCreateOrganization/components/Header.d.ts +0 -1
- package/es/plus/saasRegister/components/EntryEmail.d.ts +0 -1
- package/es/plus/saasRegister/components/EntryInfo.d.ts +0 -1
- package/es/plus/saasRegister/components/GoLogin.d.ts +0 -1
- package/es/plus/saasRegister/components/Header.d.ts +0 -1
- package/es/plus/saasRegister/components/VerifyError.d.ts +0 -1
- package/es/plus/saasRegister/components/VerifyingLink.d.ts +0 -1
- package/es/plus/skuOptionsSelection/components/VariantCard/index.js +30 -1
- package/es/plus/skuOptionsSelection/components/VariantCard/index.less +10 -0
- package/es/plus/skuOptionsSelection/locales.d.ts +3 -0
- package/es/plus/skuOptionsSelection/locales.js +3 -0
- package/es/plus/skuOptionsSelection/store/actions.js +17 -2
- package/es/plus/skuOptionsSelection/types.d.ts +5 -0
- package/es/plus/skuOptionsSelection/types.js +2 -1
- package/es/plus/skuOptionsSelection/utils/transformVariantGroup.js +70 -3
- package/es/plus/walletEditor/components/relationProduct/index.d.ts +0 -1
- package/es/plus/walletPassGallery/components/passDetail/index.js +6 -5
- package/es/plus/walletPassGallery/components/timelineSection/index.d.ts +1 -0
- package/es/plus/walletPassGallery/components/timelineSection/index.js +9 -3
- package/es/plus/walletPassGallery/index.js +2 -2
- package/es/plus/walletPassGallery/serve.d.ts +8 -0
- package/es/plus/walletPassGallery/serve.js +78 -52
- package/es/pro/Selector/Selector.d.ts +1 -1
- package/es/pro/numberKeyboard/index.d.ts +28 -0
- package/es/pro/numberKeyboard/index.js +155 -0
- package/es/pro/numberKeyboard/index.less +25 -0
- package/es/pro/numberKeyboard/locales.d.ts +12 -0
- package/es/pro/numberKeyboard/locales.js +11 -0
- package/es/pro/pisellNumberSelector/example.d.ts +3 -0
- package/es/pro/pisellNumberSelector/example.js +68 -0
- package/es/pro/pisellNumberSelector/index.d.ts +29 -0
- package/es/pro/pisellNumberSelector/index.js +257 -0
- package/es/pro/pisellNumberSelector/index.less +235 -0
- package/es/pro/skuDetailModal/index.d.ts +4 -0
- package/es/pro/skuDetailModal/index.js +1031 -0
- package/lib/components/Sales/Cart/index.js +25 -7
- package/lib/components/Sales/Cart/utils.d.ts +5 -0
- package/lib/components/Sales/Cart/utils.js +13 -1
- package/lib/components/Sales/Summary/utils.js +2 -4
- package/lib/components/booking/addons/model.d.ts +1 -10
- package/lib/components/booking/components/TabProduct/index.d.ts +0 -1
- package/lib/components/booking/components/TabProduct/productItem/index.d.ts +0 -1
- package/lib/components/booking/components/TabProduct/selectProductItem/index.d.ts +0 -1
- package/lib/components/booking/components/collapsibleList/utils.d.ts +0 -1
- package/lib/components/booking/components/emptyBooking/index.d.ts +0 -1
- package/lib/components/booking/components/footer/FooterMenus/index.d.ts +0 -1
- package/lib/components/booking/components/reloadResourceModal/index.d.ts +0 -1
- package/lib/components/booking/components/voucher/index.js +0 -1
- package/lib/components/booking/forms/model.d.ts +1 -10
- package/lib/components/booking/forms/single/index.d.ts +0 -1
- package/lib/components/booking/forms/table/index.d.ts +0 -1
- package/lib/components/booking/info/clientVariant/hooks/useClientFn.d.ts +0 -1
- package/lib/components/booking/info/date/index.d.ts +0 -1
- package/lib/components/booking/info/model.d.ts +1 -10
- package/lib/components/booking/info/notes/index.d.ts +0 -1
- package/lib/components/booking/info/service/actions/index.d.ts +0 -1
- package/lib/components/booking/info/service/addService/utils.d.ts +1 -1
- package/lib/components/booking/info2/service/actions/index.d.ts +0 -1
- package/lib/components/booking/info2/service/addService/utils.d.ts +1 -1
- package/lib/components/booking/info2/service/contactInfoMode/index.d.ts +0 -1
- package/lib/components/booking/materiels/contacts/index.d.ts +0 -1
- package/lib/components/booking/materiels/duration/index.d.ts +0 -1
- package/lib/components/booking/materiels/holder/index.d.ts +0 -1
- package/lib/components/booking/materiels/startTime/index.d.ts +0 -1
- package/lib/components/booking/model.d.ts +1 -9
- package/lib/components/booking/notes/NoteBlock/NoteItem/index.d.ts +0 -1
- package/lib/components/booking/notes/NoteBlock/index.d.ts +0 -1
- package/lib/components/booking/notes/model.d.ts +1 -10
- package/lib/components/booking/payments/model.d.ts +1 -10
- package/lib/components/booking/utils.d.ts +2 -2
- package/lib/components/eftpos/index.d.ts +0 -1
- package/lib/components/eftpos/pos.d.ts +0 -1
- package/lib/components/eftposPay/amount.d.ts +1 -2
- package/lib/components/eftposPay/component/fail/failCustom.d.ts +0 -1
- package/lib/components/eftposPay/component/fail/network.d.ts +0 -1
- package/lib/components/eftposPay/component/fail/unknow.d.ts +0 -1
- package/lib/components/eftposPay/component/manual/index.d.ts +0 -1
- package/lib/components/eftposPay/component/signature/index.d.ts +0 -1
- package/lib/components/eftposPay/device.d.ts +1 -1
- package/lib/components/eftposPay/hooks.d.ts +2 -2
- package/lib/components/eftposPay/pay.d.ts +0 -1
- package/lib/components/eftposPay/payo/config.d.ts +0 -1
- package/lib/components/eftposPay/store/index.d.ts +4 -4
- package/lib/components/eftposPay/tip.d.ts +0 -1
- package/lib/components/eftposPay/windcave/receiptAction.d.ts +0 -1
- package/lib/components/eftposPay/windcave/windcave.d.ts +0 -1
- package/lib/components/eventBooking/components/Provider/Cart/Deposit/index.d.ts +0 -1
- package/lib/components/eventBooking/components/Provider/Cart/Item/index.js +2 -1
- package/lib/components/eventBooking/components/Provider/Content/index.d.ts +0 -1
- package/lib/components/eventBooking/components/Provider/Header/index.d.ts +0 -1
- package/lib/components/eventBooking/components/Provider/SelectHolderModal.d.ts +0 -1
- package/lib/components/eventBooking/components/Voucher/components/Voucher.d.ts +20 -0
- package/lib/components/eventBooking/components/Voucher/components/Voucher.js +116 -0
- package/lib/components/eventBooking/components/Voucher/components/index.less +124 -0
- package/lib/components/eventBooking/components/Voucher/components/locales.d.ts +39 -0
- package/lib/components/eventBooking/components/Voucher/components/locales.js +59 -0
- package/lib/components/eventBooking/components/Voucher/hooks.d.ts +7 -0
- package/lib/components/eventBooking/components/Voucher/hooks.js +176 -0
- package/lib/components/eventBooking/components/Voucher/index.d.ts +2 -0
- package/lib/components/eventBooking/components/Voucher/index.js +197 -0
- package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateStatus/index.d.ts +0 -1
- package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Status/index.d.ts +0 -1
- package/lib/components/eventBooking/components/bookingDetailModal/components/Resource.d.ts +0 -1
- package/lib/components/eventBooking/components/bookingDetailModal/components/Schedule.d.ts +0 -1
- package/lib/components/eventBooking/components/scheduleCalendar/ProductItem/index.d.ts +0 -1
- package/lib/components/kioskSkuDetail/index.d.ts +39 -0
- package/lib/components/kioskSkuDetail/index.js +393 -0
- package/lib/components/kioskSkuDetail/index.less +196 -0
- package/lib/components/kioskSkuDetail/locales.d.ts +27 -0
- package/lib/components/kioskSkuDetail/locales.js +50 -0
- package/lib/components/login/index.d.ts +0 -1
- package/lib/components/pay/toC/PaymentMethods/MWCreditCard/tds2.js +5 -0
- package/lib/components/pay/toC/PaymentMethods/StripePay/Stripe/index.d.ts +0 -1
- package/lib/components/pay/toC/model.d.ts +1 -9
- package/lib/components/pisellSelectCustomerModal/RightPanel/Add/BirthdayField/index.d.ts +0 -1
- package/lib/components/pisellSelectCustomerModal/RightPanel/Add/GenderField/index.d.ts +0 -1
- package/lib/components/pisellSelectCustomerModal/RightPanel/Add/index.d.ts +0 -1
- package/lib/components/productExtension/fields/Actor/index.d.ts +0 -1
- package/lib/components/productExtension/fields/Forms/index.d.ts +0 -1
- package/lib/components/productExtension/fields/SelectProducts/ProductItem/index.d.ts +0 -1
- package/lib/components/productExtension/fields/SelectProducts/ProductItemPreview/index.d.ts +0 -1
- package/lib/components/productExtension/fields/SelectProducts/index.d.ts +0 -1
- package/lib/components/productExtension/fields/SelectResourcesTable/index.d.ts +0 -1
- package/lib/components/ruleSetting/ruleBorder/index.d.ts +0 -1
- package/lib/components/schedules/calendar/calendarItem.d.ts +0 -1
- package/lib/components/schedules/calendar/index.d.ts +0 -1
- package/lib/components/schedules/components/CurrentDay/index.d.ts +0 -1
- package/lib/components/schedules/components/ScheduleDetailList/index.d.ts +0 -1
- package/lib/components/schedules/components/ScheduleList/index.d.ts +0 -1
- package/lib/components/schedules/model.d.ts +1 -9
- package/lib/components/schedules/products/ProductDetailDrawer/ProductDetail/MaxParticipantsModule/index.d.ts +0 -1
- package/lib/components/schedules/products/ProductDetailDrawer/ProductDetail/ResourcesModule/index.d.ts +0 -1
- package/lib/components/schedules/products/ProductDetailDrawer/ProductDetail/index.d.ts +0 -1
- package/lib/components/schedules/products/ProductDetailDrawer/ProductDetailByDate/index.d.ts +0 -1
- package/lib/components/schedules/products/ProductDetailDrawer/index.d.ts +0 -1
- package/lib/components/schedules/products/index.d.ts +0 -1
- package/lib/components/schedules/products/list/ProductItem/index.d.ts +0 -1
- package/lib/components/schedules/products/list/index.d.ts +0 -1
- package/lib/components/schedules/resources/index.d.ts +0 -1
- package/lib/components/schedules/resources/list/index.d.ts +0 -1
- package/lib/components/schedules/schedules/AllSchedules/index.d.ts +0 -1
- package/lib/components/schedules/schedules/ScheduleDetailDrawer/index.d.ts +0 -1
- package/lib/components/schedules/schedules/index.d.ts +0 -1
- package/lib/components/shoppingCart/components/Empty/index.d.ts +0 -1
- package/lib/components/shoppingCart/components/Render/index.d.ts +0 -1
- package/lib/components/shoppingCart/index.d.ts +0 -1
- package/lib/components/walletList/index.js +5 -1
- package/lib/hooks/usePaymentLogger.d.ts +0 -1
- package/lib/index.d.ts +3 -1
- package/lib/index.js +7 -1
- package/lib/plus/saasCreateOrganization/components/Header.d.ts +0 -1
- package/lib/plus/saasRegister/components/EntryEmail.d.ts +0 -1
- package/lib/plus/saasRegister/components/EntryInfo.d.ts +0 -1
- package/lib/plus/saasRegister/components/GoLogin.d.ts +0 -1
- package/lib/plus/saasRegister/components/Header.d.ts +0 -1
- package/lib/plus/saasRegister/components/VerifyError.d.ts +0 -1
- package/lib/plus/saasRegister/components/VerifyingLink.d.ts +0 -1
- package/lib/plus/skuOptionsSelection/components/VariantCard/index.js +32 -3
- package/lib/plus/skuOptionsSelection/components/VariantCard/index.less +10 -0
- package/lib/plus/skuOptionsSelection/locales.d.ts +3 -0
- package/lib/plus/skuOptionsSelection/locales.js +3 -0
- package/lib/plus/skuOptionsSelection/store/actions.js +25 -1
- package/lib/plus/skuOptionsSelection/types.d.ts +5 -0
- package/lib/plus/skuOptionsSelection/types.js +2 -1
- package/lib/plus/skuOptionsSelection/utils/transformVariantGroup.js +51 -5
- package/lib/plus/walletEditor/components/relationProduct/index.d.ts +0 -1
- package/lib/plus/walletPassGallery/components/passDetail/index.js +24 -6
- package/lib/plus/walletPassGallery/components/timelineSection/index.d.ts +1 -0
- package/lib/plus/walletPassGallery/components/timelineSection/index.js +17 -10
- package/lib/plus/walletPassGallery/index.js +2 -2
- package/lib/plus/walletPassGallery/serve.d.ts +8 -0
- package/lib/plus/walletPassGallery/serve.js +23 -10
- package/lib/pro/Selector/Selector.d.ts +1 -1
- package/lib/pro/numberKeyboard/index.d.ts +28 -0
- package/lib/pro/numberKeyboard/index.js +182 -0
- package/lib/pro/numberKeyboard/index.less +25 -0
- package/lib/pro/numberKeyboard/locales.d.ts +12 -0
- package/lib/pro/numberKeyboard/locales.js +35 -0
- package/lib/pro/pisellNumberSelector/example.d.ts +3 -0
- package/lib/pro/pisellNumberSelector/example.js +93 -0
- package/lib/pro/pisellNumberSelector/index.d.ts +29 -0
- package/lib/pro/pisellNumberSelector/index.js +275 -0
- package/lib/pro/pisellNumberSelector/index.less +235 -0
- package/lib/pro/skuDetailModal/index.d.ts +4 -0
- package/lib/pro/skuDetailModal/index.js +736 -0
- package/lowcode/kiosk-sku-detail/meta.ts +264 -0
- package/package.json +3 -3
|
@@ -0,0 +1,1031 @@
|
|
|
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 ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
7
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
8
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
9
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
10
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
11
|
+
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."); }
|
|
12
|
+
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); }
|
|
13
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
14
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
15
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
16
|
+
import React, { forwardRef, useContext, useImperativeHandle, useState, useMemo, useRef } from 'react';
|
|
17
|
+
import { PisellModal, Button, Iconfont, PisellProcedure, Checkbox } from '@pisell/materials';
|
|
18
|
+
import Decimal from 'decimal.js';
|
|
19
|
+
import { locales } from '@pisell/utils';
|
|
20
|
+
import Delete_wght300_24px from '@pisell/icon/es/Delete_wght300_24px';
|
|
21
|
+
import localeTexts from "./locales";
|
|
22
|
+
import "./index.less";
|
|
23
|
+
import PisellNumberSelector from "../pisellNumberSelector";
|
|
24
|
+
import NoteModal from "../../plus/noteModal";
|
|
25
|
+
import useEngineContext from "../../hooks/useEngineContext";
|
|
26
|
+
import { DiscountKeyboard } from "../priceKeyboard";
|
|
27
|
+
import SKUOptionsSelection from "../../plus/skuOptionsSelection";
|
|
28
|
+
import { getProductDetail } from "../../components/booking/info/service/serve";
|
|
29
|
+
import { checkSkuStockCanSell } from "./utils";
|
|
30
|
+
import { Context as BookingContext } from "../../components/booking/info/model";
|
|
31
|
+
import useToast from "../../hooks/useToast";
|
|
32
|
+
var SkuDetailModal = function SkuDetailModal(_ref, ref) {
|
|
33
|
+
var _context$appHelper, _store$getState, _context$engine, _productData$_extend2, _bookingState$booking10, _bookingState$booking11;
|
|
34
|
+
var onConfirm = _ref.onConfirm,
|
|
35
|
+
onRemove = _ref.onRemove,
|
|
36
|
+
onClose = _ref.onClose;
|
|
37
|
+
var _useState = useState(false),
|
|
38
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
39
|
+
open = _useState2[0],
|
|
40
|
+
setOpen = _useState2[1];
|
|
41
|
+
var _useState3 = useState(null),
|
|
42
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
43
|
+
productData = _useState4[0],
|
|
44
|
+
setProductData = _useState4[1];
|
|
45
|
+
var _useState5 = useState(''),
|
|
46
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
47
|
+
note = _useState6[0],
|
|
48
|
+
setNote = _useState6[1];
|
|
49
|
+
var _useState7 = useState(1),
|
|
50
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
51
|
+
quantity = _useState8[0],
|
|
52
|
+
setQuantity = _useState8[1];
|
|
53
|
+
/**
|
|
54
|
+
* @description 手动改价(单价维度)
|
|
55
|
+
* - null 表示未设置过手动改价
|
|
56
|
+
* - 只要设置过,右侧总价展示始终以该单价为准
|
|
57
|
+
*/
|
|
58
|
+
var _useState9 = useState(null),
|
|
59
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
60
|
+
priceOverride = _useState10[0],
|
|
61
|
+
setPriceOverride = _useState10[1];
|
|
62
|
+
var _useState11 = useState(false),
|
|
63
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
64
|
+
showPriceAdjustModal = _useState12[0],
|
|
65
|
+
setShowPriceAdjustModal = _useState12[1];
|
|
66
|
+
var _useState13 = useState([]),
|
|
67
|
+
_useState14 = _slicedToArray(_useState13, 2),
|
|
68
|
+
discounts = _useState14[0],
|
|
69
|
+
setDiscounts = _useState14[1];
|
|
70
|
+
var _useState15 = useState(false),
|
|
71
|
+
_useState16 = _slicedToArray(_useState15, 2),
|
|
72
|
+
noteModalOpen = _useState16[0],
|
|
73
|
+
setNoteModalOpen = _useState16[1];
|
|
74
|
+
var _useState17 = useState({
|
|
75
|
+
price: 0,
|
|
76
|
+
product_id: 0,
|
|
77
|
+
product_variant_id: 0,
|
|
78
|
+
bundle: [],
|
|
79
|
+
option: []
|
|
80
|
+
}),
|
|
81
|
+
_useState18 = _slicedToArray(_useState17, 2),
|
|
82
|
+
skuValue = _useState18[0],
|
|
83
|
+
setSkuValue = _useState18[1];
|
|
84
|
+
var _useState19 = useState({
|
|
85
|
+
product_id: 0,
|
|
86
|
+
price: 0,
|
|
87
|
+
product_variant_id: 0,
|
|
88
|
+
bundle: [],
|
|
89
|
+
option: []
|
|
90
|
+
}),
|
|
91
|
+
_useState20 = _slicedToArray(_useState19, 2),
|
|
92
|
+
skuDefaultValue = _useState20[0],
|
|
93
|
+
setSkuDefaultValue = _useState20[1];
|
|
94
|
+
var openParamsRef = useRef(null);
|
|
95
|
+
var Toast = useToast();
|
|
96
|
+
/**
|
|
97
|
+
* @description SKUOptionsSelection ref,用于触发内部校验与读取最终值
|
|
98
|
+
*/
|
|
99
|
+
var skuOptionsSelectionRef = useRef(null);
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* @description 库存提醒弹窗(允许缺货加入购物车时触发)
|
|
103
|
+
*/
|
|
104
|
+
var _useState21 = useState(false),
|
|
105
|
+
_useState22 = _slicedToArray(_useState21, 2),
|
|
106
|
+
stockAlertOpen = _useState22[0],
|
|
107
|
+
setStockAlertOpen = _useState22[1];
|
|
108
|
+
var _useState23 = useState(false),
|
|
109
|
+
_useState24 = _slicedToArray(_useState23, 2),
|
|
110
|
+
stockAlertDontShowAgainChecked = _useState24[0],
|
|
111
|
+
setStockAlertDontShowAgainChecked = _useState24[1];
|
|
112
|
+
var pendingConfirmDataRef = useRef(null);
|
|
113
|
+
var _useState25 = useState(0),
|
|
114
|
+
_useState26 = _slicedToArray(_useState25, 2),
|
|
115
|
+
currentStep = _useState26[0],
|
|
116
|
+
setCurrentStep = _useState26[1];
|
|
117
|
+
var procedureRef = useRef(null);
|
|
118
|
+
var context = useEngineContext();
|
|
119
|
+
var _ref2 = ((_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 ? void 0 : _context$appHelper.utils) || {},
|
|
120
|
+
store = _ref2.store,
|
|
121
|
+
getData = _ref2.getData;
|
|
122
|
+
/**
|
|
123
|
+
* @description
|
|
124
|
+
* booking state 需要从 Booking 的 Context 读取(与 editService 保持一致),不要用 store.getState()
|
|
125
|
+
*/
|
|
126
|
+
var _ref3 = useContext(BookingContext) || {},
|
|
127
|
+
bookingState = _ref3.state;
|
|
128
|
+
var symbol = (store === null || store === void 0 || (_store$getState = store.getState) === null || _store$getState === void 0 || (_store$getState = _store$getState.call(store)) === null || _store$getState === void 0 || (_store$getState = _store$getState.global) === null || _store$getState === void 0 ? void 0 : _store$getState.symbol) || '$';
|
|
129
|
+
locales.init(localeTexts, (context === null || context === void 0 || (_context$engine = context.engine) === null || _context$engine === void 0 || (_context$engine = _context$engine.props) === null || _context$engine === void 0 ? void 0 : _context$engine.locale) || 'en');
|
|
130
|
+
useImperativeHandle(ref, function () {
|
|
131
|
+
return {
|
|
132
|
+
open: function () {
|
|
133
|
+
var _open = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(data) {
|
|
134
|
+
var _data$_extend, _data$_extend2, _data$_extend3, _data$_extend4, _data$_extend5, _data$_extend6, _data$_extend7, _data$_extend8, _data$_extend9, _data$_extend10;
|
|
135
|
+
var _ref4, _is_eject, _hydratedData$_extend, open_deposit, productDetail, apiData, basePrice, hydratedData, isEject, _data;
|
|
136
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
137
|
+
while (1) switch (_context.prev = _context.next) {
|
|
138
|
+
case 0:
|
|
139
|
+
setCurrentStep(1);
|
|
140
|
+
// create 模式:只有 id/date/is_eject,先请求详情再打开
|
|
141
|
+
if (!('date' in data && !('_extend' in data))) {
|
|
142
|
+
_context.next = 25;
|
|
143
|
+
break;
|
|
144
|
+
}
|
|
145
|
+
openParamsRef.current = data;
|
|
146
|
+
open_deposit = (getData === null || getData === void 0 ? void 0 : getData('bookingv2_deposit')) || 0;
|
|
147
|
+
_context.next = 6;
|
|
148
|
+
return getProductDetail(String(data.id), {
|
|
149
|
+
schedule_date: data.date,
|
|
150
|
+
is_eject: data.is_eject,
|
|
151
|
+
open_deposit: open_deposit
|
|
152
|
+
});
|
|
153
|
+
case 6:
|
|
154
|
+
productDetail = _context.sent;
|
|
155
|
+
apiData = (productDetail === null || productDetail === void 0 ? void 0 : productDetail.data) || {};
|
|
156
|
+
basePrice = Number((apiData === null || apiData === void 0 ? void 0 : apiData.price) || 0);
|
|
157
|
+
hydratedData = _objectSpread(_objectSpread({}, apiData), {}, {
|
|
158
|
+
id: (apiData === null || apiData === void 0 ? void 0 : apiData.id) || data.id,
|
|
159
|
+
product_id: (apiData === null || apiData === void 0 ? void 0 : apiData.product_id) || data.id,
|
|
160
|
+
_extend: _objectSpread(_objectSpread({}, (apiData === null || apiData === void 0 ? void 0 : apiData._extend) || {}), {}, {
|
|
161
|
+
product_name: (apiData === null || apiData === void 0 ? void 0 : apiData.title) || (apiData === null || apiData === void 0 ? void 0 : apiData.product_name) || '',
|
|
162
|
+
quantity: 1,
|
|
163
|
+
price: basePrice,
|
|
164
|
+
total: basePrice,
|
|
165
|
+
origin_total: basePrice,
|
|
166
|
+
note: '',
|
|
167
|
+
skuValue: {
|
|
168
|
+
product_id: (apiData === null || apiData === void 0 ? void 0 : apiData.id) || data.id,
|
|
169
|
+
product_variant_id: 0,
|
|
170
|
+
bundle: [],
|
|
171
|
+
option: []
|
|
172
|
+
}
|
|
173
|
+
})
|
|
174
|
+
}); // 如果该商品不需要弹窗(is_eject !== 1),则直接走确认回调,不再展示弹窗
|
|
175
|
+
isEject = Number((_ref4 = (_is_eject = apiData === null || apiData === void 0 ? void 0 : apiData.is_eject) !== null && _is_eject !== void 0 ? _is_eject : data.is_eject) !== null && _ref4 !== void 0 ? _ref4 : 0) === 1;
|
|
176
|
+
if (isEject) {
|
|
177
|
+
_context.next = 15;
|
|
178
|
+
break;
|
|
179
|
+
}
|
|
180
|
+
onConfirm === null || onConfirm === void 0 || onConfirm(hydratedData);
|
|
181
|
+
modalCloseAction();
|
|
182
|
+
return _context.abrupt("return");
|
|
183
|
+
case 15:
|
|
184
|
+
setProductData(hydratedData);
|
|
185
|
+
setNote('');
|
|
186
|
+
setQuantity((apiData === null || apiData === void 0 ? void 0 : apiData.min_num_unit) || 1);
|
|
187
|
+
setDiscounts([]);
|
|
188
|
+
setSkuValue({
|
|
189
|
+
product_id: hydratedData.id,
|
|
190
|
+
product_variant_id: 0,
|
|
191
|
+
bundle: [],
|
|
192
|
+
option: []
|
|
193
|
+
});
|
|
194
|
+
setSkuDefaultValue({
|
|
195
|
+
product_id: hydratedData.id,
|
|
196
|
+
product_variant_id: 0,
|
|
197
|
+
bundle: [],
|
|
198
|
+
option: [],
|
|
199
|
+
price: (hydratedData === null || hydratedData === void 0 || (_hydratedData$_extend = hydratedData._extend) === null || _hydratedData$_extend === void 0 ? void 0 : _hydratedData$_extend.price) || 0
|
|
200
|
+
});
|
|
201
|
+
setPriceOverride(null);
|
|
202
|
+
setShowPriceAdjustModal(false);
|
|
203
|
+
setOpen(true);
|
|
204
|
+
return _context.abrupt("return");
|
|
205
|
+
case 25:
|
|
206
|
+
// edit 模式:直接使用传入的 ProductData
|
|
207
|
+
openParamsRef.current = null;
|
|
208
|
+
_data = safeClone(data);
|
|
209
|
+
setProductData(_data);
|
|
210
|
+
console.log(_data, '_data');
|
|
211
|
+
setNote((_data === null || _data === void 0 || (_data$_extend = _data._extend) === null || _data$_extend === void 0 ? void 0 : _data$_extend.note) || '');
|
|
212
|
+
setQuantity((_data === null || _data === void 0 || (_data$_extend2 = _data._extend) === null || _data$_extend2 === void 0 ? void 0 : _data$_extend2.quantity) || 1);
|
|
213
|
+
setDiscounts((_data === null || _data === void 0 ? void 0 : _data.discount_list) || []);
|
|
214
|
+
console.log({
|
|
215
|
+
product_id: _data === null || _data === void 0 ? void 0 : _data.product_id,
|
|
216
|
+
product_variant_id: (_data === null || _data === void 0 || (_data$_extend3 = _data._extend) === null || _data$_extend3 === void 0 || (_data$_extend3 = _data$_extend3.other) === null || _data$_extend3 === void 0 ? void 0 : _data$_extend3.product_variant_id) || 0,
|
|
217
|
+
bundle: (_data === null || _data === void 0 || (_data$_extend4 = _data._extend) === null || _data$_extend4 === void 0 || (_data$_extend4 = _data$_extend4.other) === null || _data$_extend4 === void 0 ? void 0 : _data$_extend4.bundle) || [],
|
|
218
|
+
option: (_data === null || _data === void 0 || (_data$_extend5 = _data._extend) === null || _data$_extend5 === void 0 || (_data$_extend5 = _data$_extend5.other) === null || _data$_extend5 === void 0 ? void 0 : _data$_extend5.option) || []
|
|
219
|
+
}, 'skuValue');
|
|
220
|
+
// setSkuValue({
|
|
221
|
+
// product_id: _data?.product_id,
|
|
222
|
+
// product_variant_id: _data?._extend?.other?.product_variant_id || 0,
|
|
223
|
+
// bundle: _data?._extend?.other?.bundle || [],
|
|
224
|
+
// option: _data?._extend?.other?.option || [],
|
|
225
|
+
// });
|
|
226
|
+
setSkuDefaultValue({
|
|
227
|
+
product_id: _data === null || _data === void 0 ? void 0 : _data.product_id,
|
|
228
|
+
product_variant_id: (_data === null || _data === void 0 || (_data$_extend6 = _data._extend) === null || _data$_extend6 === void 0 || (_data$_extend6 = _data$_extend6.other) === null || _data$_extend6 === void 0 ? void 0 : _data$_extend6.product_variant_id) || 0,
|
|
229
|
+
price: (_data === null || _data === void 0 || (_data$_extend7 = _data._extend) === null || _data$_extend7 === void 0 ? void 0 : _data$_extend7.price) || 0,
|
|
230
|
+
bundle: (_data === null || _data === void 0 || (_data$_extend8 = _data._extend) === null || _data$_extend8 === void 0 || (_data$_extend8 = _data$_extend8.other) === null || _data$_extend8 === void 0 ? void 0 : _data$_extend8.bundle) || [],
|
|
231
|
+
option: (_data === null || _data === void 0 || (_data$_extend9 = _data._extend) === null || _data$_extend9 === void 0 || (_data$_extend9 = _data$_extend9.other) === null || _data$_extend9 === void 0 ? void 0 : _data$_extend9.option) || []
|
|
232
|
+
});
|
|
233
|
+
setPriceOverride((_data === null || _data === void 0 || (_data$_extend10 = _data._extend) === null || _data$_extend10 === void 0 ? void 0 : _data$_extend10.priceOverride) || undefined);
|
|
234
|
+
// setPriceOverride(getInitialPriceOverrideFromProductData({ productData: _data }))
|
|
235
|
+
setShowPriceAdjustModal(false);
|
|
236
|
+
setTimeout(function () {
|
|
237
|
+
setOpen(true);
|
|
238
|
+
}, 0);
|
|
239
|
+
case 37:
|
|
240
|
+
case "end":
|
|
241
|
+
return _context.stop();
|
|
242
|
+
}
|
|
243
|
+
}, _callee);
|
|
244
|
+
}));
|
|
245
|
+
function open(_x) {
|
|
246
|
+
return _open.apply(this, arguments);
|
|
247
|
+
}
|
|
248
|
+
return open;
|
|
249
|
+
}()
|
|
250
|
+
};
|
|
251
|
+
});
|
|
252
|
+
var priceText = useMemo(function () {
|
|
253
|
+
var _productData$_extend;
|
|
254
|
+
var price = (productData === null || productData === void 0 || (_productData$_extend = productData._extend) === null || _productData$_extend === void 0 ? void 0 : _productData$_extend.price) || 0;
|
|
255
|
+
var priceSign = Number(price) < 0 ? '-' : '';
|
|
256
|
+
return "".concat(priceSign).concat(symbol).concat(Math.abs(Number(price)));
|
|
257
|
+
}, [productData === null || productData === void 0 || (_productData$_extend2 = productData._extend) === null || _productData$_extend2 === void 0 ? void 0 : _productData$_extend2.price, symbol]);
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* @title 商品单价(含套餐/单规格/组合规格)
|
|
261
|
+
* @description
|
|
262
|
+
* - 套餐:主商品价格 + 选择的套餐子商品(含其单规格)的总价
|
|
263
|
+
* - 单规格:主商品价格 + 单规格加价
|
|
264
|
+
* - 组合规格:使用选中变体价格作为主商品价格,再叠加 bundle/option
|
|
265
|
+
*
|
|
266
|
+
* @note 计算规则对齐 booking/utils.ts 的 getProductTotalPrice
|
|
267
|
+
*/
|
|
268
|
+
var unitPrice = useMemo(function () {
|
|
269
|
+
var activeSkuValue = skuValue !== null && skuValue !== void 0 && skuValue.product_id ? skuValue : skuDefaultValue;
|
|
270
|
+
return getSelectedUnitPrice({
|
|
271
|
+
productData: productData,
|
|
272
|
+
skuValue: activeSkuValue
|
|
273
|
+
});
|
|
274
|
+
}, [productData, skuValue, skuDefaultValue]);
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* @description 最终用于展示总价的单价
|
|
278
|
+
* - 若设置过手动改价,则始终使用手动改价单价
|
|
279
|
+
* - 否则使用 sku 计算出来的单价
|
|
280
|
+
*/
|
|
281
|
+
var displayUnitPrice = useMemo(function () {
|
|
282
|
+
if (priceOverride === null || typeof priceOverride === 'undefined') return unitPrice;
|
|
283
|
+
return priceOverride;
|
|
284
|
+
}, [priceOverride, unitPrice]);
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* @title 售价小计
|
|
288
|
+
* @description
|
|
289
|
+
* 小计展示的是「商品单价」(即主商品 + 套餐子商品 + 单规格/组合规格加价的合计)
|
|
290
|
+
*/
|
|
291
|
+
var subtotal = useMemo(function () {
|
|
292
|
+
return new Decimal(unitPrice || 0);
|
|
293
|
+
}, [unitPrice]);
|
|
294
|
+
var subtotalText = useMemo(function () {
|
|
295
|
+
var priceSign = subtotal.toNumber() < 0 ? '-' : '';
|
|
296
|
+
return "".concat(priceSign).concat(symbol).concat(subtotal.abs().toNumber().toFixed(2));
|
|
297
|
+
}, [subtotal, symbol]);
|
|
298
|
+
var discountsCount = useMemo(function () {
|
|
299
|
+
return (discounts === null || discounts === void 0 ? void 0 : discounts.length) || 0;
|
|
300
|
+
}, [discounts]);
|
|
301
|
+
|
|
302
|
+
/**
|
|
303
|
+
* @title 折扣信息
|
|
304
|
+
*/
|
|
305
|
+
var totalDiscounts = useMemo(function () {
|
|
306
|
+
if ((discounts === null || discounts === void 0 ? void 0 : discounts.length) > 0) {
|
|
307
|
+
return discounts.reduce(function (sum, discount) {
|
|
308
|
+
var includeType = ['discount_card', 'product_discount_card'];
|
|
309
|
+
var _quantity = includeType.includes((discount === null || discount === void 0 ? void 0 : discount.type) || '') ? quantity : 1;
|
|
310
|
+
return sum.plus(new Decimal((discount === null || discount === void 0 ? void 0 : discount.amount) || 0).mul(_quantity));
|
|
311
|
+
}, new Decimal(0)).toNumber().toFixed(2);
|
|
312
|
+
}
|
|
313
|
+
return '0.00';
|
|
314
|
+
}, [discounts, quantity]);
|
|
315
|
+
|
|
316
|
+
/**
|
|
317
|
+
* @title 最终价格
|
|
318
|
+
* @description 商品总价 = 商品单价 * 商品数量
|
|
319
|
+
*/
|
|
320
|
+
var finalTotal = useMemo(function () {
|
|
321
|
+
var deTotal = new Decimal(displayUnitPrice || '0');
|
|
322
|
+
var deQuantity = new Decimal(quantity || '1');
|
|
323
|
+
return deTotal.mul(deQuantity);
|
|
324
|
+
}, [displayUnitPrice, quantity]);
|
|
325
|
+
var totalText = useMemo(function () {
|
|
326
|
+
var priceSign = finalTotal.toNumber() < 0 ? '-' : '';
|
|
327
|
+
return "".concat(priceSign).concat(symbol).concat(finalTotal.abs().toNumber().toFixed(2));
|
|
328
|
+
}, [finalTotal, symbol]);
|
|
329
|
+
|
|
330
|
+
/**
|
|
331
|
+
* @description 价格变动展示(仅当设置过手动改价时展示)
|
|
332
|
+
* - 展示手动改价的单价
|
|
333
|
+
* - 展示相对 sku 单价的变动额: (priceOverride - unitPrice) * quantity
|
|
334
|
+
*/
|
|
335
|
+
var priceOverrideText = useMemo(function () {
|
|
336
|
+
if (priceOverride === null || typeof priceOverride === 'undefined') return '';
|
|
337
|
+
var prefix = "(".concat(locales.getText('pisell2.text.sku.detail.modal.price.override'), " ");
|
|
338
|
+
var overrideNumber = new Decimal(priceOverride || 0);
|
|
339
|
+
var sign = overrideNumber.toNumber() < 0 ? '-' : '';
|
|
340
|
+
var absValue = overrideNumber.abs().toNumber().toFixed(2);
|
|
341
|
+
return "".concat(prefix).concat(sign).concat(symbol).concat(absValue, ")");
|
|
342
|
+
}, [priceOverride, symbol]);
|
|
343
|
+
var priceChangeText = useMemo(function () {
|
|
344
|
+
if (priceOverride === null || typeof priceOverride === 'undefined') return '';
|
|
345
|
+
var diff = new Decimal(priceOverride || 0).minus(new Decimal(unitPrice || 0)).mul(new Decimal(quantity || 1));
|
|
346
|
+
var diffNumber = diff.toNumber();
|
|
347
|
+
var diffSign = diffNumber > 0 ? '+' : diffNumber < 0 ? '-' : '';
|
|
348
|
+
var absDiff = diff.abs().toNumber().toFixed(2);
|
|
349
|
+
return "".concat(diffSign).concat(symbol).concat(absDiff);
|
|
350
|
+
}, [priceOverride, unitPrice, quantity, symbol]);
|
|
351
|
+
var modalCloseAction = function modalCloseAction() {
|
|
352
|
+
setOpen(false);
|
|
353
|
+
setProductData(null);
|
|
354
|
+
setNote('');
|
|
355
|
+
setQuantity(1);
|
|
356
|
+
setNoteModalOpen(false);
|
|
357
|
+
setPriceOverride(null);
|
|
358
|
+
setShowPriceAdjustModal(false);
|
|
359
|
+
setDiscounts([]);
|
|
360
|
+
openParamsRef.current = null;
|
|
361
|
+
};
|
|
362
|
+
var handleCancel = function handleCancel() {
|
|
363
|
+
modalCloseAction();
|
|
364
|
+
onClose === null || onClose === void 0 || onClose();
|
|
365
|
+
};
|
|
366
|
+
|
|
367
|
+
/**
|
|
368
|
+
* @description 检查当前选择下的库存是否充足
|
|
369
|
+
*/
|
|
370
|
+
var handleCheckStock = function handleCheckStock(params) {
|
|
371
|
+
var _value$bundle;
|
|
372
|
+
var value = (params === null || params === void 0 ? void 0 : params.value) || skuValue;
|
|
373
|
+
var data = (params === null || params === void 0 ? void 0 : params.data) || productData;
|
|
374
|
+
if (!data) return true;
|
|
375
|
+
// 检测 variant 库存
|
|
376
|
+
if (value !== null && value !== void 0 && value.product_variant_id && data) {
|
|
377
|
+
var _variant;
|
|
378
|
+
var variantItem = data === null || data === void 0 || (_variant = data.variant) === null || _variant === void 0 ? void 0 : _variant.find(function (item) {
|
|
379
|
+
return item.id === value.product_variant_id;
|
|
380
|
+
});
|
|
381
|
+
var variantCanSell = checkSkuStockCanSell(variantItem);
|
|
382
|
+
if (!variantCanSell.hasStock) {
|
|
383
|
+
return false;
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
// 检测 bundle 库存
|
|
387
|
+
if ((value === null || value === void 0 || (_value$bundle = value.bundle) === null || _value$bundle === void 0 ? void 0 : _value$bundle.length) > 0 && data) {
|
|
388
|
+
var bundleCanSell = value === null || value === void 0 ? void 0 : value.bundle.every(function (item) {
|
|
389
|
+
var data = checkSkuStockCanSell(item);
|
|
390
|
+
return data.hasStock;
|
|
391
|
+
});
|
|
392
|
+
if (!bundleCanSell) {
|
|
393
|
+
return false;
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
// 检测商品本身库存
|
|
397
|
+
var productCanSell = checkSkuStockCanSell(data);
|
|
398
|
+
if (!productCanSell.hasStock) {
|
|
399
|
+
return false;
|
|
400
|
+
}
|
|
401
|
+
return true;
|
|
402
|
+
};
|
|
403
|
+
var handleConfirm = /*#__PURE__*/function () {
|
|
404
|
+
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
405
|
+
var _bookingState$booking;
|
|
406
|
+
var _procedureRef$current, _procedureRef$current2, requiredOptionValidation, shouldValidate, _skuOptionsSelectionR, _skuOptionsSelectionR2, isValid, _skuOptionsSelectionR3, _skuOptionsSelectionR4, _bookingState$booking2, _bookingState$booking3, _bookingState$booking4, _bookingState$booking5, _bookingState$booking6, _bookingState$booking7, latestSkuValue, updatedData, stockValidation, allowAddToCartWhenOutStock, enableDontShowAgainToday, hasStock, productId, shouldSkipAlert;
|
|
407
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
408
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
409
|
+
case 0:
|
|
410
|
+
if (!(currentStep === 0)) {
|
|
411
|
+
_context2.next = 4;
|
|
412
|
+
break;
|
|
413
|
+
}
|
|
414
|
+
(_procedureRef$current = procedureRef.current) === null || _procedureRef$current === void 0 || (_procedureRef$current2 = _procedureRef$current.goToStep) === null || _procedureRef$current2 === void 0 || _procedureRef$current2.call(_procedureRef$current, 1);
|
|
415
|
+
setCurrentStep(1);
|
|
416
|
+
return _context2.abrupt("return");
|
|
417
|
+
case 4:
|
|
418
|
+
/**
|
|
419
|
+
* @description Confirm 前是否需要触发 SKU 选择校验
|
|
420
|
+
* - required_option_validation 不为 0:需要校验(失败阻断)
|
|
421
|
+
* - required_option_validation 为 0:不校验(无论成功/失败都允许提交)
|
|
422
|
+
*
|
|
423
|
+
* @note 配置缺失时默认走“需要校验”,保持更安全的默认行为
|
|
424
|
+
*/
|
|
425
|
+
requiredOptionValidation = bookingState === null || bookingState === void 0 || (_bookingState$booking = bookingState.bookingConfig) === null || _bookingState$booking === void 0 || (_bookingState$booking = _bookingState$booking.config) === null || _bookingState$booking === void 0 || (_bookingState$booking = _bookingState$booking.product_setting_tab) === null || _bookingState$booking === void 0 ? void 0 : _bookingState$booking.required_option_validation;
|
|
426
|
+
shouldValidate = Number(requiredOptionValidation !== null && requiredOptionValidation !== void 0 ? requiredOptionValidation : 1) !== 0;
|
|
427
|
+
if (!shouldValidate) {
|
|
428
|
+
_context2.next = 19;
|
|
429
|
+
break;
|
|
430
|
+
}
|
|
431
|
+
_context2.prev = 7;
|
|
432
|
+
_context2.next = 10;
|
|
433
|
+
return (_skuOptionsSelectionR = skuOptionsSelectionRef.current) === null || _skuOptionsSelectionR === void 0 || (_skuOptionsSelectionR2 = _skuOptionsSelectionR.validate) === null || _skuOptionsSelectionR2 === void 0 ? void 0 : _skuOptionsSelectionR2.call(_skuOptionsSelectionR);
|
|
434
|
+
case 10:
|
|
435
|
+
isValid = _context2.sent;
|
|
436
|
+
if (isValid) {
|
|
437
|
+
_context2.next = 13;
|
|
438
|
+
break;
|
|
439
|
+
}
|
|
440
|
+
return _context2.abrupt("return");
|
|
441
|
+
case 13:
|
|
442
|
+
_context2.next = 19;
|
|
443
|
+
break;
|
|
444
|
+
case 15:
|
|
445
|
+
_context2.prev = 15;
|
|
446
|
+
_context2.t0 = _context2["catch"](7);
|
|
447
|
+
// 预期外错误:阻断提交,避免提交不合法数据
|
|
448
|
+
console.log('sku_detail_modal_validate_error>>>>>', _context2.t0);
|
|
449
|
+
return _context2.abrupt("return");
|
|
450
|
+
case 19:
|
|
451
|
+
if (!(productData && onConfirm)) {
|
|
452
|
+
_context2.next = 40;
|
|
453
|
+
break;
|
|
454
|
+
}
|
|
455
|
+
/**
|
|
456
|
+
* @description 优先从 SKUOptionsSelection ref 读取最新转换后的值
|
|
457
|
+
*/
|
|
458
|
+
latestSkuValue = ((_skuOptionsSelectionR3 = skuOptionsSelectionRef.current) === null || _skuOptionsSelectionR3 === void 0 || (_skuOptionsSelectionR4 = _skuOptionsSelectionR3.getTransformValues) === null || _skuOptionsSelectionR4 === void 0 ? void 0 : _skuOptionsSelectionR4.call(_skuOptionsSelectionR3)) || skuValue || skuDefaultValue;
|
|
459
|
+
updatedData = _objectSpread(_objectSpread({}, productData), {}, {
|
|
460
|
+
discount_list: discounts || [],
|
|
461
|
+
_extend: _objectSpread(_objectSpread({}, (productData === null || productData === void 0 ? void 0 : productData._extend) || {}), {}, {
|
|
462
|
+
quantity: quantity,
|
|
463
|
+
note: note,
|
|
464
|
+
// 上层 getProductTotalPrice 依赖 other 来计算(组合规格/套餐/单规格)
|
|
465
|
+
other: getOtherFromSkuValue({
|
|
466
|
+
productData: productData,
|
|
467
|
+
skuValue: latestSkuValue
|
|
468
|
+
}),
|
|
469
|
+
skuValue: getOtherFromSkuValue({
|
|
470
|
+
productData: productData,
|
|
471
|
+
skuValue: latestSkuValue
|
|
472
|
+
})
|
|
473
|
+
}, priceOverride !== null && typeof priceOverride !== 'undefined' ? {
|
|
474
|
+
priceOverride: priceOverride
|
|
475
|
+
} : {})
|
|
476
|
+
});
|
|
477
|
+
/**
|
|
478
|
+
* @description 库存校验(受全局配置控制)
|
|
479
|
+
* - stock_validation === 1:启用库存校验
|
|
480
|
+
* - allow_add_to_cart_when_out_stock === 1:缺货允许加入购物车(弹窗提示)
|
|
481
|
+
*/
|
|
482
|
+
stockValidation = Number((_bookingState$booking2 = bookingState === null || bookingState === void 0 || (_bookingState$booking3 = bookingState.bookingConfig) === null || _bookingState$booking3 === void 0 || (_bookingState$booking3 = _bookingState$booking3.config) === null || _bookingState$booking3 === void 0 || (_bookingState$booking3 = _bookingState$booking3.stock_setting) === null || _bookingState$booking3 === void 0 ? void 0 : _bookingState$booking3.stock_validation) !== null && _bookingState$booking2 !== void 0 ? _bookingState$booking2 : 0);
|
|
483
|
+
allowAddToCartWhenOutStock = Number((_bookingState$booking4 = bookingState === null || bookingState === void 0 || (_bookingState$booking5 = bookingState.bookingConfig) === null || _bookingState$booking5 === void 0 || (_bookingState$booking5 = _bookingState$booking5.config) === null || _bookingState$booking5 === void 0 || (_bookingState$booking5 = _bookingState$booking5.stock_setting) === null || _bookingState$booking5 === void 0 ? void 0 : _bookingState$booking5.allow_add_to_cart_when_out_stock) !== null && _bookingState$booking4 !== void 0 ? _bookingState$booking4 : 0);
|
|
484
|
+
enableDontShowAgainToday = Number((_bookingState$booking6 = bookingState === null || bookingState === void 0 || (_bookingState$booking7 = bookingState.bookingConfig) === null || _bookingState$booking7 === void 0 || (_bookingState$booking7 = _bookingState$booking7.config) === null || _bookingState$booking7 === void 0 || (_bookingState$booking7 = _bookingState$booking7.stock_setting) === null || _bookingState$booking7 === void 0 ? void 0 : _bookingState$booking7.do_not_show_again_today) !== null && _bookingState$booking6 !== void 0 ? _bookingState$booking6 : 0);
|
|
485
|
+
if (!(stockValidation === 1)) {
|
|
486
|
+
_context2.next = 38;
|
|
487
|
+
break;
|
|
488
|
+
}
|
|
489
|
+
hasStock = handleCheckStock({
|
|
490
|
+
value: latestSkuValue,
|
|
491
|
+
data: productData
|
|
492
|
+
});
|
|
493
|
+
if (hasStock) {
|
|
494
|
+
_context2.next = 38;
|
|
495
|
+
break;
|
|
496
|
+
}
|
|
497
|
+
if (!(allowAddToCartWhenOutStock !== 1)) {
|
|
498
|
+
_context2.next = 31;
|
|
499
|
+
break;
|
|
500
|
+
}
|
|
501
|
+
Toast === null || Toast === void 0 || Toast.fail(locales.getText('pisell2.skuOptionsSelection.variantItemCard.soldOut'));
|
|
502
|
+
return _context2.abrupt("return");
|
|
503
|
+
case 31:
|
|
504
|
+
// 缺货允许加入购物车:命中「今天不再提示」则直接提交
|
|
505
|
+
productId = Number((productData === null || productData === void 0 ? void 0 : productData.product_id) || 0);
|
|
506
|
+
shouldSkipAlert = enableDontShowAgainToday === 1 && hasHiddenStockAlertForToday({
|
|
507
|
+
productId: productId
|
|
508
|
+
});
|
|
509
|
+
if (shouldSkipAlert) {
|
|
510
|
+
_context2.next = 38;
|
|
511
|
+
break;
|
|
512
|
+
}
|
|
513
|
+
pendingConfirmDataRef.current = updatedData;
|
|
514
|
+
setStockAlertDontShowAgainChecked(false);
|
|
515
|
+
setStockAlertOpen(true);
|
|
516
|
+
return _context2.abrupt("return");
|
|
517
|
+
case 38:
|
|
518
|
+
onConfirm(updatedData);
|
|
519
|
+
modalCloseAction();
|
|
520
|
+
case 40:
|
|
521
|
+
case "end":
|
|
522
|
+
return _context2.stop();
|
|
523
|
+
}
|
|
524
|
+
}, _callee2, null, [[7, 15]]);
|
|
525
|
+
}));
|
|
526
|
+
return function handleConfirm() {
|
|
527
|
+
return _ref5.apply(this, arguments);
|
|
528
|
+
};
|
|
529
|
+
}();
|
|
530
|
+
var handleStockAlertCancel = function handleStockAlertCancel() {
|
|
531
|
+
pendingConfirmDataRef.current = null;
|
|
532
|
+
setStockAlertOpen(false);
|
|
533
|
+
setStockAlertDontShowAgainChecked(false);
|
|
534
|
+
};
|
|
535
|
+
var handleStockAlertContinue = function handleStockAlertContinue() {
|
|
536
|
+
var _bookingState$booking8, _bookingState$booking9;
|
|
537
|
+
var pendingData = pendingConfirmDataRef.current;
|
|
538
|
+
if (!pendingData) {
|
|
539
|
+
setStockAlertOpen(false);
|
|
540
|
+
return;
|
|
541
|
+
}
|
|
542
|
+
var enableDontShowAgainToday = Number((_bookingState$booking8 = bookingState === null || bookingState === void 0 || (_bookingState$booking9 = bookingState.bookingConfig) === null || _bookingState$booking9 === void 0 || (_bookingState$booking9 = _bookingState$booking9.config) === null || _bookingState$booking9 === void 0 || (_bookingState$booking9 = _bookingState$booking9.stock_setting) === null || _bookingState$booking9 === void 0 ? void 0 : _bookingState$booking9.do_not_show_again_today) !== null && _bookingState$booking8 !== void 0 ? _bookingState$booking8 : 0);
|
|
543
|
+
if (enableDontShowAgainToday === 1 && stockAlertDontShowAgainChecked) {
|
|
544
|
+
var productId = Number((productData === null || productData === void 0 ? void 0 : productData.product_id) || 0);
|
|
545
|
+
setHiddenStockAlertForToday({
|
|
546
|
+
productId: productId
|
|
547
|
+
});
|
|
548
|
+
}
|
|
549
|
+
onConfirm === null || onConfirm === void 0 || onConfirm(pendingData);
|
|
550
|
+
pendingConfirmDataRef.current = null;
|
|
551
|
+
setStockAlertOpen(false);
|
|
552
|
+
modalCloseAction();
|
|
553
|
+
};
|
|
554
|
+
var handleRemove = function handleRemove() {
|
|
555
|
+
if (productData && onRemove) {
|
|
556
|
+
onRemove(productData);
|
|
557
|
+
modalCloseAction();
|
|
558
|
+
}
|
|
559
|
+
};
|
|
560
|
+
var handleQuantityChange = function handleQuantityChange(value) {
|
|
561
|
+
if (value && value > 0) {
|
|
562
|
+
setQuantity(value);
|
|
563
|
+
}
|
|
564
|
+
};
|
|
565
|
+
var onNoteConfirm = function onNoteConfirm(note) {
|
|
566
|
+
setNote(note);
|
|
567
|
+
setNoteModalOpen(false);
|
|
568
|
+
};
|
|
569
|
+
var onNoteDelete = function onNoteDelete() {
|
|
570
|
+
setNote('');
|
|
571
|
+
setNoteModalOpen(false);
|
|
572
|
+
};
|
|
573
|
+
var onNoteCancel = function onNoteCancel() {
|
|
574
|
+
setNoteModalOpen(false);
|
|
575
|
+
};
|
|
576
|
+
var handleManualPriceChange = function handleManualPriceChange() {
|
|
577
|
+
if (!productData) return;
|
|
578
|
+
setShowPriceAdjustModal(true);
|
|
579
|
+
};
|
|
580
|
+
var handlePriceAdjustConfirm = function handlePriceAdjustConfirm(value) {
|
|
581
|
+
setPriceOverride(value);
|
|
582
|
+
// 手动改价后需要清除折扣信息
|
|
583
|
+
setDiscounts([]);
|
|
584
|
+
setShowPriceAdjustModal(false);
|
|
585
|
+
};
|
|
586
|
+
|
|
587
|
+
// 无图时使用商品名称前两个字作为封面文字
|
|
588
|
+
var coverText = useMemo(function () {
|
|
589
|
+
var _productData$title;
|
|
590
|
+
var title = (productData === null || productData === void 0 || (_productData$title = productData.title) === null || _productData$title === void 0 ? void 0 : _productData$title.trim()) || '';
|
|
591
|
+
if (!title) return '';
|
|
592
|
+
return Array.from(title).slice(0, 2).join('');
|
|
593
|
+
}, [productData === null || productData === void 0 ? void 0 : productData.title]);
|
|
594
|
+
var isCreateMode = !!openParamsRef.current;
|
|
595
|
+
var leftContent = function leftContent() {
|
|
596
|
+
return (
|
|
597
|
+
/*#__PURE__*/
|
|
598
|
+
/* 左侧商品图片和操作 */
|
|
599
|
+
React.createElement("div", {
|
|
600
|
+
className: "sku-detail-left"
|
|
601
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
602
|
+
className: "sku-detail-left-content"
|
|
603
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
604
|
+
className: "product-image"
|
|
605
|
+
}, productData !== null && productData !== void 0 && productData.cover ? /*#__PURE__*/React.createElement("img", {
|
|
606
|
+
src: (productData === null || productData === void 0 ? void 0 : productData.cover) || ''
|
|
607
|
+
}) : /*#__PURE__*/React.createElement("div", {
|
|
608
|
+
className: "product-cover-text"
|
|
609
|
+
}, coverText)), /*#__PURE__*/React.createElement("div", {
|
|
610
|
+
className: "product-info"
|
|
611
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
612
|
+
className: "product-info-left"
|
|
613
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
614
|
+
className: "product-name"
|
|
615
|
+
}, (productData === null || productData === void 0 ? void 0 : productData.title) || ''), /*#__PURE__*/React.createElement("div", {
|
|
616
|
+
className: "product-spec"
|
|
617
|
+
}))), /*#__PURE__*/React.createElement("div", {
|
|
618
|
+
className: "product-actions"
|
|
619
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
620
|
+
size: "large",
|
|
621
|
+
className: "add-note-btn",
|
|
622
|
+
onClick: function onClick() {
|
|
623
|
+
return setNoteModalOpen(true);
|
|
624
|
+
}
|
|
625
|
+
}, locales.getText('pisell2.text.sku.detail.modal.btn.add.note'))), note && /*#__PURE__*/React.createElement("div", {
|
|
626
|
+
className: "note-section"
|
|
627
|
+
}, /*#__PURE__*/React.createElement("div", null, locales.getText('pisell2.text.sku.detail.modal.note')), /*#__PURE__*/React.createElement("div", {
|
|
628
|
+
className: "note-text",
|
|
629
|
+
onClick: function onClick() {
|
|
630
|
+
return setNoteModalOpen(true);
|
|
631
|
+
}
|
|
632
|
+
}, note))), /*#__PURE__*/React.createElement("div", {
|
|
633
|
+
className: "price-summary-section"
|
|
634
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
635
|
+
className: "price-item"
|
|
636
|
+
}, /*#__PURE__*/React.createElement("div", null, locales.getText('pisell2.text.sku.detail.modal.subtotal')), /*#__PURE__*/React.createElement("div", null, subtotalText)), /*#__PURE__*/React.createElement("div", {
|
|
637
|
+
className: "price-item"
|
|
638
|
+
}, /*#__PURE__*/React.createElement("div", null, locales.getText('pisell2.text.sku.detail.modal.discount'), discountsCount > 0 && /*#__PURE__*/React.createElement("span", {
|
|
639
|
+
className: "price-item-danger"
|
|
640
|
+
}, "\xA0(", discountsCount, ")")), /*#__PURE__*/React.createElement("div", {
|
|
641
|
+
className: "price-item-danger"
|
|
642
|
+
}, discountsCount > 0 ? '-' : '', symbol, totalDiscounts)), priceOverride !== null && typeof priceOverride !== 'undefined' && /*#__PURE__*/React.createElement("div", {
|
|
643
|
+
className: "price-item"
|
|
644
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
645
|
+
onClick: handleManualPriceChange
|
|
646
|
+
}, locales.getText('pisell2.text.sku.detail.modal.manual.price.change'), /*#__PURE__*/React.createElement("span", {
|
|
647
|
+
className: "price-item-override"
|
|
648
|
+
}, priceOverrideText)), /*#__PURE__*/React.createElement("div", {
|
|
649
|
+
className: "price-item-danger"
|
|
650
|
+
}, priceChangeText)), /*#__PURE__*/React.createElement("div", {
|
|
651
|
+
className: "price-item-total"
|
|
652
|
+
}, /*#__PURE__*/React.createElement("div", null, locales.getText('pisell2.text.sku.detail.modal.total'), /*#__PURE__*/React.createElement("span", {
|
|
653
|
+
className: "price-item-total-gst"
|
|
654
|
+
}, "\uFF08", productData !== null && productData !== void 0 && productData.is_charge_tax ? locales.getText('pisell2.text.sku.detail.modal.gst.incl') : locales.getText('pisell2.text.sku.detail.modal.gst.excl'), "\uFF09")), /*#__PURE__*/React.createElement("div", null, totalText))))
|
|
655
|
+
);
|
|
656
|
+
};
|
|
657
|
+
if (!productData) return null;
|
|
658
|
+
var rightContent = function rightContent() {
|
|
659
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
660
|
+
className: "sku-detail-right-content"
|
|
661
|
+
}, currentStep === 0 && /*#__PURE__*/React.createElement("div", {
|
|
662
|
+
className: "sku-detail-right-content-detail"
|
|
663
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
664
|
+
className: "sku-detail-right-content-detail-title"
|
|
665
|
+
}, (productData === null || productData === void 0 ? void 0 : productData.title) || ''), /*#__PURE__*/React.createElement("div", {
|
|
666
|
+
className: "sku-detail-right-content-detail-description"
|
|
667
|
+
}, (productData === null || productData === void 0 ? void 0 : productData.subtitle) || '')), currentStep === 1 && /*#__PURE__*/React.createElement(SKUOptionsSelection, {
|
|
668
|
+
ref: skuOptionsSelectionRef,
|
|
669
|
+
dataSource: productData,
|
|
670
|
+
value: skuDefaultValue,
|
|
671
|
+
skuCardConfig: {
|
|
672
|
+
title: {
|
|
673
|
+
lineClamp: 1
|
|
674
|
+
},
|
|
675
|
+
subTitle: {
|
|
676
|
+
lineClamp: 1
|
|
677
|
+
}
|
|
678
|
+
},
|
|
679
|
+
onChange: function onChange(v) {
|
|
680
|
+
setSkuValue(v);
|
|
681
|
+
}
|
|
682
|
+
/**
|
|
683
|
+
* SelectorGroup 内部会基于 scroll parent 计算滚动位置(切换分类/滚动到错误项等)
|
|
684
|
+
* 这里让右侧内容区域自身成为滚动容器(见 index.less),并把 scroll parent 指向它
|
|
685
|
+
*/,
|
|
686
|
+
customScrollParent: ".pisell-sku-detail-modal .sku-detail-right-content"
|
|
687
|
+
}));
|
|
688
|
+
};
|
|
689
|
+
var leftHeaderClose = function leftHeaderClose() {
|
|
690
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
691
|
+
className: "sku-detail-left-close",
|
|
692
|
+
onClick: handleCancel
|
|
693
|
+
}, /*#__PURE__*/React.createElement(Iconfont, {
|
|
694
|
+
type: "pisell2-x-close"
|
|
695
|
+
}), locales.getText('pisell2.text.sku.detail.modal.btn.close'));
|
|
696
|
+
};
|
|
697
|
+
|
|
698
|
+
/**
|
|
699
|
+
* @description Procedure Header:返回按钮(仅在非第一步展示)
|
|
700
|
+
* - 第一页不展示,但必须渲染一个空 div 占位,避免 header 布局抖动
|
|
701
|
+
*/
|
|
702
|
+
var leftHeaderBack = function leftHeaderBack() {
|
|
703
|
+
if (currentStep === 0) {
|
|
704
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
705
|
+
className: "sku-detail-left-back-placeholder"
|
|
706
|
+
});
|
|
707
|
+
}
|
|
708
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
709
|
+
className: "sku-detail-left-back",
|
|
710
|
+
onClick: function onClick() {
|
|
711
|
+
var _procedureRef$current3, _procedureRef$current4;
|
|
712
|
+
(_procedureRef$current3 = procedureRef.current) === null || _procedureRef$current3 === void 0 || (_procedureRef$current4 = _procedureRef$current3.goToStep) === null || _procedureRef$current4 === void 0 || _procedureRef$current4.call(_procedureRef$current3, 0);
|
|
713
|
+
setCurrentStep(0);
|
|
714
|
+
}
|
|
715
|
+
}, /*#__PURE__*/React.createElement(Iconfont, {
|
|
716
|
+
type: "pisell2-arrow-left"
|
|
717
|
+
}), locales.getText('pisell2.text.sku.detail.modal.btn.back'));
|
|
718
|
+
};
|
|
719
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(PisellModal, {
|
|
720
|
+
platform: "pc",
|
|
721
|
+
open: open,
|
|
722
|
+
header: null,
|
|
723
|
+
headerDivider: false,
|
|
724
|
+
footer: null,
|
|
725
|
+
onCancel: handleCancel,
|
|
726
|
+
closable: false,
|
|
727
|
+
destroyOnClose: true,
|
|
728
|
+
width: 880,
|
|
729
|
+
className: "pisell-sku-detail-modal"
|
|
730
|
+
}, /*#__PURE__*/React.createElement(PisellProcedure, {
|
|
731
|
+
ref: procedureRef,
|
|
732
|
+
className: "pisell-sku-procedure",
|
|
733
|
+
mode: "modal",
|
|
734
|
+
defaultCurrent: currentStep,
|
|
735
|
+
onStepsChange: function onStepsChange(result) {
|
|
736
|
+
setCurrentStep(result.currentStep);
|
|
737
|
+
},
|
|
738
|
+
headerProps: {
|
|
739
|
+
showBackOnFirstStep: true,
|
|
740
|
+
showSteps: true,
|
|
741
|
+
left: leftHeaderBack(),
|
|
742
|
+
right: leftHeaderClose(),
|
|
743
|
+
stepsProps: {
|
|
744
|
+
items: [{
|
|
745
|
+
title: locales.getText('pisell2.text.sku.detail.modal.step.details'),
|
|
746
|
+
description: ''
|
|
747
|
+
}, {
|
|
748
|
+
title: locales.getText('pisell2.text.sku.detail.modal.step.select.bundle'),
|
|
749
|
+
description: ''
|
|
750
|
+
}]
|
|
751
|
+
}
|
|
752
|
+
},
|
|
753
|
+
onFirstStepBack: function onFirstStepBack() {
|
|
754
|
+
handleCancel();
|
|
755
|
+
},
|
|
756
|
+
showSideBar: true,
|
|
757
|
+
showFooter: true,
|
|
758
|
+
bodyProps: {
|
|
759
|
+
direction: 'horizontal',
|
|
760
|
+
contentOrder: 'sidebar-first',
|
|
761
|
+
contentSlot: rightContent(),
|
|
762
|
+
sidebarSlot: leftContent(),
|
|
763
|
+
sidebarContainerSelector: '.pisell-sku-detail-modal'
|
|
764
|
+
},
|
|
765
|
+
footerProps: {
|
|
766
|
+
position: 'fixed-bottom',
|
|
767
|
+
style: {
|
|
768
|
+
height: '72px !important'
|
|
769
|
+
},
|
|
770
|
+
leftSlot: /*#__PURE__*/React.createElement("div", {
|
|
771
|
+
className: "quantity-section"
|
|
772
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
773
|
+
className: "quantity-section-title"
|
|
774
|
+
}, locales.getText('pisell2.text.sku.detail.modal.quantity')), /*#__PURE__*/React.createElement(PisellNumberSelector, {
|
|
775
|
+
value: quantity,
|
|
776
|
+
width: "120px",
|
|
777
|
+
onChange: handleQuantityChange,
|
|
778
|
+
min: 1,
|
|
779
|
+
max: 99999,
|
|
780
|
+
step: 1,
|
|
781
|
+
size: "middle",
|
|
782
|
+
enablePriceAdjust: true
|
|
783
|
+
})),
|
|
784
|
+
actions: /*#__PURE__*/React.createElement("div", {
|
|
785
|
+
className: "sku-detail-content-footer"
|
|
786
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
787
|
+
className: "modal-actions"
|
|
788
|
+
}, isCreateMode ? /*#__PURE__*/React.createElement(Button, {
|
|
789
|
+
type: "default",
|
|
790
|
+
size: "large",
|
|
791
|
+
className: "sku-detail-content-footer-remove-btn",
|
|
792
|
+
onClick: handleCancel
|
|
793
|
+
}, locales.getText('pisell2.text.cancel') || 'Cancel') : /*#__PURE__*/React.createElement(Button, {
|
|
794
|
+
type: "primary",
|
|
795
|
+
danger: true,
|
|
796
|
+
size: "large",
|
|
797
|
+
icon: /*#__PURE__*/React.createElement(Delete_wght300_24px, {
|
|
798
|
+
style: {
|
|
799
|
+
fontSize: 20
|
|
800
|
+
}
|
|
801
|
+
}),
|
|
802
|
+
className: "sku-detail-content-footer-remove-btn",
|
|
803
|
+
onClick: handleRemove
|
|
804
|
+
}, locales.getText('pisell2.text.sku.detail.modal.btn.remove')), /*#__PURE__*/React.createElement(Button, {
|
|
805
|
+
type: "default",
|
|
806
|
+
size: "large",
|
|
807
|
+
onClick: handleManualPriceChange,
|
|
808
|
+
className: "sku-detail-content-footer-price-btn"
|
|
809
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
810
|
+
className: "sku-detail-content-footer-price-btn-text"
|
|
811
|
+
}, locales.getText('pisell2.text.sku.detail.modal.btn.manual.price.change'))), /*#__PURE__*/React.createElement(Button, {
|
|
812
|
+
type: "primary",
|
|
813
|
+
size: "large",
|
|
814
|
+
onClick: handleConfirm,
|
|
815
|
+
className: "sku-detail-content-footer-confirm-btn"
|
|
816
|
+
}, currentStep === 0 ? /*#__PURE__*/React.createElement("span", {
|
|
817
|
+
className: "sku-detail-content-footer-confirm-btn-text"
|
|
818
|
+
}, locales.getText('pisell2.text.sku.detail.modal.btn.next')) : /*#__PURE__*/React.createElement("span", {
|
|
819
|
+
className: "sku-detail-content-footer-confirm-btn-text"
|
|
820
|
+
}, locales.getText('pisell2.text.sku.detail.modal.btn.confirm')))))
|
|
821
|
+
}
|
|
822
|
+
}), noteModalOpen && /*#__PURE__*/React.createElement(NoteModal, {
|
|
823
|
+
open: noteModalOpen,
|
|
824
|
+
value: note,
|
|
825
|
+
onCancel: onNoteCancel,
|
|
826
|
+
onConfirm: onNoteConfirm,
|
|
827
|
+
onDelete: onNoteDelete
|
|
828
|
+
}), /*#__PURE__*/React.createElement(DiscountKeyboard, {
|
|
829
|
+
containerProps: {
|
|
830
|
+
renderType: 'modal',
|
|
831
|
+
open: showPriceAdjustModal,
|
|
832
|
+
onCancel: function onCancel() {
|
|
833
|
+
return setShowPriceAdjustModal(false);
|
|
834
|
+
}
|
|
835
|
+
}
|
|
836
|
+
// 允许一口价超出原价
|
|
837
|
+
,
|
|
838
|
+
enableExceedMaxAmount: true,
|
|
839
|
+
originalValue: displayUnitPrice || 0,
|
|
840
|
+
defaultValue: displayUnitPrice || 0,
|
|
841
|
+
onEnter: function onEnter(discountAmount) {
|
|
842
|
+
// 将折扣值转化为最终“单价”
|
|
843
|
+
var nextUnitPrice = new Decimal(displayUnitPrice || 0).minus(discountAmount).toNumber();
|
|
844
|
+
handlePriceAdjustConfirm(nextUnitPrice);
|
|
845
|
+
},
|
|
846
|
+
selectType: "dark"
|
|
847
|
+
})), /*#__PURE__*/React.createElement(PisellModal, {
|
|
848
|
+
platform: "pc",
|
|
849
|
+
open: stockAlertOpen,
|
|
850
|
+
title: locales.getText('pisell2.text.sku.detail.modal.stock.alert.title'),
|
|
851
|
+
headerDivider: false,
|
|
852
|
+
footer: /*#__PURE__*/React.createElement("div", {
|
|
853
|
+
style: {
|
|
854
|
+
width: '100%',
|
|
855
|
+
display: 'flex',
|
|
856
|
+
justifyContent: 'flex-end',
|
|
857
|
+
gap: 12
|
|
858
|
+
}
|
|
859
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
860
|
+
size: "large",
|
|
861
|
+
onClick: handleStockAlertCancel
|
|
862
|
+
}, locales.getText('pisell2.text.sku.detail.modal.stock.alert.btn.cancel')), /*#__PURE__*/React.createElement(Button, {
|
|
863
|
+
type: "primary",
|
|
864
|
+
size: "large",
|
|
865
|
+
onClick: handleStockAlertContinue
|
|
866
|
+
}, locales.getText('pisell2.text.sku.detail.modal.stock.alert.btn.continue'))),
|
|
867
|
+
width: 520,
|
|
868
|
+
centered: true,
|
|
869
|
+
destroyOnClose: true,
|
|
870
|
+
maskClosable: false,
|
|
871
|
+
zIndex: 2000,
|
|
872
|
+
onCancel: handleStockAlertCancel
|
|
873
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
874
|
+
style: {
|
|
875
|
+
padding: '40px 0 0 0'
|
|
876
|
+
}
|
|
877
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
878
|
+
style: {
|
|
879
|
+
color: '#344054',
|
|
880
|
+
fontSize: 14,
|
|
881
|
+
lineHeight: '22px'
|
|
882
|
+
}
|
|
883
|
+
}, locales.getText('pisell2.text.sku.detail.modal.stock.alert.desc')), Number((_bookingState$booking10 = bookingState === null || bookingState === void 0 || (_bookingState$booking11 = bookingState.bookingConfig) === null || _bookingState$booking11 === void 0 || (_bookingState$booking11 = _bookingState$booking11.config) === null || _bookingState$booking11 === void 0 || (_bookingState$booking11 = _bookingState$booking11.stock_setting) === null || _bookingState$booking11 === void 0 ? void 0 : _bookingState$booking11.do_not_show_again_today) !== null && _bookingState$booking10 !== void 0 ? _bookingState$booking10 : 0) === 1 && /*#__PURE__*/React.createElement("div", {
|
|
884
|
+
style: {
|
|
885
|
+
marginTop: 16
|
|
886
|
+
}
|
|
887
|
+
}, /*#__PURE__*/React.createElement(Checkbox, {
|
|
888
|
+
checked: stockAlertDontShowAgainChecked,
|
|
889
|
+
onChange: function onChange(e) {
|
|
890
|
+
var _e$target;
|
|
891
|
+
setStockAlertDontShowAgainChecked(!!(e !== null && e !== void 0 && (_e$target = e.target) !== null && _e$target !== void 0 && _e$target.checked));
|
|
892
|
+
}
|
|
893
|
+
}, locales.getText('pisell2.text.sku.detail.modal.stock.alert.checkbox'))))));
|
|
894
|
+
};
|
|
895
|
+
export default /*#__PURE__*/forwardRef(SkuDetailModal);
|
|
896
|
+
|
|
897
|
+
/**
|
|
898
|
+
* @description 获取本地当天日期 key(本地时区)
|
|
899
|
+
*/
|
|
900
|
+
function getLocalDayKey() {
|
|
901
|
+
var now = new Date();
|
|
902
|
+
var yyyy = String(now.getFullYear());
|
|
903
|
+
var mm = String(now.getMonth() + 1).padStart(2, '0');
|
|
904
|
+
var dd = String(now.getDate()).padStart(2, '0');
|
|
905
|
+
return "".concat(yyyy, "-").concat(mm, "-").concat(dd);
|
|
906
|
+
}
|
|
907
|
+
function getStockAlertStorageKey(params) {
|
|
908
|
+
return "pisell2_stock_alert_hidden_".concat(params.productId);
|
|
909
|
+
}
|
|
910
|
+
|
|
911
|
+
/**
|
|
912
|
+
* @description 判断今天是否已对该商品隐藏库存提示
|
|
913
|
+
*/
|
|
914
|
+
function hasHiddenStockAlertForToday(params) {
|
|
915
|
+
try {
|
|
916
|
+
if (!params.productId) return false;
|
|
917
|
+
if (typeof window === 'undefined') return false;
|
|
918
|
+
var key = getStockAlertStorageKey(params);
|
|
919
|
+
var value = window.localStorage.getItem(key);
|
|
920
|
+
return value === getLocalDayKey();
|
|
921
|
+
} catch (error) {
|
|
922
|
+
return false;
|
|
923
|
+
}
|
|
924
|
+
}
|
|
925
|
+
|
|
926
|
+
/**
|
|
927
|
+
* @description 设置今天对该商品隐藏库存提示
|
|
928
|
+
*/
|
|
929
|
+
function setHiddenStockAlertForToday(params) {
|
|
930
|
+
try {
|
|
931
|
+
if (!params.productId) return;
|
|
932
|
+
if (typeof window === 'undefined') return;
|
|
933
|
+
var key = getStockAlertStorageKey(params);
|
|
934
|
+
window.localStorage.setItem(key, getLocalDayKey());
|
|
935
|
+
} catch (error) {}
|
|
936
|
+
}
|
|
937
|
+
function safeClone(value) {
|
|
938
|
+
try {
|
|
939
|
+
// eslint-disable-next-line no-undef
|
|
940
|
+
if (typeof structuredClone === 'function') return structuredClone(value);
|
|
941
|
+
} catch (error) {}
|
|
942
|
+
return JSON.parse(JSON.stringify(value));
|
|
943
|
+
}
|
|
944
|
+
|
|
945
|
+
/**
|
|
946
|
+
* @description
|
|
947
|
+
* 根据当前 skuValue(组合规格/单规格/套餐)计算“商品单价”
|
|
948
|
+
* 计算规则与 booking/utils.ts 的 getProductTotalPrice 保持一致。
|
|
949
|
+
*/
|
|
950
|
+
function getSelectedUnitPrice(params) {
|
|
951
|
+
var _ref6, _productData$base_pri, _productData$_extend3;
|
|
952
|
+
var productData = params.productData,
|
|
953
|
+
skuValue = params.skuValue;
|
|
954
|
+
if (!productData) return 0;
|
|
955
|
+
|
|
956
|
+
// base price(默认商品基础价;如果选了组合规格则用对应 variant.price/base_price)
|
|
957
|
+
var price = new Decimal((_ref6 = (_productData$base_pri = productData === null || productData === void 0 ? void 0 : productData.base_price) !== null && _productData$base_pri !== void 0 ? _productData$base_pri : productData === null || productData === void 0 || (_productData$_extend3 = productData._extend) === null || _productData$_extend3 === void 0 ? void 0 : _productData$_extend3.price) !== null && _ref6 !== void 0 ? _ref6 : 0);
|
|
958
|
+
if (skuValue !== null && skuValue !== void 0 && skuValue.product_variant_id) {
|
|
959
|
+
var _variant2;
|
|
960
|
+
var variantItem = productData === null || productData === void 0 || (_variant2 = productData.variant) === null || _variant2 === void 0 ? void 0 : _variant2.find(function (item) {
|
|
961
|
+
return Number(item === null || item === void 0 ? void 0 : item.id) === Number(skuValue.product_variant_id);
|
|
962
|
+
});
|
|
963
|
+
if (variantItem) {
|
|
964
|
+
var _ref7, _variantItem$price;
|
|
965
|
+
price = new Decimal((_ref7 = (_variantItem$price = variantItem === null || variantItem === void 0 ? void 0 : variantItem.price) !== null && _variantItem$price !== void 0 ? _variantItem$price : variantItem === null || variantItem === void 0 ? void 0 : variantItem.base_price) !== null && _ref7 !== void 0 ? _ref7 : 0);
|
|
966
|
+
}
|
|
967
|
+
}
|
|
968
|
+
|
|
969
|
+
// bundle(套餐)
|
|
970
|
+
if (Array.isArray(skuValue === null || skuValue === void 0 ? void 0 : skuValue.bundle) && skuValue.bundle.length > 0) {
|
|
971
|
+
price = skuValue.bundle.reduce(function (accumulator, currentValue) {
|
|
972
|
+
var currentPrice = new Decimal((currentValue === null || currentValue === void 0 ? void 0 : currentValue.price) || 0);
|
|
973
|
+
var currentNum = new Decimal((currentValue === null || currentValue === void 0 ? void 0 : currentValue.num) || 0);
|
|
974
|
+
return accumulator.add(currentPrice.mul(currentNum));
|
|
975
|
+
}, price);
|
|
976
|
+
}
|
|
977
|
+
|
|
978
|
+
// option(单规格)
|
|
979
|
+
if (Array.isArray(skuValue === null || skuValue === void 0 ? void 0 : skuValue.option) && skuValue.option.length > 0) {
|
|
980
|
+
price = skuValue.option.reduce(function (accumulator, currentValue) {
|
|
981
|
+
var currentPrice = new Decimal((currentValue === null || currentValue === void 0 ? void 0 : currentValue.price) || 0);
|
|
982
|
+
var currentNum = new Decimal((currentValue === null || currentValue === void 0 ? void 0 : currentValue.num) || 0);
|
|
983
|
+
return accumulator.add(currentPrice.mul(currentNum));
|
|
984
|
+
}, price);
|
|
985
|
+
}
|
|
986
|
+
return price.toNumber();
|
|
987
|
+
}
|
|
988
|
+
|
|
989
|
+
/**
|
|
990
|
+
* @description
|
|
991
|
+
* 生成给 booking 侧使用的 other 字段(用于 getProductTotalPrice 按同规则算价)
|
|
992
|
+
*/
|
|
993
|
+
function getOtherFromSkuValue(params) {
|
|
994
|
+
var productData = params.productData,
|
|
995
|
+
skuValue = params.skuValue;
|
|
996
|
+
var other = {
|
|
997
|
+
product_variant_id: (skuValue === null || skuValue === void 0 ? void 0 : skuValue.product_variant_id) || 0,
|
|
998
|
+
bundle: (skuValue === null || skuValue === void 0 ? void 0 : skuValue.bundle) || [],
|
|
999
|
+
option: (skuValue === null || skuValue === void 0 ? void 0 : skuValue.option) || []
|
|
1000
|
+
};
|
|
1001
|
+
if (other.product_variant_id && productData) {
|
|
1002
|
+
var _variant3;
|
|
1003
|
+
var variantItem = productData === null || productData === void 0 || (_variant3 = productData.variant) === null || _variant3 === void 0 ? void 0 : _variant3.find(function (item) {
|
|
1004
|
+
return Number(item === null || item === void 0 ? void 0 : item.id) === Number(other.product_variant_id);
|
|
1005
|
+
});
|
|
1006
|
+
if (variantItem) {
|
|
1007
|
+
var _ref8, _variantItem$price2;
|
|
1008
|
+
other.price = Number((_ref8 = (_variantItem$price2 = variantItem === null || variantItem === void 0 ? void 0 : variantItem.price) !== null && _variantItem$price2 !== void 0 ? _variantItem$price2 : variantItem === null || variantItem === void 0 ? void 0 : variantItem.base_price) !== null && _ref8 !== void 0 ? _ref8 : 0);
|
|
1009
|
+
}
|
|
1010
|
+
}
|
|
1011
|
+
return other;
|
|
1012
|
+
}
|
|
1013
|
+
|
|
1014
|
+
/**
|
|
1015
|
+
* @description
|
|
1016
|
+
* 尝试从旧数据推断“手动改价单价”:
|
|
1017
|
+
* - 若 total 与 origin_total / price 不一致,则认为是手动改价
|
|
1018
|
+
* - 否则返回 null(表示未设置手动改价)
|
|
1019
|
+
*/
|
|
1020
|
+
function getInitialPriceOverrideFromProductData(params) {
|
|
1021
|
+
var _extend, _extend2, _ref9, _extend$price, _extend3;
|
|
1022
|
+
var data = params.productData;
|
|
1023
|
+
if (!data) return null;
|
|
1024
|
+
var total = Number(data === null || data === void 0 || (_extend = data._extend) === null || _extend === void 0 ? void 0 : _extend.total);
|
|
1025
|
+
var originTotal = Number(data === null || data === void 0 || (_extend2 = data._extend) === null || _extend2 === void 0 ? void 0 : _extend2.origin_total);
|
|
1026
|
+
var basePrice = Number((_ref9 = (_extend$price = data === null || data === void 0 || (_extend3 = data._extend) === null || _extend3 === void 0 ? void 0 : _extend3.price) !== null && _extend$price !== void 0 ? _extend$price : data === null || data === void 0 ? void 0 : data.price) !== null && _ref9 !== void 0 ? _ref9 : 0);
|
|
1027
|
+
if (!Number.isFinite(total)) return null;
|
|
1028
|
+
if (Number.isFinite(originTotal) && total !== originTotal) return total;
|
|
1029
|
+
if (Number.isFinite(basePrice) && total !== basePrice) return total;
|
|
1030
|
+
return null;
|
|
1031
|
+
}
|