@pisell/private-materials 6.7.9 → 6.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (421) hide show
  1. package/build/lowcode/assets-daily.json +11 -11
  2. package/build/lowcode/assets-dev.json +2 -2
  3. package/build/lowcode/assets-prod.json +11 -11
  4. package/build/lowcode/index.js +1 -1
  5. package/build/lowcode/meta.js +2 -2
  6. package/build/lowcode/preview.js +7 -7
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +9 -9
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +9 -9
  11. package/es/components/appointmentBooking/components/Voucher/index.js +2 -1
  12. package/es/components/booking/addons/index.js +25 -17
  13. package/es/components/booking/components/footer/amount.d.ts +1 -0
  14. package/es/components/booking/components/footer/amount.js +548 -84
  15. package/es/components/booking/components/footer/index.js +77 -56
  16. package/es/components/booking/components/footer/utils.d.ts +19 -0
  17. package/es/components/booking/components/footer/utils.js +194 -73
  18. package/es/components/booking/components/voucher/index.js +23 -7
  19. package/es/components/booking/hooks/useQuotation.js +4 -1
  20. package/es/components/booking/info/clientVariant/hooks/useIsLowSpeedNetwork.d.ts +0 -1
  21. package/es/components/booking/info/hooks/useInfoHolder.d.ts +0 -1
  22. package/es/components/booking/info/service2/utils.js +1 -0
  23. package/es/components/booking/info2/cartClientCard/index.js +30 -6
  24. package/es/components/booking/info2/index.js +1 -1
  25. package/es/components/booking/info2/service/addService/index.js +2 -3
  26. package/es/components/booking/info2/service/editNormalService/index.js +6 -0
  27. package/es/components/booking/info2/service/editService/index.js +16 -6
  28. package/es/components/booking/info2/service/editService/utils.d.ts +15 -0
  29. package/es/components/booking/info2/service/editService/utils.js +66 -0
  30. package/es/components/booking/utils.d.ts +1 -0
  31. package/es/components/booking/utils.js +16 -3
  32. package/es/components/checkout/PaymentModal.d.ts +13 -5
  33. package/es/components/checkout/PaymentModal.js +304 -252
  34. package/es/components/checkout/components/AdditionalModule/index.d.ts +3 -1
  35. package/es/components/checkout/components/AdditionalModule/index.js +52 -12
  36. package/es/components/checkout/components/AmountSummary/index.js +9 -76
  37. package/es/components/checkout/components/AmountSummary/index.less +5 -6
  38. package/es/components/checkout/components/CashPaymentModule/index.d.ts +3 -1
  39. package/es/components/checkout/components/CashPaymentModule/index.js +5 -2
  40. package/es/components/checkout/components/PaymentDetailModal/index.js +2 -2
  41. package/es/components/checkout/components/PaymentOptionsModule/PaymentMethodItem.d.ts +2 -0
  42. package/es/components/checkout/components/PaymentOptionsModule/PaymentMethodItem.js +6 -1
  43. package/es/components/checkout/components/PaymentOptionsModule/index.d.ts +1 -0
  44. package/es/components/checkout/components/PaymentOptionsModule/index.js +2 -1
  45. package/es/components/checkout/components/PaymentOptionsModule/index.less +4 -0
  46. package/es/components/checkout/components/PaymentResultToast/PaymentResultToastProvider.d.ts +4 -0
  47. package/es/components/checkout/components/PaymentResultToast/PaymentResultToastProvider.js +31 -8
  48. package/es/components/checkout/components/PaymentResultToast/index.js +6 -6
  49. package/es/components/checkout/components/PaymentResultToast/index.less +94 -33
  50. package/es/components/checkout/components/SearchAndClientModule/index.js +39 -40
  51. package/es/components/checkout/index.less +1 -1
  52. package/es/components/checkout/locales.d.ts +6 -0
  53. package/es/components/checkout/locales.js +6 -0
  54. package/es/components/checkout/plugin.d.ts +2 -0
  55. package/es/components/checkout/plugin.js +303 -0
  56. package/es/components/checkout/utils/PaymentResultToastUtils.d.ts +0 -1
  57. package/es/components/checkout/utils/PaymentResultToastUtils.js +11 -1
  58. package/es/components/eftpos/hooks.d.ts +0 -1
  59. package/es/components/eftposPay/hooks.d.ts +1 -1
  60. package/es/components/eftposPay/linkly/hooks/useTimeQuery.js +14 -6
  61. package/es/components/eftposPay/payo/config.js +70 -32
  62. package/es/components/eftposPay/payo/payment.d.ts +66 -0
  63. package/es/components/eftposPay/payo/payment.js +579 -0
  64. package/es/components/eftposPay/store/index.d.ts +4 -4
  65. package/es/components/eftposPay/tyro/hooks.d.ts +0 -1
  66. package/es/components/eftposPay/tyro/index.js +12 -0
  67. package/es/components/eftposPay/utils/log/index.d.ts +110 -0
  68. package/es/components/eftposPay/utils/log/index.js +371 -0
  69. package/es/components/eventBooking/components/ErrorTip/index.d.ts +0 -1
  70. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateStatus/index.d.ts +0 -1
  71. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/CallToBook/index.d.ts +0 -1
  72. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/WeekItem/index.d.ts +0 -1
  73. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/index.d.ts +0 -1
  74. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Item/DayItem/index.d.ts +0 -1
  75. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Item/index.d.ts +0 -1
  76. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Status/index.d.ts +0 -1
  77. package/es/components/index.d.ts +2 -1
  78. package/es/components/index.js +2 -1
  79. package/es/components/list/List.js +99 -56
  80. package/es/components/list/hooks/useListState.d.ts +5 -3
  81. package/es/components/list/hooks/useListState.js +10 -2
  82. package/es/components/list/styles/base.less +4 -0
  83. package/es/components/list/styles/content.less +1 -1
  84. package/es/components/list/styles/header.less +4 -4
  85. package/es/components/list/types.d.ts +1 -0
  86. package/es/components/list/utils/index.d.ts +13 -1
  87. package/es/components/list/utils/index.js +43 -1
  88. package/es/components/pay/toC/PaymentMethods/MWCreditCard/tds2.js +14 -12
  89. package/es/components/pay/toC/PaymentMethods/StripePay/Stripe/Finish/index.d.ts +0 -1
  90. package/es/components/pay/toC/PaymentMethods/StripePay/Stripe/StripeSDK/index.d.ts +0 -1
  91. package/es/components/pay/toC/PaymentMethods/StripePay/Stripe/components/PageLoading/index.d.ts +0 -1
  92. package/es/components/pay/toC/PaymentMethods/WalletPass/serve.d.ts +6 -0
  93. package/es/components/pay/toC/PaymentMethods/WalletPass/utils.js +4 -2
  94. package/es/components/pay/toC/PaymentMethods/components/PaymentReturnContent/index.js +2 -0
  95. package/es/components/pay/toC/PaymentMethods/components/PaymentReturnContent/index.less +13 -3
  96. package/es/components/pay/toC/index.js +7 -4
  97. package/es/components/pay/toC/locales.d.ts +3 -0
  98. package/es/components/pay/toC/locales.js +6 -3
  99. package/es/components/pay/toC/status.d.ts +1 -0
  100. package/es/components/pay/toC/status.js +3 -0
  101. package/es/components/shoppingCart/components/Empty/index.d.ts +0 -1
  102. package/es/components/subTotal/index.js +1 -1
  103. package/es/components/systemSettings/registry/components/GroupModal.d.ts +4 -0
  104. package/es/components/{checkout/PaymentPlugin.js → systemSettings/registry/components/GroupModal.js} +132 -171
  105. package/es/components/systemSettings/registry/components/ItemModal.d.ts +4 -0
  106. package/es/components/systemSettings/registry/components/ItemModal.js +547 -0
  107. package/es/components/systemSettings/registry/components/ModuleList.d.ts +4 -0
  108. package/es/components/systemSettings/registry/components/ModuleList.js +54 -0
  109. package/es/components/systemSettings/registry/components/SectionList.d.ts +4 -0
  110. package/es/components/systemSettings/registry/components/SectionList.js +174 -0
  111. package/es/components/systemSettings/registry/components/SettingsTable.d.ts +4 -0
  112. package/es/components/systemSettings/registry/components/SettingsTable.js +765 -0
  113. package/es/components/systemSettings/registry/components/index.d.ts +4 -0
  114. package/es/components/systemSettings/registry/components/index.js +4 -0
  115. package/es/components/systemSettings/registry/index.d.ts +5 -0
  116. package/es/components/systemSettings/registry/index.js +1059 -0
  117. package/es/components/systemSettings/registry/index.less +410 -0
  118. package/es/components/systemSettings/registry/locales.d.ts +272 -0
  119. package/es/components/systemSettings/registry/locales.js +300 -0
  120. package/es/components/systemSettings/registry/services.d.ts +77 -0
  121. package/es/components/systemSettings/registry/services.js +472 -0
  122. package/es/components/systemSettings/registry/types.d.ts +126 -0
  123. package/es/components/systemSettings/registry/types.js +1 -0
  124. package/es/components/systemSettings/registry/utils/typeValidation.d.ts +16 -0
  125. package/es/components/systemSettings/registry/utils/typeValidation.js +284 -0
  126. package/es/components/systemSettings/registry/utils/validators.d.ts +8 -0
  127. package/es/components/systemSettings/registry/utils/validators.js +44 -0
  128. package/es/components/ticketBooking/components/ProductDisplayAdapter/ProductDisplayAdapter.js +58 -11
  129. package/es/components/ticketBooking/components/ProductDisplayAdapter/index.less +28 -1
  130. package/es/components/ticketBooking/components/ProductDisplayAdapter/utils.d.ts +35 -2
  131. package/es/components/ticketBooking/components/ProductDisplayAdapter/utils.js +149 -36
  132. package/es/components/ticketBooking/components/addServiceVariant/addService.js +2 -86
  133. package/es/components/ticketBooking/components/menuBar/index.js +109 -12
  134. package/es/components/ticketBooking/components/ticketBooking/index.js +2 -2
  135. package/es/components/ticketBooking/components/timeBar/index.js +112 -7
  136. package/es/components/ticketBooking/components/timeBar/index.less +59 -0
  137. package/es/components/ticketBooking/hooks/pisellos/useProducts.js +29 -18
  138. package/es/components/ticketBooking/locales.d.ts +9 -0
  139. package/es/components/ticketBooking/locales.js +12 -3
  140. package/es/components/ticketBooking/utils/index.d.ts +3 -0
  141. package/es/components/ticketBooking/utils/index.js +36 -13
  142. package/es/components/wallet/Detail/index.js +34 -2
  143. package/es/components/wallet/Detail/index.less +11 -0
  144. package/es/components/wallet/Detail/locales.d.ts +6 -0
  145. package/es/components/wallet/Detail/locales.js +14 -2
  146. package/es/components/wallet/Voucher/index.js +11 -10
  147. package/es/components/wallet/components/WalletCard.js +5 -1
  148. package/es/components/wallet/index.js +4 -2
  149. package/es/components/wallet/serve.d.ts +7 -0
  150. package/es/components/wallet/utils.d.ts +48 -0
  151. package/es/components/wallet/utils.js +342 -0
  152. package/es/index.d.ts +5 -0
  153. package/es/index.js +6 -1
  154. package/es/plus/clientCard/locales.js +3 -3
  155. package/es/plus/clinetSearch/index.js +28 -30
  156. package/es/plus/clinetSearch/locales.d.ts +3 -0
  157. package/es/plus/clinetSearch/locales.js +7 -4
  158. package/es/plus/clinetSearch/types.d.ts +12 -0
  159. package/es/plus/productSelect/CategoryTabs/index.d.ts +1 -0
  160. package/es/plus/productSelect/CategoryTabs/index.js +2 -1
  161. package/es/plus/walletPassGallery/components/footerButton/index.js +2 -4
  162. package/es/plus/walletPassGallery/components/footerButton/index.less +14 -59
  163. package/es/plus/walletPassGallery/components/passDetail/index.d.ts +1 -0
  164. package/es/plus/walletPassGallery/components/passDetail/index.js +84 -31
  165. package/es/plus/walletPassGallery/components/passDetail/index.less +4 -0
  166. package/es/plus/walletPassGallery/components/recharge/index.js +19 -8
  167. package/es/plus/walletPassGallery/index.js +7 -3
  168. package/es/plus/walletPassGallery/serve.d.ts +3 -0
  169. package/es/plus/walletPassGallery/serve.js +4 -2
  170. package/es/pro/Login2.0/index.less +15 -8
  171. package/es/pro/Selector/BatchSelectorDemo.d.ts +3 -0
  172. package/es/pro/Selector/BatchSelectorDemo.js +470 -0
  173. package/es/pro/Selector/Selector.d.ts +5 -0
  174. package/es/pro/Selector/Selector.js +283 -0
  175. package/es/pro/Selector/SelectorGroup.d.ts +11 -0
  176. package/es/pro/Selector/SelectorGroup.js +537 -0
  177. package/es/pro/Selector/components/Card/index.d.ts +27 -0
  178. package/es/pro/Selector/components/Card/index.js +96 -0
  179. package/es/pro/Selector/components/Card/index.less +132 -0
  180. package/es/pro/Selector/components/IntersectionObserver.d.ts +105 -0
  181. package/es/pro/Selector/components/IntersectionObserver.js +384 -0
  182. package/es/pro/Selector/components/NumericStepper/index.d.ts +41 -0
  183. package/es/pro/Selector/components/NumericStepper/index.js +198 -0
  184. package/es/pro/Selector/components/NumericStepper/index.less +221 -0
  185. package/es/pro/Selector/components/index.d.ts +2 -0
  186. package/es/pro/Selector/components/index.js +2 -0
  187. package/es/pro/Selector/demo.d.ts +3 -0
  188. package/es/pro/Selector/demo.js +158 -0
  189. package/es/pro/Selector/hooks/useSelectionController.d.ts +42 -0
  190. package/es/pro/Selector/hooks/useSelectionController.js +414 -0
  191. package/es/pro/Selector/index.d.ts +8 -0
  192. package/es/pro/Selector/index.js +5 -0
  193. package/es/pro/Selector/locales.d.ts +42 -0
  194. package/es/pro/Selector/locales.js +80 -0
  195. package/es/pro/Selector/selector.less +3 -0
  196. package/es/pro/Selector/selectorGroup.less +8 -0
  197. package/es/pro/Selector/types.d.ts +114 -0
  198. package/es/pro/Selector/types.js +1 -0
  199. package/es/pro/Selector/utils/index.d.ts +49 -0
  200. package/es/pro/Selector/utils/index.js +229 -0
  201. package/es/pro/comprehensiveSearch/components/searchSection/locales.js +3 -3
  202. package/es/pro/comprehensiveSearch/locales.js +1 -1
  203. package/es/pro/priceKeyboard/components/cashKeyboard/CashKeyboardIntact.js +45 -36
  204. package/es/pro/priceKeyboard/components/cashKeyboard/index.d.ts +1 -0
  205. package/es/pro/priceKeyboard/components/cashKeyboard/index.js +4 -2
  206. package/es/pro/priceKeyboard/components/cashKeyboard/types.d.ts +1 -0
  207. package/es/pro/priceKeyboard/components/discountKeyboard/index.js +10 -1
  208. package/es/pro/priceKeyboard/components/discountKeyboard/index.less +14 -0
  209. package/es/pro/priceKeyboard/components/shortcuts/index.d.ts +1 -0
  210. package/es/pro/priceKeyboard/components/shortcuts/index.js +5 -2
  211. package/es/pro/priceKeyboard/components/shortcuts/index.less +4 -0
  212. package/lib/components/appointmentBooking/components/Voucher/index.js +2 -1
  213. package/lib/components/booking/addons/index.js +15 -7
  214. package/lib/components/booking/components/footer/amount.d.ts +1 -0
  215. package/lib/components/booking/components/footer/amount.js +293 -41
  216. package/lib/components/booking/components/footer/index.js +30 -11
  217. package/lib/components/booking/components/footer/utils.d.ts +19 -0
  218. package/lib/components/booking/components/footer/utils.js +138 -41
  219. package/lib/components/booking/components/voucher/index.js +25 -9
  220. package/lib/components/booking/hooks/useQuotation.js +2 -1
  221. package/lib/components/booking/info/clientVariant/hooks/useIsLowSpeedNetwork.d.ts +0 -1
  222. package/lib/components/booking/info/hooks/useInfoHolder.d.ts +0 -1
  223. package/lib/components/booking/info/service2/utils.js +1 -0
  224. package/lib/components/booking/info2/cartClientCard/index.js +25 -5
  225. package/lib/components/booking/info2/index.js +7 -2
  226. package/lib/components/booking/info2/service/addService/index.js +1 -2
  227. package/lib/components/booking/info2/service/editNormalService/index.js +6 -0
  228. package/lib/components/booking/info2/service/editService/index.js +12 -3
  229. package/lib/components/booking/info2/service/editService/utils.d.ts +15 -0
  230. package/lib/components/booking/info2/service/editService/utils.js +40 -3
  231. package/lib/components/booking/utils.d.ts +1 -0
  232. package/lib/components/booking/utils.js +11 -0
  233. package/lib/components/checkout/PaymentModal.d.ts +13 -5
  234. package/lib/components/checkout/PaymentModal.js +190 -147
  235. package/lib/components/checkout/components/AdditionalModule/index.d.ts +3 -1
  236. package/lib/components/checkout/components/AdditionalModule/index.js +52 -11
  237. package/lib/components/checkout/components/AmountSummary/index.js +5 -46
  238. package/lib/components/checkout/components/AmountSummary/index.less +5 -6
  239. package/lib/components/checkout/components/CashPaymentModule/index.d.ts +3 -1
  240. package/lib/components/checkout/components/CashPaymentModule/index.js +5 -2
  241. package/lib/components/checkout/components/PaymentDetailModal/index.js +2 -2
  242. package/lib/components/checkout/components/PaymentOptionsModule/PaymentMethodItem.d.ts +2 -0
  243. package/lib/components/checkout/components/PaymentOptionsModule/PaymentMethodItem.js +5 -1
  244. package/lib/components/checkout/components/PaymentOptionsModule/index.d.ts +1 -0
  245. package/lib/components/checkout/components/PaymentOptionsModule/index.js +6 -0
  246. package/lib/components/checkout/components/PaymentOptionsModule/index.less +4 -0
  247. package/lib/components/checkout/components/PaymentResultToast/PaymentResultToastProvider.d.ts +4 -0
  248. package/lib/components/checkout/components/PaymentResultToast/PaymentResultToastProvider.js +23 -5
  249. package/lib/components/checkout/components/PaymentResultToast/index.js +4 -4
  250. package/lib/components/checkout/components/PaymentResultToast/index.less +94 -33
  251. package/lib/components/checkout/components/SearchAndClientModule/index.js +29 -3
  252. package/lib/components/checkout/index.less +1 -1
  253. package/lib/components/checkout/locales.d.ts +6 -0
  254. package/lib/components/checkout/locales.js +6 -0
  255. package/lib/components/checkout/plugin.d.ts +2 -0
  256. package/lib/components/checkout/plugin.js +263 -0
  257. package/lib/components/checkout/utils/PaymentResultToastUtils.d.ts +0 -1
  258. package/lib/components/checkout/utils/PaymentResultToastUtils.js +11 -1
  259. package/lib/components/eftpos/hooks.d.ts +0 -1
  260. package/lib/components/eftposPay/hooks.d.ts +1 -1
  261. package/lib/components/eftposPay/linkly/hooks/useTimeQuery.js +12 -6
  262. package/lib/components/eftposPay/payo/config.js +98 -73
  263. package/lib/components/eftposPay/payo/payment.d.ts +66 -0
  264. package/lib/components/eftposPay/payo/payment.js +357 -0
  265. package/lib/components/eftposPay/store/index.d.ts +4 -4
  266. package/lib/components/eftposPay/tyro/hooks.d.ts +0 -1
  267. package/lib/components/eftposPay/tyro/index.js +12 -0
  268. package/lib/components/eftposPay/utils/log/index.d.ts +110 -0
  269. package/lib/components/eftposPay/utils/log/index.js +294 -0
  270. package/lib/components/eventBooking/components/ErrorTip/index.d.ts +0 -1
  271. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateStatus/index.d.ts +0 -1
  272. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/CallToBook/index.d.ts +0 -1
  273. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/WeekItem/index.d.ts +0 -1
  274. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/index.d.ts +0 -1
  275. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Item/DayItem/index.d.ts +0 -1
  276. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Item/index.d.ts +0 -1
  277. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Status/index.d.ts +0 -1
  278. package/lib/components/index.d.ts +2 -1
  279. package/lib/components/index.js +3 -0
  280. package/lib/components/list/List.js +58 -36
  281. package/lib/components/list/hooks/useListState.d.ts +5 -3
  282. package/lib/components/list/hooks/useListState.js +9 -1
  283. package/lib/components/list/styles/base.less +4 -0
  284. package/lib/components/list/styles/content.less +1 -1
  285. package/lib/components/list/styles/header.less +4 -4
  286. package/lib/components/list/types.d.ts +1 -0
  287. package/lib/components/list/utils/index.d.ts +13 -1
  288. package/lib/components/list/utils/index.js +27 -0
  289. package/lib/components/pay/toC/PaymentMethods/MWCreditCard/tds2.js +14 -12
  290. package/lib/components/pay/toC/PaymentMethods/StripePay/Stripe/Finish/index.d.ts +0 -1
  291. package/lib/components/pay/toC/PaymentMethods/StripePay/Stripe/StripeSDK/index.d.ts +0 -1
  292. package/lib/components/pay/toC/PaymentMethods/StripePay/Stripe/components/PageLoading/index.d.ts +0 -1
  293. package/lib/components/pay/toC/PaymentMethods/WalletPass/serve.d.ts +6 -0
  294. package/lib/components/pay/toC/PaymentMethods/WalletPass/utils.js +4 -2
  295. package/lib/components/pay/toC/PaymentMethods/components/PaymentReturnContent/index.js +1 -1
  296. package/lib/components/pay/toC/PaymentMethods/components/PaymentReturnContent/index.less +13 -3
  297. package/lib/components/pay/toC/index.js +4 -1
  298. package/lib/components/pay/toC/locales.d.ts +3 -0
  299. package/lib/components/pay/toC/locales.js +6 -3
  300. package/lib/components/pay/toC/status.d.ts +1 -0
  301. package/lib/components/pay/toC/status.js +5 -0
  302. package/lib/components/shoppingCart/components/Empty/index.d.ts +0 -1
  303. package/lib/components/subTotal/index.js +1 -1
  304. package/lib/components/systemSettings/registry/components/GroupModal.d.ts +4 -0
  305. package/lib/components/systemSettings/registry/components/GroupModal.js +177 -0
  306. package/lib/components/systemSettings/registry/components/ItemModal.d.ts +4 -0
  307. package/lib/components/systemSettings/registry/components/ItemModal.js +508 -0
  308. package/lib/components/systemSettings/registry/components/ModuleList.d.ts +4 -0
  309. package/lib/components/systemSettings/registry/components/ModuleList.js +71 -0
  310. package/lib/components/systemSettings/registry/components/SectionList.d.ts +4 -0
  311. package/lib/components/systemSettings/registry/components/SectionList.js +181 -0
  312. package/lib/components/systemSettings/registry/components/SettingsTable.d.ts +4 -0
  313. package/lib/components/systemSettings/registry/components/SettingsTable.js +575 -0
  314. package/lib/components/systemSettings/registry/components/index.d.ts +4 -0
  315. package/lib/components/systemSettings/registry/components/index.js +48 -0
  316. package/lib/components/systemSettings/registry/index.d.ts +5 -0
  317. package/lib/components/systemSettings/registry/index.js +529 -0
  318. package/lib/components/systemSettings/registry/index.less +410 -0
  319. package/lib/components/systemSettings/registry/locales.d.ts +272 -0
  320. package/lib/components/systemSettings/registry/locales.js +324 -0
  321. package/lib/components/systemSettings/registry/services.d.ts +77 -0
  322. package/lib/components/systemSettings/registry/services.js +290 -0
  323. package/lib/components/systemSettings/registry/types.d.ts +126 -0
  324. package/lib/components/systemSettings/registry/types.js +17 -0
  325. package/lib/components/systemSettings/registry/utils/typeValidation.d.ts +16 -0
  326. package/lib/components/systemSettings/registry/utils/typeValidation.js +228 -0
  327. package/lib/components/systemSettings/registry/utils/validators.d.ts +8 -0
  328. package/lib/components/systemSettings/registry/utils/validators.js +54 -0
  329. package/lib/components/ticketBooking/components/ProductDisplayAdapter/ProductDisplayAdapter.js +40 -5
  330. package/lib/components/ticketBooking/components/ProductDisplayAdapter/index.less +28 -1
  331. package/lib/components/ticketBooking/components/ProductDisplayAdapter/utils.d.ts +35 -2
  332. package/lib/components/ticketBooking/components/ProductDisplayAdapter/utils.js +93 -24
  333. package/lib/components/ticketBooking/components/addServiceVariant/addService.js +0 -1
  334. package/lib/components/ticketBooking/components/menuBar/index.js +42 -6
  335. package/lib/components/ticketBooking/components/ticketBooking/index.js +2 -2
  336. package/lib/components/ticketBooking/components/timeBar/index.js +105 -4
  337. package/lib/components/ticketBooking/components/timeBar/index.less +59 -0
  338. package/lib/components/ticketBooking/hooks/pisellos/useProducts.js +17 -13
  339. package/lib/components/ticketBooking/locales.d.ts +9 -0
  340. package/lib/components/ticketBooking/locales.js +12 -3
  341. package/lib/components/ticketBooking/utils/index.d.ts +3 -0
  342. package/lib/components/ticketBooking/utils/index.js +20 -6
  343. package/lib/components/wallet/Detail/index.js +31 -3
  344. package/lib/components/wallet/Detail/index.less +11 -0
  345. package/lib/components/wallet/Detail/locales.d.ts +6 -0
  346. package/lib/components/wallet/Detail/locales.js +14 -2
  347. package/lib/components/wallet/Voucher/index.js +8 -8
  348. package/lib/components/wallet/components/WalletCard.js +4 -0
  349. package/lib/components/wallet/index.js +2 -2
  350. package/lib/components/wallet/serve.d.ts +7 -0
  351. package/lib/components/wallet/utils.d.ts +48 -0
  352. package/lib/components/wallet/utils.js +287 -0
  353. package/lib/index.d.ts +5 -0
  354. package/lib/index.js +15 -0
  355. package/lib/plus/clientCard/locales.js +3 -3
  356. package/lib/plus/clinetSearch/index.js +17 -8
  357. package/lib/plus/clinetSearch/locales.d.ts +3 -0
  358. package/lib/plus/clinetSearch/locales.js +7 -4
  359. package/lib/plus/clinetSearch/types.d.ts +12 -0
  360. package/lib/plus/productSelect/CategoryTabs/index.d.ts +1 -0
  361. package/lib/plus/productSelect/CategoryTabs/index.js +2 -1
  362. package/lib/plus/walletPassGallery/components/footerButton/index.js +2 -2
  363. package/lib/plus/walletPassGallery/components/footerButton/index.less +14 -59
  364. package/lib/plus/walletPassGallery/components/passDetail/index.d.ts +1 -0
  365. package/lib/plus/walletPassGallery/components/passDetail/index.js +54 -15
  366. package/lib/plus/walletPassGallery/components/passDetail/index.less +4 -0
  367. package/lib/plus/walletPassGallery/components/recharge/index.js +7 -1
  368. package/lib/plus/walletPassGallery/index.js +7 -3
  369. package/lib/plus/walletPassGallery/serve.d.ts +3 -0
  370. package/lib/plus/walletPassGallery/serve.js +3 -2
  371. package/lib/pro/Login2.0/index.less +15 -8
  372. package/lib/pro/Selector/BatchSelectorDemo.d.ts +3 -0
  373. package/lib/pro/Selector/BatchSelectorDemo.js +376 -0
  374. package/lib/pro/Selector/Selector.d.ts +5 -0
  375. package/lib/pro/Selector/Selector.js +264 -0
  376. package/lib/pro/Selector/SelectorGroup.d.ts +11 -0
  377. package/lib/pro/Selector/SelectorGroup.js +463 -0
  378. package/lib/pro/Selector/components/Card/index.d.ts +27 -0
  379. package/lib/pro/Selector/components/Card/index.js +114 -0
  380. package/lib/pro/Selector/components/Card/index.less +132 -0
  381. package/lib/pro/Selector/components/IntersectionObserver.d.ts +105 -0
  382. package/lib/pro/Selector/components/IntersectionObserver.js +281 -0
  383. package/lib/pro/Selector/components/NumericStepper/index.d.ts +41 -0
  384. package/lib/pro/Selector/components/NumericStepper/index.js +221 -0
  385. package/lib/pro/Selector/components/NumericStepper/index.less +221 -0
  386. package/lib/pro/Selector/components/index.d.ts +2 -0
  387. package/lib/pro/Selector/components/index.js +42 -0
  388. package/lib/pro/Selector/demo.d.ts +3 -0
  389. package/lib/pro/Selector/demo.js +102 -0
  390. package/lib/pro/Selector/hooks/useSelectionController.d.ts +42 -0
  391. package/lib/pro/Selector/hooks/useSelectionController.js +338 -0
  392. package/lib/pro/Selector/index.d.ts +8 -0
  393. package/lib/pro/Selector/index.js +39 -0
  394. package/lib/pro/Selector/locales.d.ts +42 -0
  395. package/lib/pro/Selector/locales.js +80 -0
  396. package/lib/pro/Selector/selector.less +3 -0
  397. package/lib/pro/Selector/selectorGroup.less +8 -0
  398. package/lib/pro/Selector/types.d.ts +114 -0
  399. package/lib/pro/Selector/types.js +17 -0
  400. package/lib/pro/Selector/utils/index.d.ts +49 -0
  401. package/lib/pro/Selector/utils/index.js +221 -0
  402. package/lib/pro/comprehensiveSearch/components/searchSection/locales.js +3 -3
  403. package/lib/pro/comprehensiveSearch/locales.js +1 -1
  404. package/lib/pro/priceKeyboard/components/cashKeyboard/CashKeyboardIntact.js +42 -43
  405. package/lib/pro/priceKeyboard/components/cashKeyboard/index.d.ts +1 -0
  406. package/lib/pro/priceKeyboard/components/cashKeyboard/index.js +3 -2
  407. package/lib/pro/priceKeyboard/components/cashKeyboard/types.d.ts +1 -0
  408. package/lib/pro/priceKeyboard/components/discountKeyboard/index.js +8 -1
  409. package/lib/pro/priceKeyboard/components/discountKeyboard/index.less +14 -0
  410. package/lib/pro/priceKeyboard/components/shortcuts/index.d.ts +1 -0
  411. package/lib/pro/priceKeyboard/components/shortcuts/index.js +3 -2
  412. package/lib/pro/priceKeyboard/components/shortcuts/index.less +4 -0
  413. package/lowcode/payment-modal/meta.ts +135 -0
  414. package/lowcode/selector/meta.ts +352 -0
  415. package/lowcode/selector.group/meta.ts +200 -0
  416. package/lowcode/settings-registry/meta.ts +29 -0
  417. package/lowcode/wallet-pass-detail/meta.ts +89 -0
  418. package/package.json +4 -4
  419. package/es/components/checkout/PaymentPlugin.d.ts +0 -3
  420. package/lib/components/checkout/PaymentPlugin.d.ts +0 -3
  421. package/lib/components/checkout/PaymentPlugin.js +0 -181
