@pisell/pisellos 3.0.57 → 3.0.59

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 (256) hide show
  1. package/dist/core/index.js +1 -2
  2. package/dist/effects/index.d.ts +3 -4
  3. package/dist/effects/index.js +6 -15
  4. package/dist/modules/AccountList/index.d.ts +1 -7
  5. package/dist/modules/AccountList/index.js +14 -81
  6. package/dist/modules/AccountList/types.d.ts +0 -28
  7. package/dist/modules/AccountList/types.js +0 -8
  8. package/dist/modules/Cart/index.js +1 -1
  9. package/dist/modules/Payment/index.d.ts +9 -273
  10. package/dist/modules/Payment/index.js +109 -2525
  11. package/dist/modules/Payment/types.d.ts +30 -382
  12. package/dist/modules/Payment/types.js +14 -116
  13. package/dist/modules/ProductList/index.d.ts +1 -12
  14. package/dist/modules/ProductList/index.js +3 -27
  15. package/dist/modules/Rules/index.js +14 -27
  16. package/dist/modules/Rules/types.d.ts +0 -1
  17. package/dist/modules/index.d.ts +0 -1
  18. package/dist/modules/index.js +0 -1
  19. package/dist/plugins/window.d.ts +0 -1
  20. package/dist/solution/BookingByStep/index.js +1 -9
  21. package/dist/solution/ShopDiscount/index.js +2 -4
  22. package/dist/solution/index.d.ts +0 -2
  23. package/dist/solution/index.js +1 -3
  24. package/dist/types/index.d.ts +1 -3
  25. package/lib/core/index.js +1 -1
  26. package/lib/effects/index.d.ts +3 -4
  27. package/lib/effects/index.js +1 -4
  28. package/lib/modules/AccountList/index.d.ts +1 -7
  29. package/lib/modules/AccountList/index.js +0 -27
  30. package/lib/modules/AccountList/types.d.ts +0 -28
  31. package/lib/modules/Cart/index.js +1 -1
  32. package/lib/modules/Payment/index.d.ts +9 -273
  33. package/lib/modules/Payment/index.js +50 -1285
  34. package/lib/modules/Payment/types.d.ts +30 -382
  35. package/lib/modules/Payment/types.js +6 -41
  36. package/lib/modules/ProductList/index.d.ts +1 -12
  37. package/lib/modules/ProductList/index.js +2 -29
  38. package/lib/modules/Rules/index.js +12 -20
  39. package/lib/modules/Rules/types.d.ts +0 -1
  40. package/lib/modules/index.d.ts +0 -1
  41. package/lib/modules/index.js +0 -2
  42. package/lib/plugins/window.d.ts +0 -1
  43. package/lib/solution/BookingByStep/index.js +2 -1
  44. package/lib/solution/ShopDiscount/index.js +1 -2
  45. package/lib/solution/index.d.ts +0 -2
  46. package/lib/solution/index.js +1 -5
  47. package/lib/types/index.d.ts +1 -3
  48. package/package.json +2 -4
  49. package/dist/modules/Customer/constants.d.ts +0 -7
  50. package/dist/modules/Customer/constants.js +0 -12
  51. package/dist/modules/Customer/index.d.ts +0 -122
  52. package/dist/modules/Customer/index.js +0 -697
  53. package/dist/modules/Customer/types.d.ts +0 -146
  54. package/dist/modules/Customer/types.js +0 -41
  55. package/dist/modules/Payment/cash.d.ts +0 -11
  56. package/dist/modules/Payment/cash.js +0 -78
  57. package/dist/modules/Payment/eftpos.d.ts +0 -11
  58. package/dist/modules/Payment/eftpos.js +0 -80
  59. package/dist/modules/Payment/wallet.d.ts +0 -11
  60. package/dist/modules/Payment/wallet.js +0 -78
  61. package/dist/modules/Payment/walletpass.d.ts +0 -0
  62. package/dist/modules/Payment/walletpass.js +0 -0
  63. package/dist/plugins/app-types/app/app.d.ts +0 -83
  64. package/dist/plugins/app-types/app/const.d.ts +0 -4
  65. package/dist/plugins/app-types/app/index.d.ts +0 -14
  66. package/dist/plugins/app-types/applicationManager/application.d.ts +0 -50
  67. package/dist/plugins/app-types/applicationManager/index.d.ts +0 -13
  68. package/dist/plugins/app-types/config.d.ts +0 -3
  69. package/dist/plugins/app-types/cookie/index.d.ts +0 -13
  70. package/dist/plugins/app-types/data/index.d.ts +0 -8
  71. package/dist/plugins/app-types/history/config.d.ts +0 -24
  72. package/dist/plugins/app-types/history/index.d.ts +0 -20
  73. package/dist/plugins/app-types/history/type.d.ts +0 -2
  74. package/dist/plugins/app-types/hooks/index.d.ts +0 -12
  75. package/dist/plugins/app-types/hooks/useDelayedValue/index.d.ts +0 -2
  76. package/dist/plugins/app-types/hooks/useDispatch/index.d.ts +0 -2
  77. package/dist/plugins/app-types/hooks/useLowCode/index.d.ts +0 -13
  78. package/dist/plugins/app-types/hooks/useStore/index.d.ts +0 -6
  79. package/dist/plugins/app-types/index.d.ts +0 -6
  80. package/dist/plugins/app-types/indexDB/index.d.ts +0 -178
  81. package/dist/plugins/app-types/locales/en.d.ts +0 -3
  82. package/dist/plugins/app-types/locales/index.d.ts +0 -37
  83. package/dist/plugins/app-types/locales/original.d.ts +0 -3
  84. package/dist/plugins/app-types/locales/type.d.ts +0 -19
  85. package/dist/plugins/app-types/locales/zh-CN.d.ts +0 -3
  86. package/dist/plugins/app-types/locales/zh-HK.d.ts +0 -3
  87. package/dist/plugins/app-types/logger/feishu.d.ts +0 -11
  88. package/dist/plugins/app-types/logger/index.d.ts +0 -122
  89. package/dist/plugins/app-types/menuManager/hooks.d.ts +0 -17
  90. package/dist/plugins/app-types/menuManager/index.d.ts +0 -28
  91. package/dist/plugins/app-types/models/global.d.ts +0 -32
  92. package/dist/plugins/app-types/models/index.d.ts +0 -45
  93. package/dist/plugins/app-types/models/type.d.ts +0 -2
  94. package/dist/plugins/app-types/package.json +0 -15
  95. package/dist/plugins/app-types/plugin/index.d.ts +0 -0
  96. package/dist/plugins/app-types/pubsub/example.d.ts +0 -5
  97. package/dist/plugins/app-types/pubsub/index.d.ts +0 -63
  98. package/dist/plugins/app-types/request/cache.d.ts +0 -46
  99. package/dist/plugins/app-types/request/cancelToken.d.ts +0 -38
  100. package/dist/plugins/app-types/request/config.d.ts +0 -3
  101. package/dist/plugins/app-types/request/constants.d.ts +0 -2
  102. package/dist/plugins/app-types/request/index.d.ts +0 -24
  103. package/dist/plugins/app-types/request/pisell2Request.d.ts +0 -6
  104. package/dist/plugins/app-types/request/type.d.ts +0 -41
  105. package/dist/plugins/app-types/request/utils.d.ts +0 -46
  106. package/dist/plugins/app-types/routes/config.d.ts +0 -7
  107. package/dist/plugins/app-types/routes/index.d.ts +0 -28
  108. package/dist/plugins/app-types/socket/components/SocketMonitorPage.d.ts +0 -6
  109. package/dist/plugins/app-types/socket/components/index.d.ts +0 -2
  110. package/dist/plugins/app-types/socket/constants.d.ts +0 -33
  111. package/dist/plugins/app-types/socket/events.d.ts +0 -31
  112. package/dist/plugins/app-types/socket/heartbeat.d.ts +0 -66
  113. package/dist/plugins/app-types/socket/index.d.ts +0 -61
  114. package/dist/plugins/app-types/socket/monitor.d.ts +0 -169
  115. package/dist/plugins/app-types/socket/reconnect.d.ts +0 -61
  116. package/dist/plugins/app-types/socket/socket.d.ts +0 -129
  117. package/dist/plugins/app-types/socket/types.d.ts +0 -85
  118. package/dist/plugins/app-types/storage/index.d.ts +0 -17
  119. package/dist/plugins/app-types/tasks/index.d.ts +0 -77
  120. package/dist/plugins/app-types/tasks/type.d.ts +0 -62
  121. package/dist/plugins/app-types/tasks/useTasks.d.ts +0 -5
  122. package/dist/plugins/app-types/type.d.ts +0 -2
  123. package/dist/plugins/app-types/variables/VariablesProvider.d.ts +0 -7
  124. package/dist/plugins/app-types/variables/config.d.ts +0 -3
  125. package/dist/plugins/app-types/variables/index.d.ts +0 -6
  126. package/dist/plugins/app-types/variables/type.d.ts +0 -2
  127. package/dist/plugins/app-types/website/index.d.ts +0 -6
  128. package/dist/plugins/app.d.ts +0 -8
  129. package/dist/plugins/app.js +0 -1
  130. package/dist/solution/BookingTicket/index.d.ts +0 -172
  131. package/dist/solution/BookingTicket/index.js +0 -665
  132. package/dist/solution/BookingTicket/types.d.ts +0 -68
  133. package/dist/solution/BookingTicket/types.js +0 -43
  134. package/dist/solution/BookingTicket/utils/scan/cloudSearch.d.ts +0 -22
  135. package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +0 -159
  136. package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts +0 -16
  137. package/dist/solution/BookingTicket/utils/scan/handleScan.js +0 -174
  138. package/dist/solution/BookingTicket/utils/scan/index.d.ts +0 -81
  139. package/dist/solution/BookingTicket/utils/scan/index.js +0 -285
  140. package/dist/solution/BookingTicket/utils/scan/scanCache.d.ts +0 -78
  141. package/dist/solution/BookingTicket/utils/scan/scanCache.js +0 -305
  142. package/dist/solution/Checkout/appointmentDemo.json +0 -1
  143. package/dist/solution/Checkout/index.d.ts +0 -181
  144. package/dist/solution/Checkout/index.js +0 -1596
  145. package/dist/solution/Checkout/types.d.ts +0 -550
  146. package/dist/solution/Checkout/types.js +0 -132
  147. package/dist/solution/Checkout/utils/index.d.ts +0 -73
  148. package/dist/solution/Checkout/utils/index.js +0 -371
  149. package/dist/utils/task.d.ts +0 -40
  150. package/dist/utils/task.js +0 -171
  151. package/dist/utils/watch.d.ts +0 -102
  152. package/dist/utils/watch.js +0 -294
  153. package/lib/modules/Customer/constants.d.ts +0 -7
  154. package/lib/modules/Customer/constants.js +0 -39
  155. package/lib/modules/Customer/index.d.ts +0 -122
  156. package/lib/modules/Customer/index.js +0 -440
  157. package/lib/modules/Customer/types.d.ts +0 -146
  158. package/lib/modules/Customer/types.js +0 -37
  159. package/lib/modules/Payment/cash.d.ts +0 -11
  160. package/lib/modules/Payment/cash.js +0 -51
  161. package/lib/modules/Payment/eftpos.d.ts +0 -11
  162. package/lib/modules/Payment/eftpos.js +0 -51
  163. package/lib/modules/Payment/wallet.d.ts +0 -11
  164. package/lib/modules/Payment/wallet.js +0 -51
  165. package/lib/modules/Payment/walletpass.d.ts +0 -0
  166. package/lib/modules/Payment/walletpass.js +0 -0
  167. package/lib/plugins/app-types/app/app.d.ts +0 -83
  168. package/lib/plugins/app-types/app/const.d.ts +0 -4
  169. package/lib/plugins/app-types/app/index.d.ts +0 -14
  170. package/lib/plugins/app-types/applicationManager/application.d.ts +0 -50
  171. package/lib/plugins/app-types/applicationManager/index.d.ts +0 -13
  172. package/lib/plugins/app-types/config.d.ts +0 -3
  173. package/lib/plugins/app-types/cookie/index.d.ts +0 -13
  174. package/lib/plugins/app-types/data/index.d.ts +0 -8
  175. package/lib/plugins/app-types/history/config.d.ts +0 -24
  176. package/lib/plugins/app-types/history/index.d.ts +0 -20
  177. package/lib/plugins/app-types/history/type.d.ts +0 -2
  178. package/lib/plugins/app-types/hooks/index.d.ts +0 -12
  179. package/lib/plugins/app-types/hooks/useDelayedValue/index.d.ts +0 -2
  180. package/lib/plugins/app-types/hooks/useDispatch/index.d.ts +0 -2
  181. package/lib/plugins/app-types/hooks/useLowCode/index.d.ts +0 -13
  182. package/lib/plugins/app-types/hooks/useStore/index.d.ts +0 -6
  183. package/lib/plugins/app-types/index.d.ts +0 -6
  184. package/lib/plugins/app-types/indexDB/index.d.ts +0 -178
  185. package/lib/plugins/app-types/locales/en.d.ts +0 -3
  186. package/lib/plugins/app-types/locales/index.d.ts +0 -37
  187. package/lib/plugins/app-types/locales/original.d.ts +0 -3
  188. package/lib/plugins/app-types/locales/type.d.ts +0 -19
  189. package/lib/plugins/app-types/locales/zh-CN.d.ts +0 -3
  190. package/lib/plugins/app-types/locales/zh-HK.d.ts +0 -3
  191. package/lib/plugins/app-types/logger/feishu.d.ts +0 -11
  192. package/lib/plugins/app-types/logger/index.d.ts +0 -122
  193. package/lib/plugins/app-types/menuManager/hooks.d.ts +0 -17
  194. package/lib/plugins/app-types/menuManager/index.d.ts +0 -28
  195. package/lib/plugins/app-types/models/global.d.ts +0 -32
  196. package/lib/plugins/app-types/models/index.d.ts +0 -45
  197. package/lib/plugins/app-types/models/type.d.ts +0 -2
  198. package/lib/plugins/app-types/package.json +0 -15
  199. package/lib/plugins/app-types/plugin/index.d.ts +0 -0
  200. package/lib/plugins/app-types/pubsub/example.d.ts +0 -5
  201. package/lib/plugins/app-types/pubsub/index.d.ts +0 -63
  202. package/lib/plugins/app-types/request/cache.d.ts +0 -46
  203. package/lib/plugins/app-types/request/cancelToken.d.ts +0 -38
  204. package/lib/plugins/app-types/request/config.d.ts +0 -3
  205. package/lib/plugins/app-types/request/constants.d.ts +0 -2
  206. package/lib/plugins/app-types/request/index.d.ts +0 -24
  207. package/lib/plugins/app-types/request/pisell2Request.d.ts +0 -6
  208. package/lib/plugins/app-types/request/type.d.ts +0 -41
  209. package/lib/plugins/app-types/request/utils.d.ts +0 -46
  210. package/lib/plugins/app-types/routes/config.d.ts +0 -7
  211. package/lib/plugins/app-types/routes/index.d.ts +0 -28
  212. package/lib/plugins/app-types/socket/components/SocketMonitorPage.d.ts +0 -6
  213. package/lib/plugins/app-types/socket/components/index.d.ts +0 -2
  214. package/lib/plugins/app-types/socket/constants.d.ts +0 -33
  215. package/lib/plugins/app-types/socket/events.d.ts +0 -31
  216. package/lib/plugins/app-types/socket/heartbeat.d.ts +0 -66
  217. package/lib/plugins/app-types/socket/index.d.ts +0 -61
  218. package/lib/plugins/app-types/socket/monitor.d.ts +0 -169
  219. package/lib/plugins/app-types/socket/reconnect.d.ts +0 -61
  220. package/lib/plugins/app-types/socket/socket.d.ts +0 -129
  221. package/lib/plugins/app-types/socket/types.d.ts +0 -85
  222. package/lib/plugins/app-types/storage/index.d.ts +0 -17
  223. package/lib/plugins/app-types/tasks/index.d.ts +0 -77
  224. package/lib/plugins/app-types/tasks/type.d.ts +0 -62
  225. package/lib/plugins/app-types/tasks/useTasks.d.ts +0 -5
  226. package/lib/plugins/app-types/type.d.ts +0 -2
  227. package/lib/plugins/app-types/variables/VariablesProvider.d.ts +0 -7
  228. package/lib/plugins/app-types/variables/config.d.ts +0 -3
  229. package/lib/plugins/app-types/variables/index.d.ts +0 -6
  230. package/lib/plugins/app-types/variables/type.d.ts +0 -2
  231. package/lib/plugins/app-types/website/index.d.ts +0 -6
  232. package/lib/plugins/app.d.ts +0 -8
  233. package/lib/plugins/app.js +0 -17
  234. package/lib/solution/BookingTicket/index.d.ts +0 -172
  235. package/lib/solution/BookingTicket/index.js +0 -399
  236. package/lib/solution/BookingTicket/types.d.ts +0 -68
  237. package/lib/solution/BookingTicket/types.js +0 -72
  238. package/lib/solution/BookingTicket/utils/scan/cloudSearch.d.ts +0 -22
  239. package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +0 -117
  240. package/lib/solution/BookingTicket/utils/scan/handleScan.d.ts +0 -16
  241. package/lib/solution/BookingTicket/utils/scan/handleScan.js +0 -125
  242. package/lib/solution/BookingTicket/utils/scan/index.d.ts +0 -81
  243. package/lib/solution/BookingTicket/utils/scan/index.js +0 -210
  244. package/lib/solution/BookingTicket/utils/scan/scanCache.d.ts +0 -78
  245. package/lib/solution/BookingTicket/utils/scan/scanCache.js +0 -231
  246. package/lib/solution/Checkout/appointmentDemo.json +0 -1
  247. package/lib/solution/Checkout/index.d.ts +0 -181
  248. package/lib/solution/Checkout/index.js +0 -864
  249. package/lib/solution/Checkout/types.d.ts +0 -550
  250. package/lib/solution/Checkout/types.js +0 -75
  251. package/lib/solution/Checkout/utils/index.d.ts +0 -73
  252. package/lib/solution/Checkout/utils/index.js +0 -266
  253. package/lib/utils/task.d.ts +0 -40
  254. package/lib/utils/task.js +0 -109
  255. package/lib/utils/watch.d.ts +0 -102
  256. package/lib/utils/watch.js +0 -217
