@pisell/private-materials 6.5.2 → 6.5.4

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 (289) 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 +1 -1
  6. package/build/lowcode/preview.js +150 -164
  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/businessModel/SalesModel/index.d.ts +1 -0
  12. package/es/components/appointmentBooking/components/Content/index.d.ts +1 -0
  13. package/es/components/appointmentBooking/components/Header/index.d.ts +1 -0
  14. package/es/components/appointmentBooking/components/Voucher/index.d.ts +1 -0
  15. package/es/components/appointmentBooking/deposit/index.d.ts +1 -0
  16. package/es/components/appointmentBooking/index.d.ts +1 -0
  17. package/es/components/booking/components/actionButtons/index.js +2 -2
  18. package/es/components/booking/components/customiseItemModal/index.js +2 -2
  19. package/es/components/booking/components/footer/index.d.ts +1 -0
  20. package/es/components/booking/components/footer/index.js +48 -42
  21. package/es/components/booking/components/voucher/index.d.ts +1 -0
  22. package/es/components/booking/components/voucher/index.js +18 -4
  23. package/es/components/booking/deposit/index.d.ts +1 -0
  24. package/es/components/booking/hooks/useQuotation.d.ts +1 -0
  25. package/es/components/booking/info/addServiceVariant/index.d.ts +1 -0
  26. package/es/components/booking/info/header/index.d.ts +1 -0
  27. package/es/components/booking/info/hooks/useInfoHolder.d.ts +1 -0
  28. package/es/components/booking/info/index.d.ts +1 -0
  29. package/es/components/booking/info/service/Lists.d.ts +1 -0
  30. package/es/components/booking/info/service/addService/index.d.ts +1 -0
  31. package/es/components/booking/info/service/addTimeModal/index.d.ts +1 -0
  32. package/es/components/booking/info/service/editService/BookingList/index.d.ts +1 -0
  33. package/es/components/booking/info/service/serviceItem/index.d.ts +1 -0
  34. package/es/components/booking/info/service/serviceList/index.d.ts +1 -0
  35. package/es/components/booking/info/service2/Lists.d.ts +1 -0
  36. package/es/components/booking/info/service2/utils.d.ts +1 -1
  37. package/es/components/booking/info2/cartClientCard/index.js +33 -20
  38. package/es/components/booking/info2/cartClientCard/utils.d.ts +2 -2
  39. package/es/components/booking/info2/service/addService/index.d.ts +1 -0
  40. package/es/components/booking/info2/service/serviceItem/index.d.ts +1 -0
  41. package/es/components/booking/info2/service/serviceList/index.d.ts +1 -0
  42. package/es/components/booking/notes/NoteBlock/index.d.ts +1 -0
  43. package/es/components/booking/notes/addNote/index.d.ts +1 -0
  44. package/es/components/booking/utils.d.ts +2 -2
  45. package/es/components/checkout/PaymentModal.js +719 -432
  46. package/es/components/checkout/PaymentPlugin.d.ts +1 -0
  47. package/es/components/checkout/components/AdditionalModule/index.d.ts +1 -1
  48. package/es/components/checkout/components/AdditionalModule/index.js +80 -49
  49. package/es/components/checkout/components/AdditionalModule/index.less +33 -34
  50. package/es/components/checkout/components/AdditionalModule/locales.d.ts +3 -0
  51. package/es/components/checkout/components/AdditionalModule/locales.js +7 -4
  52. package/es/components/checkout/components/AmountSummary/index.d.ts +2 -1
  53. package/es/components/checkout/components/AmountSummary/index.js +69 -31
  54. package/es/components/checkout/components/AmountSummary/index.less +27 -9
  55. package/es/components/checkout/components/CashPaymentModule/index.js +8 -1
  56. package/es/components/checkout/components/CashPaymentModule/index.less +0 -2
  57. package/es/components/checkout/components/PaymentDetailModal/index.js +55 -10
  58. package/es/components/checkout/components/PaymentOptionsModule/index.d.ts +2 -1
  59. package/es/components/checkout/components/PaymentOptionsModule/index.js +40 -25
  60. package/es/components/checkout/components/PaymentOptionsModule/index.less +11 -6
  61. package/es/components/checkout/components/PaymentResultToast/PaymentResultToastProvider.d.ts +42 -9
  62. package/es/components/checkout/components/PaymentResultToast/PaymentResultToastProvider.js +512 -82
  63. package/es/components/checkout/components/PaymentResultToast/index.d.ts +2 -1
  64. package/es/components/checkout/components/PaymentResultToast/index.js +90 -35
  65. package/es/components/checkout/components/PaymentResultToast/index.less +445 -77
  66. package/es/components/checkout/components/PaymentResultToast/types.d.ts +3 -3
  67. package/es/components/checkout/components/PaymentResultToast/utils.d.ts +26 -0
  68. package/es/components/checkout/components/PaymentResultToast/utils.js +81 -2
  69. package/es/components/checkout/components/SearchAndClientModule/index.d.ts +1 -0
  70. package/es/components/checkout/components/SearchAndClientModule/index.js +17 -16
  71. package/es/components/checkout/components/SearchAndClientModule/index.less +29 -8
  72. package/es/components/checkout/components/WalletPassModule/components/ConflictModal/index.d.ts +1 -0
  73. package/es/components/checkout/components/WalletPassModule/components/DiscountWallet/index.d.ts +1 -0
  74. package/es/components/checkout/components/WalletPassModule/components/WalletPassHeader/index.js +3 -1
  75. package/es/components/checkout/components/WalletPassModule/index.less +3 -3
  76. package/es/components/checkout/hooks/useWalletPass.d.ts +1 -1
  77. package/es/components/checkout/hooks/useWalletPass.js +1 -1
  78. package/es/components/checkout/index.d.ts +1 -1
  79. package/es/components/checkout/index.js +1 -1
  80. package/es/components/checkout/index.less +56 -38
  81. package/es/components/checkout/locales.d.ts +6 -0
  82. package/es/components/checkout/locales.js +9 -3
  83. package/es/components/checkout/payment-modal-utils.js +5 -5
  84. package/es/components/checkout/utils/PaymentResultToastUtils.d.ts +3 -3
  85. package/es/components/checkout/utils/PaymentResultToastUtils.js +111 -72
  86. package/es/components/eftpos/surcharge/index.d.ts +1 -0
  87. package/es/components/eftposPay/amount.d.ts +1 -1
  88. package/es/components/eftposPay/app.d.ts +1 -0
  89. package/es/components/eftposPay/device.d.ts +1 -1
  90. package/es/components/eftposPay/hooks.d.ts +2 -2
  91. package/es/components/eftposPay/index.d.ts +1 -0
  92. package/es/components/eftposPay/linkly/index.d.ts +1 -0
  93. package/es/components/eftposPay/store/index.d.ts +6 -6
  94. package/es/components/eventBooking/components/Provider/Cart/ContinueButton/index.d.ts +1 -0
  95. package/es/components/eventBooking/components/Provider/Cart/Item/Total.d.ts +1 -0
  96. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/CallToBook/index.d.ts +1 -0
  97. package/es/components/eventBooking/components/scheduleCalendar/calendarItem.d.ts +1 -0
  98. package/es/components/eventBooking/index.d.ts +1 -0
  99. package/es/components/pay/toB/components/Cache/index.d.ts +1 -0
  100. package/es/components/pay/toB/components/Card/index.d.ts +1 -0
  101. package/es/components/pay/toB/components/CardGroup/index.d.ts +1 -0
  102. package/es/components/pay/toB/components/ConfirmedPayment/index.d.ts +1 -0
  103. package/es/components/pay/toB/components/Content/Footer.d.ts +1 -0
  104. package/es/components/pay/toB/components/Content/Header.d.ts +1 -0
  105. package/es/components/pay/toB/components/EFTPOS/index.js +91 -58
  106. package/es/components/pay/toC/PaymentMethods/MWCreditCard/TDSPay/ThreedsLoading/index.d.ts +1 -0
  107. package/es/components/pay/toC/PaymentMethods/StripePay/Stripe/Finish/index.d.ts +1 -0
  108. package/es/components/pay/toC/PaymentMethods/StripePay/Stripe/StripeSDK/SDK.d.ts +1 -0
  109. package/es/components/pay/toC/PaymentMethods/StripePay/Stripe/components/PageLoading/index.d.ts +1 -0
  110. package/es/components/pay/toC/PaymentMethods/StripePay/Stripe/components/SetupForm/PaymentRequestForm.d.ts +1 -0
  111. package/es/components/pisellSelectCustomerModal/RightPanel/Add/PhoneField/index.d.ts +1 -0
  112. package/es/components/pisellSelectCustomerModal/RightPanel/index.d.ts +1 -0
  113. package/es/components/pisellSelectCustomerModal/index.d.ts +1 -0
  114. package/es/components/productExtension/index.d.ts +1 -0
  115. package/es/components/productSelect/components/TabProduct/index.d.ts +1 -0
  116. package/es/components/productSelect/components/productGroup/index.d.ts +1 -0
  117. package/es/components/ruleSetting/index.d.ts +1 -0
  118. package/es/components/schedules/components/ScheduleList/RenderScheduleItem/index.d.ts +1 -0
  119. package/es/components/schedules/products/ProductDetailDrawer/ProductDetail/SchedulesModule/AddSchedules/index.d.ts +1 -0
  120. package/es/components/schedules/products/ProductDetailDrawer/ProductDetail/SchedulesModule/index.d.ts +1 -0
  121. package/es/components/schedules/utils.d.ts +1 -1
  122. package/es/components/shoppingCart/components/Cart/Product.d.ts +1 -0
  123. package/es/components/taxSelect/index.d.ts +1 -0
  124. package/es/components/ticketBooking/components/addServiceVariant/addService.d.ts +1 -0
  125. package/es/components/ticketBooking/components/addServiceVariant/addService.js +4 -3
  126. package/es/components/ticketBooking/components/addServiceVariant/index.d.ts +1 -0
  127. package/es/components/ticketBooking/components/bookingDataPanel/index.js +1 -1
  128. package/es/components/ticketBooking/components/menuBar/index.d.ts +1 -0
  129. package/es/components/ticketBooking/components/menuBar/index.js +1 -1
  130. package/es/components/ticketBooking/components/ticketBooking/index.d.ts +1 -0
  131. package/es/components/ticketBooking/components/ticketBooking/index.js +2 -2
  132. package/es/components/ticketBooking/components/timeBar/index.d.ts +1 -0
  133. package/es/components/ticketBooking/hooks/pisellos/useScanCustomer.js +1 -1
  134. package/es/components/ticketBooking/hooks/pisellos/useScanGlobal.js +1 -1
  135. package/es/components/ticketBooking/hooks/pisellos/useScanGlobalHandle.js +4 -2
  136. package/es/components/ticketBooking/index.d.ts +1 -0
  137. package/es/components/workSpaceList/components/SearchWorkspaceAndBase/index.d.ts +1 -0
  138. package/es/plus/clientCard/index.js +3 -2
  139. package/es/plus/clientCard/index.less +3 -32
  140. package/es/plus/clientName/index.d.ts +1 -0
  141. package/es/plus/clinetSearch/Add/BirthdayField/index.d.ts +1 -0
  142. package/es/plus/clinetSearch/Add/GenderField/index.d.ts +1 -0
  143. package/es/plus/clinetSearch/Add/PhoneField/index.d.ts +1 -0
  144. package/es/plus/noteModal/AddTempModal.d.ts +1 -0
  145. package/es/plus/saasCreateOrganization/index.d.ts +1 -0
  146. package/es/pro/comprehensiveSearch/components/searchSection/index.js +9 -12
  147. package/es/pro/comprehensiveSearch/components/searchSection/index.less +22 -19
  148. package/es/pro/pisellPhoneKeyboard/index.d.ts +1 -0
  149. package/es/utils/index.d.ts +1 -1
  150. package/lib/businessModel/SalesModel/index.d.ts +1 -0
  151. package/lib/components/appointmentBooking/components/Content/index.d.ts +1 -0
  152. package/lib/components/appointmentBooking/components/Header/index.d.ts +1 -0
  153. package/lib/components/appointmentBooking/components/Voucher/index.d.ts +1 -0
  154. package/lib/components/appointmentBooking/deposit/index.d.ts +1 -0
  155. package/lib/components/appointmentBooking/index.d.ts +1 -0
  156. package/lib/components/booking/components/actionButtons/index.js +2 -1
  157. package/lib/components/booking/components/customiseItemModal/index.js +2 -2
  158. package/lib/components/booking/components/footer/index.d.ts +1 -0
  159. package/lib/components/booking/components/footer/index.js +3 -0
  160. package/lib/components/booking/components/voucher/index.d.ts +1 -0
  161. package/lib/components/booking/components/voucher/index.js +15 -3
  162. package/lib/components/booking/deposit/index.d.ts +1 -0
  163. package/lib/components/booking/hooks/useQuotation.d.ts +1 -0
  164. package/lib/components/booking/info/addServiceVariant/index.d.ts +1 -0
  165. package/lib/components/booking/info/header/index.d.ts +1 -0
  166. package/lib/components/booking/info/hooks/useInfoHolder.d.ts +1 -0
  167. package/lib/components/booking/info/index.d.ts +1 -0
  168. package/lib/components/booking/info/service/Lists.d.ts +1 -0
  169. package/lib/components/booking/info/service/addService/index.d.ts +1 -0
  170. package/lib/components/booking/info/service/addTimeModal/index.d.ts +1 -0
  171. package/lib/components/booking/info/service/editService/BookingList/index.d.ts +1 -0
  172. package/lib/components/booking/info/service/serviceItem/index.d.ts +1 -0
  173. package/lib/components/booking/info/service/serviceList/index.d.ts +1 -0
  174. package/lib/components/booking/info/service2/Lists.d.ts +1 -0
  175. package/lib/components/booking/info/service2/utils.d.ts +1 -1
  176. package/lib/components/booking/info2/cartClientCard/index.js +16 -5
  177. package/lib/components/booking/info2/cartClientCard/utils.d.ts +2 -2
  178. package/lib/components/booking/info2/service/addService/index.d.ts +1 -0
  179. package/lib/components/booking/info2/service/serviceItem/index.d.ts +1 -0
  180. package/lib/components/booking/info2/service/serviceList/index.d.ts +1 -0
  181. package/lib/components/booking/notes/NoteBlock/index.d.ts +1 -0
  182. package/lib/components/booking/notes/addNote/index.d.ts +1 -0
  183. package/lib/components/booking/utils.d.ts +2 -2
  184. package/lib/components/checkout/PaymentModal.js +241 -109
  185. package/lib/components/checkout/PaymentPlugin.d.ts +1 -0
  186. package/lib/components/checkout/components/AdditionalModule/index.d.ts +1 -1
  187. package/lib/components/checkout/components/AdditionalModule/index.js +98 -34
  188. package/lib/components/checkout/components/AdditionalModule/index.less +33 -34
  189. package/lib/components/checkout/components/AdditionalModule/locales.d.ts +3 -0
  190. package/lib/components/checkout/components/AdditionalModule/locales.js +7 -4
  191. package/lib/components/checkout/components/AmountSummary/index.d.ts +2 -1
  192. package/lib/components/checkout/components/AmountSummary/index.js +103 -47
  193. package/lib/components/checkout/components/AmountSummary/index.less +27 -9
  194. package/lib/components/checkout/components/CashPaymentModule/index.js +5 -1
  195. package/lib/components/checkout/components/CashPaymentModule/index.less +0 -2
  196. package/lib/components/checkout/components/PaymentDetailModal/index.js +56 -11
  197. package/lib/components/checkout/components/PaymentOptionsModule/index.d.ts +2 -1
  198. package/lib/components/checkout/components/PaymentOptionsModule/index.js +11 -8
  199. package/lib/components/checkout/components/PaymentOptionsModule/index.less +11 -6
  200. package/lib/components/checkout/components/PaymentResultToast/PaymentResultToastProvider.d.ts +42 -9
  201. package/lib/components/checkout/components/PaymentResultToast/PaymentResultToastProvider.js +279 -73
  202. package/lib/components/checkout/components/PaymentResultToast/index.d.ts +2 -1
  203. package/lib/components/checkout/components/PaymentResultToast/index.js +69 -22
  204. package/lib/components/checkout/components/PaymentResultToast/index.less +445 -77
  205. package/lib/components/checkout/components/PaymentResultToast/types.d.ts +3 -3
  206. package/lib/components/checkout/components/PaymentResultToast/utils.d.ts +26 -0
  207. package/lib/components/checkout/components/PaymentResultToast/utils.js +58 -4
  208. package/lib/components/checkout/components/SearchAndClientModule/index.d.ts +1 -0
  209. package/lib/components/checkout/components/SearchAndClientModule/index.js +17 -15
  210. package/lib/components/checkout/components/SearchAndClientModule/index.less +29 -8
  211. package/lib/components/checkout/components/WalletPassModule/components/ConflictModal/index.d.ts +1 -0
  212. package/lib/components/checkout/components/WalletPassModule/components/DiscountWallet/index.d.ts +1 -0
  213. package/lib/components/checkout/components/WalletPassModule/components/WalletPassHeader/index.js +12 -2
  214. package/lib/components/checkout/components/WalletPassModule/index.less +3 -3
  215. package/lib/components/checkout/hooks/useWalletPass.d.ts +1 -1
  216. package/lib/components/checkout/hooks/useWalletPass.js +2 -2
  217. package/lib/components/checkout/index.d.ts +1 -1
  218. package/lib/components/checkout/index.js +2 -0
  219. package/lib/components/checkout/index.less +56 -38
  220. package/lib/components/checkout/locales.d.ts +6 -0
  221. package/lib/components/checkout/locales.js +9 -3
  222. package/lib/components/checkout/payment-modal-utils.js +5 -5
  223. package/lib/components/checkout/utils/PaymentResultToastUtils.d.ts +3 -3
  224. package/lib/components/checkout/utils/PaymentResultToastUtils.js +26 -18
  225. package/lib/components/eftpos/surcharge/index.d.ts +1 -0
  226. package/lib/components/eftposPay/amount.d.ts +1 -1
  227. package/lib/components/eftposPay/app.d.ts +1 -0
  228. package/lib/components/eftposPay/device.d.ts +1 -1
  229. package/lib/components/eftposPay/hooks.d.ts +2 -2
  230. package/lib/components/eftposPay/index.d.ts +1 -0
  231. package/lib/components/eftposPay/linkly/index.d.ts +1 -0
  232. package/lib/components/eftposPay/store/index.d.ts +6 -6
  233. package/lib/components/eventBooking/components/Provider/Cart/ContinueButton/index.d.ts +1 -0
  234. package/lib/components/eventBooking/components/Provider/Cart/Item/Total.d.ts +1 -0
  235. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/CallToBook/index.d.ts +1 -0
  236. package/lib/components/eventBooking/components/scheduleCalendar/calendarItem.d.ts +1 -0
  237. package/lib/components/eventBooking/index.d.ts +1 -0
  238. package/lib/components/pay/toB/components/Cache/index.d.ts +1 -0
  239. package/lib/components/pay/toB/components/Card/index.d.ts +1 -0
  240. package/lib/components/pay/toB/components/CardGroup/index.d.ts +1 -0
  241. package/lib/components/pay/toB/components/ConfirmedPayment/index.d.ts +1 -0
  242. package/lib/components/pay/toB/components/Content/Footer.d.ts +1 -0
  243. package/lib/components/pay/toB/components/Content/Header.d.ts +1 -0
  244. package/lib/components/pay/toB/components/EFTPOS/index.js +25 -10
  245. package/lib/components/pay/toC/PaymentMethods/MWCreditCard/TDSPay/ThreedsLoading/index.d.ts +1 -0
  246. package/lib/components/pay/toC/PaymentMethods/StripePay/Stripe/Finish/index.d.ts +1 -0
  247. package/lib/components/pay/toC/PaymentMethods/StripePay/Stripe/StripeSDK/SDK.d.ts +1 -0
  248. package/lib/components/pay/toC/PaymentMethods/StripePay/Stripe/components/PageLoading/index.d.ts +1 -0
  249. package/lib/components/pay/toC/PaymentMethods/StripePay/Stripe/components/SetupForm/PaymentRequestForm.d.ts +1 -0
  250. package/lib/components/pisellSelectCustomerModal/RightPanel/Add/PhoneField/index.d.ts +1 -0
  251. package/lib/components/pisellSelectCustomerModal/RightPanel/index.d.ts +1 -0
  252. package/lib/components/pisellSelectCustomerModal/index.d.ts +1 -0
  253. package/lib/components/productExtension/index.d.ts +1 -0
  254. package/lib/components/productSelect/components/TabProduct/index.d.ts +1 -0
  255. package/lib/components/productSelect/components/productGroup/index.d.ts +1 -0
  256. package/lib/components/ruleSetting/index.d.ts +1 -0
  257. package/lib/components/schedules/components/ScheduleList/RenderScheduleItem/index.d.ts +1 -0
  258. package/lib/components/schedules/products/ProductDetailDrawer/ProductDetail/SchedulesModule/AddSchedules/index.d.ts +1 -0
  259. package/lib/components/schedules/products/ProductDetailDrawer/ProductDetail/SchedulesModule/index.d.ts +1 -0
  260. package/lib/components/schedules/utils.d.ts +1 -1
  261. package/lib/components/shoppingCart/components/Cart/Product.d.ts +1 -0
  262. package/lib/components/taxSelect/index.d.ts +1 -0
  263. package/lib/components/ticketBooking/components/addServiceVariant/addService.d.ts +1 -0
  264. package/lib/components/ticketBooking/components/addServiceVariant/addService.js +7 -6
  265. package/lib/components/ticketBooking/components/addServiceVariant/index.d.ts +1 -0
  266. package/lib/components/ticketBooking/components/bookingDataPanel/index.js +2 -2
  267. package/lib/components/ticketBooking/components/menuBar/index.d.ts +1 -0
  268. package/lib/components/ticketBooking/components/menuBar/index.js +1 -1
  269. package/lib/components/ticketBooking/components/ticketBooking/index.d.ts +1 -0
  270. package/lib/components/ticketBooking/components/ticketBooking/index.js +1 -1
  271. package/lib/components/ticketBooking/components/timeBar/index.d.ts +1 -0
  272. package/lib/components/ticketBooking/hooks/pisellos/useScanCustomer.js +2 -12
  273. package/lib/components/ticketBooking/hooks/pisellos/useScanGlobal.js +2 -12
  274. package/lib/components/ticketBooking/hooks/pisellos/useScanGlobalHandle.js +5 -13
  275. package/lib/components/ticketBooking/index.d.ts +1 -0
  276. package/lib/components/workSpaceList/components/SearchWorkspaceAndBase/index.d.ts +1 -0
  277. package/lib/plus/clientCard/index.js +5 -4
  278. package/lib/plus/clientCard/index.less +3 -32
  279. package/lib/plus/clientName/index.d.ts +1 -0
  280. package/lib/plus/clinetSearch/Add/BirthdayField/index.d.ts +1 -0
  281. package/lib/plus/clinetSearch/Add/GenderField/index.d.ts +1 -0
  282. package/lib/plus/clinetSearch/Add/PhoneField/index.d.ts +1 -0
  283. package/lib/plus/noteModal/AddTempModal.d.ts +1 -0
  284. package/lib/plus/saasCreateOrganization/index.d.ts +1 -0
  285. package/lib/pro/comprehensiveSearch/components/searchSection/index.js +6 -18
  286. package/lib/pro/comprehensiveSearch/components/searchSection/index.less +22 -19
  287. package/lib/pro/pisellPhoneKeyboard/index.d.ts +1 -0
  288. package/lib/utils/index.d.ts +1 -1
  289. package/package.json +12 -12
