@pisell/pisellos 2.3.59 → 2.3.61

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 (46) hide show
  1. package/dist/core/index.d.ts +0 -7
  2. package/dist/core/index.js +66 -109
  3. package/dist/model/strategy/adapter/walletPass/evaluator.js +0 -1
  4. package/dist/model/strategy/adapter/walletPass/type.d.ts +5 -0
  5. package/dist/model/strategy/adapter/walletPass/utils.js +57 -24
  6. package/dist/modules/Payment/types.d.ts +2 -0
  7. package/dist/modules/Payment/utils.js +4 -1
  8. package/dist/modules/Payment/walletpass.d.ts +11 -0
  9. package/dist/modules/Payment/walletpass.js +204 -49
  10. package/dist/modules/ProductList/index.js +2 -1
  11. package/dist/modules/Quotation/index.d.ts +0 -6
  12. package/dist/modules/Quotation/index.js +19 -75
  13. package/dist/plugins/request.d.ts +0 -1
  14. package/dist/server/index.js +62 -74
  15. package/dist/server/modules/floor-plan/index.d.ts +0 -4
  16. package/dist/server/modules/floor-plan/index.js +98 -240
  17. package/dist/server/modules/order/index.d.ts +5 -6
  18. package/dist/server/modules/order/index.js +78 -176
  19. package/dist/server/modules/products/index.d.ts +0 -2
  20. package/dist/server/modules/products/index.js +3 -17
  21. package/dist/server/modules/resource/index.js +13 -21
  22. package/dist/solution/BaseSales/index.d.ts +5 -0
  23. package/dist/solution/BaseSales/index.js +311 -281
  24. package/lib/core/index.d.ts +0 -7
  25. package/lib/core/index.js +3 -20
  26. package/lib/model/strategy/adapter/walletPass/evaluator.js +0 -1
  27. package/lib/model/strategy/adapter/walletPass/type.d.ts +5 -0
  28. package/lib/model/strategy/adapter/walletPass/utils.js +62 -10
  29. package/lib/modules/Payment/types.d.ts +2 -0
  30. package/lib/modules/Payment/utils.js +5 -1
  31. package/lib/modules/Payment/walletpass.d.ts +11 -0
  32. package/lib/modules/Payment/walletpass.js +183 -15
  33. package/lib/modules/ProductList/index.js +2 -1
  34. package/lib/modules/Quotation/index.d.ts +0 -6
  35. package/lib/modules/Quotation/index.js +5 -49
  36. package/lib/plugins/request.d.ts +0 -1
  37. package/lib/server/modules/floor-plan/index.d.ts +0 -4
  38. package/lib/server/modules/floor-plan/index.js +6 -54
  39. package/lib/server/modules/order/index.d.ts +5 -6
  40. package/lib/server/modules/order/index.js +23 -105
  41. package/lib/server/modules/products/index.d.ts +0 -2
  42. package/lib/server/modules/products/index.js +4 -15
  43. package/lib/server/modules/resource/index.js +2 -7
  44. package/lib/solution/BaseSales/index.d.ts +5 -0
  45. package/lib/solution/BaseSales/index.js +11 -0
  46. package/package.json +1 -1
