@pisell/private-materials 6.6.4 → 6.6.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/index.js +1 -1
- package/build/lowcode/meta.js +1 -1
- package/build/lowcode/preview.js +7 -7
- 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/Footer/index.d.ts +0 -1
- package/es/components/appointmentBooking/components/Guest/components/InformationOptionsModal/index.d.ts +0 -1
- package/es/components/appointmentBooking/components/Services/index.js +25 -22
- package/es/components/appointmentBooking/components/Voucher/index.js +15 -1
- package/es/components/booking/addons/index.js +25 -17
- package/es/components/booking/components/actionButtons/index.js +3 -1
- package/es/components/booking/components/footer/amount.d.ts +1 -0
- package/es/components/booking/components/footer/amount.js +548 -84
- package/es/components/booking/components/footer/index.js +36 -33
- package/es/components/booking/components/footer/utils.d.ts +19 -0
- package/es/components/booking/components/footer/utils.js +166 -67
- package/es/components/booking/components/formItemChildrenWrap/index.d.ts +0 -1
- package/es/components/booking/components/voucher/index.js +53 -15
- package/es/components/booking/forms/table/index.d.ts +0 -1
- package/es/components/booking/hooks/useQuotation.js +4 -1
- package/es/components/booking/info/clientVariant/hooks/useIsLowSpeedNetwork.d.ts +0 -1
- package/es/components/booking/info/dateRange/index.d.ts +0 -1
- package/es/components/booking/info/service/like/index.d.ts +0 -1
- package/es/components/booking/info/service2/utils.js +1 -0
- package/es/components/booking/info2/cartClientCard/index.js +5 -3
- package/es/components/booking/info2/service/addService/index.js +9 -9
- package/es/components/booking/info2/service/editNormalService/index.js +6 -0
- package/es/components/booking/info2/service/editService/index.js +27 -17
- package/es/components/booking/info2/service/editService/utils.d.ts +15 -0
- package/es/components/booking/info2/service/editService/utils.js +66 -0
- package/es/components/booking/materiels/startTime/index.d.ts +0 -1
- package/es/components/booking/utils.d.ts +1 -0
- package/es/components/booking/utils.js +15 -2
- package/es/components/checkout/components/AmountSummary/index.less +4 -5
- package/es/components/eftpos/deviceList/index.d.ts +0 -1
- package/es/components/eftpos/form/index.d.ts +0 -1
- package/es/components/eftpos/group/index.d.ts +0 -1
- package/es/components/eftpos/hooks.d.ts +0 -1
- package/es/components/eftpos/icon/apiKey.d.ts +0 -1
- package/es/components/eftpos/icon/device.d.ts +0 -1
- package/es/components/eftpos/receipt/index.d.ts +0 -1
- package/es/components/eftposPay/component/alert/warn.d.ts +0 -1
- package/es/components/eftposPay/component/header/titlebar.d.ts +0 -1
- package/es/components/eftposPay/component/step/index.d.ts +0 -1
- package/es/components/eftposPay/component/step/step.d.ts +0 -1
- package/es/components/eftposPay/linkly/hooks/useTimeQuery.js +14 -6
- package/es/components/eftposPay/payo/config.d.ts +1 -0
- package/es/components/eftposPay/payo/config.js +70 -32
- package/es/components/eftposPay/payo/payment.d.ts +66 -0
- package/es/components/eftposPay/payo/payment.js +579 -0
- package/es/components/eftposPay/store/index.d.ts +1 -1
- package/es/components/eftposPay/tyro/hooks.d.ts +0 -1
- package/es/components/eftposPay/utils/log/index.d.ts +110 -0
- package/es/components/eftposPay/utils/log/index.js +371 -0
- package/es/components/eventBooking/components/ErrorTip/index.d.ts +0 -1
- package/es/components/eventBooking/components/Provider/InformationOptionsModal/index.d.ts +0 -1
- package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateStatus/index.d.ts +0 -1
- package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/WeekItem/index.d.ts +0 -1
- package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/index.d.ts +0 -1
- package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Item/DayItem/index.d.ts +0 -1
- package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Item/index.d.ts +0 -1
- package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Status/index.d.ts +0 -1
- package/es/components/index.d.ts +2 -2
- package/es/components/index.js +2 -2
- package/es/components/pay/toC/PaymentMethods/MWCreditCard/tds2.js +13 -11
- package/es/components/pay/toC/PaymentMethods/StripePay/Stripe/StripeSDK/index.d.ts +0 -1
- package/es/components/pay/toC/PaymentMethods/StripePay/Stripe/components/SetupForm/index.d.ts +0 -1
- package/es/components/pay/toC/PaymentMethods/components/PaymentReturnContent/index.js +2 -0
- package/es/components/pay/toC/PaymentMethods/components/PaymentReturnContent/index.less +13 -3
- package/es/components/pay/toC/WalletPassBlock/components/WalletUseList/index.d.ts +0 -1
- package/es/components/pay/toC/index.js +7 -4
- package/es/components/pay/toC/locales.d.ts +3 -0
- package/es/components/pay/toC/locales.js +6 -3
- package/es/components/pay/toC/status.d.ts +1 -0
- package/es/components/pay/toC/status.js +3 -0
- package/es/components/productExtension/fields/Forms/index.d.ts +0 -1
- package/es/components/schedules/calendar/calendarItem.d.ts +0 -1
- package/es/components/schedules/components/CurrentDay/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/index.d.ts +0 -1
- package/es/components/schedules/resources/relationProduct/index.d.ts +0 -1
- package/es/components/subTotal/index.js +1 -1
- package/es/components/systemSettings/registry/components/GroupModal.d.ts +4 -0
- package/es/components/{wallet/serve.js → systemSettings/registry/components/GroupModal.js} +145 -190
- package/es/components/systemSettings/registry/components/ItemModal.d.ts +4 -0
- package/es/components/systemSettings/registry/components/ItemModal.js +547 -0
- package/es/components/systemSettings/registry/components/ModuleList.d.ts +4 -0
- package/es/components/systemSettings/registry/components/ModuleList.js +54 -0
- package/es/components/systemSettings/registry/components/SectionList.d.ts +4 -0
- package/es/components/systemSettings/registry/components/SectionList.js +174 -0
- package/es/components/systemSettings/registry/components/SettingsTable.d.ts +4 -0
- package/es/components/systemSettings/registry/components/SettingsTable.js +765 -0
- package/es/components/systemSettings/registry/components/index.d.ts +4 -0
- package/es/components/systemSettings/registry/components/index.js +4 -0
- package/es/components/systemSettings/registry/index.d.ts +5 -0
- package/es/components/systemSettings/registry/index.js +1059 -0
- package/es/components/systemSettings/registry/index.less +410 -0
- package/es/components/systemSettings/registry/locales.d.ts +272 -0
- package/es/components/systemSettings/registry/locales.js +300 -0
- package/es/components/systemSettings/registry/services.d.ts +77 -0
- package/es/components/systemSettings/registry/services.js +472 -0
- package/es/components/systemSettings/registry/types.d.ts +126 -0
- package/es/components/systemSettings/registry/types.js +1 -0
- package/es/components/systemSettings/registry/utils/typeValidation.d.ts +16 -0
- package/es/components/systemSettings/registry/utils/typeValidation.js +284 -0
- package/es/components/systemSettings/registry/utils/validators.d.ts +8 -0
- package/es/components/systemSettings/registry/utils/validators.js +44 -0
- package/es/components/ticketBooking/components/addServiceVariant/addService.js +7 -5
- package/es/components/ticketBooking/utils/index.d.ts +5 -0
- package/es/components/ticketBooking/utils/index.js +38 -17
- package/es/components/walletList/index.d.ts +0 -25
- package/es/components/walletList/index.js +173 -41
- package/es/components/walletList/locales.d.ts +9 -0
- package/es/components/walletList/locales.js +12 -3
- package/es/components/walletList/serve.d.ts +19 -0
- package/es/components/walletList/serve.js +94 -5
- package/es/components/walletList/tempHolderSelector/index.d.ts +14 -0
- package/es/components/walletList/tempHolderSelector/index.js +196 -0
- package/es/components/walletList/tempHolderSelector/index.less +63 -0
- package/es/components/workSpaceList/components/Modal/index.d.ts +0 -1
- package/es/index.d.ts +3 -2
- package/es/index.js +4 -3
- package/es/plus/clientName/index.d.ts +0 -1
- package/es/plus/walletEditor/WalletEditor.js +60 -2
- package/es/plus/walletEditor/locales.d.ts +9 -0
- package/es/plus/walletEditor/locales.js +12 -3
- package/es/plus/walletPassGallery/components/footerButton/index.js +2 -4
- package/es/plus/walletPassGallery/components/footerButton/index.less +14 -59
- package/es/plus/walletPassGallery/components/passDetail/index.js +5 -1
- package/es/plus/walletPassGallery/components/passDetail/index.less +4 -0
- package/es/plus/walletPassGallery/components/passList/index.d.ts +1 -0
- package/es/plus/walletPassGallery/components/passList/index.js +17 -5
- package/es/plus/walletPassGallery/components/recharge/index.js +19 -8
- package/es/plus/walletPassGallery/index.js +226 -42
- package/es/plus/walletPassGallery/locales.d.ts +15 -0
- package/es/plus/walletPassGallery/locales.js +29 -5
- package/es/plus/walletPassGallery/serve.d.ts +15 -1
- package/es/plus/walletPassGallery/serve.js +59 -2
- package/es/plus/walletPassGallery/utils.d.ts +48 -0
- package/es/plus/walletPassGallery/utils.js +342 -0
- package/es/pro/Login2.0/index.less +15 -8
- package/es/pro/pisellPaymentList/example.d.ts +0 -1
- package/es/pro/priceKeyboard/components/cashKeyboard/CashKeyboardIntact.js +35 -30
- package/lib/components/appointmentBooking/components/Footer/index.d.ts +0 -1
- package/lib/components/appointmentBooking/components/Guest/components/InformationOptionsModal/index.d.ts +0 -1
- package/lib/components/appointmentBooking/components/Services/index.js +5 -2
- package/lib/components/appointmentBooking/components/Voucher/index.js +13 -1
- package/lib/components/booking/addons/index.js +15 -7
- package/lib/components/booking/components/actionButtons/index.js +4 -2
- package/lib/components/booking/components/footer/amount.d.ts +1 -0
- package/lib/components/booking/components/footer/amount.js +293 -41
- package/lib/components/booking/components/footer/index.js +5 -2
- package/lib/components/booking/components/footer/utils.d.ts +19 -0
- package/lib/components/booking/components/footer/utils.js +111 -35
- package/lib/components/booking/components/formItemChildrenWrap/index.d.ts +0 -1
- package/lib/components/booking/components/voucher/index.js +56 -16
- package/lib/components/booking/forms/table/index.d.ts +0 -1
- package/lib/components/booking/hooks/useQuotation.js +2 -1
- package/lib/components/booking/info/clientVariant/hooks/useIsLowSpeedNetwork.d.ts +0 -1
- package/lib/components/booking/info/dateRange/index.d.ts +0 -1
- package/lib/components/booking/info/service/like/index.d.ts +0 -1
- package/lib/components/booking/info/service2/utils.js +1 -0
- package/lib/components/booking/info2/cartClientCard/index.js +4 -2
- package/lib/components/booking/info2/service/addService/index.js +1 -1
- package/lib/components/booking/info2/service/editNormalService/index.js +6 -0
- package/lib/components/booking/info2/service/editService/index.js +30 -8
- package/lib/components/booking/info2/service/editService/utils.d.ts +15 -0
- package/lib/components/booking/info2/service/editService/utils.js +40 -3
- package/lib/components/booking/materiels/startTime/index.d.ts +0 -1
- package/lib/components/booking/utils.d.ts +1 -0
- package/lib/components/booking/utils.js +11 -0
- package/lib/components/checkout/components/AmountSummary/index.less +4 -5
- package/lib/components/eftpos/deviceList/index.d.ts +0 -1
- package/lib/components/eftpos/form/index.d.ts +0 -1
- package/lib/components/eftpos/group/index.d.ts +0 -1
- package/lib/components/eftpos/hooks.d.ts +0 -1
- package/lib/components/eftpos/icon/apiKey.d.ts +0 -1
- package/lib/components/eftpos/icon/device.d.ts +0 -1
- package/lib/components/eftpos/receipt/index.d.ts +0 -1
- package/lib/components/eftposPay/component/alert/warn.d.ts +0 -1
- package/lib/components/eftposPay/component/header/titlebar.d.ts +0 -1
- package/lib/components/eftposPay/component/step/index.d.ts +0 -1
- package/lib/components/eftposPay/component/step/step.d.ts +0 -1
- package/lib/components/eftposPay/linkly/hooks/useTimeQuery.js +12 -6
- package/lib/components/eftposPay/payo/config.d.ts +1 -0
- package/lib/components/eftposPay/payo/config.js +98 -73
- package/lib/components/eftposPay/payo/payment.d.ts +66 -0
- package/lib/components/eftposPay/payo/payment.js +357 -0
- package/lib/components/eftposPay/store/index.d.ts +1 -1
- package/lib/components/eftposPay/tyro/hooks.d.ts +0 -1
- package/lib/components/eftposPay/utils/log/index.d.ts +110 -0
- package/lib/components/eftposPay/utils/log/index.js +294 -0
- package/lib/components/eventBooking/components/ErrorTip/index.d.ts +0 -1
- package/lib/components/eventBooking/components/Provider/InformationOptionsModal/index.d.ts +0 -1
- package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateStatus/index.d.ts +0 -1
- package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/WeekItem/index.d.ts +0 -1
- package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/index.d.ts +0 -1
- package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Item/DayItem/index.d.ts +0 -1
- package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Item/index.d.ts +0 -1
- package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Status/index.d.ts +0 -1
- package/lib/components/index.d.ts +2 -2
- package/lib/components/index.js +3 -3
- package/lib/components/pay/toC/PaymentMethods/MWCreditCard/tds2.js +13 -11
- package/lib/components/pay/toC/PaymentMethods/StripePay/Stripe/StripeSDK/index.d.ts +0 -1
- package/lib/components/pay/toC/PaymentMethods/StripePay/Stripe/components/SetupForm/index.d.ts +0 -1
- package/lib/components/pay/toC/PaymentMethods/components/PaymentReturnContent/index.js +1 -1
- package/lib/components/pay/toC/PaymentMethods/components/PaymentReturnContent/index.less +13 -3
- package/lib/components/pay/toC/WalletPassBlock/components/WalletUseList/index.d.ts +0 -1
- package/lib/components/pay/toC/index.js +4 -1
- package/lib/components/pay/toC/locales.d.ts +3 -0
- package/lib/components/pay/toC/locales.js +6 -3
- package/lib/components/pay/toC/status.d.ts +1 -0
- package/lib/components/pay/toC/status.js +5 -0
- package/lib/components/productExtension/fields/Forms/index.d.ts +0 -1
- package/lib/components/schedules/calendar/calendarItem.d.ts +0 -1
- package/lib/components/schedules/components/CurrentDay/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/index.d.ts +0 -1
- package/lib/components/schedules/resources/relationProduct/index.d.ts +0 -1
- package/lib/components/subTotal/index.js +1 -1
- package/lib/components/systemSettings/registry/components/GroupModal.d.ts +4 -0
- package/lib/components/systemSettings/registry/components/GroupModal.js +177 -0
- package/lib/components/systemSettings/registry/components/ItemModal.d.ts +4 -0
- package/lib/components/systemSettings/registry/components/ItemModal.js +508 -0
- package/lib/components/systemSettings/registry/components/ModuleList.d.ts +4 -0
- package/lib/components/systemSettings/registry/components/ModuleList.js +71 -0
- package/lib/components/systemSettings/registry/components/SectionList.d.ts +4 -0
- package/lib/components/systemSettings/registry/components/SectionList.js +181 -0
- package/lib/components/systemSettings/registry/components/SettingsTable.d.ts +4 -0
- package/lib/components/systemSettings/registry/components/SettingsTable.js +575 -0
- package/lib/components/systemSettings/registry/components/index.d.ts +4 -0
- package/lib/components/{wallet → systemSettings/registry}/components/index.js +13 -10
- package/lib/components/systemSettings/registry/index.d.ts +5 -0
- package/lib/components/systemSettings/registry/index.js +529 -0
- package/lib/components/systemSettings/registry/index.less +410 -0
- package/lib/components/systemSettings/registry/locales.d.ts +272 -0
- package/lib/components/systemSettings/registry/locales.js +324 -0
- package/lib/components/systemSettings/registry/services.d.ts +77 -0
- package/lib/components/systemSettings/registry/services.js +290 -0
- package/lib/components/systemSettings/registry/types.d.ts +126 -0
- package/lib/components/{wallet/RechargeableCard/serve.js → systemSettings/registry/types.js} +3 -19
- package/lib/components/systemSettings/registry/utils/typeValidation.d.ts +16 -0
- package/lib/components/systemSettings/registry/utils/typeValidation.js +228 -0
- package/lib/components/systemSettings/registry/utils/validators.d.ts +8 -0
- package/lib/components/systemSettings/registry/utils/validators.js +54 -0
- package/lib/components/ticketBooking/components/addServiceVariant/addService.js +9 -7
- package/lib/components/ticketBooking/utils/index.d.ts +5 -0
- package/lib/components/ticketBooking/utils/index.js +22 -6
- package/lib/components/walletList/index.d.ts +0 -25
- package/lib/components/walletList/index.js +100 -4
- package/lib/components/walletList/locales.d.ts +9 -0
- package/lib/components/walletList/locales.js +12 -3
- package/lib/components/walletList/serve.d.ts +19 -0
- package/lib/components/walletList/serve.js +26 -3
- package/lib/components/walletList/tempHolderSelector/index.d.ts +14 -0
- package/lib/components/walletList/tempHolderSelector/index.js +166 -0
- package/lib/components/walletList/tempHolderSelector/index.less +63 -0
- package/lib/components/workSpaceList/components/Modal/index.d.ts +0 -1
- package/lib/index.d.ts +3 -2
- package/lib/index.js +5 -2
- package/lib/plus/clientName/index.d.ts +0 -1
- package/lib/plus/walletEditor/WalletEditor.js +53 -0
- package/lib/plus/walletEditor/locales.d.ts +9 -0
- package/lib/plus/walletEditor/locales.js +12 -3
- package/lib/plus/walletPassGallery/components/footerButton/index.js +2 -2
- package/lib/plus/walletPassGallery/components/footerButton/index.less +14 -59
- package/lib/plus/walletPassGallery/components/passDetail/index.js +4 -1
- package/lib/plus/walletPassGallery/components/passDetail/index.less +4 -0
- package/lib/plus/walletPassGallery/components/passList/index.d.ts +1 -0
- package/lib/plus/walletPassGallery/components/passList/index.js +16 -4
- package/lib/plus/walletPassGallery/components/recharge/index.js +7 -1
- package/lib/plus/walletPassGallery/index.js +157 -28
- package/lib/plus/walletPassGallery/locales.d.ts +15 -0
- package/lib/plus/walletPassGallery/locales.js +32 -5
- package/lib/plus/walletPassGallery/serve.d.ts +15 -1
- package/lib/plus/walletPassGallery/serve.js +17 -5
- package/lib/plus/walletPassGallery/utils.d.ts +48 -0
- package/lib/plus/walletPassGallery/utils.js +287 -0
- package/lib/pro/Login2.0/index.less +15 -8
- package/lib/pro/pisellPaymentList/example.d.ts +0 -1
- package/lib/pro/priceKeyboard/components/cashKeyboard/CashKeyboardIntact.js +34 -39
- package/lowcode/settings-registry/meta.ts +29 -0
- package/package.json +4 -4
- package/es/components/wallet/Detail/index.d.ts +0 -42
- package/es/components/wallet/Detail/index.js +0 -1182
- package/es/components/wallet/Detail/index.less +0 -386
- package/es/components/wallet/Detail/locales.d.ts +0 -153
- package/es/components/wallet/Detail/locales.js +0 -170
- package/es/components/wallet/Detail/model.d.ts +0 -13
- package/es/components/wallet/Detail/model.js +0 -22
- package/es/components/wallet/Detail/serve.d.ts +0 -39
- package/es/components/wallet/Detail/serve.js +0 -64
- package/es/components/wallet/DetailContext.d.ts +0 -25
- package/es/components/wallet/DetailContext.js +0 -162
- package/es/components/wallet/DiscountCard/index.d.ts +0 -3
- package/es/components/wallet/DiscountCard/index.js +0 -218
- package/es/components/wallet/DiscountCard/index.less +0 -9
- package/es/components/wallet/DiscountCard/model.d.ts +0 -14
- package/es/components/wallet/DiscountCard/model.js +0 -22
- package/es/components/wallet/PointCard/index.d.ts +0 -3
- package/es/components/wallet/PointCard/index.js +0 -169
- package/es/components/wallet/PointCard/index.less +0 -9
- package/es/components/wallet/PointCard/model.d.ts +0 -13
- package/es/components/wallet/PointCard/model.js +0 -22
- package/es/components/wallet/RechargeableCard/index.d.ts +0 -13
- package/es/components/wallet/RechargeableCard/index.js +0 -463
- package/es/components/wallet/RechargeableCard/index.less +0 -108
- package/es/components/wallet/RechargeableCard/model.d.ts +0 -29
- package/es/components/wallet/RechargeableCard/model.js +0 -28
- package/es/components/wallet/RechargeableCard/serve.d.ts +0 -23
- package/es/components/wallet/RechargeableCard/serve.js +0 -32
- package/es/components/wallet/Voucher/index.d.ts +0 -12
- package/es/components/wallet/Voucher/index.js +0 -131
- package/es/components/wallet/Voucher/index.less +0 -9
- package/es/components/wallet/Voucher/locales.d.ts +0 -21
- package/es/components/wallet/Voucher/locales.js +0 -20
- package/es/components/wallet/Voucher/model.d.ts +0 -13
- package/es/components/wallet/Voucher/model.js +0 -22
- package/es/components/wallet/carouselArrow.png +0 -0
- package/es/components/wallet/components/FooterButtons/index.d.ts +0 -18
- package/es/components/wallet/components/FooterButtons/index.js +0 -81
- package/es/components/wallet/components/FooterButtons/index.less +0 -91
- package/es/components/wallet/components/UsageRules/index.d.ts +0 -23
- package/es/components/wallet/components/UsageRules/index.js +0 -147
- package/es/components/wallet/components/UsageRules/index.less +0 -157
- package/es/components/wallet/components/WalletBar/index.d.ts +0 -8
- package/es/components/wallet/components/WalletBar/index.js +0 -19
- package/es/components/wallet/components/WalletBar/index.less +0 -36
- package/es/components/wallet/components/WalletCard.d.ts +0 -11
- package/es/components/wallet/components/WalletCard.js +0 -91
- package/es/components/wallet/components/index.d.ts +0 -3
- package/es/components/wallet/components/index.js +0 -4
- package/es/components/wallet/hooks/useWalletCard.d.ts +0 -34
- package/es/components/wallet/hooks/useWalletCard.js +0 -147
- package/es/components/wallet/index.d.ts +0 -10
- package/es/components/wallet/index.js +0 -807
- package/es/components/wallet/index.less +0 -151
- package/es/components/wallet/locales.d.ts +0 -132
- package/es/components/wallet/locales.js +0 -139
- package/es/components/wallet/model.d.ts +0 -37
- package/es/components/wallet/model.js +0 -86
- package/es/components/wallet/serve.d.ts +0 -150
- package/es/components/wallet/utils/formatUtils.d.ts +0 -36
- package/es/components/wallet/utils/formatUtils.js +0 -73
- package/lib/components/wallet/Detail/index.d.ts +0 -42
- package/lib/components/wallet/Detail/index.js +0 -874
- package/lib/components/wallet/Detail/index.less +0 -386
- package/lib/components/wallet/Detail/locales.d.ts +0 -153
- package/lib/components/wallet/Detail/locales.js +0 -194
- package/lib/components/wallet/Detail/model.d.ts +0 -13
- package/lib/components/wallet/Detail/model.js +0 -43
- package/lib/components/wallet/Detail/serve.d.ts +0 -39
- package/lib/components/wallet/Detail/serve.js +0 -44
- package/lib/components/wallet/DetailContext.d.ts +0 -25
- package/lib/components/wallet/DetailContext.js +0 -118
- package/lib/components/wallet/DiscountCard/index.d.ts +0 -3
- package/lib/components/wallet/DiscountCard/index.js +0 -209
- package/lib/components/wallet/DiscountCard/index.less +0 -9
- package/lib/components/wallet/DiscountCard/model.d.ts +0 -14
- package/lib/components/wallet/DiscountCard/model.js +0 -43
- package/lib/components/wallet/PointCard/index.d.ts +0 -3
- package/lib/components/wallet/PointCard/index.js +0 -190
- package/lib/components/wallet/PointCard/index.less +0 -9
- package/lib/components/wallet/PointCard/model.d.ts +0 -13
- package/lib/components/wallet/PointCard/model.js +0 -43
- package/lib/components/wallet/RechargeableCard/index.d.ts +0 -13
- package/lib/components/wallet/RechargeableCard/index.js +0 -380
- package/lib/components/wallet/RechargeableCard/index.less +0 -108
- package/lib/components/wallet/RechargeableCard/model.d.ts +0 -29
- package/lib/components/wallet/RechargeableCard/model.js +0 -49
- package/lib/components/wallet/RechargeableCard/serve.d.ts +0 -23
- package/lib/components/wallet/Voucher/index.d.ts +0 -12
- package/lib/components/wallet/Voucher/index.js +0 -146
- package/lib/components/wallet/Voucher/index.less +0 -9
- package/lib/components/wallet/Voucher/locales.d.ts +0 -21
- package/lib/components/wallet/Voucher/locales.js +0 -44
- package/lib/components/wallet/Voucher/model.d.ts +0 -13
- package/lib/components/wallet/Voucher/model.js +0 -43
- package/lib/components/wallet/carouselArrow.png +0 -0
- package/lib/components/wallet/components/FooterButtons/index.d.ts +0 -18
- package/lib/components/wallet/components/FooterButtons/index.js +0 -109
- package/lib/components/wallet/components/FooterButtons/index.less +0 -91
- package/lib/components/wallet/components/UsageRules/index.d.ts +0 -23
- package/lib/components/wallet/components/UsageRules/index.js +0 -113
- package/lib/components/wallet/components/UsageRules/index.less +0 -157
- package/lib/components/wallet/components/WalletBar/index.d.ts +0 -8
- package/lib/components/wallet/components/WalletBar/index.js +0 -49
- package/lib/components/wallet/components/WalletBar/index.less +0 -36
- package/lib/components/wallet/components/WalletCard.d.ts +0 -11
- package/lib/components/wallet/components/WalletCard.js +0 -97
- package/lib/components/wallet/components/index.d.ts +0 -3
- package/lib/components/wallet/hooks/useWalletCard.d.ts +0 -34
- package/lib/components/wallet/hooks/useWalletCard.js +0 -111
- package/lib/components/wallet/index.d.ts +0 -10
- package/lib/components/wallet/index.js +0 -580
- package/lib/components/wallet/index.less +0 -151
- package/lib/components/wallet/locales.d.ts +0 -132
- package/lib/components/wallet/locales.js +0 -163
- package/lib/components/wallet/model.d.ts +0 -37
- package/lib/components/wallet/model.js +0 -91
- package/lib/components/wallet/serve.d.ts +0 -150
- package/lib/components/wallet/serve.js +0 -85
- package/lib/components/wallet/utils/formatUtils.d.ts +0 -36
- package/lib/components/wallet/utils/formatUtils.js +0 -73
|
@@ -1,4 +1,12 @@
|
|
|
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 _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
3
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
5
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
6
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
7
|
+
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."); }
|
|
8
|
+
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; } }
|
|
9
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
2
10
|
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
11
|
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
12
|
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; }
|
|
@@ -35,7 +43,7 @@ export var getRelationDetailsTotal = function getRelationDetailsTotal(relation_d
|
|
|
35
43
|
* @param state
|
|
36
44
|
* @returns
|
|
37
45
|
*/
|
|
38
|
-
var getProductExpectAmount = function getProductExpectAmount(state, isEdit) {
|
|
46
|
+
var getProductExpectAmount = function getProductExpectAmount(state, isEdit, isOriginTotal) {
|
|
39
47
|
var price = new Decimal(0);
|
|
40
48
|
var duration = new Decimal(0);
|
|
41
49
|
// 是否是跨日预约
|
|
@@ -57,7 +65,8 @@ var getProductExpectAmount = function getProductExpectAmount(state, isEdit) {
|
|
|
57
65
|
if (isDay || isNormalProductByDurationSchedule(item) || isMultiDayProduct(item)) {
|
|
58
66
|
var quantity = new Decimal(item._extend.quantity || 1);
|
|
59
67
|
var itemTotal = new Decimal(item._extend.total || 0);
|
|
60
|
-
|
|
68
|
+
var itemOriginTotal = new Decimal(item._extend.origin_total || 0);
|
|
69
|
+
price = price.add((isOriginTotal ? itemOriginTotal : itemTotal).mul(quantity));
|
|
61
70
|
|
|
62
71
|
// 普通商品不能加到时长上
|
|
63
72
|
var _duration = !isNormalProductByDurationSchedule(item) ? new Decimal(item._extend.duration || 0) : new Decimal(0);
|
|
@@ -69,7 +78,8 @@ var getProductExpectAmount = function getProductExpectAmount(state, isEdit) {
|
|
|
69
78
|
} else {
|
|
70
79
|
var _quantity = new Decimal(item._extend.quantity || 1);
|
|
71
80
|
var _itemTotal = new Decimal(item._extend.total || 0);
|
|
72
|
-
|
|
81
|
+
var _itemOriginTotal = new Decimal(item._extend.origin_total || 0);
|
|
82
|
+
price = price.add((isOriginTotal ? _itemOriginTotal : _itemTotal).mul(_quantity));
|
|
73
83
|
|
|
74
84
|
// 附加商品
|
|
75
85
|
var relationTotal = new Decimal(getRelationDetailsTotal(item._extend.relation_details || []));
|
|
@@ -99,7 +109,8 @@ var getProductExpectAmount = function getProductExpectAmount(state, isEdit) {
|
|
|
99
109
|
var _item = _step3.value;
|
|
100
110
|
var _quantity2 = new Decimal(_item._extend.quantity || 1);
|
|
101
111
|
var _itemTotal2 = new Decimal(_item._extend.total || 0);
|
|
102
|
-
|
|
112
|
+
var _itemOriginTotal2 = new Decimal(_item._extend.origin_total || 0);
|
|
113
|
+
price = price.add((isOriginTotal ? _itemOriginTotal2 : _itemTotal2).mul(_quantity2));
|
|
103
114
|
}
|
|
104
115
|
} catch (err) {
|
|
105
116
|
_iterator3.e(err);
|
|
@@ -181,7 +192,52 @@ var getProductItemTax = function getProductItemTax(item, state, options) {
|
|
|
181
192
|
}
|
|
182
193
|
|
|
183
194
|
// 结果 = 单个商品税费 × 数量
|
|
184
|
-
return singleItemTax.times(quantity);
|
|
195
|
+
return singleItemTax.times(quantity).toDecimalPlaces(2, Decimal.ROUND_HALF_UP);
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* 计算商品附加费 包含子商品的总附加费
|
|
200
|
+
*/
|
|
201
|
+
var getProductSurchargeFee = function getProductSurchargeFee(product) {
|
|
202
|
+
var _extend = product._extend;
|
|
203
|
+
if (!_extend) {
|
|
204
|
+
return 0;
|
|
205
|
+
}
|
|
206
|
+
var surcharge_fee = _extend.surcharge_fee,
|
|
207
|
+
relation_details = _extend.relation_details,
|
|
208
|
+
other = _extend.other,
|
|
209
|
+
surcharge_rounding_remainder = _extend.surcharge_rounding_remainder;
|
|
210
|
+
var totalSurchargeFee = new Decimal(0);
|
|
211
|
+
if (surcharge_fee) {
|
|
212
|
+
totalSurchargeFee = totalSurchargeFee.plus(surcharge_fee);
|
|
213
|
+
}
|
|
214
|
+
if (surcharge_rounding_remainder) {
|
|
215
|
+
totalSurchargeFee = totalSurchargeFee.plus(surcharge_rounding_remainder);
|
|
216
|
+
}
|
|
217
|
+
if (relation_details) {
|
|
218
|
+
var _iterator4 = _createForOfIteratorHelper(relation_details),
|
|
219
|
+
_step4;
|
|
220
|
+
try {
|
|
221
|
+
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
222
|
+
var item = _step4.value;
|
|
223
|
+
totalSurchargeFee = totalSurchargeFee.plus(getProductSurchargeFee(item));
|
|
224
|
+
}
|
|
225
|
+
} catch (err) {
|
|
226
|
+
_iterator4.e(err);
|
|
227
|
+
} finally {
|
|
228
|
+
_iterator4.f();
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
if (other !== null && other !== void 0 && other.bundle) {
|
|
232
|
+
totalSurchargeFee = totalSurchargeFee.plus(other.bundle.reduce(function (total, item) {
|
|
233
|
+
var surchargeFee = new Decimal(item.surcharge_fee || 0).times(item.num || item.quantity || 1);
|
|
234
|
+
if (item.surcharge_rounding_remainder) {
|
|
235
|
+
surchargeFee = surchargeFee.plus(item.surcharge_rounding_remainder);
|
|
236
|
+
}
|
|
237
|
+
return total.plus(surchargeFee);
|
|
238
|
+
}, new Decimal(0)));
|
|
239
|
+
}
|
|
240
|
+
return totalSurchargeFee.toNumber();
|
|
185
241
|
};
|
|
186
242
|
|
|
187
243
|
/**
|
|
@@ -200,17 +256,21 @@ var processItemsTax = function processItemsTax(items, state, options) {
|
|
|
200
256
|
productExpectAmount = computed.productExpectAmount;
|
|
201
257
|
var originTax = new Decimal(0);
|
|
202
258
|
var tax = new Decimal(0);
|
|
203
|
-
var
|
|
204
|
-
|
|
259
|
+
var _iterator5 = _createForOfIteratorHelper(items),
|
|
260
|
+
_step5;
|
|
205
261
|
try {
|
|
206
|
-
for (
|
|
207
|
-
var
|
|
262
|
+
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
|
|
263
|
+
var _item$_extend, _item$_extend2, _item$_extend$other;
|
|
264
|
+
var item = _step5.value;
|
|
208
265
|
var quantity = new Decimal(item._extend.quantity || 1);
|
|
209
266
|
var unitPrice = new Decimal(item._extend.total || 0);
|
|
267
|
+
var mainProductPrice = new Decimal(getMainProductTotal(item) || 0);
|
|
268
|
+
|
|
269
|
+
// const surchargeFee = getProductSurchargeFee(item);
|
|
210
270
|
|
|
211
271
|
// 计算原始税费(折扣前)- 单个商品
|
|
212
272
|
var originalTaxPerItem = getProductItemTax(_objectSpread(_objectSpread({}, item), {}, {
|
|
213
|
-
total:
|
|
273
|
+
total: mainProductPrice.add(((_item$_extend = item._extend) === null || _item$_extend === void 0 ? void 0 : _item$_extend.surcharge_fee) || 0).toNumber(),
|
|
214
274
|
quantity: 1
|
|
215
275
|
}), state, {
|
|
216
276
|
tax_rate: tax_rate,
|
|
@@ -223,12 +283,31 @@ var processItemsTax = function processItemsTax(items, state, options) {
|
|
|
223
283
|
itemDiscount = unitPrice.dividedBy(productExpectAmount).times(shopDiscount);
|
|
224
284
|
}
|
|
225
285
|
|
|
226
|
-
// 商品折后单价 = 商品单价 - 商品折后单价
|
|
227
|
-
|
|
286
|
+
// // 商品折后单价 = 商品单价 - 商品折后单价
|
|
287
|
+
// const itemDiscountedUnitPrice = unitPrice.minus(itemDiscount).add(surchargeFee);
|
|
288
|
+
|
|
289
|
+
// // 计算折后税费(折扣后)- 单个商品 加子商品的税费
|
|
290
|
+
// const discountedTaxPerItem = getProductItemTax(
|
|
291
|
+
// {
|
|
292
|
+
// ...item,
|
|
293
|
+
// total: itemDiscountedUnitPrice.toNumber(),
|
|
294
|
+
// price: item._extend.total,
|
|
295
|
+
// quantity: 1,
|
|
296
|
+
// },
|
|
297
|
+
// state,
|
|
298
|
+
// { tax_rate, is_price_include_tax }
|
|
299
|
+
// );
|
|
300
|
+
|
|
301
|
+
// 按比例计算主商品应分摊的折扣
|
|
302
|
+
var mainItemDiscount = new Decimal(0);
|
|
303
|
+
if (unitPrice.greaterThan(0)) {
|
|
304
|
+
mainItemDiscount = mainProductPrice.dividedBy(productExpectAmount).times(shopDiscount);
|
|
305
|
+
}
|
|
306
|
+
var mainItemDiscountedUnitPrice = mainProductPrice.minus(mainItemDiscount).add(((_item$_extend2 = item._extend) === null || _item$_extend2 === void 0 ? void 0 : _item$_extend2.surcharge_fee) || 0);
|
|
228
307
|
|
|
229
|
-
// 计算折后税费(折扣后)-
|
|
230
|
-
var
|
|
231
|
-
total:
|
|
308
|
+
// 计算折后税费(折扣后)- 主商品的税费
|
|
309
|
+
var maxDiscountedTaxPerItem = getProductItemTax(_objectSpread(_objectSpread({}, item), {}, {
|
|
310
|
+
total: mainItemDiscountedUnitPrice.toNumber(),
|
|
232
311
|
price: item._extend.total,
|
|
233
312
|
quantity: 1
|
|
234
313
|
}), state, {
|
|
@@ -236,18 +315,20 @@ var processItemsTax = function processItemsTax(items, state, options) {
|
|
|
236
315
|
is_price_include_tax: is_price_include_tax
|
|
237
316
|
});
|
|
238
317
|
|
|
239
|
-
//
|
|
240
|
-
|
|
241
|
-
item._extend.
|
|
318
|
+
// item._extend.payment_price = itemDiscountedUnitPrice;
|
|
319
|
+
// 保存到商品扩展信息中(保留两位小数)
|
|
320
|
+
// item._extend.original_tax_fee = originalTaxPerItem.toNumber();
|
|
321
|
+
// item._extend.tax_fee = discountedTaxPerItem.toNumber();
|
|
322
|
+
item._extend.main_product_attached_bundle_tax_fee = maxDiscountedTaxPerItem.toNumber();
|
|
242
323
|
|
|
243
324
|
// 注意:加时商品独立计算,不考虑主商品数量
|
|
244
325
|
var addTimeTotalTax = new Decimal(0);
|
|
245
326
|
if (Array.isArray(item._extend.relation_details)) {
|
|
246
|
-
var
|
|
247
|
-
|
|
327
|
+
var _iterator6 = _createForOfIteratorHelper(item._extend.relation_details),
|
|
328
|
+
_step6;
|
|
248
329
|
try {
|
|
249
|
-
for (
|
|
250
|
-
var atItem =
|
|
330
|
+
for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
|
|
331
|
+
var atItem = _step6.value;
|
|
251
332
|
// 计算单件加时商品折扣后价格
|
|
252
333
|
var _originTotal = new Decimal(atItem.selling_price || atItem.price || 0);
|
|
253
334
|
var _discountedTotal = _originTotal;
|
|
@@ -255,8 +336,7 @@ var processItemsTax = function processItemsTax(items, state, options) {
|
|
|
255
336
|
_discountedTotal = _originTotal.minus(_originTotal.dividedBy(productExpectAmount).times(shopDiscount));
|
|
256
337
|
}
|
|
257
338
|
var addTimeTaxPerItem = getProductItemTax(_objectSpread(_objectSpread({}, atItem), {}, {
|
|
258
|
-
total: _discountedTotal,
|
|
259
|
-
// 可能包含原有数据,或前端临时数据
|
|
339
|
+
total: _discountedTotal.add((atItem === null || atItem === void 0 ? void 0 : atItem.surcharge_fee) || 0).toNumber(),
|
|
260
340
|
quantity: atItem.product_quantity || atItem.num || 1
|
|
261
341
|
}), state, {
|
|
262
342
|
tax_rate: tax_rate,
|
|
@@ -265,20 +345,84 @@ var processItemsTax = function processItemsTax(items, state, options) {
|
|
|
265
345
|
addTimeTotalTax = addTimeTotalTax.plus(addTimeTaxPerItem);
|
|
266
346
|
}
|
|
267
347
|
} catch (err) {
|
|
268
|
-
|
|
348
|
+
_iterator6.e(err);
|
|
349
|
+
} finally {
|
|
350
|
+
_iterator6.f();
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
// 处理 bundle 子商品(仅原价子商品)
|
|
355
|
+
var bundleTotalOriginTax = new Decimal(0);
|
|
356
|
+
var bundleTotalTax = new Decimal(0);
|
|
357
|
+
if (Array.isArray((_item$_extend$other = item._extend.other) === null || _item$_extend$other === void 0 ? void 0 : _item$_extend$other.bundle)) {
|
|
358
|
+
var _iterator7 = _createForOfIteratorHelper(item._extend.other.bundle),
|
|
359
|
+
_step7;
|
|
360
|
+
try {
|
|
361
|
+
for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
|
|
362
|
+
var bundleItem = _step7.value;
|
|
363
|
+
// 只处理原价的子商品
|
|
364
|
+
if (getBundleItemIsOriginalPrice(bundleItem)) {
|
|
365
|
+
var _ref2, _bundleItem$bundle_se;
|
|
366
|
+
var bundleQuantity = new Decimal(bundleItem.quantity || 1);
|
|
367
|
+
var bundleUnitPrice = new Decimal((_ref2 = (_bundleItem$bundle_se = bundleItem.bundle_selling_price) !== null && _bundleItem$bundle_se !== void 0 ? _bundleItem$bundle_se : bundleItem.price) !== null && _ref2 !== void 0 ? _ref2 : 0);
|
|
368
|
+
|
|
369
|
+
// 计算原始税费(折扣前)- 单个商品
|
|
370
|
+
var bundleOriginalTaxPerItem = getProductItemTax(_objectSpread(_objectSpread({}, bundleItem), {}, {
|
|
371
|
+
total: bundleUnitPrice.add((bundleItem === null || bundleItem === void 0 ? void 0 : bundleItem.surcharge_fee) || 0).toNumber(),
|
|
372
|
+
quantity: 1
|
|
373
|
+
}), state, {
|
|
374
|
+
tax_rate: tax_rate,
|
|
375
|
+
is_price_include_tax: is_price_include_tax
|
|
376
|
+
});
|
|
377
|
+
|
|
378
|
+
// 计算平摊到该bundle商品的折扣
|
|
379
|
+
var bundleItemDiscount = new Decimal(0);
|
|
380
|
+
if (productExpectAmount > 0) {
|
|
381
|
+
bundleItemDiscount = bundleUnitPrice.dividedBy(productExpectAmount).times(shopDiscount);
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
// bundle商品折后单价
|
|
385
|
+
var bundleDiscountedUnitPrice = bundleUnitPrice.minus(bundleItemDiscount).add((bundleItem === null || bundleItem === void 0 ? void 0 : bundleItem.surcharge_fee) || 0);
|
|
386
|
+
|
|
387
|
+
// 计算折后税费(折扣后)- 单个商品
|
|
388
|
+
var bundleDiscountedTaxPerItem = getProductItemTax(_objectSpread(_objectSpread({}, bundleItem), {}, {
|
|
389
|
+
total: bundleDiscountedUnitPrice.toNumber(),
|
|
390
|
+
quantity: 1
|
|
391
|
+
}), state, {
|
|
392
|
+
tax_rate: tax_rate,
|
|
393
|
+
is_price_include_tax: is_price_include_tax
|
|
394
|
+
});
|
|
395
|
+
|
|
396
|
+
// bundle商品折后单价
|
|
397
|
+
// bundleItem.bundle_payment_price = bundleDiscountedUnitPrice;
|
|
398
|
+
// 保存到bundle商品上(单个商品的税费,保留两位小数)
|
|
399
|
+
bundleItem.original_tax_fee = new Decimal(bundleOriginalTaxPerItem).toNumber();
|
|
400
|
+
bundleItem.tax_fee = new Decimal(bundleDiscountedTaxPerItem).toNumber();
|
|
401
|
+
|
|
402
|
+
// 累加bundle税费(需要乘以bundle数量和主商品数量)
|
|
403
|
+
bundleTotalOriginTax = bundleTotalOriginTax.plus(bundleOriginalTaxPerItem.times(bundleQuantity));
|
|
404
|
+
bundleTotalTax = bundleTotalTax.plus(bundleDiscountedTaxPerItem.times(bundleQuantity));
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
} catch (err) {
|
|
408
|
+
_iterator7.e(err);
|
|
269
409
|
} finally {
|
|
270
|
-
|
|
410
|
+
_iterator7.f();
|
|
271
411
|
}
|
|
272
412
|
}
|
|
413
|
+
var original_tax_fee = originalTaxPerItem.add(bundleTotalOriginTax);
|
|
414
|
+
var tax_fee = maxDiscountedTaxPerItem.add(bundleTotalTax);
|
|
415
|
+
item._extend.original_tax_fee = original_tax_fee.toNumber();
|
|
416
|
+
item._extend.tax_fee = tax_fee.toNumber();
|
|
273
417
|
|
|
274
418
|
// 累加到总税费(乘以数量)
|
|
275
|
-
originTax = originTax.plus(
|
|
276
|
-
tax = tax.plus(
|
|
419
|
+
originTax = originTax.plus(original_tax_fee.times(quantity)).plus(addTimeTotalTax);
|
|
420
|
+
tax = tax.plus(tax_fee.times(quantity)).plus(addTimeTotalTax);
|
|
277
421
|
}
|
|
278
422
|
} catch (err) {
|
|
279
|
-
|
|
423
|
+
_iterator5.e(err);
|
|
280
424
|
} finally {
|
|
281
|
-
|
|
425
|
+
_iterator5.f();
|
|
282
426
|
}
|
|
283
427
|
return {
|
|
284
428
|
originTax: originTax,
|
|
@@ -378,10 +522,9 @@ var isProductMatchSurchargeCondition = function isProductMatchSurchargeCondition
|
|
|
378
522
|
var surchargeConfig = options.surchargeConfig,
|
|
379
523
|
_options$scheduleById = options.scheduleById,
|
|
380
524
|
scheduleById = _options$scheduleById === void 0 ? {} : _options$scheduleById;
|
|
381
|
-
var
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
isCustomItem = _item$_extend.isCustomItem;
|
|
525
|
+
var startDate = item.startDate,
|
|
526
|
+
product_id = item.product_id,
|
|
527
|
+
isCustomItem = item.isCustomItem;
|
|
385
528
|
var _surchargeConfig$open = surchargeConfig.open_product,
|
|
386
529
|
open_product = _surchargeConfig$open === void 0 ? 0 : _surchargeConfig$open,
|
|
387
530
|
_surchargeConfig$is_a = surchargeConfig.is_all,
|
|
@@ -412,7 +555,6 @@ var isProductMatchSurchargeCondition = function isProductMatchSurchargeCondition
|
|
|
412
555
|
isProductMatch = false;
|
|
413
556
|
} else {
|
|
414
557
|
// 普通商品:检查是否在指定商品列表中
|
|
415
|
-
var product_id = other === null || other === void 0 ? void 0 : other.product_id;
|
|
416
558
|
isProductMatch = available_product_ids.includes(product_id);
|
|
417
559
|
}
|
|
418
560
|
}
|
|
@@ -451,6 +593,148 @@ var isProductMatchSurchargeCondition = function isProductMatchSurchargeCondition
|
|
|
451
593
|
return isProductMatch && isScheduleMatch;
|
|
452
594
|
};
|
|
453
595
|
|
|
596
|
+
// bundle商品是否是原价
|
|
597
|
+
var getBundleItemIsOriginalPrice = function getBundleItemIsOriginalPrice(item) {
|
|
598
|
+
return (item === null || item === void 0 ? void 0 : item.price_type) === 'markup' && (item === null || item === void 0 ? void 0 : item.price_type_ext) === 'product_price';
|
|
599
|
+
};
|
|
600
|
+
|
|
601
|
+
// bundle商品是否是加价
|
|
602
|
+
var getBundleItemIsMarkupPrice = function getBundleItemIsMarkupPrice(item) {
|
|
603
|
+
return (item === null || item === void 0 ? void 0 : item.price_type) === 'markup' && ((item === null || item === void 0 ? void 0 : item.price_type_ext) === '' || !(item !== null && item !== void 0 && item.price_type_ext));
|
|
604
|
+
};
|
|
605
|
+
|
|
606
|
+
// bundle商品是否是减价
|
|
607
|
+
var getBundleItemIsDiscountPrice = function getBundleItemIsDiscountPrice(item) {
|
|
608
|
+
return (item === null || item === void 0 ? void 0 : item.price_type) === 'markdown' && ((item === null || item === void 0 ? void 0 : item.price_type_ext) === '' || !(item !== null && item !== void 0 && item.price_type_ext));
|
|
609
|
+
};
|
|
610
|
+
|
|
611
|
+
// bundle商品是否是加价或减价
|
|
612
|
+
var getBundleItemIsMarkupOrDiscountPrice = function getBundleItemIsMarkupOrDiscountPrice(item) {
|
|
613
|
+
return getBundleItemIsMarkupPrice(item) || getBundleItemIsDiscountPrice(item);
|
|
614
|
+
};
|
|
615
|
+
var getDiscountAmount = function getDiscountAmount(discounts) {
|
|
616
|
+
return (discounts || []).reduce(function (total, discount) {
|
|
617
|
+
return total.add(new Decimal(discount.amount || 0));
|
|
618
|
+
}, new Decimal(0)).toNumber();
|
|
619
|
+
};
|
|
620
|
+
|
|
621
|
+
/**
|
|
622
|
+
* 获取主商品加价减价后的总价 (主商品价格 + 子商品加价减价)
|
|
623
|
+
*/
|
|
624
|
+
var getMainProductTotal = function getMainProductTotal(item) {
|
|
625
|
+
var _ref3, _ref4, _item$_extend$main_pr, _item$_extend3, _item$metadata, _item$_extend$other2, _item$_extend$other3, _item$_extend$other5;
|
|
626
|
+
var total = new Decimal((_ref3 = (_ref4 = (_item$_extend$main_pr = (_item$_extend3 = item._extend) === null || _item$_extend3 === void 0 ? void 0 : _item$_extend3.main_product_selling_price) !== null && _item$_extend$main_pr !== void 0 ? _item$_extend$main_pr : item === null || item === void 0 || (_item$metadata = item.metadata) === null || _item$metadata === void 0 ? void 0 : _item$metadata.main_product_selling_price) !== null && _ref4 !== void 0 ? _ref4 : item._extend.price) !== null && _ref3 !== void 0 ? _ref3 : 0);
|
|
627
|
+
|
|
628
|
+
// 单规格
|
|
629
|
+
if ((_item$_extend$other2 = item._extend.other) !== null && _item$_extend$other2 !== void 0 && _item$_extend$other2.option && Array.isArray((_item$_extend$other3 = item._extend.other) === null || _item$_extend$other3 === void 0 ? void 0 : _item$_extend$other3.option)) {
|
|
630
|
+
var _item$_extend$other4;
|
|
631
|
+
total = total.add((_item$_extend$other4 = item._extend.other) === null || _item$_extend$other4 === void 0 ? void 0 : _item$_extend$other4.option.reduce(function (t, option) {
|
|
632
|
+
return t.add(new Decimal(option.price || 0).mul(option.num || 1));
|
|
633
|
+
}, new Decimal(0)));
|
|
634
|
+
}
|
|
635
|
+
var _iterator8 = _createForOfIteratorHelper(((_item$_extend$other5 = item._extend.other) === null || _item$_extend$other5 === void 0 ? void 0 : _item$_extend$other5.bundle) || []),
|
|
636
|
+
_step8;
|
|
637
|
+
try {
|
|
638
|
+
for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
|
|
639
|
+
var bundleItem = _step8.value;
|
|
640
|
+
if (getBundleItemIsMarkupOrDiscountPrice(bundleItem)) {
|
|
641
|
+
var _ref5, _bundleItem$bundle_se2;
|
|
642
|
+
// 子商品折扣金额
|
|
643
|
+
var discountAmount = getDiscountAmount(bundleItem.discount_list);
|
|
644
|
+
// 子商品价格
|
|
645
|
+
var bundleItemPrice = new Decimal((_ref5 = (_bundleItem$bundle_se2 = bundleItem.bundle_selling_price) !== null && _bundleItem$bundle_se2 !== void 0 ? _bundleItem$bundle_se2 : bundleItem.price) !== null && _ref5 !== void 0 ? _ref5 : 0);
|
|
646
|
+
// todo: 套餐子商品后不需要处理 子商品价格 - 子商品折扣金额
|
|
647
|
+
var bundleItemTotal = bundleItemPrice.minus(discountAmount);
|
|
648
|
+
total = total.add(bundleItemTotal);
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
} catch (err) {
|
|
652
|
+
_iterator8.e(err);
|
|
653
|
+
} finally {
|
|
654
|
+
_iterator8.f();
|
|
655
|
+
}
|
|
656
|
+
return total.toNumber();
|
|
657
|
+
};
|
|
658
|
+
|
|
659
|
+
/**
|
|
660
|
+
* 清除附加费
|
|
661
|
+
*/
|
|
662
|
+
var clearSurchargeFee = function clearSurchargeFee(state) {
|
|
663
|
+
var service = state.service,
|
|
664
|
+
addons = state.addons;
|
|
665
|
+
if (Array.isArray(service === null || service === void 0 ? void 0 : service.value)) {
|
|
666
|
+
var _iterator9 = _createForOfIteratorHelper(service.value),
|
|
667
|
+
_step9;
|
|
668
|
+
try {
|
|
669
|
+
for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
|
|
670
|
+
var _item$_extend$other6;
|
|
671
|
+
var item = _step9.value;
|
|
672
|
+
item._extend.surcharge_fee = 0;
|
|
673
|
+
item._extend.relation_surcharge_ids = [];
|
|
674
|
+
var _iterator10 = _createForOfIteratorHelper(((_item$_extend$other6 = item._extend.other) === null || _item$_extend$other6 === void 0 ? void 0 : _item$_extend$other6.bundle) || []),
|
|
675
|
+
_step10;
|
|
676
|
+
try {
|
|
677
|
+
for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
|
|
678
|
+
var bundleItem = _step10.value;
|
|
679
|
+
bundleItem.surcharge_fee = 0;
|
|
680
|
+
bundleItem.relation_surcharge_ids = [];
|
|
681
|
+
}
|
|
682
|
+
} catch (err) {
|
|
683
|
+
_iterator10.e(err);
|
|
684
|
+
} finally {
|
|
685
|
+
_iterator10.f();
|
|
686
|
+
}
|
|
687
|
+
var _iterator11 = _createForOfIteratorHelper(item._extend.relation_details || []),
|
|
688
|
+
_step11;
|
|
689
|
+
try {
|
|
690
|
+
for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) {
|
|
691
|
+
var relationDetail = _step11.value;
|
|
692
|
+
relationDetail.surcharge_fee = 0;
|
|
693
|
+
relationDetail.relation_surcharge_ids = [];
|
|
694
|
+
}
|
|
695
|
+
} catch (err) {
|
|
696
|
+
_iterator11.e(err);
|
|
697
|
+
} finally {
|
|
698
|
+
_iterator11.f();
|
|
699
|
+
}
|
|
700
|
+
}
|
|
701
|
+
} catch (err) {
|
|
702
|
+
_iterator9.e(err);
|
|
703
|
+
} finally {
|
|
704
|
+
_iterator9.f();
|
|
705
|
+
}
|
|
706
|
+
}
|
|
707
|
+
if (Array.isArray(addons === null || addons === void 0 ? void 0 : addons.value)) {
|
|
708
|
+
var _iterator12 = _createForOfIteratorHelper(addons.value),
|
|
709
|
+
_step12;
|
|
710
|
+
try {
|
|
711
|
+
for (_iterator12.s(); !(_step12 = _iterator12.n()).done;) {
|
|
712
|
+
var _item2$_extend$other;
|
|
713
|
+
var _item2 = _step12.value;
|
|
714
|
+
_item2._extend.surcharge_fee = 0;
|
|
715
|
+
_item2._extend.relation_surcharge_ids = [];
|
|
716
|
+
var _iterator13 = _createForOfIteratorHelper(((_item2$_extend$other = _item2._extend.other) === null || _item2$_extend$other === void 0 ? void 0 : _item2$_extend$other.bundle) || []),
|
|
717
|
+
_step13;
|
|
718
|
+
try {
|
|
719
|
+
for (_iterator13.s(); !(_step13 = _iterator13.n()).done;) {
|
|
720
|
+
var _bundleItem = _step13.value;
|
|
721
|
+
_bundleItem.surcharge_fee = 0;
|
|
722
|
+
_bundleItem.relation_surcharge_ids = [];
|
|
723
|
+
}
|
|
724
|
+
} catch (err) {
|
|
725
|
+
_iterator13.e(err);
|
|
726
|
+
} finally {
|
|
727
|
+
_iterator13.f();
|
|
728
|
+
}
|
|
729
|
+
}
|
|
730
|
+
} catch (err) {
|
|
731
|
+
_iterator12.e(err);
|
|
732
|
+
} finally {
|
|
733
|
+
_iterator12.f();
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
};
|
|
737
|
+
|
|
454
738
|
/**
|
|
455
739
|
* 订单附加费各项信息
|
|
456
740
|
* @param state
|
|
@@ -487,6 +771,8 @@ var getSurcharge = function getSurcharge(state, options) {
|
|
|
487
771
|
}
|
|
488
772
|
return [];
|
|
489
773
|
}
|
|
774
|
+
// 清除附加费
|
|
775
|
+
clearSurchargeFee(state);
|
|
490
776
|
|
|
491
777
|
// 新增状态
|
|
492
778
|
var service = state.service,
|
|
@@ -506,93 +792,252 @@ var getSurcharge = function getSurcharge(state, options) {
|
|
|
506
792
|
fixed = _surchargeConfig$fixe === void 0 ? '0' : _surchargeConfig$fixe,
|
|
507
793
|
id = surchargeConfig.id,
|
|
508
794
|
type = surchargeConfig.type,
|
|
509
|
-
description = surchargeConfig.description
|
|
795
|
+
description = surchargeConfig.description,
|
|
796
|
+
open_product = surchargeConfig.open_product;
|
|
510
797
|
|
|
511
798
|
// 收集所有符合条件的商品
|
|
512
799
|
var matchedItems = [];
|
|
513
800
|
|
|
514
801
|
// 检查service中符合条件的商品
|
|
515
802
|
if (Array.isArray(service === null || service === void 0 ? void 0 : service.value)) {
|
|
516
|
-
var
|
|
517
|
-
|
|
803
|
+
var _iterator14 = _createForOfIteratorHelper(service.value),
|
|
804
|
+
_step14;
|
|
518
805
|
try {
|
|
519
|
-
for (
|
|
520
|
-
var
|
|
521
|
-
|
|
806
|
+
for (_iterator14.s(); !(_step14 = _iterator14.n()).done;) {
|
|
807
|
+
var _item$_extend$other7;
|
|
808
|
+
var item = _step14.value;
|
|
809
|
+
// 主商品符合附加费条件
|
|
810
|
+
if (isProductMatchSurchargeCondition({
|
|
811
|
+
isCustomItem: item.isCustomItem,
|
|
812
|
+
startDate: item._extend.startDate,
|
|
813
|
+
product_id: item.product_id
|
|
814
|
+
}, {
|
|
522
815
|
surchargeConfig: surchargeConfig,
|
|
523
816
|
scheduleById: scheduleById || {},
|
|
524
817
|
ScheduleModule: ScheduleModule
|
|
525
818
|
})) {
|
|
819
|
+
// 主商品加价减价后的总价
|
|
820
|
+
var total = getMainProductTotal(item);
|
|
821
|
+
var mainQuantity = item._extend.quantity || 1;
|
|
526
822
|
matchedItems.push({
|
|
527
|
-
total:
|
|
528
|
-
addTimeTotal: getRelationDetailsTotal(
|
|
529
|
-
|
|
823
|
+
total: total,
|
|
824
|
+
// addTimeTotal: getRelationDetailsTotal(
|
|
825
|
+
// item._extend.relation_details || []
|
|
826
|
+
// ),
|
|
827
|
+
isMain: true,
|
|
828
|
+
quantity: mainQuantity,
|
|
829
|
+
item: item,
|
|
830
|
+
mainQuantity: mainQuantity // 主商品的mainQuantity等于自己的quantity
|
|
530
831
|
});
|
|
531
832
|
}
|
|
833
|
+
// 遍历子商品 原价商品符合附加费条件
|
|
834
|
+
var _iterator15 = _createForOfIteratorHelper(((_item$_extend$other7 = item._extend.other) === null || _item$_extend$other7 === void 0 ? void 0 : _item$_extend$other7.bundle) || []),
|
|
835
|
+
_step15;
|
|
836
|
+
try {
|
|
837
|
+
for (_iterator15.s(); !(_step15 = _iterator15.n()).done;) {
|
|
838
|
+
var bundleItem = _step15.value;
|
|
839
|
+
// bundle商品是原价且符合附加费条件
|
|
840
|
+
if (getBundleItemIsOriginalPrice(bundleItem) && isProductMatchSurchargeCondition({
|
|
841
|
+
isCustomItem: false,
|
|
842
|
+
startDate: item._extend.startDate,
|
|
843
|
+
product_id: bundleItem._bundle_product_id
|
|
844
|
+
}, {
|
|
845
|
+
surchargeConfig: surchargeConfig,
|
|
846
|
+
scheduleById: scheduleById || {},
|
|
847
|
+
ScheduleModule: ScheduleModule
|
|
848
|
+
})) {
|
|
849
|
+
var _ref6, _bundleItem$bundle_se3;
|
|
850
|
+
var _mainQuantity = item._extend.quantity || 1;
|
|
851
|
+
matchedItems.push({
|
|
852
|
+
isMain: false,
|
|
853
|
+
total: Number((_ref6 = (_bundleItem$bundle_se3 = bundleItem.bundle_selling_price) !== null && _bundleItem$bundle_se3 !== void 0 ? _bundleItem$bundle_se3 : bundleItem.price) !== null && _ref6 !== void 0 ? _ref6 : 0),
|
|
854
|
+
quantity: bundleItem.num || bundleItem.quantity || 1,
|
|
855
|
+
item: bundleItem,
|
|
856
|
+
mainQuantity: _mainQuantity // 子商品的mainQuantity是所属主商品的quantity
|
|
857
|
+
});
|
|
858
|
+
}
|
|
859
|
+
}
|
|
860
|
+
|
|
861
|
+
// 加时商品符合附加费条件
|
|
862
|
+
} catch (err) {
|
|
863
|
+
_iterator15.e(err);
|
|
864
|
+
} finally {
|
|
865
|
+
_iterator15.f();
|
|
866
|
+
}
|
|
867
|
+
var _iterator16 = _createForOfIteratorHelper(item._extend.relation_details || []),
|
|
868
|
+
_step16;
|
|
869
|
+
try {
|
|
870
|
+
for (_iterator16.s(); !(_step16 = _iterator16.n()).done;) {
|
|
871
|
+
var relationDetail = _step16.value;
|
|
872
|
+
if (isProductMatchSurchargeCondition({
|
|
873
|
+
isCustomItem: false,
|
|
874
|
+
startDate: item._extend.startDate,
|
|
875
|
+
product_id: relationDetail.product_id
|
|
876
|
+
}, {
|
|
877
|
+
surchargeConfig: surchargeConfig,
|
|
878
|
+
scheduleById: scheduleById || {},
|
|
879
|
+
ScheduleModule: ScheduleModule
|
|
880
|
+
})) {
|
|
881
|
+
var _relationDetail$metad;
|
|
882
|
+
matchedItems.push({
|
|
883
|
+
isMain: false,
|
|
884
|
+
total: Number((relationDetail === null || relationDetail === void 0 ? void 0 : relationDetail.price) || (relationDetail === null || relationDetail === void 0 || (_relationDetail$metad = relationDetail.metadata) === null || _relationDetail$metad === void 0 ? void 0 : _relationDetail$metad.main_product_attached_bundle_selling_price)),
|
|
885
|
+
quantity: relationDetail.num || relationDetail.quantity || 1,
|
|
886
|
+
item: relationDetail,
|
|
887
|
+
mainQuantity: 1 // 加时商品不受主商品数量影响
|
|
888
|
+
});
|
|
889
|
+
}
|
|
890
|
+
}
|
|
891
|
+
} catch (err) {
|
|
892
|
+
_iterator16.e(err);
|
|
893
|
+
} finally {
|
|
894
|
+
_iterator16.f();
|
|
895
|
+
}
|
|
532
896
|
}
|
|
533
897
|
} catch (err) {
|
|
534
|
-
|
|
898
|
+
_iterator14.e(err);
|
|
535
899
|
} finally {
|
|
536
|
-
|
|
900
|
+
_iterator14.f();
|
|
537
901
|
}
|
|
538
902
|
}
|
|
539
903
|
|
|
540
904
|
// 检查addons中符合条件的商品
|
|
541
905
|
if (Array.isArray(addons === null || addons === void 0 ? void 0 : addons.value)) {
|
|
542
|
-
var
|
|
543
|
-
|
|
906
|
+
var _iterator17 = _createForOfIteratorHelper(addons.value),
|
|
907
|
+
_step17;
|
|
544
908
|
try {
|
|
545
|
-
for (
|
|
546
|
-
var
|
|
547
|
-
if (isProductMatchSurchargeCondition(
|
|
909
|
+
for (_iterator17.s(); !(_step17 = _iterator17.n()).done;) {
|
|
910
|
+
var _item3 = _step17.value;
|
|
911
|
+
if (isProductMatchSurchargeCondition(_item3, {
|
|
548
912
|
surchargeConfig: surchargeConfig,
|
|
549
913
|
scheduleById: scheduleById || {},
|
|
550
914
|
ScheduleModule: ScheduleModule
|
|
551
915
|
})) {
|
|
552
916
|
matchedItems.push({
|
|
553
|
-
|
|
554
|
-
|
|
917
|
+
isMain: true,
|
|
918
|
+
total: Number(_item3._extend.total),
|
|
919
|
+
quantity: _item3._extend.quantity || 1,
|
|
920
|
+
item: _item3,
|
|
921
|
+
mainQuantity: 1 // addons独立商品,mainQuantity为1
|
|
555
922
|
});
|
|
556
923
|
}
|
|
557
924
|
}
|
|
558
925
|
} catch (err) {
|
|
559
|
-
|
|
926
|
+
_iterator17.e(err);
|
|
560
927
|
} finally {
|
|
561
|
-
|
|
928
|
+
_iterator17.f();
|
|
562
929
|
}
|
|
563
930
|
}
|
|
564
931
|
var finalAmount = 0;
|
|
932
|
+
|
|
933
|
+
// 计算商品总数:主商品和addons按quantity计算,子商品(bundle item)需要乘以主商品数量
|
|
934
|
+
var productCount = matchedItems.reduce(function (total, item) {
|
|
935
|
+
if (item.isMain) {
|
|
936
|
+
// 主商品和addons商品
|
|
937
|
+
return total + (item.quantity || 1);
|
|
938
|
+
} else {
|
|
939
|
+
// 子商品(bundle item)和加时商品
|
|
940
|
+
// 加时商品的 mainQuantity = 1,所以不受影响
|
|
941
|
+
// bundle item 的 mainQuantity = 主商品数量,需要乘以实际数量
|
|
942
|
+
return total + (item.quantity || 1) * (item.mainQuantity || 1);
|
|
943
|
+
}
|
|
944
|
+
}, 0);
|
|
945
|
+
|
|
946
|
+
// 追加进入的固定附加费总值
|
|
947
|
+
var fixedTotal = new Decimal(0);
|
|
948
|
+
// 追加到商品的附加费总值 用于追加抹平字段
|
|
949
|
+
var productTotalSurcharge = new Decimal(0);
|
|
565
950
|
if (matchedItems.length > 0) {
|
|
566
951
|
// 基于每个商品计算附加费:max(0, 商品价格) * rate + fixed
|
|
567
952
|
var configTotal = new Decimal(0);
|
|
568
953
|
|
|
954
|
+
// 计算固定附加费 - 只加一次
|
|
955
|
+
if (fixed && new Decimal(fixed).gt(0)) {
|
|
956
|
+
configTotal = configTotal.plus(fixed);
|
|
957
|
+
}
|
|
958
|
+
|
|
569
959
|
// 计算百分比附加费 - 对每个商品单独计算
|
|
570
|
-
if (percentage && new Decimal(percentage).gt(0)) {
|
|
960
|
+
if (percentage && new Decimal(percentage).gt(0) || fixed) {
|
|
571
961
|
var percentageRate = new Decimal(percentage);
|
|
572
|
-
var
|
|
573
|
-
|
|
962
|
+
var _iterator18 = _createForOfIteratorHelper(matchedItems.entries()),
|
|
963
|
+
_step18;
|
|
574
964
|
try {
|
|
575
|
-
for (
|
|
576
|
-
var
|
|
965
|
+
for (_iterator18.s(); !(_step18 = _iterator18.n()).done;) {
|
|
966
|
+
var _step18$value = _slicedToArray(_step18.value, 2),
|
|
967
|
+
index = _step18$value[0],
|
|
968
|
+
_item4 = _step18$value[1];
|
|
969
|
+
var isLast = index === matchedItems.length - 1;
|
|
577
970
|
// 对每个商品:max(0, 价格) * 数量 * 费率
|
|
578
|
-
var itemPrice = new Decimal(Math.max(0,
|
|
579
|
-
var itemQuantity = new Decimal(
|
|
580
|
-
var addTimeTotal = new Decimal(
|
|
581
|
-
|
|
582
|
-
|
|
971
|
+
var itemPrice = new Decimal(Math.max(0, _item4.total || 0));
|
|
972
|
+
var itemQuantity = new Decimal(_item4.isMain ? _item4.quantity || 1 : _item4.quantity * _item4.mainQuantity || 1);
|
|
973
|
+
var addTimeTotal = new Decimal(_item4.addTimeTotal || 0);
|
|
974
|
+
// 单个商品总附加费
|
|
975
|
+
var itemTotalSurcharge = itemPrice.times(itemQuantity).plus(addTimeTotal).times(percentageRate);
|
|
976
|
+
configTotal = configTotal.plus(itemTotalSurcharge);
|
|
977
|
+
|
|
978
|
+
// 单个商品单数量附加费
|
|
979
|
+
var itemSurcharge = itemPrice.times(percentageRate);
|
|
980
|
+
|
|
981
|
+
// 固定附加费 = 1 / 商品数量 * 固定附加费(向下取整保留两位小数)
|
|
982
|
+
var fixedSurcharge = new Decimal(1).div(productCount).times(fixed).times(100).floor().div(100).toFixed(2);
|
|
983
|
+
var quantity = _item4.isMain ? _item4.quantity : _item4.quantity * _item4.mainQuantity;
|
|
984
|
+
fixedTotal = fixedTotal.plus(new Decimal(fixedSurcharge).times(quantity).toNumber());
|
|
985
|
+
|
|
986
|
+
// 如果是最后一个商品 判断fixed - fixedTotal 是否有剩余小数 如果有的话,追加抹平字段
|
|
987
|
+
if (isLast && fixedTotal.gt(0)) {
|
|
988
|
+
var remaining = new Decimal(fixed).minus(fixedTotal).toNumber();
|
|
989
|
+
if (remaining > 0) {
|
|
990
|
+
productTotalSurcharge = productTotalSurcharge.plus(remaining);
|
|
991
|
+
if (_item4.isMain) {
|
|
992
|
+
_item4.item._extend.surcharge_rounding_remainder = remaining;
|
|
993
|
+
} else {
|
|
994
|
+
_item4.item.surcharge_rounding_remainder = remaining;
|
|
995
|
+
}
|
|
996
|
+
}
|
|
997
|
+
}
|
|
998
|
+
// 只有当 open_product !== 0 时,才将附加费追加到商品身上
|
|
999
|
+
// open_product === 0 表示商品未开启该附加费,只在订单级别累加
|
|
1000
|
+
if (open_product !== 0) {
|
|
1001
|
+
if (_item4.isMain) {
|
|
1002
|
+
var _item4$item$_extend;
|
|
1003
|
+
var originSurchargeFee = new Decimal(_item4.item._extend.surcharge_fee || 0);
|
|
1004
|
+
// 保留两位小数
|
|
1005
|
+
var surchargeFee = originSurchargeFee.plus(itemSurcharge).plus(fixedSurcharge).toDecimalPlaces(2, Decimal.ROUND_DOWN).toNumber();
|
|
1006
|
+
productTotalSurcharge = productTotalSurcharge.plus(new Decimal(surchargeFee).times(itemQuantity).toNumber());
|
|
1007
|
+
_item4.item._extend.surcharge_fee = surchargeFee;
|
|
1008
|
+
_item4.item._extend.relation_surcharge_ids = [].concat(_toConsumableArray(((_item4$item$_extend = _item4.item._extend) === null || _item4$item$_extend === void 0 ? void 0 : _item4$item$_extend.relation_surcharge_ids) || []), [id]);
|
|
1009
|
+
} else {
|
|
1010
|
+
var _item4$item;
|
|
1011
|
+
var _originSurchargeFee = new Decimal(_item4.item.surcharge_fee || 0);
|
|
1012
|
+
// 保留两位小数
|
|
1013
|
+
var _surchargeFee = _originSurchargeFee.plus(itemSurcharge).plus(fixedSurcharge).toDecimalPlaces(2, Decimal.ROUND_DOWN).toNumber();
|
|
1014
|
+
productTotalSurcharge = productTotalSurcharge.plus(new Decimal(_surchargeFee).times(itemQuantity).toNumber());
|
|
1015
|
+
_item4.item.surcharge_fee = _surchargeFee;
|
|
1016
|
+
_item4.item.relation_surcharge_ids = [].concat(_toConsumableArray(((_item4$item = _item4.item) === null || _item4$item === void 0 ? void 0 : _item4$item.relation_surcharge_ids) || []), [id]);
|
|
1017
|
+
}
|
|
1018
|
+
}
|
|
1019
|
+
// 最后一个商品 判断configTotal - productTotalSurcharge 是否有剩余小数 如果有的话,追加抹平字段
|
|
1020
|
+
if (isLast && configTotal.minus(productTotalSurcharge).gt(0)) {
|
|
1021
|
+
// 四舍五入configTotal
|
|
1022
|
+
var configTotalRounded = configTotal.toDecimalPlaces(2, Decimal.ROUND_HALF_UP);
|
|
1023
|
+
if (_item4.isMain) {
|
|
1024
|
+
var newRoundingRemainder = new Decimal(_item4.item._extend.surcharge_rounding_remainder || 0);
|
|
1025
|
+
newRoundingRemainder = newRoundingRemainder.plus(configTotalRounded.minus(productTotalSurcharge));
|
|
1026
|
+
_item4.item._extend.surcharge_rounding_remainder = newRoundingRemainder.toNumber();
|
|
1027
|
+
} else {
|
|
1028
|
+
var _newRoundingRemainder = new Decimal(_item4.item.surcharge_rounding_remainder || 0);
|
|
1029
|
+
_newRoundingRemainder = _newRoundingRemainder.plus(configTotalRounded.minus(productTotalSurcharge));
|
|
1030
|
+
_item4.item.surcharge_rounding_remainder = _newRoundingRemainder.toNumber();
|
|
1031
|
+
}
|
|
1032
|
+
}
|
|
583
1033
|
}
|
|
584
1034
|
} catch (err) {
|
|
585
|
-
|
|
1035
|
+
_iterator18.e(err);
|
|
586
1036
|
} finally {
|
|
587
|
-
|
|
1037
|
+
_iterator18.f();
|
|
588
1038
|
}
|
|
589
1039
|
}
|
|
590
1040
|
|
|
591
|
-
// 计算固定附加费 - 只加一次
|
|
592
|
-
if (fixed && new Decimal(fixed).gt(0)) {
|
|
593
|
-
configTotal = configTotal.plus(fixed);
|
|
594
|
-
}
|
|
595
|
-
|
|
596
1041
|
// 如果该配置有金额,则添加到结果中
|
|
597
1042
|
finalAmount = configTotal.toDecimalPlaces(2, Decimal.ROUND_HALF_UP).toNumber();
|
|
598
1043
|
}
|
|
@@ -611,7 +1056,10 @@ var getSurcharge = function getSurcharge(state, options) {
|
|
|
611
1056
|
type: 'default',
|
|
612
1057
|
fixed: fixed,
|
|
613
1058
|
amount: finalAmount,
|
|
614
|
-
percentage: percentage
|
|
1059
|
+
percentage: percentage,
|
|
1060
|
+
metadata: {
|
|
1061
|
+
open_product: open_product
|
|
1062
|
+
}
|
|
615
1063
|
});
|
|
616
1064
|
}
|
|
617
1065
|
return surchargeWithAmount;
|
|
@@ -682,13 +1130,13 @@ export var getIsPriceIncludeTax = function getIsPriceIncludeTax(state) {
|
|
|
682
1130
|
var _state$bookingDetail$, _state$bookingDetail6;
|
|
683
1131
|
return (_state$bookingDetail$ = (_state$bookingDetail6 = state.bookingDetail) === null || _state$bookingDetail6 === void 0 ? void 0 : _state$bookingDetail6.is_price_include_tax) !== null && _state$bookingDetail$ !== void 0 ? _state$bookingDetail$ : 0;
|
|
684
1132
|
};
|
|
685
|
-
var getExpectAmount = function getExpectAmount(
|
|
686
|
-
var price =
|
|
687
|
-
tax =
|
|
688
|
-
surchargeAmount =
|
|
689
|
-
shopDiscount =
|
|
690
|
-
state =
|
|
691
|
-
options =
|
|
1133
|
+
var getExpectAmount = function getExpectAmount(_ref7) {
|
|
1134
|
+
var price = _ref7.price,
|
|
1135
|
+
tax = _ref7.tax,
|
|
1136
|
+
surchargeAmount = _ref7.surchargeAmount,
|
|
1137
|
+
shopDiscount = _ref7.shopDiscount,
|
|
1138
|
+
state = _ref7.state,
|
|
1139
|
+
options = _ref7.options;
|
|
692
1140
|
var _tax = tax;
|
|
693
1141
|
// 如果价格含税, 则将税费改为0
|
|
694
1142
|
if (getIsPriceIncludeTax(state) || options !== null && options !== void 0 && options.is_price_include_tax) {
|
|
@@ -710,9 +1158,9 @@ var getRoundingAmount = function getRoundingAmount(state) {
|
|
|
710
1158
|
var _state$bookingDetail9;
|
|
711
1159
|
return Number(state === null || state === void 0 || (_state$bookingDetail9 = state.bookingDetail) === null || _state$bookingDetail9 === void 0 ? void 0 : _state$bookingDetail9.rounding_amount) || 0;
|
|
712
1160
|
};
|
|
713
|
-
var getSumTotalAmount = function getSumTotalAmount(
|
|
714
|
-
var expectAmount =
|
|
715
|
-
roundingAmount =
|
|
1161
|
+
var getSumTotalAmount = function getSumTotalAmount(_ref8) {
|
|
1162
|
+
var expectAmount = _ref8.expectAmount,
|
|
1163
|
+
roundingAmount = _ref8.roundingAmount;
|
|
716
1164
|
return expectAmount + roundingAmount;
|
|
717
1165
|
};
|
|
718
1166
|
|
|
@@ -784,6 +1232,20 @@ export var getSumTotal = function getSumTotal(state, options) {
|
|
|
784
1232
|
options: options
|
|
785
1233
|
});
|
|
786
1234
|
|
|
1235
|
+
// 商品原价 不包含折扣
|
|
1236
|
+
var _getProductExpectAmou2 = getProductExpectAmount(state, options.isEdit, true),
|
|
1237
|
+
productExpectAmountWithoutDiscount = _getProductExpectAmou2.productExpectAmount;
|
|
1238
|
+
|
|
1239
|
+
// 订单原价 不包含整单折扣 不包含商品券折扣卡抵扣
|
|
1240
|
+
var originExpectAmountWithoutDiscount = getExpectAmount({
|
|
1241
|
+
price: productExpectAmountWithoutDiscount,
|
|
1242
|
+
tax: originTax,
|
|
1243
|
+
surchargeAmount: surchargeAmount,
|
|
1244
|
+
shopDiscount: 0,
|
|
1245
|
+
state: state,
|
|
1246
|
+
options: options
|
|
1247
|
+
});
|
|
1248
|
+
|
|
787
1249
|
// 总支付金额 总计
|
|
788
1250
|
var sumTotalAmount = getSumTotalAmount({
|
|
789
1251
|
expectAmount: expectAmount,
|
|
@@ -820,6 +1282,8 @@ export var getSumTotal = function getSumTotal(state, options) {
|
|
|
820
1282
|
totalRefundAmount: totalRefundAmount,
|
|
821
1283
|
dueAmount: dueAmount,
|
|
822
1284
|
roundingAmount: roundingAmount,
|
|
823
|
-
originExpectAmount: originExpectAmount
|
|
1285
|
+
originExpectAmount: originExpectAmount,
|
|
1286
|
+
// 订单原价 不包含整单折扣 不包含商品券折扣卡抵扣
|
|
1287
|
+
originExpectAmountWithoutDiscount: originExpectAmountWithoutDiscount
|
|
824
1288
|
};
|
|
825
1289
|
};
|