@@ -20,9 +20,9 @@ import { locales } from '@pisell/utils';
20
20
  import { getLocale } from "../../utils/locales";
21
21
  import { useMemoizedFn } from 'ahooks';
22
22
  import { createPortal } from 'react-dom';
23
+ import ReactDOM from 'react-dom';
23
24
  import checkoutLocales from "./locales";
24
- import { PisellContainer } from '@pisell/materials';
25
- import { PisellAdjustPrice } from '@pisell/materials';
25
+ import { PisellContainer, PisellAdjustPrice, Icon, useToast, ConfigProvider } from '@pisell/materials';
26
26
  import useEngineContext from "../../hooks/useEngineContext";
27
27
  import NoteModal from "../../plus/noteModal";
28
28
  import SendPaymentLinkModal from "./components/SendPaymentLinkModal";
@@ -33,14 +33,12 @@ import PaymentOptionsModule from "./components/PaymentOptionsModule";
33
33
  import CashPaymentModule from "./components/CashPaymentModule";
34
34
  import AdditionalModule from "./components/AdditionalModule";
35
35
  import { getSumTotal } from "../booking/components/footer/amount";
36
- import { PaymentResultToastProvider, closePaymentResultToast } from "./components/PaymentResultToast";
36
+ import { closePaymentResultToast, closeAllPaymentResultToasts, setTillButton } from "./components/PaymentResultToast";
37
37
  import { formatCurrency, calculateStatusClassName, calculateAutoCloseConfig, displayPaymentResultToast, createShowSuccessToast } from "./utils/PaymentResultToastUtils";
38
38
  import { Printer, FileCheck02, RefreshCw05, CreditCard02, MessageTextSquare02, ArrowLeft, DotsVertical } from '@pisell/icon';
39
39
  import { checkoutStyles } from "./styles";
40
40
  import PaymentMethods from "../pay/toB/paymentMethods";
41
- import { DeviceIconGroup } from "../../pro/comprehensiveSearch/components";
42
41
  import SearchAndClientModule from "./components/SearchAndClientModule";
43
- import useToast from "../../hooks/useToast";
44
42
  import "./index.less";
45
43
  import { WALLET_PASS_CODE_ARRAY, WALLET_PASS_CODE_MAP } from "./constants";
46
44
  import { cloneDeep } from 'lodash';
@@ -181,6 +179,7 @@ var PaymentContent = /*#__PURE__*/forwardRef(function (_ref, ref) {
181
179
  }, [paymentMethods]);