@@ -42,7 +42,6 @@ import { getOrderPaymentIdentityKeys, isIdentifiedPendingOrderPayment, isPending
42
42
  */
43
43
  var INDEXDB_STORE_NAME = 'orders';
44
44
  var ORDER_LAST_FULL_FETCH_AT_STORAGE_KEY = 'server_order_last_full_fetch_at';
45
- var ORDER_LAST_FULL_FETCH_SHOP_ID_STORAGE_KEY = 'server_order_last_full_fetch_shop_id';
46
45
  var ORDER_SYNC_THROTTLE_MS_STORAGE_KEY = 'order_sync_throttle_ms';
47
46
  var DEFAULT_ORDER_SYNC_THROTTLE_MS = 2000;
48
47
  /** pubsub 回声写入去重窗口:业务 API 刚写入后,跳过同单 SQLite patch */
@@ -701,62 +700,26 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
701
700
  key: "preload",
702
701
  value: function () {
703
702
  var _preload = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
704
- var cachedOrders, memoryOrders, orders;
703
+ var orders;
705
704
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
706
705
  while (1) switch (_context4.prev = _context4.next) {
707
706
  case 0:
708
- cachedOrders = null;
709
- if (!this.dbManager) {
710
- _context4.next = 11;
711
- break;
712
- }
713
- _context4.prev = 2;
714
- _context4.next = 5;
715
- return this.loadOrdersFromSQLite({
716
- throwOnError: true
717
- });
718
- case 5:
719
- cachedOrders = _context4.sent;
720
- _context4.next = 11;
721
- break;
722
- case 8:
723
- _context4.prev = 8;
724
- _context4.t0 = _context4["catch"](2);
725
- this.logWarning('preload-SQLite读取失败,回退远端全量拉取', {
726
- error: _context4.t0 instanceof Error ? _context4.t0.message : String(_context4.t0)
727
- });
728
- case 11:
729
- if (!(cachedOrders !== null && this.hasPulledOrdersToday())) {
730
- _context4.next = 20;
731
- break;
732
- }
733
- memoryOrders = this.normalizeOrdersForMemoryList(cachedOrders, 'preload.sqliteMemory');
734
- this.store.list = cloneDeep(memoryOrders);
735
- this.syncOrdersMap();
736
- _context4.next = 17;
737
- return this.core.effects.emit(OrderHooks.onOrdersLoaded, this.store.list);
738
- case 17:
739
- _context4.next = 19;
740
- return this.emitOrdersChanged([], 'preload.sqlite');
741
- case 19:
742
- return _context4.abrupt("return");
743
- case 20:
744
- _context4.next = 22;
707
+ _context4.next = 2;
745
708
  return this.loadOrdersByServer();
746
- case 22:
709
+ case 2:
747
710
  orders = _context4.sent;
748
711
  this.store.list = cloneDeep(orders);
749
712
  this.syncOrdersMap();
750
- _context4.next = 27;
713
+ _context4.next = 7;
751
714
  return this.emitOrdersChanged([], 'preload');
752
- case 27:
753
- _context4.next = 29;
715
+ case 7:
716
+ _context4.next = 9;
754
717
  return this.core.effects.emit(OrderHooks.onOrdersSyncCompleted, null);
755
- case 29:
718
+ case 9:
756
719
  case "end":
757
720
  return _context4.stop();
758
721
  }
759
- }, _callee4, this, [[2, 8]]);
722
+ }, _callee4, this);
760
723
  }));
761
724
  function preload() {
762
725
  return _preload.apply(this, arguments);
@@ -1089,15 +1052,14 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
1089
1052
  var _loadOrdersByServer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
1090
1053
  var _this5 = this,
1091
1054
  _this$store;
1092
- var orderList, hasFetchedRemoteSnapshot, protectedOrdersBeforeRemoteFetch, data, _yield$this$replaceOr, mergedOrders, isRemoteSnapshotPersisted, memoryOrders;
1055
+ var orderList, protectedOrdersBeforeRemoteFetch, data, mergedOrders, memoryOrders;
1093
1056
  return _regeneratorRuntime().wrap(function _callee8$(_context8) {
1094
1057
  while (1) switch (_context8.prev = _context8.next) {
1095
1058
  case 0:
1096
1059
  orderList = [];
1097
- hasFetchedRemoteSnapshot = false;
1098
- _context8.next = 4;
1060
+ _context8.next = 3;
1099
1061
  return this.loadOrdersFromSQLite();
1100
- case 4:
1062
+ case 3:
1101
1063
  protectedOrdersBeforeRemoteFetch = _context8.sent.filter(function (order) {
1102
1064
  return _this5.shouldProtectLocalOrderFromRemoteSnapshot(order);
1103
1065
  });
@@ -1110,59 +1072,51 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
1110
1072
  }, 0)
1111
1073
  });
1112
1074
  if (!this.orderDataSource) {
1113
- _context8.next = 21;
1075
+ _context8.next = 20;
1114
1076
  break;
1115
1077
  }
