@pisell/pisellos 3.0.55 → 3.0.57

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 (268) hide show
  1. package/dist/core/index.js +2 -1
  2. package/dist/effects/index.d.ts +4 -3
  3. package/dist/effects/index.js +15 -6
  4. package/dist/modules/AccountList/index.d.ts +7 -1
  5. package/dist/modules/AccountList/index.js +81 -14
  6. package/dist/modules/AccountList/types.d.ts +28 -0
  7. package/dist/modules/AccountList/types.js +8 -0
  8. package/dist/modules/Cart/index.js +1 -1
  9. package/dist/modules/Cart/utils/changePrice.d.ts +2 -2
  10. package/dist/modules/Cart/utils/changePrice.js +1 -1
  11. package/dist/modules/Customer/constants.d.ts +7 -0
  12. package/dist/modules/Customer/constants.js +12 -0
  13. package/dist/modules/Customer/index.d.ts +122 -0
  14. package/dist/modules/Customer/index.js +697 -0
  15. package/dist/modules/Customer/types.d.ts +146 -0
  16. package/dist/modules/Customer/types.js +41 -0
  17. package/dist/modules/Payment/cash.d.ts +11 -0
  18. package/dist/modules/Payment/cash.js +78 -0
  19. package/dist/modules/Payment/eftpos.d.ts +11 -0
  20. package/dist/modules/Payment/eftpos.js +80 -0
  21. package/dist/modules/Payment/index.d.ts +273 -9
  22. package/dist/modules/Payment/index.js +2525 -109
  23. package/dist/modules/Payment/types.d.ts +382 -30
  24. package/dist/modules/Payment/types.js +116 -14
  25. package/dist/modules/Payment/wallet.d.ts +11 -0
  26. package/dist/modules/Payment/wallet.js +78 -0
  27. package/dist/modules/Payment/walletpass.d.ts +0 -0
  28. package/dist/modules/Payment/walletpass.js +0 -0
  29. package/dist/modules/ProductList/index.d.ts +14 -3
  30. package/dist/modules/ProductList/index.js +58 -44
  31. package/dist/modules/ProductList/types.d.ts +0 -1
  32. package/dist/modules/Rules/index.js +27 -14
  33. package/dist/modules/Rules/types.d.ts +1 -0
  34. package/dist/modules/index.d.ts +1 -0
  35. package/dist/modules/index.js +1 -0
  36. package/dist/plugins/app-types/app/app.d.ts +83 -0
  37. package/dist/plugins/app-types/app/const.d.ts +4 -0
  38. package/dist/plugins/app-types/app/index.d.ts +14 -0
  39. package/dist/plugins/app-types/applicationManager/application.d.ts +50 -0
  40. package/dist/plugins/app-types/applicationManager/index.d.ts +13 -0
  41. package/dist/plugins/app-types/config.d.ts +3 -0
  42. package/dist/plugins/app-types/cookie/index.d.ts +13 -0
  43. package/dist/plugins/app-types/data/index.d.ts +8 -0
  44. package/dist/plugins/app-types/history/config.d.ts +24 -0
  45. package/dist/plugins/app-types/history/index.d.ts +20 -0
  46. package/dist/plugins/app-types/history/type.d.ts +2 -0
  47. package/dist/plugins/app-types/hooks/index.d.ts +12 -0
  48. package/dist/plugins/app-types/hooks/useDelayedValue/index.d.ts +2 -0
  49. package/dist/plugins/app-types/hooks/useDispatch/index.d.ts +2 -0
  50. package/dist/plugins/app-types/hooks/useLowCode/index.d.ts +13 -0
  51. package/dist/plugins/app-types/hooks/useStore/index.d.ts +6 -0
  52. package/dist/plugins/app-types/index.d.ts +6 -0
  53. package/dist/plugins/app-types/indexDB/index.d.ts +178 -0
  54. package/dist/plugins/app-types/locales/en.d.ts +3 -0
  55. package/dist/plugins/app-types/locales/index.d.ts +37 -0
  56. package/dist/plugins/app-types/locales/original.d.ts +3 -0
  57. package/dist/plugins/app-types/locales/type.d.ts +19 -0
  58. package/dist/plugins/app-types/locales/zh-CN.d.ts +3 -0
  59. package/dist/plugins/app-types/locales/zh-HK.d.ts +3 -0
  60. package/dist/plugins/app-types/logger/feishu.d.ts +11 -0
  61. package/dist/plugins/app-types/logger/index.d.ts +122 -0
  62. package/dist/plugins/app-types/menuManager/hooks.d.ts +17 -0
  63. package/dist/plugins/app-types/menuManager/index.d.ts +28 -0
  64. package/dist/plugins/app-types/models/global.d.ts +32 -0
  65. package/dist/plugins/app-types/models/index.d.ts +45 -0
  66. package/dist/plugins/app-types/models/type.d.ts +2 -0
  67. package/dist/plugins/app-types/package.json +15 -0
  68. package/dist/plugins/app-types/plugin/index.d.ts +0 -0
  69. package/dist/plugins/app-types/pubsub/example.d.ts +5 -0
  70. package/dist/plugins/app-types/pubsub/index.d.ts +63 -0
  71. package/dist/plugins/app-types/request/cache.d.ts +46 -0
  72. package/dist/plugins/app-types/request/cancelToken.d.ts +38 -0
  73. package/dist/plugins/app-types/request/config.d.ts +3 -0
  74. package/dist/plugins/app-types/request/constants.d.ts +2 -0
  75. package/dist/plugins/app-types/request/index.d.ts +24 -0
  76. package/dist/plugins/app-types/request/pisell2Request.d.ts +6 -0
  77. package/dist/plugins/app-types/request/type.d.ts +41 -0
  78. package/dist/plugins/app-types/request/utils.d.ts +46 -0
  79. package/dist/plugins/app-types/routes/config.d.ts +7 -0
  80. package/dist/plugins/app-types/routes/index.d.ts +28 -0
  81. package/dist/plugins/app-types/socket/components/SocketMonitorPage.d.ts +6 -0
  82. package/dist/plugins/app-types/socket/components/index.d.ts +2 -0
  83. package/dist/plugins/app-types/socket/constants.d.ts +33 -0
  84. package/dist/plugins/app-types/socket/events.d.ts +31 -0
  85. package/dist/plugins/app-types/socket/heartbeat.d.ts +66 -0
  86. package/dist/plugins/app-types/socket/index.d.ts +61 -0
  87. package/dist/plugins/app-types/socket/monitor.d.ts +169 -0
  88. package/dist/plugins/app-types/socket/reconnect.d.ts +61 -0
  89. package/dist/plugins/app-types/socket/socket.d.ts +129 -0
  90. package/dist/plugins/app-types/socket/types.d.ts +85 -0
  91. package/dist/plugins/app-types/storage/index.d.ts +17 -0
  92. package/dist/plugins/app-types/tasks/index.d.ts +77 -0
  93. package/dist/plugins/app-types/tasks/type.d.ts +62 -0
  94. package/dist/plugins/app-types/tasks/useTasks.d.ts +5 -0
  95. package/dist/plugins/app-types/type.d.ts +2 -0
  96. package/dist/plugins/app-types/variables/VariablesProvider.d.ts +7 -0
  97. package/dist/plugins/app-types/variables/config.d.ts +3 -0
  98. package/dist/plugins/app-types/variables/index.d.ts +6 -0
  99. package/dist/plugins/app-types/variables/type.d.ts +2 -0
  100. package/dist/plugins/app-types/website/index.d.ts +6 -0
  101. package/dist/plugins/app.d.ts +8 -0
  102. package/dist/plugins/app.js +1 -0
  103. package/dist/plugins/window.d.ts +1 -0
  104. package/dist/solution/BookingByStep/index.js +59 -35
  105. package/dist/solution/BookingByStep/types.d.ts +3 -2
  106. package/dist/solution/BookingTicket/index.d.ts +172 -0
  107. package/dist/solution/BookingTicket/index.js +665 -0
  108. package/dist/solution/BookingTicket/types.d.ts +68 -0
  109. package/dist/solution/BookingTicket/types.js +43 -0
  110. package/dist/solution/BookingTicket/utils/scan/cloudSearch.d.ts +22 -0
  111. package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +159 -0
  112. package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts +16 -0
  113. package/dist/solution/BookingTicket/utils/scan/handleScan.js +174 -0
  114. package/dist/solution/BookingTicket/utils/scan/index.d.ts +81 -0
  115. package/dist/solution/BookingTicket/utils/scan/index.js +285 -0
  116. package/dist/solution/BookingTicket/utils/scan/scanCache.d.ts +78 -0
  117. package/dist/solution/BookingTicket/utils/scan/scanCache.js +305 -0
  118. package/dist/solution/BuyTickets/index.d.ts +2 -2
  119. package/dist/solution/BuyTickets/index.js +1 -1
  120. package/dist/solution/Checkout/appointmentDemo.json +1 -0
  121. package/dist/solution/Checkout/index.d.ts +181 -0
  122. package/dist/solution/Checkout/index.js +1596 -0
  123. package/dist/solution/Checkout/types.d.ts +550 -0
  124. package/dist/solution/Checkout/types.js +132 -0
  125. package/dist/solution/Checkout/utils/index.d.ts +73 -0
  126. package/dist/solution/Checkout/utils/index.js +371 -0
  127. package/dist/solution/ShopDiscount/index.js +4 -2
  128. package/dist/solution/index.d.ts +2 -0
  129. package/dist/solution/index.js +3 -1
  130. package/dist/types/index.d.ts +3 -1
  131. package/dist/utils/task.d.ts +40 -0
  132. package/dist/utils/task.js +171 -0
  133. package/dist/utils/watch.d.ts +102 -0
  134. package/dist/utils/watch.js +294 -0
  135. package/lib/core/index.js +1 -1
  136. package/lib/effects/index.d.ts +4 -3
  137. package/lib/effects/index.js +4 -1
  138. package/lib/modules/AccountList/index.d.ts +7 -1
  139. package/lib/modules/AccountList/index.js +27 -0
  140. package/lib/modules/AccountList/types.d.ts +28 -0
  141. package/lib/modules/Cart/index.js +1 -1
  142. package/lib/modules/Cart/utils/changePrice.d.ts +2 -2
  143. package/lib/modules/Cart/utils/changePrice.js +1 -1
  144. package/lib/modules/Customer/constants.d.ts +7 -0
  145. package/lib/modules/Customer/constants.js +39 -0
  146. package/lib/modules/Customer/index.d.ts +122 -0
  147. package/lib/modules/Customer/index.js +440 -0
  148. package/lib/modules/Customer/types.d.ts +146 -0
  149. package/lib/modules/Customer/types.js +37 -0
  150. package/lib/modules/Payment/cash.d.ts +11 -0
  151. package/lib/modules/Payment/cash.js +51 -0
  152. package/lib/modules/Payment/eftpos.d.ts +11 -0
  153. package/lib/modules/Payment/eftpos.js +51 -0
  154. package/lib/modules/Payment/index.d.ts +273 -9
  155. package/lib/modules/Payment/index.js +1285 -50
  156. package/lib/modules/Payment/types.d.ts +382 -30
  157. package/lib/modules/Payment/types.js +41 -6
  158. package/lib/modules/Payment/wallet.d.ts +11 -0
  159. package/lib/modules/Payment/wallet.js +51 -0
  160. package/lib/modules/Payment/walletpass.d.ts +0 -0
  161. package/lib/modules/Payment/walletpass.js +0 -0
  162. package/lib/modules/ProductList/index.d.ts +14 -3
  163. package/lib/modules/ProductList/index.js +42 -28
  164. package/lib/modules/ProductList/types.d.ts +0 -1
  165. package/lib/modules/Rules/index.js +20 -12
  166. package/lib/modules/Rules/types.d.ts +1 -0
  167. package/lib/modules/index.d.ts +1 -0
  168. package/lib/modules/index.js +2 -0
  169. package/lib/plugins/app-types/app/app.d.ts +83 -0
  170. package/lib/plugins/app-types/app/const.d.ts +4 -0
  171. package/lib/plugins/app-types/app/index.d.ts +14 -0
  172. package/lib/plugins/app-types/applicationManager/application.d.ts +50 -0
  173. package/lib/plugins/app-types/applicationManager/index.d.ts +13 -0
  174. package/lib/plugins/app-types/config.d.ts +3 -0
  175. package/lib/plugins/app-types/cookie/index.d.ts +13 -0
  176. package/lib/plugins/app-types/data/index.d.ts +8 -0
  177. package/lib/plugins/app-types/history/config.d.ts +24 -0
  178. package/lib/plugins/app-types/history/index.d.ts +20 -0
  179. package/lib/plugins/app-types/history/type.d.ts +2 -0
  180. package/lib/plugins/app-types/hooks/index.d.ts +12 -0
  181. package/lib/plugins/app-types/hooks/useDelayedValue/index.d.ts +2 -0
  182. package/lib/plugins/app-types/hooks/useDispatch/index.d.ts +2 -0
  183. package/lib/plugins/app-types/hooks/useLowCode/index.d.ts +13 -0
  184. package/lib/plugins/app-types/hooks/useStore/index.d.ts +6 -0
  185. package/lib/plugins/app-types/index.d.ts +6 -0
  186. package/lib/plugins/app-types/indexDB/index.d.ts +178 -0
  187. package/lib/plugins/app-types/locales/en.d.ts +3 -0
  188. package/lib/plugins/app-types/locales/index.d.ts +37 -0
  189. package/lib/plugins/app-types/locales/original.d.ts +3 -0
  190. package/lib/plugins/app-types/locales/type.d.ts +19 -0
  191. package/lib/plugins/app-types/locales/zh-CN.d.ts +3 -0
  192. package/lib/plugins/app-types/locales/zh-HK.d.ts +3 -0
  193. package/lib/plugins/app-types/logger/feishu.d.ts +11 -0
  194. package/lib/plugins/app-types/logger/index.d.ts +122 -0
  195. package/lib/plugins/app-types/menuManager/hooks.d.ts +17 -0
  196. package/lib/plugins/app-types/menuManager/index.d.ts +28 -0
  197. package/lib/plugins/app-types/models/global.d.ts +32 -0
  198. package/lib/plugins/app-types/models/index.d.ts +45 -0
  199. package/lib/plugins/app-types/models/type.d.ts +2 -0
  200. package/lib/plugins/app-types/package.json +15 -0
  201. package/lib/plugins/app-types/plugin/index.d.ts +0 -0
  202. package/lib/plugins/app-types/pubsub/example.d.ts +5 -0
  203. package/lib/plugins/app-types/pubsub/index.d.ts +63 -0
  204. package/lib/plugins/app-types/request/cache.d.ts +46 -0
  205. package/lib/plugins/app-types/request/cancelToken.d.ts +38 -0
  206. package/lib/plugins/app-types/request/config.d.ts +3 -0
  207. package/lib/plugins/app-types/request/constants.d.ts +2 -0
  208. package/lib/plugins/app-types/request/index.d.ts +24 -0
  209. package/lib/plugins/app-types/request/pisell2Request.d.ts +6 -0
  210. package/lib/plugins/app-types/request/type.d.ts +41 -0
  211. package/lib/plugins/app-types/request/utils.d.ts +46 -0
  212. package/lib/plugins/app-types/routes/config.d.ts +7 -0
  213. package/lib/plugins/app-types/routes/index.d.ts +28 -0
  214. package/lib/plugins/app-types/socket/components/SocketMonitorPage.d.ts +6 -0
  215. package/lib/plugins/app-types/socket/components/index.d.ts +2 -0
  216. package/lib/plugins/app-types/socket/constants.d.ts +33 -0
  217. package/lib/plugins/app-types/socket/events.d.ts +31 -0
  218. package/lib/plugins/app-types/socket/heartbeat.d.ts +66 -0
  219. package/lib/plugins/app-types/socket/index.d.ts +61 -0
  220. package/lib/plugins/app-types/socket/monitor.d.ts +169 -0
  221. package/lib/plugins/app-types/socket/reconnect.d.ts +61 -0
  222. package/lib/plugins/app-types/socket/socket.d.ts +129 -0
  223. package/lib/plugins/app-types/socket/types.d.ts +85 -0
  224. package/lib/plugins/app-types/storage/index.d.ts +17 -0
  225. package/lib/plugins/app-types/tasks/index.d.ts +77 -0
  226. package/lib/plugins/app-types/tasks/type.d.ts +62 -0
  227. package/lib/plugins/app-types/tasks/useTasks.d.ts +5 -0
  228. package/lib/plugins/app-types/type.d.ts +2 -0
  229. package/lib/plugins/app-types/variables/VariablesProvider.d.ts +7 -0
  230. package/lib/plugins/app-types/variables/config.d.ts +3 -0
  231. package/lib/plugins/app-types/variables/index.d.ts +6 -0
  232. package/lib/plugins/app-types/variables/type.d.ts +2 -0
  233. package/lib/plugins/app-types/website/index.d.ts +6 -0
  234. package/lib/plugins/app.d.ts +8 -0
  235. package/lib/plugins/app.js +17 -0
  236. package/lib/plugins/window.d.ts +1 -0
  237. package/lib/solution/BookingByStep/index.js +40 -29
  238. package/lib/solution/BookingByStep/types.d.ts +3 -2
  239. package/lib/solution/BookingTicket/index.d.ts +172 -0
  240. package/lib/solution/BookingTicket/index.js +399 -0
  241. package/lib/solution/BookingTicket/types.d.ts +68 -0
  242. package/lib/solution/BookingTicket/types.js +72 -0
  243. package/lib/solution/BookingTicket/utils/scan/cloudSearch.d.ts +22 -0
  244. package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +117 -0
  245. package/lib/solution/BookingTicket/utils/scan/handleScan.d.ts +16 -0
  246. package/lib/solution/BookingTicket/utils/scan/handleScan.js +125 -0
  247. package/lib/solution/BookingTicket/utils/scan/index.d.ts +81 -0
  248. package/lib/solution/BookingTicket/utils/scan/index.js +210 -0
  249. package/lib/solution/BookingTicket/utils/scan/scanCache.d.ts +78 -0
  250. package/lib/solution/BookingTicket/utils/scan/scanCache.js +231 -0
  251. package/lib/solution/BuyTickets/index.d.ts +2 -2
  252. package/lib/solution/BuyTickets/index.js +1 -1
  253. package/lib/solution/Checkout/appointmentDemo.json +1 -0
  254. package/lib/solution/Checkout/index.d.ts +181 -0
  255. package/lib/solution/Checkout/index.js +864 -0
  256. package/lib/solution/Checkout/types.d.ts +550 -0
  257. package/lib/solution/Checkout/types.js +75 -0
  258. package/lib/solution/Checkout/utils/index.d.ts +73 -0
  259. package/lib/solution/Checkout/utils/index.js +266 -0
  260. package/lib/solution/ShopDiscount/index.js +2 -1
  261. package/lib/solution/index.d.ts +2 -0
  262. package/lib/solution/index.js +5 -1
  263. package/lib/types/index.d.ts +3 -1
  264. package/lib/utils/task.d.ts +40 -0
  265. package/lib/utils/task.js +109 -0
  266. package/lib/utils/watch.d.ts +102 -0
  267. package/lib/utils/watch.js +217 -0
  268. package/package.json +4 -2