182
180
  var handleAddCashPayment = /*#__PURE__*/function () {
183
181
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(result) {
182
+ var _interaction$utils, _interaction$utils$po;
184
183
  var cashPaymentMethod;
185
184
  return _regeneratorRuntime().wrap(function _callee$(_context) {
186
185
  while (1) switch (_context.prev = _context.next) {
@@ -206,6 +205,19 @@ var PaymentContent = /*#__PURE__*/forwardRef(function (_ref, ref) {
206
205
  rounding_amount: result.roundingAmount
207
206
  });
208
207
  case 3:
208
+ logger === null || logger === void 0 || logger.addLog({
209
+ type: 'info',
210
+ title: 'open_till',
211
+ metadata: {}
212
+ });
213
+ interaction === null || interaction === void 0 || (_interaction$utils = interaction.utils) === null || _interaction$utils === void 0 || (_interaction$utils$po = _interaction$utils.postMessageToApp) === null || _interaction$utils$po === void 0 || _interaction$utils$po.call(_interaction$utils, {
214
+ module: 'till',
215
+ key: 'open_till',
216
+ data: {
217
+ type: 'cash' // cash 不需要验证钱箱权限
218
+ }
219
+ });
220
+ case 5:
209
221
  case "end":
210
222
  return _context.stop();
211
223
  }
@@ -508,48 +520,48 @@ var PaymentContent = /*#__PURE__*/forwardRef(function (_ref, ref) {
508
520
  // Toast?.fail(locales.getText('pisell2.checkout.order-sync-failed') || 'Order sync failed');
509
521
  // }
510
522
  // );
511
- var orderPaymentAddedUnsubscribe = core.effects.on(CheckoutHooks.OnOrderPaymentAdded, function (data) {
512
- console.log('orderPaymentAddedUnsubscribe>>>>', data);
513
- var balanceDueAmount = checkoutModule.getBalanceDueAmount();
514
- if (Number(balanceDueAmount) > 0) {
515
- var autoCloseConfig = calculateAutoCloseConfig('partially_paid', false);
516
- // 获取订单总金额
517
- var _orderInfo = checkoutModule.getCurrentOrderInfo();
518
-
519
- // 根据支付状态展示不同的 toast
520
- displayPaymentResultToast({
521
- paymentStatus: 'partially_paid',
522
- orderTotalAmount: _orderInfo.totalAmount,
523
- gapAmount: balanceDueAmount,
524
- failureReason: '',
525
- autoCloseConfig: autoCloseConfig,
526
- actionButtons: generateActionButtons === null || generateActionButtons === void 0 ? void 0 : generateActionButtons('partially_paid')
527
- }, _objectSpread(_objectSpread({}, paymentResultToastConfig), {}, {
528
- onToastClose: function onToastClose() {
529
- closePaymentResultToast();
530
- },
531
- onCountdownComplete: function onCountdownComplete() {
532
- closePaymentResultToast();
523
+ var orderPaymentAddedUnsubscribe = core.effects.on(CheckoutHooks.OnOrderPaymentAdded, /*#__PURE__*/function () {
524
+ var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(data) {
525
+ var balanceDueAmount, autoCloseConfig, _orderInfo;
526
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
527
+ while (1) switch (_context5.prev = _context5.next) {
528
+ case 0:
529
+ console.log('orderPaymentAddedUnsubscribe>>>>', data);
530
+ balanceDueAmount = checkoutModule.getBalanceDueAmount();
531
+ if (!(Number(balanceDueAmount) > 0)) {
532
+ _context5.next = 7;
533
+ break;
534
+ }
535
+ autoCloseConfig = calculateAutoCloseConfig('partially_paid', false); // 获取订单总金额
536
+ _orderInfo = checkoutModule.getCurrentOrderInfo(); // 根据支付状态展示不同的 toast
537
+ _context5.next = 7;
538
+ return displayPaymentResultToast({
539
+ paymentStatus: 'partially_paid',
540
+ orderTotalAmount: _orderInfo.totalAmount,
541
+ gapAmount: balanceDueAmount,
542
+ failureReason: '',
543
+ autoCloseConfig: autoCloseConfig,
544
+ actionButtons: generateActionButtons === null || generateActionButtons === void 0 ? void 0 : generateActionButtons('partially_paid')
545
+ }, _objectSpread(_objectSpread({}, paymentResultToastConfig), {}, {
546
+ onToastClose: function onToastClose() {
547
+ closePaymentResultToast();
548
+ },
549
+ onCountdownComplete: function onCountdownComplete() {
550
+ closePaymentResultToast();
551
+ // PaymentResultToast自己管理关闭,不需要额外调用
552
+ // 不自动关闭Modal,让两个弹窗独立管理
553
+ }
554
+ }));
555
+ case 7:
556
+ case "end":
557
+ return _context5.stop();
533
558
  }
534
- }));
535
- }
536
- // 判断是否为现金支付
537
- var paymentMethodName = data.paymentMethodName || data.name || '';
538
- var isCashPayment = data.paymentMethodCode === 'CASHMANUAL' || /现金|現金/i.test(paymentMethodName) || /cash/i.test(paymentMethodName);
539
- if (isCashPayment) {
540
- var _interaction$utils, _interaction$utils$po;
541
- logger === null || logger === void 0 || logger.addLog({
542
- type: 'info',
543
- title: 'open_till',
544
- metadata: {}
545
- });
546
- // handleToastClose();
547
- interaction === null || interaction === void 0 || (_interaction$utils = interaction.utils) === null || _interaction$utils === void 0 || (_interaction$utils$po = _interaction$utils.postMessageToApp) === null || _interaction$utils$po === void 0 || _interaction$utils$po.call(_interaction$utils, {
548
- module: 'till',
549
- key: 'open_till'
550
- });
551
- }
552
- });
559
+ }, _callee5);
560
+ }));
561
+ return function (_x5) {
562
+ return _ref8.apply(this, arguments);
563
+ };
564
+ }());
553
565
  return function () {
554
566
  if (unsubscribe && typeof unsubscribe === 'function') {
555
567
  unsubscribe();
@@ -576,98 +588,100 @@ var PaymentContent = /*#__PURE__*/forwardRef(function (_ref, ref) {
576
588
 
577
589
  // 处理金额修改
578
590
  var handleAmountChange = useCallback( /*#__PURE__*/function () {
579
- var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(newAmount) {
580
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
581
- while (1) switch (_context5.prev = _context5.next) {
591
+ var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(newAmount) {
592
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
593
+ while (1) switch (_context6.prev = _context6.next) {
582
594
  case 0:
583
595
  if (!checkoutModule) {
584
- _context5.next = 10;
596
+ _context6.next = 10;
585
597
  break;
586
598
  }
587
- _context5.prev = 1;
588
- _context5.next = 4;
599
+ _context6.prev = 1;
600
+ _context6.next = 4;
589
601
  return checkoutModule.setStateAmountAsync(newAmount);
590
602
  case 4:
591
603
  setCustomAmount(newAmount);
592
- _context5.next = 10;
604
+ _context6.next = 10;
593
605
  break;
594
606
  case 7:
595
- _context5.prev = 7;
596
- _context5.t0 = _context5["catch"](1);
597
- console.error('Failed to set custom amount:', _context5.t0);
607
+ _context6.prev = 7;
608
+ _context6.t0 = _context6["catch"](1);
609
+ console.error('Failed to set custom amount:', _context6.t0);
598
610
  case 10:
599
611
  case "end":
600
- return _context5.stop();
612
+ return _context6.stop();
601
613
  }
602
- }, _callee5, null, [[1, 7]]);
614
+ }, _callee6, null, [[1, 7]]);
603
615
  }));
604
- return function (_x5) {
605
- return _ref8.apply(this, arguments);
616
+ return function (_x6) {
617
+ return _ref9.apply(this, arguments);
606
618
  };
607
619
  }(), [checkoutModule]);
608
620
 
609
621
  // 处理押金状态变更
610
622
  var handleDepositStatusChange = useCallback( /*#__PURE__*/function () {
611
- var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(isDeposit) {
623
+ var _ref10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(isDeposit) {
612
624
  var depositStatus;
613
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
614
- while (1) switch (_context6.prev = _context6.next) {
625
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
626
+ while (1) switch (_context7.prev = _context7.next) {
615
627
  case 0:
616
628
  if (!checkoutModule) {
617
- _context6.next = 11;
629
+ _context7.next = 11;
618
630
  break;
619
631
  }
620
- _context6.prev = 1;
632
+ _context7.prev = 1;
621
633
  depositStatus = isDeposit ? 1 : 0;
622
- _context6.next = 5;
634
+ _context7.next = 5;
623
635
  return checkoutModule.updateOrderDepositStatusAsync(depositStatus);
624
636
  case 5:
625
637
  console.log("Deposit status updated to: ".concat(depositStatus, " (").concat(isDeposit ? 'deposit' : 'regular', ")"));
626
- _context6.next = 11;
638
+ _context7.next = 11;
627
639
  break;
628
640
  case 8:
629
- _context6.prev = 8;
630
- _context6.t0 = _context6["catch"](1);
631
- console.error('Failed to update deposit status:', _context6.t0);
641
+ _context7.prev = 8;
642
+ _context7.t0 = _context7["catch"](1);
643
+ console.error('Failed to update deposit status:', _context7.t0);
632
644
  case 11:
633
645
  case "end":
634
- return _context6.stop();
646
+ return _context7.stop();
635
647
  }
636
- }, _callee6, null, [[1, 8]]);
648
+ }, _callee7, null, [[1, 8]]);
637
649
  }));
638
- return function (_x6) {
639
- return _ref9.apply(this, arguments);
650
+ return function (_x7) {
651
+ return _ref10.apply(this, arguments);
640
652
  };
641
653
  }(), [checkoutModule]);
642
654
 
643
655
  // 当 walletpass 直接就满足订单支付时,触发此方法
644
656
  var handleWalletPassConfirmPay = /*#__PURE__*/function () {
645
- var _ref10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(action) {
657
+ var _ref11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(action) {
646
658
  var result, _result$response, responseData, _responseData$payment, params;
647
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
648
- while (1) switch (_context7.prev = _context7.next) {
659
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
660
+ while (1) switch (_context8.prev = _context8.next) {
649
661
  case 0:
650
662
  if (!(action === 'save-without-deduct')) {
651
- _context7.next = 5;
663
+ _context8.next = 5;
652
664
  break;
653
665
  }
654
- _context7.next = 3;
666
+ _context8.next = 3;
655
667
  return checkoutModule.updateVoucherPaymentItemsAsync([]);
656
668
  case 3:
657
- _context7.next = 7;
669
+ _context8.next = 7;
658
670
  break;
659
671
  case 5:
660
672
  if (!(action === 'cancel')) {
661
- _context7.next = 7;
673
+ _context8.next = 7;
662
674
  break;
663
675
  }
664
- return _context7.abrupt("return");
676
+ return _context8.abrupt("return");
665
677
  case 7:
666
- _context7.next = 9;
678
+ _context8.next = 9;
667
679
  return checkoutModule.manualSyncOrderAsync();
668
680
  case 9:
669
- result = _context7.sent;
670
- showSuccessToast === null || showSuccessToast === void 0 || showSuccessToast(result);
681
+ result = _context8.sent;
682
+ _context8.next = 12;
683
+ return showSuccessToast === null || showSuccessToast === void 0 ? void 0 : showSuccessToast(result);
684
+ case 12:
671
685
  if (result.success) {
672
686
  responseData = (_result$response = result.response) === null || _result$response === void 0 ? void 0 : _result$response.data; // 打印订单完整信息
673
687
  console.log('print_order_onOrderSynced>>>>', result);
@@ -689,74 +703,75 @@ var PaymentContent = /*#__PURE__*/forwardRef(function (_ref, ref) {
689
703
  } catch (error) {
690
704
  console.error('print_order_onOrderSynced_error>>>>', error);
691
705
  }
706
+ // 支付成功时关闭 PaymentModal
707
+ onPaymentCancel(true);
692
708
  }
693
- // onPaymentCancel(true);
694
- case 12:
709
+ case 13:
695
710
  case "end":
696
- return _context7.stop();
711
+ return _context8.stop();
697
712
  }
698
- }, _callee7);
713
+ }, _callee8);
699
714
  }));
700
- return function handleWalletPassConfirmPay(_x7) {
701
- return _ref10.apply(this, arguments);
715
+ return function handleWalletPassConfirmPay(_x8) {
716
+ return _ref11.apply(this, arguments);
702
717
  };
703
718
  }();
704
719
 
705
720
  // 处理 Save & Pay Later 的钱包余额确认
706
721
  var handleSavePayLater = useCallback( /*#__PURE__*/function () {
707
- var _ref11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(action) {
722
+ var _ref12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(action) {
708
723
  var res;
709
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
710
- while (1) switch (_context8.prev = _context8.next) {
724
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
725
+ while (1) switch (_context9.prev = _context9.next) {
711
726
  case 0:
712
727
  if (!(action === 'apply-deduct-now')) {
713
- _context8.next = 4;
728
+ _context9.next = 4;
714
729
  break;
715
730
  }
716
731
  console.log('立即应用并扣除钱包余额,然后保存稍后付款');
717
732
  // 执行扣除逻辑
718
- _context8.next = 13;
733
+ _context9.next = 13;
719
734
  break;
720
735
  case 4:
721
736
  if (!(action === 'save-without-deduct')) {
722
- _context8.next = 10;
737
+ _context9.next = 10;
723
738
  break;
724
739
  }
725
740
  console.log('保存但不扣除钱包余额,稍后付款');
726
741
  // 保存但不扣除,先把 os 里 voucher_id 的 payment 删除
727
- _context8.next = 8;
742
+ _context9.next = 8;
728
743
  return checkoutModule.updateVoucherPaymentItemsAsync([]);
729
744
  case 8:
730
- _context8.next = 13;
745
+ _context9.next = 13;
731
746
  break;
732
747
  case 10:
733
748
  if (!(action === 'cancel')) {
734
- _context8.next = 13;
749
+ _context9.next = 13;
735
750
  break;
736
751
  }
737
752
  console.log('取消保存稍后付款');
738
- return _context8.abrupt("return");
753
+ return _context9.abrupt("return");
739
754
  case 13:
740
755
  if (!checkoutModule) {
741
- _context8.next = 18;
756
+ _context9.next = 18;
742
757
  break;
743
758
  }
744
- _context8.next = 16;
759
+ _context9.next = 16;
745
760
  return checkoutModule.saveForLaterPaymentAsync();
746
761
  case 16:
747
- res = _context8.sent;
762
+ res = _context9.sent;
748
763
  if (res.success) {
749
764
  onPaymentCancel(true);
750
- closePaymentResultToast();
765
+ // 不关闭PaymentResultToast,让Save & Pay Later操作后toast保持显示
751
766
  }
752
767
  case 18:
753
768
  case "end":
754
- return _context8.stop();
769
+ return _context9.stop();
755
770
  }
756
- }, _callee8);
771
+ }, _callee9);
757
772
  }));
758
- return function (_x8) {
759
- return _ref11.apply(this, arguments);
773
+ return function (_x9) {
774
+ return _ref12.apply(this, arguments);
760
775
  };
761
776
  }(), [checkoutModule, onPaymentCancel]);
762
777
  var moduleConfig = {
@@ -824,13 +839,13 @@ var PaymentContent = /*#__PURE__*/forwardRef(function (_ref, ref) {
824
839
  }
825
840
  }, [state, showPriceAdjustModal]);
826
841
  var handleSelectWalletChange = useMemoizedFn( /*#__PURE__*/function () {
827
- var _ref12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(select) {
842
+ var _ref13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(select) {
828
843
  var voucherItems, data;
829
- return _regeneratorRuntime().wrap(function _callee9$(_context9) {
830
- while (1) switch (_context9.prev = _context9.next) {
844
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
845
+ while (1) switch (_context10.prev = _context10.next) {
831
846
  case 0:
832
847
  if (!walletPassDetail.isShow) {
833
- _context9.next = 7;
848
+ _context10.next = 7;
834
849
  break;
835
850
  }
836
851
  voucherItems = [];
@@ -859,7 +874,7 @@ var PaymentContent = /*#__PURE__*/forwardRef(function (_ref, ref) {
859
874
  title: 'handleSelectWalletChange checkoutModule updateVoucherPaymentItemsAsync',
860
875
  metadata: {}
861
876
  });
862
- _context9.next = 6;
877
+ _context10.next = 6;
863
878
  return checkoutModule.updateVoucherPaymentItemsAsync(voucherItems);
864
879
  case 6:
865
880
  // 更新钱包卡券数据
@@ -869,21 +884,21 @@ var PaymentContent = /*#__PURE__*/forwardRef(function (_ref, ref) {
869
884
  }
870
885
  case 7:
871
886
  case "end":
872
- return _context9.stop();
887
+ return _context10.stop();
873
888
  }
874
- }, _callee9);
889
+ }, _callee10);
875
890
  }));
876
- return function (_x9) {
877
- return _ref12.apply(this, arguments);
891
+ return function (_x10) {
892
+ return _ref13.apply(this, arguments);
878
893
  };
879
894
  }());