1116
- _context8.prev = 7;
1117
- _context8.next = 10;
1078
+ _context8.prev = 6;
1079
+ _context8.next = 9;
1118
1080
  return this.orderDataSource.run({
1119
1081
  sse: {
1120
1082
  query: this.store.createdAtQuery
1121
1083
  }
1122
1084
  });
1123
- case 10:
1085
+ case 9:
1124
1086
  data = _context8.sent;
1125
1087
  orderList = data || [];
1126
1088
  this.logInfo('loadOrdersByServer-SSE拉取成功', {
1127
1089
  count: orderList.length
1128
1090
  });
1129
- hasFetchedRemoteSnapshot = true;
1091
+ this.markOrderPulledAtNow();
1130
1092
  this.lastServerFullFetchAtMs = Date.now();
1131
- _context8.next = 21;
1093
+ _context8.next = 20;
1132
1094
  break;
1133
- case 17:
1134
- _context8.prev = 17;
1135
- _context8.t0 = _context8["catch"](7);
1095
+ case 16:
1096
+ _context8.prev = 16;
1097
+ _context8.t0 = _context8["catch"](6);
1136
1098
  this.logInfo('loadOrdersByServer-SSE拉取失败,保持当前内存订单');
1137
1099
  return _context8.abrupt("return", this.store.list);
1138
- case 21:
1139
- if (hasFetchedRemoteSnapshot) {
1140
- this.clearOrderSnapshotMarker();
1141
- }
1142
- _context8.next = 24;
1100
+ case 20:
1101
+ _context8.next = 22;
1143
1102
  return this.replaceOrdersSnapshotInSQLite(orderList, 'loadOrdersByServer', protectedOrdersBeforeRemoteFetch);
1144
- case 24:
1145
- _yield$this$replaceOr = _context8.sent;
1146
- mergedOrders = _yield$this$replaceOr.orders;
1147
- isRemoteSnapshotPersisted = _yield$this$replaceOr.persisted;
1148
- if (hasFetchedRemoteSnapshot && isRemoteSnapshotPersisted) {
1149
- this.markOrderPulledAtNow();
1150
- }
1103
+ case 22:
1104
+ mergedOrders = _context8.sent;
1151
1105
  memoryOrders = this.normalizeOrdersForMemoryList(mergedOrders, 'loadOrdersByServer.memory');
1152
1106
  this.logInfo('loadOrdersByServer-结束', {
1153
1107
  count: memoryOrders.length,
1154
1108
  persistedCount: mergedOrders.length,
1155
1109
  sqliteOnlyDraftCount: mergedOrders.length - memoryOrders.length
1156
1110
  });
1157
- _context8.next = 32;
1111
+ _context8.next = 27;
1158
1112
  return this.core.effects.emit(OrderHooks.onOrdersLoaded, memoryOrders);
1159
- case 32:
1113
+ case 27:
1160
1114
  return _context8.abrupt("return", memoryOrders);
1161
- case 33:
1115
+ case 28:
1162
1116
  case "end":
1163
1117
  return _context8.stop();
1164
1118
  }
1165
- }, _callee8, this, [[7, 17]]);
1119
+ }, _callee8, this, [[6, 16]]);
1166
1120
  }));
1167
1121
  function loadOrdersByServer() {
1168
1122
  return _loadOrdersByServer.apply(this, arguments);
@@ -3239,32 +3193,25 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
3239
3193
  }
3240
3194
 
3241
3195
  /**
3242
- * 当前订单缓存可复用窗口。
3243
- * start_time 模式使用精确的营业日起止时间;配置缺失或异常时退化为自然日。
3196
+ * 当前订单拉取窗口:
3197
+ * - 优先使用 createdAtQuery.sales_time_between(已按营业日边界初始化)
3198
+ * - 无法解析时退化为自然日窗口
3244
3199
  */
