@pisell/pisellos 0.0.216 → 0.0.217
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.
- package/dist/modules/Customer/index.d.ts +33 -0
- package/dist/modules/Customer/index.js +315 -58
- package/dist/modules/Customer/types.d.ts +17 -1
- package/dist/modules/Customer/types.js +2 -0
- package/dist/solution/BookingTicket/index.d.ts +26 -0
- package/dist/solution/BookingTicket/index.js +120 -14
- package/dist/solution/BookingTicket/types.d.ts +3 -1
- package/dist/solution/BookingTicket/types.js +2 -0
- package/lib/modules/Customer/index.d.ts +33 -0
- package/lib/modules/Customer/index.js +168 -33
- package/lib/modules/Customer/types.d.ts +17 -1
- package/lib/modules/Customer/types.js +2 -0
- package/lib/solution/BookingTicket/index.d.ts +26 -0
- package/lib/solution/BookingTicket/index.js +50 -0
- package/lib/solution/BookingTicket/types.d.ts +3 -1
- package/lib/solution/BookingTicket/types.js +2 -0
- package/package.json +1 -1
|
@@ -11,6 +11,18 @@ export declare class CustomerModule extends BaseModule implements Module, Custom
|
|
|
11
11
|
private fatherModule;
|
|
12
12
|
constructor(name?: string, version?: string);
|
|
13
13
|
initialize(core: PisellCore, options?: ModuleOptions): Promise<void>;
|
|
14
|
+
/**
|
|
15
|
+
* 获取客户列表数据(内部方法)
|
|
16
|
+
* @param params 查询参数
|
|
17
|
+
* @returns API响应数据
|
|
18
|
+
*/
|
|
19
|
+
private fetchCustomerListData;
|
|
20
|
+
/**
|
|
21
|
+
* 处理客户列表操作的错误(内部方法)
|
|
22
|
+
* @param error 错误对象
|
|
23
|
+
* @param operation 操作名称
|
|
24
|
+
*/
|
|
25
|
+
private handleCustomerListError;
|
|
14
26
|
/**
|
|
15
27
|
* 获取客户列表
|
|
16
28
|
* @param params 查询参数
|
|
@@ -81,6 +93,27 @@ export declare class CustomerModule extends BaseModule implements Module, Custom
|
|
|
81
93
|
* @returns 客户列表响应
|
|
82
94
|
*/
|
|
83
95
|
changeCustomerPage(page: number, pageSize?: number): Promise<ICustomerListResponse>;
|
|
96
|
+
/**
|
|
97
|
+
* 滚动加载更多客户数据 - 数据会追加到现有列表中
|
|
98
|
+
* @returns 客户列表响应
|
|
99
|
+
*/
|
|
100
|
+
loadMoreCustomers(): Promise<ICustomerListResponse>;
|
|
101
|
+
/**
|
|
102
|
+
* 重置并重新开始滚动加载
|
|
103
|
+
* @param params 查询参数
|
|
104
|
+
* @returns 客户列表响应
|
|
105
|
+
*/
|
|
106
|
+
resetAndLoadCustomers(params?: ShopGetCustomerListParams): Promise<ICustomerListResponse>;
|
|
107
|
+
/**
|
|
108
|
+
* 检查是否还有更多数据可以加载
|
|
109
|
+
* @returns 是否还有更多数据
|
|
110
|
+
*/
|
|
111
|
+
hasMoreCustomers(): boolean;
|
|
112
|
+
/**
|
|
113
|
+
* 获取当前的搜索条件
|
|
114
|
+
* @returns 当前搜索条件
|
|
115
|
+
*/
|
|
116
|
+
getCurrentSearchParams(): Omit<ShopGetCustomerListParams, 'skip' | 'num'>;
|
|
84
117
|
/**
|
|
85
118
|
* 缓存状态变化
|
|
86
119
|
*/
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
var _excluded = ["skip", "num", "search"]
|
|
1
|
+
var _excluded = ["skip", "num", "search"],
|
|
2
|
+
_excluded2 = ["skip", "num"];
|
|
2
3
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
3
4
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
4
5
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
@@ -46,7 +47,10 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
46
47
|
currentPage: 1,
|
|
47
48
|
pageSize: DEFAULT_PAGE_SIZE,
|
|
48
49
|
loading: false,
|
|
49
|
-
error: null
|
|
50
|
+
error: null,
|
|
51
|
+
hasMore: true,
|
|
52
|
+
loadingMore: false,
|
|
53
|
+
searchParams: {}
|
|
50
54
|
});
|
|
51
55
|
_defineProperty(_assertThisInitialized(_this), "request", void 0);
|
|
52
56
|
_defineProperty(_assertThisInitialized(_this), "cacheId", void 0);
|
|
@@ -58,7 +62,7 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
58
62
|
key: "initialize",
|
|
59
63
|
value: function () {
|
|
60
64
|
var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(core, options) {
|
|
61
|
-
var _options$initialState, _options$initialState2, _options$initialState3, _options$initialState4, _options$initialState5, _options$otherParams, _options$otherParams2;
|
|
65
|
+
var _options$initialState, _options$initialState2, _options$initialState3, _options$initialState4, _options$initialState5, _options$initialState6, _options$initialState7, _options$initialState8, _options$initialState9, _options$initialState10, _options$initialState11, _options$otherParams, _options$otherParams2;
|
|
62
66
|
var customerList;
|
|
63
67
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
64
68
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -95,6 +99,11 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
95
99
|
this.store.pageSize = DEFAULT_PAGE_SIZE;
|
|
96
100
|
}
|
|
97
101
|
|
|
102
|
+
// 初始化滚动加载相关状态
|
|
103
|
+
this.store.hasMore = (_options$initialState6 = options === null || options === void 0 || (_options$initialState7 = options.initialState) === null || _options$initialState7 === void 0 ? void 0 : _options$initialState7.hasMore) !== null && _options$initialState6 !== void 0 ? _options$initialState6 : true;
|
|
104
|
+
this.store.loadingMore = (_options$initialState8 = options === null || options === void 0 || (_options$initialState9 = options.initialState) === null || _options$initialState9 === void 0 ? void 0 : _options$initialState9.loadingMore) !== null && _options$initialState8 !== void 0 ? _options$initialState8 : false;
|
|
105
|
+
this.store.searchParams = (_options$initialState10 = options === null || options === void 0 || (_options$initialState11 = options.initialState) === null || _options$initialState11 === void 0 ? void 0 : _options$initialState11.searchParams) !== null && _options$initialState10 !== void 0 ? _options$initialState10 : {};
|
|
106
|
+
|
|
98
107
|
// 缓存配置
|
|
99
108
|
if (options !== null && options !== void 0 && (_options$otherParams = options.otherParams) !== null && _options$otherParams !== void 0 && _options$otherParams.cacheId) {
|
|
100
109
|
this.openCache = options.otherParams.openCache;
|
|
@@ -103,7 +112,7 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
103
112
|
if (options !== null && options !== void 0 && (_options$otherParams2 = options.otherParams) !== null && _options$otherParams2 !== void 0 && _options$otherParams2.fatherModule) {
|
|
104
113
|
this.fatherModule = options.otherParams.fatherModule;
|
|
105
114
|
}
|
|
106
|
-
case
|
|
115
|
+
case 13:
|
|
107
116
|
case "end":
|
|
108
117
|
return _context.stop();
|
|
109
118
|
}
|
|
@@ -115,14 +124,15 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
115
124
|
return initialize;
|
|
116
125
|
}()
|
|
117
126
|
/**
|
|
118
|
-
*
|
|
127
|
+
* 获取客户列表数据(内部方法)
|
|
119
128
|
* @param params 查询参数
|
|
120
|
-
* @returns
|
|
129
|
+
* @returns API响应数据
|
|
121
130
|
*/
|
|
122
131
|
}, {
|
|
123
|
-
key: "
|
|
132
|
+
key: "fetchCustomerListData",
|
|
124
133
|
value: (function () {
|
|
125
|
-
var
|
|
134
|
+
var _fetchCustomerListData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
135
|
+
var _res$data, _res$data2;
|
|
126
136
|
var params,
|
|
127
137
|
url,
|
|
128
138
|
_params$skip,
|
|
@@ -131,15 +141,8 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
131
141
|
num,
|
|
132
142
|
search,
|
|
133
143
|
otherParams,
|
|
134
|
-
_res$data,
|
|
135
|
-
_res$data2,
|
|
136
144
|
queryParams,
|
|
137
145
|
res,
|
|
138
|
-
customerList,
|
|
139
|
-
total,
|
|
140
|
-
page,
|
|
141
|
-
pageSize,
|
|
142
|
-
response,
|
|
143
146
|
_args2 = arguments;
|
|
144
147
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
145
148
|
while (1) switch (_context2.prev = _context2.next) {
|
|
@@ -147,9 +150,6 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
147
150
|
params = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : {};
|
|
148
151
|
url = '/customer/select-list';
|
|
149
152
|
_params$skip = params.skip, skip = _params$skip === void 0 ? 1 : _params$skip, _params$num = params.num, num = _params$num === void 0 ? DEFAULT_PAGE_SIZE : _params$num, search = params.search, otherParams = _objectWithoutProperties(params, _excluded);
|
|
150
|
-
_context2.prev = 3;
|
|
151
|
-
this.store.loading = true;
|
|
152
|
-
this.store.error = null;
|
|
153
153
|
queryParams = _objectSpread(_objectSpread({
|
|
154
154
|
skip: skip,
|
|
155
155
|
num: num,
|
|
@@ -160,29 +160,114 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
160
160
|
}, search && {
|
|
161
161
|
search: search
|
|
162
162
|
}), otherParams);
|
|
163
|
-
_context2.next =
|
|
163
|
+
_context2.next = 6;
|
|
164
164
|
return this.request.get(url, queryParams);
|
|
165
|
-
case
|
|
165
|
+
case 6:
|
|
166
166
|
res = _context2.sent;
|
|
167
167
|
if (!((res === null || res === void 0 ? void 0 : res.code) !== 200)) {
|
|
168
|
-
_context2.next =
|
|
168
|
+
_context2.next = 9;
|
|
169
169
|
break;
|
|
170
170
|
}
|
|
171
171
|
throw new Error(res === null || res === void 0 ? void 0 : res.message);
|
|
172
|
-
case
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
172
|
+
case 9:
|
|
173
|
+
return _context2.abrupt("return", {
|
|
174
|
+
customerList: (res === null || res === void 0 || (_res$data = res.data) === null || _res$data === void 0 ? void 0 : _res$data.list) || [],
|
|
175
|
+
total: (res === null || res === void 0 || (_res$data2 = res.data) === null || _res$data2 === void 0 ? void 0 : _res$data2.count) || 0,
|
|
176
|
+
page: skip,
|
|
177
|
+
pageSize: num
|
|
178
|
+
});
|
|
179
|
+
case 10:
|
|
180
|
+
case "end":
|
|
181
|
+
return _context2.stop();
|
|
182
|
+
}
|
|
183
|
+
}, _callee2, this);
|
|
184
|
+
}));
|
|
185
|
+
function fetchCustomerListData() {
|
|
186
|
+
return _fetchCustomerListData.apply(this, arguments);
|
|
187
|
+
}
|
|
188
|
+
return fetchCustomerListData;
|
|
189
|
+
}()
|
|
190
|
+
/**
|
|
191
|
+
* 处理客户列表操作的错误(内部方法)
|
|
192
|
+
* @param error 错误对象
|
|
193
|
+
* @param operation 操作名称
|
|
194
|
+
*/
|
|
195
|
+
)
|
|
196
|
+
}, {
|
|
197
|
+
key: "handleCustomerListError",
|
|
198
|
+
value: (function () {
|
|
199
|
+
var _handleCustomerListError = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(error, operation) {
|
|
200
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
201
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
202
|
+
case 0:
|
|
203
|
+
console.error("Failed to ".concat(operation, ":"), error);
|
|
204
|
+
this.store.error = error instanceof Error ? error.message : "Failed to ".concat(operation);
|
|
205
|
+
_context3.next = 4;
|
|
206
|
+
return this.core.effects.emit(CustomerHooks.OnCustomerListError, this.store.error);
|
|
207
|
+
case 4:
|
|
208
|
+
case "end":
|
|
209
|
+
return _context3.stop();
|
|
210
|
+
}
|
|
211
|
+
}, _callee3, this);
|
|
212
|
+
}));
|
|
213
|
+
function handleCustomerListError(_x3, _x4) {
|
|
214
|
+
return _handleCustomerListError.apply(this, arguments);
|
|
215
|
+
}
|
|
216
|
+
return handleCustomerListError;
|
|
217
|
+
}()
|
|
218
|
+
/**
|
|
219
|
+
* 获取客户列表
|
|
220
|
+
* @param params 查询参数
|
|
221
|
+
* @returns 客户列表响应
|
|
222
|
+
*/
|
|
223
|
+
)
|
|
224
|
+
}, {
|
|
225
|
+
key: "getCustomerList",
|
|
226
|
+
value: (function () {
|
|
227
|
+
var _getCustomerList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
228
|
+
var params,
|
|
229
|
+
_yield$this$fetchCust,
|
|
230
|
+
customerList,
|
|
231
|
+
total,
|
|
232
|
+
page,
|
|
233
|
+
pageSize,
|
|
234
|
+
skip,
|
|
235
|
+
num,
|
|
236
|
+
searchParams,
|
|
237
|
+
response,
|
|
238
|
+
_args4 = arguments;
|
|
239
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
240
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
241
|
+
case 0:
|
|
242
|
+
params = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : {};
|
|
243
|
+
_context4.prev = 1;
|
|
244
|
+
this.store.loading = true;
|
|
245
|
+
this.store.error = null;
|
|
246
|
+
_context4.next = 6;
|
|
247
|
+
return this.fetchCustomerListData(params);
|
|
248
|
+
case 6:
|
|
249
|
+
_yield$this$fetchCust = _context4.sent;
|
|
250
|
+
customerList = _yield$this$fetchCust.customerList;
|
|
251
|
+
total = _yield$this$fetchCust.total;
|
|
252
|
+
page = _yield$this$fetchCust.page;
|
|
253
|
+
pageSize = _yield$this$fetchCust.pageSize;
|
|
254
|
+
// 保存搜索条件(排除skip和num)
|
|
255
|
+
skip = params.skip, num = params.num, searchParams = _objectWithoutProperties(params, _excluded2);
|
|
256
|
+
this.store.searchParams = cloneDeep(searchParams);
|
|
257
|
+
|
|
258
|
+
// 更新分页状态
|
|
177
259
|
this.store.currentPage = page;
|
|
178
260
|
this.store.pageSize = pageSize;
|
|
179
261
|
this.store.total = total;
|
|
180
262
|
|
|
181
|
-
//
|
|
263
|
+
// 计算是否还有更多数据
|
|
264
|
+
this.store.hasMore = page * pageSize < total;
|
|
265
|
+
|
|
266
|
+
// 设置客户列表(替换模式)
|
|
182
267
|
this.store.customerList = cloneDeep(customerList);
|
|
183
|
-
|
|
268
|
+
_context4.next = 20;
|
|
184
269
|
return this.core.effects.emit(CustomerHooks.OnCustomerListUpdate, this.store);
|
|
185
|
-
case
|
|
270
|
+
case 20:
|
|
186
271
|
// 触发分页变化事件
|
|
187
272
|
this.triggerPaginationChange({
|
|
188
273
|
page: page,
|
|
@@ -196,26 +281,24 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
196
281
|
page: page,
|
|
197
282
|
pageSize: pageSize
|
|
198
283
|
};
|
|
199
|
-
return
|
|
200
|
-
case
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
this.
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
case
|
|
208
|
-
|
|
209
|
-
case 34:
|
|
210
|
-
_context2.prev = 34;
|
|
284
|
+
return _context4.abrupt("return", response);
|
|
285
|
+
case 25:
|
|
286
|
+
_context4.prev = 25;
|
|
287
|
+
_context4.t0 = _context4["catch"](1);
|
|
288
|
+
_context4.next = 29;
|
|
289
|
+
return this.handleCustomerListError(_context4.t0, 'fetch customer list');
|
|
290
|
+
case 29:
|
|
291
|
+
throw _context4.t0;
|
|
292
|
+
case 30:
|
|
293
|
+
_context4.prev = 30;
|
|
211
294
|
this.store.loading = false;
|
|
212
295
|
this.storeChange();
|
|
213
|
-
return
|
|
214
|
-
case
|
|
296
|
+
return _context4.finish(30);
|
|
297
|
+
case 34:
|
|
215
298
|
case "end":
|
|
216
|
-
return
|
|
299
|
+
return _context4.stop();
|
|
217
300
|
}
|
|
218
|
-
},
|
|
301
|
+
}, _callee4, this, [[1, 25, 30, 34]]);
|
|
219
302
|
}));
|
|
220
303
|
function getCustomerList() {
|
|
221
304
|
return _getCustomerList.apply(this, arguments);
|
|
@@ -294,6 +377,9 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
294
377
|
this.store.total = 0;
|
|
295
378
|
this.store.currentPage = 1;
|
|
296
379
|
this.store.pageSize = DEFAULT_PAGE_SIZE;
|
|
380
|
+
this.store.hasMore = true;
|
|
381
|
+
this.store.loadingMore = false;
|
|
382
|
+
this.store.searchParams = {};
|
|
297
383
|
this.core.effects.emit(CustomerHooks.OnCustomerListUpdate, this.store);
|
|
298
384
|
this.storeChange();
|
|
299
385
|
}
|
|
@@ -386,39 +472,210 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
386
472
|
}, {
|
|
387
473
|
key: "changeCustomerPage",
|
|
388
474
|
value: (function () {
|
|
389
|
-
var _changeCustomerPage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
475
|
+
var _changeCustomerPage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(page, pageSize) {
|
|
390
476
|
var targetPageSize, skip, num;
|
|
391
|
-
return _regeneratorRuntime().wrap(function
|
|
392
|
-
while (1) switch (
|
|
477
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
478
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
393
479
|
case 0:
|
|
394
480
|
targetPageSize = pageSize || this.store.pageSize; // 先更新分页状态
|
|
395
481
|
this.setPaginationInfo(page, targetPageSize);
|
|
396
482
|
|
|
397
483
|
// skip直接使用page,num使用pageSize
|
|
398
484
|
skip = page;
|
|
399
|
-
num = targetPageSize; //
|
|
400
|
-
|
|
401
|
-
return this.getCustomerList({
|
|
485
|
+
num = targetPageSize; // 自动调用获取客户列表,使用存储的搜索条件
|
|
486
|
+
_context5.next = 6;
|
|
487
|
+
return this.getCustomerList(_objectSpread({
|
|
402
488
|
skip: skip,
|
|
403
489
|
num: num
|
|
404
|
-
});
|
|
490
|
+
}, this.store.searchParams));
|
|
405
491
|
case 6:
|
|
406
|
-
return
|
|
492
|
+
return _context5.abrupt("return", _context5.sent);
|
|
407
493
|
case 7:
|
|
408
494
|
case "end":
|
|
409
|
-
return
|
|
495
|
+
return _context5.stop();
|
|
410
496
|
}
|
|
411
|
-
},
|
|
497
|
+
}, _callee5, this);
|
|
412
498
|
}));
|
|
413
|
-
function changeCustomerPage(
|
|
499
|
+
function changeCustomerPage(_x5, _x6) {
|
|
414
500
|
return _changeCustomerPage.apply(this, arguments);
|
|
415
501
|
}
|
|
416
502
|
return changeCustomerPage;
|
|
417
503
|
}()
|
|
418
504
|
/**
|
|
419
|
-
*
|
|
505
|
+
* 滚动加载更多客户数据 - 数据会追加到现有列表中
|
|
506
|
+
* @returns 客户列表响应
|
|
507
|
+
*/
|
|
508
|
+
)
|
|
509
|
+
}, {
|
|
510
|
+
key: "loadMoreCustomers",
|
|
511
|
+
value: (function () {
|
|
512
|
+
var _loadMoreCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
513
|
+
var nextPage, _yield$this$fetchCust2, newCustomers, total, page, pageSize, updatedCustomerList, response;
|
|
514
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
515
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
516
|
+
case 0:
|
|
517
|
+
if (!(!this.store.hasMore || this.store.loadingMore)) {
|
|
518
|
+
_context6.next = 2;
|
|
519
|
+
break;
|
|
520
|
+
}
|
|
521
|
+
return _context6.abrupt("return", {
|
|
522
|
+
list: [],
|
|
523
|
+
total: this.store.total,
|
|
524
|
+
page: this.store.currentPage,
|
|
525
|
+
pageSize: this.store.pageSize
|
|
526
|
+
});
|
|
527
|
+
case 2:
|
|
528
|
+
// 计算下一页
|
|
529
|
+
nextPage = this.store.currentPage + 1;
|
|
530
|
+
_context6.prev = 3;
|
|
531
|
+
this.store.loadingMore = true;
|
|
532
|
+
this.store.error = null;
|
|
533
|
+
|
|
534
|
+
// 使用公共方法获取数据,传入存储的搜索条件
|
|
535
|
+
_context6.next = 8;
|
|
536
|
+
return this.fetchCustomerListData(_objectSpread({
|
|
537
|
+
skip: nextPage,
|
|
538
|
+
num: this.store.pageSize
|
|
539
|
+
}, this.store.searchParams));
|
|
540
|
+
case 8:
|
|
541
|
+
_yield$this$fetchCust2 = _context6.sent;
|
|
542
|
+
newCustomers = _yield$this$fetchCust2.customerList;
|
|
543
|
+
total = _yield$this$fetchCust2.total;
|
|
544
|
+
page = _yield$this$fetchCust2.page;
|
|
545
|
+
pageSize = _yield$this$fetchCust2.pageSize;
|
|
546
|
+
// 将新数据追加到现有列表(追加模式)
|
|
547
|
+
updatedCustomerList = [].concat(_toConsumableArray(this.store.customerList), _toConsumableArray(cloneDeep(newCustomers))); // 更新状态
|
|
548
|
+
this.store.customerList = updatedCustomerList;
|
|
549
|
+
this.store.currentPage = page;
|
|
550
|
+
this.store.total = total;
|
|
551
|
+
this.store.hasMore = page * pageSize < total;
|
|
552
|
+
|
|
553
|
+
// 触发滚动加载特定事件
|
|
554
|
+
_context6.next = 20;
|
|
555
|
+
return this.core.effects.emit(CustomerHooks.OnScrollLoadMore, {
|
|
556
|
+
newCustomers: newCustomers,
|
|
557
|
+
allCustomers: this.store.customerList,
|
|
558
|
+
currentPage: page,
|
|
559
|
+
hasMore: this.store.hasMore
|
|
560
|
+
});
|
|
561
|
+
case 20:
|
|
562
|
+
_context6.next = 22;
|
|
563
|
+
return this.core.effects.emit(CustomerHooks.OnCustomerListUpdate, this.store);
|
|
564
|
+
case 22:
|
|
565
|
+
// 触发分页变化事件
|
|
566
|
+
this.triggerPaginationChange({
|
|
567
|
+
page: page,
|
|
568
|
+
pageSize: pageSize,
|
|
569
|
+
total: total,
|
|
570
|
+
totalPages: Math.ceil(total / pageSize)
|
|
571
|
+
});
|
|
572
|
+
response = {
|
|
573
|
+
list: newCustomers,
|
|
574
|
+
// 返回新加载的数据
|
|
575
|
+
total: total,
|
|
576
|
+
page: page,
|
|
577
|
+
pageSize: pageSize
|
|
578
|
+
};
|
|
579
|
+
return _context6.abrupt("return", response);
|
|
580
|
+
case 27:
|
|
581
|
+
_context6.prev = 27;
|
|
582
|
+
_context6.t0 = _context6["catch"](3);
|
|
583
|
+
_context6.next = 31;
|
|
584
|
+
return this.handleCustomerListError(_context6.t0, 'load more customers');
|
|
585
|
+
case 31:
|
|
586
|
+
throw _context6.t0;
|
|
587
|
+
case 32:
|
|
588
|
+
_context6.prev = 32;
|
|
589
|
+
this.store.loadingMore = false;
|
|
590
|
+
this.storeChange();
|
|
591
|
+
return _context6.finish(32);
|
|
592
|
+
case 36:
|
|
593
|
+
case "end":
|
|
594
|
+
return _context6.stop();
|
|
595
|
+
}
|
|
596
|
+
}, _callee6, this, [[3, 27, 32, 36]]);
|
|
597
|
+
}));
|
|
598
|
+
function loadMoreCustomers() {
|
|
599
|
+
return _loadMoreCustomers.apply(this, arguments);
|
|
600
|
+
}
|
|
601
|
+
return loadMoreCustomers;
|
|
602
|
+
}()
|
|
603
|
+
/**
|
|
604
|
+
* 重置并重新开始滚动加载
|
|
605
|
+
* @param params 查询参数
|
|
606
|
+
* @returns 客户列表响应
|
|
420
607
|
*/
|
|
421
608
|
)
|
|
609
|
+
}, {
|
|
610
|
+
key: "resetAndLoadCustomers",
|
|
611
|
+
value: (function () {
|
|
612
|
+
var _resetAndLoadCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
|
613
|
+
var params,
|
|
614
|
+
resetParams,
|
|
615
|
+
response,
|
|
616
|
+
_args7 = arguments;
|
|
617
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
618
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
619
|
+
case 0:
|
|
620
|
+
params = _args7.length > 0 && _args7[0] !== undefined ? _args7[0] : {};
|
|
621
|
+
// 重置状态
|
|
622
|
+
this.store.customerList = [];
|
|
623
|
+
this.store.currentPage = 1;
|
|
624
|
+
this.store.hasMore = true;
|
|
625
|
+
this.store.loadingMore = false;
|
|
626
|
+
|
|
627
|
+
// 使用第一页参数
|
|
628
|
+
resetParams = _objectSpread(_objectSpread({}, params), {}, {
|
|
629
|
+
skip: 1,
|
|
630
|
+
num: params.num || this.store.pageSize
|
|
631
|
+
}); // 调用普通的获取列表方法
|
|
632
|
+
_context7.next = 8;
|
|
633
|
+
return this.getCustomerList(resetParams);
|
|
634
|
+
case 8:
|
|
635
|
+
response = _context7.sent;
|
|
636
|
+
_context7.next = 11;
|
|
637
|
+
return this.core.effects.emit(CustomerHooks.OnScrollLoadComplete, {
|
|
638
|
+
customers: this.store.customerList,
|
|
639
|
+
total: this.store.total,
|
|
640
|
+
hasMore: this.store.hasMore
|
|
641
|
+
});
|
|
642
|
+
case 11:
|
|
643
|
+
return _context7.abrupt("return", response);
|
|
644
|
+
case 12:
|
|
645
|
+
case "end":
|
|
646
|
+
return _context7.stop();
|
|
647
|
+
}
|
|
648
|
+
}, _callee7, this);
|
|
649
|
+
}));
|
|
650
|
+
function resetAndLoadCustomers() {
|
|
651
|
+
return _resetAndLoadCustomers.apply(this, arguments);
|
|
652
|
+
}
|
|
653
|
+
return resetAndLoadCustomers;
|
|
654
|
+
}()
|
|
655
|
+
/**
|
|
656
|
+
* 检查是否还有更多数据可以加载
|
|
657
|
+
* @returns 是否还有更多数据
|
|
658
|
+
*/
|
|
659
|
+
)
|
|
660
|
+
}, {
|
|
661
|
+
key: "hasMoreCustomers",
|
|
662
|
+
value: function hasMoreCustomers() {
|
|
663
|
+
return this.store.hasMore && !this.store.loadingMore;
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
/**
|
|
667
|
+
* 获取当前的搜索条件
|
|
668
|
+
* @returns 当前搜索条件
|
|
669
|
+
*/
|
|
670
|
+
}, {
|
|
671
|
+
key: "getCurrentSearchParams",
|
|
672
|
+
value: function getCurrentSearchParams() {
|
|
673
|
+
return cloneDeep(this.store.searchParams);
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
/**
|
|
677
|
+
* 缓存状态变化
|
|
678
|
+
*/
|
|
422
679
|
}, {
|
|
423
680
|
key: "storeChange",
|
|
424
681
|
value: function storeChange() {
|
|
@@ -428,7 +685,7 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
428
685
|
cacheId: this.cacheId,
|
|
429
686
|
fatherModule: this.fatherModule,
|
|
430
687
|
store: store,
|
|
431
|
-
cacheKey: ['customerList', 'selectedCustomer', 'total', 'currentPage', 'pageSize']
|
|
688
|
+
cacheKey: ['customerList', 'selectedCustomer', 'total', 'currentPage', 'pageSize', 'hasMore', 'loadingMore', 'searchParams']
|
|
432
689
|
});
|
|
433
690
|
}
|
|
434
691
|
}
|
|
@@ -3,7 +3,9 @@ export declare enum CustomerHooks {
|
|
|
3
3
|
OnCustomerListUpdate = "customer:onUpdate",
|
|
4
4
|
OnCustomerListError = "customer:onError",
|
|
5
5
|
OnCustomerSelected = "customer:onSelected",
|
|
6
|
-
OnPaginationChange = "customer:onPaginationChange"
|
|
6
|
+
OnPaginationChange = "customer:onPaginationChange",
|
|
7
|
+
OnScrollLoadMore = "customer:onScrollLoadMore",
|
|
8
|
+
OnScrollLoadComplete = "customer:onScrollLoadComplete"
|
|
7
9
|
}
|
|
8
10
|
/**
|
|
9
11
|
* 客户数据
|
|
@@ -95,6 +97,12 @@ export interface CustomerState {
|
|
|
95
97
|
loading: boolean;
|
|
96
98
|
/** 错误信息 */
|
|
97
99
|
error: string | null;
|
|
100
|
+
/** 是否支持滚动加载更多 */
|
|
101
|
+
hasMore: boolean;
|
|
102
|
+
/** 滚动加载状态 */
|
|
103
|
+
loadingMore: boolean;
|
|
104
|
+
/** 当前搜索条件 */
|
|
105
|
+
searchParams: Omit<ShopGetCustomerListParams, 'skip' | 'num'>;
|
|
98
106
|
}
|
|
99
107
|
/**
|
|
100
108
|
* 客户模块 API
|
|
@@ -126,5 +134,13 @@ export interface CustomerModuleAPI {
|
|
|
126
134
|
setPaginationInfo: (page: number, pageSize: number) => void;
|
|
127
135
|
/** 便捷方法:切换分页并自动获取数据 */
|
|
128
136
|
changeCustomerPage: (page: number, pageSize?: number) => Promise<ICustomerListResponse>;
|
|
137
|
+
/** 滚动加载更多客户数据 */
|
|
138
|
+
loadMoreCustomers: () => Promise<ICustomerListResponse>;
|
|
139
|
+
/** 重置并重新开始滚动加载 */
|
|
140
|
+
resetAndLoadCustomers: (params?: ShopGetCustomerListParams) => Promise<ICustomerListResponse>;
|
|
141
|
+
/** 检查是否还有更多数据可以加载 */
|
|
142
|
+
hasMoreCustomers: () => boolean;
|
|
143
|
+
/** 获取当前的搜索条件 */
|
|
144
|
+
getCurrentSearchParams: () => Omit<ShopGetCustomerListParams, 'skip' | 'num'>;
|
|
129
145
|
}
|
|
130
146
|
export {};
|
|
@@ -3,6 +3,8 @@ export var CustomerHooks = /*#__PURE__*/function (CustomerHooks) {
|
|
|
3
3
|
CustomerHooks["OnCustomerListError"] = "customer:onError";
|
|
4
4
|
CustomerHooks["OnCustomerSelected"] = "customer:onSelected";
|
|
5
5
|
CustomerHooks["OnPaginationChange"] = "customer:onPaginationChange";
|
|
6
|
+
CustomerHooks["OnScrollLoadMore"] = "customer:onScrollLoadMore";
|
|
7
|
+
CustomerHooks["OnScrollLoadComplete"] = "customer:onScrollLoadComplete";
|
|
6
8
|
return CustomerHooks;
|
|
7
9
|
}({});
|
|
8
10
|
|
|
@@ -91,6 +91,32 @@ export declare class BookingTicketImpl extends BaseModule implements Module {
|
|
|
91
91
|
* @returns 客户列表响应
|
|
92
92
|
*/
|
|
93
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;
|
|
94
120
|
/**
|
|
95
121
|
* 全局扫描监听
|
|
96
122
|
* @param callback 回调
|
|
@@ -380,11 +380,117 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
380
380
|
}
|
|
381
381
|
return changeCustomerPage;
|
|
382
382
|
}()
|
|
383
|
+
/**
|
|
384
|
+
* 滚动加载更多客户数据 - 数据会追加到现有列表中
|
|
385
|
+
* @returns 客户列表响应
|
|
386
|
+
*/
|
|
387
|
+
)
|
|
388
|
+
}, {
|
|
389
|
+
key: "loadMoreCustomers",
|
|
390
|
+
value: (function () {
|
|
391
|
+
var _loadMoreCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
392
|
+
var result;
|
|
393
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
394
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
395
|
+
case 0:
|
|
396
|
+
_context6.prev = 0;
|
|
397
|
+
_context6.next = 3;
|
|
398
|
+
return this.store.customer.loadMoreCustomers();
|
|
399
|
+
case 3:
|
|
400
|
+
result = _context6.sent;
|
|
401
|
+
this.core.effects.emit(BookingTicketHooks.onCustomerListUpdate, result);
|
|
402
|
+
return _context6.abrupt("return", result);
|
|
403
|
+
case 8:
|
|
404
|
+
_context6.prev = 8;
|
|
405
|
+
_context6.t0 = _context6["catch"](0);
|
|
406
|
+
console.error('Failed to load more customers:', _context6.t0);
|
|
407
|
+
throw _context6.t0;
|
|
408
|
+
case 12:
|
|
409
|
+
case "end":
|
|
410
|
+
return _context6.stop();
|
|
411
|
+
}
|
|
412
|
+
}, _callee6, this, [[0, 8]]);
|
|
413
|
+
}));
|
|
414
|
+
function loadMoreCustomers() {
|
|
415
|
+
return _loadMoreCustomers.apply(this, arguments);
|
|
416
|
+
}
|
|
417
|
+
return loadMoreCustomers;
|
|
418
|
+
}()
|
|
419
|
+
/**
|
|
420
|
+
* 重置并重新开始滚动加载客户数据
|
|
421
|
+
* @param params 查询参数
|
|
422
|
+
* @returns 客户列表响应
|
|
423
|
+
*/
|
|
424
|
+
)
|
|
425
|
+
}, {
|
|
426
|
+
key: "resetAndLoadCustomers",
|
|
427
|
+
value: (function () {
|
|
428
|
+
var _resetAndLoadCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
|
429
|
+
var params,
|
|
430
|
+
result,
|
|
431
|
+
_args7 = arguments;
|
|
432
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
433
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
434
|
+
case 0:
|
|
435
|
+
params = _args7.length > 0 && _args7[0] !== undefined ? _args7[0] : {};
|
|
436
|
+
_context7.prev = 1;
|
|
437
|
+
_context7.next = 4;
|
|
438
|
+
return this.store.customer.resetAndLoadCustomers(params);
|
|
439
|
+
case 4:
|
|
440
|
+
result = _context7.sent;
|
|
441
|
+
this.core.effects.emit(BookingTicketHooks.onCustomerListReset, result);
|
|
442
|
+
return _context7.abrupt("return", result);
|
|
443
|
+
case 9:
|
|
444
|
+
_context7.prev = 9;
|
|
445
|
+
_context7.t0 = _context7["catch"](1);
|
|
446
|
+
console.error('Failed to reset and load customers:', _context7.t0);
|
|
447
|
+
throw _context7.t0;
|
|
448
|
+
case 13:
|
|
449
|
+
case "end":
|
|
450
|
+
return _context7.stop();
|
|
451
|
+
}
|
|
452
|
+
}, _callee7, this, [[1, 9]]);
|
|
453
|
+
}));
|
|
454
|
+
function resetAndLoadCustomers() {
|
|
455
|
+
return _resetAndLoadCustomers.apply(this, arguments);
|
|
456
|
+
}
|
|
457
|
+
return resetAndLoadCustomers;
|
|
458
|
+
}()
|
|
459
|
+
/**
|
|
460
|
+
* 检查是否还有更多客户数据可以加载
|
|
461
|
+
* @returns 是否还有更多数据
|
|
462
|
+
*/
|
|
463
|
+
)
|
|
464
|
+
}, {
|
|
465
|
+
key: "hasMoreCustomers",
|
|
466
|
+
value: function hasMoreCustomers() {
|
|
467
|
+
return this.store.customer.hasMoreCustomers();
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
/**
|
|
471
|
+
* 获取当前的客户搜索条件
|
|
472
|
+
* @returns 当前搜索条件
|
|
473
|
+
*/
|
|
474
|
+
}, {
|
|
475
|
+
key: "getCurrentCustomerSearchParams",
|
|
476
|
+
value: function getCurrentCustomerSearchParams() {
|
|
477
|
+
return this.store.customer.getCurrentSearchParams();
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
/**
|
|
481
|
+
* 获取客户列表状态(包含滚动加载相关状态)
|
|
482
|
+
* @returns 客户状态
|
|
483
|
+
*/
|
|
484
|
+
}, {
|
|
485
|
+
key: "getCustomerState",
|
|
486
|
+
value: function getCustomerState() {
|
|
487
|
+
return this.store.customer.getState();
|
|
488
|
+
}
|
|
489
|
+
|
|
383
490
|
/**
|
|
384
491
|
* 全局扫描监听
|
|
385
492
|
* @param callback 回调
|
|
386
493
|
*/
|
|
387
|
-
)
|
|
388
494
|
}, {
|
|
389
495
|
key: "scanGlobalListener",
|
|
390
496
|
value: function scanGlobalListener(callback) {
|
|
@@ -458,15 +564,15 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
458
564
|
}, {
|
|
459
565
|
key: "setOtherParams",
|
|
460
566
|
value: (function () {
|
|
461
|
-
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
567
|
+
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(params) {
|
|
462
568
|
var _ref,
|
|
463
569
|
_ref$cover,
|
|
464
570
|
cover,
|
|
465
|
-
|
|
466
|
-
return _regeneratorRuntime().wrap(function
|
|
467
|
-
while (1) switch (
|
|
571
|
+
_args8 = arguments;
|
|
572
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
573
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
468
574
|
case 0:
|
|
469
|
-
_ref =
|
|
575
|
+
_ref = _args8.length > 1 && _args8[1] !== undefined ? _args8[1] : {}, _ref$cover = _ref.cover, cover = _ref$cover === void 0 ? false : _ref$cover;
|
|
470
576
|
if (cover) {
|
|
471
577
|
this.otherParams = params;
|
|
472
578
|
} else {
|
|
@@ -474,9 +580,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
474
580
|
}
|
|
475
581
|
case 2:
|
|
476
582
|
case "end":
|
|
477
|
-
return
|
|
583
|
+
return _context8.stop();
|
|
478
584
|
}
|
|
479
|
-
},
|
|
585
|
+
}, _callee8, this);
|
|
480
586
|
}));
|
|
481
587
|
function setOtherParams(_x5) {
|
|
482
588
|
return _setOtherParams.apply(this, arguments);
|
|
@@ -491,16 +597,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
491
597
|
}, {
|
|
492
598
|
key: "getOtherParams",
|
|
493
599
|
value: (function () {
|
|
494
|
-
var _getOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
495
|
-
return _regeneratorRuntime().wrap(function
|
|
496
|
-
while (1) switch (
|
|
600
|
+
var _getOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
|
|
601
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
602
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
497
603
|
case 0:
|
|
498
|
-
return
|
|
604
|
+
return _context9.abrupt("return", this.otherParams);
|
|
499
605
|
case 1:
|
|
500
606
|
case "end":
|
|
501
|
-
return
|
|
607
|
+
return _context9.stop();
|
|
502
608
|
}
|
|
503
|
-
},
|
|
609
|
+
}, _callee9, this);
|
|
504
610
|
}));
|
|
505
611
|
function getOtherParams() {
|
|
506
612
|
return _getOtherParams.apply(this, arguments);
|
|
@@ -12,7 +12,9 @@ export declare enum BookingTicketHooks {
|
|
|
12
12
|
onInited = "bookingTicket:onInited",
|
|
13
13
|
onDestroy = "bookingTicket:onDestroy",
|
|
14
14
|
onProductsLoaded = "bookingTicket:onProductsLoaded",
|
|
15
|
-
onCustomerSelected = "bookingTicket:onCustomerSelected"
|
|
15
|
+
onCustomerSelected = "bookingTicket:onCustomerSelected",
|
|
16
|
+
onCustomerListUpdate = "bookingTicket:onCustomerListUpdate",
|
|
17
|
+
onCustomerListReset = "bookingTicket:onCustomerListReset"
|
|
16
18
|
}
|
|
17
19
|
/**
|
|
18
20
|
* 获取客户列表的参数
|
|
@@ -21,6 +21,8 @@ export var BookingTicketHooks = /*#__PURE__*/function (BookingTicketHooks) {
|
|
|
21
21
|
BookingTicketHooks["onDestroy"] = "bookingTicket:onDestroy";
|
|
22
22
|
BookingTicketHooks["onProductsLoaded"] = "bookingTicket:onProductsLoaded";
|
|
23
23
|
BookingTicketHooks["onCustomerSelected"] = "bookingTicket:onCustomerSelected";
|
|
24
|
+
BookingTicketHooks["onCustomerListUpdate"] = "bookingTicket:onCustomerListUpdate";
|
|
25
|
+
BookingTicketHooks["onCustomerListReset"] = "bookingTicket:onCustomerListReset";
|
|
24
26
|
return BookingTicketHooks;
|
|
25
27
|
}({});
|
|
26
28
|
|
|
@@ -11,6 +11,18 @@ export declare class CustomerModule extends BaseModule implements Module, Custom
|
|
|
11
11
|
private fatherModule;
|
|
12
12
|
constructor(name?: string, version?: string);
|
|
13
13
|
initialize(core: PisellCore, options?: ModuleOptions): Promise<void>;
|
|
14
|
+
/**
|
|
15
|
+
* 获取客户列表数据(内部方法)
|
|
16
|
+
* @param params 查询参数
|
|
17
|
+
* @returns API响应数据
|
|
18
|
+
*/
|
|
19
|
+
private fetchCustomerListData;
|
|
20
|
+
/**
|
|
21
|
+
* 处理客户列表操作的错误(内部方法)
|
|
22
|
+
* @param error 错误对象
|
|
23
|
+
* @param operation 操作名称
|
|
24
|
+
*/
|
|
25
|
+
private handleCustomerListError;
|
|
14
26
|
/**
|
|
15
27
|
* 获取客户列表
|
|
16
28
|
* @param params 查询参数
|
|
@@ -81,6 +93,27 @@ export declare class CustomerModule extends BaseModule implements Module, Custom
|
|
|
81
93
|
* @returns 客户列表响应
|
|
82
94
|
*/
|
|
83
95
|
changeCustomerPage(page: number, pageSize?: number): Promise<ICustomerListResponse>;
|
|
96
|
+
/**
|
|
97
|
+
* 滚动加载更多客户数据 - 数据会追加到现有列表中
|
|
98
|
+
* @returns 客户列表响应
|
|
99
|
+
*/
|
|
100
|
+
loadMoreCustomers(): Promise<ICustomerListResponse>;
|
|
101
|
+
/**
|
|
102
|
+
* 重置并重新开始滚动加载
|
|
103
|
+
* @param params 查询参数
|
|
104
|
+
* @returns 客户列表响应
|
|
105
|
+
*/
|
|
106
|
+
resetAndLoadCustomers(params?: ShopGetCustomerListParams): Promise<ICustomerListResponse>;
|
|
107
|
+
/**
|
|
108
|
+
* 检查是否还有更多数据可以加载
|
|
109
|
+
* @returns 是否还有更多数据
|
|
110
|
+
*/
|
|
111
|
+
hasMoreCustomers(): boolean;
|
|
112
|
+
/**
|
|
113
|
+
* 获取当前的搜索条件
|
|
114
|
+
* @returns 当前搜索条件
|
|
115
|
+
*/
|
|
116
|
+
getCurrentSearchParams(): Omit<ShopGetCustomerListParams, 'skip' | 'num'>;
|
|
84
117
|
/**
|
|
85
118
|
* 缓存状态变化
|
|
86
119
|
*/
|
|
@@ -40,12 +40,15 @@ var CustomerModule = class extends import_BaseModule.BaseModule {
|
|
|
40
40
|
currentPage: 1,
|
|
41
41
|
pageSize: import_constants.DEFAULT_PAGE_SIZE,
|
|
42
42
|
loading: false,
|
|
43
|
-
error: null
|
|
43
|
+
error: null,
|
|
44
|
+
hasMore: true,
|
|
45
|
+
loadingMore: false,
|
|
46
|
+
searchParams: {}
|
|
44
47
|
};
|
|
45
48
|
this.openCache = false;
|
|
46
49
|
}
|
|
47
50
|
async initialize(core, options) {
|
|
48
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
51
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
49
52
|
this.core = core;
|
|
50
53
|
this.store = options == null ? void 0 : options.store;
|
|
51
54
|
this.request = this.core.getPlugin("request");
|
|
@@ -75,47 +78,76 @@ var CustomerModule = class extends import_BaseModule.BaseModule {
|
|
|
75
78
|
} else {
|
|
76
79
|
this.store.pageSize = import_constants.DEFAULT_PAGE_SIZE;
|
|
77
80
|
}
|
|
78
|
-
|
|
81
|
+
this.store.hasMore = ((_f = options == null ? void 0 : options.initialState) == null ? void 0 : _f.hasMore) ?? true;
|
|
82
|
+
this.store.loadingMore = ((_g = options == null ? void 0 : options.initialState) == null ? void 0 : _g.loadingMore) ?? false;
|
|
83
|
+
this.store.searchParams = ((_h = options == null ? void 0 : options.initialState) == null ? void 0 : _h.searchParams) ?? {};
|
|
84
|
+
if ((_i = options == null ? void 0 : options.otherParams) == null ? void 0 : _i.cacheId) {
|
|
79
85
|
this.openCache = options.otherParams.openCache;
|
|
80
86
|
this.cacheId = options.otherParams.cacheId;
|
|
81
87
|
}
|
|
82
|
-
if ((
|
|
88
|
+
if ((_j = options == null ? void 0 : options.otherParams) == null ? void 0 : _j.fatherModule) {
|
|
83
89
|
this.fatherModule = options.otherParams.fatherModule;
|
|
84
90
|
}
|
|
85
91
|
}
|
|
86
92
|
/**
|
|
87
|
-
*
|
|
93
|
+
* 获取客户列表数据(内部方法)
|
|
88
94
|
* @param params 查询参数
|
|
89
|
-
* @returns
|
|
95
|
+
* @returns API响应数据
|
|
90
96
|
*/
|
|
91
|
-
async
|
|
97
|
+
async fetchCustomerListData(params = {}) {
|
|
92
98
|
var _a, _b;
|
|
93
99
|
const url = "/customer/select-list";
|
|
94
100
|
const { skip = 1, num = import_constants.DEFAULT_PAGE_SIZE, search, ...otherParams } = params;
|
|
101
|
+
const queryParams = {
|
|
102
|
+
skip,
|
|
103
|
+
num,
|
|
104
|
+
sort_by: import_constants.SORT_BY,
|
|
105
|
+
with: ["latestWalletDetail.wallet"],
|
|
106
|
+
search_wallet_flag: 1,
|
|
107
|
+
search_wallet_pass_flag: 1,
|
|
108
|
+
...search && { search },
|
|
109
|
+
...otherParams
|
|
110
|
+
};
|
|
111
|
+
const res = await this.request.get(url, queryParams);
|
|
112
|
+
if ((res == null ? void 0 : res.code) !== 200) {
|
|
113
|
+
throw new Error(res == null ? void 0 : res.message);
|
|
114
|
+
}
|
|
115
|
+
return {
|
|
116
|
+
customerList: ((_a = res == null ? void 0 : res.data) == null ? void 0 : _a.list) || [],
|
|
117
|
+
total: ((_b = res == null ? void 0 : res.data) == null ? void 0 : _b.count) || 0,
|
|
118
|
+
page: skip,
|
|
119
|
+
pageSize: num
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* 处理客户列表操作的错误(内部方法)
|
|
124
|
+
* @param error 错误对象
|
|
125
|
+
* @param operation 操作名称
|
|
126
|
+
*/
|
|
127
|
+
async handleCustomerListError(error, operation) {
|
|
128
|
+
console.error(`Failed to ${operation}:`, error);
|
|
129
|
+
this.store.error = error instanceof Error ? error.message : `Failed to ${operation}`;
|
|
130
|
+
await this.core.effects.emit(
|
|
131
|
+
import_types.CustomerHooks.OnCustomerListError,
|
|
132
|
+
this.store.error
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* 获取客户列表
|
|
137
|
+
* @param params 查询参数
|
|
138
|
+
* @returns 客户列表响应
|
|
139
|
+
*/
|
|
140
|
+
async getCustomerList(params = {}) {
|
|
95
141
|
try {
|
|
96
142
|
this.store.loading = true;
|
|
97
143
|
this.store.error = null;
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
sort_by: import_constants.SORT_BY,
|
|
102
|
-
with: ["latestWalletDetail.wallet"],
|
|
103
|
-
search_wallet_flag: 1,
|
|
104
|
-
search_wallet_pass_flag: 1,
|
|
105
|
-
...search && { search },
|
|
106
|
-
...otherParams
|
|
107
|
-
};
|
|
108
|
-
const res = await this.request.get(url, queryParams);
|
|
109
|
-
if ((res == null ? void 0 : res.code) !== 200) {
|
|
110
|
-
throw new Error(res == null ? void 0 : res.message);
|
|
111
|
-
}
|
|
112
|
-
const customerList = ((_a = res == null ? void 0 : res.data) == null ? void 0 : _a.list) || [];
|
|
113
|
-
const total = ((_b = res == null ? void 0 : res.data) == null ? void 0 : _b.count) || 0;
|
|
114
|
-
const page = skip;
|
|
115
|
-
const pageSize = num;
|
|
144
|
+
const { customerList, total, page, pageSize } = await this.fetchCustomerListData(params);
|
|
145
|
+
const { skip, num, ...searchParams } = params;
|
|
146
|
+
this.store.searchParams = (0, import_lodash_es.cloneDeep)(searchParams);
|
|
116
147
|
this.store.currentPage = page;
|
|
117
148
|
this.store.pageSize = pageSize;
|
|
118
149
|
this.store.total = total;
|
|
150
|
+
this.store.hasMore = page * pageSize < total;
|
|
119
151
|
this.store.customerList = (0, import_lodash_es.cloneDeep)(customerList);
|
|
120
152
|
await this.core.effects.emit(
|
|
121
153
|
import_types.CustomerHooks.OnCustomerListUpdate,
|
|
@@ -135,12 +167,7 @@ var CustomerModule = class extends import_BaseModule.BaseModule {
|
|
|
135
167
|
};
|
|
136
168
|
return response;
|
|
137
169
|
} catch (error) {
|
|
138
|
-
|
|
139
|
-
this.store.error = error instanceof Error ? error.message : "Failed to fetch customer list";
|
|
140
|
-
await this.core.effects.emit(
|
|
141
|
-
import_types.CustomerHooks.OnCustomerListError,
|
|
142
|
-
this.store.error
|
|
143
|
-
);
|
|
170
|
+
await this.handleCustomerListError(error, "fetch customer list");
|
|
144
171
|
throw error;
|
|
145
172
|
} finally {
|
|
146
173
|
this.store.loading = false;
|
|
@@ -202,6 +229,9 @@ var CustomerModule = class extends import_BaseModule.BaseModule {
|
|
|
202
229
|
this.store.total = 0;
|
|
203
230
|
this.store.currentPage = 1;
|
|
204
231
|
this.store.pageSize = import_constants.DEFAULT_PAGE_SIZE;
|
|
232
|
+
this.store.hasMore = true;
|
|
233
|
+
this.store.loadingMore = false;
|
|
234
|
+
this.store.searchParams = {};
|
|
205
235
|
this.core.effects.emit(
|
|
206
236
|
import_types.CustomerHooks.OnCustomerListUpdate,
|
|
207
237
|
this.store
|
|
@@ -280,9 +310,114 @@ var CustomerModule = class extends import_BaseModule.BaseModule {
|
|
|
280
310
|
const num = targetPageSize;
|
|
281
311
|
return await this.getCustomerList({
|
|
282
312
|
skip,
|
|
283
|
-
num
|
|
313
|
+
num,
|
|
314
|
+
...this.store.searchParams
|
|
315
|
+
// 使用存储的搜索条件
|
|
284
316
|
});
|
|
285
317
|
}
|
|
318
|
+
/**
|
|
319
|
+
* 滚动加载更多客户数据 - 数据会追加到现有列表中
|
|
320
|
+
* @returns 客户列表响应
|
|
321
|
+
*/
|
|
322
|
+
async loadMoreCustomers() {
|
|
323
|
+
if (!this.store.hasMore || this.store.loadingMore) {
|
|
324
|
+
return {
|
|
325
|
+
list: [],
|
|
326
|
+
total: this.store.total,
|
|
327
|
+
page: this.store.currentPage,
|
|
328
|
+
pageSize: this.store.pageSize
|
|
329
|
+
};
|
|
330
|
+
}
|
|
331
|
+
const nextPage = this.store.currentPage + 1;
|
|
332
|
+
try {
|
|
333
|
+
this.store.loadingMore = true;
|
|
334
|
+
this.store.error = null;
|
|
335
|
+
const { customerList: newCustomers, total, page, pageSize } = await this.fetchCustomerListData({
|
|
336
|
+
skip: nextPage,
|
|
337
|
+
num: this.store.pageSize,
|
|
338
|
+
...this.store.searchParams
|
|
339
|
+
// 使用存储的搜索条件
|
|
340
|
+
});
|
|
341
|
+
const updatedCustomerList = [...this.store.customerList, ...(0, import_lodash_es.cloneDeep)(newCustomers)];
|
|
342
|
+
this.store.customerList = updatedCustomerList;
|
|
343
|
+
this.store.currentPage = page;
|
|
344
|
+
this.store.total = total;
|
|
345
|
+
this.store.hasMore = page * pageSize < total;
|
|
346
|
+
await this.core.effects.emit(
|
|
347
|
+
import_types.CustomerHooks.OnScrollLoadMore,
|
|
348
|
+
{
|
|
349
|
+
newCustomers,
|
|
350
|
+
allCustomers: this.store.customerList,
|
|
351
|
+
currentPage: page,
|
|
352
|
+
hasMore: this.store.hasMore
|
|
353
|
+
}
|
|
354
|
+
);
|
|
355
|
+
await this.core.effects.emit(
|
|
356
|
+
import_types.CustomerHooks.OnCustomerListUpdate,
|
|
357
|
+
this.store
|
|
358
|
+
);
|
|
359
|
+
this.triggerPaginationChange({
|
|
360
|
+
page,
|
|
361
|
+
pageSize,
|
|
362
|
+
total,
|
|
363
|
+
totalPages: Math.ceil(total / pageSize)
|
|
364
|
+
});
|
|
365
|
+
const response = {
|
|
366
|
+
list: newCustomers,
|
|
367
|
+
// 返回新加载的数据
|
|
368
|
+
total,
|
|
369
|
+
page,
|
|
370
|
+
pageSize
|
|
371
|
+
};
|
|
372
|
+
return response;
|
|
373
|
+
} catch (error) {
|
|
374
|
+
await this.handleCustomerListError(error, "load more customers");
|
|
375
|
+
throw error;
|
|
376
|
+
} finally {
|
|
377
|
+
this.store.loadingMore = false;
|
|
378
|
+
this.storeChange();
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
/**
|
|
382
|
+
* 重置并重新开始滚动加载
|
|
383
|
+
* @param params 查询参数
|
|
384
|
+
* @returns 客户列表响应
|
|
385
|
+
*/
|
|
386
|
+
async resetAndLoadCustomers(params = {}) {
|
|
387
|
+
this.store.customerList = [];
|
|
388
|
+
this.store.currentPage = 1;
|
|
389
|
+
this.store.hasMore = true;
|
|
390
|
+
this.store.loadingMore = false;
|
|
391
|
+
const resetParams = {
|
|
392
|
+
...params,
|
|
393
|
+
skip: 1,
|
|
394
|
+
num: params.num || this.store.pageSize
|
|
395
|
+
};
|
|
396
|
+
const response = await this.getCustomerList(resetParams);
|
|
397
|
+
await this.core.effects.emit(
|
|
398
|
+
import_types.CustomerHooks.OnScrollLoadComplete,
|
|
399
|
+
{
|
|
400
|
+
customers: this.store.customerList,
|
|
401
|
+
total: this.store.total,
|
|
402
|
+
hasMore: this.store.hasMore
|
|
403
|
+
}
|
|
404
|
+
);
|
|
405
|
+
return response;
|
|
406
|
+
}
|
|
407
|
+
/**
|
|
408
|
+
* 检查是否还有更多数据可以加载
|
|
409
|
+
* @returns 是否还有更多数据
|
|
410
|
+
*/
|
|
411
|
+
hasMoreCustomers() {
|
|
412
|
+
return this.store.hasMore && !this.store.loadingMore;
|
|
413
|
+
}
|
|
414
|
+
/**
|
|
415
|
+
* 获取当前的搜索条件
|
|
416
|
+
* @returns 当前搜索条件
|
|
417
|
+
*/
|
|
418
|
+
getCurrentSearchParams() {
|
|
419
|
+
return (0, import_lodash_es.cloneDeep)(this.store.searchParams);
|
|
420
|
+
}
|
|
286
421
|
/**
|
|
287
422
|
* 缓存状态变化
|
|
288
423
|
*/
|
|
@@ -293,7 +428,7 @@ var CustomerModule = class extends import_BaseModule.BaseModule {
|
|
|
293
428
|
cacheId: this.cacheId,
|
|
294
429
|
fatherModule: this.fatherModule,
|
|
295
430
|
store,
|
|
296
|
-
cacheKey: ["customerList", "selectedCustomer", "total", "currentPage", "pageSize"]
|
|
431
|
+
cacheKey: ["customerList", "selectedCustomer", "total", "currentPage", "pageSize", "hasMore", "loadingMore", "searchParams"]
|
|
297
432
|
});
|
|
298
433
|
}
|
|
299
434
|
}
|
|
@@ -3,7 +3,9 @@ export declare enum CustomerHooks {
|
|
|
3
3
|
OnCustomerListUpdate = "customer:onUpdate",
|
|
4
4
|
OnCustomerListError = "customer:onError",
|
|
5
5
|
OnCustomerSelected = "customer:onSelected",
|
|
6
|
-
OnPaginationChange = "customer:onPaginationChange"
|
|
6
|
+
OnPaginationChange = "customer:onPaginationChange",
|
|
7
|
+
OnScrollLoadMore = "customer:onScrollLoadMore",
|
|
8
|
+
OnScrollLoadComplete = "customer:onScrollLoadComplete"
|
|
7
9
|
}
|
|
8
10
|
/**
|
|
9
11
|
* 客户数据
|
|
@@ -95,6 +97,12 @@ export interface CustomerState {
|
|
|
95
97
|
loading: boolean;
|
|
96
98
|
/** 错误信息 */
|
|
97
99
|
error: string | null;
|
|
100
|
+
/** 是否支持滚动加载更多 */
|
|
101
|
+
hasMore: boolean;
|
|
102
|
+
/** 滚动加载状态 */
|
|
103
|
+
loadingMore: boolean;
|
|
104
|
+
/** 当前搜索条件 */
|
|
105
|
+
searchParams: Omit<ShopGetCustomerListParams, 'skip' | 'num'>;
|
|
98
106
|
}
|
|
99
107
|
/**
|
|
100
108
|
* 客户模块 API
|
|
@@ -126,5 +134,13 @@ export interface CustomerModuleAPI {
|
|
|
126
134
|
setPaginationInfo: (page: number, pageSize: number) => void;
|
|
127
135
|
/** 便捷方法:切换分页并自动获取数据 */
|
|
128
136
|
changeCustomerPage: (page: number, pageSize?: number) => Promise<ICustomerListResponse>;
|
|
137
|
+
/** 滚动加载更多客户数据 */
|
|
138
|
+
loadMoreCustomers: () => Promise<ICustomerListResponse>;
|
|
139
|
+
/** 重置并重新开始滚动加载 */
|
|
140
|
+
resetAndLoadCustomers: (params?: ShopGetCustomerListParams) => Promise<ICustomerListResponse>;
|
|
141
|
+
/** 检查是否还有更多数据可以加载 */
|
|
142
|
+
hasMoreCustomers: () => boolean;
|
|
143
|
+
/** 获取当前的搜索条件 */
|
|
144
|
+
getCurrentSearchParams: () => Omit<ShopGetCustomerListParams, 'skip' | 'num'>;
|
|
129
145
|
}
|
|
130
146
|
export {};
|
|
@@ -27,6 +27,8 @@ var CustomerHooks = /* @__PURE__ */ ((CustomerHooks2) => {
|
|
|
27
27
|
CustomerHooks2["OnCustomerListError"] = "customer:onError";
|
|
28
28
|
CustomerHooks2["OnCustomerSelected"] = "customer:onSelected";
|
|
29
29
|
CustomerHooks2["OnPaginationChange"] = "customer:onPaginationChange";
|
|
30
|
+
CustomerHooks2["OnScrollLoadMore"] = "customer:onScrollLoadMore";
|
|
31
|
+
CustomerHooks2["OnScrollLoadComplete"] = "customer:onScrollLoadComplete";
|
|
30
32
|
return CustomerHooks2;
|
|
31
33
|
})(CustomerHooks || {});
|
|
32
34
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -91,6 +91,32 @@ export declare class BookingTicketImpl extends BaseModule implements Module {
|
|
|
91
91
|
* @returns 客户列表响应
|
|
92
92
|
*/
|
|
93
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;
|
|
94
120
|
/**
|
|
95
121
|
* 全局扫描监听
|
|
96
122
|
* @param callback 回调
|
|
@@ -241,6 +241,56 @@ var BookingTicketImpl = class extends import_BaseModule.BaseModule {
|
|
|
241
241
|
throw error;
|
|
242
242
|
}
|
|
243
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
|
+
}
|
|
244
294
|
/**
|
|
245
295
|
* 全局扫描监听
|
|
246
296
|
* @param callback 回调
|
|
@@ -12,7 +12,9 @@ export declare enum BookingTicketHooks {
|
|
|
12
12
|
onInited = "bookingTicket:onInited",
|
|
13
13
|
onDestroy = "bookingTicket:onDestroy",
|
|
14
14
|
onProductsLoaded = "bookingTicket:onProductsLoaded",
|
|
15
|
-
onCustomerSelected = "bookingTicket:onCustomerSelected"
|
|
15
|
+
onCustomerSelected = "bookingTicket:onCustomerSelected",
|
|
16
|
+
onCustomerListUpdate = "bookingTicket:onCustomerListUpdate",
|
|
17
|
+
onCustomerListReset = "bookingTicket:onCustomerListReset"
|
|
16
18
|
}
|
|
17
19
|
/**
|
|
18
20
|
* 获取客户列表的参数
|
|
@@ -61,6 +61,8 @@ var BookingTicketHooks = /* @__PURE__ */ ((BookingTicketHooks2) => {
|
|
|
61
61
|
BookingTicketHooks2["onDestroy"] = "bookingTicket:onDestroy";
|
|
62
62
|
BookingTicketHooks2["onProductsLoaded"] = "bookingTicket:onProductsLoaded";
|
|
63
63
|
BookingTicketHooks2["onCustomerSelected"] = "bookingTicket:onCustomerSelected";
|
|
64
|
+
BookingTicketHooks2["onCustomerListUpdate"] = "bookingTicket:onCustomerListUpdate";
|
|
65
|
+
BookingTicketHooks2["onCustomerListReset"] = "bookingTicket:onCustomerListReset";
|
|
64
66
|
return BookingTicketHooks2;
|
|
65
67
|
})(BookingTicketHooks || {});
|
|
66
68
|
// Annotate the CommonJS export names for ESM import in node:
|