@@ -0,0 +1,172 @@
1
+ import { Module, PisellCore } from '../../types';
2
+ import { BaseModule } from '../../modules/BaseModule';
3
+ import { RequestPlugin, WindowPlugin } from '../../plugins';
4
+ import { IGetCustomerListParams, ICustomer, ILoadProductsParams, IScanResult } from './types';
5
+ import { ProductData } from '../../modules';
6
+ export declare class BookingTicketImpl extends BaseModule implements Module {
7
+ protected defaultName: string;
8
+ protected defaultVersion: string;
9
+ isSolution: boolean;
10
+ request: RequestPlugin;
11
+ window: WindowPlugin;
12
+ private shopStore;
13
+ private store;
14
+ private otherParams;
15
+ private cacheId;
16
+ private platform;
17
+ private scan;
18
+ initialize(core: PisellCore, options: any): Promise<void>;
19
+ /**
20
+ * 获取商品列表
21
+ * @param params 包含 schedule_date 的参数
22
+ * @returns 商品列表
23
+ */
24
+ loadProducts(params?: ILoadProductsParams): Promise<any>;
25
+ /**
26
+ * 获取商品列表(不加载到模块中)
27
+ * @returns 商品列表
28
+ */
29
+ getProducts(): Promise<ProductData[]>;
30
+ /**
31
+ * 获取客户列表
32
+ * @param params 查询参数
33
+ * @returns 客户列表响应
34
+ */
35
+ getCustomerList(params?: IGetCustomerListParams): Promise<import("../../modules").ICustomerListResponse>;
36
+ /**
37
+ * 设置活跃客户
38
+ * @param customer 客户信息
39
+ */
40
+ setActiveCustomer(customer: ICustomer): void;
41
+ /**
42
+ * 获取当前活跃客户
43
+ * @returns 当前活跃客户
44
+ */
45
+ getActiveCustomer(): ICustomer | null;
46
+ /**
47
+ * 根据ID设置选中的客户
48
+ * @param customerId 客户ID
49
+ */
50
+ setSelectedCustomerById(customerId: string | number): void;
51
+ /**
52
+ * 获取所有客户
53
+ * @returns 客户列表
54
+ */
55
+ getCustomers(): ICustomer[];
56
+ /**
57
+ * 根据ID获取客户
58
+ * @param customerId 客户ID
59
+ * @returns 客户信息
60
+ */
61
+ getCustomerById(customerId: string | number): ICustomer | null;
62
+ /**
63
+ * 清空客户列表
64
+ */
65
+ clearCustomers(): void;
66
+ /**
67
+ * 添加客户到列表第一位
68
+ * @param customer 要添加的客户信息
69
+ */
70
+ addCustomerToFirst(customer: ICustomer): void;
71
+ /**
72
+ * 获取客户分页信息
73
+ * @returns 分页信息
74
+ */
75
+ getCustomerPaginationInfo(): import("../../modules").IPaginationInfo;
76
+ /**
77
+ * 获取客户列表总数
78
+ * @returns 总数
79
+ */
80
+ getCustomerTotal(): number;
81
+ /**
82
+ * 设置客户分页信息
83
+ * @param page 页码
84
+ * @param pageSize 每页数量
85
+ */
86
+ setCustomerPaginationInfo(page: number, pageSize: number): void;
87
+ /**
88
+ * 便捷方法:切换客户分页并自动获取数据
89
+ * @param page 页码
90
+ * @param pageSize 每页数量(可选)
91
+ * @returns 客户列表响应
92
+ */
93
+ changeCustomerPage(page: number, pageSize?: number): Promise<import("../../modules").ICustomerListResponse>;
94
+ /**
95
+ * 滚动加载更多客户数据 - 数据会追加到现有列表中
96
+ * @returns 客户列表响应
97
+ */
98
+ loadMoreCustomers(): Promise<import("../../modules").ICustomerListResponse>;
99
+ /**
100
+ * 重置并重新开始滚动加载客户数据
101
+ * @param params 查询参数
102
+ * @returns 客户列表响应
103
+ */
104
+ resetAndLoadCustomers(params?: IGetCustomerListParams): Promise<import("../../modules").ICustomerListResponse>;
105
+ /**
106
+ * 检查是否还有更多客户数据可以加载
107
+ * @returns 是否还有更多数据
108
+ */
109
+ hasMoreCustomers(): boolean;
110
+ /**
111
+ * 获取当前的客户搜索条件
112
+ * @returns 当前搜索条件
113
+ */
114
+ getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
115
+ /**
116
+ * 获取客户列表状态(包含滚动加载相关状态)
117
+ * @returns 客户状态
118
+ */
119
+ getCustomerState(): import("../../modules").CustomerState;
120
+ /**
121
+ * 全局扫描监听
122
+ * @param callback 回调
123
+ */
124
+ scanGlobalListener(callback: (data: IScanResult) => void): {
125
+ remove: () => void;
126
+ };
127
+ /**
128
+ * 客户扫描监听
129
+ * @param callback 回调
130
+ */
131
+ scanCustomerListener(callback: (data: IScanResult) => void): {
132
+ remove: () => void;
133
+ };
134
+ /**
135
+ * 调用摄像头
136
+ * @param data 用户自定义数据
137
+ */
138
+ activateCamera(data?: {
139
+ [key: string]: any;
140
+ }): void;
141
+ /**
142
+ * 禁用所有扫描监听
143
+ */
144
+ disableAllScanListeners(): void;
145
+ /**
146
+ * 启用所有扫描监听
147
+ */
148
+ enableAllScanListeners(): void;
149
+ /**
150
+ * 清空所有扫描监听对应的任务执行队列
151
+ */
152
+ clearAllScanListenersTaskQueue(): void;
153
+ /**
154
+ * 设置其他参数
155
+ * @param params 参数
156
+ * @param options 选项
157
+ */
158
+ setOtherParams(params: Record<string, any>, { cover }?: {
159
+ cover?: boolean;
160
+ }): Promise<void>;
161
+ /**
162
+ * 获取其他参数
163
+ * @returns 其他参数
164
+ */
165
+ getOtherParams(): Promise<Record<string, any>>;
166
+ /**
167
+ * 销毁模块
168
+ */
169
+ destroy(): void;
170
+ }
171
+ export * from './types';
172
+ export { BookingTicketImpl as BookingTicket };
@@ -0,0 +1,399 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/solution/BookingTicket/index.ts
31
+ var BookingTicket_exports = {};
32
+ __export(BookingTicket_exports, {
33
+ BookingTicket: () => BookingTicketImpl,
34
+ BookingTicketImpl: () => BookingTicketImpl
35
+ });
36
+ module.exports = __toCommonJS(BookingTicket_exports);
37
+ var import_BaseModule = require("../../modules/BaseModule");
38
+ var import_types = require("./types");
39
+ var import_scan = __toESM(require("./utils/scan"));
40
+ var import_handleScan = require("./utils/scan/handleScan");
41
+ var import_scanCache = __toESM(require("./utils/scan/scanCache"));
42
+ __reExport(BookingTicket_exports, require("./types"), module.exports);
43
+ var BookingTicketImpl = class extends import_BaseModule.BaseModule {
44
+ constructor() {
45
+ super(...arguments);
46
+ this.defaultName = "bookingTicket";
47
+ this.defaultVersion = "1.0.0";
48
+ this.isSolution = true;
49
+ this.otherParams = {};
50
+ }
51
+ async initialize(core, options) {
52
+ var _a, _b, _c;
53
+ this.core = core;
54
+ this.store = options.store || {};
55
+ this.otherParams = options.otherParams || {};
56
+ console.log("[BookingTicket] 初始化完成");
57
+ this.request = core.getPlugin("request");
58
+ this.window = core.getPlugin("window");
59
+ this.shopStore = core.getPlugin("shopStore");
60
+ if (!this.request) {
61
+ throw new Error("bookingTicket解决方案需要 request 插件支持");
62
+ }
63
+ if (!this.shopStore) {
64
+ throw new Error("bookingTicket解决方案需要 shopStore 插件支持");
65
+ }
66
+ let targetCacheData = {};
67
+ this.cacheId = (_a = this.otherParams) == null ? void 0 : _a.cacheId;
68
+ this.platform = (_b = this.otherParams) == null ? void 0 : _b.platform;
69
+ this.scan = new import_scan.default(this, "BOOKING_TICKET_SCAN");
70
+ if ((_c = this.otherParams) == null ? void 0 : _c.cacheId) {
71
+ const sessionData = this.window.sessionStorage.getItem(this.name);
72
+ if (sessionData) {
73
+ const data = JSON.parse(sessionData);
74
+ targetCacheData = data[this.otherParams.cacheId];
75
+ }
76
+ }
77
+ const moduleArr = [
78
+ "cart",
79
+ "products",
80
+ "accountList",
81
+ "customer",
82
+ "order"
83
+ ];
84
+ moduleArr.forEach((step) => {
85
+ var _a2, _b2;
86
+ const targetModule = (0, import_types.createModule)(step, this.name);
87
+ if (targetModule) {
88
+ this.store[step] = targetModule;
89
+ this.core.registerModule(targetModule, {
90
+ initialState: targetCacheData == null ? void 0 : targetCacheData[targetModule.name],
91
+ otherParams: {
92
+ ...this.otherParams,
93
+ fatherModule: this.name,
94
+ openCache: ((_a2 = this.otherParams) == null ? void 0 : _a2.cacheId) ? true : false,
95
+ cacheId: (_b2 = this.otherParams) == null ? void 0 : _b2.cacheId
96
+ }
97
+ });
98
+ } else {
99
+ throw new Error(`模块 ${step} 不存在`);
100
+ }
101
+ });
102
+ this.core.effects.emit(import_types.BookingTicketHooks.onInited, {});
103
+ }
104
+ /**
105
+ * 获取商品列表
106
+ * @param params 包含 schedule_date 的参数
107
+ * @returns 商品列表
108
+ */
109
+ async loadProducts(params = {}) {
110
+ const { schedule_date, customer_id, menu_list_ids, schedule_datetime } = params;
111
+ try {
112
+ const result = await this.store.products.loadProducts({
113
+ with_count: ["bundleGroup", "optionGroup"],
114
+ with_schedule: 1,
115
+ ...params,
116
+ cacheId: this.cacheId
117
+ });
118
+ this.core.effects.emit(import_types.BookingTicketHooks.onProductsLoaded, result);
119
+ return result;
120
+ } catch (error) {
121
+ console.error("Failed to load products:", error);
122
+ throw error;
123
+ }
124
+ }
125
+ /**
126
+ * 获取商品列表(不加载到模块中)
127
+ * @returns 商品列表
128
+ */
129
+ async getProducts() {
130
+ return this.store.products.getProducts();
131
+ }
132
+ /**
133
+ * 获取客户列表
134
+ * @param params 查询参数
135
+ * @returns 客户列表响应
136
+ */
137
+ async getCustomerList(params = {}) {
138
+ try {
139
+ const result = await this.store.customer.getCustomerList(params);
140
+ return result;
141
+ } catch (error) {
142
+ console.error("Failed to get customer list:", error);
143
+ throw error;
144
+ }
145
+ }
146
+ /**
147
+ * 设置活跃客户
148
+ * @param customer 客户信息
149
+ */
150
+ setActiveCustomer(customer) {
151
+ this.store.customer.setSelectedCustomer(customer);
152
+ this.core.effects.emit(import_types.BookingTicketHooks.onCustomerSelected, {
153
+ customer
154
+ });
155
+ }
156
+ /**
157
+ * 获取当前活跃客户
158
+ * @returns 当前活跃客户
159
+ */
160
+ getActiveCustomer() {
161
+ return this.store.customer.getSelectedCustomer();
162
+ }
163
+ /**
164
+ * 根据ID设置选中的客户
165
+ * @param customerId 客户ID
166
+ */
167
+ setSelectedCustomerById(customerId) {
168
+ const customer = this.store.customer.getCustomerById(customerId);
169
+ if (customer) {
170
+ this.store.customer.setSelectedCustomer(customer);
171
+ this.core.effects.emit(import_types.BookingTicketHooks.onCustomerSelected, {
172
+ customer
173
+ });
174
+ }
175
+ }
176
+ /**
177
+ * 获取所有客户
178
+ * @returns 客户列表
179
+ */
180
+ getCustomers() {
181
+ return this.store.customer.getCustomers();
182
+ }
183
+ /**
184
+ * 根据ID获取客户
185
+ * @param customerId 客户ID
186
+ * @returns 客户信息
187
+ */
188
+ getCustomerById(customerId) {
189
+ return this.store.customer.getCustomerById(customerId);
190
+ }
191
+ /**
192
+ * 清空客户列表
193
+ */
194
+ clearCustomers() {
195
+ this.store.customer.clearCustomers();
196
+ }
197
+ /**
198
+ * 添加客户到列表第一位
199
+ * @param customer 要添加的客户信息
200
+ */
201
+ addCustomerToFirst(customer) {
202
+ this.store.customer.addCustomerToFirst(customer);
203
+ }
204
+ /**
205
+ * 获取客户分页信息
206
+ * @returns 分页信息
207
+ */
208
+ getCustomerPaginationInfo() {
209
+ return this.store.customer.getPaginationInfo();
210
+ }
211
+ /**
212
+ * 获取客户列表总数
213
+ * @returns 总数
214
+ */
215
+ getCustomerTotal() {
216
+ return this.store.customer.getState().total;
217
+ }
218
+ /**
219
+ * 设置客户分页信息
220
+ * @param page 页码
221
+ * @param pageSize 每页数量
222
+ */
223
+ setCustomerPaginationInfo(page, pageSize) {
224
+ this.store.customer.setPaginationInfo(page, pageSize);
225
+ }
226
+ /**
227
+ * 便捷方法:切换客户分页并自动获取数据
228
+ * @param page 页码
229
+ * @param pageSize 每页数量(可选)
230
+ * @returns 客户列表响应
231
+ */
232
+ async changeCustomerPage(page, pageSize) {
233
+ try {
234
+ const result = await this.store.customer.changeCustomerPage(
235
+ page,
236
+ pageSize
237
+ );
238
+ return result;
239
+ } catch (error) {
240
+ console.error("Failed to change customer page:", error);
241
+ throw error;
242
+ }
243
+ }
244
+ /**
245
+ * 滚动加载更多客户数据 - 数据会追加到现有列表中
246
+ * @returns 客户列表响应
247
+ */
248
+ async loadMoreCustomers() {
249
+ try {
250
+ const result = await this.store.customer.loadMoreCustomers();
251
+ this.core.effects.emit(import_types.BookingTicketHooks.onCustomerListUpdate, result);
252
+ return result;
253
+ } catch (error) {
254
+ console.error("Failed to load more customers:", error);
255
+ throw error;
256
+ }
257
+ }
258
+ /**
259
+ * 重置并重新开始滚动加载客户数据
260
+ * @param params 查询参数
261
+ * @returns 客户列表响应
262
+ */
263
+ async resetAndLoadCustomers(params = {}) {
264
+ try {
265
+ const result = await this.store.customer.resetAndLoadCustomers(params);
266
+ this.core.effects.emit(import_types.BookingTicketHooks.onCustomerListReset, result);
267
+ return result;
268
+ } catch (error) {
269
+ console.error("Failed to reset and load customers:", error);
270
+ throw error;
271
+ }
272
+ }
273
+ /**
274
+ * 检查是否还有更多客户数据可以加载
275
+ * @returns 是否还有更多数据
276
+ */
277
+ hasMoreCustomers() {
278
+ return this.store.customer.hasMoreCustomers();
279
+ }
280
+ /**
281
+ * 获取当前的客户搜索条件
282
+ * @returns 当前搜索条件
283
+ */
284
+ getCurrentCustomerSearchParams() {
285
+ return this.store.customer.getCurrentSearchParams();
286
+ }
287
+ /**
288
+ * 获取客户列表状态(包含滚动加载相关状态)
289
+ * @returns 客户状态
290
+ */
291
+ getCustomerState() {
292
+ return this.store.customer.getState();
293
+ }
294
+ /**
295
+ * 全局扫描监听
296
+ * @param callback 回调
297
+ */
298
+ scanGlobalListener(callback) {
299
+ const localSearch = (v) => this.store.products.findProductsByCodeOrBarcode(v);
300
+ const scanCallback = (0, import_handleScan.handleGlobalScan)(this.request, localSearch);
301
+ const safeCallback = (d) => {
302
+ try {
303
+ callback(d);
304
+ } catch (error) {
305
+ console.error("scanGlobalListener回掉函数异常", error);
306
+ }
307
+ };
308
+ const listener = { key: "global", callback: safeCallback };
309
+ const removeListener = this.scan.addListener(listener, scanCallback);
310
+ return removeListener;
311
+ }
312
+ /**
313
+ * 客户扫描监听
314
+ * @param callback 回调
315
+ */
316
+ scanCustomerListener(callback) {
317
+ const scanCallback = (0, import_handleScan.handleCustomerScan)();
318
+ const safeCallback = (d) => {
319
+ try {
320
+ callback(d);
321
+ } catch (error) {
322
+ console.error("scanCustomerListener回掉函数异常", error);
323
+ }
324
+ };
325
+ const listener = { key: "customer", callback: safeCallback };
326
+ const removeListener = this.scan.addListener(listener, scanCallback);
327
+ return removeListener;
328
+ }
329
+ /**
330
+ * 调用摄像头
331
+ * @param data 用户自定义数据
332
+ */
333
+ activateCamera(data) {
334
+ var _a, _b, _c, _d;
335
+ (_d = (_c = (_b = (_a = this.window) == null ? void 0 : _a.interaction) == null ? void 0 : _b.utils) == null ? void 0 : _c.postMessageToApp) == null ? void 0 : _d.call(_c, {
336
+ module: "global",
337
+ key: "active_native_scanner",
338
+ data
339
+ });
340
+ }
341
+ /**
342
+ * 禁用所有扫描监听
343
+ */
344
+ disableAllScanListeners() {
345
+ this.scan.disableAllListeners();
346
+ }
347
+ /**
348
+ * 启用所有扫描监听
349
+ */
350
+ enableAllScanListeners() {
351
+ this.scan.enableAllListeners();
352
+ }
353
+ /**
354
+ * 清空所有扫描监听对应的任务执行队列
355
+ */
356
+ clearAllScanListenersTaskQueue() {
357
+ this.scan.clearTaskQueue();
358
+ }
359
+ /**
360
+ * 设置其他参数
361
+ * @param params 参数
362
+ * @param options 选项
363
+ */
364
+ async setOtherParams(params, { cover = false } = {}) {
365
+ if (cover) {
366
+ this.otherParams = params;
367
+ } else {
368
+ this.otherParams = { ...this.otherParams, ...params };
369
+ }
370
+ }
371
+ /**
372
+ * 获取其他参数
373
+ * @returns 其他参数
374
+ */
375
+ async getOtherParams() {
376
+ return this.otherParams;
377
+ }
378
+ /**
379
+ * 销毁模块
380
+ */
381
+ destroy() {
382
+ var _a, _b, _c, _d, _e;
383
+ (_a = this.store.cart) == null ? void 0 : _a.destroy();
384
+ (_b = this.store.products) == null ? void 0 : _b.destroy();
385
+ (_c = this.store.accountList) == null ? void 0 : _c.destroy();
386
+ (_d = this.store.customer) == null ? void 0 : _d.destroy();
387
+ (_e = this.store.order) == null ? void 0 : _e.destroy();
388
+ this.core.effects.offByModuleDestroy(this.name);
389
+ this.core.unregisterModule(this);
390
+ this.scan.removeAllListeners();
391
+ import_scanCache.default.clear();
392
+ }
393
+ };
394
+ // Annotate the CommonJS export names for ESM import in node:
395
+ 0 && (module.exports = {
396
+ BookingTicket,
397
+ BookingTicketImpl,
398
+ ...require("./types")
399
+ });
@@ -0,0 +1,68 @@
1
+ import { ProductList, CartModule, AccountListModule, OrderModule } from '../../modules';
2
+ import { CustomerModule } from '../../modules/Customer';
3
+ export interface BookingTicketState {
4
+ cart: CartModule;
5
+ products: ProductList;
6
+ accountList: AccountListModule;
7
+ customer: CustomerModule;
8
+ order: OrderModule;
9
+ }
10
+ export declare function createModule<T extends keyof BookingTicketState>(moduleName: T, solutionName: string, name?: string, version?: string): BookingTicketState[T];
11
+ export declare enum BookingTicketHooks {
12
+ onInited = "bookingTicket:onInited",
13
+ onDestroy = "bookingTicket:onDestroy",
14
+ onProductsLoaded = "bookingTicket:onProductsLoaded",
15
+ onCustomerSelected = "bookingTicket:onCustomerSelected",
16
+ onCustomerListUpdate = "bookingTicket:onCustomerListUpdate",
17
+ onCustomerListReset = "bookingTicket:onCustomerListReset"
18
+ }
19
+ /**
20
+ * 获取客户列表的参数
21
+ */
22
+ export interface IGetCustomerListParams {
23
+ /** 页码 */
24
+ skip?: number;
25
+ /** 每页数量 */
26
+ num?: number;
27
+ /** 搜索关键词 */
28
+ search?: string;
29
+ /** 其他筛选参数 */
30
+ [key: string]: any;
31
+ }
32
+ /**
33
+ * 客户信息
34
+ */
35
+ export interface ICustomer {
36
+ /** 客户ID */
37
+ id: string | number;
38
+ /** 客户姓名 */
39
+ name: string;
40
+ /** 客户电话 */
41
+ phone?: string;
42
+ /** 客户邮箱 */
43
+ email?: string;
44
+ /** 其他客户信息 */
45
+ [key: string]: any;
46
+ }
47
+ /**
48
+ * 加载商品列表的参数
49
+ */
50
+ export interface ILoadProductsParams {
51
+ /** 日期 格式:YYYY-MM-DD */
52
+ schedule_date?: string;
53
+ /** 客户ID */
54
+ customer_id?: number;
55
+ /** 餐牌列表ID */
56
+ menu_list_ids?: number[];
57
+ /** 时间 格式:YYYY-MM-DD HH:mm:ss*/
58
+ schedule_datetime?: string;
59
+ }
60
+ /**
61
+ * 扫描结果
62
+ */
63
+ export interface IScanResult {
64
+ status: 'success' | 'fail';
65
+ scanType: string;
66
+ scanCode: string;
67
+ result: any;
68
+ }
@@ -0,0 +1,72 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/solution/BookingTicket/types.ts
20
+ var types_exports = {};
21
+ __export(types_exports, {
22
+ BookingTicketHooks: () => BookingTicketHooks,
23
+ createModule: () => createModule
24
+ });
25
+ module.exports = __toCommonJS(types_exports);
26
+ var import_modules = require("../../modules");
27
+ var import_Customer = require("../../modules/Customer");
28
+ function createModule(moduleName, solutionName, name, version) {
29
+ switch (moduleName) {
30
+ case "cart":
31
+ return new import_modules.CartModule(
32
+ `${solutionName}_${name || moduleName}`,
33
+ version
34
+ );
35
+ case "products":
36
+ return new import_modules.ProductList(
37
+ `${solutionName}_${name || moduleName}`,
38
+ version
39
+ );
40
+ case "accountList":
41
+ return new import_modules.AccountListModule(
42
+ `${solutionName}_${name || moduleName}`,
43
+ version
44
+ );
45
+ case "customer":
46
+ return new import_Customer.CustomerModule(
47
+ `${solutionName}_${name || moduleName}`,
48
+ version
49
+ );
50
+ case "order":
51
+ return new import_modules.OrderModule(
52
+ `${solutionName}_${name || moduleName}`,
53
+ version
54
+ );
55
+ default:
56
+ throw new Error(`Unknown module type: ${moduleName}`);
57
+ }
58
+ }
59
+ var BookingTicketHooks = /* @__PURE__ */ ((BookingTicketHooks2) => {
60
+ BookingTicketHooks2["onInited"] = "bookingTicket:onInited";
61
+ BookingTicketHooks2["onDestroy"] = "bookingTicket:onDestroy";
62
+ BookingTicketHooks2["onProductsLoaded"] = "bookingTicket:onProductsLoaded";
63
+ BookingTicketHooks2["onCustomerSelected"] = "bookingTicket:onCustomerSelected";
64
+ BookingTicketHooks2["onCustomerListUpdate"] = "bookingTicket:onCustomerListUpdate";
65
+ BookingTicketHooks2["onCustomerListReset"] = "bookingTicket:onCustomerListReset";
66
+ return BookingTicketHooks2;
67
+ })(BookingTicketHooks || {});
68
+ // Annotate the CommonJS export names for ESM import in node:
69
+ 0 && (module.exports = {
70
+ BookingTicketHooks,
71
+ createModule
72
+ });