@pisell/pisellos 2.2.244 → 2.2.245

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 (317) hide show
  1. package/dist/model/strategy/adapter/promotion/evaluator.js +3 -2
  2. package/dist/model/strategy/adapter/promotion/index.js +0 -9
  3. package/dist/model/strategy/adapter/walletPass/utils.js +7 -4
  4. package/dist/modules/BookingContext/index.d.ts +48 -0
  5. package/dist/modules/BookingContext/index.js +566 -0
  6. package/dist/modules/BookingContext/types.d.ts +102 -0
  7. package/dist/modules/BookingContext/types.js +51 -0
  8. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +16 -0
  9. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +284 -0
  10. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +8 -0
  11. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +145 -0
  12. package/dist/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +76 -0
  13. package/dist/modules/BookingContext/utils/cacheItemToBookingInput.js +218 -0
  14. package/dist/modules/BookingContext/utils/flexible.d.ts +28 -0
  15. package/dist/modules/BookingContext/utils/flexible.js +56 -0
  16. package/dist/modules/BookingContext/utils/formatResourceList.d.ts +8 -0
  17. package/dist/modules/BookingContext/utils/formatResourceList.js +38 -0
  18. package/dist/modules/BookingContext/utils/index.d.ts +11 -0
  19. package/dist/modules/BookingContext/utils/index.js +11 -0
  20. package/dist/modules/BookingContext/utils/noResource.d.ts +13 -0
  21. package/dist/modules/BookingContext/utils/noResource.js +77 -0
  22. package/dist/modules/BookingContext/utils/orderLineDisplay.d.ts +1 -0
  23. package/dist/modules/BookingContext/utils/orderLineDisplay.js +36 -0
  24. package/dist/modules/BookingContext/utils/productExtend.d.ts +72 -0
  25. package/dist/modules/BookingContext/utils/productExtend.js +339 -0
  26. package/dist/modules/BookingContext/utils/resourceErrors.d.ts +41 -0
  27. package/dist/modules/BookingContext/utils/resourceErrors.js +74 -0
  28. package/dist/modules/BookingContext/utils/resourceSelection.d.ts +7 -0
  29. package/dist/modules/BookingContext/utils/resourceSelection.js +24 -0
  30. package/dist/modules/BookingContext/utils/resources.d.ts +80 -0
  31. package/dist/modules/BookingContext/utils/resources.js +486 -0
  32. package/dist/modules/BookingContext/utils/serviceTimes.d.ts +55 -0
  33. package/dist/modules/BookingContext/utils/serviceTimes.js +151 -0
  34. package/dist/modules/BookingContext/utils/timeSlices.d.ts +42 -0
  35. package/dist/modules/BookingContext/utils/timeSlices.js +100 -0
  36. package/dist/modules/Cart/utils/cartProduct.js +24 -3
  37. package/dist/modules/Cart/utils/changePrice.js +11 -11
  38. package/dist/modules/Customer/index.d.ts +20 -0
  39. package/dist/modules/Customer/index.js +172 -83
  40. package/dist/modules/Customer/types.d.ts +2 -0
  41. package/dist/modules/Discount/index.d.ts +1 -1
  42. package/dist/modules/Discount/index.js +13 -6
  43. package/dist/modules/Discount/types.d.ts +1 -0
  44. package/dist/modules/OpenData/index.d.ts +8 -0
  45. package/dist/modules/OpenData/index.js +37 -17
  46. package/dist/modules/Order/index.d.ts +275 -19
  47. package/dist/modules/Order/index.js +3493 -809
  48. package/dist/modules/Order/types.d.ts +286 -31
  49. package/dist/modules/Order/types.js +38 -0
  50. package/dist/modules/Order/utils/manualProductDiscount.d.ts +106 -0
  51. package/dist/modules/Order/utils/manualProductDiscount.js +210 -0
  52. package/dist/modules/Order/utils.d.ts +147 -5
  53. package/dist/modules/Order/utils.js +750 -104
  54. package/dist/modules/Payment/index.d.ts +10 -13
  55. package/dist/modules/Payment/index.js +467 -837
  56. package/dist/modules/Payment/types.d.ts +2 -0
  57. package/dist/modules/Payment/utils.js +2 -1
  58. package/dist/modules/Payment/walletpass.js +41 -25
  59. package/dist/modules/ProductList/index.d.ts +16 -12
  60. package/dist/modules/ProductList/index.js +133 -59
  61. package/dist/modules/ProductList/types.d.ts +14 -0
  62. package/dist/modules/Quotation/index.d.ts +0 -1
  63. package/dist/modules/Quotation/index.js +25 -22
  64. package/dist/modules/Rules/index.d.ts +4 -0
  65. package/dist/modules/Rules/index.js +97 -70
  66. package/dist/modules/Rules/types.d.ts +1 -0
  67. package/dist/modules/SalesSummary/index.d.ts +8 -25
  68. package/dist/modules/SalesSummary/index.js +86 -35
  69. package/dist/modules/SalesSummary/types.d.ts +4 -1
  70. package/dist/modules/SalesSummary/utils.d.ts +2 -25
  71. package/dist/modules/SalesSummary/utils.js +794 -162
  72. package/dist/modules/Schedule/index.d.ts +7 -0
  73. package/dist/modules/Schedule/index.js +24 -2
  74. package/dist/modules/Summary/index.js +4 -3
  75. package/dist/modules/SurchargeList/index.d.ts +16 -0
  76. package/dist/modules/SurchargeList/index.js +162 -0
  77. package/dist/modules/SurchargeList/types.d.ts +11 -0
  78. package/dist/modules/SurchargeList/types.js +1 -0
  79. package/dist/modules/index.d.ts +2 -0
  80. package/dist/modules/index.js +3 -1
  81. package/dist/plugins/request.d.ts +1 -0
  82. package/dist/server/index.d.ts +204 -1
  83. package/dist/server/index.js +3654 -922
  84. package/dist/server/modules/index.d.ts +2 -0
  85. package/dist/server/modules/index.js +2 -0
  86. package/dist/server/modules/order/index.d.ts +120 -3
  87. package/dist/server/modules/order/index.js +1758 -448
  88. package/dist/server/modules/order/types.d.ts +32 -3
  89. package/dist/server/modules/order/types.js +8 -0
  90. package/dist/server/modules/order/utils/filterBookings.js +26 -3
  91. package/dist/server/modules/order/utils/filterOrders.js +23 -8
  92. package/dist/server/modules/payment/index.d.ts +28 -0
  93. package/dist/server/modules/payment/index.js +305 -0
  94. package/dist/server/modules/payment/types.d.ts +9 -0
  95. package/dist/server/modules/payment/types.js +1 -0
  96. package/dist/server/modules/products/index.d.ts +34 -7
  97. package/dist/server/modules/products/index.js +631 -317
  98. package/dist/server/modules/resource/index.d.ts +2 -0
  99. package/dist/server/modules/resource/index.js +29 -3
  100. package/dist/server/modules/schedule/index.d.ts +4 -4
  101. package/dist/server/modules/schedule/index.js +111 -88
  102. package/dist/server/test.json +713 -0
  103. package/dist/server/utils/small-ticket.d.ts +71 -0
  104. package/dist/server/utils/small-ticket.js +840 -0
  105. package/dist/solution/BaseSales/index.d.ts +133 -10
  106. package/dist/solution/BaseSales/index.js +1950 -447
  107. package/dist/solution/BaseSales/types.d.ts +82 -6
  108. package/dist/solution/BaseSales/types.js +5 -4
  109. package/dist/solution/BaseSales/utils/cartPromotion.d.ts +287 -0
  110. package/dist/solution/BaseSales/utils/cartPromotion.js +1438 -0
  111. package/dist/solution/BaseSales/utils/quotationPrice.d.ts +7 -0
  112. package/dist/solution/BaseSales/utils/quotationPrice.js +237 -0
  113. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +1 -0
  114. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +105 -24
  115. package/dist/solution/BaseSales/utils.d.ts +1 -1
  116. package/dist/solution/BaseSales/utils.js +62 -21
  117. package/dist/solution/BookingByStep/index.d.ts +1 -1
  118. package/dist/solution/BookingTicket/index.d.ts +271 -11
  119. package/dist/solution/BookingTicket/index.js +1777 -242
  120. package/dist/solution/BookingTicket/types.d.ts +118 -1
  121. package/dist/solution/BookingTicket/types.js +41 -2
  122. package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +117 -0
  123. package/dist/solution/BookingTicket/utils/addProductDecision.js +346 -0
  124. package/dist/solution/BookingTicket/utils/addTimeAvailability.d.ts +35 -0
  125. package/dist/solution/BookingTicket/utils/addTimeAvailability.js +95 -0
  126. package/dist/solution/BookingTicket/utils/bookingStatus.d.ts +40 -0
  127. package/dist/solution/BookingTicket/utils/bookingStatus.js +70 -0
  128. package/dist/solution/BookingTicket/utils/cartView.d.ts +9 -1
  129. package/dist/solution/BookingTicket/utils/cartView.js +94 -7
  130. package/dist/solution/BookingTicket/utils/exampleData.d.ts +123 -0
  131. package/dist/solution/BookingTicket/utils/exampleData.js +183 -0
  132. package/dist/solution/BookingTicket/utils/resolveBestAddTimePlan.d.ts +185 -0
  133. package/dist/solution/BookingTicket/utils/resolveBestAddTimePlan.js +438 -0
  134. package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +36 -0
  135. package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +400 -0
  136. package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +32 -0
  137. package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.js +56 -0
  138. package/dist/solution/BookingTicket/utils/scan/index.d.ts +5 -0
  139. package/dist/solution/BookingTicket/utils/scan/index.js +20 -8
  140. package/dist/solution/BookingTicket/utils/scan/scanProductValues.d.ts +21 -0
  141. package/dist/solution/BookingTicket/utils/scan/scanProductValues.js +150 -0
  142. package/dist/solution/BookingTicket/utils/sessionCatalogStale.d.ts +23 -0
  143. package/dist/solution/BookingTicket/utils/sessionCatalogStale.js +78 -0
  144. package/dist/solution/Checkout/index.d.ts +1 -0
  145. package/dist/solution/Checkout/index.js +10 -9
  146. package/dist/solution/RegisterAndLogin/config.js +2 -10
  147. package/dist/solution/ScanOrder/index.d.ts +9 -3
  148. package/dist/solution/ScanOrder/index.js +241 -134
  149. package/dist/solution/ScanOrder/types.d.ts +9 -5
  150. package/dist/solution/ScanOrder/types.js +2 -3
  151. package/dist/solution/ScanOrder/utils.d.ts +1 -1
  152. package/dist/solution/ScanOrder/utils.js +84 -22
  153. package/dist/solution/VenueBooking/index.d.ts +5 -2
  154. package/dist/solution/VenueBooking/index.js +110 -59
  155. package/dist/solution/VenueBooking/sales-section-4-annotated.json +0 -2
  156. package/dist/solution/VenueBooking/utils/slotMerge.d.ts +4 -0
  157. package/dist/solution/VenueBooking/utils/slotMerge.js +10 -0
  158. package/dist/types/index.d.ts +10 -0
  159. package/lib/model/strategy/adapter/promotion/evaluator.js +2 -1
  160. package/lib/model/strategy/adapter/promotion/index.js +49 -0
  161. package/lib/model/strategy/adapter/walletPass/utils.js +3 -2
  162. package/lib/modules/BookingContext/index.d.ts +48 -0
  163. package/lib/modules/BookingContext/index.js +368 -0
  164. package/lib/modules/BookingContext/types.d.ts +102 -0
  165. package/lib/modules/BookingContext/types.js +34 -0
  166. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +16 -0
  167. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +276 -0
  168. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +8 -0
  169. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +151 -0
  170. package/lib/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +76 -0
  171. package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +201 -0
  172. package/lib/modules/BookingContext/utils/flexible.d.ts +28 -0
  173. package/lib/modules/BookingContext/utils/flexible.js +80 -0
  174. package/lib/modules/BookingContext/utils/formatResourceList.d.ts +8 -0
  175. package/lib/modules/BookingContext/utils/formatResourceList.js +50 -0
  176. package/lib/modules/BookingContext/utils/index.d.ts +11 -0
  177. package/lib/modules/BookingContext/utils/index.js +43 -0
  178. package/lib/modules/BookingContext/utils/noResource.d.ts +13 -0
  179. package/lib/modules/BookingContext/utils/noResource.js +90 -0
  180. package/lib/modules/BookingContext/utils/orderLineDisplay.d.ts +1 -0
  181. package/lib/modules/BookingContext/utils/orderLineDisplay.js +56 -0
  182. package/lib/modules/BookingContext/utils/productExtend.d.ts +72 -0
  183. package/lib/modules/BookingContext/utils/productExtend.js +283 -0
  184. package/lib/modules/BookingContext/utils/resourceErrors.d.ts +41 -0
  185. package/lib/modules/BookingContext/utils/resourceErrors.js +80 -0
  186. package/lib/modules/BookingContext/utils/resourceSelection.d.ts +7 -0
  187. package/lib/modules/BookingContext/utils/resourceSelection.js +46 -0
  188. package/lib/modules/BookingContext/utils/resources.d.ts +80 -0
  189. package/lib/modules/BookingContext/utils/resources.js +377 -0
  190. package/lib/modules/BookingContext/utils/serviceTimes.d.ts +55 -0
  191. package/lib/modules/BookingContext/utils/serviceTimes.js +162 -0
  192. package/lib/modules/BookingContext/utils/timeSlices.d.ts +42 -0
  193. package/lib/modules/BookingContext/utils/timeSlices.js +124 -0
  194. package/lib/modules/Cart/utils/cartProduct.js +20 -3
  195. package/lib/modules/Cart/utils/changePrice.js +12 -20
  196. package/lib/modules/Customer/index.d.ts +20 -0
  197. package/lib/modules/Customer/index.js +64 -11
  198. package/lib/modules/Customer/types.d.ts +2 -0
  199. package/lib/modules/Discount/index.d.ts +1 -1
  200. package/lib/modules/Discount/index.js +9 -1
  201. package/lib/modules/Discount/types.d.ts +1 -0
  202. package/lib/modules/OpenData/index.d.ts +8 -0
  203. package/lib/modules/OpenData/index.js +19 -5
  204. package/lib/modules/Order/index.d.ts +275 -19
  205. package/lib/modules/Order/index.js +2245 -336
  206. package/lib/modules/Order/types.d.ts +286 -31
  207. package/lib/modules/Order/types.js +1 -0
  208. package/lib/modules/Order/utils/manualProductDiscount.d.ts +106 -0
  209. package/lib/modules/Order/utils/manualProductDiscount.js +206 -0
  210. package/lib/modules/Order/utils.d.ts +147 -5
  211. package/lib/modules/Order/utils.js +615 -46
  212. package/lib/modules/Payment/index.d.ts +10 -13
  213. package/lib/modules/Payment/index.js +18 -150
  214. package/lib/modules/Payment/types.d.ts +2 -0
  215. package/lib/modules/Payment/utils.js +2 -1
  216. package/lib/modules/Payment/walletpass.js +16 -3
  217. package/lib/modules/ProductList/index.d.ts +16 -12
  218. package/lib/modules/ProductList/index.js +41 -4
  219. package/lib/modules/ProductList/types.d.ts +14 -0
  220. package/lib/modules/Quotation/index.d.ts +0 -1
  221. package/lib/modules/Quotation/index.js +19 -16
  222. package/lib/modules/Rules/index.d.ts +4 -0
  223. package/lib/modules/Rules/index.js +137 -120
  224. package/lib/modules/Rules/types.d.ts +1 -0
  225. package/lib/modules/SalesSummary/index.d.ts +8 -25
  226. package/lib/modules/SalesSummary/index.js +30 -4
  227. package/lib/modules/SalesSummary/types.d.ts +4 -1
  228. package/lib/modules/SalesSummary/utils.d.ts +2 -25
  229. package/lib/modules/SalesSummary/utils.js +645 -91
  230. package/lib/modules/Schedule/index.d.ts +7 -0
  231. package/lib/modules/Schedule/index.js +17 -1
  232. package/lib/modules/Summary/index.js +5 -4
  233. package/lib/modules/SurchargeList/index.d.ts +16 -0
  234. package/lib/modules/SurchargeList/index.js +89 -0
  235. package/lib/modules/SurchargeList/types.d.ts +11 -0
  236. package/lib/modules/SurchargeList/types.js +17 -0
  237. package/lib/modules/index.d.ts +2 -0
  238. package/lib/modules/index.js +5 -1
  239. package/lib/plugins/request.d.ts +1 -0
  240. package/lib/server/index.d.ts +204 -1
  241. package/lib/server/index.js +1891 -59
  242. package/lib/server/modules/index.d.ts +2 -0
  243. package/lib/server/modules/index.js +3 -0
  244. package/lib/server/modules/order/index.d.ts +120 -3
  245. package/lib/server/modules/order/index.js +883 -94
  246. package/lib/server/modules/order/types.d.ts +32 -3
  247. package/lib/server/modules/order/utils/filterBookings.js +24 -5
  248. package/lib/server/modules/order/utils/filterOrders.js +15 -6
  249. package/lib/server/modules/payment/index.d.ts +28 -0
  250. package/lib/server/modules/payment/index.js +192 -0
  251. package/lib/server/modules/payment/types.d.ts +9 -0
  252. package/lib/server/modules/payment/types.js +17 -0
  253. package/lib/server/modules/products/index.d.ts +34 -7
  254. package/lib/server/modules/products/index.js +189 -54
  255. package/lib/server/modules/resource/index.d.ts +2 -0
  256. package/lib/server/modules/resource/index.js +27 -3
  257. package/lib/server/modules/schedule/index.d.ts +4 -4
  258. package/lib/server/modules/schedule/index.js +47 -40
  259. package/lib/server/test.json +713 -0
  260. package/lib/server/utils/small-ticket.d.ts +71 -0
  261. package/lib/server/utils/small-ticket.js +800 -0
  262. package/lib/solution/BaseSales/index.d.ts +133 -10
  263. package/lib/solution/BaseSales/index.js +1111 -63
  264. package/lib/solution/BaseSales/types.d.ts +82 -6
  265. package/lib/solution/BaseSales/types.js +3 -1
  266. package/lib/solution/BaseSales/utils/cartPromotion.d.ts +287 -0
  267. package/lib/solution/BaseSales/utils/cartPromotion.js +992 -0
  268. package/lib/solution/BaseSales/utils/quotationPrice.d.ts +7 -0
  269. package/lib/solution/BaseSales/utils/quotationPrice.js +277 -0
  270. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +1 -0
  271. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +106 -18
  272. package/lib/solution/BaseSales/utils.d.ts +1 -1
  273. package/lib/solution/BaseSales/utils.js +54 -10
  274. package/lib/solution/BookingByStep/index.d.ts +1 -1
  275. package/lib/solution/BookingTicket/index.d.ts +271 -11
  276. package/lib/solution/BookingTicket/index.js +922 -29
  277. package/lib/solution/BookingTicket/types.d.ts +118 -1
  278. package/lib/solution/BookingTicket/types.js +11 -0
  279. package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +117 -0
  280. package/lib/solution/BookingTicket/utils/addProductDecision.js +318 -0
  281. package/lib/solution/BookingTicket/utils/addTimeAvailability.d.ts +35 -0
  282. package/lib/solution/BookingTicket/utils/addTimeAvailability.js +125 -0
  283. package/lib/solution/BookingTicket/utils/bookingStatus.d.ts +40 -0
  284. package/lib/solution/BookingTicket/utils/bookingStatus.js +44 -2
  285. package/lib/solution/BookingTicket/utils/cartView.d.ts +9 -1
  286. package/lib/solution/BookingTicket/utils/cartView.js +61 -6
  287. package/lib/solution/BookingTicket/utils/exampleData.d.ts +123 -0
  288. package/lib/solution/BookingTicket/utils/exampleData.js +0 -0
  289. package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.d.ts +185 -0
  290. package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.js +254 -0
  291. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +36 -0
  292. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +169 -0
  293. package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +32 -0
  294. package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.js +51 -0
  295. package/lib/solution/BookingTicket/utils/scan/index.d.ts +5 -0
  296. package/lib/solution/BookingTicket/utils/scan/index.js +17 -3
  297. package/lib/solution/BookingTicket/utils/scan/scanProductValues.d.ts +21 -0
  298. package/lib/solution/BookingTicket/utils/scan/scanProductValues.js +127 -0
  299. package/lib/solution/BookingTicket/utils/sessionCatalogStale.d.ts +23 -0
  300. package/lib/solution/BookingTicket/utils/sessionCatalogStale.js +85 -0
  301. package/lib/solution/Checkout/index.d.ts +1 -0
  302. package/lib/solution/Checkout/index.js +1 -2
  303. package/lib/solution/RegisterAndLogin/config.js +2 -10
  304. package/lib/solution/ScanOrder/index.d.ts +9 -3
  305. package/lib/solution/ScanOrder/index.js +153 -70
  306. package/lib/solution/ScanOrder/types.d.ts +9 -5
  307. package/lib/solution/ScanOrder/utils.d.ts +1 -1
  308. package/lib/solution/ScanOrder/utils.js +83 -17
  309. package/lib/solution/VenueBooking/index.d.ts +5 -2
  310. package/lib/solution/VenueBooking/index.js +54 -17
  311. package/lib/solution/VenueBooking/sales-section-4-annotated.json +0 -2
  312. package/lib/solution/VenueBooking/utils/slotMerge.d.ts +4 -0
  313. package/lib/solution/VenueBooking/utils/slotMerge.js +10 -0
  314. package/lib/types/index.d.ts +10 -0
  315. package/package.json +1 -1
  316. package/dist/solution/Checkout/appointmentDemo.json +0 -1
  317. package/lib/solution/Checkout/appointmentDemo.json +0 -1