880
895
 
881
896
  // 手动折扣相关处理函数
882
897
  var handlePriceAdjustConfirm = /*#__PURE__*/function () {
883
- var _ref13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(newPrice) {
898
+ var _ref14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(newPrice) {
884
899
  var ScheduleModule, _getSumTotal2, productAmount, discountAmount;
885
- return _regeneratorRuntime().wrap(function _callee10$(_context10) {
886
- while (1) switch (_context10.prev = _context10.next) {
900
+ return _regeneratorRuntime().wrap(function _callee11$(_context11) {
901
+ while (1) switch (_context11.prev = _context11.next) {
887
902
  case 0:
888
903
  try {
889
904
  if (checkoutModule && orderInfo !== null && orderInfo !== void 0 && orderInfo.totalAmount) {
@@ -914,51 +929,51 @@ var PaymentContent = /*#__PURE__*/forwardRef(function (_ref, ref) {
914
929
  setShowPriceAdjustModal(false);
915
930
  case 2:
916
931
  case "end":
917
- return _context10.stop();
932
+ return _context11.stop();
918
933
  }
919
- }, _callee10);
934
+ }, _callee11);
920
935
  }));
921
- return function handlePriceAdjustConfirm(_x10) {
922
- return _ref13.apply(this, arguments);
936
+ return function handlePriceAdjustConfirm(_x11) {
937
+ return _ref14.apply(this, arguments);
923
938
  };
924
939
  }();
925
940
  var handleButtonClick = /*#__PURE__*/function () {
926
- var _ref14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(key) {
941
+ var _ref15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(key) {
927
942
  var _savePayLaterHandlerR;
928
943
  var data, isSynced, orderId, params, _paymentItems;
929
- return _regeneratorRuntime().wrap(function _callee11$(_context11) {
930
- while (1) switch (_context11.prev = _context11.next) {
944
+ return _regeneratorRuntime().wrap(function _callee12$(_context12) {
945
+ while (1) switch (_context12.prev = _context12.next) {
931
946
  case 0:
932
947
  console.log('handleButtonClick', key);
933
- _context11.t0 = key;
934
- _context11.next = _context11.t0 === 'order-note' ? 4 : _context11.t0 === 'send-link' ? 6 : _context11.t0 === 'print-receipt' ? 8 : _context11.t0 === 'manual-discount' ? 24 : _context11.t0 === 'save-pay-later' ? 38 : 40;
948
+ _context12.t0 = key;
949
+ _context12.next = _context12.t0 === 'order-note' ? 4 : _context12.t0 === 'send-link' ? 6 : _context12.t0 === 'print-receipt' ? 8 : _context12.t0 === 'manual-discount' ? 24 : _context12.t0 === 'save-pay-later' ? 38 : 40;
935
950
  break;
936
951
  case 4:
937
952
  setNoteModalOpen(true);
938
- return _context11.abrupt("break", 40);
953
+ return _context12.abrupt("break", 40);
939
954
  case 6:
940
955
  setPaymentLinkModalOpen(true);
941
- return _context11.abrupt("break", 40);
956
+ return _context12.abrupt("break", 40);
942
957
  case 8:
943
- _context11.next = 10;
958
+ _context12.next = 10;
944
959
  return checkoutModule.isCurrentOrderSynced();
945
960
  case 10:
946
- isSynced = _context11.sent;
961
+ isSynced = _context12.sent;
947
962
  if (isSynced) {
948
- _context11.next = 17;
963
+ _context12.next = 17;
949
964
  break;
950
965
  }
951
- _context11.next = 14;
966
+ _context12.next = 14;
952
967
  return checkoutModule.manualSyncOrderAsync();
953
968
  case 14:
954
- data = _context11.sent;
955
- _context11.next = 21;
969
+ data = _context12.sent;
970
+ _context12.next = 21;
956
971
  break;
957
972
  case 17:
958
- _context11.next = 19;
973
+ _context12.next = 19;
959
974
  return checkoutModule.getCurrentOrderId();
960
975
  case 19:
961
- orderId = _context11.sent;
976
+ orderId = _context12.sent;
962
977
  data = {
963
978
  orderId: orderId
964
979
  };
@@ -983,47 +998,47 @@ var PaymentContent = /*#__PURE__*/forwardRef(function (_ref, ref) {
983
998
  console.error('handleButtonClick_print-receipt_error>>>>', error);
984
999
  }
985
1000
  }
986
- return _context11.abrupt("break", 40);
1001
+ return _context12.abrupt("break", 40);
987
1002
  case 24:
988
1003
  if (orderInfo !== null && orderInfo !== void 0 && orderInfo.totalAmount) {
989
- _context11.next = 27;
1004
+ _context12.next = 27;
990
1005
  break;
991
1006
  }
992
1007
  Toast === null || Toast === void 0 || Toast.fail(locales.getText('pisell2.checkout.manual-discount.no-amount'));
993
- return _context11.abrupt("return");
1008
+ return _context12.abrupt("return");
994
1009
  case 27:
995
- _context11.next = 29;
1010
+ _context12.next = 29;
996
1011
  return checkoutModule.getCurrentOrderPaymentItemsAsync();
997
1012
  case 29:
998
- _paymentItems = _context11.sent;
1013
+ _paymentItems = _context12.sent;
999
1014
  if (!(_paymentItems !== null && _paymentItems !== void 0 && _paymentItems.length)) {
1000
- _context11.next = 33;
1015
+ _context12.next = 33;
1001
1016
  break;
1002
1017
  }
1003
1018
  Toast === null || Toast === void 0 || Toast.fail(locales.getText('pisell2.checkout.manual-discount.has-payment-items'));
1004
- return _context11.abrupt("return");
1019
+ return _context12.abrupt("return");
1005
1020
  case 33:
1006
1021
  if (!(Number(customAmount) <= 0 && Number(orderInfo === null || orderInfo === void 0 ? void 0 : orderInfo.totalAmount) >= 0)) {
1007
- _context11.next = 36;
1022
+ _context12.next = 36;
1008
1023
  break;
1009
1024
  }
1010
1025
  Toast === null || Toast === void 0 || Toast.fail(locales.getText('pisell2.checkout.manual-discount.no-amount'));
1011
- return _context11.abrupt("return");
1026
+ return _context12.abrupt("return");
1012
1027
  case 36:
1013
1028
  setShowPriceAdjustModal(true);
1014
- return _context11.abrupt("break", 40);
1029
+ return _context12.abrupt("break", 40);
1015
1030
  case 38:
1016
1031
  // 通过 ref 调用 SavePayLaterHandler 的处理方法
1017
1032
  (_savePayLaterHandlerR = savePayLaterHandlerRef.current) === null || _savePayLaterHandlerR === void 0 || _savePayLaterHandlerR.handleSavePayLaterClick();
1018
- return _context11.abrupt("break", 40);
1033
+ return _context12.abrupt("break", 40);
1019
1034
  case 40:
1020
1035
  case "end":
1021
- return _context11.stop();
1036
+ return _context12.stop();
1022
1037
  }
1023
- }, _callee11);
1038
+ }, _callee12);
1024
1039
  }));
1025
- return function handleButtonClick(_x11) {
1026
- return _ref14.apply(this, arguments);
1040
+ return function handleButtonClick(_x12) {
1041
+ return _ref15.apply(this, arguments);
1027
1042
  };
1028
1043
  }();
1029
1044
 
@@ -1051,37 +1066,37 @@ var PaymentContent = /*#__PURE__*/forwardRef(function (_ref, ref) {
1051
1066
  };
1052
1067
  };
1053
1068
  var handleSendCustomerPaymentLink = /*#__PURE__*/function () {
1054
- var _ref15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(data) {
1069
+ var _ref16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(data) {
1055
1070
  var order, stateAmount, isCurrentOrderSynced, res;
1056
- return _regeneratorRuntime().wrap(function _callee12$(_context12) {
1057
- while (1) switch (_context12.prev = _context12.next) {
1071
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
1072
+ while (1) switch (_context13.prev = _context13.next) {
1058
1073
  case 0:
1059
1074
  // 先检测订单是否同步过,如果没有,需要先手动下单
1060
1075
  // 如果是定金模式,则需要设置当前待付金额至 os 的 deposit_amount
1061
1076
  order = checkoutModule.getCurrentOrderInfo();
1062
1077
  if (!order.isDeposit) {
1063
- _context12.next = 5;
1078
+ _context13.next = 5;
1064
1079
  break;
1065
1080
  }
1066
1081
  stateAmount = checkoutModule.getStateAmount();
1067
- _context12.next = 5;
1082
+ _context13.next = 5;
1068
1083
  return checkoutModule.setDepositAmountAsync(stateAmount);
1069
1084
  case 5:
1070
1085
  isCurrentOrderSynced = checkoutModule.isCurrentOrderSynced();
1071
1086
  if (isCurrentOrderSynced) {
1072
- _context12.next = 9;
1087
+ _context13.next = 9;
1073
1088
  break;
1074
1089
  }
1075
- _context12.next = 9;
1090
+ _context13.next = 9;
1076
1091
  return checkoutModule.manualSyncOrderAsync();
1077
1092
  case 9:
1078
- _context12.next = 11;
1093
+ _context13.next = 11;
1079
1094
  return checkoutModule.sendCustomerPayLinkAsync({
1080
1095
  emails: data.emails,
1081
1096
  order_ids: [checkoutModule.getCurrentOrderId()]
1082
1097
  });
1083
1098
  case 11:
1084
- res = _context12.sent;
1099
+ res = _context13.sent;
1085
1100
  // 支付链接发送成功 转 toC,这边可以关掉了
1086
1101
  if (res.success) {
1087
1102
  Toast === null || Toast === void 0 || Toast.success(locales.getText('pisell2.checkout.send-payment-link.success'));
@@ -1091,12 +1106,12 @@ var PaymentContent = /*#__PURE__*/forwardRef(function (_ref, ref) {
1091
1106
  }
1092
1107
  case 13:
1093
1108
  case "end":
1094
- return _context12.stop();
1109
+ return _context13.stop();
1095
1110
  }
1096
- }, _callee12);
1111
+ }, _callee13);
1097
1112
  }));
1098
- return function handleSendCustomerPaymentLink(_x12) {
1099
- return _ref15.apply(this, arguments);
1113
+ return function handleSendCustomerPaymentLink(_x13) {
1114
+ return _ref16.apply(this, arguments);
1100
1115
  };
1101
1116
  }();
1102
1117
  var searchAndClientProps = useMemo(function () {
@@ -1108,31 +1123,44 @@ var PaymentContent = /*#__PURE__*/forwardRef(function (_ref, ref) {
1108
1123
  return {};
1109
1124
  }, [paymentItems]);
1110
1125
  var roundingFunction = /*#__PURE__*/function () {
1111
- var _ref16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(amount) {
1126
+ var _ref17 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(amount) {
1112
1127
  var res;
1113
- return _regeneratorRuntime().wrap(function _callee13$(_context13) {
1114
- while (1) switch (_context13.prev = _context13.next) {
1128
+ return _regeneratorRuntime().wrap(function _callee14$(_context14) {
1129
+ while (1) switch (_context14.prev = _context14.next) {
1115
1130
  case 0:
1116
- _context13.next = 2;
1131
+ _context14.next = 2;
1117
1132
  return checkoutModule.roundAmountAsync(amount);
1118
1133
  case 2:
1119
- res = _context13.sent;
1120
- return _context13.abrupt("return", res);
1134
+ res = _context14.sent;
1135
+ return _context14.abrupt("return", res);
1121
1136
  case 4:
1122
1137
  case "end":
1123
- return _context13.stop();
1138
+ return _context14.stop();
1124
1139
  }
1125
- }, _callee13);
1140
+ }, _callee14);
1126
1141
  }));
1127
- return function roundingFunction(_x13) {
1128
- return _ref16.apply(this, arguments);
1142
+ return function roundingFunction(_x14) {
1143
+ return _ref17.apply(this, arguments);
1129
1144
  };
1130
1145
  }();
1146
+
1147
+ // 处理PaymentModal区域的点击事件
1148
+ var handleModalClick = useCallback(function (event) {
1149
+ // 关闭所有Toast
1150
+ closeAllPaymentResultToasts();
1151
+ }, []);
1131
1152
  return /*#__PURE__*/React.createElement("div", {
1132
1153
  ref: checkoutRef,
1154
+ onClick: handleModalClick,
1133
1155
  style: _objectSpread(_objectSpread({}, checkoutStyles.container), {}, {
1134
1156
  maxHeight: dynamicMaxHeight
1135
1157
  })
1158
+ }, /*#__PURE__*/React.createElement("div", {
1159
+ style: {
1160
+ padding: '12px 16px',
1161
+ border: '1px solid #d0d5dd',
1162
+ borderRadius: 8
1163
+ }
1136
1164
  }, /*#__PURE__*/React.createElement(SearchAndClientModule, _extends({
1137
1165
  onClientChange: function onClientChange() {
1138
1166
  // 同步记录客户信息变更情况
@@ -1146,7 +1174,7 @@ var PaymentContent = /*#__PURE__*/forwardRef(function (_ref, ref) {
1146
1174
  ref: walletPassRef,
1147
1175
  paymentItems: paymentItems,
1148
1176
  onSelectChange: handleSelectWalletChange
1149
- }), /*#__PURE__*/React.createElement(AmountSummary, {
1177
+ })), /*#__PURE__*/React.createElement(AmountSummary, {
1150
1178
  amountSymbol: state.amountSymbol,
1151
1179
  orderInfo: orderInfo || undefined,
1152
1180
  cartData: cartData,
@@ -1158,6 +1186,7 @@ var PaymentContent = /*#__PURE__*/forwardRef(function (_ref, ref) {
1158
1186
  clientInfo: state === null || state === void 0 || (_state$client3 = state.client) === null || _state$client3 === void 0 ? void 0 : _state$client3.value,
1159
1187
  onAmountChange: handleAmountChange,
1160
1188
  onDepositStatusChange: handleDepositStatusChange,
1189
+ onBalanceDueAmountClick: handleButtonClick,
1161
1190
  onConfirm: handleWalletPassConfirmPay,
1162
1191
  totalAmount: totalAmount
1163
1192
  }), /*#__PURE__*/React.createElement("div", {
@@ -1189,7 +1218,8 @@ var PaymentContent = /*#__PURE__*/forwardRef(function (_ref, ref) {
1189
1218
  paymentMethods: paymentMethods,
1190
1219
  customAmount: customAmount,
1191
1220
  title: paymentOptionsTitle,
1192
- disabled: isOrderFree
1221
+ disabled: isOrderFree,
1222
+ showCashPayment: showCashPayment
1193
1223
  })), moduleConfig.showAdditionalModule && /*#__PURE__*/React.createElement("div", {
1194
1224
  className: showCashPayment ? '' : 'additional-module-container',
1195
1225
  style: showCashPayment ? {
@@ -1253,20 +1283,20 @@ var PaymentContent = /*#__PURE__*/forwardRef(function (_ref, ref) {
1253
1283
 
1254
1284
  // 主要的支付弹窗组件
1255
1285
 
1256
- var PaymentModal = function PaymentModal(_ref17) {
1286
+ var PaymentModal = function PaymentModal(_ref18) {
1257
1287
  var _context$appHelper$ut, _context$appHelper$ut2, _context$appHelper$ut3, _context$appHelper$ut4, _context$appHelper;
1258
- var open = _ref17.open,
1259
- data = _ref17.data,
1260
- callback = _ref17.callback,
1261
- onClose = _ref17.onClose,
1262
- dispatch = _ref17.dispatch,
1263
- state = _ref17.state;
1288
+ var open = _ref18.open,
1289
+ data = _ref18.data,
1290
+ callback = _ref18.callback,
1291
+ onClose = _ref18.onClose,
1292
+ dispatch = _ref18.dispatch,
1293
+ state = _ref18.state;
1264
1294
  var context = useEngineContext();
1265
1295
  locales.init(checkoutLocales, ((_context$appHelper$ut = context.appHelper.utils) === null || _context$appHelper$ut === void 0 || (_context$appHelper$ut2 = _context$appHelper$ut.getApp) === null || _context$appHelper$ut2 === void 0 || (_context$appHelper$ut2 = _context$appHelper$ut2.call(_context$appHelper$ut)) === null || _context$appHelper$ut2 === void 0 || (_context$appHelper$ut2 = _context$appHelper$ut2.locales) === null || _context$appHelper$ut2 === void 0 || (_context$appHelper$ut3 = _context$appHelper$ut2.getLocale) === null || _context$appHelper$ut3 === void 0 ? void 0 : _context$appHelper$ut3.call(_context$appHelper$ut2)) || ((_context$appHelper$ut4 = context.appHelper.utils) === null || _context$appHelper$ut4 === void 0 || (_context$appHelper$ut4 = _context$appHelper$ut4.storage) === null || _context$appHelper$ut4 === void 0 ? void 0 : _context$appHelper$ut4.get('umi_locale')) || 'en');
1266
- var _ref18 = (context === null || context === void 0 || (_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 ? void 0 : _context$appHelper.utils) || {},
1267
- pisellos = _ref18.pisellos,
1268
- getData = _ref18.getData,
1269
- interaction = _ref18.interaction;
1296
+ var _ref19 = (context === null || context === void 0 || (_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 ? void 0 : _context$appHelper.utils) || {},
1297
+ pisellos = _ref19.pisellos,
1298
+ getData = _ref19.getData,
1299
+ interaction = _ref19.interaction;
1270
1300
  var _useState21 = useState(null),
1271
1301
  _useState22 = _slicedToArray(_useState21, 2),
1272
1302
  orderInfo = _useState22[0],
@@ -1293,10 +1323,10 @@ var PaymentModal = function PaymentModal(_ref17) {
1293
1323
 
1294
1324
  // 重试处理函数(逻辑由用户自己实现)
1295
1325
  var handleRetry = /*#__PURE__*/function () {
1296
- var _ref19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
1326
+ var _ref20 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
1297
1327
  var checkoutModule, res;
1298
- return _regeneratorRuntime().wrap(function _callee14$(_context14) {
1299
- while (1) switch (_context14.prev = _context14.next) {
1328
+ return _regeneratorRuntime().wrap(function _callee15$(_context15) {
1329
+ while (1) switch (_context15.prev = _context15.next) {
1300
1330
  case 0:
1301
1331
  // TODO: 用户在这里实现重试逻辑
1302
1332
  // console.log('重试按钮被点击,请在这里添加重试逻辑');
@@ -1308,24 +1338,26 @@ var PaymentModal = function PaymentModal(_ref17) {
1308
1338
  // // 失败保持弹窗打开,允许继续重试
1309
1339
  // }
1310
1340
  checkoutModule = pisellos === null || pisellos === void 0 ? void 0 : pisellos.getModule('checkout');
1311
- _context14.next = 3;
1341
+ _context15.next = 3;
1312
1342
  return checkoutModule === null || checkoutModule === void 0 ? void 0 : checkoutModule.manualSyncOrderAsync();
1313
1343
  case 3:
1314
- res = _context14.sent;
1344
+ res = _context15.sent;
1315
1345
  console.log(res);
1316
- if (res.success) {
1317
- setShowRetryModal(false);
1318
- showSuccessToast === null || showSuccessToast === void 0 || showSuccessToast(res);
1319
- // setShowRetryModal(false);
1346
+ if (!res.success) {
1347
+ _context15.next = 9;
1348
+ break;
1320
1349
  }
1321
- case 6:
1350
+ setShowRetryModal(false);
1351
+ _context15.next = 9;
1352
+ return showSuccessToast === null || showSuccessToast === void 0 ? void 0 : showSuccessToast(res);
1353
+ case 9:
1322
1354
  case "end":
1323
- return _context14.stop();
1355
+ return _context15.stop();
1324
1356
  }
1325
- }, _callee14);
1357
+ }, _callee15);
1326
1358
  }));
1327
1359
  return function handleRetry() {
1328
- return _ref19.apply(this, arguments);
1360
+ return _ref20.apply(this, arguments);
1329
1361
  };
1330
1362
  }();
1331
1363
 
@@ -1349,6 +1381,53 @@ var PaymentModal = function PaymentModal(_ref17) {
1349
1381
  };
1350
1382
  }, []);
1351
1383
 
1384
+ // 初始化 tillButton 数据
1385
+ useEffect(function () {
1386
+ var _interaction$utils3;
1387
+ var initTillButtonData = /*#__PURE__*/function () {
1388
+ var _ref21 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
1389
+ var _interaction$utils2, _interaction$utils2$a, tillButtonData;
1390
+ return _regeneratorRuntime().wrap(function _callee16$(_context16) {
1391
+ while (1) switch (_context16.prev = _context16.next) {
1392
+ case 0:
1393
+ console.log('准备获取tillButton数据');
1394
+ _context16.prev = 1;
1395
+ _context16.next = 4;
1396
+ return interaction === null || interaction === void 0 || (_interaction$utils2 = interaction.utils) === null || _interaction$utils2 === void 0 || (_interaction$utils2$a = _interaction$utils2.asyncDataManager) === null || _interaction$utils2$a === void 0 ? void 0 : _interaction$utils2$a.call(_interaction$utils2, {
1397
+ module: 'get',
1398
+ key: 'till_button'
1399
+ });
1400
+ case 4:
1401
+ tillButtonData = _context16.sent;
1402
+ console.log('获取tillButton数据成功', tillButtonData);
1403
+ if (tillButtonData) {
1404
+ // 设置 tillButton 数据到全局 Toast 管理器
1405
+ setTillButton(tillButtonData);
1406
+ console.log('PaymentModal: tillButton data set successfully', tillButtonData);
1407
+ }
1408
+ _context16.next = 12;
1409
+ break;
1410
+ case 9:
1411
+ _context16.prev = 9;
1412
+ _context16.t0 = _context16["catch"](1);
1413
+ console.error('PaymentModal: Failed to get till_button from asyncDataManager:', _context16.t0);
1414
+ case 12:
1415
+ case "end":
1416
+ return _context16.stop();
1417
+ }
1418
+ }, _callee16, null, [[1, 9]]);
1419
+ }));
1420
+ return function initTillButtonData() {
1421
+ return _ref21.apply(this, arguments);
1422
+ };
1423
+ }();
1424
+
1425
+ // 只在 PaymentModal 打开时初始化 tillButton 数据
1426
+ if (interaction !== null && interaction !== void 0 && (_interaction$utils3 = interaction.utils) !== null && _interaction$utils3 !== void 0 && _interaction$utils3.asyncDataManager) {
1427
+ initTillButtonData();
1428
+ }
1429
+ }, [interaction]);
1430
+
1352
1431
  // 计算元素最大高度: window.innerHeight * 0.9 - 72
1353
1432
  var dynamicMaxHeight = useMemo(function () {
1354
1433
  if (windowHeight === 0) return '600px'; // 默认值
@@ -1387,13 +1466,13 @@ var PaymentModal = function PaymentModal(_ref17) {
1387
1466
 
1388
1467
  // 订单备注相关处理函数
1389
1468
  var handleNoteConfirm = /*#__PURE__*/function () {
1390
- var _ref20 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(noteValue) {
1469
+ var _ref22 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(noteValue) {
1391
1470
  var checkoutModule, orderId, _checkoutModule$editO, _checkoutModule, _checkoutModule$updat;
1392
- return _regeneratorRuntime().wrap(function _callee15$(_context15) {
1393
- while (1) switch (_context15.prev = _context15.next) {
1471
+ return _regeneratorRuntime().wrap(function _callee17$(_context17) {
1472
+ while (1) switch (_context17.prev = _context17.next) {
1394
1473
  case 0:
1395
1474
  if (!(noteModalSource === 'payment-result-toast')) {
1396
- _context15.next = 6;
1475
+ _context17.next = 6;
1397
1476
  break;
1398
1477
  }
1399
1478
  checkoutModule = pisellos === null || pisellos === void 0 ? void 0 : pisellos.getModule('checkout');
@@ -1404,15 +1483,15 @@ var PaymentModal = function PaymentModal(_ref17) {
1404
1483
  Toast === null || Toast === void 0 || Toast.success(locales.getText('pisell2.checkout.order-note.updated-successfully'));
1405
1484
  }
1406
1485
  setNoteModalOpen(false);
1407
- return _context15.abrupt("return");
1486
+ return _context17.abrupt("return");
1408
1487
  case 6:
1409
- _context15.prev = 6;
1488
+ _context17.prev = 6;
1410
1489
  _checkoutModule = pisellos === null || pisellos === void 0 ? void 0 : pisellos.getModule('checkout');
1411
1490
  if (!_checkoutModule) {
1412
- _context15.next = 13;
1491
+ _context17.next = 13;
1413
1492
  break;
1414
1493
  }
1415
- _context15.next = 11;
1494
+ _context17.next = 11;
1416
1495
  return (_checkoutModule$updat = _checkoutModule.updateOrderNoteAsync) === null || _checkoutModule$updat === void 0 ? void 0 : _checkoutModule$updat.call(_checkoutModule, noteValue);
1417
1496
  case 11:
1418
1497
  setOrderNote(noteValue);
@@ -1438,38 +1517,38 @@ var PaymentModal = function PaymentModal(_ref17) {
1438
1517
  console.log('Note added from payment content');
1439
1518
  // 在支付内容中打开的,执行常规处理逻辑
1440
1519
  }
1441
- _context15.next = 21;
1520
+ _context17.next = 21;
1442
1521
  break;
1443
1522
  case 17:
1444
- _context15.prev = 17;
1445
- _context15.t0 = _context15["catch"](6);
1446
- console.error('Failed to update order note:', _context15.t0);
1523
+ _context17.prev = 17;
1524
+ _context17.t0 = _context17["catch"](6);
1525
+ console.error('Failed to update order note:', _context17.t0);
1447
1526
  Toast === null || Toast === void 0 || Toast.error(locales.getText('pisell2.checkout.order-note.update-failed'));
1448
1527
  case 21:
1449
1528
  setNoteModalOpen(false);
1450
1529
  case 22:
1451
1530
  case "end":
1452
- return _context15.stop();
1531
+ return _context17.stop();
1453
1532
  }
1454
- }, _callee15, null, [[6, 17]]);
1533
+ }, _callee17, null, [[6, 17]]);
1455
1534
  }));
1456
- return function handleNoteConfirm(_x14) {
1457
- return _ref20.apply(this, arguments);
1535
+ return function handleNoteConfirm(_x15) {
1536
+ return _ref22.apply(this, arguments);
1458
1537
  };
1459
1538
  }();
1460
1539
  var handleNoteDelete = /*#__PURE__*/function () {
1461
- var _ref21 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
1540
+ var _ref23 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18() {
1462
1541
  var checkoutModule, _checkoutModule$updat2;
1463
- return _regeneratorRuntime().wrap(function _callee16$(_context16) {
1464
- while (1) switch (_context16.prev = _context16.next) {
1542
+ return _regeneratorRuntime().wrap(function _callee18$(_context18) {
1543
+ while (1) switch (_context18.prev = _context18.next) {
1465
1544
  case 0:
1466
- _context16.prev = 0;
1545
+ _context18.prev = 0;
1467
1546
  checkoutModule = pisellos === null || pisellos === void 0 ? void 0 : pisellos.getModule('checkout');
1468
1547
  if (!checkoutModule) {
1469
- _context16.next = 7;
1548
+ _context18.next = 7;
1470
1549
  break;
1471
1550
  }
1472
- _context16.next = 5;
1551
+ _context18.next = 5;
1473
1552
  return (_checkoutModule$updat2 = checkoutModule.updateOrderNoteAsync) === null || _checkoutModule$updat2 === void 0 ? void 0 : _checkoutModule$updat2.call(checkoutModule, '');
1474
1553
  case 5:
1475
1554
  setOrderNote('');
@@ -1485,23 +1564,23 @@ var PaymentModal = function PaymentModal(_ref17) {
1485
1564
  }
1486
1565
  });
1487
1566
  }
1488
- _context16.next = 14;
1567
+ _context18.next = 14;
1489
1568
  break;
1490
1569
  case 10:
1491
- _context16.prev = 10;
1492
- _context16.t0 = _context16["catch"](0);
1493
- console.error('Failed to delete order note:', _context16.t0);
1570
+ _context18.prev = 10;
1571
+ _context18.t0 = _context18["catch"](0);
1572
+ console.error('Failed to delete order note:', _context18.t0);
1494
1573
  Toast === null || Toast === void 0 || Toast.error(locales.getText('pisell2.checkout.order-note.delete-failed'));
1495
1574
  case 14:
1496
1575
  setNoteModalOpen(false);
1497
1576
  case 15:
1498
1577
  case "end":
1499
- return _context16.stop();
1578
+ return _context18.stop();
1500
1579
  }
1501
- }, _callee16, null, [[0, 10]]);
1580
+ }, _callee18, null, [[0, 10]]);
1502
1581
  }));
1503
1582
  return function handleNoteDelete() {
1504
- return _ref21.apply(this, arguments);
1583
+ return _ref23.apply(this, arguments);
1505
1584
  };
1506
1585
  }();
1507
1586
  var handleNoteCancel = function handleNoteCancel() {
@@ -1519,8 +1598,173 @@ var PaymentModal = function PaymentModal(_ref17) {
1519
1598
 
1520
1599
  // 处理从支付结果toast打开订单备注的事件
1521
1600
  var handleOrderNoteClickFromToast = function handleOrderNoteClickFromToast() {
1522
- setNoteModalSource('payment-result-toast');
1523
- setNoteModalOpen(true);
1601
+ var _context$appHelper$ut5, _context$appHelper$ut6, _context$appHelper$ut7, _context$appHelper$ut8;
1602
+ // 创建独立的Modal容器
1603
+ var modalContainer = document.createElement('div');
1604
+ document.body.appendChild(modalContainer);
1605
+
1606
+ // 获取当前的Toast实例,如果不可用则创建全局Toast函数
1607
+ var showToast = function showToast(type, message) {
1608
+ if (Toast && Toast[type]) {
1609
+ Toast[type](message);
1610
+ } else {
1611
+ // 如果Toast不可用,尝试使用全局的消息提示
1612
+ if (type === 'success') {
1613
+ console.log('✅ Success:', message);
1614
+ // 可以在这里添加其他全局提示方式
1615
+ } else {
1616
+ console.error('❌ Error:', message);
1617
+ // 可以在这里添加其他全局提示方式
1618
+ }
1619
+ }
1620
+ };
1621
+ var handleNoteConfirm = /*#__PURE__*/function () {
1622
+ var _ref24 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(noteValue) {
1623
+ var checkoutModule, orderId, _checkoutModule$editO2;
1624
+ return _regeneratorRuntime().wrap(function _callee19$(_context19) {
1625
+ while (1) switch (_context19.prev = _context19.next) {
1626
+ case 0:
1627
+ _context19.prev = 0;
1628
+ checkoutModule = pisellos === null || pisellos === void 0 ? void 0 : pisellos.getModule('checkout');
1629
+ orderId = checkoutModule === null || checkoutModule === void 0 ? void 0 : checkoutModule.getCurrentOrderId();
1630
+ if (!(checkoutModule && orderId)) {
1631
+ _context19.next = 8;
1632
+ break;
1633
+ }
1634
+ _context19.next = 6;
1635
+ return (_checkoutModule$editO2 = checkoutModule.editOrderNoteByOrderIdAsync) === null || _checkoutModule$editO2 === void 0 ? void 0 : _checkoutModule$editO2.call(checkoutModule, orderId, noteValue);
1636
+ case 6:
1637
+ setOrderNote(noteValue);
1638
+ showToast('success', locales.getText('pisell2.checkout.order-note.updated-successfully'));
1639
+ case 8:
1640
+ _context19.next = 14;
1641
+ break;
1642
+ case 10:
1643
+ _context19.prev = 10;
1644
+ _context19.t0 = _context19["catch"](0);
1645
+ console.error('Failed to update order note:', _context19.t0);
1646
+ showToast('error', locales.getText('pisell2.checkout.order-note.update-failed'));
1647
+ case 14:
1648
+ // 清理DOM
1649
+ ReactDOM.unmountComponentAtNode(modalContainer);
1650
+ if (document.body.contains(modalContainer)) {
1651
+ document.body.removeChild(modalContainer);
1652
+ }
1653
+ case 16:
1654
+ case "end":
1655
+ return _context19.stop();
1656
+ }
1657
+ }, _callee19, null, [[0, 10]]);
1658
+ }));
1659
+ return function handleNoteConfirm(_x16) {
1660
+ return _ref24.apply(this, arguments);
1661
+ };
1662
+ }();
1663
+ var handleNoteDelete = /*#__PURE__*/function () {
1664
+ var _ref25 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20() {
1665
+ var checkoutModule, orderId, _checkoutModule$editO3;
1666
+ return _regeneratorRuntime().wrap(function _callee20$(_context20) {
1667
+ while (1) switch (_context20.prev = _context20.next) {
1668
+ case 0:
1669
+ _context20.prev = 0;
1670
+ checkoutModule = pisellos === null || pisellos === void 0 ? void 0 : pisellos.getModule('checkout');
1671
+ orderId = checkoutModule === null || checkoutModule === void 0 ? void 0 : checkoutModule.getCurrentOrderId();
1672
+ if (!(checkoutModule && orderId)) {
1673
+ _context20.next = 8;
1674
+ break;
1675
+ }
1676
+ _context20.next = 6;
1677
+ return (_checkoutModule$editO3 = checkoutModule.editOrderNoteByOrderIdAsync) === null || _checkoutModule$editO3 === void 0 ? void 0 : _checkoutModule$editO3.call(checkoutModule, orderId, '');
1678
+ case 6:
1679
+ setOrderNote('');
1680
+ showToast('success', locales.getText('pisell2.checkout.order-note.deleted-successfully'));
1681
+ case 8:
1682
+ _context20.next = 14;
1683
+ break;
1684
+ case 10:
1685
+ _context20.prev = 10;
1686
+ _context20.t0 = _context20["catch"](0);
1687
+ console.error('Failed to delete order note:', _context20.t0);
1688
+ showToast('error', locales.getText('pisell2.checkout.order-note.delete-failed'));
1689
+ case 14:
1690
+ // 清理DOM
1691
+ ReactDOM.unmountComponentAtNode(modalContainer);
1692
+ if (document.body.contains(modalContainer)) {
1693
+ document.body.removeChild(modalContainer);
1694
+ }
1695
+ case 16:
1696
+ case "end":
1697
+ return _context20.stop();
1698
+ }
1699
+ }, _callee20, null, [[0, 10]]);
1700
+ }));
1701
+ return function handleNoteDelete() {
1702
+ return _ref25.apply(this, arguments);
1703
+ };
1704
+ }();
1705
+ var handleNoteCancel = function handleNoteCancel() {
1706
+ // 清理DOM
1707
+ ReactDOM.unmountComponentAtNode(modalContainer);
1708
+ if (document.body.contains(modalContainer)) {
1709
+ document.body.removeChild(modalContainer);
1710
+ }
1711
+ };
1712
+
1713
+ // 获取当前语言环境
1714
+ var currentLocale = ((_context$appHelper$ut5 = context.appHelper.utils) === null || _context$appHelper$ut5 === void 0 || (_context$appHelper$ut6 = _context$appHelper$ut5.getApp) === null || _context$appHelper$ut6 === void 0 || (_context$appHelper$ut6 = _context$appHelper$ut6.call(_context$appHelper$ut5)) === null || _context$appHelper$ut6 === void 0 || (_context$appHelper$ut6 = _context$appHelper$ut6.locales) === null || _context$appHelper$ut6 === void 0 || (_context$appHelper$ut7 = _context$appHelper$ut6.getLocale) === null || _context$appHelper$ut7 === void 0 ? void 0 : _context$appHelper$ut7.call(_context$appHelper$ut6)) || ((_context$appHelper$ut8 = context.appHelper.utils) === null || _context$appHelper$ut8 === void 0 || (_context$appHelper$ut8 = _context$appHelper$ut8.storage) === null || _context$appHelper$ut8 === void 0 ? void 0 : _context$appHelper$ut8.get('umi_locale')) || 'en';
1715
+
1716
+ // 创建一个临时的Context Provider来传递正确的语言环境
1717
+ var EngineContextProvider = function EngineContextProvider(_ref26) {
1718
+ var _context$engine;
1719
+ var children = _ref26.children;
1720
+ var tempEngineContext = _objectSpread(_objectSpread({}, context), {}, {
1721
+ engine: _objectSpread(_objectSpread({}, context.engine), {}, {
1722
+ props: _objectSpread(_objectSpread({}, (_context$engine = context.engine) === null || _context$engine === void 0 ? void 0 : _context$engine.props), {}, {
1723
+ locale: currentLocale
1724
+ })
1725
+ })
1726
+ });
1727
+
1728
+ // 创建临时的Context
1729
+ var TempContext = /*#__PURE__*/React.createContext(tempEngineContext);
1730
+
1731
+ // 临时设置全局上下文,确保useEngineContext能够获取到正确的语言环境
1732
+ var originalContext = window.__injectedContext;
1733
+ window.__injectedContext = tempEngineContext;
1734
+ React.useEffect(function () {
1735
+ return function () {
1736
+ // 组件卸载时恢复原始上下文
1737
+ window.__injectedContext = originalContext;
1738
+ };
1739
+ }, []);
1740
+ return /*#__PURE__*/React.createElement(TempContext.Provider, {
1741
+ value: tempEngineContext
1742
+ }, children);
1743
+ };
1744
+ var orderNote = '';
1745
+ try {
1746
+ var checkoutModule = pisellos === null || pisellos === void 0 ? void 0 : pisellos.getModule('checkout');
1747
+ orderNote = checkoutModule.getOrderNote();
1748
+ } catch (error) {
1749
+ console.warn('Failed to get initial custom amount:', error);
1750
+ }
1751
+
1752
+ // 渲染NoteModal
1753
+ ReactDOM.render( /*#__PURE__*/React.createElement(EngineContextProvider, null, /*#__PURE__*/React.createElement(ConfigProvider, {
1754
+ prefixCls: "pisell-lowcode",
1755
+ theme: {
1756
+ token: {
1757
+ colorPrimary: '#7F56DA'
1758
+ }
1759
+ }
1760
+ }, /*#__PURE__*/React.createElement(NoteModal, {
1761
+ open: true,
1762
+ title: locales.getText('pisell2.text.add-order-notes'),
1763
+ value: orderNote,
1764
+ onConfirm: handleNoteConfirm,
1765
+ onDelete: handleNoteDelete,
1766
+ onCancel: handleNoteCancel
1767
+ }))), modalContainer);
1524
1768
  };
1525
1769
 
1526
1770
  // 创建本地翻译函数,优先使用 checkout 语言包
@@ -1550,14 +1794,19 @@ var PaymentModal = function PaymentModal(_ref17) {
1550
1794
  currentPaymentResultRef.current = result;
1551
1795
  };
1552
1796
 
1553
- // 创建toast关闭时的统一回调函数
1797
+ // 创建toast关闭时的统一回调函数 - 现在只处理支付完成回调,不自动关闭Modal
1554
1798
  var handleToastClose = function handleToastClose() {
1555
- console.log('PaymentModal - Toast closed, executing callbacks and closing modal');
1799
+ console.log('PaymentModal - Toast closed, executing payment completion callback');
1556
1800
  // 调用支付完成回调
1557
1801
  if (currentPaymentResultRef.current) {
1558
1802
  callback === null || callback === void 0 || callback(currentPaymentResultRef.current);
1559
1803
  }
1560
- // 关闭整个支付弹窗
1804
+ // 不再自动关闭PaymentModal,让两个弹窗独立管理
1805
+ };
1806
+
1807
+ // 专门用于关闭PaymentModal的函数
1808
+ var handleModalClose = function handleModalClose() {
1809
+ console.log('PaymentModal - Modal closing independently');
1561
1810
  onClose === null || onClose === void 0 || onClose(true);
1562
1811
  };
1563
1812
  var handlePaymentCancel = function handlePaymentCancel(reset) {
@@ -1567,33 +1816,42 @@ var PaymentModal = function PaymentModal(_ref17) {
1567
1816
  });
1568
1817
  var checkout = pisellos.getModule('checkout');
1569
1818
  checkout.cancelCurrentOrderAsync();
1819
+ // 不关闭PaymentResultToast,让它独立存在
1570
1820
  onClose === null || onClose === void 0 || onClose(reset || false);
1571
1821
  };
1572
1822
 
1573
1823
  // 自定义头部组件
1574
1824
  var CustomHeader = function CustomHeader() {
1575
1825
  return /*#__PURE__*/React.createElement("div", {
1576
- style: {
1577
- display: 'flex',
1578
- alignItems: 'center',
1579
- width: '100%',
1580
- position: 'relative'
1581
- }
1826
+ className: "payment-modal-custom-header"
1582
1827
  }, /*#__PURE__*/React.createElement("div", {
1583
- style: {
1584
- display: 'flex',
1585
- alignItems: 'center',
1586
- gap: '12px',
1587
- flex: '0 0 auto'
1828
+ className: "header__left"
1829
+ }, /*#__PURE__*/React.createElement(Button, {
1830
+ icon: /*#__PURE__*/React.createElement(Icon, {
1831
+ type: "pisell2-arrow-left",
1832
+ size: 24
1833
+ }),
1834
+ size: "small",
1835
+ type: "text",
1836
+ onClick: function onClick() {
1837
+ var checkout = pisellos.getModule('checkout');
1838
+ if (checkout.isCurrentOrderSynced()) {
1839
+ handlePaymentCancel(true);
1840
+ } else {
1841
+ handlePaymentCancel(false);
1842
+ }
1588
1843
  }
1589
- }, /*#__PURE__*/React.createElement(DeviceIconGroup, null)), /*#__PURE__*/React.createElement("div", {
1590
- style: {
1591
- position: 'absolute',
1592
- left: '50%',
1593
- transform: 'translateX(-50%)',
1594
- fontWeight: '500'
1844
+ })), /*#__PURE__*/React.createElement("div", {
1845
+ className: "header__center"
1846
+ }, translation('order.total'), "\uFF1A", formatCurrency(totalAmount, state === null || state === void 0 ? void 0 : state.amountSymbol)), /*#__PURE__*/React.createElement("div", {
1847
+ className: "header__right"
1848
+ }, /*#__PURE__*/React.createElement(Button, {
1849
+ size: "small",
1850
+ type: "link",
1851
+ onClick: function onClick() {
1852
+ return handlePaymentCancel(true);
1595
1853
  }
1596
- }, translation('order.total'), "\uFF1A", formatCurrency(totalAmount, state === null || state === void 0 ? void 0 : state.amountSymbol)));
1854
+ }, locales.getText('order.start-new-order'))));
1597
1855
  };
1598
1856
 
1599
1857
  // 初始化订单备注
@@ -1610,23 +1868,23 @@ var PaymentModal = function PaymentModal(_ref17) {
1610
1868
  // 初始化checkout数据
1611
1869
  useEffect(function () {
1612
1870
  var initCheckoutData = /*#__PURE__*/function () {
1613
- var _ref22 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
1871
+ var _ref27 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22() {
1614
1872
  var checkout, _newData$subtotal_inf, shop_wallet_pass_id, newData, _orderInfo2, _data$subtotal_info, _orderInfo3;
1615
- return _regeneratorRuntime().wrap(function _callee17$(_context17) {
1616
- while (1) switch (_context17.prev = _context17.next) {
1873
+ return _regeneratorRuntime().wrap(function _callee22$(_context22) {
1874
+ while (1) switch (_context22.prev = _context22.next) {
1617
1875
  case 0:
1618
- _context17.prev = 0;
1876
+ _context22.prev = 0;
1619
1877
  // 获取 checkout 模块并处理订单数据
1620
1878
  checkout = pisellos === null || pisellos === void 0 ? void 0 : pisellos.getModule('checkout');
1621
1879
  if (!(checkout && data && !isLocalOrderCreated.current)) {
1622
- _context17.next = 18;
1880
+ _context22.next = 18;
1623
1881
  break;
1624
1882
  }
1625
1883
  isLocalOrderCreated.current = true;
1626
- _context17.next = 6;
1884
+ _context22.next = 6;
1627
1885
  return getShopWalletPassId(interaction);
1628
1886
  case 6:
1629
- shop_wallet_pass_id = _context17.sent;
1887
+ shop_wallet_pass_id = _context22.sent;
1630
1888
  checkout.setOtherParams({
1631
1889
  is_price_include_tax: getData('is_price_include_tax'),
1632
1890
  tax_rate: getData('tax_rate') || '10',
@@ -1641,7 +1899,7 @@ var PaymentModal = function PaymentModal(_ref17) {
1641
1899
  });
1642
1900
  newData = cloneDeep(data); // setTotalAmount(newData.total.expectAmount);
1643
1901
  // 先往 checkout 解决方案推送一条 local 数据
1644
- _context17.next = 11;
1902
+ _context22.next = 11;
1645
1903
  return checkout.createLocalOrderAsync({
1646
1904
  orderData: newData.order_info,
1647
1905
  cartSummary: (_newData$subtotal_inf = newData.subtotal_info) === null || _newData$subtotal_inf === void 0 ? void 0 : _newData$subtotal_inf.subTotalList,
@@ -1665,123 +1923,152 @@ var PaymentModal = function PaymentModal(_ref17) {
1665
1923
  unsubscribeRef.current = undefined;
1666
1924
  }
1667
1925
  // 监听订单同步完成,同步完成后显示订单完成 toast,关闭当前弹窗
1668
- unsubscribeRef.current = checkout.core.effects.on('checkout:onOrderSynced', function (data) {
1669
- var _data$response, _responseData$payment2;
1670
- // 获取支付状态和相关信息
1671
- var responseData = (_data$response = data.response) === null || _data$response === void 0 ? void 0 : _data$response.data;
1672
- // 获取支付状态
1673
- var paymentStatus = responseData === null || responseData === void 0 ? void 0 : responseData.payment_status;
1674
- if (data.isManual) return;
1675
- handlePaymentComplete(data);
1676
- // 如果正在显示现金支付 toast,跳过自动关闭逻辑
1677
- if (showingCashToastRef.current) {
1678
- return;
1679
- }
1680
-
1681
- // 获取订单总金额
1682
- var orderTotalAmount = Number((responseData === null || responseData === void 0 ? void 0 : responseData.total_amount) || 0);
1683
- var gapAmount = Number((responseData === null || responseData === void 0 ? void 0 : responseData.amount_gap) || 0);
1684
- var currentChangeGivenAmount = Number((responseData === null || responseData === void 0 || (_responseData$payment2 = responseData.payment_info) === null || _responseData$payment2 === void 0 ? void 0 : _responseData$payment2.current_change_given_amount) || 0);
1685
- // const changeDue = Number(responseData?.amount_gap || 0);
1686
- // 获取失败原因
1687
- var failureReason = responseData === null || responseData === void 0 ? void 0 : responseData.failure_reason;
1688
-
1689
- // 根据支付状态弹出对应的支付结果toast
1690
- if (paymentStatus) {
1691
- // 打印订单完整信息
1692
- console.log('print_order_onOrderSynced>>>>', responseData);
1693
- logger === null || logger === void 0 || logger.addLog({
1694
- type: 'info',
1695
- title: 'print_order_onOrderSynced',
1696
- metadata: {
1697
- responseData: responseData
1698
- }
1699
- });
1700
- try {
1701
- var _responseData$payment3;
1702
- var params = {
1703
- type: '99',
1704
- // 打印订单全部信息
1705
- data: {
1706
- order_id: responseData.order_id,
1707
- machine_code_print_info: responseData === null || responseData === void 0 ? void 0 : responseData.machine_code_print_info,
1708
- small_ticket_data: responseData === null || responseData === void 0 || (_responseData$payment3 = responseData.payment_info) === null || _responseData$payment3 === void 0 ? void 0 : _responseData$payment3.small_ticket_data,
1709
- machine_code_print_info_v2: responseData === null || responseData === void 0 ? void 0 : responseData.machine_code_print_info_v2
1710
- }
1711
- };
1712
- console.log('print_order_onOrderSynced_params>>>>', params);
1713
- logger === null || logger === void 0 || logger.addLog({
1714
- type: 'info',
1715
- title: 'print_order_onOrderSynced_params',
1716
- metadata: {
1717
- params: params
1718
- }
1719
- });
1720
- nativePrint(params, function (res) {
1721
- console.log('print_order_onOrderSynced_res>>>>', res);
1722
- logger === null || logger === void 0 || logger.addLog({
1723
- type: 'info',
1724
- title: 'print_order_onOrderSynced_res',
1725
- metadata: {
1726
- res: res
1926
+ unsubscribeRef.current = checkout.core.effects.on('checkout:onOrderSynced', /*#__PURE__*/function () {
1927
+ var _ref28 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(data) {
1928
+ var _data$response, _responseData$payment2;
1929
+ var responseData, paymentStatus, orderTotalAmount, gapAmount, currentChangeGivenAmount, failureReason, _interaction$utils4, _interaction$utils4$a, _responseData$payment3, params, statusClassName, autoCloseConfig, enabledAutoPrint, paymentResult;
1930
+ return _regeneratorRuntime().wrap(function _callee21$(_context21) {
1931
+ while (1) switch (_context21.prev = _context21.next) {
1932
+ case 0:
1933
+ // 获取支付状态和相关信息
1934
+ responseData = (_data$response = data.response) === null || _data$response === void 0 ? void 0 : _data$response.data; // 获取支付状态
1935
+ paymentStatus = responseData === null || responseData === void 0 ? void 0 : responseData.payment_status;
1936
+ if (!data.isManual) {
1937
+ _context21.next = 4;
1938
+ break;
1939
+ }
1940
+ return _context21.abrupt("return");
1941
+ case 4:
1942
+ handlePaymentComplete(data);
1943
+ // 如果正在显示现金支付 toast,跳过自动关闭逻辑
1944
+ if (!showingCashToastRef.current) {
1945
+ _context21.next = 7;
1946
+ break;
1947
+ }
1948
+ return _context21.abrupt("return");
1949
+ case 7:
1950
+ // 获取订单总金额
1951
+ orderTotalAmount = Number((responseData === null || responseData === void 0 ? void 0 : responseData.total_amount) || 0);
1952
+ gapAmount = Number((responseData === null || responseData === void 0 ? void 0 : responseData.amount_gap) || 0);
1953
+ currentChangeGivenAmount = Number((responseData === null || responseData === void 0 || (_responseData$payment2 = responseData.payment_info) === null || _responseData$payment2 === void 0 ? void 0 : _responseData$payment2.current_change_given_amount) || 0); // const changeDue = Number(responseData?.amount_gap || 0);
1954
+ // 获取失败原因
1955
+ failureReason = responseData === null || responseData === void 0 ? void 0 : responseData.failure_reason; // 根据支付状态弹出对应的支付结果toast
1956
+ if (!paymentStatus) {
1957
+ _context21.next = 27;
1958
+ break;
1959
+ }
1960
+ // 打印订单完整信息
1961
+ console.log('print_order_onOrderSynced>>>>', responseData);
1962
+ logger === null || logger === void 0 || logger.addLog({
1963
+ type: 'info',
1964
+ title: 'print_order_onOrderSynced',
1965
+ metadata: {
1966
+ responseData: responseData
1967
+ }
1968
+ });
1969
+ try {
1970
+ params = {
1971
+ type: '99',
1972
+ // 打印订单全部信息
1973
+ data: {
1974
+ order_id: responseData.order_id,
1975
+ machine_code_print_info: responseData === null || responseData === void 0 ? void 0 : responseData.machine_code_print_info,
1976
+ small_ticket_data: responseData === null || responseData === void 0 || (_responseData$payment3 = responseData.payment_info) === null || _responseData$payment3 === void 0 ? void 0 : _responseData$payment3.small_ticket_data,
1977
+ machine_code_print_info_v2: responseData === null || responseData === void 0 ? void 0 : responseData.machine_code_print_info_v2
1978
+ }
1979
+ };
1980
+ console.log('print_order_onOrderSynced_params>>>>', params);
1981
+ logger === null || logger === void 0 || logger.addLog({
1982
+ type: 'info',
1983
+ title: 'print_order_onOrderSynced_params',
1984
+ metadata: {
1985
+ params: params
1986
+ }
1987
+ });
1988
+ nativePrint(params, function (res) {
1989
+ console.log('print_order_onOrderSynced_res>>>>', res);
1990
+ logger === null || logger === void 0 || logger.addLog({
1991
+ type: 'info',
1992
+ title: 'print_order_onOrderSynced_res',
1993
+ metadata: {
1994
+ res: res
1995
+ }
1996
+ });
1997
+ });
1998
+ } catch (error) {
1999
+ console.error('print_order_onOrderSynced_error>>>>', error);
2000
+ logger === null || logger === void 0 || logger.addLog({
2001
+ type: 'info',
2002
+ title: 'print_order_onOrderSynced_error',
2003
+ metadata: {
2004
+ error: error
2005
+ }
2006
+ });
1727
2007
  }
1728
- });
1729
- });
1730
- } catch (error) {
1731
- console.error('print_order_onOrderSynced_error>>>>', error);
1732
- logger === null || logger === void 0 || logger.addLog({
1733
- type: 'info',
1734
- title: 'print_order_onOrderSynced_error',
1735
- metadata: {
1736
- error: error
1737
- }
1738
- });
1739
- }
1740
-
1741
- // 确定支付状态
1742
- var statusClassName = calculateStatusClassName(paymentStatus);
1743
- var autoCloseConfig = calculateAutoCloseConfig(paymentStatus, !!currentChangeGivenAmount);
1744
2008
 
1745
- // 根据支付状态展示不同的 toast
1746
- displayPaymentResultToast({
1747
- paymentStatus: paymentStatus,
1748
- orderTotalAmount: orderTotalAmount,
1749
- gapAmount: paymentStatus === 'partially_paid' ? gapAmount : currentChangeGivenAmount,
1750
- failureReason: failureReason,
1751
- autoCloseConfig: autoCloseConfig,
1752
- actionButtons: generateActionButtons(paymentStatus)
1753
- }, paymentResultToastConfig);
2009
+ // 确定支付状态
2010
+ statusClassName = calculateStatusClassName(paymentStatus);
2011
+ autoCloseConfig = calculateAutoCloseConfig(paymentStatus, !!currentChangeGivenAmount);
2012
+ _context21.next = 19;
2013
+ return interaction === null || interaction === void 0 || (_interaction$utils4 = interaction.utils) === null || _interaction$utils4 === void 0 || (_interaction$utils4$a = _interaction$utils4.asyncDataManager) === null || _interaction$utils4$a === void 0 ? void 0 : _interaction$utils4$a.call(_interaction$utils4, {
2014
+ module: 'get',
2015
+ key: 'auto_print_receipt'
2016
+ });
2017
+ case 19:
2018
+ enabledAutoPrint = _context21.sent;
2019
+ _context21.next = 22;
2020
+ return displayPaymentResultToast({
2021
+ paymentStatus: paymentStatus,
2022
+ orderTotalAmount: orderTotalAmount,
2023
+ gapAmount: paymentStatus === 'partially_paid' ? gapAmount : currentChangeGivenAmount,
2024
+ failureReason: failureReason,
2025
+ autoCloseConfig: autoCloseConfig,
2026
+ actionButtons: generateActionButtons(paymentStatus, enabledAutoPrint)
2027
+ }, paymentResultToastConfig);
2028
+ case 22:
2029
+ // 当支付状态为 paid 时,关闭 paymentModal
2030
+ if (paymentStatus === 'paid') {
2031
+ handleModalClose();
2032
+ }
1754
2033
 
1755
- // 将支付结果信息传递给回调处理
1756
- var paymentResult = _objectSpread(_objectSpread({}, data), {}, {
1757
- toastInfo: {
1758
- status: paymentStatus,
1759
- amount: orderTotalAmount,
1760
- gapAmount: currentChangeGivenAmount,
1761
- failureReason: failureReason
2034
+ // 将支付结果信息传递给回调处理
2035
+ paymentResult = _objectSpread(_objectSpread({}, data), {}, {
2036
+ toastInfo: {
2037
+ status: paymentStatus,
2038
+ amount: orderTotalAmount,
2039
+ gapAmount: currentChangeGivenAmount,
2040
+ failureReason: failureReason
2041
+ }
2042
+ });
2043
+ handlePaymentComplete(paymentResult);
2044
+ _context21.next = 28;
2045
+ break;
2046
+ case 27:
2047
+ handlePaymentComplete(data);
2048
+ case 28:
2049
+ case "end":
2050
+ return _context21.stop();
1762
2051
  }
1763
- });
1764
- handlePaymentComplete(paymentResult);
1765
- } else {
1766
- handlePaymentComplete(data);
1767
- }
1768
- // 可以在这里执行同步完成后的业务逻辑
1769
- // 比如:通知其他系统、更新UI状态等
1770
- });
1771
- _context17.next = 29;
2052
+ }, _callee21);
2053
+ }));
2054
+ return function (_x17) {
2055
+ return _ref28.apply(this, arguments);
2056
+ };
2057
+ }());
2058
+ _context22.next = 29;
1772
2059
  break;
1773
2060
  case 18:
1774
2061
  if (!isLocalOrderCreated.current) {
1775
- _context17.next = 29;
2062
+ _context22.next = 29;
1776
2063
  break;
1777
2064
  }
1778
2065
  // // 如果本地订单已创建,这时候还更新了 data,则需要销毁当前的订单数据,然后更新新的订单数据了
1779
2066
  console.log('🔄 PaymentModal: data changed, updating checkout data...');
1780
2067
  isLocalOrderCreated.current = false;
1781
- _context17.next = 23;
2068
+ _context22.next = 23;
1782
2069
  return checkout.cancelCurrentOrderAsync();
1783
2070
  case 23:
1784
- _context17.next = 25;
2071
+ _context22.next = 25;
1785
2072
  return checkout.createLocalOrderAsync({
1786
2073
  orderData: data === null || data === void 0 ? void 0 : data.order_info,
1787
2074
  cartSummary: data === null || data === void 0 || (_data$subtotal_info = data.subtotal_info) === null || _data$subtotal_info === void 0 ? void 0 : _data$subtotal_info.subTotalList,
@@ -1797,27 +2084,27 @@ var PaymentModal = function PaymentModal(_ref17) {
1797
2084
  setOrderInfo(_orderInfo3);
1798
2085
  isLocalOrderCreated.current = true;
1799
2086
  case 29:
1800
- _context17.next = 35;
2087
+ _context22.next = 35;
1801
2088
  break;
1802
2089
  case 31:
1803
- _context17.prev = 31;
1804
- _context17.t0 = _context17["catch"](0);
1805
- console.error('Failed to initialize checkout data:', _context17.t0);
2090
+ _context22.prev = 31;
2091
+ _context22.t0 = _context22["catch"](0);
2092
+ console.error('Failed to initialize checkout data:', _context22.t0);
1806
2093
  logger === null || logger === void 0 || logger.addLog({
1807
2094
  type: 'error',
1808
2095
  title: 'Failed to initialize checkout data',
1809
2096
  metadata: {
1810
- error: _context17.t0
2097
+ error: _context22.t0
1811
2098
  }
1812
2099
  });
1813
2100
  case 35:
1814
2101
  case "end":
1815
- return _context17.stop();
2102
+ return _context22.stop();
1816
2103
  }
1817
- }, _callee17, null, [[0, 31]]);
2104
+ }, _callee22, null, [[0, 31]]);
1818
2105
  }));
1819
2106
  return function initCheckoutData() {
1820
- return _ref22.apply(this, arguments);
2107
+ return _ref27.apply(this, arguments);
1821
2108
  };
1822
2109
  }();
1823
2110
  if (data) {
@@ -1846,36 +2133,35 @@ var PaymentModal = function PaymentModal(_ref17) {
1846
2133
  };
1847
2134
 
1848
2135
  // 支付结果弹窗按钮生成函数
1849
- var generateActionButtons = function generateActionButtons(paymentStatus) {
2136
+ var generateActionButtons = function generateActionButtons(paymentStatus, enabledAutoPrint) {
1850
2137
  var getClassName = function getClassName(suffix) {
1851
2138
  return "payment-result-toast-".concat(suffix);
1852
2139
  };
1853
2140
 
1854
2141
  // 通用回调函数
1855
2142
  var handleDetailsClick = /*#__PURE__*/function () {
1856
- var _ref23 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18() {
2143
+ var _ref29 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23() {
1857
2144
  var _context$appHelper2;
1858
- var _context$appHelper$ut5, isTerminal, isWebPos, checkout, orderId;
1859
- return _regeneratorRuntime().wrap(function _callee18$(_context18) {
1860
- while (1) switch (_context18.prev = _context18.next) {
2145
+ var _context$appHelper$ut9, isTerminal, isWebPos, checkout, orderId;
2146
+ return _regeneratorRuntime().wrap(function _callee23$(_context23) {
2147
+ while (1) switch (_context23.prev = _context23.next) {
1861
2148
  case 0:
1862
2149
  setTimeout(function () {
1863
- // 关闭支付结果toast
2150
+ // 主动关闭PaymentResultToast
1864
2151
  closePaymentResultToast();
1865
- // 关闭PaymentModal
1866
- handleToastClose();
2152
+ // 不关闭PaymentModal,保持其打开状态
1867
2153
  }, 0);
1868
- _context$appHelper$ut5 = (_context$appHelper2 = context.appHelper) === null || _context$appHelper2 === void 0 ? void 0 : _context$appHelper2.utils, isTerminal = _context$appHelper$ut5.isTerminal, isWebPos = _context$appHelper$ut5.isWebPos;
2154
+ _context$appHelper$ut9 = (_context$appHelper2 = context.appHelper) === null || _context$appHelper2 === void 0 ? void 0 : _context$appHelper2.utils, isTerminal = _context$appHelper$ut9.isTerminal, isWebPos = _context$appHelper$ut9.isWebPos;
1869
2155
  if (!(isTerminal !== null && isTerminal !== void 0 && isTerminal())) {
1870
- _context18.next = 8;
2156
+ _context23.next = 8;
1871
2157
  break;
1872
2158
  }
1873
2159
  checkout = pisellos.getModule('checkout');
1874
- _context18.next = 6;
2160
+ _context23.next = 6;
1875
2161
  return checkout.getCurrentOrderId();
1876
2162
  case 6:
1877
- orderId = _context18.sent;
1878
- return _context18.abrupt("return", interaction.utils.postMessageToApp({
2163
+ orderId = _context23.sent;
2164
+ return _context23.abrupt("return", interaction.utils.postMessageToApp({
1879
2165
  module: 'booking',
1880
2166
  key: 'view_order',
1881
2167
  data: {
@@ -1885,50 +2171,55 @@ var PaymentModal = function PaymentModal(_ref17) {
1885
2171
  }));
1886
2172
  case 8:
1887
2173
  case "end":
1888
- return _context18.stop();
2174
+ return _context23.stop();
1889
2175
  }
1890
- }, _callee18);
2176
+ }, _callee23);
1891
2177
  }));
1892
2178
  return function handleDetailsClick() {
1893
- return _ref23.apply(this, arguments);
2179
+ return _ref29.apply(this, arguments);
1894
2180
  };
1895
2181
  }();
1896
2182
  var handlePrintReceiptClick = /*#__PURE__*/function () {
1897
- var _ref24 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19() {
2183
+ var _ref30 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
1898
2184
  var checkoutModule, data, isSynced, orderId, params;
1899
- return _regeneratorRuntime().wrap(function _callee19$(_context19) {
1900
- while (1) switch (_context19.prev = _context19.next) {
2185
+ return _regeneratorRuntime().wrap(function _callee24$(_context24) {
2186
+ while (1) switch (_context24.prev = _context24.next) {
1901
2187
  case 0:
2188
+ setTimeout(function () {
2189
+ // 主动关闭PaymentResultToast
2190
+ closePaymentResultToast();
2191
+ // 不关闭PaymentModal,保持其打开状态
2192
+ }, 0);
1902
2193
  checkoutModule = pisellos === null || pisellos === void 0 ? void 0 : pisellos.getModule('checkout');
1903
2194
  if (checkoutModule) {
1904
- _context19.next = 3;
2195
+ _context24.next = 4;
1905
2196
  break;
1906
2197
  }
1907
- return _context19.abrupt("return");
1908
- case 3:
1909
- _context19.next = 5;
2198
+ return _context24.abrupt("return");
2199
+ case 4:
2200
+ _context24.next = 6;
1910
2201
  return checkoutModule.isCurrentOrderSynced();
1911
- case 5:
1912
- isSynced = _context19.sent;
2202
+ case 6:
2203
+ isSynced = _context24.sent;
1913
2204
  if (isSynced) {
1914
- _context19.next = 12;
2205
+ _context24.next = 13;
1915
2206
  break;
1916
2207
  }
1917
- _context19.next = 9;
2208
+ _context24.next = 10;
1918
2209
  return checkoutModule.manualSyncOrderAsync();
1919
- case 9:
1920
- data = _context19.sent;
1921
- _context19.next = 16;
2210
+ case 10:
2211
+ data = _context24.sent;
2212
+ _context24.next = 17;
1922
2213
  break;
1923
- case 12:
1924
- _context19.next = 14;
2214
+ case 13:
2215
+ _context24.next = 15;
1925
2216
  return checkoutModule.getCurrentOrderId();
1926
- case 14:
1927
- orderId = _context19.sent;
2217
+ case 15:
2218
+ orderId = _context24.sent;
1928
2219
  data = {
1929
2220
  orderId: orderId
1930
2221
  };
1931
- case 16:
2222
+ case 17:
1932
2223
  // data.orderId 就是订单号,可以用来打印小票
1933
2224
  if (data.orderId) {
1934
2225
  params = {
@@ -1948,14 +2239,14 @@ var PaymentModal = function PaymentModal(_ref17) {
1948
2239
  console.error('handleButtonClick_print-receipt_error>>>>', error);
1949
2240
  }
1950
2241
  }
1951
- case 17:
2242
+ case 18:
1952
2243
  case "end":
1953
- return _context19.stop();
2244
+ return _context24.stop();
1954
2245
  }
1955
- }, _callee19);
2246
+ }, _callee24);
1956
2247
  }));
1957
2248
  return function handlePrintReceiptClick() {
1958
- return _ref24.apply(this, arguments);
2249
+ return _ref30.apply(this, arguments);
1959
2250
  };
1960
2251
  }();
1961
2252
  var handleRetryClick = function handleRetryClick() {
@@ -1982,6 +2273,9 @@ var PaymentModal = function PaymentModal(_ref17) {
1982
2273
  closePaymentResultToast();
1983
2274
  };
1984
2275
  var handleOrderNoteClick = function handleOrderNoteClick() {
2276
+ setTimeout(function () {
2277
+ closePaymentResultToast();
2278
+ }, 0);
1985
2279
  console.log(locales.getText('payment.result.actions.orderNoteClicked'));
1986
2280
  // 从支付结果toast打开NoteModal,使用传入的回调函数
1987
2281
  if (handleOrderNoteClickFromToast) {
@@ -1995,7 +2289,7 @@ var PaymentModal = function PaymentModal(_ref17) {
1995
2289
  switch (paymentStatus) {
1996
2290
  case 'paid':
1997
2291
  // 成功状态,显示查看详情和打印收据按钮
1998
- return [[{
2292
+ return [[enabledAutoPrint ? {
1999
2293
  id: 'details',
2000
2294
  buttonProps: {
2001
2295
  className: getClassName('action-button'),
@@ -2005,7 +2299,7 @@ var PaymentModal = function PaymentModal(_ref17) {
2005
2299
  }),
2006
2300
  children: locales.getText('payment.result.details')
2007
2301
  }
2008
- }, {
2302
+ } : {
2009
2303
  id: 'print',
2010
2304
  buttonProps: {
2011
2305
  className: getClassName('action-button'),
@@ -2036,20 +2330,14 @@ var PaymentModal = function PaymentModal(_ref17) {
2036
2330
  case 'partially_paid':
2037
2331
  // 部分支付状态
2038
2332
  return [[{
2039
- id: 'saveAsPartialPaid',
2040
- buttonProps: {
2041
- className: getClassName('action-button'),
2042
- onClick: handleSaveAsPartialPaidClick,
2043
- children: locales.getText('payment.result.saveAsPartialPaid')
2044
- }
2045
- }, {
2046
- id: 'continuePayment',
2333
+ id: 'details',
2047
2334
  buttonProps: {
2048
2335
  className: getClassName('action-button'),
2049
- onClick: function onClick() {
2050
- closePaymentResultToast();
2051
- },
2052
- children: locales.getText('payment.result.continuePayment')
2336
+ onClick: handleDetailsClick,
2337
+ icon: /*#__PURE__*/React.createElement(FileCheck02, {
2338
+ className: getClassName('action-icon')
2339
+ }),
2340
+ children: locales.getText('payment.result.details')
2053
2341
  }
2054
2342
  }, {
2055
2343
  id: 'more',
@@ -2178,7 +2466,7 @@ var PaymentModal = function PaymentModal(_ref17) {
2178
2466
 
2179
2467
  // 使用新的工具方法创建showSuccessToast函数
2180
2468
  var showSuccessToast = createShowSuccessToast(paymentResultToastConfig, generateActionButtons);
2181
- return /*#__PURE__*/React.createElement(PaymentResultToastProvider, null, /*#__PURE__*/React.createElement(PisellContainer
2469
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(PisellContainer
2182
2470
  // open={open}
2183
2471
  , {
2184
2472
  renderType: "modal",
@@ -2192,10 +2480,9 @@ var PaymentModal = function PaymentModal(_ref17) {
2192
2480
  destroyOnClose: false,
2193
2481
  maskClosable: false,
2194
2482
  footer: null,
2195
- closeIcon: null,
2483
+ closeIcon: false,
2196
2484
  wrapClassName: "payment-modal-wrapper ".concat(!actualShowCashPayment ? 'no-cash-payment' : ''),
2197
2485
  size: 'large',
2198
- headerDivider: false,
2199
2486
  style: {
2200
2487
  height: 'auto'
2201
2488
  },
@@ -2203,7 +2490,7 @@ var PaymentModal = function PaymentModal(_ref17) {
2203
2490
  maxHeight: '100%',
2204
2491
  // 使用100%基于父元素,而不是视口的90%
2205
2492
  overflowY: 'auto',
2206
- padding: 0,
2493
+ padding: 16,
2207
2494
  display: 'flex',
2208
2495
  flexDirection: 'column'
2209
2496
  }