3245
3200
  }, {
3246
- key: "getCurrentOrderCacheWindow",
3247
- value: function getCurrentOrderCacheWindow() {
3201
+ key: "getCurrentPullWindow",
3202
+ value: function getCurrentPullWindow() {
3203
+ var _this$store2;
3248
3204
  var now = dayjs();
3249
- try {
3250
- var _coreData$core;
3251
- var appPlugin = this.core.getPlugin('app');
3252
- var app = appPlugin === null || appPlugin === void 0 ? void 0 : appPlugin.getApp();
3253
- var coreData = app === null || app === void 0 ? void 0 : app.data.store.getStore().getDataByModel('core');
3254
- var boundary = coreData === null || coreData === void 0 || (_coreData$core = coreData.core) === null || _coreData$core === void 0 ? void 0 : _coreData$core.operating_day_boundary;
3255
- if ((boundary === null || boundary === void 0 ? void 0 : boundary.type) === 'start_time') {
3256
- var boundaryTime = String(boundary.time || '').trim();
3257
- var todayBoundary = dayjs("".concat(now.format('YYYY-MM-DD'), " ").concat(boundaryTime));
3258
- if (todayBoundary.isValid()) {
3259
- var _startAt = now.isBefore(todayBoundary) ? todayBoundary.subtract(1, 'day') : todayBoundary;
3260
- return {
3261
- startAt: _startAt,
3262
- endExclusiveAt: _startAt.add(1, 'day')
3263
- };
3264
- }
3205
+ var range = (_this$store2 = this.store) === null || _this$store2 === void 0 || (_this$store2 = _this$store2.createdAtQuery) === null || _this$store2 === void 0 ? void 0 : _this$store2.sales_time_between;
3206
+ if (Array.isArray(range) && range.length >= 2) {
3207
+ var _startAt = dayjs(range[0]);
3208
+ var endExclusiveAt = dayjs(range[1]);
3209
+ if (_startAt.isValid() && endExclusiveAt.isValid() && endExclusiveAt.isAfter(_startAt)) {
3210
+ return {
3211
+ startAt: _startAt,
3212
+ endExclusiveAt: endExclusiveAt
3213
+ };
3265
3214
  }
3266
- } catch (_unused6) {
3267
- // 读取营业日配置失败时按自然日兜底,不影响启动。
3268
3215
  }
3269
3216
  var startAt = now.startOf('day');
3270
3217
  return {
@@ -3277,47 +3224,20 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
3277
3224
  value: function hasPulledOrdersToday() {
3278
3225
  var lastFullFetchAt = this.getStorageItem(ORDER_LAST_FULL_FETCH_AT_STORAGE_KEY);
3279
3226
  if (!lastFullFetchAt) return false;
3280
- var currentShopId = this.getCurrentShopId();
3281
- var lastFullFetchShopId = this.getStorageItem(ORDER_LAST_FULL_FETCH_SHOP_ID_STORAGE_KEY);
3282
- if (!currentShopId || !lastFullFetchShopId || currentShopId !== lastFullFetchShopId) {
3283
- return false;
3284
- }
3285
3227
  var parsed = dayjs(lastFullFetchAt);
3286
3228
  if (!parsed.isValid()) return false;
3287
- var _this$getCurrentOrder = this.getCurrentOrderCacheWindow(),
3288
- startAt = _this$getCurrentOrder.startAt,
3289
- endExclusiveAt = _this$getCurrentOrder.endExclusiveAt;
3229
+
3230
+ // 按当前拉取窗口判断,而不是自然日判断。
3231
+ // 这样在营业日跨日边界(start_time)场景下也能正确判定是否需要重新拉取。
3232
+ var _this$getCurrentPullW = this.getCurrentPullWindow(),
3233
+ startAt = _this$getCurrentPullW.startAt,
3234
+ endExclusiveAt = _this$getCurrentPullW.endExclusiveAt;
3290
3235
  return (parsed.isAfter(startAt) || parsed.isSame(startAt)) && parsed.isBefore(endExclusiveAt);
3291
3236
  }
3292
3237
  }, {
3293
3238
  key: "markOrderPulledAtNow",
3294
3239
  value: function markOrderPulledAtNow() {
3295
- var currentShopId = this.getCurrentShopId();
3296
- if (!currentShopId) return;
3297
3240
  this.setStorageItem(ORDER_LAST_FULL_FETCH_AT_STORAGE_KEY, dayjs().format('YYYY-MM-DD HH:mm:ss'));
3298
- this.setStorageItem(ORDER_LAST_FULL_FETCH_SHOP_ID_STORAGE_KEY, currentShopId);
3299
- }
3300
- }, {
3301
- key: "clearOrderSnapshotMarker",
3302
- value: function clearOrderSnapshotMarker() {
3303
- this.setStorageItem(ORDER_LAST_FULL_FETCH_AT_STORAGE_KEY, '');
3304
- this.setStorageItem(ORDER_LAST_FULL_FETCH_SHOP_ID_STORAGE_KEY, '');
3305
- }
3306
- }, {
3307
- key: "getCurrentShopId",
3308
- value: function getCurrentShopId() {
3309
- try {
3310
- var _coreData$core2;
3311
- var appPlugin = this.core.getPlugin('app');
3312
- var app = appPlugin === null || appPlugin === void 0 ? void 0 : appPlugin.getApp();
3313
- if (!app) return null;
3314
- var coreData = app.data.store.getStore().getDataByModel('core');
3315
- var shopId = coreData === null || coreData === void 0 || (_coreData$core2 = coreData.core) === null || _coreData$core2 === void 0 ? void 0 : _coreData$core2.id;
3316
- if (shopId === undefined || shopId === null || shopId === '') return null;
3317
- return String(shopId);
3318
- } catch (_unused7) {
3319
- return null;
3320
- }
3321
3241
  }
3322
3242
  }, {
3323
3243
  key: "getStorageItem",
@@ -3328,7 +3248,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
3328
3248
  if (typeof globalThis !== 'undefined' && globalThis !== null && globalThis !== void 0 && globalThis.localStorage) {
3329
3249
  return globalThis.localStorage.getItem(key);
3330
3250
  }
3331
- } catch (_unused8) {
3251
+ } catch (_unused6) {
3332
3252
  // 忽略存储异常,避免影响主流程
3333
3253
  }
3334
3254
  return null;
@@ -3345,7 +3265,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
3345
3265
  if (typeof globalThis !== 'undefined' && globalThis !== null && globalThis !== void 0 && globalThis.localStorage) {
3346
3266
  globalThis.localStorage.setItem(key, value);
3347
3267
  }
3348
- } catch (_unused9) {
3268
+ } catch (_unused7) {
3349
3269
  // 忽略存储异常,避免影响主流程
3350
3270
  }
3351
3271
  }
@@ -3354,42 +3274,33 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
3354
3274
  value: function () {
3355
3275
  var _loadOrdersFromSQLite = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20() {
3356
3276
  var _this20 = this;
3357
- var options,
3358
- orders,
3359
- _args20 = arguments;
3277
+ var orders;
3360
3278
  return _regeneratorRuntime().wrap(function _callee20$(_context20) {
3361
3279
  while (1) switch (_context20.prev = _context20.next) {
3362
3280
  case 0:
3363
- options = _args20.length > 0 && _args20[0] !== undefined ? _args20[0] : {};
3364
3281
  if (this.dbManager) {
3365
- _context20.next = 3;
3282
+ _context20.next = 2;
3366
3283
  break;
3367
3284
  }
3368
3285
  return _context20.abrupt("return", []);
3369
- case 3:
3370
- _context20.prev = 3;
3371
- _context20.next = 6;
3286
+ case 2:
3287
+ _context20.prev = 2;
3288
+ _context20.next = 5;
3372
3289
  return this.dbManager.getAll(INDEXDB_STORE_NAME);
3373
- case 6:
3290
+ case 5:
3374
3291
  orders = _context20.sent;
3375
3292
  return _context20.abrupt("return", (orders || []).map(function (order) {
3376
3293
  return _this20.normalizeOrderCollectionsForIngress(order, 'loadOrdersFromSQLite');
3377
3294
  }));
3378
- case 10:
3379
- _context20.prev = 10;
3380
- _context20.t0 = _context20["catch"](3);
3381
- if (!options.throwOnError) {
3382
- _context20.next = 14;
3383
- break;
3384
- }
3385
- throw _context20.t0;
3386
- case 14:
3295
+ case 9:
3296
+ _context20.prev = 9;
3297
+ _context20.t0 = _context20["catch"](2);
3387
3298
  return _context20.abrupt("return", []);
3388
- case 15:
3299
+ case 12:
3389
3300
  case "end":
3390
3301
  return _context20.stop();
3391
3302
  }
3392
- }, _callee20, this, [[3, 10]]);
3303
+ }, _callee20, this, [[2, 9]]);
3393
3304
  }));