@@ -110,9 +110,6 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
110
110
  _defineProperty(_assertThisInitialized(_this), "logger", void 0);
111
111
  // LoggerManager 实例
112
112
  _defineProperty(_assertThisInitialized(_this), "voucherUpdateLockByOrderUuid", new Map());
113
- _defineProperty(_assertThisInitialized(_this), "payMethodMemoryCache", null);
114
- _defineProperty(_assertThisInitialized(_this), "payMethodListInFlight", null);
115
- _defineProperty(_assertThisInitialized(_this), "isRefreshingPaymentMethods", false);
116
113
  _defineProperty(_assertThisInitialized(_this), "otherParams", {});
117
114
  // 支付方式实例
118
115
  _defineProperty(_assertThisInitialized(_this), "cash", void 0);
@@ -200,9 +197,8 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
200
197
  this.logger = this.app.logger;
201
198
 
202
199
  // 确保支付模块所需的对象存储已创建
203
- _context.next = 15;
204
- return this.ensurePaymentTables();
205
- case 15:
200
+ // await this.ensurePaymentTables();
201
+
206
202
  this.registerNetworkHandlers();
207
203
 
208
204
  // // 预连接数据库
@@ -210,7 +206,7 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
210
206
 
211
207
  console.log('[PaymentModule] 初始化完成');
212
208
  this.logInfo('PaymentModule initialized successfully');
213
- case 18:
209
+ case 16:
214
210
  case "end":
215
211
  return _context.stop();
216
212
  }
@@ -221,6 +217,18 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
221
217
  }
222
218
  return initialize;
223
219
  }()
220
+ /**
221
+ * 更新父级解决方案透传的运行态参数,主要用于日志父模块等上下文。
222
+ *
223
+ * @example
224
+ * paymentModule.updateOtherParams({ fatherModule: 'bookingTicket' });
225
+ */
226
+ }, {
227
+ key: "updateOtherParams",
228
+ value: function updateOtherParams(params) {
229
+ this.otherParams = params || {};
230
+ }
231
+
224
232
  /**
225
233
  * 记录信息日志
226
234
  */
@@ -331,458 +339,78 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
331
339
  };
332
340
  }());
333
341
  }
334
- }, {
335
- key: "filterPayMethods",
336
- value: function () {
337
- var _filterPayMethods = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(payMethods) {
338
- var walletPassMethod;
339
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
340
- while (1) switch (_context3.prev = _context3.next) {
341
- case 0:
342
- // 1. 筛选 status === 1 && disable === 0的数据
343
- // 2. 检查列表里是否有 code=WALLET_PASS的数据,如果没有,则列表里如果有 PRODUCTVOUCHER 、 GIFTCARD 、 POINTCARD 则删除他们
344
- // 如果有 code = WALLET_PASS的数据,则列表里PRODUCTVOUCHER 、 GIFTCARD 、 POINTCARD 的channel_application 指向 WALLET_PASS 的 channel_application
345
- payMethods = payMethods.filter(function (method) {
346
- return method.status === 1 && method.disable === 0;
347
- });
348
- walletPassMethod = payMethods.find(function (method) {
349
- return method.code === 'WALLET_PASS';
350
- });
351
- if (walletPassMethod) {
352
- payMethods.forEach(function (method) {
353
- if (method.code === 'PRODUCTVOUCHER' || method.code === 'GIFTCARD' || method.code === 'POINTCARD') {
354
- method.channel_application = walletPassMethod.channel_application;
355
- }
356
- });
357
- } else {
358
- payMethods = payMethods.filter(function (method) {
359
- return method.code !== 'PRODUCTVOUCHER' && method.code !== 'GIFTCARD' && method.code !== 'POINTCARD';
360
- });
361
- }
362
- return _context3.abrupt("return", payMethods);
363
- case 4:
364
- case "end":
365
- return _context3.stop();
366
- }
367
- }, _callee3);
368
- }));
369
- function filterPayMethods(_x4) {
370
- return _filterPayMethods.apply(this, arguments);
371
- }
372
- return filterPayMethods;
373
- }()
342
+
374
343
  /**
375
344
  * 获取支付方式列表
376
345
  */