@@ -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; }
@@ -34,7 +42,7 @@ export var getRelationDetailsTotal = function getRelationDetailsTotal(relation_d
34
42
  * @param state
35
43
  * @returns
36
44
  */
37
- var getProductExpectAmount = function getProductExpectAmount(state, isEdit) {
45
+ var getProductExpectAmount = function getProductExpectAmount(state, isEdit, isOriginTotal) {
38
46
  var price = new Decimal(0);
39
47
  var duration = new Decimal(0);
40
48
  // 是否是跨日预约
@@ -54,7 +62,8 @@ var getProductExpectAmount = function getProductExpectAmount(state, isEdit) {
54
62
  if (isDay || isNormalProductByDurationSchedule(item)) {
55
63
  var quantity = new Decimal(item._extend.quantity || 1);
56
64
  var itemTotal = new Decimal(item._extend.total || 0);
57
- price = price.add(itemTotal.mul(quantity));
65
+ var itemOriginTotal = new Decimal(item._extend.origin_total || 0);
66
+ price = price.add((isOriginTotal ? itemOriginTotal : itemTotal).mul(quantity));
58
67
 
59
68
  // 普通商品不能加到时长上
60
69
  var _duration = isDayBookingProduct(item, state) ? new Decimal(item._extend.duration || 0) : new Decimal(0);
@@ -62,7 +71,8 @@ var getProductExpectAmount = function getProductExpectAmount(state, isEdit) {
62
71
  } else {
63
72
  var _quantity = new Decimal(item._extend.quantity || 1);
64
73
  var _itemTotal = new Decimal(item._extend.total || 0);
65
- price = price.add(_itemTotal.mul(_quantity));
74
+ var _itemOriginTotal = new Decimal(item._extend.origin_total || 0);
75
+ price = price.add((isOriginTotal ? _itemOriginTotal : _itemTotal).mul(_quantity));
66
76
 
67
77
  // 附加商品
68
78
  var relationTotal = new Decimal(getRelationDetailsTotal(item._extend.relation_details || []));
@@ -87,7 +97,8 @@ var getProductExpectAmount = function getProductExpectAmount(state, isEdit) {
87
97
  var _item = _step3.value;
88
98
  var _quantity2 = new Decimal(_item._extend.quantity || 1);
89
99
  var _itemTotal2 = new Decimal(_item._extend.total || 0);
90
- price = price.add(_itemTotal2.mul(_quantity2));
100
+ var _itemOriginTotal2 = new Decimal(_item._extend.origin_total || 0);
101
+ price = price.add((isOriginTotal ? _itemOriginTotal2 : _itemTotal2).mul(_quantity2));
91
102
  }
92
103
  } catch (err) {
93
104
  _iterator3.e(err);
@@ -164,7 +175,52 @@ var getProductItemTax = function getProductItemTax(item, state, options) {
164
175
  }
165
176
 
166
177
  // 结果 = 单个商品税费 × 数量
167
- return singleItemTax.times(quantity);
178
+ return singleItemTax.times(quantity).toDecimalPlaces(2, Decimal.ROUND_HALF_UP);
179
+ };
180
+
181
+ /**
182
+ * 计算商品附加费 包含子商品的总附加费
183
+ */
184
+ var getProductSurchargeFee = function getProductSurchargeFee(product) {
185
+ var _extend = product._extend;
186
+ if (!_extend) {
187
+ return 0;
188
+ }
189
+ var surcharge_fee = _extend.surcharge_fee,
190
+ relation_details = _extend.relation_details,
191
+ other = _extend.other,
192
+ surcharge_rounding_remainder = _extend.surcharge_rounding_remainder;
193
+ var totalSurchargeFee = new Decimal(0);
194
+ if (surcharge_fee) {
195
+ totalSurchargeFee = totalSurchargeFee.plus(surcharge_fee);
196
+ }
197
+ if (surcharge_rounding_remainder) {
198
+ totalSurchargeFee = totalSurchargeFee.plus(surcharge_rounding_remainder);
199
+ }
200
+ if (relation_details) {
201
+ var _iterator4 = _createForOfIteratorHelper(relation_details),
202
+ _step4;
203
+ try {
204
+ for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
205
+ var item = _step4.value;
206
+ totalSurchargeFee = totalSurchargeFee.plus(getProductSurchargeFee(item));
207
+ }
208
+ } catch (err) {
209
+ _iterator4.e(err);
210
+ } finally {
211
+ _iterator4.f();
212
+ }
213
+ }
214
+ if (other !== null && other !== void 0 && other.bundle) {
215
+ totalSurchargeFee = totalSurchargeFee.plus(other.bundle.reduce(function (total, item) {
216
+ var surchargeFee = new Decimal(item.surcharge_fee || 0).times(item.num || item.quantity || 1);
217
+ if (item.surcharge_rounding_remainder) {
218
+ surchargeFee = surchargeFee.plus(item.surcharge_rounding_remainder);
219
+ }
220
+ return total.plus(surchargeFee);
221
+ }, new Decimal(0)));
222
+ }
223
+ return totalSurchargeFee.toNumber();
168
224
  };
169
225
 
170
226
  /**
@@ -183,17 +239,21 @@ var processItemsTax = function processItemsTax(items, state, options) {
183
239
  productExpectAmount = computed.productExpectAmount;
184
240
  var originTax = new Decimal(0);
185
241
  var tax = new Decimal(0);
186
- var _iterator4 = _createForOfIteratorHelper(items),
187
- _step4;
242
+ var _iterator5 = _createForOfIteratorHelper(items),
243
+ _step5;
188
244
  try {
189
- for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
190
- var item = _step4.value;
245
+ for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
246
+ var _item$_extend, _item$_extend2, _item$_extend$other;
247
+ var item = _step5.value;
191
248
  var quantity = new Decimal(item._extend.quantity || 1);
192
249
  var unitPrice = new Decimal(item._extend.total || 0);
250
+ var mainProductPrice = new Decimal(getMainProductTotal(item) || 0);
251
+
252
+ // const surchargeFee = getProductSurchargeFee(item);
193
253
 
194
254
  // 计算原始税费(折扣前)- 单个商品
195
255
  var originalTaxPerItem = getProductItemTax(_objectSpread(_objectSpread({}, item), {}, {
196
- total: unitPrice.toNumber(),
256
+ total: mainProductPrice.add(((_item$_extend = item._extend) === null || _item$_extend === void 0 ? void 0 : _item$_extend.surcharge_fee) || 0).toNumber(),
197
257
  quantity: 1
198
258
  }), state, {
199
259
  tax_rate: tax_rate,
@@ -206,12 +266,31 @@ var processItemsTax = function processItemsTax(items, state, options) {
206
266
  itemDiscount = unitPrice.dividedBy(productExpectAmount).times(shopDiscount);
207
267
  }
208
268
 
209
- // 商品折后单价 = 商品单价 - 商品折后单价
210
- var itemDiscountedUnitPrice = unitPrice.minus(itemDiscount);
269
+ // // 商品折后单价 = 商品单价 - 商品折后单价
270
+ // const itemDiscountedUnitPrice = unitPrice.minus(itemDiscount).add(surchargeFee);
271
+
272
+ // // 计算折后税费(折扣后)- 单个商品 加子商品的税费
273
+ // const discountedTaxPerItem = getProductItemTax(
274
+ // {
275
+ // ...item,
276
+ // total: itemDiscountedUnitPrice.toNumber(),
277
+ // price: item._extend.total,
278
+ // quantity: 1,
279
+ // },
280
+ // state,
281
+ // { tax_rate, is_price_include_tax }
282
+ // );
211
283
 
212
- // 计算折后税费(折扣后)- 单个商品
213
- var discountedTaxPerItem = getProductItemTax(_objectSpread(_objectSpread({}, item), {}, {
214
- total: itemDiscountedUnitPrice.toNumber(),
284
+ // 按比例计算主商品应分摊的折扣
285
+ var mainItemDiscount = new Decimal(0);
286
+ if (unitPrice.greaterThan(0)) {
287
+ mainItemDiscount = mainProductPrice.dividedBy(productExpectAmount).times(shopDiscount);
288
+ }
289
+ var mainItemDiscountedUnitPrice = mainProductPrice.minus(mainItemDiscount).add(((_item$_extend2 = item._extend) === null || _item$_extend2 === void 0 ? void 0 : _item$_extend2.surcharge_fee) || 0);
290
+
291
+ // 计算折后税费(折扣后)- 主商品的税费
292
+ var maxDiscountedTaxPerItem = getProductItemTax(_objectSpread(_objectSpread({}, item), {}, {
293
+ total: mainItemDiscountedUnitPrice.toNumber(),
215
294
  price: item._extend.total,
216
295
  quantity: 1
217
296
  }), state, {
@@ -219,18 +298,20 @@ var processItemsTax = function processItemsTax(items, state, options) {
219
298
  is_price_include_tax: is_price_include_tax
220
299
  });
221
300
 
222
- // 保存到商品扩展信息中
223
- item._extend.original_tax_fee = originalTaxPerItem.toNumber();
224
- item._extend.tax_fee = discountedTaxPerItem.toNumber();
301
+ // item._extend.payment_price = itemDiscountedUnitPrice;
302
+ // 保存到商品扩展信息中(保留两位小数)
303
+ // item._extend.original_tax_fee = originalTaxPerItem.toNumber();
304
+ // item._extend.tax_fee = discountedTaxPerItem.toNumber();
305
+ item._extend.main_product_attached_bundle_tax_fee = maxDiscountedTaxPerItem.toNumber();
225
306
 
226
307
  // 注意:加时商品独立计算,不考虑主商品数量
227
308
  var addTimeTotalTax = new Decimal(0);
228
309
  if (Array.isArray(item._extend.relation_details)) {
229
- var _iterator5 = _createForOfIteratorHelper(item._extend.relation_details),
230
- _step5;
310
+ var _iterator6 = _createForOfIteratorHelper(item._extend.relation_details),
311
+ _step6;
231
312
  try {
232
- for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
233
- var atItem = _step5.value;
313
+ for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
314
+ var atItem = _step6.value;
234
315
  // 计算单件加时商品折扣后价格
235
316
  var _originTotal = new Decimal(atItem.selling_price || atItem.price || 0);
236
317
  var _discountedTotal = _originTotal;
@@ -238,8 +319,7 @@ var processItemsTax = function processItemsTax(items, state, options) {
238
319
  _discountedTotal = _originTotal.minus(_originTotal.dividedBy(productExpectAmount).times(shopDiscount));
239
320
  }
240
321
  var addTimeTaxPerItem = getProductItemTax(_objectSpread(_objectSpread({}, atItem), {}, {
241
- total: _discountedTotal,
242
- // 可能包含原有数据,或前端临时数据
322
+ total: _discountedTotal.add((atItem === null || atItem === void 0 ? void 0 : atItem.surcharge_fee) || 0).toNumber(),
243
323
  quantity: atItem.product_quantity || atItem.num || 1
244
324
  }), state, {
245
325
  tax_rate: tax_rate,
@@ -248,20 +328,84 @@ var processItemsTax = function processItemsTax(items, state, options) {
248
328
  addTimeTotalTax = addTimeTotalTax.plus(addTimeTaxPerItem);
249
329
  }
250
330
  } catch (err) {
251
- _iterator5.e(err);
331
+ _iterator6.e(err);
252
332
  } finally {
253
- _iterator5.f();
333
+ _iterator6.f();
254
334
  }
255
335
  }
256
336
 
337
+ // 处理 bundle 子商品(仅原价子商品)
338
+ var bundleTotalOriginTax = new Decimal(0);
339
+ var bundleTotalTax = new Decimal(0);
340
+ if (Array.isArray((_item$_extend$other = item._extend.other) === null || _item$_extend$other === void 0 ? void 0 : _item$_extend$other.bundle)) {
341
+ var _iterator7 = _createForOfIteratorHelper(item._extend.other.bundle),
342
+ _step7;
343
+ try {
344
+ for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
345
+ var bundleItem = _step7.value;
346
+ // 只处理原价的子商品
347
+ if (getBundleItemIsOriginalPrice(bundleItem)) {
348
+ var _ref2, _bundleItem$bundle_se;
349
+ var bundleQuantity = new Decimal(bundleItem.quantity || 1);
350
+ 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);
351
+
352
+ // 计算原始税费(折扣前)- 单个商品
353
+ var bundleOriginalTaxPerItem = getProductItemTax(_objectSpread(_objectSpread({}, bundleItem), {}, {
354
+ total: bundleUnitPrice.add((bundleItem === null || bundleItem === void 0 ? void 0 : bundleItem.surcharge_fee) || 0).toNumber(),
355
+ quantity: 1
356
+ }), state, {
357
+ tax_rate: tax_rate,
358
+ is_price_include_tax: is_price_include_tax
359
+ });
360
+
361
+ // 计算平摊到该bundle商品的折扣
362
+ var bundleItemDiscount = new Decimal(0);
363
+ if (productExpectAmount > 0) {
364
+ bundleItemDiscount = bundleUnitPrice.dividedBy(productExpectAmount).times(shopDiscount);
365
+ }
366
+
367
+ // bundle商品折后单价
368
+ var bundleDiscountedUnitPrice = bundleUnitPrice.minus(bundleItemDiscount).add((bundleItem === null || bundleItem === void 0 ? void 0 : bundleItem.surcharge_fee) || 0);
369
+
370
+ // 计算折后税费(折扣后)- 单个商品
371
+ var bundleDiscountedTaxPerItem = getProductItemTax(_objectSpread(_objectSpread({}, bundleItem), {}, {
372
+ total: bundleDiscountedUnitPrice.toNumber(),
373
+ quantity: 1
374
+ }), state, {
375
+ tax_rate: tax_rate,
376
+ is_price_include_tax: is_price_include_tax
377
+ });
378
+
379
+ // bundle商品折后单价
380
+ // bundleItem.bundle_payment_price = bundleDiscountedUnitPrice;
381
+ // 保存到bundle商品上(单个商品的税费,保留两位小数)
382
+ bundleItem.original_tax_fee = new Decimal(bundleOriginalTaxPerItem).toNumber();
383
+ bundleItem.tax_fee = new Decimal(bundleDiscountedTaxPerItem).toNumber();
384
+
385
+ // 累加bundle税费(需要乘以bundle数量和主商品数量)
386
+ bundleTotalOriginTax = bundleTotalOriginTax.plus(bundleOriginalTaxPerItem.times(bundleQuantity));
387
+ bundleTotalTax = bundleTotalTax.plus(bundleDiscountedTaxPerItem.times(bundleQuantity));
388
+ }
389
+ }
390
+ } catch (err) {
391
+ _iterator7.e(err);
392
+ } finally {
393
+ _iterator7.f();
394
+ }
395
+ }
396
+ var original_tax_fee = originalTaxPerItem.add(bundleTotalOriginTax);
397
+ var tax_fee = maxDiscountedTaxPerItem.add(bundleTotalTax);
398
+ item._extend.original_tax_fee = original_tax_fee.toNumber();
399
+ item._extend.tax_fee = tax_fee.toNumber();
400
+
257
401
  // 累加到总税费(乘以数量)
258
- originTax = originTax.plus(originalTaxPerItem.times(quantity)).plus(addTimeTotalTax);
259
- tax = tax.plus(discountedTaxPerItem.times(quantity)).plus(addTimeTotalTax);
402
+ originTax = originTax.plus(original_tax_fee.times(quantity)).plus(addTimeTotalTax);
403
+ tax = tax.plus(tax_fee.times(quantity)).plus(addTimeTotalTax);
260
404
  }
261
405
  } catch (err) {
262
- _iterator4.e(err);
406
+ _iterator5.e(err);
263
407
  } finally {
264
- _iterator4.f();
408
+ _iterator5.f();
265
409
  }
266
410
  return {
267
411
  originTax: originTax,
@@ -361,10 +505,9 @@ var isProductMatchSurchargeCondition = function isProductMatchSurchargeCondition
361
505
  var surchargeConfig = options.surchargeConfig,
362
506
  _options$scheduleById = options.scheduleById,
363
507
  scheduleById = _options$scheduleById === void 0 ? {} : _options$scheduleById;
364
- var _item$_extend = item._extend,
365
- startDate = _item$_extend.startDate,
366
- other = _item$_extend.other,
367
- isCustomItem = _item$_extend.isCustomItem;
508
+ var startDate = item.startDate,
509
+ product_id = item.product_id,
510
+ isCustomItem = item.isCustomItem;
368
511
  var _surchargeConfig$open = surchargeConfig.open_product,
369
512
  open_product = _surchargeConfig$open === void 0 ? 0 : _surchargeConfig$open,
370
513
  _surchargeConfig$is_a = surchargeConfig.is_all,
@@ -395,7 +538,6 @@ var isProductMatchSurchargeCondition = function isProductMatchSurchargeCondition
395
538
  isProductMatch = false;
396
539
  } else {
397
540
  // 普通商品:检查是否在指定商品列表中
398
- var product_id = other === null || other === void 0 ? void 0 : other.product_id;
399
541
  isProductMatch = available_product_ids.includes(product_id);
400
542
  }
401
543
  }
@@ -434,6 +576,148 @@ var isProductMatchSurchargeCondition = function isProductMatchSurchargeCondition
434
576
  return isProductMatch && isScheduleMatch;
435
577
  };
436
578
 
579
+ // bundle商品是否是原价
580
+ var getBundleItemIsOriginalPrice = function getBundleItemIsOriginalPrice(item) {
581
+ 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';
582
+ };
583
+
584
+ // bundle商品是否是加价
585
+ var getBundleItemIsMarkupPrice = function getBundleItemIsMarkupPrice(item) {
586
+ 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));
587
+ };
588
+
589
+ // bundle商品是否是减价
590
+ var getBundleItemIsDiscountPrice = function getBundleItemIsDiscountPrice(item) {
591
+ 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));
592
+ };
593
+
594
+ // bundle商品是否是加价或减价
595
+ var getBundleItemIsMarkupOrDiscountPrice = function getBundleItemIsMarkupOrDiscountPrice(item) {
596
+ return getBundleItemIsMarkupPrice(item) || getBundleItemIsDiscountPrice(item);
597
+ };
598
+ var getDiscountAmount = function getDiscountAmount(discounts) {
599
+ return (discounts || []).reduce(function (total, discount) {
600
+ return total.add(new Decimal(discount.amount || 0));
601
+ }, new Decimal(0)).toNumber();
602
+ };
603
+
604
+ /**
605
+ * 获取主商品加价减价后的总价 (主商品价格 + 子商品加价减价)
606
+ */
607
+ var getMainProductTotal = function getMainProductTotal(item) {
608
+ var _ref3, _ref4, _item$_extend$main_pr, _item$_extend3, _item$metadata, _item$_extend$other2, _item$_extend$other3, _item$_extend$other5;
609
+ 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);
610
+
611
+ // 单规格
612
+ 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)) {
613
+ var _item$_extend$other4;
614
+ 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) {
615
+ return t.add(new Decimal(option.price || 0).mul(option.num || 1));
616
+ }, new Decimal(0)));
617
+ }
618
+ var _iterator8 = _createForOfIteratorHelper(((_item$_extend$other5 = item._extend.other) === null || _item$_extend$other5 === void 0 ? void 0 : _item$_extend$other5.bundle) || []),
619
+ _step8;
620
+ try {
621
+ for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
622
+ var bundleItem = _step8.value;
623
+ if (getBundleItemIsMarkupOrDiscountPrice(bundleItem)) {
624
+ var _ref5, _bundleItem$bundle_se2;
625
+ // 子商品折扣金额
626
+ var discountAmount = getDiscountAmount(bundleItem.discount_list);
627
+ // 子商品价格
628
+ 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);
629
+ // todo: 套餐子商品后不需要处理 子商品价格 - 子商品折扣金额
630
+ var bundleItemTotal = bundleItemPrice.minus(discountAmount);
631
+ total = total.add(bundleItemTotal);
632
+ }
633
+ }
634
+ } catch (err) {
635
+ _iterator8.e(err);
636
+ } finally {
637
+ _iterator8.f();
638
+ }
639
+ return total.toNumber();
640
+ };
641
+
642
+ /**
643
+ * 清除附加费
644
+ */
645
+ var clearSurchargeFee = function clearSurchargeFee(state) {
646
+ var service = state.service,
647
+ addons = state.addons;
648
+ if (Array.isArray(service === null || service === void 0 ? void 0 : service.value)) {
649
+ var _iterator9 = _createForOfIteratorHelper(service.value),
650
+ _step9;
651
+ try {
652
+ for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
653
+ var _item$_extend$other6;
654
+ var item = _step9.value;
655
+ item._extend.surcharge_fee = 0;
656
+ item._extend.relation_surcharge_ids = [];
657
+ var _iterator10 = _createForOfIteratorHelper(((_item$_extend$other6 = item._extend.other) === null || _item$_extend$other6 === void 0 ? void 0 : _item$_extend$other6.bundle) || []),
658
+ _step10;
659
+ try {
660
+ for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
661
+ var bundleItem = _step10.value;
662
+ bundleItem.surcharge_fee = 0;
663
+ bundleItem.relation_surcharge_ids = [];
664
+ }
665
+ } catch (err) {
666
+ _iterator10.e(err);
667
+ } finally {
668
+ _iterator10.f();
669
+ }
670
+ var _iterator11 = _createForOfIteratorHelper(item._extend.relation_details || []),
671
+ _step11;
672
+ try {
673
+ for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) {
674
+ var relationDetail = _step11.value;
675
+ relationDetail.surcharge_fee = 0;
676
+ relationDetail.relation_surcharge_ids = [];
677
+ }
678
+ } catch (err) {
679
+ _iterator11.e(err);
680
+ } finally {
681
+ _iterator11.f();
682
+ }
683
+ }
684
+ } catch (err) {
685
+ _iterator9.e(err);
686
+ } finally {
687
+ _iterator9.f();
688
+ }
689
+ }
690
+ if (Array.isArray(addons === null || addons === void 0 ? void 0 : addons.value)) {
691
+ var _iterator12 = _createForOfIteratorHelper(addons.value),
692
+ _step12;
693
+ try {
694
+ for (_iterator12.s(); !(_step12 = _iterator12.n()).done;) {
695
+ var _item2$_extend$other;
696
+ var _item2 = _step12.value;
697
+ _item2._extend.surcharge_fee = 0;
698
+ _item2._extend.relation_surcharge_ids = [];
699
+ var _iterator13 = _createForOfIteratorHelper(((_item2$_extend$other = _item2._extend.other) === null || _item2$_extend$other === void 0 ? void 0 : _item2$_extend$other.bundle) || []),
700
+ _step13;
701
+ try {
702
+ for (_iterator13.s(); !(_step13 = _iterator13.n()).done;) {
703
+ var _bundleItem = _step13.value;
704
+ _bundleItem.surcharge_fee = 0;
705
+ _bundleItem.relation_surcharge_ids = [];
706
+ }
707
+ } catch (err) {
708
+ _iterator13.e(err);
709
+ } finally {
710
+ _iterator13.f();
711
+ }
712
+ }
713
+ } catch (err) {
714
+ _iterator12.e(err);
715
+ } finally {
716
+ _iterator12.f();
717
+ }
718
+ }
719
+ };
720
+
437
721
  /**
438
722
  * 订单附加费各项信息
439
723
  * @param state
@@ -470,6 +754,8 @@ var getSurcharge = function getSurcharge(state, options) {
470
754
  }
471
755
  return [];
472
756
  }
757
+ // 清除附加费
758
+ clearSurchargeFee(state);
473
759
 
474
760
  // 新增状态
475
761
  var service = state.service,
@@ -489,93 +775,252 @@ var getSurcharge = function getSurcharge(state, options) {
489
775
  fixed = _surchargeConfig$fixe === void 0 ? '0' : _surchargeConfig$fixe,
490
776
  id = surchargeConfig.id,
491
777
  type = surchargeConfig.type,
492
- description = surchargeConfig.description;
778
+ description = surchargeConfig.description,
779
+ open_product = surchargeConfig.open_product;
493
780
 
494
781
  // 收集所有符合条件的商品
495
782
  var matchedItems = [];
496
783
 
497
784
  // 检查service中符合条件的商品
498
785
  if (Array.isArray(service === null || service === void 0 ? void 0 : service.value)) {
499
- var _iterator6 = _createForOfIteratorHelper(service.value),
500
- _step6;
786
+ var _iterator14 = _createForOfIteratorHelper(service.value),
787
+ _step14;
501
788
  try {
502
- for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
503
- var item = _step6.value;
504
- if (isProductMatchSurchargeCondition(item, {
789
+ for (_iterator14.s(); !(_step14 = _iterator14.n()).done;) {
790
+ var _item$_extend$other7;
791
+ var item = _step14.value;
792
+ // 主商品符合附加费条件
793
+ if (isProductMatchSurchargeCondition({
794
+ isCustomItem: item.isCustomItem,
795
+ startDate: item._extend.startDate,
796
+ product_id: item.product_id
797
+ }, {
505
798
  surchargeConfig: surchargeConfig,
506
799
  scheduleById: scheduleById || {},
507
800
  ScheduleModule: ScheduleModule
508
801
  })) {
802
+ // 主商品加价减价后的总价
803
+ var total = getMainProductTotal(item);
804
+ var mainQuantity = item._extend.quantity || 1;
509
805
  matchedItems.push({
510
- total: Number(item._extend.total),
511
- addTimeTotal: getRelationDetailsTotal(item._extend.relation_details || []),
512
- quantity: item._extend.quantity || 1
806
+ total: total,
807
+ // addTimeTotal: getRelationDetailsTotal(
808
+ // item._extend.relation_details || []
809
+ // ),
810
+ isMain: true,
811
+ quantity: mainQuantity,
812
+ item: item,
813
+ mainQuantity: mainQuantity // 主商品的mainQuantity等于自己的quantity
513
814
  });
514
815
  }
816
+ // 遍历子商品 原价商品符合附加费条件
817
+ var _iterator15 = _createForOfIteratorHelper(((_item$_extend$other7 = item._extend.other) === null || _item$_extend$other7 === void 0 ? void 0 : _item$_extend$other7.bundle) || []),
818
+ _step15;
819
+ try {
820
+ for (_iterator15.s(); !(_step15 = _iterator15.n()).done;) {
821
+ var bundleItem = _step15.value;
822
+ // bundle商品是原价且符合附加费条件
823
+ if (getBundleItemIsOriginalPrice(bundleItem) && isProductMatchSurchargeCondition({
824
+ isCustomItem: false,
825
+ startDate: item._extend.startDate,
826
+ product_id: bundleItem._bundle_product_id
827
+ }, {
828
+ surchargeConfig: surchargeConfig,
829
+ scheduleById: scheduleById || {},
830
+ ScheduleModule: ScheduleModule
831
+ })) {
832
+ var _ref6, _bundleItem$bundle_se3;
833
+ var _mainQuantity = item._extend.quantity || 1;
834
+ matchedItems.push({
835
+ isMain: false,
836
+ 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),
837
+ quantity: bundleItem.num || bundleItem.quantity || 1,
838
+ item: bundleItem,
839
+ mainQuantity: _mainQuantity // 子商品的mainQuantity是所属主商品的quantity
840
+ });
841
+ }
842
+ }
843
+
844
+ // 加时商品符合附加费条件
845
+ } catch (err) {
846
+ _iterator15.e(err);
847
+ } finally {
848
+ _iterator15.f();
849
+ }
850
+ var _iterator16 = _createForOfIteratorHelper(item._extend.relation_details || []),
851
+ _step16;
852
+ try {
853
+ for (_iterator16.s(); !(_step16 = _iterator16.n()).done;) {
854
+ var relationDetail = _step16.value;
855
+ if (isProductMatchSurchargeCondition({
856
+ isCustomItem: false,
857
+ startDate: item._extend.startDate,
858
+ product_id: relationDetail.product_id
859
+ }, {
860
+ surchargeConfig: surchargeConfig,
861
+ scheduleById: scheduleById || {},
862
+ ScheduleModule: ScheduleModule
863
+ })) {
864
+ var _relationDetail$metad;
865
+ matchedItems.push({
866
+ isMain: false,
867
+ 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)),
868
+ quantity: relationDetail.num || relationDetail.quantity || 1,
869
+ item: relationDetail,
870
+ mainQuantity: 1 // 加时商品不受主商品数量影响
871
+ });
872
+ }
873
+ }
874
+ } catch (err) {
875
+ _iterator16.e(err);
876
+ } finally {
877
+ _iterator16.f();
878
+ }
515
879
  }
516
880
  } catch (err) {
517
- _iterator6.e(err);
881
+ _iterator14.e(err);
518
882
  } finally {
519
- _iterator6.f();
883
+ _iterator14.f();
520
884
  }
521
885
  }
522
886
 
523
887
  // 检查addons中符合条件的商品
524
888
  if (Array.isArray(addons === null || addons === void 0 ? void 0 : addons.value)) {
525
- var _iterator7 = _createForOfIteratorHelper(addons.value),
526
- _step7;
889
+ var _iterator17 = _createForOfIteratorHelper(addons.value),
890
+ _step17;
527
891
  try {
528
- for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
529
- var _item2 = _step7.value;
530
- if (isProductMatchSurchargeCondition(_item2, {
892
+ for (_iterator17.s(); !(_step17 = _iterator17.n()).done;) {
893
+ var _item3 = _step17.value;
894
+ if (isProductMatchSurchargeCondition(_item3, {
531
895
  surchargeConfig: surchargeConfig,
532
896
  scheduleById: scheduleById || {},
533
897
  ScheduleModule: ScheduleModule
534
898
  })) {
535
899
  matchedItems.push({
536
- total: Number(_item2._extend.total),
537
- quantity: _item2._extend.quantity || 1
900
+ isMain: true,
901
+ total: Number(_item3._extend.total),
902
+ quantity: _item3._extend.quantity || 1,
903
+ item: _item3,
904
+ mainQuantity: 1 // addons独立商品,mainQuantity为1
538
905
  });
539
906
  }
540
907
  }
541
908
  } catch (err) {
542
- _iterator7.e(err);
909
+ _iterator17.e(err);
543
910
  } finally {
544
- _iterator7.f();
911
+ _iterator17.f();
545
912
  }
546
913
  }
547
914
  var finalAmount = 0;
915
+
916
+ // 计算商品总数:主商品和addons按quantity计算,子商品(bundle item)需要乘以主商品数量
917
+ var productCount = matchedItems.reduce(function (total, item) {
918
+ if (item.isMain) {
919
+ // 主商品和addons商品
920
+ return total + (item.quantity || 1);
921
+ } else {
922
+ // 子商品(bundle item)和加时商品
923
+ // 加时商品的 mainQuantity = 1,所以不受影响
924
+ // bundle item 的 mainQuantity = 主商品数量,需要乘以实际数量
925
+ return total + (item.quantity || 1) * (item.mainQuantity || 1);
926
+ }
927
+ }, 0);
928
+
929
+ // 追加进入的固定附加费总值
930
+ var fixedTotal = new Decimal(0);
931
+ // 追加到商品的附加费总值 用于追加抹平字段
932
+ var productTotalSurcharge = new Decimal(0);
548
933
  if (matchedItems.length > 0) {
549
934
  // 基于每个商品计算附加费:max(0, 商品价格) * rate + fixed
550
935
  var configTotal = new Decimal(0);
551
936
 
937
+ // 计算固定附加费 - 只加一次
938
+ if (fixed && new Decimal(fixed).gt(0)) {
939
+ configTotal = configTotal.plus(fixed);
940
+ }
941
+
552
942
  // 计算百分比附加费 - 对每个商品单独计算
553
- if (percentage && new Decimal(percentage).gt(0)) {
943
+ if (percentage && new Decimal(percentage).gt(0) || fixed) {
554
944
  var percentageRate = new Decimal(percentage);
555
- var _iterator8 = _createForOfIteratorHelper(matchedItems),
556
- _step8;
945
+ var _iterator18 = _createForOfIteratorHelper(matchedItems.entries()),
946
+ _step18;
557
947
  try {
558
- for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
559
- var _item3 = _step8.value;
948
+ for (_iterator18.s(); !(_step18 = _iterator18.n()).done;) {
949
+ var _step18$value = _slicedToArray(_step18.value, 2),
950
+ index = _step18$value[0],
951
+ _item4 = _step18$value[1];
952
+ var isLast = index === matchedItems.length - 1;
560
953
  // 对每个商品:max(0, 价格) * 数量 * 费率
561
- var itemPrice = new Decimal(Math.max(0, _item3.total || 0));
562
- var itemQuantity = new Decimal(_item3.quantity || 1);
563
- var addTimeTotal = new Decimal(_item3.addTimeTotal || 0);
564
- var itemSurcharge = itemPrice.times(itemQuantity).plus(addTimeTotal).times(percentageRate);
565
- configTotal = configTotal.plus(itemSurcharge);
954
+ var itemPrice = new Decimal(Math.max(0, _item4.total || 0));
955
+ var itemQuantity = new Decimal(_item4.isMain ? _item4.quantity || 1 : _item4.quantity * _item4.mainQuantity || 1);
956
+ var addTimeTotal = new Decimal(_item4.addTimeTotal || 0);
957
+ // 单个商品总附加费
958
+ var itemTotalSurcharge = itemPrice.times(itemQuantity).plus(addTimeTotal).times(percentageRate);
959
+ configTotal = configTotal.plus(itemTotalSurcharge);
960
+
961
+ // 单个商品单数量附加费
962
+ var itemSurcharge = itemPrice.times(percentageRate);
963
+
964
+ // 固定附加费 = 1 / 商品数量 * 固定附加费(向下取整保留两位小数)
965
+ var fixedSurcharge = new Decimal(1).div(productCount).times(fixed).times(100).floor().div(100).toFixed(2);
966
+ var quantity = _item4.isMain ? _item4.quantity : _item4.quantity * _item4.mainQuantity;
967
+ fixedTotal = fixedTotal.plus(new Decimal(fixedSurcharge).times(quantity).toNumber());
968
+
969
+ // 如果是最后一个商品 判断fixed - fixedTotal 是否有剩余小数 如果有的话,追加抹平字段
970
+ if (isLast && fixedTotal.gt(0)) {
971
+ var remaining = new Decimal(fixed).minus(fixedTotal).toNumber();
972
+ if (remaining > 0) {
973
+ productTotalSurcharge = productTotalSurcharge.plus(remaining);
974
+ if (_item4.isMain) {
975
+ _item4.item._extend.surcharge_rounding_remainder = remaining;
976
+ } else {
977
+ _item4.item.surcharge_rounding_remainder = remaining;
978
+ }
979
+ }
980
+ }
981
+ // 只有当 open_product !== 0 时,才将附加费追加到商品身上
982
+ // open_product === 0 表示商品未开启该附加费,只在订单级别累加
983
+ if (open_product !== 0) {
984
+ if (_item4.isMain) {
985
+ var _item4$item$_extend;
986
+ var originSurchargeFee = new Decimal(_item4.item._extend.surcharge_fee || 0);
987
+ // 保留两位小数
988
+ var surchargeFee = originSurchargeFee.plus(itemSurcharge).plus(fixedSurcharge).toDecimalPlaces(2, Decimal.ROUND_DOWN).toNumber();
989
+ productTotalSurcharge = productTotalSurcharge.plus(new Decimal(surchargeFee).times(itemQuantity).toNumber());
990
+ _item4.item._extend.surcharge_fee = surchargeFee;
991
+ _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]);
992
+ } else {
993
+ var _item4$item;
994
+ var _originSurchargeFee = new Decimal(_item4.item.surcharge_fee || 0);
995
+ // 保留两位小数
996
+ var _surchargeFee = _originSurchargeFee.plus(itemSurcharge).plus(fixedSurcharge).toDecimalPlaces(2, Decimal.ROUND_DOWN).toNumber();
997
+ productTotalSurcharge = productTotalSurcharge.plus(new Decimal(_surchargeFee).times(itemQuantity).toNumber());
998
+ _item4.item.surcharge_fee = _surchargeFee;
999
+ _item4.item.relation_surcharge_ids = [].concat(_toConsumableArray(((_item4$item = _item4.item) === null || _item4$item === void 0 ? void 0 : _item4$item.relation_surcharge_ids) || []), [id]);
1000
+ }
1001
+ }
1002
+ // 最后一个商品 判断configTotal - productTotalSurcharge 是否有剩余小数 如果有的话,追加抹平字段
1003
+ if (isLast && configTotal.minus(productTotalSurcharge).gt(0)) {
1004
+ // 四舍五入configTotal
1005
+ var configTotalRounded = configTotal.toDecimalPlaces(2, Decimal.ROUND_HALF_UP);
1006
+ if (_item4.isMain) {
1007
+ var newRoundingRemainder = new Decimal(_item4.item._extend.surcharge_rounding_remainder || 0);
1008
+ newRoundingRemainder = newRoundingRemainder.plus(configTotalRounded.minus(productTotalSurcharge));
1009
+ _item4.item._extend.surcharge_rounding_remainder = newRoundingRemainder.toNumber();
1010
+ } else {
1011
+ var _newRoundingRemainder = new Decimal(_item4.item.surcharge_rounding_remainder || 0);
1012
+ _newRoundingRemainder = _newRoundingRemainder.plus(configTotalRounded.minus(productTotalSurcharge));
1013
+ _item4.item.surcharge_rounding_remainder = _newRoundingRemainder.toNumber();
1014
+ }
1015
+ }
566
1016
  }
567
1017
  } catch (err) {
568
- _iterator8.e(err);
1018
+ _iterator18.e(err);
569
1019
  } finally {
570
- _iterator8.f();
1020
+ _iterator18.f();
571
1021
  }
572
1022
  }
573
1023
 
574
- // 计算固定附加费 - 只加一次
575
- if (fixed && new Decimal(fixed).gt(0)) {
576
- configTotal = configTotal.plus(fixed);
577
- }
578
-
579
1024
  // 如果该配置有金额,则添加到结果中
580
1025
  finalAmount = configTotal.toDecimalPlaces(2, Decimal.ROUND_HALF_UP).toNumber();
581
1026
  }
@@ -594,7 +1039,10 @@ var getSurcharge = function getSurcharge(state, options) {
594
1039
  type: 'default',
595
1040
  fixed: fixed,
596
1041
  amount: finalAmount,
597
- percentage: percentage
1042
+ percentage: percentage,
1043
+ metadata: {
1044
+ open_product: open_product
1045
+ }
598
1046
  });
599
1047
  }
600
1048
  return surchargeWithAmount;
@@ -665,13 +1113,13 @@ export var getIsPriceIncludeTax = function getIsPriceIncludeTax(state) {
665
1113
  var _state$bookingDetail$, _state$bookingDetail6;
666
1114
  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;
667
1115
  };
668
- var getExpectAmount = function getExpectAmount(_ref2) {
669
- var price = _ref2.price,
670
- tax = _ref2.tax,
671
- surchargeAmount = _ref2.surchargeAmount,
672
- shopDiscount = _ref2.shopDiscount,
673
- state = _ref2.state,
674
- options = _ref2.options;
1116
+ var getExpectAmount = function getExpectAmount(_ref7) {
1117
+ var price = _ref7.price,
1118
+ tax = _ref7.tax,
1119
+ surchargeAmount = _ref7.surchargeAmount,
1120
+ shopDiscount = _ref7.shopDiscount,
1121
+ state = _ref7.state,
1122
+ options = _ref7.options;
675
1123
  var _tax = tax;
676
1124
  // 如果价格含税, 则将税费改为0
677
1125
  if (getIsPriceIncludeTax(state) || options !== null && options !== void 0 && options.is_price_include_tax) {
@@ -693,9 +1141,9 @@ var getRoundingAmount = function getRoundingAmount(state) {
693
1141
  var _state$bookingDetail9;
694
1142
  return Number(state === null || state === void 0 || (_state$bookingDetail9 = state.bookingDetail) === null || _state$bookingDetail9 === void 0 ? void 0 : _state$bookingDetail9.rounding_amount) || 0;
695
1143
  };
696
- var getSumTotalAmount = function getSumTotalAmount(_ref3) {
697
- var expectAmount = _ref3.expectAmount,
698
- roundingAmount = _ref3.roundingAmount;
1144
+ var getSumTotalAmount = function getSumTotalAmount(_ref8) {
1145
+ var expectAmount = _ref8.expectAmount,
1146
+ roundingAmount = _ref8.roundingAmount;
699
1147
  return expectAmount + roundingAmount;
700
1148
  };
701
1149
 
@@ -767,6 +1215,20 @@ export var getSumTotal = function getSumTotal(state, options) {
767
1215
  options: options
768
1216
  });
769
1217
 
1218
+ // 商品原价 不包含折扣
1219
+ var _getProductExpectAmou2 = getProductExpectAmount(state, options.isEdit, true),
1220
+ productExpectAmountWithoutDiscount = _getProductExpectAmou2.productExpectAmount;
1221
+
1222
+ // 订单原价 不包含整单折扣 不包含商品券折扣卡抵扣
1223
+ var originExpectAmountWithoutDiscount = getExpectAmount({
1224
+ price: productExpectAmountWithoutDiscount,
1225
+ tax: originTax,
1226
+ surchargeAmount: surchargeAmount,
1227
+ shopDiscount: 0,
1228
+ state: state,
1229
+ options: options
1230
+ });
1231
+
770
1232
  // 总支付金额 总计
771
1233
  var sumTotalAmount = getSumTotalAmount({
772
1234
  expectAmount: expectAmount,
@@ -803,6 +1265,8 @@ export var getSumTotal = function getSumTotal(state, options) {
803
1265
  totalRefundAmount: totalRefundAmount,
804
1266
  dueAmount: dueAmount,
805
1267
  roundingAmount: roundingAmount,
806
- originExpectAmount: originExpectAmount
1268
+ originExpectAmount: originExpectAmount,
1269
+ // 订单原价 不包含整单折扣 不包含商品券折扣卡抵扣
1270
+ originExpectAmountWithoutDiscount: originExpectAmountWithoutDiscount
807
1271
  };
808
1272
  };