@pisell/pisellos 3.0.76 → 3.0.78

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 (314) hide show
  1. package/dist/core/index.js +1 -2
  2. package/dist/effects/index.d.ts +3 -5
  3. package/dist/effects/index.js +8 -40
  4. package/dist/modules/Account/index.js +3 -2
  5. package/dist/modules/AccountList/index.d.ts +1 -7
  6. package/dist/modules/AccountList/index.js +14 -81
  7. package/dist/modules/AccountList/types.d.ts +0 -28
  8. package/dist/modules/AccountList/types.js +0 -8
  9. package/dist/modules/BaseModule.d.ts +0 -3
  10. package/dist/modules/BaseModule.js +0 -15
  11. package/dist/modules/Cart/index.d.ts +0 -1
  12. package/dist/modules/Cart/index.js +1 -2
  13. package/dist/modules/Date/types.d.ts +3 -1
  14. package/dist/modules/Discount/index.d.ts +0 -1
  15. package/dist/modules/Discount/index.js +1 -1
  16. package/dist/modules/Guests/index.js +9 -9
  17. package/dist/modules/Order/index.d.ts +1 -25
  18. package/dist/modules/Order/index.js +3 -224
  19. package/dist/modules/Order/types.d.ts +0 -45
  20. package/dist/modules/Order/types.js +0 -8
  21. package/dist/modules/Order/utils.js +1 -1
  22. package/dist/modules/Payment/index.d.ts +9 -184
  23. package/dist/modules/Payment/index.js +109 -2084
  24. package/dist/modules/Payment/types.d.ts +30 -772
  25. package/dist/modules/Payment/types.js +12 -236
  26. package/dist/modules/ProductList/index.d.ts +1 -12
  27. package/dist/modules/ProductList/index.js +6 -29
  28. package/dist/modules/Resource/index.js +1 -1
  29. package/dist/modules/Rules/index.d.ts +4 -3
  30. package/dist/modules/Rules/index.js +121 -78
  31. package/dist/modules/Rules/types.d.ts +6 -1
  32. package/dist/modules/Rules/types.js +8 -0
  33. package/dist/modules/Schedule/index.d.ts +0 -9
  34. package/dist/modules/Schedule/index.js +0 -77
  35. package/dist/modules/index.d.ts +0 -1
  36. package/dist/modules/index.js +0 -1
  37. package/dist/plugins/window.d.ts +0 -1
  38. package/dist/solution/BookingByStep/index.d.ts +17 -0
  39. package/dist/solution/BookingByStep/index.js +525 -190
  40. package/dist/solution/BookingByStep/utils/products.d.ts +0 -6
  41. package/dist/solution/BookingByStep/utils/products.js +0 -10
  42. package/dist/solution/BookingByStep/utils/resources.js +4 -0
  43. package/dist/solution/BuyTickets/index.js +8 -7
  44. package/dist/solution/ShopDiscount/index.d.ts +12 -10
  45. package/dist/solution/ShopDiscount/index.js +64 -110
  46. package/dist/solution/ShopDiscount/types.d.ts +0 -8
  47. package/dist/solution/ShopDiscount/utils.js +1 -0
  48. package/dist/solution/index.d.ts +0 -2
  49. package/dist/solution/index.js +1 -3
  50. package/dist/types/index.d.ts +1 -4
  51. package/lib/core/index.js +1 -1
  52. package/lib/effects/index.d.ts +3 -5
  53. package/lib/effects/index.js +1 -17
  54. package/lib/modules/Account/index.js +3 -2
  55. package/lib/modules/AccountList/index.d.ts +1 -7
  56. package/lib/modules/AccountList/index.js +0 -27
  57. package/lib/modules/AccountList/types.d.ts +0 -28
  58. package/lib/modules/BaseModule.d.ts +0 -3
  59. package/lib/modules/BaseModule.js +0 -9
  60. package/lib/modules/Cart/index.d.ts +0 -1
  61. package/lib/modules/Cart/index.js +2 -5
  62. package/lib/modules/Date/types.d.ts +3 -1
  63. package/lib/modules/Discount/index.d.ts +0 -1
  64. package/lib/modules/Discount/index.js +1 -1
  65. package/lib/modules/Guests/index.js +9 -9
  66. package/lib/modules/Order/index.d.ts +1 -25
  67. package/lib/modules/Order/index.js +1 -186
  68. package/lib/modules/Order/types.d.ts +0 -45
  69. package/lib/modules/Order/utils.js +1 -1
  70. package/lib/modules/Payment/index.d.ts +9 -184
  71. package/lib/modules/Payment/index.js +51 -1084
  72. package/lib/modules/Payment/types.d.ts +30 -772
  73. package/lib/modules/Payment/types.js +6 -79
  74. package/lib/modules/ProductList/index.d.ts +1 -12
  75. package/lib/modules/ProductList/index.js +5 -31
  76. package/lib/modules/Resource/index.js +1 -1
  77. package/lib/modules/Rules/index.d.ts +4 -3
  78. package/lib/modules/Rules/index.js +64 -43
  79. package/lib/modules/Rules/types.d.ts +6 -1
  80. package/lib/modules/Rules/types.js +11 -2
  81. package/lib/modules/Schedule/index.d.ts +0 -9
  82. package/lib/modules/Schedule/index.js +0 -60
  83. package/lib/modules/index.d.ts +0 -1
  84. package/lib/modules/index.js +0 -2
  85. package/lib/plugins/window.d.ts +0 -1
  86. package/lib/solution/BookingByStep/index.d.ts +17 -0
  87. package/lib/solution/BookingByStep/index.js +325 -60
  88. package/lib/solution/BookingByStep/utils/products.d.ts +0 -6
  89. package/lib/solution/BookingByStep/utils/products.js +2 -8
  90. package/lib/solution/BookingByStep/utils/resources.js +4 -1
  91. package/lib/solution/BuyTickets/index.js +8 -7
  92. package/lib/solution/ShopDiscount/index.d.ts +12 -10
  93. package/lib/solution/ShopDiscount/index.js +30 -51
  94. package/lib/solution/ShopDiscount/types.d.ts +0 -8
  95. package/lib/solution/index.d.ts +0 -2
  96. package/lib/solution/index.js +1 -5
  97. package/lib/types/index.d.ts +1 -4
  98. package/package.json +1 -3
  99. package/dist/modules/Customer/constants.d.ts +0 -7
  100. package/dist/modules/Customer/constants.js +0 -12
  101. package/dist/modules/Customer/index.d.ts +0 -122
  102. package/dist/modules/Customer/index.js +0 -696
  103. package/dist/modules/Customer/types.d.ts +0 -146
  104. package/dist/modules/Customer/types.js +0 -41
  105. package/dist/modules/Payment/cash.d.ts +0 -19
  106. package/dist/modules/Payment/cash.js +0 -97
  107. package/dist/modules/Payment/cashRecommendationAlgorithm.d.ts +0 -22
  108. package/dist/modules/Payment/cashRecommendationAlgorithm.js +0 -423
  109. package/dist/modules/Payment/eftpos.d.ts +0 -11
  110. package/dist/modules/Payment/eftpos.js +0 -80
  111. package/dist/modules/Payment/mx51.d.ts +0 -0
  112. package/dist/modules/Payment/mx51.js +0 -0
  113. package/dist/modules/Payment/utils.d.ts +0 -17
  114. package/dist/modules/Payment/utils.js +0 -62
  115. package/dist/modules/Payment/walletpass.d.ts +0 -99
  116. package/dist/modules/Payment/walletpass.js +0 -711
  117. package/dist/plugins/app-types/app/app.d.ts +0 -83
  118. package/dist/plugins/app-types/app/const.d.ts +0 -4
  119. package/dist/plugins/app-types/app/index.d.ts +0 -14
  120. package/dist/plugins/app-types/applicationManager/application.d.ts +0 -50
  121. package/dist/plugins/app-types/applicationManager/index.d.ts +0 -13
  122. package/dist/plugins/app-types/config.d.ts +0 -3
  123. package/dist/plugins/app-types/cookie/index.d.ts +0 -13
  124. package/dist/plugins/app-types/data/index.d.ts +0 -8
  125. package/dist/plugins/app-types/history/config.d.ts +0 -24
  126. package/dist/plugins/app-types/history/index.d.ts +0 -20
  127. package/dist/plugins/app-types/history/type.d.ts +0 -2
  128. package/dist/plugins/app-types/hooks/index.d.ts +0 -12
  129. package/dist/plugins/app-types/hooks/useDelayedValue/index.d.ts +0 -2
  130. package/dist/plugins/app-types/hooks/useDispatch/index.d.ts +0 -2
  131. package/dist/plugins/app-types/hooks/useLowCode/index.d.ts +0 -13
  132. package/dist/plugins/app-types/hooks/useStore/index.d.ts +0 -6
  133. package/dist/plugins/app-types/index.d.ts +0 -6
  134. package/dist/plugins/app-types/indexDB/index.d.ts +0 -178
  135. package/dist/plugins/app-types/locales/en.d.ts +0 -3
  136. package/dist/plugins/app-types/locales/index.d.ts +0 -37
  137. package/dist/plugins/app-types/locales/original.d.ts +0 -3
  138. package/dist/plugins/app-types/locales/type.d.ts +0 -19
  139. package/dist/plugins/app-types/locales/zh-CN.d.ts +0 -3
  140. package/dist/plugins/app-types/locales/zh-HK.d.ts +0 -3
  141. package/dist/plugins/app-types/logger/feishu.d.ts +0 -11
  142. package/dist/plugins/app-types/logger/index.d.ts +0 -122
  143. package/dist/plugins/app-types/menuManager/hooks.d.ts +0 -17
  144. package/dist/plugins/app-types/menuManager/index.d.ts +0 -28
  145. package/dist/plugins/app-types/models/global.d.ts +0 -32
  146. package/dist/plugins/app-types/models/index.d.ts +0 -45
  147. package/dist/plugins/app-types/models/type.d.ts +0 -2
  148. package/dist/plugins/app-types/package.json +0 -15
  149. package/dist/plugins/app-types/plugin/index.d.ts +0 -0
  150. package/dist/plugins/app-types/pubsub/example.d.ts +0 -5
  151. package/dist/plugins/app-types/pubsub/index.d.ts +0 -63
  152. package/dist/plugins/app-types/request/cache.d.ts +0 -46
  153. package/dist/plugins/app-types/request/cancelToken.d.ts +0 -38
  154. package/dist/plugins/app-types/request/config.d.ts +0 -3
  155. package/dist/plugins/app-types/request/constants.d.ts +0 -2
  156. package/dist/plugins/app-types/request/index.d.ts +0 -24
  157. package/dist/plugins/app-types/request/pisell2Request.d.ts +0 -6
  158. package/dist/plugins/app-types/request/type.d.ts +0 -41
  159. package/dist/plugins/app-types/request/utils.d.ts +0 -46
  160. package/dist/plugins/app-types/routes/config.d.ts +0 -7
  161. package/dist/plugins/app-types/routes/index.d.ts +0 -28
  162. package/dist/plugins/app-types/socket/components/SocketMonitorPage.d.ts +0 -6
  163. package/dist/plugins/app-types/socket/components/index.d.ts +0 -2
  164. package/dist/plugins/app-types/socket/constants.d.ts +0 -33
  165. package/dist/plugins/app-types/socket/events.d.ts +0 -31
  166. package/dist/plugins/app-types/socket/heartbeat.d.ts +0 -66
  167. package/dist/plugins/app-types/socket/index.d.ts +0 -61
  168. package/dist/plugins/app-types/socket/monitor.d.ts +0 -169
  169. package/dist/plugins/app-types/socket/reconnect.d.ts +0 -61
  170. package/dist/plugins/app-types/socket/socket.d.ts +0 -129
  171. package/dist/plugins/app-types/socket/types.d.ts +0 -85
  172. package/dist/plugins/app-types/storage/index.d.ts +0 -17
  173. package/dist/plugins/app-types/tasks/index.d.ts +0 -77
  174. package/dist/plugins/app-types/tasks/type.d.ts +0 -62
  175. package/dist/plugins/app-types/tasks/useTasks.d.ts +0 -5
  176. package/dist/plugins/app-types/type.d.ts +0 -2
  177. package/dist/plugins/app-types/variables/VariablesProvider.d.ts +0 -7
  178. package/dist/plugins/app-types/variables/config.d.ts +0 -3
  179. package/dist/plugins/app-types/variables/index.d.ts +0 -6
  180. package/dist/plugins/app-types/variables/type.d.ts +0 -2
  181. package/dist/plugins/app-types/website/index.d.ts +0 -6
  182. package/dist/plugins/app.d.ts +0 -8
  183. package/dist/plugins/app.js +0 -1
  184. package/dist/solution/BookingTicket/index.d.ts +0 -184
  185. package/dist/solution/BookingTicket/index.js +0 -698
  186. package/dist/solution/BookingTicket/types.d.ts +0 -68
  187. package/dist/solution/BookingTicket/types.js +0 -43
  188. package/dist/solution/BookingTicket/utils/scan/cloudSearch.d.ts +0 -22
  189. package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +0 -159
  190. package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts +0 -22
  191. package/dist/solution/BookingTicket/utils/scan/handleScan.js +0 -189
  192. package/dist/solution/BookingTicket/utils/scan/index.d.ts +0 -85
  193. package/dist/solution/BookingTicket/utils/scan/index.js +0 -294
  194. package/dist/solution/BookingTicket/utils/scan/scanCache.d.ts +0 -78
  195. package/dist/solution/BookingTicket/utils/scan/scanCache.js +0 -305
  196. package/dist/solution/Checkout/appointmentDemo.json +0 -1
  197. package/dist/solution/Checkout/index.d.ts +0 -432
  198. package/dist/solution/Checkout/index.js +0 -4452
  199. package/dist/solution/Checkout/types.d.ts +0 -727
  200. package/dist/solution/Checkout/types.js +0 -104
  201. package/dist/solution/Checkout/utils/index.d.ts +0 -121
  202. package/dist/solution/Checkout/utils/index.js +0 -511
  203. package/dist/utils/task.d.ts +0 -40
  204. package/dist/utils/task.js +0 -171
  205. package/dist/utils/watch.d.ts +0 -102
  206. package/dist/utils/watch.js +0 -294
  207. package/lib/modules/Customer/constants.d.ts +0 -7
  208. package/lib/modules/Customer/constants.js +0 -39
  209. package/lib/modules/Customer/index.d.ts +0 -122
  210. package/lib/modules/Customer/index.js +0 -439
  211. package/lib/modules/Customer/types.d.ts +0 -146
  212. package/lib/modules/Customer/types.js +0 -37
  213. package/lib/modules/Payment/cash.d.ts +0 -19
  214. package/lib/modules/Payment/cash.js +0 -64
  215. package/lib/modules/Payment/cashRecommendationAlgorithm.d.ts +0 -22
  216. package/lib/modules/Payment/cashRecommendationAlgorithm.js +0 -342
  217. package/lib/modules/Payment/eftpos.d.ts +0 -11
  218. package/lib/modules/Payment/eftpos.js +0 -51
  219. package/lib/modules/Payment/mx51.d.ts +0 -0
  220. package/lib/modules/Payment/mx51.js +0 -0
  221. package/lib/modules/Payment/utils.d.ts +0 -17
  222. package/lib/modules/Payment/utils.js +0 -67
  223. package/lib/modules/Payment/walletpass.d.ts +0 -99
  224. package/lib/modules/Payment/walletpass.js +0 -484
  225. package/lib/plugins/app-types/app/app.d.ts +0 -83
  226. package/lib/plugins/app-types/app/const.d.ts +0 -4
  227. package/lib/plugins/app-types/app/index.d.ts +0 -14
  228. package/lib/plugins/app-types/applicationManager/application.d.ts +0 -50
  229. package/lib/plugins/app-types/applicationManager/index.d.ts +0 -13
  230. package/lib/plugins/app-types/config.d.ts +0 -3
  231. package/lib/plugins/app-types/cookie/index.d.ts +0 -13
  232. package/lib/plugins/app-types/data/index.d.ts +0 -8
  233. package/lib/plugins/app-types/history/config.d.ts +0 -24
  234. package/lib/plugins/app-types/history/index.d.ts +0 -20
  235. package/lib/plugins/app-types/history/type.d.ts +0 -2
  236. package/lib/plugins/app-types/hooks/index.d.ts +0 -12
  237. package/lib/plugins/app-types/hooks/useDelayedValue/index.d.ts +0 -2
  238. package/lib/plugins/app-types/hooks/useDispatch/index.d.ts +0 -2
  239. package/lib/plugins/app-types/hooks/useLowCode/index.d.ts +0 -13
  240. package/lib/plugins/app-types/hooks/useStore/index.d.ts +0 -6
  241. package/lib/plugins/app-types/index.d.ts +0 -6
  242. package/lib/plugins/app-types/indexDB/index.d.ts +0 -178
  243. package/lib/plugins/app-types/locales/en.d.ts +0 -3
  244. package/lib/plugins/app-types/locales/index.d.ts +0 -37
  245. package/lib/plugins/app-types/locales/original.d.ts +0 -3
  246. package/lib/plugins/app-types/locales/type.d.ts +0 -19
  247. package/lib/plugins/app-types/locales/zh-CN.d.ts +0 -3
  248. package/lib/plugins/app-types/locales/zh-HK.d.ts +0 -3
  249. package/lib/plugins/app-types/logger/feishu.d.ts +0 -11
  250. package/lib/plugins/app-types/logger/index.d.ts +0 -122
  251. package/lib/plugins/app-types/menuManager/hooks.d.ts +0 -17
  252. package/lib/plugins/app-types/menuManager/index.d.ts +0 -28
  253. package/lib/plugins/app-types/models/global.d.ts +0 -32
  254. package/lib/plugins/app-types/models/index.d.ts +0 -45
  255. package/lib/plugins/app-types/models/type.d.ts +0 -2
  256. package/lib/plugins/app-types/package.json +0 -15
  257. package/lib/plugins/app-types/plugin/index.d.ts +0 -0
  258. package/lib/plugins/app-types/pubsub/example.d.ts +0 -5
  259. package/lib/plugins/app-types/pubsub/index.d.ts +0 -63
  260. package/lib/plugins/app-types/request/cache.d.ts +0 -46
  261. package/lib/plugins/app-types/request/cancelToken.d.ts +0 -38
  262. package/lib/plugins/app-types/request/config.d.ts +0 -3
  263. package/lib/plugins/app-types/request/constants.d.ts +0 -2
  264. package/lib/plugins/app-types/request/index.d.ts +0 -24
  265. package/lib/plugins/app-types/request/pisell2Request.d.ts +0 -6
  266. package/lib/plugins/app-types/request/type.d.ts +0 -41
  267. package/lib/plugins/app-types/request/utils.d.ts +0 -46
  268. package/lib/plugins/app-types/routes/config.d.ts +0 -7
  269. package/lib/plugins/app-types/routes/index.d.ts +0 -28
  270. package/lib/plugins/app-types/socket/components/SocketMonitorPage.d.ts +0 -6
  271. package/lib/plugins/app-types/socket/components/index.d.ts +0 -2
  272. package/lib/plugins/app-types/socket/constants.d.ts +0 -33
  273. package/lib/plugins/app-types/socket/events.d.ts +0 -31
  274. package/lib/plugins/app-types/socket/heartbeat.d.ts +0 -66
  275. package/lib/plugins/app-types/socket/index.d.ts +0 -61
  276. package/lib/plugins/app-types/socket/monitor.d.ts +0 -169
  277. package/lib/plugins/app-types/socket/reconnect.d.ts +0 -61
  278. package/lib/plugins/app-types/socket/socket.d.ts +0 -129
  279. package/lib/plugins/app-types/socket/types.d.ts +0 -85
  280. package/lib/plugins/app-types/storage/index.d.ts +0 -17
  281. package/lib/plugins/app-types/tasks/index.d.ts +0 -77
  282. package/lib/plugins/app-types/tasks/type.d.ts +0 -62
  283. package/lib/plugins/app-types/tasks/useTasks.d.ts +0 -5
  284. package/lib/plugins/app-types/type.d.ts +0 -2
  285. package/lib/plugins/app-types/variables/VariablesProvider.d.ts +0 -7
  286. package/lib/plugins/app-types/variables/config.d.ts +0 -3
  287. package/lib/plugins/app-types/variables/index.d.ts +0 -6
  288. package/lib/plugins/app-types/variables/type.d.ts +0 -2
  289. package/lib/plugins/app-types/website/index.d.ts +0 -6
  290. package/lib/plugins/app.d.ts +0 -8
  291. package/lib/plugins/app.js +0 -17
  292. package/lib/solution/BookingTicket/index.d.ts +0 -184
  293. package/lib/solution/BookingTicket/index.js +0 -426
  294. package/lib/solution/BookingTicket/types.d.ts +0 -68
  295. package/lib/solution/BookingTicket/types.js +0 -72
  296. package/lib/solution/BookingTicket/utils/scan/cloudSearch.d.ts +0 -22
  297. package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +0 -117
  298. package/lib/solution/BookingTicket/utils/scan/handleScan.d.ts +0 -22
  299. package/lib/solution/BookingTicket/utils/scan/handleScan.js +0 -132
  300. package/lib/solution/BookingTicket/utils/scan/index.d.ts +0 -85
  301. package/lib/solution/BookingTicket/utils/scan/index.js +0 -216
  302. package/lib/solution/BookingTicket/utils/scan/scanCache.d.ts +0 -78
  303. package/lib/solution/BookingTicket/utils/scan/scanCache.js +0 -231
  304. package/lib/solution/Checkout/appointmentDemo.json +0 -1
  305. package/lib/solution/Checkout/index.d.ts +0 -432
  306. package/lib/solution/Checkout/index.js +0 -2776
  307. package/lib/solution/Checkout/types.d.ts +0 -727
  308. package/lib/solution/Checkout/types.js +0 -63
  309. package/lib/solution/Checkout/utils/index.d.ts +0 -121
  310. package/lib/solution/Checkout/utils/index.js +0 -362
  311. package/lib/utils/task.d.ts +0 -40
  312. package/lib/utils/task.js +0 -109
  313. package/lib/utils/watch.d.ts +0 -102
  314. package/lib/utils/watch.js +0 -217