@@ -1,399 +0,0 @@
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
- });
@@ -1,68 +0,0 @@
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
- }
@@ -1,72 +0,0 @@
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
- });
@@ -1,22 +0,0 @@
1
- import { RequestPlugin } from '../../../../plugins';
2
- /**
3
- * 搜索通用识别码
4
- */
5
- export declare const searchWalletPass: (request: RequestPlugin, code: string) => Promise<{
6
- searchType: string;
7
- response: any;
8
- }>;
9
- /**
10
- * 搜索钱包
11
- */
12
- export declare const searchWallet: (request: RequestPlugin, code: string) => Promise<{
13
- searchType: string;
14
- response: any;
15
- }>;
16
- /**
17
- * 搜索商品
18
- */
19
- export declare const searchProduct: (request: RequestPlugin, code: string) => Promise<{
20
- searchType: string;
21
- response: any;
22
- }>;
@@ -1,117 +0,0 @@
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/utils/scan/cloudSearch.ts
20
- var cloudSearch_exports = {};
21
- __export(cloudSearch_exports, {
22
- searchProduct: () => searchProduct,
23
- searchWallet: () => searchWallet,
24
- searchWalletPass: () => searchWalletPass
25
- });
26
- module.exports = __toCommonJS(cloudSearch_exports);
27
- var searchWalletPass = async (request, code) => {
28
- const params = {
29
- code,
30
- translate_flag: 1,
31
- // 翻译识别码名称 0:不翻译 1:翻译
32
- relation_product: 1,
33
- // 组装关联商品: 0不处理 1处理
34
- with: ["customer"],
35
- tags: [
36
- "point_card",
37
- // 积分卡
38
- "gift_card",
39
- // 充值卡
40
- "product_voucher",
41
- // 代金券
42
- "product_discount_card",
43
- // 折扣卡
44
- "good_pass",
45
- // 商品券
46
- "session_ticket",
47
- // 场次票
48
- "appointment_ticket"
49
- // 预约类门票
50
- ]
51
- };
52
- try {
53
- const res = await (request == null ? void 0 : request.get(
54
- "/machinecode/batch-search",
55
- params
56
- ));
57
- if ((res == null ? void 0 : res.code) == 200 && !!(res == null ? void 0 : res.data)) {
58
- return { searchType: "walletPass", response: res };
59
- }
60
- throw new Error("没有找到对应的识别码");
61
- } catch (error) {
62
- throw error;
63
- }
64
- };
65
- var searchWallet = async (request, code) => {
66
- const params = { code, with_customer: 1 };
67
- try {
68
- const res = await (request == null ? void 0 : request.post(
69
- "/wallet/detail/search",
70
- params
71
- ));
72
- if ((res == null ? void 0 : res.code) == 200 && !!(res == null ? void 0 : res.data)) {
73
- return { searchType: "wallet", response: res };
74
- }
75
- throw new Error("没有找到对应的识别码");
76
- } catch (error) {
77
- throw error;
78
- }
79
- };
80
- var searchProduct = async (request, code) => {
81
- var _a, _b;
82
- const params = {
83
- exact_search: code,
84
- open_bundle: 0,
85
- // 套餐子信息
86
- open_quotation: 1,
87
- // 报价单
88
- skip: 1,
89
- num: 20,
90
- status: "published",
91
- with: ["variantGroup"],
92
- with_count: ["bundleGroup", "optionGroup"],
93
- exclude_extension_type: [
94
- "product_party",
95
- "product_event",
96
- "product_series_event",
97
- "product_package_ticket",
98
- "ticket",
99
- "event_item"
100
- ]
101
- };
102
- try {
103
- const res = await (request == null ? void 0 : request.post("/product/query", params));
104
- if ((res == null ? void 0 : res.code) == 200 && ((_b = (_a = res == null ? void 0 : res.data) == null ? void 0 : _a.list) == null ? void 0 : _b.length) > 0) {
105
- return { searchType: "product", response: res };
106
- }
107
- throw new Error("没有找到对应的识别码");
108
- } catch (error) {
109
- throw error;
110
- }
111
- };
112
- // Annotate the CommonJS export names for ESM import in node:
113
- 0 && (module.exports = {
114
- searchProduct,
115
- searchWallet,
116
- searchWalletPass
117
- });
@@ -1,16 +0,0 @@
1
- import { RequestPlugin } from '../../../../plugins';
2
- /**
3
- * 处理全局扫码
4
- * @param request 请求插件
5
- * @returns 处理结果
6
- */
7
- export declare const handleGlobalScan: (request: RequestPlugin, localSearch: (v: string) => any[]) => (scanResult: {
8
- type: string;
9
- value: string;
10
- }) => Promise<any>;
11
- /**
12
- * 处理客户扫码
13
- * @param request 请求插件
14
- * @returns 处理结果
15
- */
16
- export declare const handleCustomerScan: () => () => Promise<{}>;