@pisell/pisellos 0.0.567 → 0.0.568
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/core/index.js +6 -9
- package/dist/model/strategy/adapter/walletPass/evaluator.js +0 -2
- package/dist/model/strategy/adapter/walletPass/example.js +3 -26
- package/dist/model/strategy/adapter/walletPass/utils.js +0 -3
- package/dist/model/strategy/strategy-example.js +5 -19
- package/dist/modules/Cart/index.js +0 -3
- package/dist/modules/Cart/utils/cartProduct.js +0 -1
- package/dist/modules/Date/index.js +1 -5
- package/dist/modules/Discount/index.js +1 -4
- package/dist/modules/OpenData/index.js +0 -2
- package/dist/modules/Order/index.d.ts +1 -1
- package/dist/modules/Order/index.js +14 -41
- package/dist/modules/Payment/index.js +142 -270
- package/dist/modules/Payment/walletpass.js +4 -5
- package/dist/modules/Rules/index.js +0 -7
- package/dist/modules/Schedule/utils.js +0 -1
- package/dist/modules/Step/index.js +0 -1
- package/dist/plugins/request.js +1 -4
- package/dist/plugins/window.js +2 -6
- package/dist/server/index.js +88 -121
- package/dist/server/modules/menu/index.js +32 -41
- package/dist/server/modules/products/index.js +29 -49
- package/dist/server/modules/quotation/index.js +29 -38
- package/dist/server/modules/resource/index.js +3 -4
- package/dist/server/modules/schedule/index.js +32 -40
- package/dist/server/utils/product.js +0 -1
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingByStep/index.js +7 -59
- package/dist/solution/BookingByStep/utils/capacity.js +1 -11
- package/dist/solution/BookingByStep/utils/resources.js +1 -3
- package/dist/solution/BookingByStep/utils/timeslots.js +2 -43
- package/dist/solution/BookingTicket/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.js +5 -7
- package/dist/solution/BookingTicket/utils/scan/handleScan.js +25 -31
- package/dist/solution/BookingTicket/utils/scan/index.js +6 -10
- package/dist/solution/BuyTickets/index.js +9 -12
- package/dist/solution/Checkout/index.js +177 -246
- package/dist/solution/Checkout/utils/index.js +4 -16
- package/dist/solution/RegisterAndLogin/index.js +30 -76
- package/dist/solution/ScanOrder/index.js +50 -60
- package/dist/solution/ShopDiscount/index.js +2 -7
- package/dist/solution/VenueBooking/index.d.ts +5 -0
- package/dist/solution/VenueBooking/index.js +364 -327
- package/dist/utils/task.js +15 -18
- package/dist/utils/watch.js +0 -1
- package/lib/apis/picoding.js +2 -0
- package/lib/core/index.js +130 -131
- package/lib/effects/index.js +46 -57
- package/lib/index.js +92 -53
- package/lib/model/index.js +14 -21
- package/lib/model/strategy/adapter/dataVariant/adapter.js +38 -50
- package/lib/model/strategy/adapter/dataVariant/evaluator.js +162 -236
- package/lib/model/strategy/adapter/dataVariant/examples.js +229 -237
- package/lib/model/strategy/adapter/dataVariant/index.js +39 -34
- package/lib/model/strategy/adapter/dataVariant/type.js +57 -28
- package/lib/model/strategy/adapter/index.js +100 -64
- package/lib/model/strategy/adapter/itemRule/adapter.js +156 -144
- package/lib/model/strategy/adapter/itemRule/evaluator.js +36 -48
- package/lib/model/strategy/adapter/itemRule/examples.js +295 -225
- package/lib/model/strategy/adapter/itemRule/index.js +83 -57
- package/lib/model/strategy/adapter/itemRule/type.js +97 -36
- package/lib/model/strategy/adapter/promotion/adapter.js +84 -63
- package/lib/model/strategy/adapter/promotion/evaluator.js +381 -231
- package/lib/model/strategy/adapter/promotion/examples.js +139 -159
- package/lib/model/strategy/adapter/promotion/index.js +1 -49
- package/lib/model/strategy/adapter/promotion/type.js +199 -35
- package/lib/model/strategy/adapter/type.js +4 -16
- package/lib/model/strategy/adapter/walletPass/evaluator.js +180 -152
- package/lib/model/strategy/adapter/walletPass/example.js +217 -190
- package/lib/model/strategy/adapter/walletPass/index.js +75 -51
- package/lib/model/strategy/adapter/walletPass/locales.js +36 -58
- package/lib/model/strategy/adapter/walletPass/type.js +4 -16
- package/lib/model/strategy/adapter/walletPass/utils.js +652 -402
- package/lib/model/strategy/engine.js +270 -168
- package/lib/model/strategy/index.js +49 -34
- package/lib/model/strategy/strategy-example.js +243 -239
- package/lib/model/strategy/type.js +100 -40
- package/lib/modules/Account/index.js +39 -53
- package/lib/modules/Account/types.js +20 -33
- package/lib/modules/AccountList/index.js +116 -154
- package/lib/modules/AccountList/types.js +30 -31
- package/lib/modules/AccountList/utils.js +18 -30
- package/lib/modules/BaseModule.js +22 -45
- package/lib/modules/Cart/index.js +170 -124
- package/lib/modules/Cart/types.js +46 -51
- package/lib/modules/Cart/utils/cartAccount.js +40 -39
- package/lib/modules/Cart/utils/cartDate.js +56 -61
- package/lib/modules/Cart/utils/cartDiscount.js +28 -33
- package/lib/modules/Cart/utils/cartNote.js +27 -32
- package/lib/modules/Cart/utils/cartProduct.js +306 -241
- package/lib/modules/Cart/utils/cartRelationForms.js +29 -35
- package/lib/modules/Cart/utils/cartResource.js +72 -78
- package/lib/modules/Cart/utils/changePrice.js +26 -62
- package/lib/modules/Cart/utils/index.js +106 -48
- package/lib/modules/Customer/constants.js +13 -34
- package/lib/modules/Customer/index.js +216 -153
- package/lib/modules/Customer/types.js +38 -35
- package/lib/modules/Date/index.js +116 -115
- package/lib/modules/Date/types.js +16 -28
- package/lib/modules/Date/utils.js +174 -123
- package/lib/modules/Discount/index.js +117 -113
- package/lib/modules/Discount/types.js +9 -31
- package/lib/modules/Guests/index.js +30 -56
- package/lib/modules/Guests/types.js +23 -33
- package/lib/modules/Holder/index.js +209 -189
- package/lib/modules/Holder/types.js +4 -16
- package/lib/modules/Holder/utils.js +20 -49
- package/lib/modules/OpenData/index.js +63 -74
- package/lib/modules/OpenData/types.js +4 -16
- package/lib/modules/OpenData/utils.js +44 -78
- package/lib/modules/Order/index.d.ts +1 -1
- package/lib/modules/Order/index.js +332 -320
- package/lib/modules/Order/types.js +24 -33
- package/lib/modules/Order/utils.js +350 -284
- package/lib/modules/Payment/cash.js +20 -33
- package/lib/modules/Payment/cashRecommendationAlgorithm.js +145 -76
- package/lib/modules/Payment/eftpos.js +16 -30
- package/lib/modules/Payment/index.js +566 -432
- package/lib/modules/Payment/mx51.js +1 -0
- package/lib/modules/Payment/types.js +216 -107
- package/lib/modules/Payment/utils.js +50 -47
- package/lib/modules/Payment/walletpass.js +221 -203
- package/lib/modules/Product/index.js +51 -46
- package/lib/modules/Product/types.js +4 -16
- package/lib/modules/Product/utils.js +32 -33
- package/lib/modules/ProductList/index.js +111 -110
- package/lib/modules/ProductList/types.js +9 -31
- package/lib/modules/Quotation/index.js +60 -82
- package/lib/modules/Quotation/types.js +4 -16
- package/lib/modules/Resource/index.js +27 -59
- package/lib/modules/Resource/types.js +22 -32
- package/lib/modules/Resource/utils.js +30 -38
- package/lib/modules/Rules/index.js +1172 -872
- package/lib/modules/Rules/types.js +17 -40
- package/lib/modules/SalesSummary/index.js +59 -68
- package/lib/modules/SalesSummary/types.js +4 -16
- package/lib/modules/SalesSummary/utils.js +176 -193
- package/lib/modules/ScanOrderLogger/index.js +59 -79
- package/lib/modules/ScanOrderLogger/providers/feishu.js +54 -78
- package/lib/modules/ScanOrderLogger/providers/grafana.js +13 -36
- package/lib/modules/ScanOrderLogger/types.js +4 -16
- package/lib/modules/Schedule/getDateIsInSchedule.js +334 -167
- package/lib/modules/Schedule/index.js +97 -107
- package/lib/modules/Schedule/type.js +4 -16
- package/lib/modules/Schedule/types.js +4 -16
- package/lib/modules/Schedule/utils.js +433 -291
- package/lib/modules/Step/index.js +40 -52
- package/lib/modules/Step/tyeps.js +4 -16
- package/lib/modules/Summary/index.js +66 -70
- package/lib/modules/Summary/types.js +4 -16
- package/lib/modules/Summary/utils.js +782 -429
- package/lib/modules/index.js +212 -57
- package/lib/plugins/app.js +4 -16
- package/lib/plugins/index.js +36 -25
- package/lib/plugins/request.js +137 -126
- package/lib/plugins/shopStore.js +4 -16
- package/lib/plugins/user.js +4 -16
- package/lib/plugins/window.js +171 -179
- package/lib/server/index.js +882 -623
- package/lib/server/modules/index.js +85 -59
- package/lib/server/modules/menu/index.js +146 -122
- package/lib/server/modules/menu/types.js +18 -31
- package/lib/server/modules/order/index.js +195 -231
- package/lib/server/modules/order/types.js +107 -32
- package/lib/server/modules/order/utils/filterBookings.js +174 -140
- package/lib/server/modules/order/utils/filterOrders.js +89 -60
- package/lib/server/modules/products/index.js +430 -335
- package/lib/server/modules/products/types.js +41 -34
- package/lib/server/modules/quotation/index.js +76 -77
- package/lib/server/modules/quotation/types.js +21 -31
- package/lib/server/modules/resource/index.js +216 -187
- package/lib/server/modules/resource/types.js +42 -33
- package/lib/server/modules/schedule/index.js +134 -119
- package/lib/server/modules/schedule/types.js +14 -21
- package/lib/server/modules/schedule/utils.js +334 -163
- package/lib/server/types.js +4 -16
- package/lib/server/utils/index.js +25 -23
- package/lib/server/utils/product.js +196 -139
- package/lib/server/utils/schedule.js +34 -41
- package/lib/server/utils/time.js +40 -49
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingByStep/index.js +1530 -1343
- package/lib/solution/BookingByStep/types.js +40 -99
- package/lib/solution/BookingByStep/utils/capacity.js +192 -160
- package/lib/solution/BookingByStep/utils/products.js +42 -52
- package/lib/solution/BookingByStep/utils/resources.js +527 -330
- package/lib/solution/BookingByStep/utils/stock.js +65 -44
- package/lib/solution/BookingByStep/utils/timeslots.js +129 -131
- package/lib/solution/BookingTicket/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.js +147 -122
- package/lib/solution/BookingTicket/types.js +38 -64
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +64 -80
- package/lib/solution/BookingTicket/utils/scan/handleScan.js +82 -80
- package/lib/solution/BookingTicket/utils/scan/index.js +90 -94
- package/lib/solution/BookingTicket/utils/scan/scanCache.js +90 -43
- package/lib/solution/BuyTickets/index.js +67 -70
- package/lib/solution/BuyTickets/types.js +22 -38
- package/lib/solution/Checkout/index.js +1451 -1158
- package/lib/solution/Checkout/types.js +91 -61
- package/lib/solution/Checkout/utils/index.js +227 -158
- package/lib/solution/PlaceOrder/index.js +55 -0
- package/lib/solution/RegisterAndLogin/config.js +493 -460
- package/lib/solution/RegisterAndLogin/index.js +633 -630
- package/lib/solution/RegisterAndLogin/types.js +189 -76
- package/lib/solution/RegisterAndLogin/utils.js +183 -125
- package/lib/solution/Sales/index.js +218 -200
- package/lib/solution/Sales/types.js +27 -33
- package/lib/solution/ScanOrder/index.js +803 -840
- package/lib/solution/ScanOrder/types.js +34 -34
- package/lib/solution/ScanOrder/utils.js +372 -331
- package/lib/solution/ShopDiscount/index.js +230 -236
- package/lib/solution/ShopDiscount/types.js +15 -37
- package/lib/solution/ShopDiscount/utils.js +309 -172
- package/lib/solution/VenueBooking/index.d.ts +5 -0
- package/lib/solution/VenueBooking/index.js +886 -929
- package/lib/solution/VenueBooking/types.js +20 -40
- package/lib/solution/VenueBooking/utils/dateSummary.js +22 -54
- package/lib/solution/VenueBooking/utils/resource.js +31 -54
- package/lib/solution/VenueBooking/utils/slotMerge.js +88 -106
- package/lib/solution/VenueBooking/utils/smartPricing.js +112 -100
- package/lib/solution/VenueBooking/utils/timeSlot.js +133 -132
- package/lib/solution/VenueBooking/utils.js +130 -67
- package/lib/solution/index.js +102 -37
- package/lib/store/createStore.js +32 -29
- package/lib/types/index.js +4 -16
- package/lib/utils/task.js +36 -36
- package/lib/utils/watch.js +81 -47
- package/package.json +2 -1
|
@@ -84,9 +84,7 @@ export var MenuModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
84
84
|
app = appPlugin.getApp();
|
|
85
85
|
this.dbManager = app.dbManager;
|
|
86
86
|
this.logger = app.logger;
|
|
87
|
-
if (this.dbManager) {
|
|
88
|
-
console.log('[Menu] IndexDB Manager 已初始化');
|
|
89
|
-
} else {
|
|
87
|
+
if (this.dbManager) {} else {
|
|
90
88
|
console.warn('[Menu] IndexDB Manager 未找到');
|
|
91
89
|
}
|
|
92
90
|
}
|
|
@@ -262,7 +260,6 @@ export var MenuModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
262
260
|
} finally {
|
|
263
261
|
_iterator2.f();
|
|
264
262
|
}
|
|
265
|
-
console.log("[Menu] Map \u7F13\u5B58\u5DF2\u540C\u6B65\uFF0C\u5171 ".concat(this.store.map.size, " \u4E2A\u9910\u724C"));
|
|
266
263
|
}
|
|
267
264
|
|
|
268
265
|
/**
|
|
@@ -285,33 +282,31 @@ export var MenuModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
285
282
|
|
|
286
283
|
// 同时清空 IndexDB 中的数据
|
|
287
284
|
if (!this.dbManager) {
|
|
288
|
-
_context4.next =
|
|
285
|
+
_context4.next = 16;
|
|
289
286
|
break;
|
|
290
287
|
}
|
|
291
288
|
_context4.prev = 5;
|
|
292
289
|
_context4.next = 8;
|
|
293
290
|
return this.dbManager.clear(INDEXDB_STORE_NAME);
|
|
294
291
|
case 8:
|
|
295
|
-
console.log('[Menu] IndexDB 缓存已清空');
|
|
296
292
|
this.logInfo('IndexDB 缓存已清空');
|
|
297
|
-
_context4.next =
|
|
293
|
+
_context4.next = 16;
|
|
298
294
|
break;
|
|
299
|
-
case
|
|
300
|
-
_context4.prev =
|
|
295
|
+
case 11:
|
|
296
|
+
_context4.prev = 11;
|
|
301
297
|
_context4.t0 = _context4["catch"](5);
|
|
302
298
|
errorMessage = _context4.t0 instanceof Error ? _context4.t0.message : String(_context4.t0);
|
|
303
299
|
console.error('[Menu] 清空 IndexDB 缓存失败:', _context4.t0);
|
|
304
300
|
this.logError('清空 IndexDB 缓存失败', {
|
|
305
301
|
error: errorMessage
|
|
306
302
|
});
|
|
307
|
-
case
|
|
308
|
-
console.log('[Menu] 缓存已清空');
|
|
303
|
+
case 16:
|
|
309
304
|
this.logInfo('缓存清空完成');
|
|
310
|
-
case
|
|
305
|
+
case 17:
|
|
311
306
|
case "end":
|
|
312
307
|
return _context4.stop();
|
|
313
308
|
}
|
|
314
|
-
}, _callee4, this, [[5,
|
|
309
|
+
}, _callee4, this, [[5, 11]]);
|
|
315
310
|
}));
|
|
316
311
|
function clear() {
|
|
317
312
|
return _clear.apply(this, arguments);
|
|
@@ -402,14 +397,13 @@ export var MenuModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
402
397
|
_context6.next = 10;
|
|
403
398
|
return Promise.all(savePromises);
|
|
404
399
|
case 10:
|
|
405
|
-
console.log("[Menu] \u5DF2\u5C06 ".concat(menuList.length, " \u6761\u9910\u724C\u6570\u636E\u4FDD\u5B58\u5230 IndexDB"));
|
|
406
400
|
this.logInfo('餐牌数据已保存到 IndexDB', {
|
|
407
401
|
menuCount: menuList.length
|
|
408
402
|
});
|
|
409
|
-
_context6.next =
|
|
403
|
+
_context6.next = 18;
|
|
410
404
|
break;
|
|
411
|
-
case
|
|
412
|
-
_context6.prev =
|
|
405
|
+
case 13:
|
|
406
|
+
_context6.prev = 13;
|
|
413
407
|
_context6.t0 = _context6["catch"](4);
|
|
414
408
|
errorMessage = _context6.t0 instanceof Error ? _context6.t0.message : String(_context6.t0);
|
|
415
409
|
console.error('[Menu] 保存数据到 IndexDB 失败:', _context6.t0);
|
|
@@ -417,11 +411,11 @@ export var MenuModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
417
411
|
menuCount: menuList.length,
|
|
418
412
|
error: errorMessage
|
|
419
413
|
});
|
|
420
|
-
case
|
|
414
|
+
case 18:
|
|
421
415
|
case "end":
|
|
422
416
|
return _context6.stop();
|
|
423
417
|
}
|
|
424
|
-
}, _callee6, this, [[4,
|
|
418
|
+
}, _callee6, this, [[4, 13]]);
|
|
425
419
|
}));
|
|
426
420
|
function saveMenuToIndexDB(_x4) {
|
|
427
421
|
return _saveMenuToIndexDB.apply(this, arguments);
|
|
@@ -441,19 +435,17 @@ export var MenuModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
441
435
|
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
442
436
|
while (1) switch (_context7.prev = _context7.next) {
|
|
443
437
|
case 0:
|
|
444
|
-
console.log('[Menu] 开始预加载数据...');
|
|
445
438
|
startTime = Date.now();
|
|
446
439
|
this.logInfo('开始预加载数据');
|
|
447
|
-
_context7.prev =
|
|
448
|
-
_context7.next =
|
|
440
|
+
_context7.prev = 2;
|
|
441
|
+
_context7.next = 5;
|
|
449
442
|
return this.loadMenuFromIndexDB();
|
|
450
|
-
case
|
|
443
|
+
case 5:
|
|
451
444
|
cachedData = _context7.sent;
|
|
452
445
|
if (!(cachedData && cachedData.length > 0)) {
|
|
453
|
-
_context7.next =
|
|
446
|
+
_context7.next = 13;
|
|
454
447
|
break;
|
|
455
448
|
}
|
|
456
|
-
console.log("[Menu] \u4ECE IndexDB \u52A0\u8F7D\u4E86 ".concat(cachedData.length, " \u6761\u9910\u724C\u6570\u636E"));
|
|
457
449
|
// 将缓存数据放入 store
|
|
458
450
|
this.store.menuList = cloneDeep(cachedData);
|
|
459
451
|
// 同步更新 Map 缓存
|
|
@@ -466,31 +458,30 @@ export var MenuModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
466
458
|
source: 'IndexDB'
|
|
467
459
|
});
|
|
468
460
|
return _context7.abrupt("return");
|
|
469
|
-
case
|
|
470
|
-
console.log('[Menu] IndexDB 中没有缓存数据,从服务器加载...');
|
|
461
|
+
case 13:
|
|
471
462
|
this.logInfo('IndexDB 中没有缓存数据,准备从服务器加载');
|
|
472
|
-
_context7.next =
|
|
463
|
+
_context7.next = 21;
|
|
473
464
|
break;
|
|
474
|
-
case
|
|
475
|
-
_context7.prev =
|
|
476
|
-
_context7.t0 = _context7["catch"](
|
|
465
|
+
case 16:
|
|
466
|
+
_context7.prev = 16;
|
|
467
|
+
_context7.t0 = _context7["catch"](2);
|
|
477
468
|
errorMessage = _context7.t0 instanceof Error ? _context7.t0.message : String(_context7.t0);
|
|
478
469
|
console.warn('[Menu] 从 IndexDB 加载数据失败:', _context7.t0);
|
|
479
470
|
this.logWarning('从 IndexDB 加载数据失败,准备从服务器加载', {
|
|
480
471
|
error: errorMessage
|
|
481
472
|
});
|
|
482
|
-
case
|
|
483
|
-
_context7.next =
|
|
473
|
+
case 21:
|
|
474
|
+
_context7.next = 23;
|
|
484
475
|
return this.loadMenuList();
|
|
485
|
-
case
|
|
476
|
+
case 23:
|
|
486
477
|
menuList = _context7.sent;
|
|
487
478
|
if (!(menuList && menuList.length > 0)) {
|
|
488
|
-
_context7.next =
|
|
479
|
+
_context7.next = 34;
|
|
489
480
|
break;
|
|
490
481
|
}
|
|
491
|
-
_context7.next =
|
|
482
|
+
_context7.next = 27;
|
|
492
483
|
return this.saveMenuToIndexDB(menuList);
|
|
493
|
-
case
|
|
484
|
+
case 27:
|
|
494
485
|
this.store.menuList = cloneDeep(menuList);
|
|
495
486
|
// 同步更新 Map 缓存
|
|
496
487
|
this.syncMenuMap();
|
|
@@ -501,18 +492,18 @@ export var MenuModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
501
492
|
duration: "".concat(_duration2, "ms"),
|
|
502
493
|
source: 'Server'
|
|
503
494
|
});
|
|
504
|
-
_context7.next =
|
|
495
|
+
_context7.next = 36;
|
|
505
496
|
break;
|
|
506
|
-
case
|
|
497
|
+
case 34:
|
|
507
498
|
_duration3 = Date.now() - startTime;
|
|
508
499
|
this.logWarning('预加载完成但未获取到数据', {
|
|
509
500
|
duration: "".concat(_duration3, "ms")
|
|
510
501
|
});
|
|
511
|
-
case
|
|
502
|
+
case 36:
|
|
512
503
|
case "end":
|
|
513
504
|
return _context7.stop();
|
|
514
505
|
}
|
|
515
|
-
}, _callee7, this, [[
|
|
506
|
+
}, _callee7, this, [[2, 16]]);
|
|
516
507
|
}));
|
|
517
508
|
function preload() {
|
|
518
509
|
return _preload.apply(this, arguments);
|
|
@@ -105,9 +105,7 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
105
105
|
app = appPlugin.getApp();
|
|
106
106
|
this.dbManager = app.dbManager;
|
|
107
107
|
this.logger = app.logger;
|
|
108
|
-
if (this.dbManager) {
|
|
109
|
-
console.log('[Products] IndexDB Manager 已初始化');
|
|
110
|
-
} else {
|
|
108
|
+
if (this.dbManager) {} else {
|
|
111
109
|
console.warn('[Products] IndexDB Manager 未找到');
|
|
112
110
|
}
|
|
113
111
|
}
|
|
@@ -516,14 +514,13 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
516
514
|
_context4.prev = 27;
|
|
517
515
|
_context4.t0 = _context4["catch"](4);
|
|
518
516
|
errorMessage = _context4.t0 instanceof Error ? _context4.t0.message : String(_context4.t0);
|
|
519
|
-
console.log("[ProductsModule] \uD83C\uDF10 ERROR", _context4.t0);
|
|
520
517
|
this.logError('prepareProductsWithPrice 处理失败', {
|
|
521
518
|
schedule_date: schedule_date,
|
|
522
519
|
error: errorMessage
|
|
523
520
|
});
|
|
524
|
-
case
|
|
521
|
+
case 31:
|
|
525
522
|
return _context4.abrupt("return", []);
|
|
526
|
-
case
|
|
523
|
+
case 32:
|
|
527
524
|
case "end":
|
|
528
525
|
return _context4.stop();
|
|
529
526
|
}
|
|
@@ -633,10 +630,8 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
633
630
|
// 创建价格格式化器
|
|
634
631
|
var priceFormatter = function priceFormatter(products, context) {
|
|
635
632
|
if (!context.priceData || context.priceData.length === 0) {
|
|
636
|
-
console.log('[ProductsModule] 💰 没有价格数据,跳过价格应用');
|
|
637
633
|
return products;
|
|
638
634
|
}
|
|
639
|
-
console.log("[ProductsModule] \uD83D\uDCB0 \u5E94\u7528\u4EF7\u683C\u6570\u636E\u5230 ".concat(products.length, " \u4E2A\u5546\u54C1"));
|
|
640
635
|
return applyPriceDataToProducts(products, context.priceData);
|
|
641
636
|
};
|
|
642
637
|
var i18nFormatter = function i18nFormatter(products, context) {
|
|
@@ -651,7 +646,6 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
651
646
|
this.formatters.push(i18nFormatter);
|
|
652
647
|
this.formatters.push(detailValueFormatter);
|
|
653
648
|
this.isPriceFormatterRegistered = true;
|
|
654
|
-
console.log('[ProductsModule] ✅ 内置价格格式化器已注册(第 1 个)');
|
|
655
649
|
}
|
|
656
650
|
|
|
657
651
|
/**
|
|
@@ -677,11 +671,9 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
677
671
|
// 插入到价格格式化器之后(索引 1 的位置)
|
|
678
672
|
var insertIndex = this.isPriceFormatterRegistered ? 1 : 0;
|
|
679
673
|
this.formatters.splice(insertIndex, 0, formatter);
|
|
680
|
-
console.log("[ProductsModule] \uD83D\uDCCC \u5DF2\u5728\u4F4D\u7F6E ".concat(insertIndex + 1, " \u63D2\u5165\u683C\u5F0F\u5316\u5668\uFF0C\u5F53\u524D\u5171 ").concat(this.formatters.length, " \u4E2A"));
|
|
681
674
|
} else {
|
|
682
675
|
// 追加到末尾
|
|
683
676
|
this.formatters.push(formatter);
|
|
684
|
-
console.log("[ProductsModule] \uD83D\uDCCC \u5DF2\u6CE8\u518C\u683C\u5F0F\u5316\u5668\uFF0C\u5F53\u524D\u5171 ".concat(this.formatters.length, " \u4E2A"));
|
|
685
677
|
}
|
|
686
678
|
}
|
|
687
679
|
|
|
@@ -696,11 +688,9 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
696
688
|
if (keepBuiltin && this.isPriceFormatterRegistered) {
|
|
697
689
|
// 只保留第一个格式化器(内置价格格式化器)
|
|
698
690
|
this.formatters = [this.formatters[0]];
|
|
699
|
-
console.log('[ProductsModule] 🧹 已清空自定义格式化器,保留内置价格格式化器');
|
|
700
691
|
} else {
|
|
701
692
|
this.formatters = [];
|
|
702
693
|
this.isPriceFormatterRegistered = false;
|
|
703
|
-
console.log('[ProductsModule] 🧹 已清空所有格式化器');
|
|
704
694
|
}
|
|
705
695
|
}
|
|
706
696
|
|
|
@@ -716,7 +706,6 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
716
706
|
var keys = Array.from(this.productsPriceCache.keys());
|
|
717
707
|
var oldestKey = keys[0];
|
|
718
708
|
this.productsPriceCache.delete(oldestKey);
|
|
719
|
-
console.log("[ProductsModule] \uD83E\uDDF9 \u6E05\u7406\u8FC7\u671F\u5546\u54C1\u4EF7\u683C\u7F13\u5B58: ".concat(oldestKey));
|
|
720
709
|
}
|
|
721
710
|
}
|
|
722
711
|
|
|
@@ -728,7 +717,6 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
728
717
|
key: "clearPriceCache",
|
|
729
718
|
value: function clearPriceCache() {
|
|
730
719
|
this.productsPriceCache.clear();
|
|
731
|
-
console.log('[ProductsModule] 🗑️ 商品价格缓存已清空');
|
|
732
720
|
}
|
|
733
721
|
|
|
734
722
|
/**
|
|
@@ -1147,33 +1135,31 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1147
1135
|
|
|
1148
1136
|
// 同时清空 IndexDB 中的所有数据(包括商品和元数据)
|
|
1149
1137
|
if (!this.dbManager) {
|
|
1150
|
-
_context13.next =
|
|
1138
|
+
_context13.next = 15;
|
|
1151
1139
|
break;
|
|
1152
1140
|
}
|
|
1153
1141
|
_context13.prev = 4;
|
|
1154
1142
|
_context13.next = 7;
|
|
1155
1143
|
return this.dbManager.clear(INDEXDB_STORE_NAME);
|
|
1156
1144
|
case 7:
|
|
1157
|
-
console.log('[Products] IndexDB 缓存已清空');
|
|
1158
1145
|
this.logInfo('IndexDB 缓存已清空');
|
|
1159
|
-
_context13.next =
|
|
1146
|
+
_context13.next = 15;
|
|
1160
1147
|
break;
|
|
1161
|
-
case
|
|
1162
|
-
_context13.prev =
|
|
1148
|
+
case 10:
|
|
1149
|
+
_context13.prev = 10;
|
|
1163
1150
|
_context13.t0 = _context13["catch"](4);
|
|
1164
1151
|
errorMessage = _context13.t0 instanceof Error ? _context13.t0.message : String(_context13.t0);
|
|
1165
1152
|
console.error('[Products] 清空 IndexDB 缓存失败:', _context13.t0);
|
|
1166
1153
|
this.logError('清空 IndexDB 缓存失败', {
|
|
1167
1154
|
error: errorMessage
|
|
1168
1155
|
});
|
|
1169
|
-
case
|
|
1170
|
-
console.log('[Products] 缓存已清空');
|
|
1156
|
+
case 15:
|
|
1171
1157
|
this.logInfo('缓存清空完成');
|
|
1172
|
-
case
|
|
1158
|
+
case 16:
|
|
1173
1159
|
case "end":
|
|
1174
1160
|
return _context13.stop();
|
|
1175
1161
|
}
|
|
1176
|
-
}, _callee13, this, [[4,
|
|
1162
|
+
}, _callee13, this, [[4, 10]]);
|
|
1177
1163
|
}));
|
|
1178
1164
|
function clear() {
|
|
1179
1165
|
return _clear.apply(this, arguments);
|
|
@@ -1267,14 +1253,13 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1267
1253
|
perfMark('saveProductsToIndexDB', performance.now() - t0, {
|
|
1268
1254
|
count: products.length
|
|
1269
1255
|
});
|
|
1270
|
-
console.log("[Products] \u5DF2\u5C06 ".concat(products.length, " \u4E2A\u5546\u54C1\u5E73\u94FA\u4FDD\u5B58\u5230 IndexDB"));
|
|
1271
1256
|
this.logInfo('商品数据已保存到 IndexDB', {
|
|
1272
1257
|
productCount: products.length
|
|
1273
1258
|
});
|
|
1274
|
-
_context15.next =
|
|
1259
|
+
_context15.next = 19;
|
|
1275
1260
|
break;
|
|
1276
|
-
case
|
|
1277
|
-
_context15.prev =
|
|
1261
|
+
case 14:
|
|
1262
|
+
_context15.prev = 14;
|
|
1278
1263
|
_context15.t0 = _context15["catch"](4);
|
|
1279
1264
|
errorMessage = _context15.t0 instanceof Error ? _context15.t0.message : String(_context15.t0);
|
|
1280
1265
|
console.error('[Products] 保存数据到 IndexDB 失败:', _context15.t0);
|
|
@@ -1282,11 +1267,11 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1282
1267
|
productCount: products.length,
|
|
1283
1268
|
error: errorMessage
|
|
1284
1269
|
});
|
|
1285
|
-
case
|
|
1270
|
+
case 19:
|
|
1286
1271
|
case "end":
|
|
1287
1272
|
return _context15.stop();
|
|
1288
1273
|
}
|
|
1289
|
-
}, _callee15, this, [[4,
|
|
1274
|
+
}, _callee15, this, [[4, 14]]);
|
|
1290
1275
|
}));
|
|
1291
1276
|
function saveProductsToIndexDB(_x16) {
|
|
1292
1277
|
return _saveProductsToIndexDB.apply(this, arguments);
|
|
@@ -1334,23 +1319,21 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1334
1319
|
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
1335
1320
|
while (1) switch (_context16.prev = _context16.next) {
|
|
1336
1321
|
case 0:
|
|
1337
|
-
console.log('[Products] 开始预加载数据...');
|
|
1338
1322
|
tTotal = performance.now();
|
|
1339
1323
|
this.logInfo('开始预加载数据');
|
|
1340
|
-
_context16.prev =
|
|
1324
|
+
_context16.prev = 2;
|
|
1341
1325
|
tIndexDB = performance.now();
|
|
1342
|
-
_context16.next =
|
|
1326
|
+
_context16.next = 6;
|
|
1343
1327
|
return this.loadProductsFromIndexDB();
|
|
1344
|
-
case
|
|
1328
|
+
case 6:
|
|
1345
1329
|
cachedData = _context16.sent;
|
|
1346
1330
|
perfMark('preload.loadFromIndexDB', performance.now() - tIndexDB, {
|
|
1347
1331
|
count: (_cachedData$length = cachedData === null || cachedData === void 0 ? void 0 : cachedData.length) !== null && _cachedData$length !== void 0 ? _cachedData$length : 0
|
|
1348
1332
|
});
|
|
1349
1333
|
if (!(cachedData && cachedData.length > 0)) {
|
|
1350
|
-
_context16.next =
|
|
1334
|
+
_context16.next = 17;
|
|
1351
1335
|
break;
|
|
1352
1336
|
}
|
|
1353
|
-
console.log("[Products] \u4ECE IndexDB \u52A0\u8F7D\u4E86 ".concat(cachedData.length, " \u4E2A\u5546\u54C1"));
|
|
1354
1337
|
// IndexDB 反序列化的数据已经是全新的,无需 cloneDeep
|
|
1355
1338
|
this.store.list = cachedData;
|
|
1356
1339
|
tSync = performance.now();
|
|
@@ -1369,24 +1352,23 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1369
1352
|
source: 'IndexDB'
|
|
1370
1353
|
});
|
|
1371
1354
|
return _context16.abrupt("return");
|
|
1372
|
-
case
|
|
1373
|
-
console.log('[Products] IndexDB 中没有缓存数据,从服务器加载...');
|
|
1355
|
+
case 17:
|
|
1374
1356
|
this.logInfo('IndexDB 中没有缓存数据,准备从服务器加载');
|
|
1375
|
-
_context16.next =
|
|
1357
|
+
_context16.next = 25;
|
|
1376
1358
|
break;
|
|
1377
|
-
case
|
|
1378
|
-
_context16.prev =
|
|
1379
|
-
_context16.t0 = _context16["catch"](
|
|
1359
|
+
case 20:
|
|
1360
|
+
_context16.prev = 20;
|
|
1361
|
+
_context16.t0 = _context16["catch"](2);
|
|
1380
1362
|
errorMessage = _context16.t0 instanceof Error ? _context16.t0.message : String(_context16.t0);
|
|
1381
1363
|
console.warn('[Products] 从 IndexDB 加载数据失败:', _context16.t0);
|
|
1382
1364
|
this.logWarning('从 IndexDB 加载数据失败,准备从服务器加载', {
|
|
1383
1365
|
error: errorMessage
|
|
1384
1366
|
});
|
|
1385
|
-
case
|
|
1367
|
+
case 25:
|
|
1386
1368
|
tServer = performance.now();
|
|
1387
|
-
_context16.next =
|
|
1369
|
+
_context16.next = 28;
|
|
1388
1370
|
return this.loadProductsByServer();
|
|
1389
|
-
case
|
|
1371
|
+
case 28:
|
|
1390
1372
|
products = _context16.sent;
|
|
1391
1373
|
perfMark('preload.loadFromServer', performance.now() - tServer, {
|
|
1392
1374
|
count: (_products$length3 = products === null || products === void 0 ? void 0 : products.length) !== null && _products$length3 !== void 0 ? _products$length3 : 0
|
|
@@ -1417,11 +1399,11 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1417
1399
|
duration: "".concat(Math.round(performance.now() - tTotal), "ms")
|
|
1418
1400
|
});
|
|
1419
1401
|
}
|
|
1420
|
-
case
|
|
1402
|
+
case 31:
|
|
1421
1403
|
case "end":
|
|
1422
1404
|
return _context16.stop();
|
|
1423
1405
|
}
|
|
1424
|
-
}, _callee16, this, [[
|
|
1406
|
+
}, _callee16, this, [[2, 20]]);
|
|
1425
1407
|
}));
|
|
1426
1408
|
function preload() {
|
|
1427
1409
|
return _preload.apply(this, arguments);
|
|
@@ -1465,7 +1447,6 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1465
1447
|
return function (message) {
|
|
1466
1448
|
var data = (message === null || message === void 0 ? void 0 : message.data) || message;
|
|
1467
1449
|
if (!data) return;
|
|
1468
|
-
console.log("[ProductsModule] \u6536\u5230\u540C\u6B65\u6D88\u606F [".concat(channelKey, "]:"), data);
|
|
1469
1450
|
_this2.logInfo('收到同步消息', {
|
|
1470
1451
|
channelKey: channelKey,
|
|
1471
1452
|
action: data.action,
|
|
@@ -1486,7 +1467,6 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1486
1467
|
this.productDataSource.run({
|
|
1487
1468
|
pubsub: {
|
|
1488
1469
|
callback: function callback(res) {
|
|
1489
|
-
console.log('sse_products_callback', res);
|
|
1490
1470
|
_this2.logInfo('sse_products_callback: 收到同步消息', {
|
|
1491
1471
|
data: res === null || res === void 0 ? void 0 : res.data
|
|
1492
1472
|
});
|
|
@@ -74,9 +74,7 @@ export var QuotationModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
74
74
|
if (appPlugin) {
|
|
75
75
|
app = appPlugin.getApp();
|
|
76
76
|
this.dbManager = app.dbManager;
|
|
77
|
-
if (this.dbManager) {
|
|
78
|
-
console.log('[Quotation] IndexDB Manager 已初始化');
|
|
79
|
-
} else {
|
|
77
|
+
if (this.dbManager) {} else {
|
|
80
78
|
console.warn('[Quotation] IndexDB Manager 未找到');
|
|
81
79
|
}
|
|
82
80
|
}
|
|
@@ -184,27 +182,24 @@ export var QuotationModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
184
182
|
|
|
185
183
|
// 同时清空 IndexDB 中的数据
|
|
186
184
|
if (!this.dbManager) {
|
|
187
|
-
_context4.next =
|
|
185
|
+
_context4.next = 10;
|
|
188
186
|
break;
|
|
189
187
|
}
|
|
190
188
|
_context4.prev = 2;
|
|
191
189
|
_context4.next = 5;
|
|
192
190
|
return this.dbManager.clear(INDEXDB_STORE_NAME);
|
|
193
191
|
case 5:
|
|
194
|
-
|
|
195
|
-
_context4.next = 11;
|
|
192
|
+
_context4.next = 10;
|
|
196
193
|
break;
|
|
197
|
-
case
|
|
198
|
-
_context4.prev =
|
|
194
|
+
case 7:
|
|
195
|
+
_context4.prev = 7;
|
|
199
196
|
_context4.t0 = _context4["catch"](2);
|
|
200
197
|
console.error('[Quotation] 清空 IndexDB 缓存失败:', _context4.t0);
|
|
201
|
-
case
|
|
202
|
-
console.log('[Quotation] 缓存已清空');
|
|
203
|
-
case 12:
|
|
198
|
+
case 10:
|
|
204
199
|
case "end":
|
|
205
200
|
return _context4.stop();
|
|
206
201
|
}
|
|
207
|
-
}, _callee4, this, [[2,
|
|
202
|
+
}, _callee4, this, [[2, 7]]);
|
|
208
203
|
}));
|
|
209
204
|
function clear() {
|
|
210
205
|
return _clear.apply(this, arguments);
|
|
@@ -283,18 +278,17 @@ export var QuotationModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
283
278
|
_context6.next = 8;
|
|
284
279
|
return Promise.all(savePromises);
|
|
285
280
|
case 8:
|
|
286
|
-
|
|
287
|
-
_context6.next = 14;
|
|
281
|
+
_context6.next = 13;
|
|
288
282
|
break;
|
|
289
|
-
case
|
|
290
|
-
_context6.prev =
|
|
283
|
+
case 10:
|
|
284
|
+
_context6.prev = 10;
|
|
291
285
|
_context6.t0 = _context6["catch"](2);
|
|
292
286
|
console.error('[Quotation] 保存数据到 IndexDB 失败:', _context6.t0);
|
|
293
|
-
case
|
|
287
|
+
case 13:
|
|
294
288
|
case "end":
|
|
295
289
|
return _context6.stop();
|
|
296
290
|
}
|
|
297
|
-
}, _callee6, this, [[2,
|
|
291
|
+
}, _callee6, this, [[2, 10]]);
|
|
298
292
|
}));
|
|
299
293
|
function saveQuotationToIndexDB(_x4) {
|
|
300
294
|
return _saveQuotationToIndexDB.apply(this, arguments);
|
|
@@ -314,48 +308,45 @@ export var QuotationModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
314
308
|
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
315
309
|
while (1) switch (_context7.prev = _context7.next) {
|
|
316
310
|
case 0:
|
|
317
|
-
|
|
318
|
-
_context7.
|
|
319
|
-
_context7.next = 4;
|
|
311
|
+
_context7.prev = 0;
|
|
312
|
+
_context7.next = 3;
|
|
320
313
|
return this.loadQuotationFromIndexDB();
|
|
321
|
-
case
|
|
314
|
+
case 3:
|
|
322
315
|
cachedData = _context7.sent;
|
|
323
316
|
if (!(cachedData && cachedData.length > 0)) {
|
|
324
|
-
_context7.next =
|
|
317
|
+
_context7.next = 8;
|
|
325
318
|
break;
|
|
326
319
|
}
|
|
327
|
-
console.log("[Quotation] \u4ECE IndexDB \u52A0\u8F7D\u4E86 ".concat(cachedData.length, " \u6761\u62A5\u4EF7\u5355\u6570\u636E"));
|
|
328
320
|
// 将缓存数据放入 store
|
|
329
321
|
this.store.quotationList = cloneDeep(cachedData);
|
|
330
322
|
this.core.effects.emit(QuotationHooks.onQuotationChanged, this.store.quotationList);
|
|
331
323
|
return _context7.abrupt("return");
|
|
332
|
-
case
|
|
333
|
-
|
|
334
|
-
_context7.next = 16;
|
|
324
|
+
case 8:
|
|
325
|
+
_context7.next = 13;
|
|
335
326
|
break;
|
|
336
|
-
case
|
|
337
|
-
_context7.prev =
|
|
338
|
-
_context7.t0 = _context7["catch"](
|
|
327
|
+
case 10:
|
|
328
|
+
_context7.prev = 10;
|
|
329
|
+
_context7.t0 = _context7["catch"](0);
|
|
339
330
|
console.warn('[Quotation] 从 IndexDB 加载数据失败:', _context7.t0);
|
|
340
|
-
case
|
|
341
|
-
_context7.next =
|
|
331
|
+
case 13:
|
|
332
|
+
_context7.next = 15;
|
|
342
333
|
return this.loadQuotationList();
|
|
343
|
-
case
|
|
334
|
+
case 15:
|
|
344
335
|
quotationList = _context7.sent;
|
|
345
336
|
if (!(quotationList && quotationList.length > 0)) {
|
|
346
|
-
_context7.next =
|
|
337
|
+
_context7.next = 21;
|
|
347
338
|
break;
|
|
348
339
|
}
|
|
349
|
-
_context7.next =
|
|
340
|
+
_context7.next = 19;
|
|
350
341
|
return this.saveQuotationToIndexDB(quotationList);
|
|
351
|
-
case
|
|
342
|
+
case 19:
|
|
352
343
|
this.store.quotationList = cloneDeep(quotationList);
|
|
353
344
|
this.core.effects.emit(QuotationHooks.onQuotationChanged, this.store.quotationList);
|
|
354
|
-
case
|
|
345
|
+
case 21:
|
|
355
346
|
case "end":
|
|
356
347
|
return _context7.stop();
|
|
357
348
|
}
|
|
358
|
-
}, _callee7, this, [[
|
|
349
|
+
}, _callee7, this, [[0, 10]]);
|
|
359
350
|
}));
|
|
360
351
|
function preload() {
|
|
361
352
|
return _preload.apply(this, arguments);
|
|
@@ -771,14 +771,13 @@ export var ResourceModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
771
771
|
});
|
|
772
772
|
case 4:
|
|
773
773
|
result = _context8.sent;
|
|
774
|
-
console.log('result', result);
|
|
775
774
|
if (!(result !== null && result !== void 0 && (_result$data = result.data) !== null && _result$data !== void 0 && (_result$data = _result$data.list) !== null && _result$data !== void 0 && _result$data.length)) {
|
|
776
|
-
_context8.next =
|
|
775
|
+
_context8.next = 8;
|
|
777
776
|
break;
|
|
778
777
|
}
|
|
779
|
-
_context8.next =
|
|
778
|
+
_context8.next = 8;
|
|
780
779
|
return this.mergeResourcesToStore(result === null || result === void 0 || (_result$data2 = result.data) === null || _result$data2 === void 0 ? void 0 : _result$data2.list);
|
|
781
|
-
case
|
|
780
|
+
case 8:
|
|
782
781
|
case "end":
|
|
783
782
|
return _context8.stop();
|
|
784
783
|
}
|