377
346
  }, {
378
347
  key: "getPayMethodListAsync",
379
348
  value: (function () {
380
- var _getPayMethodListAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
381
- var _this$payMethodMemory,
382
- _this4 = this;
383
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
384
- while (1) switch (_context4.prev = _context4.next) {
349
+ var _getPayMethodListAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
350
+ var response, payMethods;
351
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
352
+ while (1) switch (_context3.prev = _context3.next) {
385
353
  case 0:
386
354
  this.logInfo('Starting getPayMethodListAsync');
387
- if (!((_this$payMethodMemory = this.payMethodMemoryCache) !== null && _this$payMethodMemory !== void 0 && _this$payMethodMemory.length)) {
388
- _context4.next = 3;
389
- break;
390
- }
391
- return _context4.abrupt("return", this.payMethodMemoryCache);
392
- case 3:
393
- if (!this.payMethodListInFlight) {
394
- _context4.next = 5;
395
- break;
396
- }
397
- return _context4.abrupt("return", this.payMethodListInFlight);
398
- case 5:
399
- this.payMethodListInFlight = this.loadPayMethodListAsync().finally(function () {
400
- _this4.payMethodListInFlight = null;
355
+ _context3.prev = 1;
356
+ _context3.next = 4;
357
+ return this.request.get('/pay/custom-payment/all', {
358
+ filterPaymentMethods: true
359
+ }, {
360
+ osServer: true
401
361
  });
402
- return _context4.abrupt("return", this.payMethodListInFlight);
403
- case 7:
404
- case "end":
405
- return _context4.stop();
406
- }
407
- }, _callee4, this);
408
- }));
409
- function getPayMethodListAsync() {
410
- return _getPayMethodListAsync.apply(this, arguments);
411
- }
412
- return getPayMethodListAsync;
413
- }())
414
- }, {
415
- key: "loadPayMethodListAsync",
416
- value: function () {
417
- var _loadPayMethodListAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
418
- var cachedMethods, hasCache, response, payMethods, _iterator2, _step2, method;
419
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
420
- while (1) switch (_context5.prev = _context5.next) {
421
- case 0:
422
- _context5.prev = 0;
423
- // 先尝试从 IndexDB 获取缓存
424
- cachedMethods = [];
425
- _context5.prev = 2;
426
- _context5.next = 5;
427
- return this.dbManager.getAll('pay_method');
428
- case 5:
429
- cachedMethods = _context5.sent;
430
- _context5.next = 11;
431
- break;
432
- case 8:
433
- _context5.prev = 8;
434
- _context5.t0 = _context5["catch"](2);
435
- console.warn('[PaymentModule] pay_method 表不存在,将从服务器获取数据');
436
- case 11:
437
- // 如果有缓存,先返回缓存数据
438
- hasCache = cachedMethods.length > 0;
439
- if (!hasCache) {
440
- _context5.next = 16;
441
- break;
442
- }
443
- this.payMethodMemoryCache = cachedMethods;
444
- // 后台异步获取最新数据
445
- this.refreshPaymentMethodsInBackground(cachedMethods);
446
- return _context5.abrupt("return", cachedMethods);
447
- case 16:
448
- _context5.next = 18;
449
- return this.request.get('/pay/custom-payment/all');
450
- case 18:
451
- response = _context5.sent;
452
- _context5.next = 21;
453
- return this.filterPayMethods(response.data);
454
- case 21:
455
- response.data = _context5.sent;
456
- payMethods = response.data || [];
457
- this.payMethodMemoryCache = payMethods;
458
-
459
- // 尝试缓存到 IndexDB
460
- _context5.prev = 24;
461
- _iterator2 = _createForOfIteratorHelper(payMethods);
462
- _context5.prev = 26;
463
- _iterator2.s();
464
- case 28:
465
- if ((_step2 = _iterator2.n()).done) {
466
- _context5.next = 34;
467
- break;
468
- }
469
- method = _step2.value;
470
- _context5.next = 32;
471
- return this.dbManager.update('pay_method', method);
472
- case 32:
473
- _context5.next = 28;
474
- break;
475
- case 34:
476
- _context5.next = 39;
477
- break;
478
- case 36:
479
- _context5.prev = 36;
480
- _context5.t1 = _context5["catch"](26);
481
- _iterator2.e(_context5.t1);
482
- case 39:
483
- _context5.prev = 39;
484
- _iterator2.f();
485
- return _context5.finish(39);
486
- case 42:
487
- _context5.next = 47;
488
- break;
489
- case 44:
490
- _context5.prev = 44;
491
- _context5.t2 = _context5["catch"](24);
492
- console.warn('[PaymentModule] 无法缓存支付方式,pay_method 表不存在');
493
- case 47:
494
- _context5.next = 49;
495
- return this.core.effects.emit("".concat(this.name, ":onPaymentMethodsLoaded"), payMethods);
496
- case 49:
362
+ case 4:
363
+ response = _context3.sent;
364
+ payMethods = (response === null || response === void 0 ? void 0 : response.data) || response || [];
497
365
  this.logInfo('getPayMethodListAsync completed successfully', {
498
366
  payMethods: payMethods
499
367
  });
500
- return _context5.abrupt("return", payMethods);
501
- case 53:
502
- _context5.prev = 53;
503
- _context5.t3 = _context5["catch"](0);
504
- console.error('[PaymentModule] 获取支付方式列表失败', _context5.t3);
505
- this.logError('getPayMethodListAsync failed', _context5.t3);
368
+ return _context3.abrupt("return", payMethods);
369
+ case 10:
370
+ _context3.prev = 10;
371
+ _context3.t0 = _context3["catch"](1);
372
+ console.error('[PaymentModule] 获取支付方式列表失败', _context3.t0);
373
+ this.logError('getPayMethodListAsync failed', _context3.t0);
506
374
  // 如果所有操作都失败,返回空数组
507
- return _context5.abrupt("return", []);
508
- case 58:
509
- case "end":
510
- return _context5.stop();
511
- }
512
- }, _callee5, this, [[0, 53], [2, 8], [24, 44], [26, 36, 39, 42]]);
513
- }));
514
- function loadPayMethodListAsync() {
515
- return _loadPayMethodListAsync.apply(this, arguments);
516
- }
517
- return loadPayMethodListAsync;
518
- }()
519
- /**
520
- * 后台刷新支付方式列表
521
- */
522
- }, {
523
- key: "refreshPaymentMethodsInBackground",
524
- value: (function () {
525
- var _refreshPaymentMethodsInBackground = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(cachedMethods) {
526
- var response, newPayMethods, hasChanges, _iterator3, _step3, method, _iterator4, _step4, _method, eventData;
527
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
528
- while (1) switch (_context6.prev = _context6.next) {
529
- case 0:
530
- if (!this.isRefreshingPaymentMethods) {
531
- _context6.next = 2;
532
- break;
533
- }
534
- return _context6.abrupt("return");
535
- case 2:
536
- this.isRefreshingPaymentMethods = true;
537
- this.logInfo('Starting refreshPaymentMethodsInBackground', {
538
- cachedMethodsCount: cachedMethods.length
539
- });
540
- _context6.prev = 4;
541
- console.log('[PaymentModule] 后台刷新支付方式列表...');
542
-
543
- // 从服务器获取最新数据
544
- _context6.next = 8;
545
- return this.request.get('/pay/custom-payment/all');
546
- case 8:
547
- response = _context6.sent;
548
- _context6.next = 11;
549
- return this.filterPayMethods(response.data);
550
- case 11:
551
- response.data = _context6.sent;
552
- newPayMethods = response.data || [];
553
- this.payMethodMemoryCache = newPayMethods;
554
-
555
- // 检查是否有变化
556
- hasChanges = this.hasPaymentMethodsChanged(cachedMethods, newPayMethods);
557
- if (!hasChanges) {
558
- _context6.next = 63;
559
- break;
560
- }
561
- console.log('[PaymentModule] 支付方式列表已更新');
562
- this.logInfo('Payment methods updated in background', {
563
- oldCount: cachedMethods.length,
564
- newCount: newPayMethods.length
565
- });
566
-
567
- // 更新缓存
568
- _context6.prev = 18;
569
- // 先清除旧数据
570
- _iterator3 = _createForOfIteratorHelper(cachedMethods);
571
- _context6.prev = 20;
572
- _iterator3.s();
573
- case 22:
574
- if ((_step3 = _iterator3.n()).done) {
575
- _context6.next = 28;
576
- break;
577
- }
578
- method = _step3.value;
579
- _context6.next = 26;
580
- return this.dbManager.delete('pay_method', method.id);
581
- case 26:
582
- _context6.next = 22;
583
- break;
584
- case 28:
585
- _context6.next = 33;
586
- break;
587
- case 30:
588
- _context6.prev = 30;
589
- _context6.t0 = _context6["catch"](20);
590
- _iterator3.e(_context6.t0);
591
- case 33:
592
- _context6.prev = 33;
593
- _iterator3.f();
594
- return _context6.finish(33);
595
- case 36:
596
- // 添加新数据
597
- _iterator4 = _createForOfIteratorHelper(newPayMethods);
598
- _context6.prev = 37;
599
- _iterator4.s();
600
- case 39:
601
- if ((_step4 = _iterator4.n()).done) {
602
- _context6.next = 45;
603
- break;
604
- }
605
- _method = _step4.value;
606
- _context6.next = 43;
607
- return this.dbManager.update('pay_method', _method);
608
- case 43:
609
- _context6.next = 39;
610
- break;
611
- case 45:
612
- _context6.next = 50;
613
- break;
614
- case 47:
615
- _context6.prev = 47;
616
- _context6.t1 = _context6["catch"](37);
617
- _iterator4.e(_context6.t1);
618
- case 50:
619
- _context6.prev = 50;
620
- _iterator4.f();
621
- return _context6.finish(50);
622
- case 53:
623
- _context6.next = 58;
624
- break;
625
- case 55:
626
- _context6.prev = 55;
627
- _context6.t2 = _context6["catch"](18);
628
- console.warn('[PaymentModule] 无法更新支付方式缓存', _context6.t2);
629
- case 58:
630
- // 通知外部支付方式已变化
631
- eventData = {
632
- oldMethods: cachedMethods,
633
- newMethods: newPayMethods
634
- };
635
- _context6.next = 61;
636
- return this.core.effects.emit("".concat(this.name, ":onPaymentMethodsChanged"), eventData);
637
- case 61:
638
- _context6.next = 64;
639
- break;
640
- case 63:
641
- console.log('[PaymentModule] 支付方式列表无变化');
642
- case 64:
643
- _context6.next = 69;
644
- break;
645
- case 66:
646
- _context6.prev = 66;
647
- _context6.t3 = _context6["catch"](4);
648
- console.error('[PaymentModule] 后台刷新支付方式失败', _context6.t3);
649
- case 69:
650
- _context6.prev = 69;
651
- this.isRefreshingPaymentMethods = false;
652
- return _context6.finish(69);
653
- case 72:
375
+ return _context3.abrupt("return", []);
376
+ case 15:
654
377
  case "end":
655
- return _context6.stop();
378
+ return _context3.stop();
656
379
  }
657
- }, _callee6, this, [[4, 66, 69, 72], [18, 55], [20, 30, 33, 36], [37, 47, 50, 53]]);
380
+ }, _callee3, this, [[1, 10]]);
658
381
  }));
659
- function refreshPaymentMethodsInBackground(_x5) {
660
- return _refreshPaymentMethodsInBackground.apply(this, arguments);
382
+ function getPayMethodListAsync() {
383
+ return _getPayMethodListAsync.apply(this, arguments);
661
384
  }
662
- return refreshPaymentMethodsInBackground;
385
+ return getPayMethodListAsync;
663
386
  }()
664
- /**
665
- * 检查支付方式列表是否有变化
666
- */
667
- )
668
- }, {
669
- key: "hasPaymentMethodsChanged",
670
- value: function hasPaymentMethodsChanged(oldMethods, newMethods) {
671
- if (oldMethods.length !== newMethods.length) {
672
- return true;
673
- }
674
-
675
- // 创建旧数据的 Map 便于查找
676
- var oldMethodsMap = new Map(oldMethods.map(function (method) {
677
- return [method.id, method];
678
- }));
679
-
680
- // 检查每个新方法是否与旧方法相同
681
- var _iterator5 = _createForOfIteratorHelper(newMethods),
682
- _step5;
683
- try {
684
- for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
685
- var newMethod = _step5.value;
686
- var oldMethod = oldMethodsMap.get(newMethod.id);
687
- if (!oldMethod) {
688
- return true; // 新增方法
689
- }
690
-
691
- // 检查关键字段是否有变化
692
- if (oldMethod.code !== newMethod.code || oldMethod.name !== newMethod.name || oldMethod.type !== newMethod.type || oldMethod.description !== newMethod.description || oldMethod.status !== newMethod.status || oldMethod.disable !== newMethod.disable || oldMethod.is_surcharge !== newMethod.is_surcharge || oldMethod.fixed !== newMethod.fixed || oldMethod.percentage !== newMethod.percentage || oldMethod.enabled !== newMethod.enabled || JSON.stringify(oldMethod.channel_application || []) !== JSON.stringify(newMethod.channel_application || []) || JSON.stringify(oldMethod.companies || []) !== JSON.stringify(newMethod.companies || []) || JSON.stringify(oldMethod.metadata || {}) !== JSON.stringify(newMethod.metadata || {})) {
693
- console.log("[PaymentModule] \u652F\u4ED8\u65B9\u5F0F ".concat(newMethod.id, " (").concat(newMethod.code, ") \u53D1\u751F\u53D8\u5316:"), {
694
- id: newMethod.id,
695
- changes: {
696
- code: oldMethod.code !== newMethod.code ? {
697
- old: oldMethod.code,
698
- new: newMethod.code
699
- } : undefined,
700
- name: oldMethod.name !== newMethod.name ? {
701
- old: oldMethod.name,
702
- new: newMethod.name
703
- } : undefined,
704
- type: oldMethod.type !== newMethod.type ? {
705
- old: oldMethod.type,
706
- new: newMethod.type
707
- } : undefined,
708
- description: oldMethod.description !== newMethod.description ? {
709
- old: oldMethod.description,
710
- new: newMethod.description
711
- } : undefined,
712
- status: oldMethod.status !== newMethod.status ? {
713
- old: oldMethod.status,
714
- new: newMethod.status
715
- } : undefined,
716
- disable: oldMethod.disable !== newMethod.disable ? {
717
- old: oldMethod.disable,
718
- new: newMethod.disable
719
- } : undefined,
720
- is_surcharge: oldMethod.is_surcharge !== newMethod.is_surcharge ? {
721
- old: oldMethod.is_surcharge,
722
- new: newMethod.is_surcharge
723
- } : undefined,
724
- fixed: oldMethod.fixed !== newMethod.fixed ? {
725
- old: oldMethod.fixed,
726
- new: newMethod.fixed
727
- } : undefined,
728
- percentage: oldMethod.percentage !== newMethod.percentage ? {
729
- old: oldMethod.percentage,
730
- new: newMethod.percentage
731
- } : undefined,
732
- enabled: oldMethod.enabled !== newMethod.enabled ? {
733
- old: oldMethod.enabled,
734
- new: newMethod.enabled
735
- } : undefined,
736
- channel_application: JSON.stringify(oldMethod.channel_application || []) !== JSON.stringify(newMethod.channel_application || []) ? {
737
- old: oldMethod.channel_application,
738
- new: newMethod.channel_application
739
- } : undefined,
740
- companies: JSON.stringify(oldMethod.companies || []) !== JSON.stringify(newMethod.companies || []) ? {
741
- old: oldMethod.companies,
742
- new: newMethod.companies
743
- } : undefined,
744
- metadata: JSON.stringify(oldMethod.metadata || {}) !== JSON.stringify(newMethod.metadata || {}) ? {
745
- old: oldMethod.metadata,
746
- new: newMethod.metadata
747
- } : undefined
748
- }
749
- });
750
- return true; // 方法属性有变化
751
- }
752
- }
753
- } catch (err) {
754
- _iterator5.e(err);
755
- } finally {
756
- _iterator5.f();
757
- }
758
- return false;
759
- }
760
-
761
387
  /**
762
388
  * 获取订单列表
763
389
  */
390
+ /** @deprecated */
391
+ )
764
392
  }, {
765
393
  key: "getOrderListAsync",
766
394
  value: (function () {
767
- var _getOrderListAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
768
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
769
- while (1) switch (_context7.prev = _context7.next) {
395
+ var _getOrderListAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
396
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
397
+ while (1) switch (_context4.prev = _context4.next) {
770
398
  case 0:
771
- _context7.prev = 0;
772
- _context7.next = 3;
399
+ _context4.prev = 0;
400
+ _context4.next = 3;
773
401
  return this.dbManager.getAll('order');
774
402
  case 3:
775
- return _context7.abrupt("return", _context7.sent);
403
+ return _context4.abrupt("return", _context4.sent);
776
404
  case 6:
777
- _context7.prev = 6;
778
- _context7.t0 = _context7["catch"](0);
779
- console.error('[PaymentModule] 获取订单列表失败', _context7.t0);
780
- return _context7.abrupt("return", []);
405
+ _context4.prev = 6;
406
+ _context4.t0 = _context4["catch"](0);
407
+ console.error('[PaymentModule] 获取订单列表失败', _context4.t0);
408
+ return _context4.abrupt("return", []);
781
409
  case 10:
782
410
  case "end":
783
- return _context7.stop();
411
+ return _context4.stop();
784
412
  }
785
- }, _callee7, this, [[0, 6]]);
413
+ }, _callee4, this, [[0, 6]]);
786
414
  }));
787
415
  function getOrderListAsync() {
788
416
  return _getOrderListAsync.apply(this, arguments);
@@ -796,27 +424,27 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
796
424
  }, {
797
425
  key: "getPaymentOrderByUuidAsync",
798
426
  value: (function () {
799
- var _getPaymentOrderByUuidAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(orderUuid) {
800
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
801
- while (1) switch (_context8.prev = _context8.next) {
427
+ var _getPaymentOrderByUuidAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(orderUuid) {
428
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
429
+ while (1) switch (_context5.prev = _context5.next) {
802
430
  case 0:
803
- _context8.prev = 0;
804
- _context8.next = 3;
431
+ _context5.prev = 0;
432
+ _context5.next = 3;
805
433
  return this.dbManager.get('order', orderUuid, true);
806
434
  case 3:
807
- return _context8.abrupt("return", _context8.sent);
435
+ return _context5.abrupt("return", _context5.sent);
808
436
  case 6:
809
- _context8.prev = 6;
810
- _context8.t0 = _context8["catch"](0);
811
- console.error('[PaymentModule] 获取支付订单失败', _context8.t0);
812
- return _context8.abrupt("return", null);
437
+ _context5.prev = 6;
438
+ _context5.t0 = _context5["catch"](0);
439
+ console.error('[PaymentModule] 获取支付订单失败', _context5.t0);
440
+ return _context5.abrupt("return", null);
813
441
  case 10:
814
442
  case "end":
815
- return _context8.stop();
443
+ return _context5.stop();
816
444
  }
817
- }, _callee8, this, [[0, 6]]);
445
+ }, _callee5, this, [[0, 6]]);
818
446
  }));