3394
3305
  function loadOrdersFromSQLite() {
3395
3306
  return _loadOrdersFromSQLite.apply(this, arguments);
@@ -3829,7 +3740,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
3829
3740
  * 用于 SSE 全量拉取与营业日窗口裁剪。
3830
3741
  *
3831
3742
  * @example
3832
- * const { orders, persisted } = await this.replaceOrdersSnapshotInSQLite(orderList, 'refresh')
3743
+ * await this.replaceOrdersSnapshotInSQLite(orderList)
3833
3744
  */
3834
3745
  )
3835
3746
  }, {
@@ -3840,7 +3751,6 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
3840
3751
  var protectedOrdersBeforeRemoteFetch,
3841
3752
  remoteSnapshot,
3842
3753
  mergedSnapshot,
3843
- persisted,
3844
3754
  _args27 = arguments;
3845
3755
  return _regeneratorRuntime().wrap(function _callee27$(_context27) {
3846
3756
  while (1) switch (_context27.prev = _context27.next) {
@@ -3850,12 +3760,9 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
3850
3760
  _context27.next = 3;
3851
3761
  break;
3852
3762
  }
3853
- return _context27.abrupt("return", {
3854
- orders: this.compactOrderListByIdentity(orderList.map(function (order) {
3855
- return _this24.normalizeRemoteSyncedOrder(order);
3856
- }), "".concat(source, ".snapshotNoDb")).list,
3857
- persisted: false
3858
- });
3763
+ return _context27.abrupt("return", this.compactOrderListByIdentity(orderList.map(function (order) {
3764
+ return _this24.normalizeRemoteSyncedOrder(order);
3765
+ }), "".concat(source, ".snapshotNoDb")).list);
3859
3766
  case 3:
3860
3767
  remoteSnapshot = cloneDeep(orderList).map(function (order) {
3861
3768
  return _this24.normalizeOrderCollectionsForIngress(order, "".concat(source, ".remoteIngress"));
@@ -3863,9 +3770,8 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
3863
3770
  mergedSnapshot = this.compactOrderListByIdentity(remoteSnapshot.map(function (order) {
3864
3771
  return _this24.normalizeRemoteSyncedOrder(order);
3865
3772
  }), "".concat(source, ".remoteSnapshot")).list;
3866
- persisted = false;
3867
- _context27.prev = 6;
3868
- _context27.next = 9;
3773
+ _context27.prev = 5;
3774
+ _context27.next = 8;
3869
3775
  return this.runInOrderSQLiteSaveQueue( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26() {
3870
3776
  var existingOrders, protectedLocalOrders, _iterator33, _step33, rawCurrentOrder, currentOrder, protectedIndex, currentNeedsProtection, orderListSnapshot;
3871
3777
  return _regeneratorRuntime().wrap(function _callee26$(_context26) {
@@ -3978,27 +3884,23 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
3978
3884
  }
3979
3885
  }, _callee26, null, [[10, 25, 28, 31]]);
3980
3886
  })));
3981
- case 9:
3982
- persisted = true;
3983
- _context27.next = 15;
3887
+ case 8:
3888
+ _context27.next = 13;
3984
3889
  break;
3985
- case 12:
3986
- _context27.prev = 12;
3987
- _context27.t0 = _context27["catch"](6);
3890
+ case 10:
3891
+ _context27.prev = 10;
3892
+ _context27.t0 = _context27["catch"](5);
3988
3893
  this.logError('全量保存订单到 SQLite 失败', {
3989
3894
  error: _context27.t0 instanceof Error ? _context27.t0.message : String(_context27.t0),
3990
3895
  orderList: remoteSnapshot.length
3991
3896
  });
3992
- case 15:
3993
- return _context27.abrupt("return", {
3994
- orders: mergedSnapshot,
3995
- persisted: persisted
3996
- });
3997
- case 16:
3897
+ case 13:
3898
+ return _context27.abrupt("return", mergedSnapshot);
3899
+ case 14:
3998
3900
  case "end":
3999
3901
  return _context27.stop();
4000
3902
  }
4001
- }, _callee27, this, [[6, 12]]);
3903
+ }, _callee27, this, [[5, 10]]);
4002
3904
  }));
