@pisell/pisellos 0.0.213 → 0.0.215

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 (80) 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/Customer/constants.d.ts +7 -0
  9. package/dist/modules/Customer/constants.js +12 -0
  10. package/dist/modules/Customer/index.d.ts +89 -0
  11. package/dist/modules/Customer/index.js +439 -0
  12. package/dist/modules/Customer/types.d.ts +130 -0
  13. package/dist/modules/Customer/types.js +39 -0
  14. package/dist/modules/ProductList/index.d.ts +6 -1
  15. package/dist/modules/ProductList/index.js +8 -4
  16. package/dist/modules/Rules/index.js +7 -5
  17. package/dist/modules/Rules/types.d.ts +1 -0
  18. package/dist/modules/Schedule/utils.js +7 -1
  19. package/dist/modules/index.d.ts +1 -0
  20. package/dist/modules/index.js +1 -0
  21. package/dist/plugins/window.d.ts +1 -0
  22. package/dist/solution/BookingByStep/index.js +8 -15
  23. package/dist/solution/BookingTicket/index.d.ts +127 -0
  24. package/dist/solution/BookingTicket/index.js +494 -0
  25. package/dist/solution/BookingTicket/types.d.ts +66 -0
  26. package/dist/solution/BookingTicket/types.js +41 -0
  27. package/dist/solution/BookingTicket/utils/scan/cloudSearch.d.ts +22 -0
  28. package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +147 -0
  29. package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts +19 -0
  30. package/dist/solution/BookingTicket/utils/scan/handleScan.js +138 -0
  31. package/dist/solution/BookingTicket/utils/scan/index.d.ts +51 -0
  32. package/dist/solution/BookingTicket/utils/scan/index.js +189 -0
  33. package/dist/solution/ShopDiscount/index.js +4 -2
  34. package/dist/solution/index.d.ts +1 -0
  35. package/dist/solution/index.js +1 -0
  36. package/dist/types/index.d.ts +3 -1
  37. package/dist/utils/task.d.ts +31 -0
  38. package/dist/utils/task.js +150 -0
  39. package/dist/utils/watch.d.ts +102 -0
  40. package/dist/utils/watch.js +294 -0
  41. package/lib/core/index.js +1 -1
  42. package/lib/effects/index.d.ts +4 -3
  43. package/lib/effects/index.js +4 -1
  44. package/lib/modules/AccountList/index.d.ts +7 -1
  45. package/lib/modules/AccountList/index.js +27 -0
  46. package/lib/modules/AccountList/types.d.ts +28 -0
  47. package/lib/modules/Customer/constants.d.ts +7 -0
  48. package/lib/modules/Customer/constants.js +39 -0
  49. package/lib/modules/Customer/index.d.ts +89 -0
  50. package/lib/modules/Customer/index.js +304 -0
  51. package/lib/modules/Customer/types.d.ts +130 -0
  52. package/lib/modules/Customer/types.js +35 -0
  53. package/lib/modules/ProductList/index.d.ts +6 -1
  54. package/lib/modules/ProductList/index.js +12 -3
  55. package/lib/modules/Rules/index.js +4 -3
  56. package/lib/modules/Rules/types.d.ts +1 -0
  57. package/lib/modules/Schedule/utils.js +8 -3
  58. package/lib/modules/index.d.ts +1 -0
  59. package/lib/modules/index.js +2 -0
  60. package/lib/plugins/window.d.ts +1 -0
  61. package/lib/solution/BookingByStep/index.js +0 -7
  62. package/lib/solution/BookingTicket/index.d.ts +127 -0
  63. package/lib/solution/BookingTicket/index.js +291 -0
  64. package/lib/solution/BookingTicket/types.d.ts +66 -0
  65. package/lib/solution/BookingTicket/types.js +70 -0
  66. package/lib/solution/BookingTicket/utils/scan/cloudSearch.d.ts +22 -0
  67. package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +97 -0
  68. package/lib/solution/BookingTicket/utils/scan/handleScan.d.ts +19 -0
  69. package/lib/solution/BookingTicket/utils/scan/handleScan.js +95 -0
  70. package/lib/solution/BookingTicket/utils/scan/index.d.ts +51 -0
  71. package/lib/solution/BookingTicket/utils/scan/index.js +153 -0
  72. package/lib/solution/ShopDiscount/index.js +2 -1
  73. package/lib/solution/index.d.ts +1 -0
  74. package/lib/solution/index.js +2 -0
  75. package/lib/types/index.d.ts +3 -1
  76. package/lib/utils/task.d.ts +31 -0
  77. package/lib/utils/task.js +84 -0
  78. package/lib/utils/watch.d.ts +102 -0
  79. package/lib/utils/watch.js +217 -0
  80. package/package.json +1 -1