819
- function getPaymentOrderByUuidAsync(_x6) {
447
+ function getPaymentOrderByUuidAsync(_x4) {
820
448
  return _getPaymentOrderByUuidAsync.apply(this, arguments);
821
449
  }
822
450
  return getPaymentOrderByUuidAsync;
@@ -828,17 +456,17 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
828
456
  }, {
829
457
  key: "createPaymentOrderAsync",
830
458
  value: (function () {
831
- var _createPaymentOrderAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(params) {
832
- var _this5 = this;
459
+ var _createPaymentOrderAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(params) {
460
+ var _this4 = this;
833
461
  var newOrder, currentTime, dbAddStartTime, dbAddDuration;
834
- return _regeneratorRuntime().wrap(function _callee9$(_context9) {
835
- while (1) switch (_context9.prev = _context9.next) {
462
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
463
+ while (1) switch (_context6.prev = _context6.next) {
836
464
  case 0:
837
465
  this.logInfo('Starting createPaymentOrderAsync', {
838
466
  orderId: params.order_id,
839
467
  totalAmount: params.total_amount
840
468
  });
841
- _context9.prev = 1;
469
+ _context6.prev = 1;
842
470
  // 检测是否有重复的 order_id
843
471
  // console.time('createLocalOrderAsync: getExistingOrder')
844
472
  // const existingOrder = await this.dbManager.get('order', params.order_id);
@@ -924,7 +552,7 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
924
552
 
925
553
  // 🚀 性能监控:记录数据库添加操作耗时
926
554
  dbAddStartTime = Date.now();
927
- _context9.next = 7;
555
+ _context6.next = 7;
928
556
  return this.dbManager.add('order', newOrder, true);
929
557
  case 7:
930
558
  dbAddDuration = Date.now() - dbAddStartTime;
@@ -937,24 +565,24 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
937
565
  performance: dbAddDuration > 100 ? 'slow' : dbAddDuration > 50 ? 'medium' : 'fast'
938
566
  });
939
567
  setTimeout(function () {
940
- _this5.core.effects.emit("".concat(_this5.name, ":onOrderAdded"), newOrder);
568
+ _this4.core.effects.emit("".concat(_this4.name, ":onOrderAdded"), newOrder);
941
569
  }, 0);
942
- return _context9.abrupt("return", newOrder);
570
+ return _context6.abrupt("return", newOrder);
943
571
  case 13:
944
- _context9.prev = 13;
945
- _context9.t0 = _context9["catch"](1);
946
- console.error('[PaymentModule] 创建支付订单失败', _context9.t0);
947
- this.logError('createPaymentOrderAsync failed', _context9.t0, {
572
+ _context6.prev = 13;
573
+ _context6.t0 = _context6["catch"](1);
574
+ console.error('[PaymentModule] 创建支付订单失败', _context6.t0);
575
+ this.logError('createPaymentOrderAsync failed', _context6.t0, {
948
576
  orderId: params.order_id
949
577
  });
950
- throw _context9.t0;
578
+ throw _context6.t0;
951
579
  case 18:
952
580
  case "end":
953
- return _context9.stop();
581
+ return _context6.stop();
954
582
  }
955
- }, _callee9, this, [[1, 13]]);
583
+ }, _callee6, this, [[1, 13]]);
956
584
  }));
957
- function createPaymentOrderAsync(_x7) {
585
+ function createPaymentOrderAsync(_x5) {
958
586
  return _createPaymentOrderAsync.apply(this, arguments);
959
587
  }
960
588
  return createPaymentOrderAsync;
@@ -966,42 +594,42 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
966
594
  }, {
967
595
  key: "deletePaymentOrderAsync",
968
596
  value: (function () {
969
- var _deletePaymentOrderAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(orderUuid) {
597
+ var _deletePaymentOrderAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(orderUuid) {
970
598
  var order;
971
- return _regeneratorRuntime().wrap(function _callee10$(_context10) {
972
- while (1) switch (_context10.prev = _context10.next) {
599
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
600
+ while (1) switch (_context7.prev = _context7.next) {
973
601
  case 0:
974
- _context10.prev = 0;
975
- _context10.next = 3;
602
+ _context7.prev = 0;
603
+ _context7.next = 3;
976
604
  return this.dbManager.get('order', orderUuid);
977
605
  case 3:
978
- order = _context10.sent;
606
+ order = _context7.sent;
979
607
  if (!order) {
980
- _context10.next = 10;
608
+ _context7.next = 10;
981
609
  break;
982
610
  }
983
- _context10.next = 7;
611
+ _context7.next = 7;
984
612
  return this.dbManager.delete('order', orderUuid);
985
613
  case 7:
986
- _context10.next = 9;
614
+ _context7.next = 9;
987
615
  return this.core.effects.emit("".concat(this.name, ":onOrderDeleted"), order);
988
616
  case 9:
989
617
  console.log('[PaymentModule] 支付订单删除成功:', orderUuid);
990
618
  case 10:
991
- _context10.next = 16;
619
+ _context7.next = 16;
992
620
  break;
993
621
  case 12:
994
- _context10.prev = 12;
995
- _context10.t0 = _context10["catch"](0);
996
- console.error('[PaymentModule] 删除支付订单失败', _context10.t0);
997
- throw _context10.t0;
622
+ _context7.prev = 12;
623
+ _context7.t0 = _context7["catch"](0);
624
+ console.error('[PaymentModule] 删除支付订单失败', _context7.t0);
625
+ throw _context7.t0;
998
626
  case 16:
999
627
  case "end":
1000
- return _context10.stop();
628
+ return _context7.stop();
1001
629
  }
1002
- }, _callee10, this, [[0, 12]]);
630
+ }, _callee7, this, [[0, 12]]);
1003
631
  }));
1004
- function deletePaymentOrderAsync(_x8) {
632
+ function deletePaymentOrderAsync(_x6) {
1005
633
  return _deletePaymentOrderAsync.apply(this, arguments);
1006
634
  }
1007
635
  return deletePaymentOrderAsync;
@@ -1013,49 +641,49 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
1013
641
  }, {
1014
642
  key: "updateOrderAsync",
1015
643
  value: (function () {
1016
- var _updateOrderAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(orderUuid, params) {
644
+ var _updateOrderAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(orderUuid, params) {
1017
645
  var order, updatedOrder;
1018
- return _regeneratorRuntime().wrap(function _callee11$(_context11) {
1019
- while (1) switch (_context11.prev = _context11.next) {
646
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
647
+ while (1) switch (_context8.prev = _context8.next) {
1020
648
  case 0:
1021
- _context11.prev = 0;
1022
- _context11.next = 3;
649
+ _context8.prev = 0;
650
+ _context8.next = 3;
1023
651
  return this.dbManager.get('order', orderUuid);
1024
652
  case 3:
1025
- order = _context11.sent;
653
+ order = _context8.sent;
1026
654
  if (!order) {
1027
- _context11.next = 13;
655
+ _context8.next = 13;
1028
656
  break;
1029
657
  }
1030
658
  updatedOrder = _objectSpread(_objectSpread({}, order), params);
1031
659
  this.recalculateOrderAmount(updatedOrder);
1032
- _context11.next = 9;
660
+ _context8.next = 9;
1033
661
  return this.dbManager.update('order', updatedOrder);
1034
662
  case 9:
1035
- _context11.next = 11;
663
+ _context8.next = 11;
1036
664
  return this.core.effects.emit("".concat(this.name, ":onOrderUpdated"), updatedOrder);
1037
665
  case 11:
1038
- _context11.next = 13;
666
+ _context8.next = 13;
1039
667
  return this.core.effects.emit("".concat(this.name, ":onOrderChanged"), {
1040
668
  action: 'update',
1041
669
  order: updatedOrder,
1042
670
  originalOrder: order
1043
671
  });
1044
672
  case 13:
1045
- _context11.next = 19;
673
+ _context8.next = 19;
1046
674
  break;
1047
675
  case 15:
1048
- _context11.prev = 15;
1049
- _context11.t0 = _context11["catch"](0);
1050
- console.error('[PaymentModule] 更新订单失败', _context11.t0);
1051
- throw _context11.t0;
676
+ _context8.prev = 15;
677
+ _context8.t0 = _context8["catch"](0);
678
+ console.error('[PaymentModule] 更新订单失败', _context8.t0);
679
+ throw _context8.t0;
1052
680
  case 19:
1053
681
  case "end":
1054
- return _context11.stop();
682
+ return _context8.stop();
1055
683
  }
1056
- }, _callee11, this, [[0, 15]]);
684
+ }, _callee8, this, [[0, 15]]);
1057
685
  }));
1058
- function updateOrderAsync(_x9, _x10) {
686
+ function updateOrderAsync(_x7, _x8) {
1059
687
  return _updateOrderAsync.apply(this, arguments);
1060
688
  }
1061
689
  return updateOrderAsync;
@@ -1074,38 +702,38 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
1074
702
  }, {
1075
703
  key: "replaceOrderIdByUuidAsync",
1076
704
  value: (function () {
1077
- var _replaceOrderIdByUuidAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(orderUuid, newOrderId) {
705
+ var _replaceOrderIdByUuidAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(orderUuid, newOrderId) {
1078
706
  var existingOrder, allOrders, duplicateOrder, originalOrderId, updatedOrder;
1079
- return _regeneratorRuntime().wrap(function _callee12$(_context12) {
1080
- while (1) switch (_context12.prev = _context12.next) {
707
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
708
+ while (1) switch (_context9.prev = _context9.next) {
1081
709
  case 0:
1082
710
  this.logInfo('Starting replaceOrderIdByUuidAsync', {
1083
711
  orderUuid: orderUuid,
1084
712
  newOrderId: newOrderId
1085
713
  });
1086
- _context12.prev = 1;
1087
- _context12.next = 4;
714
+ _context9.prev = 1;
715
+ _context9.next = 4;
1088
716
  return this.dbManager.get('order', orderUuid);
1089
717
  case 4:
1090
- existingOrder = _context12.sent;
718
+ existingOrder = _context9.sent;
1091
719
  if (existingOrder) {
1092
- _context12.next = 8;
720
+ _context9.next = 8;
1093
721
  break;
1094
722
  }
1095
723
  this.logWarning('Order not found for UUID replacement', {
1096
724
  orderUuid: orderUuid
1097
725
  });
1098
- return _context12.abrupt("return", null);
726
+ return _context9.abrupt("return", null);
1099
727
  case 8:
1100
- _context12.next = 10;
728
+ _context9.next = 10;
1101
729
  return this.dbManager.getAll('order');
1102
730
  case 10:
1103
- allOrders = _context12.sent;
731
+ allOrders = _context9.sent;
1104
732
  duplicateOrder = allOrders.find(function (order) {
1105
733
  return String(order.order_id) === String(newOrderId) && order.uuid !== orderUuid;
1106
734
  });
1107
735
  if (!duplicateOrder) {
1108
- _context12.next = 15;
736
+ _context9.next = 15;
1109
737
  break;
1110
738
  }
1111
739
  this.logWarning('New order ID already exists', {
@@ -1127,13 +755,13 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
1127
755
  updated_at: new Date().toISOString()
1128
756
  })
1129
757
  }); // 更新到数据库
1130
- _context12.next = 19;
758
+ _context9.next = 19;
1131
759
  return this.dbManager.update('order', updatedOrder);
1132
760
  case 19:
1133
- _context12.next = 21;
761
+ _context9.next = 21;
1134
762
  return this.core.effects.emit("".concat(this.name, ":onOrderUpdated"), updatedOrder);
1135
763
  case 21:
1136
- _context12.next = 23;
764
+ _context9.next = 23;
1137
765
  return this.core.effects.emit("".concat(this.name, ":onOrderChanged"), {
1138
766
  action: 'order_id_replaced',
1139
767
  order: updatedOrder,
@@ -1150,23 +778,23 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
1150
778
  newOrderId: newOrderId
1151
779
  });
1152
780
  console.log("[PaymentModule] \u8BA2\u5355ID\u66FF\u6362\u6210\u529F: ".concat(originalOrderId, " \u2192 ").concat(newOrderId));
1153
- return _context12.abrupt("return", updatedOrder);
781
+ return _context9.abrupt("return", updatedOrder);
1154
782
  case 28:
1155
- _context12.prev = 28;
1156
- _context12.t0 = _context12["catch"](1);
1157
- console.error('[PaymentModule] 替换订单ID失败', _context12.t0);
1158
- this.logError('replaceOrderIdByUuidAsync failed', _context12.t0, {
783
+ _context9.prev = 28;
784
+ _context9.t0 = _context9["catch"](1);
785
+ console.error('[PaymentModule] 替换订单ID失败', _context9.t0);
786
+ this.logError('replaceOrderIdByUuidAsync failed', _context9.t0, {
1159
787
  orderUuid: orderUuid,
1160
788
  newOrderId: newOrderId
1161
789
  });
1162
- throw _context12.t0;
790
+ throw _context9.t0;
1163
791
  case 33:
1164
792
  case "end":
1165
- return _context12.stop();
793
+ return _context9.stop();
1166
794
  }
1167
- }, _callee12, this, [[1, 28]]);
795
+ }, _callee9, this, [[1, 28]]);
1168
796
  }));
1169
- function replaceOrderIdByUuidAsync(_x11, _x12) {
797
+ function replaceOrderIdByUuidAsync(_x9, _x10) {
1170
798
  return _replaceOrderIdByUuidAsync.apply(this, arguments);
1171
799
  }
1172
800
  return replaceOrderIdByUuidAsync;
@@ -1182,42 +810,42 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
1182
810
  }, {
1183
811
  key: "getPaymentItemsAsync",
1184
812
  value: (function () {
1185
- var _getPaymentItemsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(orderUuid) {
813
+ var _getPaymentItemsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(orderUuid) {
1186
814
  var includeVoided,
1187
815
  order,
1188
816
  allPayments,
1189
- _args13 = arguments;
1190
- return _regeneratorRuntime().wrap(function _callee13$(_context13) {
1191
- while (1) switch (_context13.prev = _context13.next) {
817
+ _args10 = arguments;
818
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
819
+ while (1) switch (_context10.prev = _context10.next) {
1192
820
  case 0:
1193
- includeVoided = _args13.length > 1 && _args13[1] !== undefined ? _args13[1] : false;
821
+ includeVoided = _args10.length > 1 && _args10[1] !== undefined ? _args10[1] : false;
1194
822
  if (orderUuid) {
1195
- _context13.next = 3;
823
+ _context10.next = 3;
1196
824
  break;
1197
825
  }
1198
826
  throw new Error('orderUuid is required');
1199
827
  case 3:
1200
- _context13.next = 5;
828
+ _context10.next = 5;
1201
829
  return this.getPaymentOrderByUuidAsync(orderUuid);
1202
830
  case 5:
1203
- order = _context13.sent;
831
+ order = _context10.sent;
1204
832
  allPayments = (order === null || order === void 0 ? void 0 : order.payment) || [];
1205
833
  if (!includeVoided) {
1206
- _context13.next = 9;
834
+ _context10.next = 9;
1207
835
  break;
1208
836
  }
1209
- return _context13.abrupt("return", allPayments);
837
+ return _context10.abrupt("return", allPayments);
1210
838
  case 9:
1211
- return _context13.abrupt("return", allPayments.filter(function (payment) {
839
+ return _context10.abrupt("return", allPayments.filter(function (payment) {
1212
840
  return payment.status !== 'voided';
1213
841
  }));
1214
842
  case 10:
1215
843
  case "end":
1216
- return _context13.stop();
844
+ return _context10.stop();
1217
845
  }
1218
- }, _callee13, this);
846
+ }, _callee10, this);
1219
847
  }));
1220
- function getPaymentItemsAsync(_x13) {
848
+ function getPaymentItemsAsync(_x11) {
1221
849
  return _getPaymentItemsAsync.apply(this, arguments);
1222
850
  }
1223
851
  return getPaymentItemsAsync;
@@ -1232,18 +860,18 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
1232
860
  }, {
1233
861
  key: "getAllPaymentItemsAsync",
1234
862
  value: (function () {
1235
- var _getAllPaymentItemsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(orderUuid) {
1236
- return _regeneratorRuntime().wrap(function _callee14$(_context14) {
1237
- while (1) switch (_context14.prev = _context14.next) {
863
+ var _getAllPaymentItemsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(orderUuid) {
864
+ return _regeneratorRuntime().wrap(function _callee11$(_context11) {
865
+ while (1) switch (_context11.prev = _context11.next) {
1238
866
  case 0:
1239
- return _context14.abrupt("return", this.getPaymentItemsAsync(orderUuid, true));
867
+ return _context11.abrupt("return", this.getPaymentItemsAsync(orderUuid, true));
1240
868
  case 1:
1241
869
  case "end":
1242
- return _context14.stop();
870
+ return _context11.stop();
1243
871
  }
1244
- }, _callee14, this);
872
+ }, _callee11, this);
1245
873
  }));
1246
- function getAllPaymentItemsAsync(_x14) {
874
+ function getAllPaymentItemsAsync(_x12) {
1247
875
  return _getAllPaymentItemsAsync.apply(this, arguments);
1248
876
  }
1249
877
  return getAllPaymentItemsAsync;
@@ -1255,10 +883,10 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
1255
883
  }, {
1256
884
  key: "addPaymentItemAsync",
1257
885
  value: (function () {
1258
- var _addPaymentItemAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(orderUuid, paymentItem) {
886
+ var _addPaymentItemAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(orderUuid, paymentItem) {
1259
887
  var _paymentItem$metadata, _newPaymentItem$metad, _newPaymentItem$metad2, _newPaymentItem$metad3, order, expectAmount, paidDepositAmount, expectedDepositAmount, warningMessage, paymentUuid, currentTime, newPaymentItem;
1260
- return _regeneratorRuntime().wrap(function _callee15$(_context15) {
1261
- while (1) switch (_context15.prev = _context15.next) {
888
+ return _regeneratorRuntime().wrap(function _callee12$(_context12) {
889
+ while (1) switch (_context12.prev = _context12.next) {
1262
890
  case 0:
1263
891
  this.logInfo('Starting addPaymentItemAsync', {
1264
892
  orderUuid: orderUuid,
@@ -1266,20 +894,20 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
1266
894
  paymentCode: paymentItem.code,
1267
895
  orderPaymentType: paymentItem.order_payment_type
1268
896
  });
1269
- _context15.prev = 1;
897
+ _context12.prev = 1;
1270
898
  this.logInfo('准备获取订单', {
1271
899
  orderUuid: orderUuid
1272
900
  });
1273
- _context15.next = 5;
901
+ _context12.next = 5;
1274
902
  return this.getPaymentOrderByUuidAsync(orderUuid);
1275
903
  case 5:
1276
- order = _context15.sent;
904
+ order = _context12.sent;
1277
905
  this.logInfo('获取订单信息成功', {
1278
906
  orderUuid: orderUuid,
1279
907
  order: order
1280
908
  });
1281
909
  if (order) {
1282
- _context15.next = 9;
910
+ _context12.next = 9;
1283
911
  break;
1284
912
  }
1285
913
  throw new Error("Order not found: ".concat(orderUuid));
@@ -1294,7 +922,7 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
1294
922
  }, new Decimal(0));
1295
923
  expectedDepositAmount = new Decimal(order.deposit_amount || '0').sub(paidDepositAmount); // 有一种特殊情况,订单金额为 0,但是定金金额>0,且此时是定金状态的,允许添加支付项
1296
924
  if (!(expectAmount.lte(0) && expectedDepositAmount.eq(0))) {
1297
- _context15.next = 17;
925
+ _context12.next = 17;
1298
926
  break;
1299
927
  }
1300
928
  warningMessage = "\u8BA2\u5355 ".concat(orderUuid, " \u5F85\u4ED8\u91D1\u989D\u5DF2\u4E3A0\uFF0C\u4E0D\u5141\u8BB8\u6DFB\u52A0\u65B0\u7684\u652F\u4ED8\u9879");
@@ -1349,7 +977,7 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
1349
977
  orderUuid: orderUuid,
1350
978
  order: order
1351
979
  });
1352
- _context15.next = 25;
980
+ _context12.next = 25;
1353
981
  return this.dbManager.update('order', order, true);
1354
982
  case 25:
1355
983
  this.logInfo('更新订单支付项完成', {
@@ -1372,24 +1000,24 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
1372
1000
  actualPaidAmount: (_newPaymentItem$metad2 = newPaymentItem.metadata) === null || _newPaymentItem$metad2 === void 0 ? void 0 : _newPaymentItem$metad2.actual_paid_amount,
1373
1001
  changeGivenAmount: (_newPaymentItem$metad3 = newPaymentItem.metadata) === null || _newPaymentItem$metad3 === void 0 ? void 0 : _newPaymentItem$metad3.change_given_amount
1374
1002
  });
1375
- _context15.next = 35;
1003
+ _context12.next = 35;
1376
1004
  break;
1377
1005
  case 30:
1378
- _context15.prev = 30;
1379
- _context15.t0 = _context15["catch"](1);
1380
- console.error('[PaymentModule] 添加支付项失败', _context15.t0);
1381
- this.logError('addPaymentItemAsync failed', _context15.t0, {
1006
+ _context12.prev = 30;
1007
+ _context12.t0 = _context12["catch"](1);
1008
+ console.error('[PaymentModule] 添加支付项失败', _context12.t0);
1009
+ this.logError('addPaymentItemAsync failed', _context12.t0, {
1382
1010
  orderUuid: orderUuid,
1383
1011
  paymentItem: paymentItem
1384
1012
  });
1385
- throw _context15.t0;
1013
+ throw _context12.t0;
1386
1014
  case 35:
1387
1015
  case "end":
1388
- return _context15.stop();
1016
+ return _context12.stop();
1389
1017
  }
1390
- }, _callee15, this, [[1, 30]]);
1018
+ }, _callee12, this, [[1, 30]]);
1391
1019
  }));
1392
- function addPaymentItemAsync(_x15, _x16) {
1020
+ function addPaymentItemAsync(_x13, _x14) {
1393
1021
  return _addPaymentItemAsync.apply(this, arguments);
1394
1022
  }
1395
1023
  return addPaymentItemAsync;
@@ -1401,22 +1029,22 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
1401
1029
  }, {
1402
1030
  key: "deletePaymentAsync",
1403
1031
  value: (function () {
1404
- var _deletePaymentAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(orderUuid, paymentUuid) {
1032
+ var _deletePaymentAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(orderUuid, paymentUuid) {
1405
1033
  var order, paymentItem;
1406
- return _regeneratorRuntime().wrap(function _callee16$(_context16) {
1407
- while (1) switch (_context16.prev = _context16.next) {
1034
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
1035
+ while (1) switch (_context13.prev = _context13.next) {
1408
1036
  case 0:
1409
1037
  this.logInfo('Starting deletePaymentAsync (mark as voided)', {
1410
1038
  orderUuid: orderUuid,
1411
1039
  paymentUuid: paymentUuid
1412
1040
  });
1413
- _context16.prev = 1;
1414
- _context16.next = 4;
1041
+ _context13.prev = 1;
1042
+ _context13.next = 4;
1415
1043
  return this.dbManager.get('order', orderUuid);
1416
1044
  case 4:
1417
- order = _context16.sent;
1045
+ order = _context13.sent;
1418
1046
  if (order) {
1419
- _context16.next = 7;
1047
+ _context13.next = 7;
1420
1048
  break;
1421
1049
  }
1422
1050
  throw new Error('订单不存在');
@@ -1425,17 +1053,17 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
1425
1053
  return payment.uuid === paymentUuid;
1426
1054
  });
1427
1055
  if (paymentItem) {
1428
- _context16.next = 10;
1056
+ _context13.next = 10;
1429
1057
  break;
1430
1058
  }
1431
1059
  throw new Error("\u652F\u4ED8\u9879\u4E0D\u5B58\u5728: ".concat(paymentUuid));
1432
1060
  case 10:
1433
1061
  if (!(paymentItem.status === 'voided')) {
1434
- _context16.next = 13;
1062
+ _context13.next = 13;
1435
1063
  break;
1436
1064
  }
1437
1065
  console.warn("[PaymentModule] \u652F\u4ED8\u9879 ".concat(paymentUuid, " \u5DF2\u7ECF\u88AB\u5220\u9664\uFF0C\u8DF3\u8FC7\u64CD\u4F5C"));
1438
- return _context16.abrupt("return");
1066
+ return _context13.abrupt("return");
1439
1067
  case 13:
1440
1068
  // 标记删除而不是物理删除
1441
1069
  paymentItem.status = 'voided';
@@ -1452,16 +1080,16 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
1452
1080
  this.recalculateOrderAmount(order);
1453
1081
 
1454
1082
  // 更新到 IndexDB
1455
- _context16.next = 20;
1083
+ _context13.next = 20;
1456
1084
  return this.dbManager.update('order', order);
1457
1085
  case 20:
1458
- _context16.next = 22;
1086
+ _context13.next = 22;
1459
1087
  return this.core.effects.emit("".concat(this.name, ":onPaymentDeleted"), {
1460
1088
  order: order,
1461
1089
  paymentItem: paymentItem
1462
1090
  });
1463
1091
  case 22:
1464
- _context16.next = 24;
1092
+ _context13.next = 24;
1465
1093
  return this.core.effects.emit("".concat(this.name, ":onOrderChanged"), {
1466
1094
  action: 'payment_delete',
1467
1095
  order: order,
@@ -1474,24 +1102,24 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
1474
1102
  originalAmount: paymentItem.origin_amount,
1475
1103
  newExpectAmount: order.expect_amount
1476
1104
  });
1477
- _context16.next = 32;
1105
+ _context13.next = 32;
1478
1106
  break;
1479
1107
  case 27:
1480
- _context16.prev = 27;
1481
- _context16.t0 = _context16["catch"](1);
1482
- console.error('[PaymentModule] 删除支付项失败', _context16.t0);
1483
- this.logError('deletePaymentAsync failed', _context16.t0, {
1108
+ _context13.prev = 27;
1109
+ _context13.t0 = _context13["catch"](1);
1110
+ console.error('[PaymentModule] 删除支付项失败', _context13.t0);
1111
+ this.logError('deletePaymentAsync failed', _context13.t0, {
1484
1112
  orderUuid: orderUuid,
1485
1113
  paymentUuid: paymentUuid
1486
1114
  });
1487
- throw _context16.t0;
1115
+ throw _context13.t0;
1488
1116
  case 32:
1489
1117
  case "end":
1490
- return _context16.stop();
1118
+ return _context13.stop();
1491
1119
  }
1492
- }, _callee16, this, [[1, 27]]);
1120
+ }, _callee13, this, [[1, 27]]);
1493
1121
  }));
1494
- function deletePaymentAsync(_x17, _x18) {
1122
+ function deletePaymentAsync(_x15, _x16) {
1495
1123
  return _deletePaymentAsync.apply(this, arguments);
1496
1124
  }
1497
1125
  return deletePaymentAsync;
@@ -1506,18 +1134,18 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
1506
1134
  }, {
1507
1135
  key: "updateVoucherPaymentItemsAsync",
1508
1136
  value: (function () {
1509
- var _updateVoucherPaymentItemsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(orderUuid, voucherPaymentItems) {
1510
- var _this6 = this;
1511
- return _regeneratorRuntime().wrap(function _callee18$(_context18) {
1512
- while (1) switch (_context18.prev = _context18.next) {
1137
+ var _updateVoucherPaymentItemsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(orderUuid, voucherPaymentItems) {
1138
+ var _this5 = this;
1139
+ return _regeneratorRuntime().wrap(function _callee15$(_context15) {
1140
+ while (1) switch (_context15.prev = _context15.next) {
1513
1141
  case 0:
1514
- return _context18.abrupt("return", this.runVoucherUpdateLocked(orderUuid, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
1515
- var _this6$normalizeVouch, normalizedVoucherItems, originalCount, normalizedCount, order, existingVoucherItems, _iterator6, _step6, voucherItem, orderAfterDelete, existingActiveVoucherKeys, _iterator7, _step7, _voucherItem, orderPaymentType, key, updatedOrder;
1516
- return _regeneratorRuntime().wrap(function _callee17$(_context17) {
1517
- while (1) switch (_context17.prev = _context17.next) {
1142
+ return _context15.abrupt("return", this.runVoucherUpdateLocked(orderUuid, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
1143
+ var _this5$normalizeVouch, normalizedVoucherItems, originalCount, normalizedCount, order, existingVoucherItems, _iterator2, _step2, voucherItem, orderAfterDelete, existingActiveVoucherKeys, _iterator3, _step3, _voucherItem, orderPaymentType, key, updatedOrder;
1144
+ return _regeneratorRuntime().wrap(function _callee14$(_context14) {
1145
+ while (1) switch (_context14.prev = _context14.next) {
1518
1146
  case 0:
1519
- _this6$normalizeVouch = _this6.normalizeVoucherPaymentItems(voucherPaymentItems), normalizedVoucherItems = _this6$normalizeVouch.items, originalCount = _this6$normalizeVouch.originalCount, normalizedCount = _this6$normalizeVouch.normalizedCount;
1520
- _this6.logInfo('Starting updateVoucherPaymentItemsAsync', {
1147
+ _this5$normalizeVouch = _this5.normalizeVoucherPaymentItems(voucherPaymentItems), normalizedVoucherItems = _this5$normalizeVouch.items, originalCount = _this5$normalizeVouch.originalCount, normalizedCount = _this5$normalizeVouch.normalizedCount;
1148
+ _this5.logInfo('Starting updateVoucherPaymentItemsAsync', {
1521
1149
  orderUuid: orderUuid,
1522
1150
  originalVoucherCount: originalCount,
1523
1151
  normalizedVoucherCount: normalizedCount,
@@ -1537,13 +1165,13 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
1537
1165
  normalizedCount: normalizedCount
1538
1166
  });
1539
1167
  }
1540
- _context17.prev = 3;
1541
- _context17.next = 6;
1542
- return _this6.getPaymentOrderByUuidAsync(orderUuid);
1168
+ _context14.prev = 3;
1169
+ _context14.next = 6;
1170
+ return _this5.getPaymentOrderByUuidAsync(orderUuid);
1543
1171
  case 6:
1544
- order = _context17.sent;
1172
+ order = _context14.sent;
1545
1173
  if (order) {
1546
- _context17.next = 9;
1174
+ _context14.next = 9;
1547
1175
  break;
1548
1176
  }
1549
1177
  throw new Error("\u8BA2\u5355\u4E0D\u5B58\u5728: ".concat(orderUuid));
@@ -1568,39 +1196,39 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
1568
1196
  });
1569
1197
 
1570
1198
  // 2. 删除所有现有的代金券支付项(仅删除未同步的)
1571
- _iterator6 = _createForOfIteratorHelper(existingVoucherItems);
1572
- _context17.prev = 12;
1573
- _iterator6.s();
1199
+ _iterator2 = _createForOfIteratorHelper(existingVoucherItems);
1200
+ _context14.prev = 12;
1201
+ _iterator2.s();
1574
1202
  case 14:
1575
- if ((_step6 = _iterator6.n()).done) {
1576
- _context17.next = 21;
1203
+ if ((_step2 = _iterator2.n()).done) {
1204
+ _context14.next = 21;
1577
1205
  break;
1578
1206
  }
1579
- voucherItem = _step6.value;
1207
+ voucherItem = _step2.value;
1580
1208
  console.log("[PaymentModule] \u5220\u9664\u73B0\u6709\u4EE3\u91D1\u5238\u652F\u4ED8\u9879: ".concat(voucherItem.uuid));
1581
- _context17.next = 19;
1582
- return _this6.deletePaymentAsync(orderUuid, voucherItem.uuid);
1209
+ _context14.next = 19;
1210
+ return _this5.deletePaymentAsync(orderUuid, voucherItem.uuid);
1583
1211
  case 19:
1584
- _context17.next = 14;
1212
+ _context14.next = 14;
1585
1213
  break;
1586
1214
  case 21:
1587
- _context17.next = 26;
1215
+ _context14.next = 26;
1588
1216
  break;
1589
1217
  case 23:
1590
- _context17.prev = 23;
1591
- _context17.t0 = _context17["catch"](12);
1592
- _iterator6.e(_context17.t0);
1218
+ _context14.prev = 23;
1219
+ _context14.t0 = _context14["catch"](12);
1220
+ _iterator2.e(_context14.t0);
1593
1221
  case 26:
1594
- _context17.prev = 26;
1595
- _iterator6.f();
1596
- return _context17.finish(26);
1222
+ _context14.prev = 26;
1223
+ _iterator2.f();
1224
+ return _context14.finish(26);
1597
1225
  case 29:
1598
- _context17.next = 31;
1599
- return _this6.getPaymentOrderByUuidAsync(orderUuid);
1226
+ _context14.next = 31;
1227
+ return _this5.getPaymentOrderByUuidAsync(orderUuid);
1600
1228
  case 31:
1601
- orderAfterDelete = _context17.sent;
1229
+ orderAfterDelete = _context14.sent;
1602
1230
  if (orderAfterDelete) {
1603
- _context17.next = 34;
1231
+ _context14.next = 34;
1604
1232
  break;
1605
1233
  }
1606
1234
  throw new Error("\u8BA2\u5355\u4E0D\u5B58\u5728: ".concat(orderUuid));
@@ -1614,19 +1242,19 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
1614
1242
  orderUuid: orderUuid,
1615
1243
  newItemCount: normalizedVoucherItems.length
1616
1244
  });
1617
- _iterator7 = _createForOfIteratorHelper(normalizedVoucherItems);
1618
- _context17.prev = 37;
1619
- _iterator7.s();
1245
+ _iterator3 = _createForOfIteratorHelper(normalizedVoucherItems);
1246
+ _context14.prev = 37;
1247
+ _iterator3.s();
1620
1248
  case 39:
1621
- if ((_step7 = _iterator7.n()).done) {
1622
- _context17.next = 52;
1249
+ if ((_step3 = _iterator3.n()).done) {
1250
+ _context14.next = 52;
1623
1251
  break;
1624
1252
  }
1625
- _voucherItem = _step7.value;
1253
+ _voucherItem = _step3.value;
1626
1254
  orderPaymentType = _voucherItem.order_payment_type || 'normal';
1627
1255
  key = "".concat(_voucherItem.voucher_id, "|").concat(orderPaymentType);
1628
1256
  if (!existingActiveVoucherKeys.has(key)) {
1629
- _context17.next = 46;
1257
+ _context14.next = 46;
1630
1258
  break;
1631
1259
  }
1632
1260
  console.warn('[PaymentModule] Skip adding voucher payment item because it already exists (active)', {
@@ -1634,7 +1262,7 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
1634
1262
  voucher_id: _voucherItem.voucher_id,
1635
1263
  order_payment_type: orderPaymentType
1636
1264
  });
1637
- return _context17.abrupt("continue", 50);
1265
+ return _context14.abrupt("continue", 50);
1638
1266
  case 46:
1639
1267
  console.log("[PaymentModule] \u6DFB\u52A0\u4EE3\u91D1\u5238\u652F\u4ED8\u9879:", _objectSpread(_objectSpread({}, _voucherItem), {}, {
1640
1268
  code: _voucherItem.code,
@@ -1642,66 +1270,66 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
1642
1270
  voucher_id: _voucherItem.voucher_id,
1643
1271
  order_payment_type: orderPaymentType
1644
1272
  }));
1645
- _context17.next = 49;
1646
- return _this6.addPaymentItemAsync(orderUuid, _voucherItem);
1273
+ _context14.next = 49;
1274
+ return _this5.addPaymentItemAsync(orderUuid, _voucherItem);
1647
1275
  case 49:
1648
1276
  existingActiveVoucherKeys.add(key);
1649
1277
  case 50:
1650
- _context17.next = 39;
1278
+ _context14.next = 39;
1651
1279
  break;
1652
1280
  case 52:
1653
- _context17.next = 57;
1281
+ _context14.next = 57;
1654
1282
  break;
1655
1283
  case 54:
1656
- _context17.prev = 54;
1657
- _context17.t1 = _context17["catch"](37);
1658
- _iterator7.e(_context17.t1);
1284
+ _context14.prev = 54;
1285
+ _context14.t1 = _context14["catch"](37);
1286
+ _iterator3.e(_context14.t1);
1659
1287
  case 57:
1660
- _context17.prev = 57;
1661
- _iterator7.f();
1662
- return _context17.finish(57);
1288
+ _context14.prev = 57;
1289
+ _iterator3.f();
1290
+ return _context14.finish(57);
1663
1291
  case 60:
1664
- _context17.next = 62;
1665
- return _this6.getPaymentOrderByUuidAsync(orderUuid);
1292
+ _context14.next = 62;
1293
+ return _this5.getPaymentOrderByUuidAsync(orderUuid);
1666
1294
  case 62:
1667
- updatedOrder = _context17.sent;
1668
- _context17.next = 65;
1669
- return _this6.core.effects.emit("".concat(_this6.name, ":onPaymentAdded"), {
1295
+ updatedOrder = _context14.sent;
1296
+ _context14.next = 65;
1297
+ return _this5.core.effects.emit("".concat(_this5.name, ":onPaymentAdded"), {
1670
1298
  orderUuid: orderUuid,
1671
1299
  order: updatedOrder,
1672
1300
  payment: null // 批量操作不提供单个支付项
1673
1301
  });
1674
1302
  case 65:
1675
- _this6.logInfo('updateVoucherPaymentItemsAsync completed successfully', {
1303
+ _this5.logInfo('updateVoucherPaymentItemsAsync completed successfully', {
1676
1304
  orderUuid: orderUuid,
1677
1305
  removedVoucherCount: existingVoucherItems.length,
1678
1306
  addedVoucherCount: normalizedVoucherItems.length,
1679
1307
  finalExpectAmount: updatedOrder === null || updatedOrder === void 0 ? void 0 : updatedOrder.expect_amount
1680
1308
  });
1681
- _context17.next = 73;
1309
+ _context14.next = 73;
1682
1310
  break;
1683
1311
  case 68:
1684
- _context17.prev = 68;
1685
- _context17.t2 = _context17["catch"](3);
1686
- console.error('[PaymentModule] 批量更新代金券支付项失败:', _context17.t2);
1687
- _this6.logError('updateVoucherPaymentItemsAsync failed', _context17.t2, {
1312
+ _context14.prev = 68;
1313
+ _context14.t2 = _context14["catch"](3);
1314
+ console.error('[PaymentModule] 批量更新代金券支付项失败:', _context14.t2);
1315
+ _this5.logError('updateVoucherPaymentItemsAsync failed', _context14.t2, {
1688
1316
  orderUuid: orderUuid,
1689
1317
  voucherPaymentItems: voucherPaymentItems
1690
1318
  });
1691
- throw _context17.t2;
1319
+ throw _context14.t2;
1692
1320
  case 73:
1693
1321
  case "end":
1694
- return _context17.stop();
1322
+ return _context14.stop();
1695
1323
  }
1696
- }, _callee17, null, [[3, 68], [12, 23, 26, 29], [37, 54, 57, 60]]);
1324
+ }, _callee14, null, [[3, 68], [12, 23, 26, 29], [37, 54, 57, 60]]);
1697
1325
  }))));
1698
1326
  case 1:
1699
1327
  case "end":
1700
- return _context18.stop();
1328
+ return _context15.stop();
1701
1329
  }
1702
- }, _callee18, this);
1330
+ }, _callee15, this);
1703
1331
  }));
1704
- function updateVoucherPaymentItemsAsync(_x19, _x20) {
1332
+ function updateVoucherPaymentItemsAsync(_x17, _x18) {
1705
1333
  return _updateVoucherPaymentItemsAsync.apply(this, arguments);
1706
1334
  }
1707
1335
  return updateVoucherPaymentItemsAsync;
@@ -1713,18 +1341,18 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
1713
1341
  }, {
1714
1342
  key: "updatePaymentAsync",
1715
1343
  value: (function () {
1716
- var _updatePaymentAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(orderUuid, paymentUuid, params) {
1344
+ var _updatePaymentAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(orderUuid, paymentUuid, params) {
1717
1345
  var order, paymentItem, formattedParams;
1718
- return _regeneratorRuntime().wrap(function _callee19$(_context19) {
1719
- while (1) switch (_context19.prev = _context19.next) {
1346
+ return _regeneratorRuntime().wrap(function _callee16$(_context16) {
1347
+ while (1) switch (_context16.prev = _context16.next) {
1720
1348
  case 0:
1721
- _context19.prev = 0;
1722
- _context19.next = 3;
1349
+ _context16.prev = 0;
1350
+ _context16.next = 3;
1723
1351
  return this.dbManager.get('order', orderUuid);
1724
1352
  case 3:
1725
- order = _context19.sent;
1353
+ order = _context16.sent;
1726
1354
  if (order) {
1727
- _context19.next = 6;
1355
+ _context16.next = 6;
1728
1356
  break;
1729
1357
  }
1730
1358
  throw new Error('订单不存在');
@@ -1733,7 +1361,7 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
1733
1361
  return payment.uuid === paymentUuid;
1734
1362
  });
1735
1363
  if (!paymentItem) {
1736
- _context19.next = 18;
1364
+ _context16.next = 18;
1737
1365
  break;
1738
1366
  }
1739
1367
  // 如果更新参数中包含 amount,先格式化
@@ -1747,36 +1375,36 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
1747
1375
  this.recalculateOrderAmount(order);
1748
1376
 
1749
1377
  // 更新到 IndexDB
1750
- _context19.next = 14;
1378
+ _context16.next = 14;
1751
1379
  return this.dbManager.update('order', order);
1752
1380
  case 14:
1753
- _context19.next = 16;
1381
+ _context16.next = 16;
1754
1382
  return this.core.effects.emit("".concat(this.name, ":onPaymentUpdated"), {
1755
1383
  order: order,
1756
1384
  paymentItem: paymentItem
1757
1385
  });
1758
1386
  case 16:
1759
- _context19.next = 18;
1387
+ _context16.next = 18;
1760
1388
  return this.core.effects.emit("".concat(this.name, ":onOrderChanged"), {
1761
1389
  action: 'payment_update',
1762
1390
  order: order,
1763
1391
  paymentItem: paymentItem
1764
1392
  });
1765
1393
  case 18:
1766
- _context19.next = 24;
1394
+ _context16.next = 24;
1767
1395
  break;
1768
1396
  case 20:
1769
- _context19.prev = 20;
1770
- _context19.t0 = _context19["catch"](0);
1771
- console.error('[PaymentModule] 更新支付项失败', _context19.t0);
1772
- throw _context19.t0;
1397
+ _context16.prev = 20;
1398
+ _context16.t0 = _context16["catch"](0);
1399
+ console.error('[PaymentModule] 更新支付项失败', _context16.t0);
1400
+ throw _context16.t0;
1773
1401
  case 24:
1774
1402
  case "end":
1775
- return _context19.stop();
1403
+ return _context16.stop();
1776
1404
  }
1777
- }, _callee19, this, [[0, 20]]);
1405
+ }, _callee16, this, [[0, 20]]);
1778
1406
  }));
1779
- function updatePaymentAsync(_x21, _x22, _x23) {
1407
+ function updatePaymentAsync(_x19, _x20, _x21) {
1780
1408
  return _updatePaymentAsync.apply(this, arguments);
1781
1409
  }
1782
1410
  return updatePaymentAsync;
@@ -1788,61 +1416,61 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
1788
1416
  }, {
1789
1417
  key: "submitPayAsync",
1790
1418
  value: (function () {
1791
- var _submitPayAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(orderUuid) {
1792
- var orderToSubmit, order, allOrders, _iterator8, _step8, _order, result;
1793
- return _regeneratorRuntime().wrap(function _callee20$(_context20) {
1794
- while (1) switch (_context20.prev = _context20.next) {
1419
+ var _submitPayAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(orderUuid) {
1420
+ var orderToSubmit, order, allOrders, _iterator4, _step4, _order, result;
1421
+ return _regeneratorRuntime().wrap(function _callee17$(_context17) {
1422
+ while (1) switch (_context17.prev = _context17.next) {
1795
1423
  case 0:
1796
1424
  this.logInfo('Starting submitPayAsync', {
1797
1425
  orderUuid: orderUuid
1798
1426
  });
1799
- _context20.prev = 1;
1427
+ _context17.prev = 1;
1800
1428
  if (!orderUuid) {
1801
- _context20.next = 9;
1429
+ _context17.next = 9;
1802
1430
  break;
1803
1431
  }
1804
- _context20.next = 5;
1432
+ _context17.next = 5;
1805
1433
  return this.dbManager.get('order', orderUuid);
1806
1434
  case 5:
1807
- order = _context20.sent;
1435
+ order = _context17.sent;
1808
1436
  orderToSubmit = order ? [order] : [];
1809
- _context20.next = 13;
1437
+ _context17.next = 13;
1810
1438
  break;
1811
1439
  case 9:
1812
- _context20.next = 11;
1440
+ _context17.next = 11;
1813
1441
  return this.dbManager.getAll('order');
1814
1442
  case 11:
1815
- allOrders = _context20.sent;
1443
+ allOrders = _context17.sent;
1816
1444
  // 包括正在处理中的订单和部分支付的订单(可能添加了新的支付项)
1817
1445
  orderToSubmit = allOrders.filter(function (order) {
1818
1446
  return order.payment_status === PaymentStatus.Processing || order.payment_status === PaymentStatus.PartiallyPaid;
1819
1447
  });
1820
1448
  case 13:
1821
- _iterator8 = _createForOfIteratorHelper(orderToSubmit);
1822
- _context20.prev = 14;
1823
- _iterator8.s();
1449
+ _iterator4 = _createForOfIteratorHelper(orderToSubmit);
1450
+ _context17.prev = 14;
1451
+ _iterator4.s();
1824
1452
  case 16:
1825
- if ((_step8 = _iterator8.n()).done) {
1826
- _context20.next = 22;
1453
+ if ((_step4 = _iterator4.n()).done) {
1454
+ _context17.next = 22;
1827
1455
  break;
1828
1456
  }
1829
- _order = _step8.value;
1830
- _context20.next = 20;
1457
+ _order = _step4.value;
1458
+ _context17.next = 20;
1831
1459
  return this.submitSingleOrderPayment(_order);
1832
1460
  case 20:
1833
- _context20.next = 16;
1461
+ _context17.next = 16;
1834
1462
  break;
1835
1463
  case 22:
1836
- _context20.next = 27;
1464
+ _context17.next = 27;
1837
1465
  break;
1838
1466
  case 24:
1839
- _context20.prev = 24;
1840
- _context20.t0 = _context20["catch"](14);
1841
- _iterator8.e(_context20.t0);
1467
+ _context17.prev = 24;
1468
+ _context17.t0 = _context17["catch"](14);
1469
+ _iterator4.e(_context17.t0);
1842
1470
  case 27:
1843
- _context20.prev = 27;
1844
- _iterator8.f();
1845
- return _context20.finish(27);
1471
+ _context17.prev = 27;
1472
+ _iterator4.f();
1473
+ return _context17.finish(27);
1846
1474
  case 30:
1847
1475
  result = {
1848
1476
  status: 'success'
@@ -1851,24 +1479,24 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
1851
1479
  result: result.status,
1852
1480
  processedOrdersCount: orderToSubmit.length
1853
1481
  });
1854
- return _context20.abrupt("return", result);
1482
+ return _context17.abrupt("return", result);
1855
1483
  case 35:
1856
- _context20.prev = 35;
1857
- _context20.t1 = _context20["catch"](1);
1858
- console.error('[PaymentModule] 提交支付失败', _context20.t1);
1859
- this.logError('submitPayAsync failed', _context20.t1, {
1484
+ _context17.prev = 35;
1485
+ _context17.t1 = _context17["catch"](1);
1486
+ console.error('[PaymentModule] 提交支付失败', _context17.t1);
1487
+ this.logError('submitPayAsync failed', _context17.t1, {
1860
1488
  orderUuid: orderUuid
1861
1489
  });
1862
- return _context20.abrupt("return", {
1490
+ return _context17.abrupt("return", {
1863
1491
  status: 'failed'
1864
1492
  });
1865
1493
  case 40:
1866
1494
  case "end":
1867
- return _context20.stop();
1495
+ return _context17.stop();
1868
1496
  }
1869
- }, _callee20, this, [[1, 35], [14, 24, 27, 30]]);
1497
+ }, _callee17, this, [[1, 35], [14, 24, 27, 30]]);
1870
1498
  }));
1871
- function submitPayAsync(_x24) {
1499
+ function submitPayAsync(_x22) {
1872
1500
  return _submitPayAsync.apply(this, arguments);
1873
1501
  }
1874
1502
  return submitPayAsync;
@@ -1880,12 +1508,12 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
1880
1508
  }, {
1881
1509
  key: "submitSingleOrderPayment",
1882
1510
  value: (function () {
1883
- var _submitSingleOrderPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(order) {
1511
+ var _submitSingleOrderPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(order) {
1884
1512
  var paymentData, totalPaidAmount, orderTotalAmount;
1885
- return _regeneratorRuntime().wrap(function _callee21$(_context21) {
1886
- while (1) switch (_context21.prev = _context21.next) {
1513
+ return _regeneratorRuntime().wrap(function _callee18$(_context18) {
1514
+ while (1) switch (_context18.prev = _context18.next) {
1887
1515
  case 0:
1888
- _context21.prev = 0;
1516
+ _context18.prev = 0;
1889
1517
  paymentData = {
1890
1518
  payments: order.payment.map(function (payment) {
1891
1519
  return {
@@ -1921,11 +1549,11 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
1921
1549
  paymentData.payment_status = order.payment_status === PaymentStatus.Finished ? 'paid' : 'partially_paid';
1922
1550
 
1923
1551
  // 更新订单状态到数据库
1924
- _context21.next = 8;
1552
+ _context18.next = 8;
1925
1553
  return this.dbManager.update('order', order);
1926
1554
  case 8:
1927
1555
  if (!(paymentData.payments.length === 0)) {
1928
- _context21.next = 12;
1556
+ _context18.next = 12;
1929
1557
  break;
1930
1558
  }
1931
1559
  console.log("[PaymentModule] \u8BA2\u5355 ".concat(order.uuid, " \u652F\u4ED8\u5217\u8868\u4E3A\u7A7A\uFF0C\u8DF3\u8FC7\u652F\u4ED8\u5904\u7406"));
@@ -1933,31 +1561,31 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
1933
1561
  orderUuid: order.uuid,
1934
1562
  orderId: order.order_id
1935
1563
  });
1936
- return _context21.abrupt("return");
1564
+ return _context18.abrupt("return");
1937
1565
  case 12:
1938
- _context21.next = 14;
1566
+ _context18.next = 14;
1939
1567
  return this.core.effects.emit("".concat(this.name, ":onPaymentSubmitted"), order);
1940
1568
  case 14:
1941
- _context21.next = 16;
1569
+ _context18.next = 16;
1942
1570
  return this.core.effects.emit("".concat(this.name, ":onOrderChanged"), {
1943
1571
  action: 'submit',
1944
1572
  order: order
1945
1573
  });
1946
1574
  case 16:
1947
- _context21.next = 22;
1575
+ _context18.next = 22;
1948
1576
  break;
1949
1577
  case 18:
1950
- _context21.prev = 18;
1951
- _context21.t0 = _context21["catch"](0);
1952
- console.error("[PaymentModule] \u8BA2\u5355 ".concat(order.uuid, " \u652F\u4ED8\u63D0\u4EA4\u5931\u8D25"), _context21.t0);
1953
- throw _context21.t0;
1578
+ _context18.prev = 18;
1579
+ _context18.t0 = _context18["catch"](0);
1580
+ console.error("[PaymentModule] \u8BA2\u5355 ".concat(order.uuid, " \u652F\u4ED8\u63D0\u4EA4\u5931\u8D25"), _context18.t0);
1581
+ throw _context18.t0;
1954
1582
  case 22:
1955
1583
  case "end":
1956
- return _context21.stop();
1584
+ return _context18.stop();
1957
1585
  }
1958
- }, _callee21, this, [[0, 18]]);
1586
+ }, _callee18, this, [[0, 18]]);
1959
1587
  }));
1960
- function submitSingleOrderPayment(_x25) {
1588
+ function submitSingleOrderPayment(_x23) {
1961
1589
  return _submitSingleOrderPayment.apply(this, arguments);
1962
1590
  }
1963
1591
  return submitSingleOrderPayment;
@@ -1969,29 +1597,29 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
1969
1597
  }, {
1970
1598
  key: "getRemainingOrderAmountAsync",
1971
1599
  value: (function () {
1972
- var _getRemainingOrderAmountAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(orderUuid) {
1600
+ var _getRemainingOrderAmountAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(orderUuid) {
1973
1601
  var order;
1974
- return _regeneratorRuntime().wrap(function _callee22$(_context22) {
1975
- while (1) switch (_context22.prev = _context22.next) {
1602
+ return _regeneratorRuntime().wrap(function _callee19$(_context19) {
1603
+ while (1) switch (_context19.prev = _context19.next) {
1976
1604
  case 0:
1977
- _context22.next = 2;
1605
+ _context19.next = 2;
1978
1606
  return this.getPaymentOrderByUuidAsync(orderUuid);
1979
1607
  case 2:
1980
- order = _context22.sent;
1608
+ order = _context19.sent;
1981
1609
  if (order) {
1982
- _context22.next = 5;
1610
+ _context19.next = 5;
1983
1611
  break;
1984
1612
  }
1985
1613
  throw new Error('订单不存在');
1986
1614
  case 5:
1987
- return _context22.abrupt("return", new Decimal(order.expect_amount).toNumber());
1615
+ return _context19.abrupt("return", new Decimal(order.expect_amount).toNumber());
1988
1616
  case 6:
1989
1617
  case "end":
1990
- return _context22.stop();
1618
+ return _context19.stop();
1991
1619
  }
1992
- }, _callee22, this);
1620
+ }, _callee19, this);
1993
1621
  }));
1994
- function getRemainingOrderAmountAsync(_x26) {
1622
+ function getRemainingOrderAmountAsync(_x24) {
1995
1623
  return _getRemainingOrderAmountAsync.apply(this, arguments);
1996
1624
  }
1997
1625
  return getRemainingOrderAmountAsync;
@@ -2003,65 +1631,65 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
2003
1631
  }, {
2004
1632
  key: "getRemainingOrderAmountWithInputAsync",
2005
1633
  value: (function () {
2006
- var _getRemainingOrderAmountWithInputAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(inputAmount, orderUuid) {
1634
+ var _getRemainingOrderAmountWithInputAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(inputAmount, orderUuid) {
2007
1635
  var order, inputDecimal;
2008
- return _regeneratorRuntime().wrap(function _callee23$(_context23) {
2009
- while (1) switch (_context23.prev = _context23.next) {
1636
+ return _regeneratorRuntime().wrap(function _callee20$(_context20) {
1637
+ while (1) switch (_context20.prev = _context20.next) {
2010
1638
  case 0:
2011
- _context23.next = 2;
1639
+ _context20.next = 2;
2012
1640
  return this.getPaymentOrderByUuidAsync(orderUuid);
2013
1641
  case 2:
2014
- order = _context23.sent;
1642
+ order = _context20.sent;
2015
1643
  if (order) {
2016
- _context23.next = 5;
1644
+ _context20.next = 5;
2017
1645
  break;
2018
1646
  }
2019
1647
  throw new Error('订单不存在');
2020
1648
  case 5:
2021
1649
  if (!(inputAmount === null || inputAmount === undefined)) {
2022
- _context23.next = 7;
1650
+ _context20.next = 7;
2023
1651
  break;
2024
1652
  }
2025
- return _context23.abrupt("return", new Decimal(order.expect_amount).toNumber());
1653
+ return _context20.abrupt("return", new Decimal(order.expect_amount).toNumber());
2026
1654
  case 7:
2027
1655
  if (!(typeof inputAmount === 'string')) {
2028
- _context23.next = 10;
1656
+ _context20.next = 10;
2029
1657
  break;
2030
1658
  }
2031
1659
  if (!(inputAmount.trim() === '')) {
2032
- _context23.next = 10;
1660
+ _context20.next = 10;
2033
1661
  break;
2034
1662
  }
2035
- return _context23.abrupt("return", new Decimal(order.expect_amount).toNumber());
1663
+ return _context20.abrupt("return", new Decimal(order.expect_amount).toNumber());
2036
1664
  case 10:
2037
1665
  if (!(typeof inputAmount === 'number')) {
2038
- _context23.next = 14;
1666
+ _context20.next = 14;
2039
1667
  break;
2040
1668
  }
2041
1669
  if (!(isNaN(inputAmount) || !isFinite(inputAmount))) {
2042
- _context23.next = 14;
1670
+ _context20.next = 14;
2043
1671
  break;
2044
1672
  }
2045
1673
  // 如果输入是 NaN 或无穷大,返回原始的待付金额
2046
1674
  console.warn("[PaymentModule] \u8F93\u5165\u91D1\u989D\u4E0D\u662F\u6709\u6548\u6570\u5B57: ".concat(inputAmount, "\uFF0C\u8FD4\u56DE\u539F\u59CB\u5F85\u4ED8\u91D1\u989D"));
2047
- return _context23.abrupt("return", new Decimal(order.expect_amount).toNumber());
1675
+ return _context20.abrupt("return", new Decimal(order.expect_amount).toNumber());
2048
1676
  case 14:
2049
- _context23.prev = 14;
1677
+ _context20.prev = 14;
2050
1678
  inputDecimal = new Decimal(inputAmount);
2051
- return _context23.abrupt("return", new Decimal(order.expect_amount).minus(inputDecimal).toNumber());
1679
+ return _context20.abrupt("return", new Decimal(order.expect_amount).minus(inputDecimal).toNumber());
2052
1680
  case 19:
2053
- _context23.prev = 19;
2054
- _context23.t0 = _context23["catch"](14);
1681
+ _context20.prev = 19;
1682
+ _context20.t0 = _context20["catch"](14);
2055
1683
  // 如果输入不是有效的数字,返回原始的待付金额
2056
1684
  console.warn("[PaymentModule] \u8F93\u5165\u91D1\u989D\u683C\u5F0F\u65E0\u6548: ".concat(inputAmount, "\uFF0C\u8FD4\u56DE\u539F\u59CB\u5F85\u4ED8\u91D1\u989D"));
2057
- return _context23.abrupt("return", new Decimal(order.expect_amount).toNumber());
1685
+ return _context20.abrupt("return", new Decimal(order.expect_amount).toNumber());
2058
1686
  case 23:
2059
1687
  case "end":
2060
- return _context23.stop();
1688
+ return _context20.stop();
2061
1689
  }
2062
- }, _callee23, this, [[14, 19]]);
1690
+ }, _callee20, this, [[14, 19]]);
2063
1691
  }));
2064
- function getRemainingOrderAmountWithInputAsync(_x27, _x28) {
1692
+ function getRemainingOrderAmountWithInputAsync(_x25, _x26) {
2065
1693
  return _getRemainingOrderAmountWithInputAsync.apply(this, arguments);
2066
1694
  }
2067
1695
  return getRemainingOrderAmountWithInputAsync;
@@ -2128,29 +1756,29 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
2128
1756
  }, {
2129
1757
  key: "getCashPaymentMethod",
2130
1758
  value: (function () {
2131
- var _getCashPaymentMethod = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
1759
+ var _getCashPaymentMethod = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21() {
2132
1760
  var payMethods;
2133
- return _regeneratorRuntime().wrap(function _callee24$(_context24) {
2134
- while (1) switch (_context24.prev = _context24.next) {
1761
+ return _regeneratorRuntime().wrap(function _callee21$(_context21) {
1762
+ while (1) switch (_context21.prev = _context21.next) {
2135
1763
  case 0:
2136
- _context24.prev = 0;
2137
- _context24.next = 3;
1764
+ _context21.prev = 0;
1765
+ _context21.next = 3;
2138
1766
  return this.dbManager.getAll('pay_method');
2139
1767
  case 3:
2140
- payMethods = _context24.sent;
2141
- return _context24.abrupt("return", payMethods.find(function (method) {
1768
+ payMethods = _context21.sent;
1769
+ return _context21.abrupt("return", payMethods.find(function (method) {
2142
1770
  return method.code === PaymentMethodType.Cash;
2143
1771
  }) || null);
2144
1772
  case 7:
2145
- _context24.prev = 7;
2146
- _context24.t0 = _context24["catch"](0);
2147
- console.error('[PaymentModule] 获取现金支付方式失败', _context24.t0);
2148
- return _context24.abrupt("return", null);
1773
+ _context21.prev = 7;
1774
+ _context21.t0 = _context21["catch"](0);
1775
+ console.error('[PaymentModule] 获取现金支付方式失败', _context21.t0);
1776
+ return _context21.abrupt("return", null);
2149
1777
  case 11:
2150
1778
  case "end":
2151
- return _context24.stop();
1779
+ return _context21.stop();
2152
1780
  }
2153
- }, _callee24, this, [[0, 7]]);
1781
+ }, _callee21, this, [[0, 7]]);
2154
1782
  }));
2155
1783
  function getCashPaymentMethod() {
2156
1784
  return _getCashPaymentMethod.apply(this, arguments);
@@ -2164,29 +1792,29 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
2164
1792
  }, {
2165
1793
  key: "getEftposPaymentMethod",
2166
1794
  value: (function () {
2167
- var _getEftposPaymentMethod = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
1795
+ var _getEftposPaymentMethod = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22() {
2168
1796
  var payMethods;
2169
- return _regeneratorRuntime().wrap(function _callee25$(_context25) {
2170
- while (1) switch (_context25.prev = _context25.next) {
1797
+ return _regeneratorRuntime().wrap(function _callee22$(_context22) {
1798
+ while (1) switch (_context22.prev = _context22.next) {
2171
1799
  case 0:
2172
- _context25.prev = 0;
2173
- _context25.next = 3;
1800
+ _context22.prev = 0;
1801
+ _context22.next = 3;
2174
1802
  return this.dbManager.getAll('pay_method');
2175
1803
  case 3:
2176
- payMethods = _context25.sent;
2177
- return _context25.abrupt("return", payMethods.find(function (method) {
1804
+ payMethods = _context22.sent;
1805
+ return _context22.abrupt("return", payMethods.find(function (method) {
2178
1806
  return method.code === PaymentMethodType.Eftpos;
2179
1807
  }) || null);
2180
1808
  case 7:
2181
- _context25.prev = 7;
2182
- _context25.t0 = _context25["catch"](0);
2183
- console.error('[PaymentModule] 获取Eftpos支付方式失败', _context25.t0);
2184
- return _context25.abrupt("return", null);
1809
+ _context22.prev = 7;
1810
+ _context22.t0 = _context22["catch"](0);
1811
+ console.error('[PaymentModule] 获取Eftpos支付方式失败', _context22.t0);
1812
+ return _context22.abrupt("return", null);
2185
1813
  case 11:
2186
1814
  case "end":
2187
- return _context25.stop();
1815
+ return _context22.stop();
2188
1816
  }
2189
- }, _callee25, this, [[0, 7]]);
1817
+ }, _callee22, this, [[0, 7]]);
2190
1818
  }));
2191
1819
  function getEftposPaymentMethod() {
2192
1820
  return _getEftposPaymentMethod.apply(this, arguments);
@@ -2200,29 +1828,29 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
2200
1828
  }, {
2201
1829
  key: "getWalletPaymentMethod",
2202
1830
  value: (function () {
2203
- var _getWalletPaymentMethod = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26() {
1831
+ var _getWalletPaymentMethod = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23() {
2204
1832
  var payMethods;
2205
- return _regeneratorRuntime().wrap(function _callee26$(_context26) {
2206
- while (1) switch (_context26.prev = _context26.next) {
1833
+ return _regeneratorRuntime().wrap(function _callee23$(_context23) {
1834
+ while (1) switch (_context23.prev = _context23.next) {
2207
1835
  case 0:
2208
- _context26.prev = 0;
2209
- _context26.next = 3;
1836
+ _context23.prev = 0;
1837
+ _context23.next = 3;
2210
1838
  return this.dbManager.getAll('pay_method');
2211
1839
  case 3:
2212
- payMethods = _context26.sent;
2213
- return _context26.abrupt("return", payMethods.find(function (method) {
1840
+ payMethods = _context23.sent;
1841
+ return _context23.abrupt("return", payMethods.find(function (method) {
2214
1842
  return method.code === PaymentMethodType.Wallet;
2215
1843
  }) || null);
2216
1844
  case 7:
2217
- _context26.prev = 7;
2218
- _context26.t0 = _context26["catch"](0);
2219
- console.error('[PaymentModule] 获取钱包支付方式失败', _context26.t0);
2220
- return _context26.abrupt("return", null);
1845
+ _context23.prev = 7;
1846
+ _context23.t0 = _context23["catch"](0);
1847
+ console.error('[PaymentModule] 获取钱包支付方式失败', _context23.t0);
1848
+ return _context23.abrupt("return", null);
2221
1849
  case 11:
2222
1850
  case "end":
2223
- return _context26.stop();
1851
+ return _context23.stop();
2224
1852
  }
2225
- }, _callee26, this, [[0, 7]]);
1853
+ }, _callee23, this, [[0, 7]]);
2226
1854
  }));
2227
1855
  function getWalletPaymentMethod() {
2228
1856
  return _getWalletPaymentMethod.apply(this, arguments);
@@ -2232,42 +1860,43 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
2232
1860
  /**
2233
1861
  * 确保支付模块所需的数据库表已创建
2234
1862
  */
1863
+ /** @deprecated */
2235
1864
  )
2236
1865
  }, {
2237
1866
  key: "ensurePaymentTables",
2238
1867
  value: (function () {
2239
- var _ensurePaymentTables = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27() {
2240
- return _regeneratorRuntime().wrap(function _callee27$(_context27) {
2241
- while (1) switch (_context27.prev = _context27.next) {
1868
+ var _ensurePaymentTables = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
1869
+ return _regeneratorRuntime().wrap(function _callee24$(_context24) {
1870
+ while (1) switch (_context24.prev = _context24.next) {
2242
1871
  case 0:
2243
- _context27.prev = 0;
2244
- _context27.next = 3;
1872
+ _context24.prev = 0;
1873
+ _context24.next = 3;
2245
1874
  return this.dbManager.getAll('pay_method');
2246
1875
  case 3:
2247
- _context27.next = 9;
1876
+ _context24.next = 9;
2248
1877
  break;
2249
1878
  case 5:
2250
- _context27.prev = 5;
2251
- _context27.t0 = _context27["catch"](0);
1879
+ _context24.prev = 5;
1880
+ _context24.t0 = _context24["catch"](0);
2252
1881
  console.warn('[PaymentModule] pay_method 表不存在,请在数据库配置中添加以下配置:');
2253
1882
  console.warn('{ name: "pay_method", keyPath: "id" }');
2254
1883
  case 9:
2255
- _context27.prev = 9;
2256
- _context27.next = 12;
1884
+ _context24.prev = 9;
1885
+ _context24.next = 12;
2257
1886
  return this.dbManager.getAll('order');
2258
1887
  case 12:
2259
- _context27.next = 18;
1888
+ _context24.next = 18;
2260
1889
  break;
2261
1890
  case 14:
2262
- _context27.prev = 14;
2263
- _context27.t1 = _context27["catch"](9);
1891
+ _context24.prev = 14;
1892
+ _context24.t1 = _context24["catch"](9);
2264
1893
  console.warn('[PaymentModule] order 表不存在,请在数据库配置中添加以下配置:');
2265
1894
  console.warn('{ name: "order", keyPath: "uuid" }');
2266
1895
  case 18:
2267
1896
  case "end":
2268
- return _context27.stop();
1897
+ return _context24.stop();
2269
1898
  }
2270
- }, _callee27, this, [[0, 5], [9, 14]]);
1899
+ }, _callee24, this, [[0, 5], [9, 14]]);
2271
1900
  }));
2272
1901
  function ensurePaymentTables() {
2273
1902
  return _ensurePaymentTables.apply(this, arguments);
@@ -2277,33 +1906,34 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
2277
1906
  /**
2278
1907
  * 获取部分支付的订单
2279
1908
  */
1909
+ /** @deprecated */
2280
1910
  )
2281
1911
  }, {
2282
1912
  key: "getPartiallyPaidOrdersAsync",
2283
1913
  value: (function () {
2284
- var _getPartiallyPaidOrdersAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28() {
1914
+ var _getPartiallyPaidOrdersAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
2285
1915
  var allOrders;
2286
- return _regeneratorRuntime().wrap(function _callee28$(_context28) {
2287
- while (1) switch (_context28.prev = _context28.next) {
1916
+ return _regeneratorRuntime().wrap(function _callee25$(_context25) {
1917
+ while (1) switch (_context25.prev = _context25.next) {
2288
1918
  case 0:
2289
- _context28.prev = 0;
2290
- _context28.next = 3;
1919
+ _context25.prev = 0;
1920
+ _context25.next = 3;
2291
1921
  return this.dbManager.getAll('order');
2292
1922
  case 3:
2293
- allOrders = _context28.sent;
2294
- return _context28.abrupt("return", allOrders.filter(function (order) {
1923
+ allOrders = _context25.sent;
1924
+ return _context25.abrupt("return", allOrders.filter(function (order) {
2295
1925
  return order.payment_status === PaymentStatus.PartiallyPaid;
2296
1926
  }));
2297
1927
  case 7:
2298
- _context28.prev = 7;
2299
- _context28.t0 = _context28["catch"](0);
2300
- console.error('[PaymentModule] 获取部分支付订单失败', _context28.t0);
2301
- return _context28.abrupt("return", []);
1928
+ _context25.prev = 7;
1929
+ _context25.t0 = _context25["catch"](0);
1930
+ console.error('[PaymentModule] 获取部分支付订单失败', _context25.t0);
1931
+ return _context25.abrupt("return", []);
2302
1932
  case 11:
2303
1933
  case "end":
2304
- return _context28.stop();
1934
+ return _context25.stop();
2305
1935
  }
2306
- }, _callee28, this, [[0, 7]]);
1936
+ }, _callee25, this, [[0, 7]]);
2307
1937
  }));
2308
1938
  function getPartiallyPaidOrdersAsync() {
2309
1939
  return _getPartiallyPaidOrdersAsync.apply(this, arguments);
@@ -2324,17 +1954,17 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
2324
1954
  }, {
2325
1955
  key: "roundAmountAsync",
2326
1956
  value: function () {
2327
- var _roundAmountAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(originalAmount, interval, rule) {
1957
+ var _roundAmountAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(originalAmount, interval, rule) {
2328
1958
  var amount, roundingInterval, supportedIntervals, intervalValue, baseValue, roundedValue, finalAmount, originalAmountStr, roundedAmountStr, roundingDifference, roundingDifferenceStr;
2329
- return _regeneratorRuntime().wrap(function _callee29$(_context29) {
2330
- while (1) switch (_context29.prev = _context29.next) {
1959
+ return _regeneratorRuntime().wrap(function _callee26$(_context26) {
1960
+ while (1) switch (_context26.prev = _context26.next) {
2331
1961
  case 0:
2332
- _context29.prev = 0;
1962
+ _context26.prev = 0;
2333
1963
  // 参数验证
2334
1964
  amount = new Decimal(originalAmount);
2335
1965
  roundingInterval = new Decimal(interval);
2336
1966
  if (!roundingInterval.lte(0)) {
2337
- _context29.next = 5;
1967
+ _context26.next = 5;
2338
1968
  break;
2339
1969
  }
2340
1970
  throw new Error('舍入间隔必须大于 0');
@@ -2349,25 +1979,25 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
2349
1979
  // 计算基础值:x / interval
2350
1980
  baseValue = amount.div(roundingInterval);
2351
1981
  console.log("[PaymentModule] \u820D\u5165\u8BA1\u7B97 - \u539F\u59CB\u91D1\u989D: ".concat(amount.toString(), ", \u95F4\u9694: ").concat(intervalValue, ", \u57FA\u7840\u503C: ").concat(baseValue.toString(), ", \u89C4\u5219: ").concat(rule));
2352
- _context29.t0 = rule;
2353
- _context29.next = _context29.t0 === RoundingRule.Standard ? 13 : _context29.t0 === 'standard' ? 13 : _context29.t0 === RoundingRule.StandardDown ? 15 : _context29.t0 === 'standard_down' ? 15 : _context29.t0 === RoundingRule.AlwaysUp ? 17 : _context29.t0 === 'always_up' ? 17 : _context29.t0 === RoundingRule.AlwaysDown ? 19 : _context29.t0 === 'always_down' ? 19 : 21;
1982
+ _context26.t0 = rule;
1983
+ _context26.next = _context26.t0 === RoundingRule.Standard ? 13 : _context26.t0 === 'standard' ? 13 : _context26.t0 === RoundingRule.StandardDown ? 15 : _context26.t0 === 'standard_down' ? 15 : _context26.t0 === RoundingRule.AlwaysUp ? 17 : _context26.t0 === 'always_up' ? 17 : _context26.t0 === RoundingRule.AlwaysDown ? 19 : _context26.t0 === 'always_down' ? 19 : 21;
2354
1984
  break;
2355
1985
  case 13:
2356
1986
  // 标准舍入(中点向上)
2357
1987
  roundedValue = this.standardRound(baseValue, true);
2358
- return _context29.abrupt("break", 22);
1988
+ return _context26.abrupt("break", 22);
2359
1989
  case 15:
2360
1990
  // 标准舍入(中点向下)
2361
1991
  roundedValue = this.standardRound(baseValue, false);
2362
- return _context29.abrupt("break", 22);
1992
+ return _context26.abrupt("break", 22);
2363
1993
  case 17:
2364
1994
  // 总是向上舍入
2365
1995
  roundedValue = baseValue.ceil();
2366
- return _context29.abrupt("break", 22);
1996
+ return _context26.abrupt("break", 22);
2367
1997
  case 19:
2368
1998
  // 总是向下舍入
2369
1999
  roundedValue = baseValue.floor();
2370
- return _context29.abrupt("break", 22);
2000
+ return _context26.abrupt("break", 22);
2371
2001
  case 21:
2372
2002
  throw new Error("\u4E0D\u652F\u6301\u7684\u820D\u5165\u89C4\u5219: ".concat(rule));
2373
2003
  case 22:
@@ -2375,11 +2005,11 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
2375
2005
  finalAmount = roundedValue.mul(roundingInterval);
2376
2006
  originalAmountStr = amount.toFixed(2); // 如果最终金额是 0 元,则不采用舍入金额,返回原始金额
2377
2007
  if (!finalAmount.eq(0)) {
2378
- _context29.next = 27;
2008
+ _context26.next = 27;
2379
2009
  break;
2380
2010
  }
2381
2011
  console.log("[PaymentModule] \u6700\u7EC8\u91D1\u989D\u4E3A0\uFF0C\u8FD4\u56DE\u539F\u59CB\u91D1\u989D: ".concat(originalAmountStr));
2382
- return _context29.abrupt("return", {
2012
+ return _context26.abrupt("return", {
2383
2013
  originalAmount: originalAmountStr,
2384
2014
  roundedAmount: originalAmountStr,
2385
2015
  roundingDifference: '0.00'
@@ -2389,23 +2019,23 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
2389
2019
  roundingDifference = finalAmount.sub(amount);
2390
2020
  roundingDifferenceStr = roundingDifference.toFixed(2);
2391
2021
  console.log("[PaymentModule] \u820D\u5165\u7ED3\u679C - \u539F\u59CB\u91D1\u989D: ".concat(originalAmountStr, ", \u820D\u5165\u540E\u91D1\u989D: ").concat(roundedAmountStr, ", \u820D\u5165\u5DEE\u989D: ").concat(roundingDifferenceStr));
2392
- return _context29.abrupt("return", {
2022
+ return _context26.abrupt("return", {
2393
2023
  originalAmount: originalAmountStr,
2394
2024
  roundedAmount: roundedAmountStr,
2395
2025
  roundingDifference: roundingDifferenceStr
2396
2026
  });
2397
2027
  case 34:
2398
- _context29.prev = 34;
2399
- _context29.t1 = _context29["catch"](0);
2400
- console.error('[PaymentModule] 金额舍入失败:', _context29.t1);
2401
- throw new Error("\u91D1\u989D\u820D\u5165\u5931\u8D25: ".concat(_context29.t1 instanceof Error ? _context29.t1.message : String(_context29.t1)));
2028
+ _context26.prev = 34;
2029
+ _context26.t1 = _context26["catch"](0);
2030
+ console.error('[PaymentModule] 金额舍入失败:', _context26.t1);
2031
+ throw new Error("\u91D1\u989D\u820D\u5165\u5931\u8D25: ".concat(_context26.t1 instanceof Error ? _context26.t1.message : String(_context26.t1)));
2402
2032
  case 38:
2403
2033
  case "end":
2404
- return _context29.stop();
2034
+ return _context26.stop();
2405
2035
  }
2406
- }, _callee29, this, [[0, 34]]);
2036
+ }, _callee26, this, [[0, 34]]);
2407
2037
  }));
2408
- function roundAmountAsync(_x29, _x30, _x31) {
2038
+ function roundAmountAsync(_x27, _x28, _x29) {
2409
2039
  return _roundAmountAsync.apply(this, arguments);
2410
2040
  }
2411
2041
  return roundAmountAsync;