@pisell/pisellos 2.2.227 → 2.2.229

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.
@@ -1,9 +0,0 @@
1
- // 导出评估器
2
- export { PromotionEvaluator } from "./evaluator";
3
-
4
- // 导出适配器
5
- export { PromotionAdapter } from "./adapter";
6
- export { default } from "./adapter";
7
-
8
- // 导出策略配置示例常量
9
- export { X_ITEMS_FOR_Y_PRICE_STRATEGY, BUY_X_GET_Y_FREE_STRATEGY } from "./examples";
@@ -175,6 +175,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
175
175
  private buildProductStructuralFingerprintItem;
176
176
  private buildOrderProductsStructuralFingerprint;
177
177
  private getOriginalSalesSnapshot;
178
+ private isSnapshotPayableAmountUnchanged;
178
179
  private restoreOriginalSnapshotIfProductsUnchanged;
179
180
  private clearPersistedAmountFieldsForFullRecalc;
180
181
  private getPaymentTargetAmount;
@@ -1688,6 +1688,23 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
1688
1688
  if (typeof snapshot.productFingerprint !== 'string') return null;
1689
1689
  return snapshot;
1690
1690
  }
1691
+ }, {
1692
+ key: "isSnapshotPayableAmountUnchanged",
1693
+ value: function isSnapshotPayableAmountUnchanged(tempOrder, snapshot, snapshotSummary) {
1694
+ var currentPaidPaymentSummary = this.calculatePaidPaymentSummary(tempOrder.payments || []);
1695
+ var currentAmountGap = this.calculateSummaryAmountGap({
1696
+ tempOrder: tempOrder,
1697
+ summary: snapshotSummary,
1698
+ orderPaidAmount: currentPaidPaymentSummary.gapPaidAmount
1699
+ });
1700
+ var snapshotPaidPaymentSummary = this.calculatePaidPaymentSummary(Array.isArray(snapshot.payments) ? snapshot.payments : []);
1701
+ var snapshotAmountGap = this.calculateSummaryAmountGap({
1702
+ tempOrder: tempOrder,
1703
+ summary: snapshotSummary,
1704
+ orderPaidAmount: snapshotPaidPaymentSummary.gapPaidAmount
1705
+ });
1706
+ return currentAmountGap === snapshotAmountGap;
1707
+ }
1691
1708
  }, {
1692
1709
  key: "restoreOriginalSnapshotIfProductsUnchanged",
1693
1710
  value: function restoreOriginalSnapshotIfProductsUnchanged(tempOrder) {
@@ -1700,6 +1717,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
1700
1717
  if (currentStructuralFingerprint !== snapshotStructuralFingerprint) return null;
1701
1718
  }
1702
1719
  var summary = _objectSpread(_objectSpread({}, createEmptySummary()), cloneDeep(snapshot.summary || {}));
1720
+ if (!this.isSnapshotPayableAmountUnchanged(tempOrder, snapshot, summary)) return null;
1703
1721
  if (Array.isArray(snapshot.products)) {
1704
1722
  tempOrder.products = cloneDeep(snapshot.products);
1705
1723
  }
@@ -3722,6 +3740,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
3722
3740
  var enhancedPayload = params !== null && params !== void 0 && params.enhancePayload ? params.enhancePayload(nextPayload, ctx) : nextPayload;
3723
3741
  return enhancedPayload;
3724
3742
  } : undefined;
3743
+ debugger;
3725
3744
  payload = buildSubmitPayload({
3726
3745
  tempOrder: tempOrder,
3727
3746
  cacheId: effectiveCacheId,
@@ -3735,10 +3754,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
3735
3754
  if (!payload.created_at) {
3736
3755
  payload.created_at = dayjs().format('YYYY-MM-DD HH:mm:ss');
3737
3756
  }
3738
- _context26.next = 20;
3757
+ _context26.next = 21;
3739
3758
  return this.saveDraft();
3740
- case 20:
3741
- _context26.prev = 20;
3759
+ case 21:
3760
+ _context26.prev = 21;
3742
3761
  this.logInfo('submitTempOrder calling sales checkout', {
3743
3762
  orderId: payload.order_id,
3744
3763
  externalSaleNumber: payload.external_sale_number,
@@ -3747,26 +3766,26 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
3747
3766
  paymentsCount: ((_payload$payments = payload.payments) === null || _payload$payments === void 0 ? void 0 : _payload$payments.length) || 0,
3748
3767
  smallTicketDataFlag: payload.small_ticket_data_flag
3749
3768
  });
3750
- _context26.next = 24;
3769
+ _context26.next = 25;
3751
3770
  return this.submitSalesOrder({
3752
3771
  query: payload
3753
3772
  });
3754
- case 24:
3773
+ case 25:
3755
3774
  result = _context26.sent;
3756
- _context26.next = 37;
3775
+ _context26.next = 38;
3757
3776
  break;
3758
- case 27:
3759
- _context26.prev = 27;
3760
- _context26.t2 = _context26["catch"](20);
3777
+ case 28:
3778
+ _context26.prev = 28;
3779
+ _context26.t2 = _context26["catch"](21);
3761
3780
  backendErrorResponse = this.extractSubmitErrorResponse(_context26.t2);
3762
3781
  if (!backendErrorResponse) {
3763
- _context26.next = 34;
3782
+ _context26.next = 35;
3764
3783
  break;
3765
3784
  }
3766
3785
  this.store.syncState = 'failed';
3767
3786
  this.logSubmitBackendRejected(backendErrorResponse, payload);
3768
3787
  return _context26.abrupt("return", backendErrorResponse);
3769
- case 34:
3788
+ case 35:
3770
3789
  this.store.syncState = 'failed';
3771
3790
  this.logError('submitTempOrder failed', {
3772
3791
  error: _context26.t2 instanceof Error ? _context26.t2.message : String(_context26.t2),
@@ -3776,40 +3795,40 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
3776
3795
  paymentsCount: ((_payload$payments2 = payload.payments) === null || _payload$payments2 === void 0 ? void 0 : _payload$payments2.length) || 0
3777
3796
  });
3778
3797
  throw _context26.t2;
3779
- case 37:
3798
+ case 38:
3780
3799
  if (!this.isSubmitResponseRejected(result)) {
3781
- _context26.next = 41;
3800
+ _context26.next = 42;
3782
3801
  break;
3783
3802
  }
3784
3803
  this.store.syncState = 'failed';
3785
3804
  this.logSubmitBackendRejected(result, payload);
3786
3805
  return _context26.abrupt("return", result);
3787
- case 41:
3806
+ case 42:
3788
3807
  submittedOrderId = this.extractOrderIdFromSubmitResult(result);
3789
3808
  if (!(submittedOrderId !== null && submittedOrderId !== undefined)) {
3790
- _context26.next = 49;
3809
+ _context26.next = 50;
3791
3810
  break;
3792
3811
  }
3793
3812
  tempOrder.order_id = submittedOrderId;
3794
3813
  resultRecord = result;
3795
- _context26.next = 47;
3814
+ _context26.next = 48;
3796
3815
  return this.markLocalOrderSynced(submittedOrderId, (resultRecord === null || resultRecord === void 0 ? void 0 : resultRecord.data) || resultRecord || {});
3797
- case 47:
3798
- _context26.next = 50;
3816
+ case 48:
3817
+ _context26.next = 51;
3799
3818
  break;
3800
- case 49:
3819
+ case 50:
3801
3820
  if (this.isLocalPendingSubmitResult(result)) {
3802
3821
  this.store.syncState = 'local';
3803
3822
  } else {
3804
3823
  this.store.syncState = 'submitted';
3805
3824
  }
3806
- case 50:
3807
- return _context26.abrupt("return", result);
3808
3825
  case 51:
3826
+ return _context26.abrupt("return", result);
3827
+ case 52:
3809
3828
  case "end":
3810
3829
  return _context26.stop();
3811
3830
  }
3812
- }, _callee24, this, [[20, 27]]);
3831
+ }, _callee24, this, [[21, 28]]);
3813
3832
  }));