@@ -1 +0,0 @@
1
- {"type":"appointment_booking","platform":"PC","sales_channel":"my_pisel","order_sales_channel":"online_store","bookings":[{"id":0,"number":1,"registration_type":"all","relation_products":[],"is_all":false,"product":{"num":1,"product_id":61170,"product_variant_id":0,"product_bundle":[],"product_option_item":[],"discount_list":[{"amount":100,"type":"good_pass","discount":{"resource_id":64523,"title":{"auto":"玄-商品券","original":"玄-商品券","en":null,"zh-CN":null,"zh-HK":null},"original_amount":100,"product_id":61170,"percent":"1.00"}}]},"sub_type":"minutes","duration":480,"like_status":"common","resources":[{"relation_type":"form","like_status":"common","form_id":35,"relation_id":40357,"capacity":1,"metadata":{"combined_resource":{"status":1,"resource_ids":[40262,40263]},"form_name":"桌台","resource_name":"组合资源测试table-0422-01"},"children":[{"relation_type":"form","like_status":"common","id":40262,"main_field":"A01(组合资源-小桌-4 人)","resourceType":"single","form_id":35,"relation_id":40262,"capacity":1,"metadata":{"combined_resource":null,"form_name":"桌台","resource_name":"A01(组合资源-小桌-4 人)"}},{"relation_type":"form","like_status":"common","id":40263,"main_field":"A02(组合资源-小桌-4 人)","resourceType":"single","form_id":35,"relation_id":40263,"capacity":0,"metadata":{"combined_resource":null,"form_name":"桌台","resource_name":"A02(组合资源-小桌-4 人)"}}]},{"relation_type":"form","like_status":"common","form_id":214,"relation_id":38350,"capacity":1,"metadata":{"combined_resource":null,"form_name":"校区2","resource_name":"West Campus"}}],"schedule_id":0,"start_date":"2025-08-22","start_time":"09:00","select_date":"2025-08-22","end_time":"17:00","end_date":"2025-08-22","metadata":{"account":{"id":13433,"username":"a a"},"capacity":[{"id":0,"value":1,"name":""}]},"holder":null,"relation_forms":[]}],"shop_note":"","schedule_date":"2025-08-22 09:00:00","is_deposit":0,"relation_products":[],"relation_forms":[]}
@@ -1,432 +0,0 @@
1
- import { Module, PisellCore, ModuleOptions } from '../../types';
2
- import { BaseModule } from '../../modules/BaseModule';
3
- import { OrderModule } from '../../modules/Order';
4
- import { PaymentModule } from '../../modules/Payment';
5
- import { CheckoutModuleAPI, CheckoutInitParams, CreateLocalOrderParams, UpdateLocalOrderParams, CurrentOrderInfo, CartSummaryItem, SendCustomerPayLinkParams } from './types';
6
- import { PaymentOrder, PaymentMethod, PaymentItem, PaymentItemInput } from '../../modules/Payment/types';
7
- export * from './types';
8
- /**
9
- * 结账解决方案实现
10
- *
11
- * 整合订单处理和支付功能,提供完整的结账流程管理。
12
- * 支持多种支付方式,提供实时状态跟踪和错误处理。
13
- */
14
- export declare class CheckoutImpl extends BaseModule implements Module, CheckoutModuleAPI {
15
- protected defaultName: string;
16
- protected defaultVersion: string;
17
- isSolution: boolean;
18
- private request;
19
- private store;
20
- private otherParams;
21
- private logger;
22
- private calculationCache;
23
- order: OrderModule;
24
- payment: PaymentModule;
25
- constructor(name?: string, version?: string);
26
- initialize(core: PisellCore, options: ModuleOptions): Promise<void>;
27
- /**
28
- * 记录信息日志
29
- */
30
- private logInfo;
31
- /**
32
- * 记录警告日志
33
- */
34
- private logWarning;
35
- /**
36
- * 记录错误日志
37
- */
38
- private logError;
39
- /**
40
- * 初始化子模块
41
- */
42
- private initializeSubModules;
43
- /**
44
- * 设置支付模块事件监听
45
- */
46
- private setupPaymentEventListeners;
47
- /**
48
- * 初始化结账流程
49
- */
50
- initializeCheckoutAsync(params: CheckoutInitParams): Promise<void>;
51
- getHolderIdFromBooking(obj: any): number | undefined;
52
- getProductListByOrder(): {
53
- product_id: number;
54
- product_variant_id: string;
55
- quantity: number;
56
- selling_price: number;
57
- }[];
58
- initWalletData(params?: {
59
- order_wait_pay_amount: number;
60
- }): Promise<void>;
61
- checkIsNeedDepositAsync(bookings: any[], relationProducts: any[]): {
62
- total: number;
63
- protocols: {
64
- id: number;
65
- title: string;
66
- }[];
67
- hasDeposit: boolean;
68
- };
69
- /**
70
- * 创建本地订单 (前端模拟下单流程)
71
- *
72
- * 此方法用于在前端模拟整个下单流程,创建一个本地的虚拟订单。
73
- * 用户在购物车点击下单时,会把购物车参数传递给此方法,
74
- * 方法会记录参数并创建本地虚拟订单,然后用 Payment 模块管理支付流程。
75
- */
76
- createLocalOrderAsync(params: CreateLocalOrderParams): Promise<PaymentOrder>;
77
- /**
78
- * 更新本地订单(已同步后端的订单)并设置为当前订单
79
- *
80
- * 通过传入真实的 orderId,对已缓存的订单数据进行更新,
81
- * 会覆盖 order_info 与金额等字段,并重新计算待付金额,最后设置为 currentOrder。
82
- */
83
- updateLocalOrderAsync(params: UpdateLocalOrderParams): Promise<PaymentOrder>;
84
- /**
85
- * 完成结账
86
- */
87
- completeCheckoutAsync(): Promise<{
88
- success: boolean;
89
- orderId?: string;
90
- }>;
91
- /**
92
- * 获取订单原始数据
93
- */
94
- getOrderOriginalData(): any;
95
- /**
96
- * 获取当前订单基础信息
97
- *
98
- * 返回当前订单的基础信息,包括订单状态、金额、支付状态等
99
- */
100
- getCurrentOrderInfo(): CurrentOrderInfo | null;
101
- /**
102
- * 获取当前订单的支付项
103
- *
104
- * 返回当前订单的所有支付项,包括活跃和已撤销的支付项
105
- */
106
- getCurrentOrderPaymentItemsAsync(): Promise<PaymentItem[]>;
107
- /**
108
- * 获取订单模块
109
- */
110
- getOrderModule(): OrderModule;
111
- /**
112
- * 获取支付模块
113
- */
114
- getPaymentModule(): PaymentModule;
115
- /**
116
- * 替换本地订单ID为真实订单ID
117
- *
118
- * 当后端订单创建完成后,调用此方法将本地虚拟订单ID替换为真实订单ID
119
- *
120
- * @param newOrderId 后端返回的真实订单ID
121
- * @returns 更新后的订单对象,如果当前没有订单则返回null
122
- */
123
- replaceLocalOrderIdAsync(newOrderId: string): Promise<PaymentOrder | null>;
124
- /**
125
- * 设置自定义支付金额
126
- *
127
- * 允许UI自定义本次支付的金额,通常用于部分支付或调整支付金额场景
128
- *
129
- * @param amount 自定义支付金额,必须是有效的数字字符串
130
- */
131
- setStateAmountAsync(amount: string): Promise<void>;
132
- /**
133
- * 获取当前自定义支付金额
134
- *
135
- * @returns 当前设置的自定义支付金额
136
- */
137
- getStateAmount(): string;
138
- /**
139
- * 获取系统计算的待付金额(只读)
140
- *
141
- * 此方法返回系统内部计算的实际待付金额,不允许外部修改
142
- *
143
- * @returns 当前系统计算的待付金额
144
- */
145
- getBalanceDueAmount(): string;
146
- /**
147
- * 获取购物车小计数据
148
- *
149
- * 返回当前结账流程中的购物车小计项数据,包含各种费用明细
150
- *
151
- * @returns 购物车小计数据数组,如果没有则返回 null
152
- */
153
- getCartSummary(): CartSummaryItem[] | null;
154
- /**
155
- * 获取支付方式列表
156
- *
157
- * 优先使用 store 中的缓存数据,避免重复接口调用。
158
- * 如果 store 中没有数据,则调用 Payment 模块的方法获取。
159
- *
160
- * @returns 支付方式列表
161
- */
162
- getPaymentMethodsAsync(): Promise<PaymentMethod[]>;
163
- /**
164
- * 为当前订单添加支付项
165
- *
166
- * 向当前活跃订单添加一个支付项,支付项包含支付方式信息和金额
167
- *
168
- * @param paymentItem 支付项数据
169
- * @throws 当前没有活跃订单时抛出错误
170
- */
171
- addPaymentItemAsync(paymentItem: PaymentItemInput): Promise<void>;
172
- /**
173
- * 删除当前订单的支付项
174
- *
175
- * 从当前活跃订单中删除指定的支付项,支付项将被标记为已撤销状态
176
- *
177
- * @param paymentUuid 要删除的支付项UUID
178
- * @throws 当前没有活跃订单时抛出错误
179
- * @throws 支付项不存在时抛出错误
180
- */
181
- deletePaymentItemAsync(paymentUuid: string): Promise<void>;
182
- /**
183
- * 批量更新当前订单的代金券支付项(覆盖更新)
184
- *
185
- * 删除所有现有的代金券支付项,然后添加新的代金券支付项。
186
- * 这是一个覆盖式更新操作,确保代金券支付项的一致性。
187
- *
188
- * @param voucherPaymentItems 新的代金券支付项列表,每个都必须包含 voucher_id
189
- * @throws 当前没有活跃订单时抛出错误
190
- * @throws 支付项缺少 voucher_id 时抛出错误
191
- */
192
- updateVoucherPaymentItemsAsync(voucherPaymentItems: PaymentItemInput[]): Promise<void>;
193
- /**
194
- * 修改当前订单的定金状态
195
- *
196
- * 更新当前订单的 is_deposit 字段,用于标识订单是否为定金订单
197
- *
198
- * @param isDeposit 定金状态 (1: 定金订单, 0: 全款订单)
199
- * @throws 当前没有活跃订单时抛出错误
200
- */
201
- updateOrderDepositStatusAsync(isDeposit: number): Promise<void>;
202
- /**
203
- * 手动设置当前订单的定金金额
204
- *
205
- * 允许手动设置订单的定金金额,通常用于用户自定义定金支付场景
206
- *
207
- * @param depositAmount 定金金额,必须是有效的数字字符串,且不能超过订单总额
208
- * @throws 当前没有活跃订单时抛出错误
209
- * @throws 定金金额格式无效或超过订单总额时抛出错误
210
- */
211
- setDepositAmountAsync(depositAmount: string): Promise<void>;
212
- /**
213
- * 手动同步订单到后端
214
- *
215
- * 用于强制同步订单到后端,特别适用于纯代金券支付完成的订单
216
- */
217
- manualSyncOrderAsync(): Promise<{
218
- success: boolean;
219
- message?: string;
220
- orderId?: string;
221
- orderUuid?: string;
222
- response?: any;
223
- }>;
224
- /**
225
- * 获取当前订单备注
226
- *
227
- * @returns 当前订单的备注内容,如果没有则返回空字符串
228
- */
229
- getOrderNote(): string;
230
- /**
231
- * 获取当前订单ID
232
- *
233
- * @returns 当前订单的ID,如果没有订单则返回null
234
- */
235
- getCurrentOrderId(): string | null;
236
- /**
237
- * 获取当前订单是否已同步到后端
238
- *
239
- * @returns 当前订单是否已同步状态,如果没有订单则返回false
240
- */
241
- isCurrentOrderSynced(): boolean;
242
- /**
243
- * 取消当前本地订单
244
- *
245
- * 只能取消未同步到后端的本地订单,如果订单已同步则不能取消
246
- *
247
- * @param cancelReason 取消原因(可选)
248
- * @returns 取消结果
249
- */
250
- cancelCurrentOrderAsync(cancelReason?: string): Promise<{
251
- success: boolean;
252
- message?: string;
253
- orderId?: string;
254
- }>;
255
- /**
256
- * 保存订单并稍后支付
257
- *
258
- * 将当前订单保存到后端,但排除代金券类支付项(voucher_id),
259
- * 适用于用户想要保存订单但稍后完成支付的场景
260
- */
261
- saveForLaterPaymentAsync(): Promise<{
262
- success: boolean;
263
- message?: string;
264
- orderId?: string;
265
- orderUuid?: string;
266
- response?: any;
267
- }>;
268
- /**
269
- * 更新订单备注
270
- *
271
- * @param note 订单备注内容
272
- */
273
- updateOrderNoteAsync(note: string): Promise<void>;
274
- /**
275
- * 处理错误
276
- */
277
- private handleError;
278
- /**
279
- * 处理支付成功
280
- */
281
- private handlePaymentSuccess;
282
- /**
283
- * 处理支付错误
284
- */
285
- private handlePaymentError;
286
- /**
287
- * 验证结账参数
288
- */
289
- private validateCheckoutParams;
290
- /**
291
- * 处理现金支付项的找零逻辑
292
- *
293
- * @param paymentItem 原始支付项
294
- * @returns 处理后的支付项(包含找零信息)
295
- */
296
- private processCashPaymentItem;
297
- /**
298
- * 预加载支付方式(在初始化时调用)
299
- */
300
- private preloadPaymentMethods;
301
- /**
302
- * 清理过期的已同步订单数据
303
- *
304
- * 删除本地 IndexDB 中超过指定天数且已同步到后端的订单数据
305
- */
306
- private cleanupExpiredOrdersAsync;
307
- /**
308
- * 清除计算缓存
309
- */
310
- private clearCalculationCache;
311
- /**
312
- * 批量获取订单数据(用于性能优化)
313
- * 一次性获取所有需要的数据,避免重复查询
314
- */
315
- private fetchOrderDataBatch;
316
- /**
317
- * 从支付项数组计算已支付金额(纯计算,不查询数据库)
318
- */
319
- private calculatePaidAmountFromItems;
320
- /**
321
- * 计算已支付金额(从 Payment 模块获取最新数据)
322
- *
323
- * 注意:此方法保持独立性,可以单独调用。
324
- * 在 updateStateAmountToRemaining 等批量操作中会使用缓存优化。
325
- */
326
- private calculatePaidAmountAsync;
327
- /**
328
- * 从订单和支付项计算剩余金额(纯计算,不查询数据库)
329
- */
330
- private calculateRemainingAmountFromData;
331
- /**
332
- * 从订单和支付项计算剩余总金额(纯计算,排除定金)
333
- */
334
- private calculateRemainingTotalAmountFromData;
335
- /**
336
- * 计算剩余未支付金额(从 Payment 模块获取最新数据)
337
- *
338
- * 注意:此方法保持独立性,可以单独调用。
339
- * 在 updateStateAmountToRemaining 等批量操作中会使用缓存优化。
340
- */
341
- private calculateRemainingAmountAsync;
342
- /**
343
- * 计算剩余未支付金额(排除定金计算,始终使用订单总金额)
344
- *
345
- * 注意:此方法保持独立性,可以单独调用。
346
- * 在 updateStateAmountToRemaining 等批量操作中会使用缓存优化。
347
- */
348
- private calculateRemainingTotalAmountAsync;
349
- /**
350
- * 更新 balanceDueAmount 为当前剩余未支付金额(系统内部计算)
351
- */
352
- private updateBalanceDueAmount;
353
- /**
354
- * 更新 stateAmount 为当前剩余未支付金额
355
- *
356
- * 优化版本:批量获取数据,避免重复查询数据库
357
- */
358
- private updateStateAmountToRemaining;
359
- /**
360
- * 检查订单支付是否完成(优化版,复用已获取的数据)
361
- *
362
- * @param paymentItems 已获取的支付项数据
363
- * @param remainingAmount 已计算的剩余金额
364
- */
365
- private checkOrderPaymentCompletionOptimized;
366
- /**
367
- * 检查订单支付是否完成
368
- *
369
- * 当剩余待付款金额 <= 0 时,触发订单支付完成事件
370
- *
371
- * 注意:此方法保持独立性,可以单独调用。
372
- * 在 updateStateAmountToRemaining 中会使用优化版本。
373
- */
374
- private checkOrderPaymentCompletion;
375
- /**
376
- * 同步订单到后端并返回真实订单ID
377
- *
378
- * @param isManual 是否为手动同步,默认为 false
379
- * @param customPaymentItems 自定义支付项列表,如果提供则使用此列表而不是从数据库获取
380
- * @returns 包含订单ID、UUID和完整后端响应的对象
381
- */
382
- private syncOrderToBackendWithReturn;
383
- setOtherParams(params: Record<string, any>, { cover }?: {
384
- cover?: boolean;
385
- }): Promise<void>;
386
- /**
387
- * 通过订单ID编辑订单备注
388
- *
389
- * 用于修改已同步到后端的订单备注,通常在支付成功后的弹窗中使用
390
- *
391
- * @param orderId 后端订单ID
392
- * @param note 新的订单备注
393
- * @returns 修改结果
394
- */
395
- editOrderNoteByOrderIdAsync(orderId: string | number, note: string): Promise<{
396
- success: boolean;
397
- message?: string;
398
- orderId?: string | number;
399
- }>;
400
- /**
401
- * 发送客户支付链接邮件
402
- *
403
- * 向指定邮箱发送订单支付提醒邮件
404
- *
405
- * @param params 发送参数
406
- * @returns 发送结果
407
- */
408
- sendCustomerPayLinkAsync(params: SendCustomerPayLinkParams): Promise<{
409
- success: boolean;
410
- message?: string;
411
- }>;
412
- /**
413
- * 金额舍入
414
- *
415
- * @param amount 原始金额
416
- * @returns 舍入结果详情,包含原始金额、舍入后金额和舍入差额
417
- */
418
- roundAmountAsync(amount: number): Promise<{
419
- originalAmount: string;
420
- roundedAmount: string;
421
- roundingDifference: string;
422
- }>;
423
- destroy(): Promise<void>;
424
- /**
425
- * 重置 store 状态
426
- *
427
- * 在创建新订单前调用,确保状态完全干净
428
- *
429
- * 🚀 性能优化:改为同步方法,事件发射不阻塞主流程
430
- */
431
- private resetStoreState;
432
- }