4003
3905
  function replaceOrdersSnapshotInSQLite(_x20, _x21) {
4004
3906
  return _replaceOrdersSnapshotInSQLite.apply(this, arguments);
@@ -4040,7 +3942,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
4040
3942
  }, _callee28);
4041
3943
  })));
4042
3944
  case 5:
4043
- this.clearOrderSnapshotMarker();
3945
+ this.setStorageItem(ORDER_LAST_FULL_FETCH_AT_STORAGE_KEY, '');
4044
3946
  this.emitOrdersChanged([], 'clear');
4045
3947
  case 7:
4046
3948
  case "end":
@@ -25,7 +25,6 @@ export declare class ProductsModule extends BaseModule implements Module {
25
25
  private quotationBridgeLoadedKey?;
26
26
  private quotationBridgeRefreshPromise?;
27
27
  private quotationBridgeRefreshKey?;
28
- private quotationBridgeUpdatedCallback?;
29
28
  private quotationScheduleCache;
30
29
  private quotationScheduleCacheSource;
31
30
  private quotationScheduleCacheLoaded;
@@ -73,7 +72,6 @@ export declare class ProductsModule extends BaseModule implements Module {
73
72
  scheduleModule?: any;
74
73
  channel?: string;
75
74
  customer_id?: number | string;
76
- onQuotationUpdated?: () => void;
77
75
  }): Promise<void>;