3814
3833
  function submitTempOrder(_x26) {
3815
3834
  return _submitTempOrder.apply(this, arguments);
@@ -4404,11 +4423,12 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
4404
4423
  });
4405
4424
  case 6:
4406
4425
  res = _context35.sent;
4426
+ debugger;
4407
4427
  if (res.code === 200) {
4408
4428
  this.store.lastOrderInfo = res.data;
4409
4429
  }
4410
4430
  return _context35.abrupt("return", res);
4411
- case 9:
4431
+ case 10:
4412
4432
  case "end":
4413
4433
  return _context35.stop();
4414
4434
  }
@@ -3811,7 +3811,7 @@ var Server = /*#__PURE__*/function () {
3811
3811
  }
3812
3812
  return _context40.abrupt("return", next);
3813
3813
  case 9:
3814
- if (!(!this.order || typeof this.order.getLocalOrderByLookup !== 'function')) {
3814
+ if (!(!this.order || typeof this.order.getLocalOrderFromMemoryByLookup !== 'function')) {
3815
3815
  _context40.next = 12;
3816
3816
  break;
3817
3817
  }
@@ -3824,12 +3824,9 @@ var Server = /*#__PURE__*/function () {
3824
3824
  return _context40.abrupt("return", next);
3825
3825
  case 12:
3826
3826
  _context40.prev = 12;
3827
- _context40.next = 15;
3828
- return this.order.getLocalOrderByLookup(externalSaleNumber);
3829
- case 15:
3830
- localOrder = _context40.sent;
3827
+ localOrder = this.order.getLocalOrderFromMemoryByLookup(externalSaleNumber);
3831
3828
  if (localOrder) {
3832
- _context40.next = 19;
3829
+ _context40.next = 17;
3833
3830
  break;
3834
3831
  }
3835
3832
  if (shouldClearLocalOrderId) {
@@ -3840,7 +3837,7 @@ var Server = /*#__PURE__*/function () {
3840
3837
  });
3841
3838
  }
3842
3839
  return _context40.abrupt("return", next);
3843
- case 19:
3840
+ case 17:
3844
3841
  if (this.isBlankCheckoutValue(next.shop_order_number)) {
3845
3842
  next.shop_order_number = localOrder.shop_order_number;
3846
3843
  }
@@ -3856,8 +3853,8 @@ var Server = /*#__PURE__*/function () {
3856
3853
  shop_full_order_number: next.shop_full_order_number
3857
3854
  });
3858
3855
  return _context40.abrupt("return", next);
3859
- case 25:
3860
- _context40.prev = 25;
3856
+ case 23:
3857
+ _context40.prev = 23;
3861
3858
  _context40.t0 = _context40["catch"](12);
3862
3859
  this.logWarning("".concat(title, ": checkout \u67E5\u627E\u672C\u5730\u8BA2\u5355\u5931\u8D25"), {
3863
3860
  external_sale_number: externalSaleNumber,
@@ -3865,11 +3862,11 @@ var Server = /*#__PURE__*/function () {
3865
3862
  error_detail: this.normalizeUnknownError(_context40.t0)
3866
3863
  });
3867
3864
  return _context40.abrupt("return", next);
3868
- case 29:
3865
+ case 27:
3869
3866
  case "end":
3870
3867
  return _context40.stop();
3871
3868
  }
3872
- }, _callee40, this, [[12, 25]]);
3869
+ }, _callee40, this, [[12, 23]]);
3873
3870
  }));