@@ -288,6 +288,33 @@ var AccountListModule = class extends import_BaseModule.BaseModule {
288
288
  );
289
289
  return accountModules;
290
290
  }
291
+ /**
292
+ * 获取客户列表
293
+ * @param params 查询参数
294
+ * @returns 客户列表
295
+ */
296
+ async getCustomerList(params = {}) {
297
+ const url = "/customer/es/data";
298
+ const { page = 1, pageSize = 20, keyword, ...otherParams } = params;
299
+ try {
300
+ this.store.isLoading = true;
301
+ this.store.error = null;
302
+ const queryParams = {
303
+ page,
304
+ pageSize,
305
+ ...keyword && { keyword },
306
+ ...otherParams
307
+ };
308
+ const res = await this.request.get(url, queryParams);
309
+ return (res == null ? void 0 : res.data) || [];
310
+ } catch (error) {
311
+ console.error("Failed to fetch customer list:", error);
312
+ this.store.error = error instanceof Error ? error.message : "Failed to fetch customer list";
313
+ throw error;
314
+ } finally {
315
+ this.store.isLoading = false;
316
+ }
317
+ }
291
318
  /**
292
319
  * 获取holder类型账户列表
293
320
  * @param params
@@ -67,3 +67,31 @@ export interface IHolder {
67
67
  main_field: string;
68
68
  customer_cover?: string;
69
69
  }
70
+ /**
71
+ * 获取客户列表参数
72
+ */
73
+ export interface IGetCustomerListParams {
74
+ /** 页码 */
75
+ page?: number;
76
+ /** 每页数量 */
77
+ pageSize?: number;
78
+ /** 搜索关键词 */
79
+ keyword?: string;
80
+ /** 其他筛选参数 */
81
+ [key: string]: any;
82
+ }
83
+ /**
84
+ * 客户数据
85
+ */
86
+ export interface ICustomer {
87
+ /** 客户ID */
88
+ id: string | number;
89
+ /** 客户姓名 */
90
+ name: string;
91
+ /** 客户电话 */
92
+ phone?: string;
93
+ /** 客户邮箱 */
94
+ email?: string;
95
+ /** 其他客户信息 */
96
+ [key: string]: any;
97
+ }
@@ -0,0 +1,7 @@
1
+ export declare const SORT_BY = "id";
2
+ export declare const DEFAULT_PAGE_SIZE = 5;
3
+ export declare const DEFAULT_CUSTOMER: {
4
+ id: number;
5
+ nickname: string;
6
+ name: string;
7
+ };
@@ -0,0 +1,39 @@
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/modules/Customer/constants.ts
20
+ var constants_exports = {};
21
+ __export(constants_exports, {
22
+ DEFAULT_CUSTOMER: () => DEFAULT_CUSTOMER,
23
+ DEFAULT_PAGE_SIZE: () => DEFAULT_PAGE_SIZE,
24
+ SORT_BY: () => SORT_BY
25
+ });
26
+ module.exports = __toCommonJS(constants_exports);
27
+ var SORT_BY = "id";
28
+ var DEFAULT_PAGE_SIZE = 5;
29
+ var DEFAULT_CUSTOMER = {
30
+ "id": 1,
31
+ "nickname": "Select a customer",
32
+ "name": "选择一个客户"
33
+ };
34
+ // Annotate the CommonJS export names for ESM import in node:
35
+ 0 && (module.exports = {
36
+ DEFAULT_CUSTOMER,
37
+ DEFAULT_PAGE_SIZE,
38
+ SORT_BY
39
+ });
@@ -0,0 +1,89 @@
1
+ import { Module, PisellCore, ModuleOptions } from '../../types';
2
+ import { BaseModule } from '../BaseModule';
3
+ import { CustomerState, ShopCustomer, ShopGetCustomerListParams, CustomerModuleAPI, IPaginationInfo, ICustomerListResponse } from './types';
4
+ export declare class CustomerModule extends BaseModule implements Module, CustomerModuleAPI {
5
+ protected defaultName: string;
6
+ protected defaultVersion: string;
7
+ private store;
8
+ private request;
9
+ private cacheId;
10
+ private openCache;
11
+ private fatherModule;
12
+ constructor(name?: string, version?: string);
13
+ initialize(core: PisellCore, options?: ModuleOptions): Promise<void>;
14
+ /**
15
+ * 获取客户列表
16
+ * @param params 查询参数
17
+ * @returns 客户列表响应
18
+ */
19
+ getCustomerList(params?: ShopGetCustomerListParams): Promise<ICustomerListResponse>;
20
+ /**
21
+ * 设置客户列表
22
+ * @param customers 客户列表
23
+ * @param total 总数
24
+ */
25
+ setCustomerList(customers: ShopCustomer[], total?: number): void;
26
+ /**
27
+ * 设置当前选择的客户
28
+ * @param customer 选择的客户
29
+ */
30
+ setSelectedCustomer(customer: ShopCustomer | null): void;
31
+ /**
32
+ * 获取当前选择的客户
33
+ * @returns 当前选择的客户
34
+ */
35
+ getSelectedCustomer(): ShopCustomer | null;
36
+ /**
37
+ * 获取客户列表
38
+ * @returns 客户列表
39
+ */
40
+ getCustomers(): ShopCustomer[];
41
+ /**
42
+ * 根据ID查找客户
43
+ * @param id 客户ID
44
+ * @returns 客户信息
45
+ */
46
+ getCustomerById(id: string | number): ShopCustomer | null;
47
+ /**
48
+ * 清空客户列表
49
+ */
50
+ clearCustomers(): void;
51
+ /**
52
+ * 添加客户到列表第一位
53
+ * @param customer 要添加的客户信息
54
+ */
55
+ addCustomerToFirst(customer: ShopCustomer): void;
56
+ /**
57
+ * 获取当前状态
58
+ * @returns 当前状态
59
+ */
60
+ getState(): CustomerState;
61
+ /**
62
+ * 获取分页信息
63
+ * @returns 分页信息
64
+ */
65
+ getPaginationInfo(): IPaginationInfo;
66
+ /**
67
+ * 触发分页变化事件
68
+ * @param pagination 分页信息
69
+ */
70
+ triggerPaginationChange(pagination: IPaginationInfo): void;
71
+ /**
72
+ * 设置分页信息
73
+ * @param page 页码
74
+ * @param pageSize 每页数量
75
+ */
76
+ setPaginationInfo(page: number, pageSize: number): void;
77
+ /**
78
+ * 便捷方法:切换分页并自动获取数据
79
+ * @param page 页码
80
+ * @param pageSize 每页数量(可选,不传则使用当前pageSize)
81
+ * @returns 客户列表响应
82
+ */
83
+ changeCustomerPage(page: number, pageSize?: number): Promise<ICustomerListResponse>;
84
+ /**
85
+ * 缓存状态变化
86
+ */
87
+ private storeChange;
88
+ }
89
+ export * from './types';
@@ -0,0 +1,304 @@
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 __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/modules/Customer/index.ts
21
+ var Customer_exports = {};
22
+ __export(Customer_exports, {
23
+ CustomerModule: () => CustomerModule
24
+ });
25
+ module.exports = __toCommonJS(Customer_exports);
26
+ var import_lodash_es = require("lodash-es");
27
+ var import_BaseModule = require("../BaseModule");
28
+ var import_types = require("./types");
29
+ var import_constants = require("./constants");
30
+ __reExport(Customer_exports, require("./types"), module.exports);
31
+ var CustomerModule = class extends import_BaseModule.BaseModule {
32
+ constructor(name, version) {
33
+ super(name, version);
34
+ this.defaultName = "customer";
35
+ this.defaultVersion = "1.0.0";
36
+ this.store = {
37
+ customerList: [],
38
+ selectedCustomer: null,
39
+ total: 0,
40
+ currentPage: 1,
41
+ pageSize: import_constants.DEFAULT_PAGE_SIZE,
42
+ loading: false,
43
+ error: null
44
+ };
45
+ this.openCache = false;
46
+ }
47
+ async initialize(core, options) {
48
+ var _a, _b, _c, _d, _e, _f, _g;
49
+ this.core = core;
50
+ this.store = options == null ? void 0 : options.store;
51
+ this.request = this.core.getPlugin("request");
52
+ if (Array.isArray((_a = options == null ? void 0 : options.initialState) == null ? void 0 : _a.customerList)) {
53
+ const customerList = (0, import_lodash_es.cloneDeep)(options.initialState.customerList || []);
54
+ this.store.customerList = customerList;
55
+ } else {
56
+ this.store.customerList = [];
57
+ }
58
+ if ((_b = options == null ? void 0 : options.initialState) == null ? void 0 : _b.selectedCustomer) {
59
+ this.store.selectedCustomer = (0, import_lodash_es.cloneDeep)(options.initialState.selectedCustomer);
60
+ } else {
61
+ this.store.selectedCustomer = null;
62
+ }
63
+ if (typeof ((_c = options == null ? void 0 : options.initialState) == null ? void 0 : _c.total) === "number") {
64
+ this.store.total = options.initialState.total;
65
+ } else {
66
+ this.store.total = 0;
67
+ }
68
+ if (typeof ((_d = options == null ? void 0 : options.initialState) == null ? void 0 : _d.currentPage) === "number") {
69
+ this.store.currentPage = options.initialState.currentPage;
70
+ } else {
71
+ this.store.currentPage = 1;
72
+ }
73
+ if (typeof ((_e = options == null ? void 0 : options.initialState) == null ? void 0 : _e.pageSize) === "number") {
74
+ this.store.pageSize = options.initialState.pageSize;
75
+ } else {
76
+ this.store.pageSize = import_constants.DEFAULT_PAGE_SIZE;
77
+ }
78
+ if ((_f = options == null ? void 0 : options.otherParams) == null ? void 0 : _f.cacheId) {
79
+ this.openCache = options.otherParams.openCache;
80
+ this.cacheId = options.otherParams.cacheId;
81
+ }
82
+ if ((_g = options == null ? void 0 : options.otherParams) == null ? void 0 : _g.fatherModule) {
83
+ this.fatherModule = options.otherParams.fatherModule;
84
+ }
85
+ }
86
+ /**
87
+ * 获取客户列表
88
+ * @param params 查询参数
89
+ * @returns 客户列表响应
90
+ */
91
+ async getCustomerList(params = {}) {
92
+ var _a, _b;
93
+ const url = "/customer/select-list";
94
+ const { skip = 1, num = import_constants.DEFAULT_PAGE_SIZE, search, ...otherParams } = params;
95
+ try {
96
+ this.store.loading = true;
97
+ this.store.error = null;
98
+ const queryParams = {
99
+ skip,
100
+ num,
101
+ sort_by: import_constants.SORT_BY,
102
+ with: ["latestWalletDetail.wallet"],
103
+ search_wallet_pass_flag: 1,
104
+ ...search && { search },
105
+ ...otherParams
106
+ };
107
+ const res = await this.request.get(url, queryParams);
108
+ if ((res == null ? void 0 : res.code) !== 200) {
109
+ throw new Error(res == null ? void 0 : res.message);
110
+ }
111
+ const customerList = ((_a = res == null ? void 0 : res.data) == null ? void 0 : _a.list) || [];
112
+ const total = ((_b = res == null ? void 0 : res.data) == null ? void 0 : _b.count) || 0;
113
+ const page = skip;
114
+ const pageSize = num;
115
+ this.store.currentPage = page;
116
+ this.store.pageSize = pageSize;
117
+ this.store.total = total;
118
+ this.store.customerList = (0, import_lodash_es.cloneDeep)(customerList);
119
+ await this.core.effects.emit(
120
+ import_types.CustomerHooks.OnCustomerListUpdate,
121
+ this.store
122
+ );
123
+ this.triggerPaginationChange({
124
+ page,
125
+ pageSize,
126
+ total,
127
+ totalPages: Math.ceil(total / pageSize)
128
+ });
129
+ const response = {
130
+ list: customerList,
131
+ total,
132
+ page,
133
+ pageSize
134
+ };
135
+ return response;
136
+ } catch (error) {
137
+ console.error("Failed to fetch customer list:", error);
138
+ this.store.error = error instanceof Error ? error.message : "Failed to fetch customer list";
139
+ await this.core.effects.emit(
140
+ import_types.CustomerHooks.OnCustomerListError,
141
+ this.store.error
142
+ );
143
+ throw error;
144
+ } finally {
145
+ this.store.loading = false;
146
+ this.storeChange();
147
+ }
148
+ }
149
+ /**
150
+ * 设置客户列表
151
+ * @param customers 客户列表
152
+ * @param total 总数
153
+ */
154
+ setCustomerList(customers, total) {
155
+ this.store.customerList = (0, import_lodash_es.cloneDeep)(customers);
156
+ if (typeof total === "number") {
157
+ this.store.total = total;
158
+ }
159
+ this.storeChange();
160
+ }
161
+ /**
162
+ * 设置当前选择的客户
163
+ * @param customer 选择的客户
164
+ */
165
+ setSelectedCustomer(customer) {
166
+ this.store.selectedCustomer = !customer ? import_constants.DEFAULT_CUSTOMER : (0, import_lodash_es.cloneDeep)(customer);
167
+ this.core.effects.emit(
168
+ import_types.CustomerHooks.OnCustomerSelected,
169
+ this.store.selectedCustomer
170
+ );
171
+ this.storeChange();
172
+ }
173
+ /**
174
+ * 获取当前选择的客户
175
+ * @returns 当前选择的客户
176
+ */
177
+ getSelectedCustomer() {
178
+ return this.store.selectedCustomer;
179
+ }
180
+ /**
181
+ * 获取客户列表
182
+ * @returns 客户列表
183
+ */
184
+ getCustomers() {
185
+ return [...this.store.customerList];
186
+ }
187
+ /**
188
+ * 根据ID查找客户
189
+ * @param id 客户ID
190
+ * @returns 客户信息
191
+ */
192
+ getCustomerById(id) {
193
+ return this.store.customerList.find((customer) => customer.id === id) || null;
194
+ }
195
+ /**
196
+ * 清空客户列表
197
+ */
198
+ clearCustomers() {
199
+ this.store.customerList = [];
200
+ this.store.selectedCustomer = null;
201
+ this.store.total = 0;
202
+ this.store.currentPage = 1;
203
+ this.store.pageSize = import_constants.DEFAULT_PAGE_SIZE;
204
+ this.core.effects.emit(
205
+ import_types.CustomerHooks.OnCustomerListUpdate,
206
+ this.store
207
+ );
208
+ this.storeChange();
209
+ }
210
+ /**
211
+ * 添加客户到列表第一位
212
+ * @param customer 要添加的客户信息
213
+ */
214
+ addCustomerToFirst(customer) {
215
+ const newCustomer = (0, import_lodash_es.cloneDeep)(customer);
216
+ this.store.customerList = [newCustomer, ...this.store.customerList];
217
+ this.store.total += 1;
218
+ this.core.effects.emit(
219
+ import_types.CustomerHooks.OnCustomerListUpdate,
220
+ this.store
221
+ );
222
+ this.storeChange();
223
+ }
224
+ /**
225
+ * 获取当前状态
226
+ * @returns 当前状态
227
+ */
228
+ getState() {
229
+ return (0, import_lodash_es.cloneDeep)(this.store);
230
+ }
231
+ /**
232
+ * 获取分页信息
233
+ * @returns 分页信息
234
+ */
235
+ getPaginationInfo() {
236
+ return {
237
+ page: this.store.currentPage,
238
+ pageSize: this.store.pageSize,
239
+ total: this.store.total,
240
+ totalPages: Math.ceil(this.store.total / this.store.pageSize)
241
+ };
242
+ }
243
+ /**
244
+ * 触发分页变化事件
245
+ * @param pagination 分页信息
246
+ */
247
+ triggerPaginationChange(pagination) {
248
+ this.core.effects.emit(
249
+ import_types.CustomerHooks.OnPaginationChange,
250
+ pagination
251
+ );
252
+ }
253
+ /**
254
+ * 设置分页信息
255
+ * @param page 页码
256
+ * @param pageSize 每页数量
257
+ */
258
+ setPaginationInfo(page, pageSize) {
259
+ this.store.currentPage = page;
260
+ this.store.pageSize = pageSize;
261
+ this.storeChange();
262
+ this.triggerPaginationChange({
263
+ page,
264
+ pageSize,
265
+ total: this.store.total,
266
+ totalPages: Math.ceil(this.store.total / pageSize)
267
+ });
268
+ }
269
+ /**
270
+ * 便捷方法:切换分页并自动获取数据
271
+ * @param page 页码
272
+ * @param pageSize 每页数量(可选,不传则使用当前pageSize)
273
+ * @returns 客户列表响应
274
+ */
275
+ async changeCustomerPage(page, pageSize) {
276
+ const targetPageSize = pageSize || this.store.pageSize;
277
+ this.setPaginationInfo(page, targetPageSize);
278
+ const skip = page;
279
+ const num = targetPageSize;
280
+ return await this.getCustomerList({
281
+ skip,
282
+ num
283
+ });
284
+ }
285
+ /**
286
+ * 缓存状态变化
287
+ */
288
+ storeChange() {
289
+ if (this.openCache) {
290
+ const store = (0, import_lodash_es.cloneDeep)(this.store);
291
+ this.checkSaveCache({
292
+ cacheId: this.cacheId,
293
+ fatherModule: this.fatherModule,
294
+ store,
295
+ cacheKey: ["customerList", "selectedCustomer", "total", "currentPage", "pageSize"]
296
+ });
297
+ }
298
+ }
299
+ };
300
+ // Annotate the CommonJS export names for ESM import in node:
301
+ 0 && (module.exports = {
302
+ CustomerModule,
303
+ ...require("./types")
304
+ });
@@ -0,0 +1,130 @@
1
+ import { ICustomer } from "../AccountList/types";
2
+ export declare enum CustomerHooks {
3
+ OnCustomerListUpdate = "customer:onUpdate",
4
+ OnCustomerListError = "customer:onError",
5
+ OnCustomerSelected = "customer:onSelected",
6
+ OnPaginationChange = "customer:onPaginationChange"
7
+ }
8
+ /**
9
+ * 客户数据
10
+ */
11
+ export interface ShopCustomer extends ICustomer {
12
+ /** 客户ID */
13
+ id: string | number;
14
+ /** 客户姓名 */
15
+ name: string;
16
+ /** 客户电话 */
17
+ phone?: string;
18
+ /** 客户邮箱 */
19
+ email?: string;
20
+ /** 客户创建时间 */
21
+ created_at?: string;
22
+ /** 客户更新时间 */
23
+ updated_at?: string;
24
+ /** 其他客户信息 */
25
+ [key: string]: any;
26
+ }
27
+ /**
28
+ * 客户列表关联查询参数
29
+ *
30
+ * formRecord: 用户表单记录
31
+ * walletDetails.wallet: 用户所有wallet
32
+ * latestWalletDetail.wallet: 用户最新wallet
33
+ */
34
+ type CustomerWith = 'formRecord' | 'walletDetails.wallet' | 'latestWalletDetail.wallet';
35
+ /**
36
+ * 获取客户列表参数
37
+ */
38
+ export interface ShopGetCustomerListParams {
39
+ /** 页码 */
40
+ skip?: number;
41
+ /** 每页数量 */
42
+ num?: number;
43
+ /** 搜索关键词 */
44
+ search?: string;
45
+ /** 关联查询参数 */
46
+ with?: CustomerWith[];
47
+ /** wallet搜索标识 */
48
+ search_wallet_flag?: 0 | 1;
49
+ /** wallet pass搜索标识 */
50
+ search_wallet_pass_flag?: 0 | 1;
51
+ /** 其他筛选参数 */
52
+ [key: string]: any;
53
+ }
54
+ /**
55
+ * 分页信息
56
+ */
57
+ export interface IPaginationInfo {
58
+ /** 当前页码 */
59
+ page: number;
60
+ /** 每页数量 */
61
+ pageSize: number;
62
+ /** 总数 */
63
+ total: number;
64
+ /** 总页数 */
65
+ totalPages: number;
66
+ }
67
+ /**
68
+ * 客户列表响应
69
+ */
70
+ export interface ICustomerListResponse {
71
+ /** 客户列表 */
72
+ list: ShopCustomer[];
73
+ /** 总数 */
74
+ total: number;
75
+ /** 当前页 */
76
+ page?: number;
77
+ /** 每页数量 */
78
+ pageSize?: number;
79
+ }
80
+ /**
81
+ * 客户列表状态
82
+ */
83
+ export interface CustomerState {
84
+ /** 客户列表 */
85
+ customerList: ShopCustomer[];
86
+ /** 当前选择的客户 */
87
+ selectedCustomer: ShopCustomer | null;
88
+ /** 列表总数 */
89
+ total: number;
90
+ /** 当前页码 */
91
+ currentPage: number;
92
+ /** 每页数量 */
93
+ pageSize: number;
94
+ /** 加载状态 */
95
+ loading: boolean;
96
+ /** 错误信息 */
97
+ error: string | null;
98
+ }
99
+ /**
100
+ * 客户模块 API
101
+ */
102
+ export interface CustomerModuleAPI {
103
+ /** 获取客户列表 */
104
+ getCustomerList: (params?: ShopGetCustomerListParams) => Promise<ICustomerListResponse>;
105
+ /** 设置客户列表 */
106
+ setCustomerList: (customers: ShopCustomer[], total?: number) => void;
107
+ /** 设置当前选择的客户 */
108
+ setSelectedCustomer: (customer: ShopCustomer | null) => void;
109
+ /** 获取当前选择的客户 */
110
+ getSelectedCustomer: () => ShopCustomer | null;
111
+ /** 获取客户列表 */
112
+ getCustomers: () => ShopCustomer[];
113
+ /** 根据ID查找客户 */
114
+ getCustomerById: (id: string | number) => ShopCustomer | null;
115
+ /** 清空客户列表 */
116
+ clearCustomers: () => void;
117
+ /** 添加客户到列表第一位 */
118
+ addCustomerToFirst: (customer: ShopCustomer) => void;
119
+ /** 获取当前状态 */
120
+ getState: () => CustomerState;
121
+ /** 获取分页信息 */
122
+ getPaginationInfo: () => IPaginationInfo;
123
+ /** 触发分页变化事件 */
124
+ triggerPaginationChange: (pagination: IPaginationInfo) => void;
125
+ /** 设置分页信息 */
126
+ setPaginationInfo: (page: number, pageSize: number) => void;
127
+ /** 便捷方法:切换分页并自动获取数据 */
128
+ changeCustomerPage: (page: number, pageSize?: number) => Promise<ICustomerListResponse>;
129
+ }
130
+ export {};
@@ -0,0 +1,35 @@
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/modules/Customer/types.ts
20
+ var types_exports = {};
21
+ __export(types_exports, {
22
+ CustomerHooks: () => CustomerHooks
23
+ });
24
+ module.exports = __toCommonJS(types_exports);
25
+ var CustomerHooks = /* @__PURE__ */ ((CustomerHooks2) => {
26
+ CustomerHooks2["OnCustomerListUpdate"] = "customer:onUpdate";
27
+ CustomerHooks2["OnCustomerListError"] = "customer:onError";
28
+ CustomerHooks2["OnCustomerSelected"] = "customer:onSelected";
29
+ CustomerHooks2["OnPaginationChange"] = "customer:onPaginationChange";
30
+ return CustomerHooks2;
31
+ })(CustomerHooks || {});
32
+ // Annotate the CommonJS export names for ESM import in node:
33
+ 0 && (module.exports = {
34
+ CustomerHooks
35
+ });
@@ -11,12 +11,17 @@ export declare class ProductList extends BaseModule implements Module {
11
11
  constructor(name?: string, version?: string);
12
12
  initialize(core: PisellCore, options: any): Promise<void>;
13
13
  storeChange(path?: string, value?: any): Promise<void>;
14
- loadProducts({ category_ids, product_ids, collection, schedule_date, cacheId }: {
14
+ loadProducts({ category_ids, product_ids, collection, menu_list_ids, customer_id: paramsCustomerId, with_count, schedule_datetime, schedule_date, cacheId, with_schedule, }: {
15
15
  category_ids?: number[];
16
16
  product_ids?: number[];
17
17
  collection?: number | string[];
18
18
  schedule_date?: string;
19
19
  cacheId?: string;
20
+ customer_id?: number;
21
+ menu_list_ids?: number[];
22
+ schedule_datetime?: string;
23
+ with_count?: string[];
24
+ with_schedule?: number;
20
25
  }): Promise<any>;
21
26
  loadProductsPrice({ ids, customer_id, schedule_date, channel, }: {
22
27
  ids?: number[];