78
76
  /**
79
77
  * 刷新桥接器内的报价单列表。
@@ -78,7 +78,6 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
78
78
  _defineProperty(_assertThisInitialized(_this), "quotationBridgeLoadedKey", '');
79
79
  _defineProperty(_assertThisInitialized(_this), "quotationBridgeRefreshPromise", void 0);
80
80
  _defineProperty(_assertThisInitialized(_this), "quotationBridgeRefreshKey", void 0);
81
- _defineProperty(_assertThisInitialized(_this), "quotationBridgeUpdatedCallback", void 0);
82
81
  _defineProperty(_assertThisInitialized(_this), "quotationScheduleCache", new Map());
83
82
  _defineProperty(_assertThisInitialized(_this), "quotationScheduleCacheSource", null);
84
83
  _defineProperty(_assertThisInitialized(_this), "quotationScheduleCacheLoaded", false);
@@ -291,9 +290,7 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
291
290
  value: (function () {
292
291
  var _setupQuotationPriceBridge = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(params) {
293
292
  var _this$otherParams,
294
- _this3 = this,
295
- _this$quotationPriceB,
296
- _this$quotationPriceB2;
293
+ _this3 = this;
297
294
  var channel, quotation;
298
295
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
299
296
  while (1) switch (_context3.prev = _context3.next) {
@@ -354,20 +351,11 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
354
351
  return schedules[0];
355
352
  });
356
353
  }
357
- if (params.onQuotationUpdated) {
358
- this.quotationBridgeUpdatedCallback = params.onQuotationUpdated;
359
- }
360
- (_this$quotationPriceB = (_this$quotationPriceB2 = this.quotationPriceBridge).setQuotationListUpdatedListener) === null || _this$quotationPriceB === void 0 || _this$quotationPriceB.call(_this$quotationPriceB2, function () {
361
- var _this3$quotationBridg;
362
- _this3.quotationBridgeLoadedKey = _this3.getQuotationBridgeScopeKey();
363
- _this3.clearPriceCache();
364
- (_this3$quotationBridg = _this3.quotationBridgeUpdatedCallback) === null || _this3$quotationBridg === void 0 || _this3$quotationBridg.call(_this3);
365
- });
366
- _context3.next = 15;
354
+ _context3.next = 13;
367
355
  return this.refreshQuotationPriceBridge({
368
356
  customer_id: params.customer_id
369
357
  });
370
- case 15:
358
+ case 13:
371
359
  case "end":
372
360
  return _context3.stop();
373
361
  }
@@ -1214,8 +1202,6 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1214
1202
  key: "clearPriceCache",
1215
1203
  value: function clearPriceCache() {
1216
1204
  this.productsPriceCache.clear();
1217
- this.quotationScheduleCache.clear();
1218
- this.quotationScheduleCacheLoaded = false;
1219
1205
  console.log('[ProductsModule] 🗑️ 商品价格缓存已清空');
1220
1206
  }
1221
1207
 
@@ -149,49 +149,41 @@ export var ResourceModule = /*#__PURE__*/function (_BaseModule) {
149
149
  while (1) switch (_context2.prev = _context2.next) {
150
150
  case 0:
151
151
  _context2.next = 2;
152
- return this.loadResourcesFromSQLite();
152
+ return this.setupResourceSync();
153
153
  case 2:
154
+ _context2.next = 4;
155
+ return this.loadResourcesFromSQLite();
156
+ case 4:
154
157
  cachedResources = _context2.sent;
155
158
  if (!(cachedResources.length > 0)) {
156
- _context2.next = 10;
159
+ _context2.next = 12;
157
160
  break;
158
161
  }
159
162
  this.store.list = cloneDeep(cachedResources).map(function (item) {
160
163
  return _this3.normalizeResource(item);
161
164
  });
162
165
  this.syncResourcesMap();
163
- _context2.next = 8;
166
+ _context2.next = 10;
164
167
  return this.safeEmit(ResourceHooks.onResourcesChanged, this.store.list);
165
- case 8:
166
- // 二次启动优先使用 SQLite。pubsub 注册及远端校准继续在后台执行,
167
- // setupResourceSync 完成后会合并最新数据并回写 SQLite。
168
- void this.setupResourceSync().catch(function (error) {
169
- _this3.logError('后台初始化资源同步失败', error);
170
- });
171
- return _context2.abrupt("return");
172
168
  case 10:
173
- _context2.next = 12;
174
- return this.setupResourceSync();
169
+ _context2.next = 20;
170
+ break;
175
171
  case 12:
176
- if (!(this.store.list.length === 0)) {
177
- _context2.next = 21;
178
- break;
179
- }
180
- _context2.next = 15;
172
+ _context2.next = 14;
181
173
  return this.loadResourcesByServer();
182
- case 15:
174
+ case 14:
183
175
  resources = _context2.sent;
184
176
  if (!(resources.length > 0)) {
185
- _context2.next = 21;
177
+ _context2.next = 20;
186
178
  break;
187
179
  }
188
180
  this.store.list = cloneDeep(resources).map(function (item) {
189
181
  return _this3.normalizeResource(item);
190
182
  });
191
183
  this.syncResourcesMap();
192
- _context2.next = 21;
184
+ _context2.next = 20;
193
185
  return this.safeEmit(ResourceHooks.onResourcesChanged, this.store.list);
194
- case 21:
186
+ case 20:
195
187
  case "end":
196
188
  return _context2.stop();
197
189
  }
@@ -362,6 +362,11 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
362
362
  selected: boolean;
363
363
  source?: WalletAssetSelectionSource;
364
364
  }): Promise<WalletAssetsState>;
365
+ /** 更新已选钱包资产的手动使用金额,并同步 pending payment。 */
366
+ updateWalletAssetAmount(params: {
367
+ assetId: WalletAssetId;
368
+ amount: number;
369
+ }): Promise<WalletAssetsState>;
365
370
  /** 扫码精确查券;仅可用资产会被自动选中。 */
366
371
  scanWalletAsset(code: string): Promise<ScanWalletAssetResult>;
367
372
  /** 清空全部未确认钱包选择,已支付钱包项由 Order 模块继续保留。 */