3874
3871
  function normalizeCheckoutSubmitData(_x42, _x43) {
3875
3872
  return _normalizeCheckoutSubmitData.apply(this, arguments);
@@ -79,6 +79,7 @@ export declare class OrderModule extends BaseModule implements Module {
79
79
  getOrderById(id: OrderId): OrderData | undefined;
80
80
  /** 按 order_id 查询内存订单。 */
81
81
  getOrderByOrderId(orderId: OrderId): OrderData | undefined;
82
+ getLocalOrderFromMemoryByLookup(lookup: OrderId): OrderData | null;
82
83
  getLocalOrderByLookup(lookup: OrderId): Promise<OrderData | null>;
83
84
  loadOrdersByServer(): Promise<OrderData[]>;
84
85
  /**
@@ -561,11 +561,23 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
561
561
  value: function getOrderByOrderId(orderId) {
562
562
  return this.store.map.get(this.getIdKey(orderId));
563
563
  }
564
+ }, {
565
+ key: "getLocalOrderFromMemoryByLookup",
566
+ value: function getLocalOrderFromMemoryByLookup(lookup) {
567
+ var _this5 = this;
568
+ var key = this.getIdKey(lookup);
569
+ var memoryOrderById = this.store.map.get(key);
570
+ if (memoryOrderById) return memoryOrderById;
571
+ var memoryOrder = this.store.list.find(function (order) {
572
+ return _this5.isOrderLookupMatch(order, key);
573
+ });
574
+ return memoryOrder || null;
575
+ }
564
576
  }, {
565
577
  key: "getLocalOrderByLookup",
566
578
  value: function () {
567
579
  var _getLocalOrderByLookup = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(lookup) {
568
- var _this5 = this;
580
+ var _this6 = this;
569
581
  var key, memoryOrderById, memoryOrder, orders, localOrder;
570
582
  return _regeneratorRuntime().wrap(function _callee5$(_context5) {
571
583
  while (1) switch (_context5.prev = _context5.next) {
@@ -579,7 +591,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
579
591
  return _context5.abrupt("return", memoryOrderById);
580
592
  case 4:
581
593
  memoryOrder = this.store.list.find(function (order) {
582
- return _this5.isOrderLookupMatch(order, key);
594
+ return _this6.isOrderLookupMatch(order, key);
583
595
  });
584
596
  if (!memoryOrder) {
585
597
  _context5.next = 7;
@@ -592,7 +604,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
592
604
  case 9:
593
605
  orders = _context5.sent;
594
606
  localOrder = orders.find(function (order) {
595
- return _this5.isOrderLookupMatch(order, key);
607
+ return _this6.isOrderLookupMatch(order, key);
596
608
  });
597
609
  if (localOrder) {
598
610
  _context5.next = 13;
@@ -601,7 +613,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
601
613
  return _context5.abrupt("return", null);
602
614
  case 13:
603
615
  this.store.list = orders.map(function (order) {
604
- return _this5.normalizeOrderForMemoryList(order);
616
+ return _this6.normalizeOrderForMemoryList(order);
605
617
  });
606
618
  this.syncOrdersMap();
607
619
  return _context5.abrupt("return", this.normalizeOrderForMemoryList(localOrder));
@@ -621,7 +633,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
621
633
  value: function () {
622
634
  var _loadOrdersByServer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
623
635
  var _this$store,
624
- _this6 = this;
636
+ _this7 = this;
625
637
  var orderList, data, mergedOrders, memoryOrders;
626
638
  return _regeneratorRuntime().wrap(function _callee6$(_context6) {
627
639
  while (1) switch (_context6.prev = _context6.next) {
@@ -663,7 +675,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
663
675
  case 19:
664
676
  mergedOrders = _context6.sent;
665
677
  memoryOrders = mergedOrders.map(function (order) {
666
- return _this6.normalizeOrderForMemoryList(order);
678
+ return _this7.normalizeOrderForMemoryList(order);
667
679
  });
668
680
  this.logInfo('loadOrdersByServer-结束', {
669
681
  count: memoryOrders.length
@@ -753,10 +765,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
753
765
  }, {
754
766
  key: "getOrdersByResourceId",
755
767
  value: function getOrdersByResourceId(resourceId) {
756
- var _this7 = this;
768
+ var _this8 = this;
757
769
  var ids = this.resourceIdIndex.get(String(resourceId)) || [];
758
770
  return ids.map(function (id) {
759
- return _this7.store.map.get(id);
771
+ return _this8.store.map.get(id);
760
772
  }).filter(function (order) {
761
773
  return !!order;
762
774
  });
@@ -784,7 +796,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
784
796
  key: "overwriteExistingOrder",
785
797
  value: (function () {
786
798
  var _overwriteExistingOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(fresh) {
787
- var _this8 = this;
799
+ var _this9 = this;
788
800
  var orderId, key;
789
801
  return _regeneratorRuntime().wrap(function _callee8$(_context8) {
790
802
  while (1) switch (_context8.prev = _context8.next) {
@@ -818,7 +830,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
818
830
  this.store.list = this.store.list.map(function (order) {
819
831
  var id = order === null || order === void 0 ? void 0 : order.order_id;
820
832
  if (id === undefined || id === null) return order;
821
- return _this8.getIdKey(id) === key ? fresh : order;
833
+ return _this9.getIdKey(id) === key ? fresh : order;
822
834
  });
823
835
  this.syncOrdersMap();
824
836
  _context8.next = 13;
@@ -884,7 +896,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
884
896
  key: "markOrderSyncedByExternalSaleNumber",
885
897
  value: function () {
886
898
  var _markOrderSyncedByExternalSaleNumber = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(params) {
887
- var _this9 = this,
899
+ var _this10 = this,
888
900
  _existing$external_sa,
889
901
  _nextOrder$order_id;
890
902
  var externalSaleNumber, key, targetIndex, existing, nextOrder, storageKey;
@@ -905,7 +917,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
905
917
  targetIndex = this.store.list.findIndex(function (order) {
906
918
  var value = order === null || order === void 0 ? void 0 : order.external_sale_number;
907
919
  if (value === undefined || value === null || value === '') return false;
908
- return _this9.getIdKey(value) === key;
920
+ return _this10.getIdKey(value) === key;
909
921
  });
910
922
  if (!(targetIndex < 0)) {
911
923
  _context10.next = 9;
@@ -1162,7 +1174,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
1162
1174
  }, {
1163
1175
  key: "syncOrdersMap",
1164
1176
  value: function syncOrdersMap() {
1165
- var _this10 = this;
1177
+ var _this11 = this;
1166
1178
  this.store.map.clear();
1167
1179
  this.resourceIdIndex.clear();
1168
1180
  var _iterator7 = _createForOfIteratorHelper(this.store.list),
@@ -1170,22 +1182,22 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
1170
1182
  try {
1171
1183
  var _loop = function _loop() {
1172
1184
  var order = _step7.value;
1173
- var primaryIdentity = _this10.getOrderMapKey(order);
1185
+ var primaryIdentity = _this11.getOrderMapKey(order);
1174
1186
  if (!primaryIdentity) return 1; // continue
1175
- _this10.store.map.set(primaryIdentity, order);
1176
- var resourceIds = _this10.extractResourceIds(order);
1187
+ _this11.store.map.set(primaryIdentity, order);
1188
+ var resourceIds = _this11.extractResourceIds(order);
1177
1189
  var _iterator8 = _createForOfIteratorHelper(resourceIds),
1178
1190
  _step8;
1179
1191
  try {
1180
1192
  for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
1181
1193
  var resourceId = _step8.value;
1182
1194
  var key = String(resourceId);
1183
- var existing = _this10.resourceIdIndex.get(key) || [];
1195
+ var existing = _this11.resourceIdIndex.get(key) || [];
1184
1196
  if (existing.some(function (eid) {
1185
- return _this10.getIdKey(eid) === primaryIdentity;
1197
+ return _this11.getIdKey(eid) === primaryIdentity;
1186
1198
  })) continue;
1187
1199
  existing.push(primaryIdentity);
1188
- _this10.resourceIdIndex.set(key, existing);
1200
+ _this11.resourceIdIndex.set(key, existing);
1189
1201
  }
1190
1202
  } catch (err) {
1191
1203
  _iterator8.e(err);
@@ -1223,7 +1235,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
1223
1235
  }, {
1224
1236
  key: "getOrderIdentityEntries",
1225
1237
  value: function getOrderIdentityEntries(order) {
1226
- var _this11 = this;
1238
+ var _this12 = this;
1227
1239
  if (!order) return [];
1228
1240
  var record = order;
1229
1241
  var candidates = [{
@@ -1242,8 +1254,8 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
1242
1254
  var entries = [];
1243
1255
  var _loop2 = function _loop2() {
1244
1256
  var candidate = _candidates[_i];
1245
- if (_this11.isBlankIdentityValue(candidate.value)) return 0; // continue
1246
- var key = _this11.getIdKey(candidate.value);
1257
+ if (_this12.isBlankIdentityValue(candidate.value)) return 0; // continue
1258
+ var key = _this12.getIdKey(candidate.value);
1247
1259
  if (entries.some(function (entry) {
1248
1260
  return entry.field === candidate.field && entry.key === key;
1249
1261
  })) return 0; // continue
@@ -1329,7 +1341,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
1329
1341
  }, {
1330
1342
  key: "setupOrderSync",
1331
1343
  value: function setupOrderSync() {
1332
- var _this12 = this;
1344
+ var _this13 = this;
1333
1345
  if (!this.orderDataSource) return;
1334
1346
  this.orderDataSource.run({
1335
1347
  pubsub: {
@@ -1337,22 +1349,22 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
1337
1349
  var _message$id, _message$order_id, _message$type;
1338
1350
  console.log('orderDataSource', res);
1339
1351
  var pubsubReceivedAt = Date.now();
1340
- var message = _this12.normalizeOrderSyncMessage(res);
1352
+ var message = _this13.normalizeOrderSyncMessage(res);
1341
1353
  if (!message) return;
1342
1354
  message._pubsubReceivedAt = pubsubReceivedAt;
1343
- _this12.pendingSyncMessages.push(message);
1344
- var throttleMs = _this12.getOrderSyncThrottleMs();
1345
- var routeInfo = _this12.resolveSyncMessageRoute(message);
1346
- _this12.logInfo('orderSync-收到消息并入队', {
1355
+ _this13.pendingSyncMessages.push(message);
1356
+ var throttleMs = _this13.getOrderSyncThrottleMs();
1357
+ var routeInfo = _this13.resolveSyncMessageRoute(message);
1358
+ _this13.logInfo('orderSync-收到消息并入队', {
1347
1359
  id: (_message$id = message.id) !== null && _message$id !== void 0 ? _message$id : null,
1348
1360
  order_id: (_message$order_id = message.order_id) !== null && _message$order_id !== void 0 ? _message$order_id : null,
1349
1361
  type: (_message$type = message.type) !== null && _message$type !== void 0 ? _message$type : null,
1350
- pendingCount: _this12.pendingSyncMessages.length,
1362
+ pendingCount: _this13.pendingSyncMessages.length,
1351
1363
  throttleMs: throttleMs,
1352
1364
  pubsubReceivedAt: new Date(pubsubReceivedAt).toISOString(),
1353
1365
  fullMessage: JSON.stringify(message)
1354
1366
  });
1355
- _this12.scheduleOrderSyncThrottle();
1367
+ _this13.scheduleOrderSyncThrottle();
1356
1368
  }
1357
1369
  }
1358
1370
  }).catch(function () {
@@ -1369,7 +1381,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
1369
1381
  }, {
1370
1382
  key: "scheduleOrderSyncThrottle",
1371
1383
  value: function scheduleOrderSyncThrottle() {
1372
- var _this13 = this;
1384
+ var _this14 = this;
1373
1385
  if (this.isProcessingSyncBatch) return;
1374
1386
  if (this.isIdlePhase) {
1375
1387
  this.isIdlePhase = false;
@@ -1380,8 +1392,8 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
1380
1392
  if (this.syncTimer) return;
1381
1393
  var throttleMs = this.getOrderSyncThrottleMs();
1382
1394
  this.syncTimer = setTimeout(function () {
1383
- _this13.syncTimer = undefined;
1384
- void _this13.flushOrderSyncMessagesByThrottle();
1395
+ _this14.syncTimer = undefined;
1396
+ void _this14.flushOrderSyncMessagesByThrottle();
1385
1397
  }, throttleMs);
1386
1398
  }
1387
1399
 
@@ -1449,7 +1461,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
1449
1461
  key: "processOrderSyncMessages",
1450
1462
  value: (function () {
1451
1463
  var _processOrderSyncMessages = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
1452
- var _this14 = this;
1464
+ var _this15 = this;
1453
1465
  var messages, batchProcessStartAt, earliestReceivedAt, upsertOrders, refreshIds, uniqueRefreshIds, upsertList, _this$filterRedundant, toFetch, skipped, freshOrders, batchProcessEndAt;
1454
1466
  return _regeneratorRuntime().wrap(function _callee14$(_context14) {
1455
1467
  while (1) switch (_context14.prev = _context14.next) {
@@ -1476,13 +1488,13 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
1476
1488
  upsertOrders = new Map();
1477
1489
  refreshIds = [];
1478
1490
  messages.forEach(function (msg, msgIndex) {
1479
- var routeInfo = _this14.resolveSyncMessageRoute(msg);
1491
+ var routeInfo = _this15.resolveSyncMessageRoute(msg);
1480
1492
  var hasBatchIds = routeInfo.hasBatchIds;
1481
1493
  var singleId = routeInfo.singleId;
1482
1494
  var hasSingleId = routeInfo.hasSingleId;
1483
- var normalizedBody = _this14.normalizeOrderSyncPayload(msg.body || msg.data);
1495
+ var normalizedBody = _this15.normalizeOrderSyncPayload(msg.body || msg.data);
1484
1496
  if (routeInfo.route === 'bodyUpsert' && normalizedBody) {
1485
- upsertOrders.set(_this14.getIdKey(normalizedBody.order_id), normalizedBody);
1497
+ upsertOrders.set(_this15.getIdKey(normalizedBody.order_id), normalizedBody);
1486
1498
  return;
1487
1499
  }
1488
1500
  if (hasBatchIds) refreshIds.push.apply(refreshIds, _toConsumableArray(routeInfo.batchIds));else if (routeInfo.route === 'httpRefresh.singleId' && singleId !== null) refreshIds.push(singleId);else if (routeInfo.route === 'httpRefresh.relationIds') refreshIds.push.apply(refreshIds, _toConsumableArray(routeInfo.batchIds));
@@ -1797,12 +1809,12 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
1797
1809
  }, {
1798
1810
  key: "isOrderLookupMatch",
1799
1811
  value: function isOrderLookupMatch(order, lookupKey) {
1800
- var _this15 = this;
1812
+ var _this16 = this;
1801
1813
  if (!order || !lookupKey) return false;
1802
1814
  var candidates = [order.order_id, order.external_sale_number, order.order_number, order.shop_order_number, order.shop_full_order_number];
1803
1815
  return candidates.some(function (value) {
1804
1816
  if (value === undefined || value === null || value === '') return false;
1805
- return _this15.getIdKey(value) === lookupKey;
1817
+ return _this16.getIdKey(value) === lookupKey;
1806
1818
  });
1807
1819
  }
1808
1820
 
@@ -1845,10 +1857,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
1845
1857
  }, {
1846
1858
  key: "findOrderIndexByIdentity",
1847
1859
  value: function findOrderIndexByIdentity(orders, target) {
1848
- var _this16 = this;
1860
+ var _this17 = this;
1849
1861
  if (this.getOrderIdentityMatchKeys(target).length === 0) return -1;
1850
1862
  return orders.findIndex(function (order) {
1851
- return _this16.doOrdersShareIdentity(order, target);
1863
+ return _this17.doOrdersShareIdentity(order, target);
1852
1864
  });
1853
1865
  }
1854
1866
  }, {
@@ -2137,9 +2149,9 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
2137
2149
  }, {
2138
2150
  key: "mergeRemoteSnapshotWithPendingOrders",
2139
2151
  value: function mergeRemoteSnapshotWithPendingOrders(remoteOrders, existingOrders) {
2140
- var _this17 = this;
2152
+ var _this18 = this;
2141
2153
  var merged = remoteOrders.map(function (order) {
2142
- return _this17.normalizeRemoteSyncedOrder(order);
2154
+ return _this18.normalizeRemoteSyncedOrder(order);
2143
2155
  });
2144
2156
  var _iterator16 = _createForOfIteratorHelper(existingOrders),
2145
2157
  _step16;
@@ -2208,7 +2220,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
2208
2220
  key: "patchOrdersInSQLite",
2209
2221
  value: (function () {
2210
2222
  var _patchOrdersInSQLite = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(orders, source) {
2211
- var _this18 = this;
2223
+ var _this19 = this;
2212
2224
  var mergeActions,
2213
2225
  ordersSnapshot,
2214
2226
  _this$filterRedundant2,
@@ -2227,7 +2239,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
2227
2239
  return _context20.abrupt("return");
2228
2240
  case 3:
2229
2241
  ordersSnapshot = cloneDeep(orders).filter(function (order) {
2230
- return _this18.getOrderStorageKey(order);
2242
+ return _this19.getOrderStorageKey(order);
2231
2243
  });
2232
2244
  if (!(ordersSnapshot.length === 0)) {
2233
2245
  _context20.next = 6;
@@ -2257,34 +2269,34 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
2257
2269
  while (1) switch (_context19.prev = _context19.next) {
2258
2270
  case 0:
2259
2271
  writeMethod = 'none';
2260
- _this18.logInfo('patchOrdersInSQLite-开始', {
2272
+ _this19.logInfo('patchOrdersInSQLite-开始', {
2261
2273
  source: source,
2262
2274
  count: compactedToWrite.length,
2263
2275
  dedupedCount: skipped.length
2264
2276
  });
2265
- if (!(typeof _this18.dbManager.bulkUpdate === 'function')) {
2277
+ if (!(typeof _this19.dbManager.bulkUpdate === 'function')) {
2266
2278
  _context19.next = 8;
2267
2279
  break;
2268
2280
  }
2269
2281
  writeMethod = 'bulkUpdate';
2270
2282
  _context19.next = 6;
2271
- return _this18.dbManager.bulkUpdate(INDEXDB_STORE_NAME, compactedToWrite);
2283
+ return _this19.dbManager.bulkUpdate(INDEXDB_STORE_NAME, compactedToWrite);
2272
2284
  case 6:
2273
2285
  _context19.next = 33;
2274
2286
  break;
2275
2287
  case 8:
2276
- if (!(typeof _this18.dbManager.bulkAdd === 'function')) {
2288
+ if (!(typeof _this19.dbManager.bulkAdd === 'function')) {
2277
2289
  _context19.next = 14;
2278
2290
  break;
2279
2291
  }
2280
2292
  writeMethod = 'bulkAdd';
2281
2293
  _context19.next = 12;
2282
- return _this18.dbManager.bulkAdd(INDEXDB_STORE_NAME, compactedToWrite);
2294
+ return _this19.dbManager.bulkAdd(INDEXDB_STORE_NAME, compactedToWrite);
2283
2295
  case 12:
2284
2296
  _context19.next = 33;
2285
2297
  break;
2286
2298
  case 14:
2287
- if (!(typeof _this18.dbManager.update === 'function')) {
2299
+ if (!(typeof _this19.dbManager.update === 'function')) {
2288
2300
  _context19.next = 33;
2289
2301
  break;
2290
2302
  }
@@ -2299,7 +2311,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
2299
2311
  }
2300
2312
  order = _step17.value;
2301
2313
  _context19.next = 23;
2302
- return _this18.dbManager.update(INDEXDB_STORE_NAME, order);
2314
+ return _this19.dbManager.update(INDEXDB_STORE_NAME, order);
2303
2315
  case 23:
2304
2316
  _context19.next = 19;
2305
2317
  break;
@@ -2315,8 +2327,8 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
2315
2327
  _iterator17.f();
2316
2328
  return _context19.finish(30);
2317
2329
  case 33:
2318
- _this18.recordRecentSqliteWrite(source, compactedToWrite);
2319
- _this18.logInfo('patchOrdersInSQLite-完成', {
2330
+ _this19.recordRecentSqliteWrite(source, compactedToWrite);
2331
+ _this19.logInfo('patchOrdersInSQLite-完成', {
2320
2332
  source: source,
2321
2333
  count: compactedToWrite.length,
2322
2334
  writeMethod: writeMethod,
@@ -2360,7 +2372,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
2360
2372
  key: "updateOrderInSQLite",
2361
2373
  value: (function () {
2362
2374
  var _updateOrderInSQLite = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(order, source) {
2363
- var _this19 = this;
2375
+ var _this20 = this;
2364
2376
  var orderSnapshot, _orderSnapshot$order_3;
2365
2377
  return _regeneratorRuntime().wrap(function _callee22$(_context22) {
2366
2378
  while (1) switch (_context22.prev = _context22.next) {
@@ -2381,43 +2393,43 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
2381
2393
  while (1) switch (_context21.prev = _context21.next) {
2382
2394
  case 0:
2383
2395
  writeMethod = 'none';
2384
- _this19.logInfo('updateOrderInSQLite-开始', {
2396
+ _this20.logInfo('updateOrderInSQLite-开始', {
2385
2397
  source: source,
2386
2398
  orderId: (_orderSnapshot$order_ = orderSnapshot.order_id) !== null && _orderSnapshot$order_ !== void 0 ? _orderSnapshot$order_ : null,
2387
- storageKey: _this19.getOrderStorageKey(orderSnapshot)
2399
+ storageKey: _this20.getOrderStorageKey(orderSnapshot)
2388
2400
  });
2389
- if (!(typeof _this19.dbManager.update === 'function')) {
2401
+ if (!(typeof _this20.dbManager.update === 'function')) {
2390
2402
  _context21.next = 8;
2391
2403
  break;
2392
2404
  }
2393
2405
  writeMethod = 'update';
2394
2406
  _context21.next = 6;
2395
- return _this19.dbManager.update(INDEXDB_STORE_NAME, orderSnapshot);
2407
+ return _this20.dbManager.update(INDEXDB_STORE_NAME, orderSnapshot);
2396
2408
  case 6:
2397
2409
  _context21.next = 18;
2398
2410
  break;
2399
2411
  case 8:
2400
- if (!(typeof _this19.dbManager.bulkUpdate === 'function')) {
2412
+ if (!(typeof _this20.dbManager.bulkUpdate === 'function')) {
2401
2413
  _context21.next = 14;
2402
2414
  break;
2403
2415
  }
2404
2416
  writeMethod = 'bulkUpdate';
2405
2417
  _context21.next = 12;
2406
- return _this19.dbManager.bulkUpdate(INDEXDB_STORE_NAME, [orderSnapshot]);
2418
+ return _this20.dbManager.bulkUpdate(INDEXDB_STORE_NAME, [orderSnapshot]);
2407
2419
  case 12:
2408
2420
  _context21.next = 18;
2409
2421
  break;
2410
2422
  case 14:
2411
- if (!(typeof _this19.dbManager.bulkAdd === 'function')) {
2423
+ if (!(typeof _this20.dbManager.bulkAdd === 'function')) {
2412
2424
  _context21.next = 18;
2413
2425
  break;
2414
2426
  }
2415
2427
  writeMethod = 'bulkAdd';
2416
2428
  _context21.next = 18;
2417
- return _this19.dbManager.bulkAdd(INDEXDB_STORE_NAME, [orderSnapshot]);
2429
+ return _this20.dbManager.bulkAdd(INDEXDB_STORE_NAME, [orderSnapshot]);
2418
2430
  case 18:
2419
- _this19.recordRecentSqliteWrite(source, [orderSnapshot]);
2420
- _this19.logInfo('updateOrderInSQLite-完成', {
2431
+ _this20.recordRecentSqliteWrite(source, [orderSnapshot]);
2432
+ _this20.logInfo('updateOrderInSQLite-完成', {
2421
2433
  source: source,
2422
2434
  orderId: (_orderSnapshot$order_2 = orderSnapshot.order_id) !== null && _orderSnapshot$order_2 !== void 0 ? _orderSnapshot$order_2 : null,
2423
2435
  writeMethod: writeMethod
@@ -2460,7 +2472,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
2460
2472
  key: "replaceOrdersSnapshotInSQLite",
2461
2473
  value: (function () {
2462
2474
  var _replaceOrdersSnapshotInSQLite = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(orderList, source) {
2463
- var _this20 = this;
2475
+ var _this21 = this;
2464
2476
  var remoteSnapshot, mergedSnapshot;
2465
2477
  return _regeneratorRuntime().wrap(function _callee24$(_context24) {
2466
2478
  while (1) switch (_context24.prev = _context24.next) {
@@ -2470,12 +2482,12 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
2470
2482
  break;
2471
2483
  }
2472
2484
  return _context24.abrupt("return", this.compactOrderListByIdentity(orderList.map(function (order) {
2473
- return _this20.normalizeRemoteSyncedOrder(order);
2485
+ return _this21.normalizeRemoteSyncedOrder(order);
2474
2486
  }), "".concat(source, ".snapshotNoDb")).list);
2475
2487
  case 2:
2476
2488
  remoteSnapshot = cloneDeep(orderList);
2477
2489
  mergedSnapshot = this.compactOrderListByIdentity(remoteSnapshot.map(function (order) {
2478
- return _this20.normalizeRemoteSyncedOrder(order);
2490
+ return _this21.normalizeRemoteSyncedOrder(order);
2479
2491
  }), "".concat(source, ".remoteSnapshot")).list;
2480
2492
  _context24.prev = 4;
2481
2493
  _context24.next = 7;
@@ -2484,12 +2496,12 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
2484
2496
  return _regeneratorRuntime().wrap(function _callee23$(_context23) {
2485
2497
  while (1) switch (_context23.prev = _context23.next) {
2486
2498
  case 0:
2487
- if (!(typeof _this20.dbManager.getAll === 'function')) {
2499
+ if (!(typeof _this21.dbManager.getAll === 'function')) {
2488
2500
  _context23.next = 6;
2489
2501
  break;
2490
2502
  }
2491
2503
  _context23.next = 3;
2492
- return _this20.dbManager.getAll(INDEXDB_STORE_NAME);
2504
+ return _this21.dbManager.getAll(INDEXDB_STORE_NAME);
2493
2505
  case 3:
2494
2506
  _context23.t0 = _context23.sent;
2495
2507
  _context23.next = 7;
@@ -2498,18 +2510,18 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
2498
2510
  _context23.t0 = [];
2499
2511
  case 7:
2500
2512
  existingOrders = _context23.t0;
2501
- orderListSnapshot = _this20.mergeRemoteSnapshotWithPendingOrders(remoteSnapshot, existingOrders || []);
2502
- mergedSnapshot = _this20.compactOrderListByIdentity(orderListSnapshot, "".concat(source, ".sqliteSnapshot")).list;
2503
- _this20.logInfo('replaceOrdersSnapshotInSQLite-开始', {
2513
+ orderListSnapshot = _this21.mergeRemoteSnapshotWithPendingOrders(remoteSnapshot, existingOrders || []);
2514
+ mergedSnapshot = _this21.compactOrderListByIdentity(orderListSnapshot, "".concat(source, ".sqliteSnapshot")).list;
2515
+ _this21.logInfo('replaceOrdersSnapshotInSQLite-开始', {
2504
2516
  source: source,
2505
2517
  count: mergedSnapshot.length,
2506
2518
  remoteCount: remoteSnapshot.length,
2507
2519
  preservedPendingCount: mergedSnapshot.length - remoteSnapshot.length
2508
2520
  });
2509
2521
  _context23.next = 13;
2510
- return _this20.dbManager.clear(INDEXDB_STORE_NAME);
2522
+ return _this21.dbManager.clear(INDEXDB_STORE_NAME);
2511
2523
  case 13:
2512
- _this20.logInfo('replaceOrdersSnapshotInSQLite-clear完成', {
2524
+ _this21.logInfo('replaceOrdersSnapshotInSQLite-clear完成', {
2513
2525
  count: mergedSnapshot.length
2514
2526
  });
2515
2527
  if (!(mergedSnapshot.length === 0)) {
@@ -2519,10 +2531,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
2519
2531
  return _context23.abrupt("return");
2520
2532
  case 16:
2521
2533
  _context23.next = 18;
2522
- return _this20.dbManager.bulkAdd(INDEXDB_STORE_NAME, mergedSnapshot);
2534
+ return _this21.dbManager.bulkAdd(INDEXDB_STORE_NAME, mergedSnapshot);
2523
2535
  case 18:
2524
- _this20.recordRecentSqliteWrite(source, mergedSnapshot);
2525
- _this20.logInfo('replaceOrdersSnapshotInSQLite-bulkAdd完成', {
2536
+ _this21.recordRecentSqliteWrite(source, mergedSnapshot);
2537
+ _this21.logInfo('replaceOrdersSnapshotInSQLite-bulkAdd完成', {
2526
2538
  source: source,
2527
2539
  count: mergedSnapshot.length
2528
2540
  });
@@ -2566,7 +2578,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
2566
2578
  key: "clear",
2567
2579
  value: (function () {
2568
2580
  var _clear = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26() {
2569
- var _this21 = this;
2581
+ var _this22 = this;
2570
2582
  return _regeneratorRuntime().wrap(function _callee26$(_context26) {
2571
2583
  while (1) switch (_context26.prev = _context26.next) {
2572
2584
  case 0:
@@ -2583,7 +2595,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
2583
2595
  while (1) switch (_context25.prev = _context25.next) {
2584
2596
  case 0:
2585
2597
  _context25.next = 2;
2586
- return _this21.dbManager.clear(INDEXDB_STORE_NAME);
2598
+ return _this22.dbManager.clear(INDEXDB_STORE_NAME);
2587
2599
  case 2:
2588
2600
  case "end":
2589
2601
  return _context25.stop();
@@ -311,7 +311,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
311
311
  date: string;
312
312
  status: string;
313
313
  week: string;
314
- weekNum: 0 | 2 | 1 | 3 | 6 | 4 | 5;
314
+ weekNum: 0 | 2 | 1 | 6 | 3 | 4 | 5;
315
315
  }[]>;
316
316
  submitTimeSlot(timeSlots: TimeSliceItem): void;
317
317
  private getScheduleDataByIds;
@@ -312,7 +312,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
312
312
  * 获取当前的客户搜索条件
313
313
  * @returns 当前搜索条件
314
314
  */
315
- getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
315
+ getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
316
316
  /**
317
317
  * 获取客户列表状态(包含滚动加载相关状态)
318
318
  * @returns 客户状态
@@ -801,19 +801,20 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
801
801
  }
802
802
  throw new Error('refreshSalesDetail: tempOrder 未加载');
803
803
  case 4:
804
- orderId = tempOrder.order_id;
804
+ debugger;
805
+ orderId = tempOrder.order_id || tempOrder.external_sale_number;
805
806
  if (!(orderId === undefined || orderId === null)) {
806
- _context11.next = 7;
807
+ _context11.next = 8;
807
808
  break;
808
809
  }
809
810
  return _context11.abrupt("return", {});
810
- case 7:
811
+ case 8:
811
812
  return _context11.abrupt("return", this.loadSalesDetail({
812
- orderId: Number(orderId),
813
+ orderId: orderId,
813
814
  // merge: true
814
815
  forceRemote: params.forceRemote
815
816
  }));
816
- case 8:
817
+ case 9:
817
818
  case "end":
818
819
  return _context11.stop();
819
820
  }
@@ -175,6 +175,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
175
175
  private buildProductStructuralFingerprintItem;
176
176
  private buildOrderProductsStructuralFingerprint;
177
177
  private getOriginalSalesSnapshot;
178
+ private isSnapshotPayableAmountUnchanged;
178
179
  private restoreOriginalSnapshotIfProductsUnchanged;
179
180
  private clearPersistedAmountFieldsForFullRecalc;
180
181
  private getPaymentTargetAmount;
@@ -1185,6 +1185,23 @@ var OrderModule = class extends import_BaseModule.BaseModule {
1185
1185
  return null;
1186
1186
  return snapshot;
1187
1187
  }
1188
+ isSnapshotPayableAmountUnchanged(tempOrder, snapshot, snapshotSummary) {
1189
+ const currentPaidPaymentSummary = this.calculatePaidPaymentSummary(tempOrder.payments || []);
1190
+ const currentAmountGap = this.calculateSummaryAmountGap({
1191
+ tempOrder,
1192
+ summary: snapshotSummary,
1193
+ orderPaidAmount: currentPaidPaymentSummary.gapPaidAmount
1194
+ });
1195
+ const snapshotPaidPaymentSummary = this.calculatePaidPaymentSummary(
1196
+ Array.isArray(snapshot.payments) ? snapshot.payments : []
1197
+ );
1198
+ const snapshotAmountGap = this.calculateSummaryAmountGap({
1199
+ tempOrder,
1200
+ summary: snapshotSummary,
1201
+ orderPaidAmount: snapshotPaidPaymentSummary.gapPaidAmount
1202
+ });
1203
+ return currentAmountGap === snapshotAmountGap;
1204
+ }
1188
1205
  restoreOriginalSnapshotIfProductsUnchanged(tempOrder) {
1189
1206
  const snapshot = this.getOriginalSalesSnapshot(tempOrder);
1190
1207
  if (!snapshot)
@@ -1202,6 +1219,8 @@ var OrderModule = class extends import_BaseModule.BaseModule {
1202
1219
  ...(0, import_utils.createEmptySummary)(),
1203
1220
  ...(0, import_lodash_es.cloneDeep)(snapshot.summary || {})
1204
1221
  };
1222
+ if (!this.isSnapshotPayableAmountUnchanged(tempOrder, snapshot, summary))
1223
+ return null;
1205
1224
  if (Array.isArray(snapshot.products)) {
1206
1225
  tempOrder.products = (0, import_lodash_es.cloneDeep)(snapshot.products);
1207
1226
  }
@@ -2742,6 +2761,7 @@ var OrderModule = class extends import_BaseModule.BaseModule {
2742
2761
  const enhancedPayload = (params == null ? void 0 : params.enhancePayload) ? params.enhancePayload(nextPayload, ctx) : nextPayload;
2743
2762
  return enhancedPayload;
2744
2763
  } : void 0;
2764
+ debugger;
2745
2765
  const payload = (0, import_utils.buildSubmitPayload)({
2746
2766
  tempOrder,
2747
2767
  cacheId: effectiveCacheId,
@@ -3185,6 +3205,7 @@ var OrderModule = class extends import_BaseModule.BaseModule {
3185
3205
  with: ["products", "bookings", "payments", "customer", "summary", "contacts_info"],
3186
3206
  ...params.forceRemote ? { forceRemote: true } : {}
3187
3207
  }, { osServer: true });
3208
+ debugger;
3188
3209
  if (res.code === 200) {
3189
3210
  this.store.lastOrderInfo = res.data;
3190
3211
  }
@@ -2382,7 +2382,7 @@ var Server = class {
2382
2382
  }
2383
2383
  return next;
2384
2384
  }
2385
- if (!this.order || typeof this.order.getLocalOrderByLookup !== "function") {
2385
+ if (!this.order || typeof this.order.getLocalOrderFromMemoryByLookup !== "function") {
2386
2386
  if (shouldClearLocalOrderId) {
2387
2387
  this.logInfo(`${title}: checkout 本地订单号已清理`, {
2388
2388
  original_order_id: data.order_id,
@@ -2392,7 +2392,7 @@ var Server = class {
2392
2392
  return next;
2393
2393
  }
2394
2394
  try {
2395
- const localOrder = await this.order.getLocalOrderByLookup(externalSaleNumber);
2395
+ const localOrder = this.order.getLocalOrderFromMemoryByLookup(externalSaleNumber);
2396
2396
  if (!localOrder) {
2397
2397
  if (shouldClearLocalOrderId) {
2398
2398
  this.logInfo(`${title}: checkout 本地订单号已清理`, {
@@ -79,6 +79,7 @@ export declare class OrderModule extends BaseModule implements Module {
79
79
  getOrderById(id: OrderId): OrderData | undefined;
80
80
  /** 按 order_id 查询内存订单。 */
81
81
  getOrderByOrderId(orderId: OrderId): OrderData | undefined;
82
+ getLocalOrderFromMemoryByLookup(lookup: OrderId): OrderData | null;
82
83
  getLocalOrderByLookup(lookup: OrderId): Promise<OrderData | null>;
83
84
  loadOrdersByServer(): Promise<OrderData[]>;
84
85
  /**
@@ -379,6 +379,14 @@ var OrderModule = class extends import_BaseModule.BaseModule {
379
379
  getOrderByOrderId(orderId) {
380
380
  return this.store.map.get(this.getIdKey(orderId));
381
381
  }
382
+ getLocalOrderFromMemoryByLookup(lookup) {
383
+ const key = this.getIdKey(lookup);
384
+ const memoryOrderById = this.store.map.get(key);
385
+ if (memoryOrderById)
386
+ return memoryOrderById;
387
+ const memoryOrder = this.store.list.find((order) => this.isOrderLookupMatch(order, key));
388
+ return memoryOrder || null;
389
+ }
382
390
  async getLocalOrderByLookup(lookup) {
383
391
  const key = this.getIdKey(lookup);
384
392
  const memoryOrderById = this.store.map.get(key);
@@ -311,7 +311,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
311
311
  date: string;
312
312
  status: string;
313
313
  week: string;
314
- weekNum: 0 | 2 | 1 | 3 | 6 | 4 | 5;
314
+ weekNum: 0 | 2 | 1 | 6 | 3 | 4 | 5;
315
315
  }[]>;
316
316
  submitTimeSlot(timeSlots: TimeSliceItem): void;
317
317
  private getScheduleDataByIds;
@@ -312,7 +312,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
312
312
  * 获取当前的客户搜索条件
313
313
  * @returns 当前搜索条件
314
314
  */
315
- getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
315
+ getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
316
316
  /**
317
317
  * 获取客户列表状态(包含滚动加载相关状态)
318
318
  * @returns 客户状态
@@ -471,12 +471,13 @@ var BookingTicketImpl = class extends import_BaseSales.BaseSalesImpl {
471
471
  if (!tempOrder) {
472
472
  throw new Error("refreshSalesDetail: tempOrder 未加载");
473
473
  }
474
- const orderId = tempOrder.order_id;
474
+ debugger;
475
+ const orderId = tempOrder.order_id || tempOrder.external_sale_number;
475
476
  if (orderId === void 0 || orderId === null) {
476
477
  return {};
477
478
  }
478
479
  return this.loadSalesDetail({
479
- orderId: Number(orderId),
480
+ orderId,
480
481
  // merge: true
481
482
  forceRemote: params.forceRemote
482
483
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "2.2.227",
4
+ "version": "2.2.229",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",