@pisell/pisellos 2.2.259 → 2.2.260

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 (103) hide show
  1. package/dist/model/strategy/adapter/dataVariant/adapter.d.ts +49 -0
  2. package/dist/model/strategy/adapter/dataVariant/adapter.js +152 -0
  3. package/dist/model/strategy/adapter/dataVariant/evaluator.d.ts +87 -0
  4. package/dist/model/strategy/adapter/dataVariant/evaluator.js +755 -0
  5. package/dist/model/strategy/adapter/dataVariant/examples.d.ts +39 -0
  6. package/dist/model/strategy/adapter/dataVariant/examples.js +282 -0
  7. package/dist/model/strategy/adapter/dataVariant/index.d.ts +4 -0
  8. package/dist/model/strategy/adapter/dataVariant/index.js +4 -0
  9. package/dist/model/strategy/adapter/dataVariant/type.d.ts +146 -0
  10. package/dist/model/strategy/adapter/dataVariant/type.js +54 -0
  11. package/dist/model/strategy/adapter/index.d.ts +4 -0
  12. package/dist/model/strategy/adapter/index.js +5 -1
  13. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +13 -17
  14. package/dist/modules/Order/index.d.ts +1 -32
  15. package/dist/modules/Order/index.js +288 -615
  16. package/dist/modules/Order/types.d.ts +2 -20
  17. package/dist/modules/Order/utils.d.ts +0 -4
  18. package/dist/modules/Order/utils.js +28 -114
  19. package/dist/modules/Product/index.d.ts +1 -1
  20. package/dist/modules/Product/types.d.ts +22 -0
  21. package/dist/modules/ProductList/index.d.ts +1 -1
  22. package/dist/modules/ProductList/index.js +4 -2
  23. package/dist/modules/ProductList/types.d.ts +2 -0
  24. package/dist/modules/Rules/index.d.ts +3 -3
  25. package/dist/modules/Rules/index.js +3 -8
  26. package/dist/modules/Rules/types.d.ts +1 -2
  27. package/dist/modules/SalesSummary/index.d.ts +3 -7
  28. package/dist/modules/SalesSummary/index.js +39 -67
  29. package/dist/modules/SalesSummary/types.d.ts +0 -1
  30. package/dist/modules/SalesSummary/utils.js +1 -2
  31. package/dist/modules/SurchargeList/index.d.ts +4 -6
  32. package/dist/modules/SurchargeList/index.js +39 -62
  33. package/dist/modules/SurchargeList/types.d.ts +2 -6
  34. package/dist/server/index.d.ts +50 -3
  35. package/dist/server/index.js +1040 -1075
  36. package/dist/server/modules/order/index.d.ts +3 -22
  37. package/dist/server/modules/order/index.js +316 -398
  38. package/dist/server/modules/products/index.d.ts +26 -7
  39. package/dist/server/modules/products/index.js +166 -76
  40. package/dist/server/modules/products/types.d.ts +14 -0
  41. package/dist/solution/BaseSales/index.d.ts +2 -22
  42. package/dist/solution/BaseSales/index.js +701 -995
  43. package/dist/solution/BaseSales/types.d.ts +0 -1
  44. package/dist/solution/BaseSales/types.js +1 -2
  45. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +3 -6
  46. package/dist/solution/BookingByStep/index.d.ts +1 -1
  47. package/dist/solution/BookingTicket/index.d.ts +0 -8
  48. package/dist/solution/BookingTicket/index.js +6 -153
  49. package/dist/solution/BookingTicket/types.d.ts +2 -0
  50. package/lib/model/strategy/adapter/dataVariant/adapter.d.ts +49 -0
  51. package/lib/model/strategy/adapter/dataVariant/adapter.js +139 -0
  52. package/lib/model/strategy/adapter/dataVariant/evaluator.d.ts +87 -0
  53. package/lib/model/strategy/adapter/dataVariant/evaluator.js +564 -0
  54. package/lib/model/strategy/adapter/dataVariant/examples.d.ts +39 -0
  55. package/lib/model/strategy/adapter/dataVariant/examples.js +295 -0
  56. package/lib/model/strategy/adapter/dataVariant/index.d.ts +4 -0
  57. package/lib/model/strategy/adapter/dataVariant/index.js +38 -0
  58. package/lib/model/strategy/adapter/dataVariant/type.d.ts +146 -0
  59. package/lib/model/strategy/adapter/dataVariant/type.js +31 -0
  60. package/lib/model/strategy/adapter/index.d.ts +4 -0
  61. package/lib/model/strategy/adapter/index.js +13 -2
  62. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +1 -11
  63. package/lib/modules/Order/index.d.ts +1 -32
  64. package/lib/modules/Order/index.js +64 -402
  65. package/lib/modules/Order/types.d.ts +2 -20
  66. package/lib/modules/Order/utils.d.ts +0 -4
  67. package/lib/modules/Order/utils.js +2 -84
  68. package/lib/modules/Product/index.d.ts +1 -1
  69. package/lib/modules/Product/types.d.ts +22 -0
  70. package/lib/modules/ProductList/index.d.ts +1 -1
  71. package/lib/modules/ProductList/index.js +4 -2
  72. package/lib/modules/ProductList/types.d.ts +2 -0
  73. package/lib/modules/Rules/index.d.ts +3 -3
  74. package/lib/modules/Rules/index.js +3 -4
  75. package/lib/modules/Rules/types.d.ts +1 -2
  76. package/lib/modules/SalesSummary/index.d.ts +3 -7
  77. package/lib/modules/SalesSummary/index.js +11 -28
  78. package/lib/modules/SalesSummary/types.d.ts +0 -1
  79. package/lib/modules/SalesSummary/utils.js +0 -2
  80. package/lib/modules/SurchargeList/index.d.ts +4 -6
  81. package/lib/modules/SurchargeList/index.js +21 -41
  82. package/lib/modules/SurchargeList/types.d.ts +2 -6
  83. package/lib/server/index.d.ts +50 -3
  84. package/lib/server/index.js +215 -244
  85. package/lib/server/modules/order/index.d.ts +3 -22
  86. package/lib/server/modules/order/index.js +53 -103
  87. package/lib/server/modules/products/index.d.ts +26 -7
  88. package/lib/server/modules/products/index.js +113 -35
  89. package/lib/server/modules/products/types.d.ts +14 -0
  90. package/lib/solution/BaseSales/index.d.ts +2 -22
  91. package/lib/solution/BaseSales/index.js +60 -246
  92. package/lib/solution/BaseSales/types.d.ts +0 -1
  93. package/lib/solution/BaseSales/types.js +1 -2
  94. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +6 -6
  95. package/lib/solution/BookingByStep/index.d.ts +1 -1
  96. package/lib/solution/BookingTicket/index.d.ts +0 -8
  97. package/lib/solution/BookingTicket/index.js +0 -101
  98. package/lib/solution/BookingTicket/types.d.ts +2 -0
  99. package/package.json +1 -1
  100. package/dist/modules/Order/utils/bundleDiscountHydration.d.ts +0 -5
  101. package/dist/modules/Order/utils/bundleDiscountHydration.js +0 -144
  102. package/lib/modules/Order/utils/bundleDiscountHydration.d.ts +0 -5
  103. package/lib/modules/Order/utils/bundleDiscountHydration.js +0 -139
@@ -62,7 +62,7 @@ var PRODUCT_TITLE_SNAPSHOT_KEYS = ['en', 'ja', 'pt', 'auto', 'zh-CN', 'zh-HK', '
62
62
  var Server = /*#__PURE__*/function () {
63
63
  function Server(core) {
64
64
  var _this = this,
65
- _this$app4;
65
+ _this$app3;
66
66
  _classCallCheck(this, Server);
67
67
  _defineProperty(this, "core", void 0);
68
68
  _defineProperty(this, "app", void 0);
@@ -93,6 +93,8 @@ var Server = /*#__PURE__*/function () {
93
93
  });
94
94
  // ---- 商品查询订阅者 ----
95
95
  _defineProperty(this, "productQuerySubscribers", new Map());
96
+ /** subscriberId → 智能定价变价时间点定时器句柄(与 subscriber 分离存储,便于 clear) */
97
+ _defineProperty(this, "productQueryScheduleTimers", new Map());
96
98
  // ---- 订单 / 预约列表查询订阅者 ----
97
99
  _defineProperty(this, "orderQuerySubscribers", new Map());
98
100
  _defineProperty(this, "bookingQuerySubscribers", new Map());
@@ -271,13 +273,13 @@ var Server = /*#__PURE__*/function () {
271
273
  */
272
274
  _defineProperty(this, "handleProductQuery", /*#__PURE__*/function () {
273
275
  var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_ref5) {
274
- var url, method, data, config, menu_list_ids, schedule_datetime, schedule_date, customer_id, ids, extension_type, _ref7, callback, subscriberId;
276
+ var url, method, data, config, menu_list_ids, schedule_datetime, schedule_date, customer_id, ids, extension_type, strategy_context, _ref7, callback, subscriberId, result;
275
277
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
276
278
  while (1) switch (_context3.prev = _context3.next) {
277
279
  case 0:
278
280
  url = _ref5.url, method = _ref5.method, data = _ref5.data, config = _ref5.config;
279
281
  console.log('[Server] handleProductQuery:', url, method, data, config);
280
- menu_list_ids = data.menu_list_ids, schedule_datetime = data.schedule_datetime, schedule_date = data.schedule_date, customer_id = data.customer_id, ids = data.ids, extension_type = data.extension_type;
282
+ menu_list_ids = data.menu_list_ids, schedule_datetime = data.schedule_datetime, schedule_date = data.schedule_date, customer_id = data.customer_id, ids = data.ids, extension_type = data.extension_type, strategy_context = data.strategy_context;
281
283
  _ref7 = config || {}, callback = _ref7.callback, subscriberId = _ref7.subscriberId;
282
284
  _this.logInfo('handleProductQuery: 开始处理商品查询请求', {
283
285
  menu_list_ids: menu_list_ids,
@@ -285,7 +287,8 @@ var Server = /*#__PURE__*/function () {
285
287
  schedule_datetime: schedule_datetime,
286
288
  schedule_date: schedule_date,
287
289
  customer_id: customer_id,
288
- extension_type: extension_type
290
+ extension_type: extension_type,
291
+ strategyContextKeys: strategy_context ? Object.keys(strategy_context) : []
289
292
  });
290
293
 
291
294
  // 存储订阅者:后续 pubsub 数据变更时可通过 callback 推送最新结果
@@ -298,7 +301,8 @@ var Server = /*#__PURE__*/function () {
298
301
  schedule_date: schedule_date,
299
302
  schedule_datetime: schedule_datetime,
300
303
  customer_id: customer_id,
301
- extension_type: extension_type
304
+ extension_type: extension_type,
305
+ strategy_context: strategy_context
302
306
  }
303
307
  });
304
308
  _this.logInfo('handleProductQuery: 已注册订阅者', {
@@ -306,15 +310,23 @@ var Server = /*#__PURE__*/function () {
306
310
  totalSubscribers: _this.productQuerySubscribers.size
307
311
  });
308
312
  }
309
- return _context3.abrupt("return", _this.computeProductQueryResult({
313
+ _context3.next = 8;
314
+ return _this.computeProductQueryResult({
310
315
  menu_list_ids: menu_list_ids,
311
316
  ids: ids,
312
317
  schedule_date: schedule_date,
313
318
  schedule_datetime: schedule_datetime,
314
319
  customer_id: customer_id,
315
- extension_type: extension_type
316
- }));
317
- case 7:
320
+ extension_type: extension_type,
321
+ strategy_context: strategy_context
322
+ });
323
+ case 8:
324
+ result = _context3.sent;
325
+ if (subscriberId && typeof callback === 'function') {
326
+ _this.syncProductQueryScheduleTimers(subscriberId, strategy_context);
327
+ }
328
+ return _context3.abrupt("return", result);
329
+ case 11:
318
330
  case "end":
319
331
  return _context3.stop();
320
332
  }
@@ -1029,8 +1041,7 @@ var Server = /*#__PURE__*/function () {
1029
1041
  checkoutData: checkoutData,
1030
1042
  order: printableOrder,
1031
1043
  response: null,
1032
- requireFullyPaid: false,
1033
- isManualPrint: true
1044
+ requireFullyPaid: false
1034
1045
  });
1035
1046
  case 27:
1036
1047
  printResult = _context16.sent;
@@ -1069,143 +1080,14 @@ var Server = /*#__PURE__*/function () {
1069
1080
  return _ref39.apply(this, arguments);
1070
1081
  };
1071
1082
  }());
1072
- _defineProperty(this, "handleMachinecodeBatchMeta", /*#__PURE__*/function () {
1083
+ _defineProperty(this, "handleOrderSalesDetail", /*#__PURE__*/function () {
1073
1084
  var _ref43 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(_ref42) {
1074
- var _this$resolveMachinec, _this$app2;
1075
- var data, title, backendPath, ids, status, message, _response$code, _response$status, _response$message, _response$data2, response, backendError, _backendError$code, _backendError$status, _backendError$message, _backendError$data, _message;
1085
+ var _this$app2;
1086
+ var url, data, path, requestPath, lookup, localOrder, backendPath, _response$data2, response, fresh, savedOrder, errorMessage;
1076
1087
  return _regeneratorRuntime().wrap(function _callee17$(_context17) {
1077
1088
  while (1) switch (_context17.prev = _context17.next) {
1078
1089
  case 0:
1079
- data = _ref42.data;
1080
- title = 'handleMachinecodeBatchMeta';
1081
- backendPath = '/shop/machinecode/batch';
1082
- ids = Array.isArray(data === null || data === void 0 ? void 0 : data.ids) ? data.ids : [];
1083
- status = data === null || data === void 0 ? void 0 : data.status;
1084
- _this.logInfo("".concat(title, ": \u5F00\u59CB\u5904\u7406"), {
1085
- backendPath: backendPath,
1086
- batchSize: ids.length,
1087
- status: status,
1088
- order_lookup: (_this$resolveMachinec = _this.resolveMachinecodeBatchMetadataLookup(data)) !== null && _this$resolveMachinec !== void 0 ? _this$resolveMachinec : null
1089
- });
1090
- if (!(ids.length === 0)) {
1091
- _context17.next = 8;
1092
- break;
1093
- }
1094
- return _context17.abrupt("return", {
1095
- code: 200,
1096
- status: true,
1097
- message: '',
1098
- data: []
1099
- });
1100
- case 8:
1101
- if (!(status !== 'used' && status !== 'unused')) {
1102
- _context17.next = 10;
1103
- break;
1104
- }
1105
- return _context17.abrupt("return", {
1106
- code: 400,
1107
- status: false,
1108
- message: '无效的核销状态',
1109
- data: null
1110
- });
1111
- case 10:
1112
- _context17.prev = 10;
1113
- _context17.next = 13;
1114
- return _this.syncMachinecodeRedeemStatusToLocalOrder(data, ids, status);
1115
- case 13:
1116
- _context17.next = 20;
1117
- break;
1118
- case 15:
1119
- _context17.prev = 15;
1120
- _context17.t0 = _context17["catch"](10);
1121
- message = _this.getUnknownErrorMessage(_context17.t0);
1122
- _this.logError("".concat(title, ": \u672C\u5730\u8BA2\u5355\u6838\u9500\u72B6\u6001\u66F4\u65B0\u5931\u8D25"), {
1123
- error: message,
1124
- error_detail: _this.normalizeUnknownError(_context17.t0)
1125
- });
1126
- return _context17.abrupt("return", {
1127
- code: 500,
1128
- status: false,
1129
- message: message,
1130
- data: null
1131
- });
1132
- case 20:
1133
- if ((_this$app2 = _this.app) !== null && _this$app2 !== void 0 && (_this$app2 = _this$app2.request) !== null && _this$app2 !== void 0 && _this$app2.post) {
1134
- _context17.next = 23;
1135
- break;
1136
- }
1137
- _this.logError("".concat(title, ": app.request \u4E0D\u53EF\u7528"), {
1138
- backendPath: backendPath
1139
- });
1140
- return _context17.abrupt("return", {
1141
- code: 500,
1142
- status: false,
1143
- message: 'app.request 不可用',
1144
- data: null
1145
- });
1146
- case 23:
1147
- _context17.prev = 23;
1148
- _context17.next = 26;
1149
- return _this.app.request.post(backendPath, {
1150
- ids: ids,
1151
- status: status
1152
- }, {
1153
- isShopApi: true,
1154
- customToast: function customToast() {}
1155
- });
1156
- case 26:
1157
- response = _context17.sent;
1158
- return _context17.abrupt("return", {
1159
- code: (_response$code = response === null || response === void 0 ? void 0 : response.code) !== null && _response$code !== void 0 ? _response$code : 200,
1160
- status: (_response$status = response === null || response === void 0 ? void 0 : response.status) !== null && _response$status !== void 0 ? _response$status : true,
1161
- message: (_response$message = response === null || response === void 0 ? void 0 : response.message) !== null && _response$message !== void 0 ? _response$message : '',
1162
- data: (_response$data2 = response === null || response === void 0 ? void 0 : response.data) !== null && _response$data2 !== void 0 ? _response$data2 : response
1163
- });
1164
- case 30:
1165
- _context17.prev = 30;
1166
- _context17.t1 = _context17["catch"](23);
1167
- backendError = _this.extractBackendErrorResponse(_context17.t1);
1168
- if (!backendError) {
1169
- _context17.next = 35;
1170
- break;
1171
- }
1172
- return _context17.abrupt("return", {
1173
- code: (_backendError$code = backendError.code) !== null && _backendError$code !== void 0 ? _backendError$code : 500,
1174
- status: (_backendError$status = backendError.status) !== null && _backendError$status !== void 0 ? _backendError$status : false,
1175
- message: (_backendError$message = backendError.message) !== null && _backendError$message !== void 0 ? _backendError$message : '后端拒绝 batch-metadata',
1176
- data: (_backendError$data = backendError.data) !== null && _backendError$data !== void 0 ? _backendError$data : null
1177
- });
1178
- case 35:
1179
- _message = _this.getUnknownErrorMessage(_context17.t1);
1180
- _this.logError("".concat(title, ": \u8BF7\u6C42\u5931\u8D25"), {
1181
- backendPath: backendPath,
1182
- error: _message,
1183
- error_detail: _this.normalizeUnknownError(_context17.t1)
1184
- });
1185
- return _context17.abrupt("return", {
1186
- code: 500,
1187
- status: false,
1188
- message: _message,
1189
- data: null
1190
- });
1191
- case 38:
1192
- case "end":
1193
- return _context17.stop();
1194
- }
1195
- }, _callee17, null, [[10, 15], [23, 30]]);
1196
- }));
1197
- return function (_x17) {
1198
- return _ref43.apply(this, arguments);
1199
- };
1200
- }());
1201
- _defineProperty(this, "handleOrderSalesDetail", /*#__PURE__*/function () {
1202
- var _ref45 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(_ref44) {
1203
- var _this$app3;
1204
- var url, data, path, requestPath, lookup, localOrder, backendPath, _response$data3, response, fresh, savedOrder, errorMessage;
1205
- return _regeneratorRuntime().wrap(function _callee18$(_context18) {
1206
- while (1) switch (_context18.prev = _context18.next) {
1207
- case 0:
1208
- url = _ref44.url, data = _ref44.data, path = _ref44.path;
1090
+ url = _ref42.url, data = _ref42.data, path = _ref42.path;
1209
1091
  requestPath = _this.parseRequestPath(url, path);
1210
1092
  lookup = _this.extractOrderSalesDetailLookup(requestPath);
1211
1093
  _this.logInfo('handleOrderSalesDetail: 开始处理', {
@@ -1214,14 +1096,14 @@ var Server = /*#__PURE__*/function () {
1214
1096
  lookup: lookup
1215
1097
  });
1216
1098
  if (lookup) {
1217
- _context18.next = 7;
1099
+ _context17.next = 7;
1218
1100
  break;
1219
1101
  }
1220
1102
  _this.logWarning('handleOrderSalesDetail: lookup 缺失', {
1221
1103
  url: url,
1222
1104
  path: requestPath
1223
1105
  });
1224
- return _context18.abrupt("return", {
1106
+ return _context17.abrupt("return", {
1225
1107
  code: 400,
1226
1108
  status: false,
1227
1109
  message: '订单 lookup 缺失',
@@ -1229,11 +1111,11 @@ var Server = /*#__PURE__*/function () {
1229
1111
  });
1230
1112
  case 7:
1231
1113
  if (_this.order) {
1232
- _context18.next = 10;
1114
+ _context17.next = 10;
1233
1115
  break;
1234
1116
  }
1235
1117
  _this.logError('handleOrderSalesDetail: Order 模块未注册');
1236
- return _context18.abrupt("return", {
1118
+ return _context17.abrupt("return", {
1237
1119
  code: 500,
1238
1120
  status: false,
1239
1121
  message: 'Order 模块未注册',
@@ -1241,33 +1123,33 @@ var Server = /*#__PURE__*/function () {
1241
1123
  });
1242
1124
  case 10:
1243
1125
  if (_this.shouldForceRemoteSalesDetail(data)) {
1244
- _context18.next = 17;
1126
+ _context17.next = 17;
1245
1127
  break;
1246
1128
  }
1247
- _context18.next = 13;
1129
+ _context17.next = 13;
1248
1130
  return _this.order.getLocalOrderByLookup(lookup);
1249
1131
  case 13:
1250
- localOrder = _context18.sent;
1132
+ localOrder = _context17.sent;
1251
1133
  if (!localOrder) {
1252
- _context18.next = 17;
1134
+ _context17.next = 17;
1253
1135
  break;
1254
1136
  }
1255
1137
  _this.logInfo('handleOrderSalesDetail: 命中本地订单', {
1256
1138
  lookup: lookup
1257
1139
  });
1258
- return _context18.abrupt("return", {
1140
+ return _context17.abrupt("return", {
1259
1141
  code: 200,
1260
1142
  status: true,
1261
1143
  message: '',
1262
1144
  data: localOrder
1263
1145
  });
1264
1146
  case 17:
1265
- if ((_this$app3 = _this.app) !== null && _this$app3 !== void 0 && _this$app3.request) {
1266
- _context18.next = 20;
1147
+ if ((_this$app2 = _this.app) !== null && _this$app2 !== void 0 && _this$app2.request) {
1148
+ _context17.next = 20;
1267
1149
  break;
1268
1150
  }
1269
1151
  _this.logError('handleOrderSalesDetail: app.request 不可用');
1270
- return _context18.abrupt("return", {
1152
+ return _context17.abrupt("return", {
1271
1153
  code: 500,
1272
1154
  status: false,
1273
1155
  message: 'app.request 不可用',
@@ -1275,8 +1157,8 @@ var Server = /*#__PURE__*/function () {
1275
1157
  });
1276
1158
  case 20:
1277
1159
  backendPath = _this.buildOrderSalesDetailBackendPath(lookup, data);
1278
- _context18.prev = 21;
1279
- _context18.next = 24;
1160
+ _context17.prev = 21;
1161
+ _context17.next = 24;
1280
1162
  return _this.app.request.get(backendPath, {
1281
1163
  lookup_mode: 'multi'
1282
1164
  }, {
@@ -1284,38 +1166,38 @@ var Server = /*#__PURE__*/function () {
1284
1166
  customToast: function customToast() {}
1285
1167
  });
1286
1168
  case 24:
1287
- response = _context18.sent;
1288
- fresh = (_response$data3 = response === null || response === void 0 ? void 0 : response.data) !== null && _response$data3 !== void 0 ? _response$data3 : response;
1169
+ response = _context17.sent;
1170
+ fresh = (_response$data2 = response === null || response === void 0 ? void 0 : response.data) !== null && _response$data2 !== void 0 ? _response$data2 : response;
1289
1171
  if (!(!fresh || _typeof(fresh) !== 'object' || fresh.order_id == null)) {
1290
- _context18.next = 29;
1172
+ _context17.next = 29;
1291
1173
  break;
1292
1174
  }
1293
1175
  _this.logInfo('handleOrderSalesDetail: 后端返回订单为空', {
1294
1176
  lookup: lookup,
1295
1177
  backendPath: backendPath
1296
1178
  });
1297
- return _context18.abrupt("return", {
1179
+ return _context17.abrupt("return", {
1298
1180
  code: 500,
1299
1181
  status: false,
1300
1182
  message: '后端返回订单为空',
1301
1183
  data: null
1302
1184
  });
1303
1185
  case 29:
1304
- _context18.next = 31;
1186
+ _context17.next = 31;
1305
1187
  return _this.order.upsertOrdersFromRemote([fresh]);
1306
1188
  case 31:
1307
- _context18.next = 33;
1189
+ _context17.next = 33;
1308
1190
  return _this.order.getLocalOrderByLookup(lookup);
1309
1191
  case 33:
1310
- savedOrder = _context18.sent;
1192
+ savedOrder = _context17.sent;
1311
1193
  if (savedOrder) {
1312
- _context18.next = 37;
1194
+ _context17.next = 37;
1313
1195
  break;
1314
1196
  }
1315
1197
  _this.logError('handleOrderSalesDetail: 订单写入后回读失败', {
1316
1198
  lookup: lookup
1317
1199
  });
1318
- return _context18.abrupt("return", {
1200
+ return _context17.abrupt("return", {
1319
1201
  code: 500,
1320
1202
  status: false,
1321
1203
  message: '订单写入后回读失败',
@@ -1325,22 +1207,22 @@ var Server = /*#__PURE__*/function () {
1325
1207
  _this.logInfo('handleOrderSalesDetail: 远端订单已同步到本地', {
1326
1208
  lookup: lookup
1327
1209
  });
1328
- return _context18.abrupt("return", {
1210
+ return _context17.abrupt("return", {
1329
1211
  code: 200,
1330
1212
  status: true,
1331
1213
  message: '',
1332
1214
  data: savedOrder
1333
1215
  });
1334
1216
  case 41:
1335
- _context18.prev = 41;
1336
- _context18.t0 = _context18["catch"](21);
1337
- errorMessage = _context18.t0 instanceof Error ? _context18.t0.message : String(_context18.t0);
1338
- _this.logInfo('handleOrderSalesDetail: 请求失败', {
1217
+ _context17.prev = 41;
1218
+ _context17.t0 = _context17["catch"](21);
1219
+ errorMessage = _context17.t0 instanceof Error ? _context17.t0.message : String(_context17.t0);
1220
+ _this.logError('handleOrderSalesDetail: 请求失败', {
1339
1221
  lookup: lookup,
1340
1222
  backendPath: backendPath,
1341
1223
  error: errorMessage
1342
1224
  });
1343
- return _context18.abrupt("return", {
1225
+ return _context17.abrupt("return", {
1344
1226
  code: 500,
1345
1227
  status: false,
1346
1228
  message: errorMessage,
@@ -1348,28 +1230,28 @@ var Server = /*#__PURE__*/function () {
1348
1230
  });
1349
1231
  case 46:
1350
1232
  case "end":
1351
- return _context18.stop();
1233
+ return _context17.stop();
1352
1234
  }
1353
- }, _callee18, null, [[21, 41]]);
1235
+ }, _callee17, null, [[21, 41]]);
1354
1236
  }));
1355
- return function (_x18) {
1356
- return _ref45.apply(this, arguments);
1237
+ return function (_x17) {
1238
+ return _ref43.apply(this, arguments);
1357
1239
  };
1358
1240
  }());
1359
1241
  /**
1360
1242
  * GET /shop/schedule/floor-plan* 前缀路由:读本地 store;支持 subscriberId + callback 订阅更新
1361
1243
  */
1362
1244
  _defineProperty(this, "handleFloorPlanGet", /*#__PURE__*/function () {
1363
- var _ref47 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(_ref46) {
1364
- var url, data, config, routePath, base, path, _subscriberId, _ref48, callback, subscriberId, ctx;
1365
- return _regeneratorRuntime().wrap(function _callee19$(_context19) {
1366
- while (1) switch (_context19.prev = _context19.next) {
1245
+ var _ref45 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(_ref44) {
1246
+ var url, data, config, routePath, base, path, _subscriberId, _ref46, callback, subscriberId, ctx;
1247
+ return _regeneratorRuntime().wrap(function _callee18$(_context18) {
1248
+ while (1) switch (_context18.prev = _context18.next) {
1367
1249
  case 0:
1368
- url = _ref46.url, data = _ref46.data, config = _ref46.config, routePath = _ref46.path;
1250
+ url = _ref44.url, data = _ref44.data, config = _ref44.config, routePath = _ref44.path;
1369
1251
  base = '/shop/schedule/floor-plan';
1370
1252
  path = _this.parseRequestPath(url, routePath);
1371
1253
  if (!(path === "".concat(base, "/unsubscribe") || path === "".concat(base, "/code/unsubscribe"))) {
1372
- _context19.next = 7;
1254
+ _context18.next = 7;
1373
1255
  break;
1374
1256
  }
1375
1257
  _subscriberId = data === null || data === void 0 ? void 0 : data.subscriberId;
@@ -1380,19 +1262,19 @@ var Server = /*#__PURE__*/function () {
1380
1262
  remaining: _this.floorPlanQuerySubscribers.size
1381
1263
  });
1382
1264
  }
1383
- return _context19.abrupt("return", {
1265
+ return _context18.abrupt("return", {
1384
1266
  code: 200,
1385
1267
  message: 'ok',
1386
1268
  status: true
1387
1269
  });
1388
1270
  case 7:
1389
- _ref48 = config || {}, callback = _ref48.callback, subscriberId = _ref48.subscriberId;
1271
+ _ref46 = config || {}, callback = _ref46.callback, subscriberId = _ref46.subscriberId;
1390
1272
  ctx = _this.resolveFloorPlanQueryContext(path, base);
1391
1273
  if (ctx) {
1392
- _context19.next = 11;
1274
+ _context18.next = 11;
1393
1275
  break;
1394
1276
  }
1395
- return _context19.abrupt("return", {
1277
+ return _context18.abrupt("return", {
1396
1278
  status: false,
1397
1279
  code: 404,
1398
1280
  message: 'Not Found',
@@ -1410,28 +1292,28 @@ var Server = /*#__PURE__*/function () {
1410
1292
  total: _this.floorPlanQuerySubscribers.size
1411
1293
  });
1412
1294
  }
1413
- return _context19.abrupt("return", _this.computeFloorPlanQueryResult(ctx));
1295
+ return _context18.abrupt("return", _this.computeFloorPlanQueryResult(ctx));
1414
1296
  case 13:
1415
1297
  case "end":
1416
- return _context19.stop();
1298
+ return _context18.stop();
1417
1299
  }
1418
- }, _callee19);
1300
+ }, _callee18);
1419
1301
  }));
1420
- return function (_x19) {
1421
- return _ref47.apply(this, arguments);
1302
+ return function (_x18) {
1303
+ return _ref45.apply(this, arguments);
1422
1304
  };
1423
1305
  }());
1424
1306
  /**
1425
1307
  * 取消预约列表查询订阅(HTTP 路由入口)
1426
1308
  */
1427
1309
  _defineProperty(this, "handleUnsubscribeBookingQuery", /*#__PURE__*/function () {
1428
- var _ref50 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(_ref49) {
1429
- var data, _ref51, subscriberId;
1430
- return _regeneratorRuntime().wrap(function _callee20$(_context20) {
1431
- while (1) switch (_context20.prev = _context20.next) {
1310
+ var _ref48 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(_ref47) {
1311
+ var data, _ref49, subscriberId;
1312
+ return _regeneratorRuntime().wrap(function _callee19$(_context19) {
1313
+ while (1) switch (_context19.prev = _context19.next) {
1432
1314
  case 0:
1433
- data = _ref49.data;
1434
- _ref51 = data || {}, subscriberId = _ref51.subscriberId;
1315
+ data = _ref47.data;
1316
+ _ref49 = data || {}, subscriberId = _ref49.subscriberId;
1435
1317
  if (subscriberId) {
1436
1318
  _this.bookingQuerySubscribers.delete(subscriberId);
1437
1319
  _this.bookingRemoteQuerySubscribers.delete(subscriberId);
@@ -1441,19 +1323,19 @@ var Server = /*#__PURE__*/function () {
1441
1323
  remainingRemote: _this.bookingRemoteQuerySubscribers.size
1442
1324
  });
1443
1325
  }
1444
- return _context20.abrupt("return", {
1326
+ return _context19.abrupt("return", {
1445
1327
  code: 200,
1446
1328
  message: 'ok',
1447
1329
  status: true
1448
1330
  });
1449
1331
  case 4:
1450
1332
  case "end":
1451
- return _context20.stop();
1333
+ return _context19.stop();
1452
1334
  }
1453
- }, _callee20);
1335
+ }, _callee19);
1454
1336
  }));
1455
- return function (_x20) {
1456
- return _ref50.apply(this, arguments);
1337
+ return function (_x19) {
1338
+ return _ref48.apply(this, arguments);
1457
1339
  };
1458
1340
  }());
1459
1341
  /**
@@ -1461,13 +1343,13 @@ var Server = /*#__PURE__*/function () {
1461
1343
  * 通过餐牌ID列表获取所有相关日程的时间段点
1462
1344
  */
1463
1345
  _defineProperty(this, "handleGetScheduleTimePoints", /*#__PURE__*/function () {
1464
- var _ref53 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(_ref52) {
1346
+ var _ref51 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(_ref50) {
1465
1347
  var _menu_list_ids$length;
1466
1348
  var url, method, data, config, menu_list_ids, _menu_list_ids$length2, menuList, scheduleIds, scheduleList, timePoints, errorMessage;
1467
- return _regeneratorRuntime().wrap(function _callee21$(_context21) {
1468
- while (1) switch (_context21.prev = _context21.next) {
1349
+ return _regeneratorRuntime().wrap(function _callee20$(_context20) {
1350
+ while (1) switch (_context20.prev = _context20.next) {
1469
1351
  case 0:
1470
- url = _ref52.url, method = _ref52.method, data = _ref52.data, config = _ref52.config;
1352
+ url = _ref50.url, method = _ref50.method, data = _ref50.data, config = _ref50.config;
1471
1353
  console.log('[Server] handleGetScheduleTimePoints:', url, method, data, config);
1472
1354
  menu_list_ids = data.menu_list_ids;
1473
1355
  _this.logInfo('handleGetScheduleTimePoints 开始处理', {
@@ -1477,12 +1359,12 @@ var Server = /*#__PURE__*/function () {
1477
1359
 
1478
1360
  // 检查必要的模块是否已注册
1479
1361
  if (_this.menu) {
1480
- _context21.next = 8;
1362
+ _context20.next = 8;
1481
1363
  break;
1482
1364
  }
1483
1365
  console.error('[Server] Menu 模块未注册');
1484
1366
  _this.logError('handleGetScheduleTimePoints: Menu 模块未注册');
1485
- return _context21.abrupt("return", {
1367
+ return _context20.abrupt("return", {
1486
1368
  code: 500,
1487
1369
  message: 'Menu 模块未注册',
1488
1370
  data: [],
@@ -1490,12 +1372,12 @@ var Server = /*#__PURE__*/function () {
1490
1372
  });
1491
1373
  case 8:
1492
1374
  if (_this.schedule) {
1493
- _context21.next = 12;
1375
+ _context20.next = 12;
1494
1376
  break;
1495
1377
  }
1496
1378
  console.error('[Server] Schedule 模块未注册');
1497
1379
  _this.logError('handleGetScheduleTimePoints: Schedule 模块未注册');
1498
- return _context21.abrupt("return", {
1380
+ return _context20.abrupt("return", {
1499
1381
  code: 500,
1500
1382
  message: 'Schedule 模块未注册',
1501
1383
  data: [],
@@ -1503,7 +1385,7 @@ var Server = /*#__PURE__*/function () {
1503
1385
  });
1504
1386
  case 12:
1505
1387
  if (!(!menu_list_ids || !Array.isArray(menu_list_ids) || menu_list_ids.length === 0)) {
1506
- _context21.next = 16;
1388
+ _context20.next = 16;
1507
1389
  break;
1508
1390
  }
1509
1391
  console.error('[Server] menu_list_ids 参数无效');
@@ -1511,14 +1393,14 @@ var Server = /*#__PURE__*/function () {
1511
1393
  menuListIdsCount: (_menu_list_ids$length2 = menu_list_ids === null || menu_list_ids === void 0 ? void 0 : menu_list_ids.length) !== null && _menu_list_ids$length2 !== void 0 ? _menu_list_ids$length2 : 0,
1512
1394
  menu_list_ids: menu_list_ids
1513
1395
  });
1514
- return _context21.abrupt("return", {
1396
+ return _context20.abrupt("return", {
1515
1397
  code: 400,
1516
1398
  message: 'menu_list_ids 参数无效',
1517
1399
  data: [],
1518
1400
  status: false
1519
1401
  });
1520
1402
  case 16:
1521
- _context21.prev = 16;
1403
+ _context20.prev = 16;
1522
1404
  // 1. 获取餐牌列表
1523
1405
  menuList = _this.menu.getMenuByIds(menu_list_ids);
1524
1406
  console.log("[Server] \u627E\u5230 ".concat(menuList.length, " \u4E2A\u9910\u724C"));
@@ -1536,13 +1418,13 @@ var Server = /*#__PURE__*/function () {
1536
1418
  scheduleCount: scheduleIds.length
1537
1419
  });
1538
1420
  if (!(scheduleIds.length === 0)) {
1539
- _context21.next = 26;
1421
+ _context20.next = 26;
1540
1422
  break;
1541
1423
  }
1542
1424
  _this.logInfo('handleGetScheduleTimePoints: 没有找到相关日程', {
1543
1425
  menuListIdsCount: menu_list_ids.length
1544
1426
  });
1545
- return _context21.abrupt("return", {
1427
+ return _context20.abrupt("return", {
1546
1428
  code: 200,
1547
1429
  message: '没有找到相关日程',
1548
1430
  data: [],
@@ -1566,22 +1448,22 @@ var Server = /*#__PURE__*/function () {
1566
1448
  scheduleCount: scheduleList.length,
1567
1449
  timePointCount: timePoints.length
1568
1450
  });
1569
- return _context21.abrupt("return", {
1451
+ return _context20.abrupt("return", {
1570
1452
  code: 200,
1571
1453
  message: '获取成功',
1572
1454
  data: timePoints,
1573
1455
  status: true
1574
1456
  });
1575
1457
  case 35:
1576
- _context21.prev = 35;
1577
- _context21.t0 = _context21["catch"](16);
1578
- errorMessage = _context21.t0 instanceof Error ? _context21.t0.message : '未知错误';
1579
- console.error('[Server] 获取日程时间点失败:', _context21.t0);
1458
+ _context20.prev = 35;
1459
+ _context20.t0 = _context20["catch"](16);
1460
+ errorMessage = _context20.t0 instanceof Error ? _context20.t0.message : '未知错误';
1461
+ console.error('[Server] 获取日程时间点失败:', _context20.t0);
1580
1462
  _this.logError('handleGetScheduleTimePoints: 获取日程时间点失败', {
1581
1463
  menuListIdsCount: menu_list_ids.length,
1582
1464
  error: errorMessage
1583
1465
  });
1584
- return _context21.abrupt("return", {
1466
+ return _context20.abrupt("return", {
1585
1467
  code: 500,
1586
1468
  message: "\u83B7\u53D6\u5931\u8D25: ".concat(errorMessage),
1587
1469
  data: [],
@@ -1589,18 +1471,18 @@ var Server = /*#__PURE__*/function () {
1589
1471
  });
1590
1472
  case 41:
1591
1473
  case "end":
1592
- return _context21.stop();
1474
+ return _context20.stop();
1593
1475
  }
1594
- }, _callee21, null, [[16, 35]]);
1476
+ }, _callee20, null, [[16, 35]]);
1595
1477
  }));
1596
- return function (_x21) {
1597
- return _ref53.apply(this, arguments);
1478
+ return function (_x20) {
1479
+ return _ref51.apply(this, arguments);
1598
1480
  };
1599
1481
  }());
1600
1482
  this.core = core;
1601
1483
  var appPlugin = core.getPlugin('app');
1602
1484
  this.app = (appPlugin === null || appPlugin === void 0 ? void 0 : appPlugin.getApp()) || null;
1603
- this.logger = ((_this$app4 = this.app) === null || _this$app4 === void 0 ? void 0 : _this$app4.logger) || null;
1485
+ this.logger = ((_this$app3 = this.app) === null || _this$app3 === void 0 ? void 0 : _this$app3.logger) || null;
1604
1486
  console.log('[Server] Server 初始化', this.core);
1605
1487
  this.logInfo('Server 初始化', {
1606
1488
  hasApp: !!this.app,
@@ -1715,10 +1597,10 @@ var Server = /*#__PURE__*/function () {
1715
1597
  }, {
1716
1598
  key: "registerModuleWithRoutes",
1717
1599
  value: (function () {
1718
- var _registerModuleWithRoutes = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(module, options, moduleName) {
1600
+ var _registerModuleWithRoutes = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(module, options, moduleName) {
1719
1601
  var routes;
1720
- return _regeneratorRuntime().wrap(function _callee22$(_context22) {
1721
- while (1) switch (_context22.prev = _context22.next) {
1602
+ return _regeneratorRuntime().wrap(function _callee21$(_context21) {
1603
+ while (1) switch (_context21.prev = _context21.next) {
1722
1604
  case 0:
1723
1605
  this.logInfo("\u5F00\u59CB\u6CE8\u518C\u6A21\u5757: ".concat(moduleName), {
1724
1606
  moduleName: moduleName,
@@ -1726,7 +1608,7 @@ var Server = /*#__PURE__*/function () {
1726
1608
  });
1727
1609
 
1728
1610
  // 注册模块到 Core
1729
- _context22.next = 3;
1611
+ _context21.next = 3;
1730
1612
  return this.core.registerModule(module, options);
1731
1613
  case 3:
1732
1614
  console.log("[Server] \u2705 ".concat(moduleName, " \u6A21\u5757\u5DF2\u6CE8\u518C"));
@@ -1747,11 +1629,11 @@ var Server = /*#__PURE__*/function () {
1747
1629
  }
1748
1630
  case 6:
1749
1631
  case "end":
1750
- return _context22.stop();
1632
+ return _context21.stop();
1751
1633
  }
1752
- }, _callee22, this);
1634
+ }, _callee21, this);
1753
1635
  }));
1754
- function registerModuleWithRoutes(_x22, _x23, _x24) {
1636
+ function registerModuleWithRoutes(_x21, _x22, _x23) {
1755
1637
  return _registerModuleWithRoutes.apply(this, arguments);
1756
1638
  }
1757
1639
  return registerModuleWithRoutes;
@@ -1764,10 +1646,10 @@ var Server = /*#__PURE__*/function () {
1764
1646
  }, {
1765
1647
  key: "registerModuleByName",
1766
1648
  value: (function () {
1767
- var _registerModuleByName = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(moduleConfig) {
1649
+ var _registerModuleByName = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(moduleConfig) {
1768
1650
  var moduleName, shouldPreload, customConfig, registryConfig, ModuleClass, moduleInstance, moduleOptions;
1769
- return _regeneratorRuntime().wrap(function _callee23$(_context23) {
1770
- while (1) switch (_context23.prev = _context23.next) {
1651
+ return _regeneratorRuntime().wrap(function _callee22$(_context22) {
1652
+ while (1) switch (_context22.prev = _context22.next) {
1771
1653
  case 0:
1772
1654
  // 解析配置
1773
1655
  moduleName = typeof moduleConfig === 'string' ? moduleConfig : moduleConfig.name;
@@ -1782,7 +1664,7 @@ var Server = /*#__PURE__*/function () {
1782
1664
  // 查找模块配置
1783
1665
  registryConfig = this.moduleRegistry[moduleName];
1784
1666
  if (registryConfig) {
1785
- _context23.next = 8;
1667
+ _context22.next = 8;
1786
1668
  break;
1787
1669
  }
1788
1670
  this.logError("\u672A\u627E\u5230\u6A21\u5757\u914D\u7F6E: ".concat(moduleName), {
@@ -1796,7 +1678,7 @@ var Server = /*#__PURE__*/function () {
1796
1678
  moduleOptions = _objectSpread({
1797
1679
  store: _objectSpread({}, registryConfig.defaultStore)
1798
1680
  }, customConfig); // 注册模块和路由
1799
- _context23.next = 13;
1681
+ _context22.next = 13;
1800
1682
  return this.registerModuleWithRoutes(moduleInstance, moduleOptions, moduleName.charAt(0).toUpperCase() + moduleName.slice(1));
1801
1683
  case 13:
1802
1684
  // 保存模块实例
@@ -1806,18 +1688,18 @@ var Server = /*#__PURE__*/function () {
1806
1688
  shouldPreload: shouldPreload,
1807
1689
  version: registryConfig.version
1808
1690
  });
1809
- return _context23.abrupt("return", {
1691
+ return _context22.abrupt("return", {
1810
1692
  module: moduleInstance,
1811
1693
  config: registryConfig,
1812
1694
  shouldPreload: shouldPreload
1813
1695
  });
1814
1696
  case 16:
1815
1697
  case "end":
1816
- return _context23.stop();
1698
+ return _context22.stop();
1817
1699
  }
1818
- }, _callee23, this);
1700
+ }, _callee22, this);
1819
1701
  }));
1820
- function registerModuleByName(_x25) {
1702
+ function registerModuleByName(_x24) {
1821
1703
  return _registerModuleByName.apply(this, arguments);
1822
1704
  }
1823
1705
  return registerModuleByName;
@@ -1830,10 +1712,10 @@ var Server = /*#__PURE__*/function () {
1830
1712
  }, {
1831
1713
  key: "registerModules",
1832
1714
  value: (function () {
1833
- var _registerModules = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(moduleConfigs) {
1715
+ var _registerModules = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(moduleConfigs) {
1834
1716
  var configs, registeredModules, _iterator2, _step2, config, configName, result, errorMessage;
1835
- return _regeneratorRuntime().wrap(function _callee24$(_context24) {
1836
- while (1) switch (_context24.prev = _context24.next) {
1717
+ return _regeneratorRuntime().wrap(function _callee23$(_context23) {
1718
+ while (1) switch (_context23.prev = _context23.next) {
1837
1719
  case 0:
1838
1720
  console.log('[Server] 开始注册模块...');
1839
1721
 
@@ -1845,47 +1727,47 @@ var Server = /*#__PURE__*/function () {
1845
1727
  });
1846
1728
  registeredModules = [];
1847
1729
  _iterator2 = _createForOfIteratorHelper(configs);
1848
- _context24.prev = 5;
1730
+ _context23.prev = 5;
1849
1731
  _iterator2.s();
1850
1732
  case 7:
1851
1733
  if ((_step2 = _iterator2.n()).done) {
1852
- _context24.next = 25;
1734
+ _context23.next = 25;
1853
1735
  break;
1854
1736
  }
1855
1737
  config = _step2.value;
1856
1738
  configName = typeof config === 'string' ? config : config.name;
1857
- _context24.prev = 10;
1858
- _context24.next = 13;
1739
+ _context23.prev = 10;
1740
+ _context23.next = 13;
1859
1741
  return this.registerModuleByName(config);
1860
1742
  case 13:
1861
- result = _context24.sent;
1743
+ result = _context23.sent;
1862
1744
  registeredModules.push(result);
1863
- _context24.next = 23;
1745
+ _context23.next = 23;
1864
1746
  break;
1865
1747
  case 17:
1866
- _context24.prev = 17;
1867
- _context24.t0 = _context24["catch"](10);
1868
- errorMessage = _context24.t0 instanceof Error ? _context24.t0.message : String(_context24.t0);
1748
+ _context23.prev = 17;
1749
+ _context23.t0 = _context23["catch"](10);
1750
+ errorMessage = _context23.t0 instanceof Error ? _context23.t0.message : String(_context23.t0);
1869
1751
  this.logError("\u6A21\u5757\u6CE8\u518C\u5931\u8D25: ".concat(configName), {
1870
1752
  moduleName: configName,
1871
1753
  error: errorMessage
1872
1754
  });
1873
- console.error("[Server] \u6A21\u5757\u6CE8\u518C\u5931\u8D25:", _context24.t0);
1874
- throw _context24.t0;
1755
+ console.error("[Server] \u6A21\u5757\u6CE8\u518C\u5931\u8D25:", _context23.t0);
1756
+ throw _context23.t0;
1875
1757
  case 23:
1876
- _context24.next = 7;
1758
+ _context23.next = 7;
1877
1759
  break;
1878
1760
  case 25:
1879
- _context24.next = 30;
1761
+ _context23.next = 30;
1880
1762
  break;
1881
1763
  case 27:
1882
- _context24.prev = 27;
1883
- _context24.t1 = _context24["catch"](5);
1884
- _iterator2.e(_context24.t1);
1764
+ _context23.prev = 27;
1765
+ _context23.t1 = _context23["catch"](5);
1766
+ _iterator2.e(_context23.t1);
1885
1767
  case 30:
1886
- _context24.prev = 30;
1768
+ _context23.prev = 30;
1887
1769
  _iterator2.f();
1888
- return _context24.finish(30);
1770
+ return _context23.finish(30);
1889
1771
  case 33:
1890
1772
  console.log('[Server] ✅ 所有模块注册完成');
1891
1773
  this.logInfo('所有模块注册完成', {
@@ -1895,14 +1777,14 @@ var Server = /*#__PURE__*/function () {
1895
1777
  return m === null || m === void 0 || (_m$config = m.config) === null || _m$config === void 0 ? void 0 : _m$config.name;
1896
1778
  })
1897
1779
  });
1898
- return _context24.abrupt("return", registeredModules);
1780
+ return _context23.abrupt("return", registeredModules);
1899
1781
  case 36:
1900
1782
  case "end":
1901
- return _context24.stop();
1783
+ return _context23.stop();
1902
1784
  }
1903
- }, _callee24, this, [[5, 27, 30, 33], [10, 17]]);
1785
+ }, _callee23, this, [[5, 27, 30, 33], [10, 17]]);
1904
1786
  }));
1905
- function registerModules(_x26) {
1787
+ function registerModules(_x25) {
1906
1788
  return _registerModules.apply(this, arguments);
1907
1789
  }
1908
1790
  return registerModules;
@@ -1915,10 +1797,10 @@ var Server = /*#__PURE__*/function () {
1915
1797
  }, {
1916
1798
  key: "preloadModulesData",
1917
1799
  value: (function () {
1918
- var _preloadModulesData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(registeredModules, options) {
1800
+ var _preloadModulesData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(registeredModules, options) {
1919
1801
  var modulesToPreload, preloadResults, _iterator3, _step3, _step3$value, module, config, shouldPreload, startTime, _options$onModuleLoad, _options$onModuleLoad2, duration, _duration, errorMessage, successCount, failCount;
1920
- return _regeneratorRuntime().wrap(function _callee25$(_context25) {
1921
- while (1) switch (_context25.prev = _context25.next) {
1802
+ return _regeneratorRuntime().wrap(function _callee24$(_context24) {
1803
+ while (1) switch (_context24.prev = _context24.next) {
1922
1804
  case 0:
1923
1805
  console.log('[Server] 开始预加载模块数据...');
1924
1806
  modulesToPreload = registeredModules.filter(function (m) {
@@ -1931,16 +1813,16 @@ var Server = /*#__PURE__*/function () {
1931
1813
  });
1932
1814
  preloadResults = [];
1933
1815
  _iterator3 = _createForOfIteratorHelper(registeredModules);
1934
- _context25.prev = 5;
1816
+ _context24.prev = 5;
1935
1817
  _iterator3.s();
1936
1818
  case 7:
1937
1819
  if ((_step3 = _iterator3.n()).done) {
1938
- _context25.next = 40;
1820
+ _context24.next = 40;
1939
1821
  break;
1940
1822
  }
1941
1823
  _step3$value = _step3.value, module = _step3$value.module, config = _step3$value.config, shouldPreload = _step3$value.shouldPreload;
1942
1824
  if (shouldPreload) {
1943
- _context25.next = 13;
1825
+ _context24.next = 13;
1944
1826
  break;
1945
1827
  }
1946
1828
  console.log("[Server] \u23ED\uFE0F \u8DF3\u8FC7 ".concat(config.name, " \u6A21\u5757\u9884\u52A0\u8F7D"));
@@ -1948,19 +1830,19 @@ var Server = /*#__PURE__*/function () {
1948
1830
  moduleName: config.name,
1949
1831
  reason: 'shouldPreload=false'
1950
1832
  });
1951
- return _context25.abrupt("continue", 38);
1833
+ return _context24.abrupt("continue", 38);
1952
1834
  case 13:
1953
1835
  if (!(typeof module.preload === 'function')) {
1954
- _context25.next = 36;
1836
+ _context24.next = 36;
1955
1837
  break;
1956
1838
  }
1957
1839
  startTime = Date.now();
1958
- _context25.prev = 15;
1840
+ _context24.prev = 15;
1959
1841
  this.logInfo("\u5F00\u59CB\u9884\u52A0\u8F7D\u6A21\u5757: ".concat(config.name), {
1960
1842
  moduleName: config.name
1961
1843
  });
1962
1844
  options === null || options === void 0 || (_options$onModuleLoad = options.onModuleLoad) === null || _options$onModuleLoad === void 0 || _options$onModuleLoad.call(options, config.name);
1963
- _context25.next = 20;
1845
+ _context24.next = 20;
1964
1846
  return module.preload();
1965
1847
  case 20:
1966
1848
  options === null || options === void 0 || (_options$onModuleLoad2 = options.onModuleLoadComplete) === null || _options$onModuleLoad2 === void 0 || _options$onModuleLoad2.call(options, config.name);
@@ -1974,14 +1856,14 @@ var Server = /*#__PURE__*/function () {
1974
1856
  name: config.name,
1975
1857
  success: true
1976
1858
  });
1977
- _context25.next = 34;
1859
+ _context24.next = 34;
1978
1860
  break;
1979
1861
  case 27:
1980
- _context25.prev = 27;
1981
- _context25.t0 = _context25["catch"](15);
1862
+ _context24.prev = 27;
1863
+ _context24.t0 = _context24["catch"](15);
1982
1864
  _duration = Date.now() - startTime;
1983
- errorMessage = _context25.t0 instanceof Error ? _context25.t0.message : String(_context25.t0);
1984
- console.error("[Server] \u274C ".concat(config.name, " \u6A21\u5757\u9884\u52A0\u8F7D\u5931\u8D25:"), _context25.t0);
1865
+ errorMessage = _context24.t0 instanceof Error ? _context24.t0.message : String(_context24.t0);
1866
+ console.error("[Server] \u274C ".concat(config.name, " \u6A21\u5757\u9884\u52A0\u8F7D\u5931\u8D25:"), _context24.t0);
1985
1867
  this.logError("\u6A21\u5757\u9884\u52A0\u8F7D\u5931\u8D25: ".concat(config.name), {
1986
1868
  moduleName: config.name,
1987
1869
  duration: "".concat(_duration, "ms"),
@@ -1993,7 +1875,7 @@ var Server = /*#__PURE__*/function () {
1993
1875
  error: errorMessage
1994
1876
  });
1995
1877
  case 34:
1996
- _context25.next = 38;
1878
+ _context24.next = 38;
1997
1879
  break;
1998
1880
  case 36:
1999
1881
  console.log("[Server] \u26A0\uFE0F ".concat(config.name, " \u6A21\u5757\u672A\u5B9E\u73B0 preload() \u65B9\u6CD5"));
@@ -2001,19 +1883,19 @@ var Server = /*#__PURE__*/function () {
2001
1883
  moduleName: config.name
2002
1884
  });
2003
1885
  case 38:
2004
- _context25.next = 7;
1886
+ _context24.next = 7;
2005
1887
  break;
2006
1888
  case 40:
2007
- _context25.next = 45;
1889
+ _context24.next = 45;
2008
1890
  break;
2009
1891
  case 42:
2010
- _context25.prev = 42;
2011
- _context25.t1 = _context25["catch"](5);
2012
- _iterator3.e(_context25.t1);
1892
+ _context24.prev = 42;
1893
+ _context24.t1 = _context24["catch"](5);
1894
+ _iterator3.e(_context24.t1);
2013
1895
  case 45:
2014
- _context25.prev = 45;
1896
+ _context24.prev = 45;
2015
1897
  _iterator3.f();
2016
- return _context25.finish(45);
1898
+ return _context24.finish(45);
2017
1899
  case 48:
2018
1900
  successCount = preloadResults.filter(function (r) {
2019
1901
  return r.success;
@@ -2028,11 +1910,11 @@ var Server = /*#__PURE__*/function () {
2028
1910
  });
2029
1911
  case 52:
2030
1912
  case "end":
2031
- return _context25.stop();
1913
+ return _context24.stop();
2032
1914
  }
2033
- }, _callee25, this, [[5, 42, 45, 48], [15, 27]]);
1915
+ }, _callee24, this, [[5, 42, 45, 48], [15, 27]]);
2034
1916
  }));
2035
- function preloadModulesData(_x27, _x28) {
1917
+ function preloadModulesData(_x26, _x27) {
2036
1918
  return _preloadModulesData.apply(this, arguments);
2037
1919
  }
2038
1920
  return preloadModulesData;
@@ -2046,7 +1928,7 @@ var Server = /*#__PURE__*/function () {
2046
1928
  }, {
2047
1929
  key: "initialize",
2048
1930
  value: (function () {
2049
- var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(moduleConfigs) {
1931
+ var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(moduleConfigs) {
2050
1932
  var _moduleConfigs$length,
2051
1933
  _this3 = this;
2052
1934
  var autoPreload,
@@ -2054,12 +1936,12 @@ var Server = /*#__PURE__*/function () {
2054
1936
  startTime,
2055
1937
  registeredModules,
2056
1938
  duration,
2057
- _args26 = arguments;
2058
- return _regeneratorRuntime().wrap(function _callee26$(_context26) {
2059
- while (1) switch (_context26.prev = _context26.next) {
1939
+ _args25 = arguments;
1940
+ return _regeneratorRuntime().wrap(function _callee25$(_context25) {
1941
+ while (1) switch (_context25.prev = _context25.next) {
2060
1942
  case 0:
2061
- autoPreload = _args26.length > 1 && _args26[1] !== undefined ? _args26[1] : true;
2062
- options = _args26.length > 2 ? _args26[2] : undefined;
1943
+ autoPreload = _args25.length > 1 && _args25[1] !== undefined ? _args25[1] : true;
1944
+ options = _args25.length > 2 ? _args25[2] : undefined;
2063
1945
  startTime = Date.now();
2064
1946
  this.logInfo('Server 初始化开始', {
2065
1947
  moduleConfigCount: (_moduleConfigs$length = moduleConfigs === null || moduleConfigs === void 0 ? void 0 : moduleConfigs.length) !== null && _moduleConfigs$length !== void 0 ? _moduleConfigs$length : 'all',
@@ -2072,25 +1954,25 @@ var Server = /*#__PURE__*/function () {
2072
1954
  this.registerDeviceTaskActions();
2073
1955
 
2074
1956
  // 注册模块
2075
- _context26.next = 8;
1957
+ _context25.next = 8;
2076
1958
  return this.registerModules(moduleConfigs);
2077
1959
  case 8:
2078
- registeredModules = _context26.sent;
1960
+ registeredModules = _context25.sent;
2079
1961
  if (!autoPreload) {
2080
- _context26.next = 14;
1962
+ _context25.next = 14;
2081
1963
  break;
2082
1964
  }
2083
- _context26.next = 12;
1965
+ _context25.next = 12;
2084
1966
  return this.preloadModulesData(registeredModules, options);
2085
1967
  case 12:
2086
- _context26.next = 15;
1968
+ _context25.next = 15;
2087
1969
  break;
2088
1970
  case 14:
2089
1971
  this.logInfo('跳过自动预加载', {
2090
1972
  autoPreload: autoPreload
2091
1973
  });
2092
1974
  case 15:
2093
- _context26.next = 17;
1975
+ _context25.next = 17;
2094
1976
  return this.setupProductsQuotationPriceBridge();
2095
1977
  case 17:
2096
1978
  // 监听 ProductsModule 同步完成事件,重新计算并推送查询结果
@@ -2117,14 +1999,14 @@ var Server = /*#__PURE__*/function () {
2117
1999
  duration: "".concat(duration, "ms"),
2118
2000
  registeredModuleCount: registeredModules.length
2119
2001
  });
2120
- return _context26.abrupt("return", registeredModules);
2002
+ return _context25.abrupt("return", registeredModules);
2121
2003
  case 23:
2122
2004
  case "end":
2123
- return _context26.stop();
2005
+ return _context25.stop();
2124
2006
  }
2125
- }, _callee26, this);
2007
+ }, _callee25, this);
2126
2008
  }));
2127
- function initialize(_x29) {
2009
+ function initialize(_x28) {
2128
2010
  return _initialize.apply(this, arguments);
2129
2011
  }
2130
2012
  return initialize;
@@ -2166,31 +2048,31 @@ var Server = /*#__PURE__*/function () {
2166
2048
  }, {
2167
2049
  key: "handleSyncSalesTask",
2168
2050
  value: function () {
2169
- var _handleSyncSalesTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(ctx) {
2170
- var _ctx$task, _this$app5;
2051
+ var _handleSyncSalesTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(ctx) {
2052
+ var _ctx$task, _this$app4;
2171
2053
  var payload, backendPath, data, title, _ctx$task2, _syncResult$syncedOrd, syncResult, backendError, message, errorMessage;
2172
- return _regeneratorRuntime().wrap(function _callee27$(_context27) {
2173
- while (1) switch (_context27.prev = _context27.next) {
2054
+ return _regeneratorRuntime().wrap(function _callee26$(_context26) {
2055
+ while (1) switch (_context26.prev = _context26.next) {
2174
2056
  case 0:
2175
2057
  payload = ((_ctx$task = ctx.task) === null || _ctx$task === void 0 ? void 0 : _ctx$task.payload) || {};
2176
2058
  backendPath = payload.backendPath;
2177
2059
  data = payload.data;
2178
2060
  title = payload.title || 'sync_sales';
2179
2061
  if (!(!backendPath || !data)) {
2180
- _context27.next = 6;
2062
+ _context26.next = 6;
2181
2063
  break;
2182
2064
  }
2183
- return _context27.abrupt("return", this.taskFail('INVALID_PAYLOAD', '缺少 backendPath 或 data'));
2065
+ return _context26.abrupt("return", this.taskFail('INVALID_PAYLOAD', '缺少 backendPath 或 data'));
2184
2066
  case 6:
2185
- if ((_this$app5 = this.app) !== null && _this$app5 !== void 0 && _this$app5.request) {
2186
- _context27.next = 9;
2067
+ if ((_this$app4 = this.app) !== null && _this$app4 !== void 0 && _this$app4.request) {
2068
+ _context26.next = 9;
2187
2069
  break;
2188
2070
  }
2189
2071
  this.logError("".concat(title, ": sync_sales app.request \u4E0D\u53EF\u7528"));
2190
- return _context27.abrupt("return", this.taskTimeout('app.request 不可用'));
2072
+ return _context26.abrupt("return", this.taskTimeout('app.request 不可用'));
2191
2073
  case 9:
2192
- _context27.prev = 9;
2193
- _context27.next = 12;
2074
+ _context26.prev = 9;
2075
+ _context26.next = 12;
2194
2076
  return this.runCheckoutSync({
2195
2077
  backendPath: backendPath,
2196
2078
  data: data,
@@ -2200,27 +2082,27 @@ var Server = /*#__PURE__*/function () {
2200
2082
  persistCheckoutDataWithResponse: false
2201
2083
  });
2202
2084
  case 12:
2203
- syncResult = _context27.sent;
2085
+ syncResult = _context26.sent;
2204
2086
  if (!syncResult.rejected) {
2205
- _context27.next = 16;
2087
+ _context26.next = 16;
2206
2088
  break;
2207
2089
  }
2208
2090
  this.logError("".concat(title, ": sync_sales \u540E\u7AEF\u660E\u786E\u5931\u8D25"), {
2209
2091
  backendPath: backendPath,
2210
2092
  response: syncResult.errorResponse
2211
2093
  });
2212
- return _context27.abrupt("return", this.taskFail('BACKEND_REJECTED', syncResult.message || '后端明确拒绝 checkout', syncResult.errorResponse));
2094
+ return _context26.abrupt("return", this.taskFail('BACKEND_REJECTED', syncResult.message || '后端明确拒绝 checkout', syncResult.errorResponse));
2213
2095
  case 16:
2214
- return _context27.abrupt("return", this.taskOk({
2096
+ return _context26.abrupt("return", this.taskOk({
2215
2097
  order: (_syncResult$syncedOrd = syncResult.syncedOrder) !== null && _syncResult$syncedOrd !== void 0 ? _syncResult$syncedOrd : null,
2216
2098
  response: syncResult.normalizedResponse
2217
2099
  }));
2218
2100
  case 19:
2219
- _context27.prev = 19;
2220
- _context27.t0 = _context27["catch"](9);
2221
- backendError = this.extractBackendErrorResponse(_context27.t0);
2101
+ _context26.prev = 19;
2102
+ _context26.t0 = _context26["catch"](9);
2103
+ backendError = this.extractBackendErrorResponse(_context26.t0);
2222
2104
  if (!backendError) {
2223
- _context27.next = 26;
2105
+ _context26.next = 26;
2224
2106
  break;
2225
2107
  }
2226
2108
  message = (backendError === null || backendError === void 0 ? void 0 : backendError.message) || '后端明确拒绝 checkout';
@@ -2228,22 +2110,22 @@ var Server = /*#__PURE__*/function () {
2228
2110
  backendPath: backendPath,
2229
2111
  backendError: backendError
2230
2112
  });
2231
- return _context27.abrupt("return", this.taskFail('BACKEND_REJECTED', message, backendError));
2113
+ return _context26.abrupt("return", this.taskFail('BACKEND_REJECTED', message, backendError));
2232
2114
  case 26:
2233
- errorMessage = this.getUnknownErrorMessage(_context27.t0);
2115
+ errorMessage = this.getUnknownErrorMessage(_context26.t0);
2234
2116
  this.logError("".concat(title, ": sync_sales \u8BF7\u6C42\u672A\u660E\u786E\u6210\u529F"), {
2235
2117
  backendPath: backendPath,
2236
2118
  error: errorMessage,
2237
- error_detail: this.normalizeUnknownError(_context27.t0)
2119
+ error_detail: this.normalizeUnknownError(_context26.t0)
2238
2120
  });
2239
- return _context27.abrupt("return", this.taskTimeout(errorMessage));
2121
+ return _context26.abrupt("return", this.taskTimeout(errorMessage));
2240
2122
  case 29:
2241
2123
  case "end":
2242
- return _context27.stop();
2124
+ return _context26.stop();
2243
2125
  }
2244
- }, _callee27, this, [[9, 19]]);
2126
+ }, _callee26, this, [[9, 19]]);
2245
2127
  }));
2246
- function handleSyncSalesTask(_x30) {
2128
+ function handleSyncSalesTask(_x29) {
2247
2129
  return _handleSyncSalesTask.apply(this, arguments);
2248
2130
  }
2249
2131
  return handleSyncSalesTask;
@@ -2251,40 +2133,40 @@ var Server = /*#__PURE__*/function () {
2251
2133
  }, {
2252
2134
  key: "runCheckoutSync",
2253
2135
  value: function () {
2254
- var _runCheckoutSync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(params) {
2255
- var _this$app6;
2136
+ var _runCheckoutSync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(params) {
2137
+ var _this$app5;
2256
2138
  var backendPath, title, normalizedData, checkoutData, remoteCheckoutData, response, fresh, externalSaleNumber, syncedOrder, printableSyncedOrder;
2257
- return _regeneratorRuntime().wrap(function _callee28$(_context28) {
2258
- while (1) switch (_context28.prev = _context28.next) {
2139
+ return _regeneratorRuntime().wrap(function _callee27$(_context27) {
2140
+ while (1) switch (_context27.prev = _context27.next) {
2259
2141
  case 0:
2260
2142
  backendPath = params.backendPath, title = params.title;
2261
- _context28.next = 3;
2143
+ _context27.next = 3;
2262
2144
  return this.normalizeCheckoutSubmitData(params.data, title);
2263
2145
  case 3:
2264
- normalizedData = _context28.sent;
2265
- _context28.next = 6;
2146
+ normalizedData = _context27.sent;
2147
+ _context27.next = 6;
2266
2148
  return this.ensureCheckoutOrderNumbers(normalizedData, title);
2267
2149
  case 6:
2268
- checkoutData = _context28.sent;
2150
+ checkoutData = _context27.sent;
2269
2151
  remoteCheckoutData = this.omitCheckoutSyncMode(checkoutData);
2270
- if ((_this$app6 = this.app) !== null && _this$app6 !== void 0 && (_this$app6 = _this$app6.request) !== null && _this$app6 !== void 0 && _this$app6.post) {
2271
- _context28.next = 10;
2152
+ if ((_this$app5 = this.app) !== null && _this$app5 !== void 0 && (_this$app5 = _this$app5.request) !== null && _this$app5 !== void 0 && _this$app5.post) {
2153
+ _context27.next = 10;
2272
2154
  break;
2273
2155
  }
2274
2156
  throw new Error('app.request 不可用');
2275
2157
  case 10:
2276
- _context28.next = 12;
2158
+ _context27.next = 12;
2277
2159
  return this.app.request.post(backendPath, remoteCheckoutData, {
2278
2160
  isShopApi: true,
2279
2161
  customToast: function customToast() {}
2280
2162
  });
2281
2163
  case 12:
2282
- response = _context28.sent;
2164
+ response = _context27.sent;
2283
2165
  if (!this.isCheckoutResponseRejected(response)) {
2284
- _context28.next = 15;
2166
+ _context27.next = 15;
2285
2167
  break;
2286
2168
  }
2287
- return _context28.abrupt("return", {
2169
+ return _context27.abrupt("return", {
2288
2170
  rejected: true,
2289
2171
  message: (response === null || response === void 0 ? void 0 : response.message) || '后端明确拒绝 checkout',
2290
2172
  errorResponse: response,
@@ -2298,7 +2180,7 @@ var Server = /*#__PURE__*/function () {
2298
2180
  external_sale_number: params.externalSaleNumber,
2299
2181
  data: remoteCheckoutData
2300
2182
  });
2301
- _context28.next = 19;
2183
+ _context27.next = 19;
2302
2184
  return this.persistSyncedCheckoutOrder({
2303
2185
  backendPath: backendPath,
2304
2186
  checkoutData: remoteCheckoutData,
@@ -2308,7 +2190,7 @@ var Server = /*#__PURE__*/function () {
2308
2190
  persistCheckoutDataWithResponse: params.persistCheckoutDataWithResponse === true
2309
2191
  });
2310
2192
  case 19:
2311
- syncedOrder = _context28.sent;
2193
+ syncedOrder = _context27.sent;
2312
2194
  printableSyncedOrder = syncedOrder ? this.buildSyncedOrderForPrint({
2313
2195
  syncedOrder: syncedOrder,
2314
2196
  checkoutResponseOrder: fresh
@@ -2317,10 +2199,10 @@ var Server = /*#__PURE__*/function () {
2317
2199
  checkoutData: remoteCheckoutData,
2318
2200
  syncedOrder: printableSyncedOrder
2319
2201
  }))) {
2320
- _context28.next = 24;
2202
+ _context27.next = 24;
2321
2203
  break;
2322
2204
  }
2323
- _context28.next = 24;
2205
+ _context27.next = 24;
2324
2206
  return this.dispatchPrintOtherReceiptTask({
2325
2207
  checkoutData: remoteCheckoutData,
2326
2208
  syncedOrder: printableSyncedOrder,
@@ -2328,7 +2210,7 @@ var Server = /*#__PURE__*/function () {
2328
2210
  deviceId: params.deviceId
2329
2211
  });
2330
2212
  case 24:
2331
- return _context28.abrupt("return", {
2213
+ return _context27.abrupt("return", {
2332
2214
  rejected: false,
2333
2215
  response: response,
2334
2216
  normalizedResponse: this.normalizeCheckoutResponse(response),
@@ -2338,11 +2220,11 @@ var Server = /*#__PURE__*/function () {
2338
2220
  });
2339
2221
  case 25:
2340
2222
  case "end":
2341
- return _context28.stop();
2223
+ return _context27.stop();
2342
2224
  }
2343
- }, _callee28, this);
2225
+ }, _callee27, this);
2344
2226
  }));
2345
- function runCheckoutSync(_x31) {
2227
+ function runCheckoutSync(_x30) {
2346
2228
  return _runCheckoutSync.apply(this, arguments);
2347
2229
  }
2348
2230
  return runCheckoutSync;
@@ -2359,15 +2241,15 @@ var Server = /*#__PURE__*/function () {
2359
2241
  }, {
2360
2242
  key: "persistSyncedCheckoutOrder",
2361
2243
  value: function () {
2362
- var _persistSyncedCheckoutOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(params) {
2244
+ var _persistSyncedCheckoutOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(params) {
2363
2245
  var backendPath, checkoutData, externalSaleNumber, fresh, title, persistCheckoutDataWithResponse, shouldMergeRemoteOrder, syncedOrder, _external_sale_number2, _external_sale_number3, _syncedOrder$order_id, _syncedOrder, patch, result;
2364
- return _regeneratorRuntime().wrap(function _callee29$(_context29) {
2365
- while (1) switch (_context29.prev = _context29.next) {
2246
+ return _regeneratorRuntime().wrap(function _callee28$(_context28) {
2247
+ while (1) switch (_context28.prev = _context28.next) {
2366
2248
  case 0:
2367
2249
  backendPath = params.backendPath, checkoutData = params.checkoutData, externalSaleNumber = params.externalSaleNumber, fresh = params.fresh, title = params.title, persistCheckoutDataWithResponse = params.persistCheckoutDataWithResponse;
2368
2250
  shouldMergeRemoteOrder = fresh ? this.isMergeableCheckoutOrder(fresh, externalSaleNumber) : false;
2369
2251
  if (!(this.order && fresh && (shouldMergeRemoteOrder || persistCheckoutDataWithResponse))) {
2370
- _context29.next = 9;
2252
+ _context28.next = 9;
2371
2253
  break;
2372
2254
  }
2373
2255
  syncedOrder = persistCheckoutDataWithResponse ? _objectSpread(_objectSpread(_objectSpread({}, checkoutData), fresh), {}, {
@@ -2377,7 +2259,7 @@ var Server = /*#__PURE__*/function () {
2377
2259
  external_sale_number: (_external_sale_number3 = fresh.external_sale_number) !== null && _external_sale_number3 !== void 0 ? _external_sale_number3 : externalSaleNumber,
2378
2260
  need_sync: 0
2379
2261
  });
2380
- _context29.next = 6;
2262
+ _context28.next = 6;
2381
2263
  return this.order.upsertOrdersFromRemote([syncedOrder]);
2382
2264
  case 6:
2383
2265
  this.logInfo("".concat(title, ": sync_sales \u5B8C\u6574\u8BA2\u5355\u5DF2\u540C\u6B65\u5230\u672C\u5730"), {
@@ -2387,21 +2269,21 @@ var Server = /*#__PURE__*/function () {
2387
2269
  mergedRemoteOrder: shouldMergeRemoteOrder,
2388
2270
  persistedCheckoutDataWithResponse: persistCheckoutDataWithResponse
2389
2271
  });
2390
- _context29.next = 19;
2272
+ _context28.next = 19;
2391
2273
  break;
2392
2274
  case 9:
2393
2275
  if (!(this.order && externalSaleNumber && typeof this.order.markOrderSyncedByExternalSaleNumber === 'function')) {
2394
- _context29.next = 18;
2276
+ _context28.next = 18;
2395
2277
  break;
2396
2278
  }
2397
2279
  patch = this.buildCheckoutSyncSuccessPatch(fresh);
2398
- _context29.next = 13;
2280
+ _context28.next = 13;
2399
2281
  return this.order.markOrderSyncedByExternalSaleNumber({
2400
2282
  externalSaleNumber: externalSaleNumber,
2401
2283
  patch: patch
2402
2284
  });
2403
2285
  case 13:
2404
- result = _context29.sent;
2286
+ result = _context28.sent;
2405
2287
  syncedOrder = (result === null || result === void 0 ? void 0 : result.order) || _objectSpread(_objectSpread(_objectSpread({}, checkoutData), patch), {}, {
2406
2288
  external_sale_number: externalSaleNumber,
2407
2289
  need_sync: 0
@@ -2412,7 +2294,7 @@ var Server = /*#__PURE__*/function () {
2412
2294
  hasRemoteOrder: !!fresh,
2413
2295
  mergedRemoteOrder: false
2414
2296
  });
2415
- _context29.next = 19;
2297
+ _context28.next = 19;
2416
2298
  break;
2417
2299
  case 18:
2418
2300
  this.logWarning("".concat(title, ": sync_sales Order \u6A21\u5757\u672A\u6CE8\u518C"), {
@@ -2421,14 +2303,14 @@ var Server = /*#__PURE__*/function () {
2421
2303
  order_id: fresh === null || fresh === void 0 ? void 0 : fresh.order_id
2422
2304
  });
2423
2305
  case 19:
2424
- return _context29.abrupt("return", syncedOrder);
2306
+ return _context28.abrupt("return", syncedOrder);
2425
2307
  case 20:
2426
2308
  case "end":
2427
- return _context29.stop();
2309
+ return _context28.stop();
2428
2310
  }
2429
- }, _callee29, this);
2311
+ }, _callee28, this);
2430
2312
  }));
2431
- function persistSyncedCheckoutOrder(_x32) {
2313
+ function persistSyncedCheckoutOrder(_x31) {
2432
2314
  return _persistSyncedCheckoutOrder.apply(this, arguments);
2433
2315
  }
2434
2316
  return persistSyncedCheckoutOrder;
@@ -2439,51 +2321,51 @@ var Server = /*#__PURE__*/function () {
2439
2321
  }, {
2440
2322
  key: "setupProductsQuotationPriceBridge",
2441
2323
  value: (function () {
2442
- var _setupProductsQuotationPriceBridge = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30() {
2324
+ var _setupProductsQuotationPriceBridge = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29() {
2443
2325
  var _this$core$context, errorMessage;
2444
- return _regeneratorRuntime().wrap(function _callee30$(_context30) {
2445
- while (1) switch (_context30.prev = _context30.next) {
2326
+ return _regeneratorRuntime().wrap(function _callee29$(_context29) {
2327
+ while (1) switch (_context29.prev = _context29.next) {
2446
2328
  case 0:
2447
2329
  if (this.products) {
2448
- _context30.next = 3;
2330
+ _context29.next = 3;
2449
2331
  break;
2450
2332
  }
2451
2333
  this.logInfo('setupProductsQuotationPriceBridge: Products 模块未注册');
2452
- return _context30.abrupt("return");
2334
+ return _context29.abrupt("return");
2453
2335
  case 3:
2454
2336
  if (this.schedule) {
2455
- _context30.next = 6;
2337
+ _context29.next = 6;
2456
2338
  break;
2457
2339
  }
2458
2340
  this.logInfo('setupProductsQuotationPriceBridge: Schedule 模块未注册');
2459
- return _context30.abrupt("return");
2341
+ return _context29.abrupt("return");
2460
2342
  case 6:
2461
- _context30.prev = 6;
2462
- _context30.next = 9;
2343
+ _context29.prev = 6;
2344
+ _context29.next = 9;
2463
2345
  return this.schedule.loadAllSchedule();
2464
2346
  case 9:
2465
2347
  this.products.clearPriceCache();
2466
- _context30.next = 12;
2348
+ _context29.next = 12;
2467
2349
  return this.products.setupQuotationPriceBridge({
2468
2350
  scheduleModule: this.schedule,
2469
2351
  channel: (_this$core$context = this.core.context) === null || _this$core$context === void 0 ? void 0 : _this$core$context.channel
2470
2352
  });
2471
2353
  case 12:
2472
2354
  this.logInfo('Products 报价单价格桥接初始化完成');
2473
- _context30.next = 19;
2355
+ _context29.next = 19;
2474
2356
  break;
2475
2357
  case 15:
2476
- _context30.prev = 15;
2477
- _context30.t0 = _context30["catch"](6);
2478
- errorMessage = _context30.t0 instanceof Error ? _context30.t0.message : String(_context30.t0);
2358
+ _context29.prev = 15;
2359
+ _context29.t0 = _context29["catch"](6);
2360
+ errorMessage = _context29.t0 instanceof Error ? _context29.t0.message : String(_context29.t0);
2479
2361
  this.logError('Products 报价单价格桥接初始化失败', {
2480
2362
  error: errorMessage
2481
2363
  });
2482
2364
  case 19:
2483
2365
  case "end":
2484
- return _context30.stop();
2366
+ return _context29.stop();
2485
2367
  }
2486
- }, _callee30, this, [[6, 15]]);
2368
+ }, _callee29, this, [[6, 15]]);
2487
2369
  }));
2488
2370
  function setupProductsQuotationPriceBridge() {
2489
2371
  return _setupProductsQuotationPriceBridge.apply(this, arguments);
@@ -2552,45 +2434,45 @@ var Server = /*#__PURE__*/function () {
2552
2434
  }, {
2553
2435
  key: "refreshProductsInBackground",
2554
2436
  value: (function () {
2555
- var _refreshProductsInBackground = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31() {
2437
+ var _refreshProductsInBackground = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30() {
2556
2438
  var startTime, duration, _duration2, errorMessage;
2557
- return _regeneratorRuntime().wrap(function _callee31$(_context31) {
2558
- while (1) switch (_context31.prev = _context31.next) {
2439
+ return _regeneratorRuntime().wrap(function _callee30$(_context30) {
2440
+ while (1) switch (_context30.prev = _context30.next) {
2559
2441
  case 0:
2560
2442
  if (this.products) {
2561
- _context31.next = 3;
2443
+ _context30.next = 3;
2562
2444
  break;
2563
2445
  }
2564
2446
  this.logWarning('refreshProductsInBackground: Products 模块未注册');
2565
- return _context31.abrupt("return");
2447
+ return _context30.abrupt("return");
2566
2448
  case 3:
2567
2449
  this.logInfo('refreshProductsInBackground 开始');
2568
2450
  startTime = Date.now();
2569
- _context31.prev = 5;
2570
- _context31.next = 8;
2451
+ _context30.prev = 5;
2452
+ _context30.next = 8;
2571
2453
  return this.products.silentRefresh();
2572
2454
  case 8:
2573
2455
  duration = Date.now() - startTime;
2574
2456
  this.logInfo('refreshProductsInBackground 完成', {
2575
2457
  duration: "".concat(duration, "ms")
2576
2458
  });
2577
- _context31.next = 18;
2459
+ _context30.next = 18;
2578
2460
  break;
2579
2461
  case 12:
2580
- _context31.prev = 12;
2581
- _context31.t0 = _context31["catch"](5);
2462
+ _context30.prev = 12;
2463
+ _context30.t0 = _context30["catch"](5);
2582
2464
  _duration2 = Date.now() - startTime;
2583
- errorMessage = _context31.t0 instanceof Error ? _context31.t0.message : String(_context31.t0);
2584
- console.error('[Server] refreshProductsInBackground 失败:', _context31.t0);
2465
+ errorMessage = _context30.t0 instanceof Error ? _context30.t0.message : String(_context30.t0);
2466
+ console.error('[Server] refreshProductsInBackground 失败:', _context30.t0);
2585
2467
  this.logError('refreshProductsInBackground 失败', {
2586
2468
  duration: "".concat(_duration2, "ms"),
2587
2469
  error: errorMessage
2588
2470
  });
2589
2471
  case 18:
2590
2472
  case "end":
2591
- return _context31.stop();
2473
+ return _context30.stop();
2592
2474
  }
2593
- }, _callee31, this, [[5, 12]]);
2475
+ }, _callee30, this, [[5, 12]]);
2594
2476
  }));
2595
2477
  function refreshProductsInBackground() {
2596
2478
  return _refreshProductsInBackground.apply(this, arguments);
@@ -2606,45 +2488,45 @@ var Server = /*#__PURE__*/function () {
2606
2488
  }, {
2607
2489
  key: "refreshOrdersInBackground",
2608
2490
  value: (function () {
2609
- var _refreshOrdersInBackground = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32() {
2491
+ var _refreshOrdersInBackground = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31() {
2610
2492
  var startTime, duration, _duration3, errorMessage;
2611
- return _regeneratorRuntime().wrap(function _callee32$(_context32) {
2612
- while (1) switch (_context32.prev = _context32.next) {
2493
+ return _regeneratorRuntime().wrap(function _callee31$(_context31) {
2494
+ while (1) switch (_context31.prev = _context31.next) {
2613
2495
  case 0:
2614
2496
  if (this.order) {
2615
- _context32.next = 3;
2497
+ _context31.next = 3;
2616
2498
  break;
2617
2499
  }
2618
2500
  this.logWarning('refreshOrdersInBackground: Order 模块未注册');
2619
- return _context32.abrupt("return");
2501
+ return _context31.abrupt("return");
2620
2502
  case 3:
2621
2503
  this.logInfo('refreshOrdersInBackground 开始');
2622
2504
  startTime = Date.now();
2623
- _context32.prev = 5;
2624
- _context32.next = 8;
2505
+ _context31.prev = 5;
2506
+ _context31.next = 8;
2625
2507
  return this.order.silentRefresh();
2626
2508
  case 8:
2627
2509
  duration = Date.now() - startTime;
2628
2510
  this.logInfo('refreshOrdersInBackground 完成', {
2629
2511
  duration: "".concat(duration, "ms")
2630
2512
  });
2631
- _context32.next = 18;
2513
+ _context31.next = 18;
2632
2514
  break;
2633
2515
  case 12:
2634
- _context32.prev = 12;
2635
- _context32.t0 = _context32["catch"](5);
2516
+ _context31.prev = 12;
2517
+ _context31.t0 = _context31["catch"](5);
2636
2518
  _duration3 = Date.now() - startTime;
2637
- errorMessage = _context32.t0 instanceof Error ? _context32.t0.message : String(_context32.t0);
2638
- console.error('[Server] refreshOrdersInBackground 失败:', _context32.t0);
2519
+ errorMessage = _context31.t0 instanceof Error ? _context31.t0.message : String(_context31.t0);
2520
+ console.error('[Server] refreshOrdersInBackground 失败:', _context31.t0);
2639
2521
  this.logError('refreshOrdersInBackground 失败', {
2640
2522
  duration: "".concat(_duration3, "ms"),
2641
2523
  error: errorMessage
2642
2524
  });
2643
2525
  case 18:
2644
2526
  case "end":
2645
- return _context32.stop();
2527
+ return _context31.stop();
2646
2528
  }
2647
- }, _callee32, this, [[5, 12]]);
2529
+ }, _callee31, this, [[5, 12]]);
2648
2530
  }));
2649
2531
  function refreshOrdersInBackground() {
2650
2532
  return _refreshOrdersInBackground.apply(this, arguments);
@@ -2659,10 +2541,10 @@ var Server = /*#__PURE__*/function () {
2659
2541
  }, {
2660
2542
  key: "clearAllIndexDB",
2661
2543
  value: (function () {
2662
- var _clearAllIndexDB = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33() {
2544
+ var _clearAllIndexDB = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32() {
2663
2545
  var clearTasks, moduleNames, errorMessage;
2664
- return _regeneratorRuntime().wrap(function _callee33$(_context33) {
2665
- while (1) switch (_context33.prev = _context33.next) {
2546
+ return _regeneratorRuntime().wrap(function _callee32$(_context32) {
2547
+ while (1) switch (_context32.prev = _context32.next) {
2666
2548
  case 0:
2667
2549
  console.log('[Server] 开始清空所有模块的IndexedDB缓存...');
2668
2550
  this.logInfo('开始清空所有模块的 IndexedDB 缓存');
@@ -2697,41 +2579,41 @@ var Server = /*#__PURE__*/function () {
2697
2579
  moduleNames.push('FloorPlan');
2698
2580
  }
2699
2581
  if (!(clearTasks.length === 0)) {
2700
- _context33.next = 15;
2582
+ _context32.next = 15;
2701
2583
  break;
2702
2584
  }
2703
2585
  console.warn('[Server] 没有找到已注册的模块,无需清空');
2704
2586
  this.logWarning('没有找到已注册的模块,无需清空 IndexedDB');
2705
- return _context33.abrupt("return");
2587
+ return _context32.abrupt("return");
2706
2588
  case 15:
2707
2589
  this.logInfo('准备清空模块缓存', {
2708
2590
  moduleNames: moduleNames
2709
2591
  });
2710
- _context33.prev = 16;
2711
- _context33.next = 19;
2592
+ _context32.prev = 16;
2593
+ _context32.next = 19;
2712
2594
  return Promise.all(clearTasks);
2713
2595
  case 19:
2714
2596
  console.log("[Server] \u2705 \u5DF2\u6210\u529F\u6E05\u7A7A\u6240\u6709\u6A21\u5757\u7684IndexedDB\u7F13\u5B58: ".concat(moduleNames.join(', ')));
2715
2597
  this.logInfo('成功清空所有模块的 IndexedDB 缓存', {
2716
2598
  moduleNames: moduleNames
2717
2599
  });
2718
- _context33.next = 29;
2600
+ _context32.next = 29;
2719
2601
  break;
2720
2602
  case 23:
2721
- _context33.prev = 23;
2722
- _context33.t0 = _context33["catch"](16);
2723
- errorMessage = _context33.t0 instanceof Error ? _context33.t0.message : String(_context33.t0);
2724
- console.error('[Server] ❌ 清空IndexedDB缓存时发生错误:', _context33.t0);
2603
+ _context32.prev = 23;
2604
+ _context32.t0 = _context32["catch"](16);
2605
+ errorMessage = _context32.t0 instanceof Error ? _context32.t0.message : String(_context32.t0);
2606
+ console.error('[Server] ❌ 清空IndexedDB缓存时发生错误:', _context32.t0);
2725
2607
  this.logError('清空 IndexedDB 缓存时发生错误', {
2726
2608
  moduleNames: moduleNames,
2727
2609
  error: errorMessage
2728
2610
  });
2729
- throw _context33.t0;
2611
+ throw _context32.t0;
2730
2612
  case 29:
2731
2613
  case "end":
2732
- return _context33.stop();
2614
+ return _context32.stop();
2733
2615
  }
2734
- }, _callee33, this, [[16, 23]]);
2616
+ }, _callee32, this, [[16, 23]]);
2735
2617
  }));
2736
2618
  function clearAllIndexDB() {
2737
2619
  return _clearAllIndexDB.apply(this, arguments);
@@ -2806,10 +2688,10 @@ var Server = /*#__PURE__*/function () {
2806
2688
  }, {
2807
2689
  key: "handleRoute",
2808
2690
  value: (function () {
2809
- var _handleRoute = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(method, path, params) {
2691
+ var _handleRoute = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(method, path, params) {
2810
2692
  var startTime, handler, result, duration, _duration4, errorMessage;
2811
- return _regeneratorRuntime().wrap(function _callee34$(_context34) {
2812
- while (1) switch (_context34.prev = _context34.next) {
2693
+ return _regeneratorRuntime().wrap(function _callee33$(_context33) {
2694
+ while (1) switch (_context33.prev = _context33.next) {
2813
2695
  case 0:
2814
2696
  startTime = Date.now();
2815
2697
  this.logInfo("\u8DEF\u7531\u8BF7\u6C42\u5F00\u59CB: ".concat(method.toUpperCase(), " ").concat(path), {
@@ -2820,7 +2702,7 @@ var Server = /*#__PURE__*/function () {
2820
2702
  });
2821
2703
  handler = this.getRouteHandler(method, path);
2822
2704
  if (handler) {
2823
- _context34.next = 6;
2705
+ _context33.next = 6;
2824
2706
  break;
2825
2707
  }
2826
2708
  this.logError("\u8DEF\u7531\u672A\u627E\u5230: ".concat(method.toUpperCase(), " ").concat(path), {
@@ -2829,13 +2711,13 @@ var Server = /*#__PURE__*/function () {
2829
2711
  });
2830
2712
  throw new Error("Route not found: ".concat(method.toUpperCase(), " ").concat(path));
2831
2713
  case 6:
2832
- _context34.prev = 6;
2833
- _context34.next = 9;
2714
+ _context33.prev = 6;
2715
+ _context33.next = 9;
2834
2716
  return handler(_objectSpread(_objectSpread({}, params), {}, {
2835
2717
  path: path
2836
2718
  }));
2837
2719
  case 9:
2838
- result = _context34.sent;
2720
+ result = _context33.sent;
2839
2721
  duration = Date.now() - startTime;
2840
2722
  this.logInfo("\u8DEF\u7531\u8BF7\u6C42\u5B8C\u6210: ".concat(method.toUpperCase(), " ").concat(path), {
2841
2723
  method: method.toUpperCase(),
@@ -2844,12 +2726,12 @@ var Server = /*#__PURE__*/function () {
2844
2726
  resultCode: result === null || result === void 0 ? void 0 : result.code,
2845
2727
  resultStatus: result === null || result === void 0 ? void 0 : result.status
2846
2728
  });
2847
- return _context34.abrupt("return", result);
2729
+ return _context33.abrupt("return", result);
2848
2730
  case 15:
2849
- _context34.prev = 15;
2850
- _context34.t0 = _context34["catch"](6);
2731
+ _context33.prev = 15;
2732
+ _context33.t0 = _context33["catch"](6);
2851
2733
  _duration4 = Date.now() - startTime;
2852
- errorMessage = _context34.t0 instanceof Error ? _context34.t0.message : String(_context34.t0);
2734
+ errorMessage = _context33.t0 instanceof Error ? _context33.t0.message : String(_context33.t0);
2853
2735
  this.logError("\u8DEF\u7531\u5904\u7406\u9519\u8BEF: ".concat(method.toUpperCase(), " ").concat(path), {
2854
2736
  method: method.toUpperCase(),
2855
2737
  path: path,
@@ -2857,15 +2739,15 @@ var Server = /*#__PURE__*/function () {
2857
2739
  error: errorMessage,
2858
2740
  data: params.data
2859
2741
  });
2860
- console.error("[Server] \u8DEF\u7531\u5904\u7406\u9519\u8BEF: ".concat(method.toUpperCase(), " ").concat(path), _context34.t0);
2861
- throw _context34.t0;
2742
+ console.error("[Server] \u8DEF\u7531\u5904\u7406\u9519\u8BEF: ".concat(method.toUpperCase(), " ").concat(path), _context33.t0);
2743
+ throw _context33.t0;
2862
2744
  case 22:
2863
2745
  case "end":
2864
- return _context34.stop();
2746
+ return _context33.stop();
2865
2747
  }
2866
- }, _callee34, this, [[6, 15]]);
2748
+ }, _callee33, this, [[6, 15]]);
2867
2749
  }));
2868
- function handleRoute(_x33, _x34, _x35) {
2750
+ function handleRoute(_x32, _x33, _x34) {
2869
2751
  return _handleRoute.apply(this, arguments);
2870
2752
  }
2871
2753
  return handleRoute;
@@ -2975,14 +2857,6 @@ var Server = /*#__PURE__*/function () {
2975
2857
  method: 'post',
2976
2858
  path: '/shop/local/print-order',
2977
2859
  handler: this.handleLocalPrintOrder.bind(this)
2978
- }, {
2979
- method: 'post',
2980
- path: '/shop/machinecode/batch',
2981
- handler: this.handleMachinecodeBatchMeta.bind(this)
2982
- }, {
2983
- method: 'post',
2984
- path: '/machinecode/batch',
2985
- handler: this.handleMachinecodeBatchMeta.bind(this)
2986
2860
  }]);
2987
2861
  this.registerPrefixRoutes([{
2988
2862
  method: 'get',
@@ -2997,36 +2871,36 @@ var Server = /*#__PURE__*/function () {
2997
2871
  }, {
2998
2872
  key: "getPaymentRouteModule",
2999
2873
  value: function () {
3000
- var _getPaymentRouteModule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36() {
2874
+ var _getPaymentRouteModule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35() {
3001
2875
  var _this6 = this;
3002
- return _regeneratorRuntime().wrap(function _callee36$(_context36) {
3003
- while (1) switch (_context36.prev = _context36.next) {
2876
+ return _regeneratorRuntime().wrap(function _callee35$(_context35) {
2877
+ while (1) switch (_context35.prev = _context35.next) {
3004
2878
  case 0:
3005
2879
  if (!this.payment) {
3006
- _context36.next = 2;
2880
+ _context35.next = 2;
3007
2881
  break;
3008
2882
  }
3009
- return _context36.abrupt("return", this.payment);
2883
+ return _context35.abrupt("return", this.payment);
3010
2884
  case 2:
3011
2885
  if (!this.paymentRouteModule) {
3012
- _context36.next = 4;
2886
+ _context35.next = 4;
3013
2887
  break;
3014
2888
  }
3015
- return _context36.abrupt("return", this.paymentRouteModule);
2889
+ return _context35.abrupt("return", this.paymentRouteModule);
3016
2890
  case 4:
3017
2891
  if (!this.paymentRouteModuleInFlight) {
3018
- _context36.next = 6;
2892
+ _context35.next = 6;
3019
2893
  break;
3020
2894
  }
3021
- return _context36.abrupt("return", this.paymentRouteModuleInFlight);
2895
+ return _context35.abrupt("return", this.paymentRouteModuleInFlight);
3022
2896
  case 6:
3023
- this.paymentRouteModuleInFlight = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35() {
2897
+ this.paymentRouteModuleInFlight = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34() {
3024
2898
  var module;
3025
- return _regeneratorRuntime().wrap(function _callee35$(_context35) {
3026
- while (1) switch (_context35.prev = _context35.next) {
2899
+ return _regeneratorRuntime().wrap(function _callee34$(_context34) {
2900
+ while (1) switch (_context34.prev = _context34.next) {
3027
2901
  case 0:
3028
2902
  module = new PaymentServerModule('server_payment_route', '1.0.0');
3029
- _context35.next = 3;
2903
+ _context34.next = 3;
3030
2904
  return module.initialize(_this6.core, {
3031
2905
  store: {
3032
2906
  payMethods: []
@@ -3034,21 +2908,21 @@ var Server = /*#__PURE__*/function () {
3034
2908
  });
3035
2909
  case 3:
3036
2910
  _this6.paymentRouteModule = module;
3037
- return _context35.abrupt("return", module);
2911
+ return _context34.abrupt("return", module);
3038
2912
  case 5:
3039
2913
  case "end":
3040
- return _context35.stop();
2914
+ return _context34.stop();
3041
2915
  }
3042
- }, _callee35);
2916
+ }, _callee34);
3043
2917
  }))().finally(function () {
3044
2918
  _this6.paymentRouteModuleInFlight = undefined;
3045
2919
  });
3046
- return _context36.abrupt("return", this.paymentRouteModuleInFlight);
2920
+ return _context35.abrupt("return", this.paymentRouteModuleInFlight);
3047
2921
  case 8:
3048
2922
  case "end":
3049
- return _context36.stop();
2923
+ return _context35.stop();
3050
2924
  }
3051
- }, _callee36, this);
2925
+ }, _callee35, this);
3052
2926
  }));
3053
2927
  function getPaymentRouteModule() {
3054
2928
  return _getPaymentRouteModule.apply(this, arguments);
@@ -3058,19 +2932,19 @@ var Server = /*#__PURE__*/function () {
3058
2932
  }, {
3059
2933
  key: "fetchQuotationAvailableFromAPI",
3060
2934
  value: function () {
3061
- var _fetchQuotationAvailableFromAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(data) {
3062
- var _this$app7;
2935
+ var _fetchQuotationAvailableFromAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(data) {
2936
+ var _this$app6;
3063
2937
  var requester;
3064
- return _regeneratorRuntime().wrap(function _callee37$(_context37) {
3065
- while (1) switch (_context37.prev = _context37.next) {
2938
+ return _regeneratorRuntime().wrap(function _callee36$(_context36) {
2939
+ while (1) switch (_context36.prev = _context36.next) {
3066
2940
  case 0:
3067
- requester = ((_this$app7 = this.app) === null || _this$app7 === void 0 ? void 0 : _this$app7.request) || this.core.getPlugin('request');
2941
+ requester = ((_this$app6 = this.app) === null || _this$app6 === void 0 ? void 0 : _this$app6.request) || this.core.getPlugin('request');
3068
2942
  if (requester !== null && requester !== void 0 && requester.get) {
3069
- _context37.next = 4;
2943
+ _context36.next = 4;
3070
2944
  break;
3071
2945
  }
3072
2946
  this.logError('fetchQuotationAvailableFromAPI: request 不可用');
3073
- return _context37.abrupt("return", {
2947
+ return _context36.abrupt("return", {
3074
2948
  code: 500,
3075
2949
  message: 'request 不可用',
3076
2950
  data: {
@@ -3079,14 +2953,14 @@ var Server = /*#__PURE__*/function () {
3079
2953
  status: false
3080
2954
  });
3081
2955
  case 4:
3082
- return _context37.abrupt("return", requester.get('/shop/quotation/available', data));
2956
+ return _context36.abrupt("return", requester.get('/shop/quotation/available', data));
3083
2957
  case 5:
3084
2958
  case "end":
3085
- return _context37.stop();
2959
+ return _context36.stop();
3086
2960
  }
3087
- }, _callee37, this);
2961
+ }, _callee36, this);
3088
2962
  }));
3089
- function fetchQuotationAvailableFromAPI(_x36) {
2963
+ function fetchQuotationAvailableFromAPI(_x35) {
3090
2964
  return _fetchQuotationAvailableFromAPI.apply(this, arguments);
3091
2965
  }
3092
2966
  return fetchQuotationAvailableFromAPI;
@@ -3108,6 +2982,7 @@ var Server = /*#__PURE__*/function () {
3108
2982
  key: "removeProductQuerySubscriber",
3109
2983
  value: function removeProductQuerySubscriber(subscriberId) {
3110
2984
  if (subscriberId) {
2985
+ this.clearSubscriberScheduleTimers(subscriberId);
3111
2986
  this.productQuerySubscribers.delete(subscriberId);
3112
2987
  this.logInfo('removeProductQuerySubscriber: 已移除订阅者', {
3113
2988
  subscriberId: subscriberId,
@@ -3115,6 +2990,243 @@ var Server = /*#__PURE__*/function () {
3115
2990
  });
3116
2991
  }
3117
2992
  }
2993
+
2994
+ /**
2995
+ * 构建商品 query 响应 data 段,附带智能定价 schedule_time_points 元数据。
2996
+ */
2997
+ }, {
2998
+ key: "buildProductQueryResultPayload",
2999
+ value: function buildProductQueryResultPayload(list, count) {
3000
+ var _this$products$getLas, _this$products, _this$products$getLas2;
3001
+ return {
3002
+ list: list,
3003
+ count: count !== null && count !== void 0 ? count : list.length,
3004
+ schedule_time_points: (_this$products$getLas = (_this$products = this.products) === null || _this$products === void 0 || (_this$products$getLas2 = _this$products.getLastScheduleTimePoints) === null || _this$products$getLas2 === void 0 ? void 0 : _this$products$getLas2.call(_this$products)) !== null && _this$products$getLas !== void 0 ? _this$products$getLas : []
3005
+ };
3006
+ }
3007
+
3008
+ /**
3009
+ * 是否启用商品 query 订阅的 schedule 时间点定时重算。
3010
+ * strategy_context.enable_schedule_reload === false 时关闭。
3011
+ */
3012
+ }, {
3013
+ key: "shouldScheduleProductQueryReload",
3014
+ value: function shouldScheduleProductQueryReload(strategy_context) {
3015
+ return (strategy_context === null || strategy_context === void 0 ? void 0 : strategy_context.enable_schedule_reload) !== false;
3016
+ }
3017
+
3018
+ /**
3019
+ * 清除指定 subscriber 的全部 schedule 定时器,防止重复 query 或 unsubscribe 后泄漏。
3020
+ */
3021
+ }, {
3022
+ key: "clearSubscriberScheduleTimers",
3023
+ value: function clearSubscriberScheduleTimers(subscriberId) {
3024
+ var timers = this.productQueryScheduleTimers.get(subscriberId);
3025
+ if (timers !== null && timers !== void 0 && timers.length) {
3026
+ timers.forEach(function (timerId) {
3027
+ return clearTimeout(timerId);
3028
+ });
3029
+ }
3030
+ this.productQueryScheduleTimers.delete(subscriberId);
3031
+ var subscriber = this.productQuerySubscribers.get(subscriberId);
3032
+ if (subscriber) {
3033
+ subscriber.scheduleTimerIds = [];
3034
+ }
3035
+ }
3036
+
3037
+ /**
3038
+ * 从 productQueryScheduleTimers 移除已触发的 timer 引用。
3039
+ */
3040
+ }, {
3041
+ key: "removeScheduleTimerRef",
3042
+ value: function removeScheduleTimerRef(subscriberId, timerId) {
3043
+ var timers = this.productQueryScheduleTimers.get(subscriberId);
3044
+ if (!(timers !== null && timers !== void 0 && timers.length)) return;
3045
+ var next = timers.filter(function (id) {
3046
+ return id !== timerId;
3047
+ });
3048
+ if (next.length === 0) {
3049
+ this.productQueryScheduleTimers.delete(subscriberId);
3050
+ } else {
3051
+ this.productQueryScheduleTimers.set(subscriberId, next);
3052
+ }
3053
+ var subscriber = this.productQuerySubscribers.get(subscriberId);
3054
+ if (subscriber) {
3055
+ subscriber.scheduleTimerIds = next;
3056
+ }
3057
+ }
3058
+
3059
+ /**
3060
+ * 计算 schedule 变价时间点到当前时刻的延迟(ms)。已过期返回 -1。
3061
+ */
3062
+ }, {
3063
+ key: "computeScheduleTimePointDelayMs",
3064
+ value: function computeScheduleTimePointDelayMs(scheduleDate, timePoint) {
3065
+ var parts = timePoint.split(':');
3066
+ if (parts.length < 2) return -1;
3067
+ var hours = parseInt(parts[0], 10);
3068
+ var minutes = parseInt(parts[1], 10);
3069
+ if (!Number.isFinite(hours) || !Number.isFinite(minutes)) return -1;
3070
+ var target = dayjs(scheduleDate).hour(hours).minute(minutes).second(4).millisecond(0);
3071
+ var delayMs = target.diff(dayjs());
3072
+ return delayMs >= 0 ? delayMs : -1;
3073
+ }
3074
+
3075
+ /**
3076
+ * 定时重算前刷新 subscriber schedule 上下文:使用执行瞬间时间,禁止沿用首次 query 的 schedule_datetime。
3077
+ */
3078
+ }, {
3079
+ key: "refreshSubscriberScheduleAtExecution",
3080
+ value: function refreshSubscriberScheduleAtExecution(subscriber) {
3081
+ var executedAt = dayjs();
3082
+ var bookingDate = subscriber.context.schedule_date || executedAt.format('YYYY-MM-DD');
3083
+ subscriber.context.schedule_date = bookingDate;
3084
+ subscriber.context.schedule_datetime = "".concat(bookingDate, " ").concat(executedAt.format('HH:mm:ss'));
3085
+ }
3086
+
3087
+ /**
3088
+ * 为 subscriber 注册智能定价 scheduleTimePoints 定时重算。
3089
+ * 必须先 clearSubscriberScheduleTimers,再调用本方法。
3090
+ */
3091
+ }, {
3092
+ key: "scheduleSubscriberTimePointReloads",
3093
+ value: function scheduleSubscriberTimePointReloads(subscriberId, timePoints) {
3094
+ var _this7 = this;
3095
+ var subscriber = this.productQuerySubscribers.get(subscriberId);
3096
+ if (!subscriber || !timePoints.length) return;
3097
+ var scheduleDate = subscriber.context.schedule_date || dayjs().format('YYYY-MM-DD');
3098
+ var timerIds = [];
3099
+ var _iterator5 = _createForOfIteratorHelper(timePoints),
3100
+ _step5;
3101
+ try {
3102
+ var _loop = function _loop() {
3103
+ var timePoint = _step5.value;
3104
+ var delayMs = _this7.computeScheduleTimePointDelayMs(scheduleDate, timePoint);
3105
+ if (delayMs < 0) return 1; // continue
3106
+ var timerId = setTimeout(function () {
3107
+ void _this7.onScheduleTimePointTimerFire(subscriberId, timerId);
3108
+ }, delayMs);
3109
+ timerIds.push(timerId);
3110
+ };
3111
+ for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
3112
+ if (_loop()) continue;
3113
+ }
3114
+ } catch (err) {
3115
+ _iterator5.e(err);
3116
+ } finally {
3117
+ _iterator5.f();
3118
+ }
3119
+ if (timerIds.length > 0) {
3120
+ this.productQueryScheduleTimers.set(subscriberId, timerIds);
3121
+ subscriber.scheduleTimerIds = timerIds;
3122
+ this.logInfo('scheduleSubscriberTimePointReloads: 已注册定时器', {
3123
+ subscriberId: subscriberId,
3124
+ timerCount: timerIds.length,
3125
+ timePoints: timePoints
3126
+ });
3127
+ }
3128
+ }
3129
+
3130
+ /**
3131
+ * schedule 变价时间点定时器触发:刷新 schedule_datetime 后重算并 callback。
3132
+ */
3133
+ }, {
3134
+ key: "onScheduleTimePointTimerFire",
3135
+ value: (function () {
3136
+ var _onScheduleTimePointTimerFire = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(subscriberId, timerId) {
3137
+ var subscriber;
3138
+ return _regeneratorRuntime().wrap(function _callee37$(_context37) {
3139
+ while (1) switch (_context37.prev = _context37.next) {
3140
+ case 0:
3141
+ this.removeScheduleTimerRef(subscriberId, timerId);
3142
+ if (this.productQuerySubscribers.has(subscriberId)) {
3143
+ _context37.next = 3;
3144
+ break;
3145
+ }
3146
+ return _context37.abrupt("return");
3147
+ case 3:
3148
+ subscriber = this.productQuerySubscribers.get(subscriberId);
3149
+ this.refreshSubscriberScheduleAtExecution(subscriber);
3150
+ _context37.next = 7;
3151
+ return this.recomputeAndNotifySubscriber(subscriberId);
3152
+ case 7:
3153
+ case "end":
3154
+ return _context37.stop();
3155
+ }
3156
+ }, _callee37, this);
3157
+ }));
3158
+ function onScheduleTimePointTimerFire(_x36, _x37) {
3159
+ return _onScheduleTimePointTimerFire.apply(this, arguments);
3160
+ }
3161
+ return onScheduleTimePointTimerFire;
3162
+ }()
3163
+ /**
3164
+ * 对单个商品 query 订阅者重算并推送(定时路径;不新建 schedule timer)。
3165
+ */
3166
+ )
3167
+ }, {
3168
+ key: "recomputeAndNotifySubscriber",
3169
+ value: (function () {
3170
+ var _recomputeAndNotifySubscriber = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38(subscriberId) {
3171
+ var subscriber, result, errorMessage;
3172
+ return _regeneratorRuntime().wrap(function _callee38$(_context38) {
3173
+ while (1) switch (_context38.prev = _context38.next) {
3174
+ case 0:
3175
+ subscriber = this.productQuerySubscribers.get(subscriberId);
3176
+ if (subscriber) {
3177
+ _context38.next = 3;
3178
+ break;
3179
+ }
3180
+ return _context38.abrupt("return");
3181
+ case 3:
3182
+ _context38.prev = 3;
3183
+ _context38.next = 6;
3184
+ return this.computeProductQueryResult(subscriber.context);
3185
+ case 6:
3186
+ result = _context38.sent;
3187
+ subscriber.callback(result);
3188
+ this.logInfo('recomputeAndNotifySubscriber: 已推送', {
3189
+ subscriberId: subscriberId,
3190
+ schedule_datetime: subscriber.context.schedule_datetime
3191
+ });
3192
+ _context38.next = 15;
3193
+ break;
3194
+ case 11:
3195
+ _context38.prev = 11;
3196
+ _context38.t0 = _context38["catch"](3);
3197
+ errorMessage = _context38.t0 instanceof Error ? _context38.t0.message : String(_context38.t0);
3198
+ this.logError('recomputeAndNotifySubscriber: 推送失败', {
3199
+ subscriberId: subscriberId,
3200
+ error: errorMessage
3201
+ });
3202
+ case 15:
3203
+ case "end":
3204
+ return _context38.stop();
3205
+ }
3206
+ }, _callee38, this, [[3, 11]]);
3207
+ }));
3208
+ function recomputeAndNotifySubscriber(_x38) {
3209
+ return _recomputeAndNotifySubscriber.apply(this, arguments);
3210
+ }
3211
+ return recomputeAndNotifySubscriber;
3212
+ }()
3213
+ /**
3214
+ * query 完成后为 subscriber 同步 schedule 定时器(先 clear 再 schedule)。
3215
+ */
3216
+ )
3217
+ }, {
3218
+ key: "syncProductQueryScheduleTimers",
3219
+ value: function syncProductQueryScheduleTimers(subscriberId, strategy_context) {
3220
+ var _this$products$getLas3, _this$products2, _this$products2$getLa;
3221
+ this.clearSubscriberScheduleTimers(subscriberId);
3222
+ if (!this.shouldScheduleProductQueryReload(strategy_context)) {
3223
+ return;
3224
+ }
3225
+ var timePoints = (_this$products$getLas3 = (_this$products2 = this.products) === null || _this$products2 === void 0 || (_this$products2$getLa = _this$products2.getLastScheduleTimePoints) === null || _this$products2$getLa === void 0 ? void 0 : _this$products2$getLa.call(_this$products2)) !== null && _this$products$getLas3 !== void 0 ? _this$products$getLas3 : [];
3226
+ if (timePoints.length > 0) {
3227
+ this.scheduleSubscriberTimePointReloads(subscriberId, timePoints);
3228
+ }
3229
+ }
3118
3230
  }, {
3119
3231
  key: "handleSalesSearchRequest",
3120
3232
  value: (
@@ -3126,32 +3238,32 @@ var Server = /*#__PURE__*/function () {
3126
3238
  * const result = await this.handleSalesSearchRequest('single', '/shop/es/search/sales', { keyword: '1001' }, {})
3127
3239
  */
3128
3240
  function () {
3129
- var _handleSalesSearchRequest = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38(kind, backendPath, data, config) {
3130
- var queryPayload, result, _ref55, callback, subscriberId, resetVisibleOrderIds, contextSignature, existing, shouldReset, visibleOrderIds, _iterator5, _step5, orderId;
3131
- return _regeneratorRuntime().wrap(function _callee38$(_context38) {
3132
- while (1) switch (_context38.prev = _context38.next) {
3241
+ var _handleSalesSearchRequest = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39(kind, backendPath, data, config) {
3242
+ var queryPayload, result, _ref53, callback, subscriberId, resetVisibleOrderIds, contextSignature, existing, shouldReset, visibleOrderIds, _iterator6, _step6, orderId;
3243
+ return _regeneratorRuntime().wrap(function _callee39$(_context39) {
3244
+ while (1) switch (_context39.prev = _context39.next) {
3133
3245
  case 0:
3134
3246
  queryPayload = data && _typeof(data) === 'object' ? _objectSpread({}, data) : {};
3135
- _context38.next = 3;
3247
+ _context39.next = 3;
3136
3248
  return this.fetchSalesSearchFromAPI(backendPath, queryPayload);
3137
3249
  case 3:
3138
- result = _context38.sent;
3139
- _ref55 = config || {}, callback = _ref55.callback, subscriberId = _ref55.subscriberId, resetVisibleOrderIds = _ref55.resetVisibleOrderIds;
3250
+ result = _context39.sent;
3251
+ _ref53 = config || {}, callback = _ref53.callback, subscriberId = _ref53.subscriberId, resetVisibleOrderIds = _ref53.resetVisibleOrderIds;
3140
3252
  if (subscriberId && typeof callback === 'function') {
3141
3253
  contextSignature = this.buildSalesSearchSignature(kind, queryPayload);
3142
3254
  existing = this.salesSearchSubscribers.get(subscriberId);
3143
3255
  shouldReset = resetVisibleOrderIds === true || !existing || existing.kind !== kind || existing.contextSignature !== contextSignature;
3144
3256
  visibleOrderIds = shouldReset ? new Set() : new Set(existing.visibleOrderIds);
3145
- _iterator5 = _createForOfIteratorHelper(this.extractSalesSearchOrderIds(kind, result));
3257
+ _iterator6 = _createForOfIteratorHelper(this.extractSalesSearchOrderIds(kind, result));
3146
3258
  try {
3147
- for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
3148
- orderId = _step5.value;
3259
+ for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
3260
+ orderId = _step6.value;
3149
3261
  visibleOrderIds.add(orderId);
3150
3262
  }
3151
3263
  } catch (err) {
3152
- _iterator5.e(err);
3264
+ _iterator6.e(err);
3153
3265
  } finally {
3154
- _iterator5.f();
3266
+ _iterator6.f();
3155
3267
  }
3156
3268
  this.salesSearchSubscribers.set(subscriberId, {
3157
3269
  callback: callback,
@@ -3167,14 +3279,14 @@ var Server = /*#__PURE__*/function () {
3167
3279
  visibleCount: visibleOrderIds.size
3168
3280
  });
3169
3281
  }
3170
- return _context38.abrupt("return", result);
3282
+ return _context39.abrupt("return", result);
3171
3283
  case 7:
3172
3284
  case "end":
3173
- return _context38.stop();
3285
+ return _context39.stop();
3174
3286
  }
3175
- }, _callee38, this);
3287
+ }, _callee39, this);
3176
3288
  }));
3177
- function handleSalesSearchRequest(_x37, _x38, _x39, _x40) {
3289
+ function handleSalesSearchRequest(_x39, _x40, _x41, _x42) {
3178
3290
  return _handleSalesSearchRequest.apply(this, arguments);
3179
3291
  }
3180
3292
  return handleSalesSearchRequest;
@@ -3189,20 +3301,20 @@ var Server = /*#__PURE__*/function () {
3189
3301
  }, {
3190
3302
  key: "fetchSalesSearchFromAPI",
3191
3303
  value: (function () {
3192
- var _fetchSalesSearchFromAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39(backendPath, data) {
3193
- var _this$app8;
3194
- var _response$data4, _response$code2, _response$status2, _response$message2, response, _payload, errorMessage;
3195
- return _regeneratorRuntime().wrap(function _callee39$(_context39) {
3196
- while (1) switch (_context39.prev = _context39.next) {
3304
+ var _fetchSalesSearchFromAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40(backendPath, data) {
3305
+ var _this$app7;
3306
+ var _response$data3, _response$code, _response$status, _response$message, response, _payload, errorMessage;
3307
+ return _regeneratorRuntime().wrap(function _callee40$(_context40) {
3308
+ while (1) switch (_context40.prev = _context40.next) {
3197
3309
  case 0:
3198
- if ((_this$app8 = this.app) !== null && _this$app8 !== void 0 && _this$app8.request) {
3199
- _context39.next = 3;
3310
+ if ((_this$app7 = this.app) !== null && _this$app7 !== void 0 && _this$app7.request) {
3311
+ _context40.next = 3;
3200
3312
  break;
3201
3313
  }
3202
3314
  this.logError('fetchSalesSearchFromAPI: app.request 不可用', {
3203
3315
  backendPath: backendPath
3204
3316
  });
3205
- return _context39.abrupt("return", {
3317
+ return _context40.abrupt("return", {
3206
3318
  code: 500,
3207
3319
  message: 'app.request 不可用',
3208
3320
  data: backendPath === '/shop/es/search' ? {
@@ -3214,29 +3326,29 @@ var Server = /*#__PURE__*/function () {
3214
3326
  status: false
3215
3327
  });
3216
3328
  case 3:
3217
- _context39.prev = 3;
3218
- _context39.next = 6;
3329
+ _context40.prev = 3;
3330
+ _context40.next = 6;
3219
3331
  return this.app.request.post(backendPath, data, {
3220
3332
  isShopApi: true
3221
3333
  });
3222
3334
  case 6:
3223
- response = _context39.sent;
3224
- _payload = (_response$data4 = response === null || response === void 0 ? void 0 : response.data) !== null && _response$data4 !== void 0 ? _response$data4 : response;
3225
- return _context39.abrupt("return", {
3226
- code: (_response$code2 = response === null || response === void 0 ? void 0 : response.code) !== null && _response$code2 !== void 0 ? _response$code2 : 200,
3227
- status: (_response$status2 = response === null || response === void 0 ? void 0 : response.status) !== null && _response$status2 !== void 0 ? _response$status2 : true,
3228
- message: (_response$message2 = response === null || response === void 0 ? void 0 : response.message) !== null && _response$message2 !== void 0 ? _response$message2 : '',
3335
+ response = _context40.sent;
3336
+ _payload = (_response$data3 = response === null || response === void 0 ? void 0 : response.data) !== null && _response$data3 !== void 0 ? _response$data3 : response;
3337
+ return _context40.abrupt("return", {
3338
+ code: (_response$code = response === null || response === void 0 ? void 0 : response.code) !== null && _response$code !== void 0 ? _response$code : 200,
3339
+ status: (_response$status = response === null || response === void 0 ? void 0 : response.status) !== null && _response$status !== void 0 ? _response$status : true,
3340
+ message: (_response$message = response === null || response === void 0 ? void 0 : response.message) !== null && _response$message !== void 0 ? _response$message : '',
3229
3341
  data: _payload
3230
3342
  });
3231
3343
  case 11:
3232
- _context39.prev = 11;
3233
- _context39.t0 = _context39["catch"](3);
3234
- errorMessage = _context39.t0 instanceof Error ? _context39.t0.message : String(_context39.t0);
3344
+ _context40.prev = 11;
3345
+ _context40.t0 = _context40["catch"](3);
3346
+ errorMessage = _context40.t0 instanceof Error ? _context40.t0.message : String(_context40.t0);
3235
3347
  this.logError('fetchSalesSearchFromAPI: 请求失败', {
3236
3348
  backendPath: backendPath,
3237
3349
  error: errorMessage
3238
3350
  });
3239
- return _context39.abrupt("return", {
3351
+ return _context40.abrupt("return", {
3240
3352
  code: 500,
3241
3353
  message: errorMessage,
3242
3354
  data: backendPath === '/shop/es/search' ? {
@@ -3249,11 +3361,11 @@ var Server = /*#__PURE__*/function () {
3249
3361
  });
3250
3362
  case 16:
3251
3363
  case "end":
3252
- return _context39.stop();
3364
+ return _context40.stop();
3253
3365
  }
3254
- }, _callee39, this, [[3, 11]]);
3366
+ }, _callee40, this, [[3, 11]]);
3255
3367
  }));
3256
- function fetchSalesSearchFromAPI(_x41, _x42) {
3368
+ function fetchSalesSearchFromAPI(_x43, _x44) {
3257
3369
  return _fetchSalesSearchFromAPI.apply(this, arguments);
3258
3370
  }
3259
3371
  return fetchSalesSearchFromAPI;
@@ -3283,10 +3395,10 @@ var Server = /*#__PURE__*/function () {
3283
3395
  }, {
3284
3396
  key: "stripSalesSearchPageParams",
3285
3397
  value: function stripSalesSearchPageParams(value) {
3286
- var _this7 = this;
3398
+ var _this8 = this;
3287
3399
  if (Array.isArray(value)) {
3288
3400
  return value.map(function (item) {
3289
- return _this7.stripSalesSearchPageParams(item);
3401
+ return _this8.stripSalesSearchPageParams(item);
3290
3402
  });
3291
3403
  }
3292
3404
  if (!value || _typeof(value) !== 'object') return value;
@@ -3324,12 +3436,12 @@ var Server = /*#__PURE__*/function () {
3324
3436
  key: "extractSalesSearchOrderIds",
3325
3437
  value: function extractSalesSearchOrderIds(kind, result) {
3326
3438
  var _this$findSalesSearch,
3327
- _this8 = this;
3439
+ _this9 = this;
3328
3440
  var data = this.extractSalesSearchResponseData(result);
3329
3441
  var list = kind === 'aggregate' ? (_this$findSalesSearch = this.findSalesSearchAggregateGroup(data)) === null || _this$findSalesSearch === void 0 ? void 0 : _this$findSalesSearch.list : data === null || data === void 0 ? void 0 : data.list;
3330
3442
  if (!Array.isArray(list)) return [];
3331
3443
  return list.map(function (item) {
3332
- return _this8.getSalesSearchOrderId(item);
3444
+ return _this9.getSalesSearchOrderId(item);
3333
3445
  }).filter(function (id) {
3334
3446
  return !!id;
3335
3447
  });
@@ -3496,11 +3608,11 @@ var Server = /*#__PURE__*/function () {
3496
3608
  }, {
3497
3609
  key: "stableSerialize",
3498
3610
  value: function stableSerialize(value) {
3499
- var _this9 = this;
3611
+ var _this10 = this;
3500
3612
  if (value === null || value === undefined) return 'null';
3501
3613
  if (Array.isArray(value)) {
3502
3614
  return "[".concat(value.map(function (item) {
3503
- return _this9.stableSerialize(item);
3615
+ return _this10.stableSerialize(item);
3504
3616
  }).join(','), "]");
3505
3617
  }
3506
3618
  if (_typeof(value) === 'object') {
@@ -3509,7 +3621,7 @@ var Server = /*#__PURE__*/function () {
3509
3621
  return obj[k] !== undefined;
3510
3622
  }).sort();
3511
3623
  return "{".concat(keys.map(function (k) {
3512
- return "".concat(JSON.stringify(k), ":").concat(_this9.stableSerialize(obj[k]));
3624
+ return "".concat(JSON.stringify(k), ":").concat(_this10.stableSerialize(obj[k]));
3513
3625
  }).join(','), "}");
3514
3626
  }
3515
3627
  return JSON.stringify(value);
@@ -3558,22 +3670,22 @@ var Server = /*#__PURE__*/function () {
3558
3670
  }
3559
3671
  var oldestKey = null;
3560
3672
  var oldestTime = Number.POSITIVE_INFINITY;
3561
- var _iterator6 = _createForOfIteratorHelper(this.bookingRemoteCache.entries()),
3562
- _step6;
3673
+ var _iterator7 = _createForOfIteratorHelper(this.bookingRemoteCache.entries()),
3674
+ _step7;
3563
3675
  try {
3564
- for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
3565
- var _step6$value = _slicedToArray(_step6.value, 2),
3566
- _key3 = _step6$value[0],
3567
- cache = _step6$value[1];
3676
+ for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
3677
+ var _step7$value = _slicedToArray(_step7.value, 2),
3678
+ _key3 = _step7$value[0],
3679
+ cache = _step7$value[1];
3568
3680
  if (cache.updatedAt < oldestTime) {
3569
3681
  oldestTime = cache.updatedAt;
3570
3682
  oldestKey = _key3;
3571
3683
  }
3572
3684
  }
3573
3685
  } catch (err) {
3574
- _iterator6.e(err);
3686
+ _iterator7.e(err);
3575
3687
  } finally {
3576
- _iterator6.f();
3688
+ _iterator7.f();
3577
3689
  }
3578
3690
  if (oldestKey) this.bookingRemoteCache.delete(oldestKey);
3579
3691
  }
@@ -3589,17 +3701,17 @@ var Server = /*#__PURE__*/function () {
3589
3701
  key: "markBookingRemoteCacheAllStale",
3590
3702
  value: function markBookingRemoteCacheAllStale(reason) {
3591
3703
  if (this.bookingRemoteCache.size === 0) return;
3592
- var _iterator7 = _createForOfIteratorHelper(this.bookingRemoteCache.values()),
3593
- _step7;
3704
+ var _iterator8 = _createForOfIteratorHelper(this.bookingRemoteCache.values()),
3705
+ _step8;
3594
3706
  try {
3595
- for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
3596
- var entry = _step7.value;
3707
+ for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
3708
+ var entry = _step8.value;
3597
3709
  entry.stale = true;
3598
3710
  }
3599
3711
  } catch (err) {
3600
- _iterator7.e(err);
3712
+ _iterator8.e(err);
3601
3713
  } finally {
3602
- _iterator7.f();
3714
+ _iterator8.f();
3603
3715
  }
3604
3716
  this.logWarning('bookingRemoteCache: 全量标记失效', {
3605
3717
  reason: reason,
@@ -3625,13 +3737,13 @@ var Server = /*#__PURE__*/function () {
3625
3737
  key: "notifyBookingRemoteSubscribersByCacheKey",
3626
3738
  value: function notifyBookingRemoteSubscribersByCacheKey(cacheKey, entry, reason) {
3627
3739
  if (this.bookingRemoteQuerySubscribers.size === 0) return;
3628
- var _iterator8 = _createForOfIteratorHelper(this.bookingRemoteQuerySubscribers.entries()),
3629
- _step8;
3740
+ var _iterator9 = _createForOfIteratorHelper(this.bookingRemoteQuerySubscribers.entries()),
3741
+ _step9;
3630
3742
  try {
3631
- for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
3632
- var _step8$value = _slicedToArray(_step8.value, 2),
3633
- subscriberId = _step8$value[0],
3634
- subscriber = _step8$value[1];
3743
+ for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
3744
+ var _step9$value = _slicedToArray(_step9.value, 2),
3745
+ subscriberId = _step9$value[0],
3746
+ subscriber = _step9$value[1];
3635
3747
  if (subscriber.cacheKey !== cacheKey) continue;
3636
3748
  try {
3637
3749
  var callbackStartAt = Date.now();
@@ -3658,9 +3770,9 @@ var Server = /*#__PURE__*/function () {
3658
3770
  }
3659
3771
  }
3660
3772
  } catch (err) {
3661
- _iterator8.e(err);
3773
+ _iterator9.e(err);
3662
3774
  } finally {
3663
- _iterator8.f();
3775
+ _iterator9.f();
3664
3776
  }
3665
3777
  }
3666
3778
  }, {
@@ -3675,13 +3787,13 @@ var Server = /*#__PURE__*/function () {
3675
3787
  return;
3676
3788
  }
3677
3789
  var syncedEntryCount = 0;
3678
- var _iterator9 = _createForOfIteratorHelper(this.bookingRemoteCache.entries()),
3679
- _step9;
3790
+ var _iterator10 = _createForOfIteratorHelper(this.bookingRemoteCache.entries()),
3791
+ _step10;
3680
3792
  try {
3681
- for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
3682
- var _step9$value = _slicedToArray(_step9.value, 2),
3683
- cacheKey = _step9$value[0],
3684
- entry = _step9$value[1];
3793
+ for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
3794
+ var _step10$value = _slicedToArray(_step10.value, 2),
3795
+ cacheKey = _step10$value[0],
3796
+ entry = _step10$value[1];
3685
3797
  if (entry.stale) {
3686
3798
  this.bookingRemoteCache.delete(cacheKey);
3687
3799
  continue;
@@ -3689,25 +3801,25 @@ var Server = /*#__PURE__*/function () {
3689
3801
  try {
3690
3802
  var queryPayload = entry.queryPayload;
3691
3803
  var orderMap = new Map();
3692
- var _iterator10 = _createForOfIteratorHelper(entry.rawOrders),
3693
- _step10;
3804
+ var _iterator11 = _createForOfIteratorHelper(entry.rawOrders),
3805
+ _step11;
3694
3806
  try {
3695
- for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
3696
- var order = _step10.value;
3807
+ for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) {
3808
+ var order = _step11.value;
3697
3809
  var _key4 = this.toOrderIdKey(order);
3698
3810
  if (_key4) orderMap.set(_key4, order);
3699
3811
  }
3700
3812
  } catch (err) {
3701
- _iterator10.e(err);
3813
+ _iterator11.e(err);
3702
3814
  } finally {
3703
- _iterator10.f();
3815
+ _iterator11.f();
3704
3816
  }
3705
3817
  var changed = false;
3706
- var _iterator11 = _createForOfIteratorHelper(latestOrders),
3707
- _step11;
3818
+ var _iterator12 = _createForOfIteratorHelper(latestOrders),
3819
+ _step12;
3708
3820
  try {
3709
- for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) {
3710
- var latest = _step11.value;
3821
+ for (_iterator12.s(); !(_step12 = _iterator12.n()).done;) {
3822
+ var latest = _step12.value;
3711
3823
  var _key5 = this.toOrderIdKey(latest);
3712
3824
  if (!_key5) continue;
3713
3825
  if (orderMap.has(_key5)) {
@@ -3719,9 +3831,9 @@ var Server = /*#__PURE__*/function () {
3719
3831
  changed = true;
3720
3832
  }
3721
3833
  } catch (err) {
3722
- _iterator11.e(err);
3834
+ _iterator12.e(err);
3723
3835
  } finally {
3724
- _iterator11.f();
3836
+ _iterator12.f();
3725
3837
  }
3726
3838
  if (!changed) continue;
3727
3839
  var mergedOrders = _toConsumableArray(orderMap.values());
@@ -3754,9 +3866,9 @@ var Server = /*#__PURE__*/function () {
3754
3866
  }
3755
3867
  }
3756
3868
  } catch (err) {
3757
- _iterator9.e(err);
3869
+ _iterator10.e(err);
3758
3870
  } finally {
3759
- _iterator9.f();
3871
+ _iterator10.f();
3760
3872
  }
3761
3873
  var syncEndAt = Date.now();
3762
3874
  if (syncedEntryCount > 0) {
@@ -3774,18 +3886,18 @@ var Server = /*#__PURE__*/function () {
3774
3886
  }, {
3775
3887
  key: "fetchOrderListFromAPI",
3776
3888
  value: (function () {
3777
- var _fetchOrderListFromAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40(data) {
3778
- var _this$app9;
3779
- var _response$data5, response, _payload2, list, count, errorMessage;
3780
- return _regeneratorRuntime().wrap(function _callee40$(_context40) {
3781
- while (1) switch (_context40.prev = _context40.next) {
3889
+ var _fetchOrderListFromAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41(data) {
3890
+ var _this$app8;
3891
+ var _response$data4, response, _payload2, list, count, errorMessage;
3892
+ return _regeneratorRuntime().wrap(function _callee41$(_context41) {
3893
+ while (1) switch (_context41.prev = _context41.next) {
3782
3894
  case 0:
3783
- if ((_this$app9 = this.app) !== null && _this$app9 !== void 0 && _this$app9.request) {
3784
- _context40.next = 3;
3895
+ if ((_this$app8 = this.app) !== null && _this$app8 !== void 0 && _this$app8.request) {
3896
+ _context41.next = 3;
3785
3897
  break;
3786
3898
  }
3787
3899
  this.logError('fetchOrderListFromAPI: app.request 不可用');
3788
- return _context40.abrupt("return", {
3900
+ return _context41.abrupt("return", {
3789
3901
  code: 500,
3790
3902
  message: 'app.request 不可用',
3791
3903
  data: {
@@ -3795,17 +3907,17 @@ var Server = /*#__PURE__*/function () {
3795
3907
  status: false
3796
3908
  });
3797
3909
  case 3:
3798
- _context40.prev = 3;
3799
- _context40.next = 6;
3910
+ _context41.prev = 3;
3911
+ _context41.next = 6;
3800
3912
  return this.app.request.post('/shop/order/v2/list', data, {
3801
3913
  isShopApi: true
3802
3914
  });
3803
3915
  case 6:
3804
- response = _context40.sent;
3805
- _payload2 = (_response$data5 = response === null || response === void 0 ? void 0 : response.data) !== null && _response$data5 !== void 0 ? _response$data5 : response;
3916
+ response = _context41.sent;
3917
+ _payload2 = (_response$data4 = response === null || response === void 0 ? void 0 : response.data) !== null && _response$data4 !== void 0 ? _response$data4 : response;
3806
3918
  list = Array.isArray(_payload2 === null || _payload2 === void 0 ? void 0 : _payload2.list) ? _payload2.list : [];
3807
3919
  count = typeof (_payload2 === null || _payload2 === void 0 ? void 0 : _payload2.count) === 'number' ? _payload2.count : list.length;
3808
- return _context40.abrupt("return", {
3920
+ return _context41.abrupt("return", {
3809
3921
  code: 200,
3810
3922
  data: _objectSpread(_objectSpread({}, _payload2), {}, {
3811
3923
  list: list,
@@ -3815,13 +3927,13 @@ var Server = /*#__PURE__*/function () {
3815
3927
  status: true
3816
3928
  });
3817
3929
  case 13:
3818
- _context40.prev = 13;
3819
- _context40.t0 = _context40["catch"](3);
3820
- errorMessage = _context40.t0 instanceof Error ? _context40.t0.message : String(_context40.t0);
3930
+ _context41.prev = 13;
3931
+ _context41.t0 = _context41["catch"](3);
3932
+ errorMessage = _context41.t0 instanceof Error ? _context41.t0.message : String(_context41.t0);
3821
3933
  this.logError('fetchOrderListFromAPI: 请求失败', {
3822
3934
  error: errorMessage
3823
3935
  });
3824
- return _context40.abrupt("return", {
3936
+ return _context41.abrupt("return", {
3825
3937
  code: 500,
3826
3938
  message: errorMessage,
3827
3939
  data: {
@@ -3832,11 +3944,11 @@ var Server = /*#__PURE__*/function () {
3832
3944
  });
3833
3945
  case 18:
3834
3946
  case "end":
3835
- return _context40.stop();
3947
+ return _context41.stop();
3836
3948
  }
3837
- }, _callee40, this, [[3, 13]]);
3949
+ }, _callee41, this, [[3, 13]]);
3838
3950
  }));
3839
- function fetchOrderListFromAPI(_x43) {
3951
+ function fetchOrderListFromAPI(_x45) {
3840
3952
  return _fetchOrderListFromAPI.apply(this, arguments);
3841
3953
  }
3842
3954
  return fetchOrderListFromAPI;
@@ -3848,17 +3960,17 @@ var Server = /*#__PURE__*/function () {
3848
3960
  }, {
3849
3961
  key: "fetchBookingListFromAPI",
3850
3962
  value: (function () {
3851
- var _fetchBookingListFromAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41(data) {
3963
+ var _fetchBookingListFromAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42(data) {
3852
3964
  var memoryCacheEnabled, withFields, requestPayload, cacheKey, cached, rawList, bookingResult, _bookingResult$list, errorMessage;
3853
- return _regeneratorRuntime().wrap(function _callee41$(_context41) {
3854
- while (1) switch (_context41.prev = _context41.next) {
3965
+ return _regeneratorRuntime().wrap(function _callee42$(_context42) {
3966
+ while (1) switch (_context42.prev = _context42.next) {
3855
3967
  case 0:
3856
3968
  if (this.order) {
3857
- _context41.next = 3;
3969
+ _context42.next = 3;
3858
3970
  break;
3859
3971
  }
3860
3972
  this.logError('fetchBookingListFromAPI: Order 模块不可用');
3861
- return _context41.abrupt("return", {
3973
+ return _context42.abrupt("return", {
3862
3974
  code: 500,
3863
3975
  message: 'Order 模块不可用',
3864
3976
  data: {
@@ -3868,18 +3980,18 @@ var Server = /*#__PURE__*/function () {
3868
3980
  status: false
3869
3981
  });
3870
3982
  case 3:
3871
- _context41.prev = 3;
3983
+ _context42.prev = 3;
3872
3984
  memoryCacheEnabled = this.isBookingRemoteMemoryCacheEnabled(data);
3873
3985
  withFields = this.resolveBookingSalesWith(data);
3874
3986
  requestPayload = this.normalizeBookingRemoteQueryPayload(data, withFields);
3875
3987
  cacheKey = this.buildBookingRemoteCacheKey(requestPayload);
3876
3988
  if (!memoryCacheEnabled) {
3877
- _context41.next = 13;
3989
+ _context42.next = 13;
3878
3990
  break;
3879
3991
  }
3880
3992
  cached = this.readBookingRemoteCache(cacheKey);
3881
3993
  if (!cached) {
3882
- _context41.next = 13;
3994
+ _context42.next = 13;
3883
3995
  break;
3884
3996
  }
3885
3997
  this.logInfo('fetchBookingListFromAPI: 命中内存缓存', {
@@ -3887,14 +3999,14 @@ var Server = /*#__PURE__*/function () {
3887
3999
  listCount: cached.bookingResult.count,
3888
4000
  withFields: cached.withFields
3889
4001
  });
3890
- return _context41.abrupt("return", this.buildBookingResponse(cached.bookingResult, {
4002
+ return _context42.abrupt("return", this.buildBookingResponse(cached.bookingResult, {
3891
4003
  cache_hit: true
3892
4004
  }));
3893
4005
  case 13:
3894
- _context41.next = 15;
4006
+ _context42.next = 15;
3895
4007
  return this.order.fetchOrdersBySSE(requestPayload);
3896
4008
  case 15:
3897
- rawList = _context41.sent;
4009
+ rawList = _context42.sent;
3898
4010
  bookingResult = sortBookings(filterBookingsFromOrders(rawList, data), data); // DEBUG: 挂到 window 上方便排查 SSE → 日历数据丢失问题
3899
4011
  if (typeof globalThis !== 'undefined') {
3900
4012
  globalThis.__SSE_BOOKING_DEBUG__ = {
@@ -3941,15 +4053,15 @@ var Server = /*#__PURE__*/function () {
3941
4053
  cacheKey: cacheKey,
3942
4054
  withFields: withFields
3943
4055
  });
3944
- return _context41.abrupt("return", this.buildBookingResponse(bookingResult));
4056
+ return _context42.abrupt("return", this.buildBookingResponse(bookingResult));
3945
4057
  case 23:
3946
- _context41.prev = 23;
3947
- _context41.t0 = _context41["catch"](3);
3948
- errorMessage = _context41.t0 instanceof Error ? _context41.t0.message : String(_context41.t0);
4058
+ _context42.prev = 23;
4059
+ _context42.t0 = _context42["catch"](3);
4060
+ errorMessage = _context42.t0 instanceof Error ? _context42.t0.message : String(_context42.t0);
3949
4061
  this.logError('fetchBookingListFromAPI: SSE 请求失败', {
3950
4062
  error: errorMessage
3951
4063
  });
3952
- return _context41.abrupt("return", {
4064
+ return _context42.abrupt("return", {
3953
4065
  code: 500,
3954
4066
  message: errorMessage,
3955
4067
  data: {
@@ -3960,11 +4072,11 @@ var Server = /*#__PURE__*/function () {
3960
4072
  });
3961
4073
  case 28:
3962
4074
  case "end":
3963
- return _context41.stop();
4075
+ return _context42.stop();
3964
4076
  }
3965
- }, _callee41, this, [[3, 23]]);
4077
+ }, _callee42, this, [[3, 23]]);
3966
4078
  }));
3967
- function fetchBookingListFromAPI(_x44) {
4079
+ function fetchBookingListFromAPI(_x46) {
3968
4080
  return _fetchBookingListFromAPI.apply(this, arguments);
3969
4081
  }
3970
4082
  return fetchBookingListFromAPI;
@@ -3972,24 +4084,24 @@ var Server = /*#__PURE__*/function () {
3972
4084
  }, {
3973
4085
  key: "getDeviceTaskPlugin",
3974
4086
  value: function getDeviceTaskPlugin() {
3975
- var _this$app10, _this$app10$getPlugin;
3976
- return ((_this$app10 = this.app) === null || _this$app10 === void 0 || (_this$app10$getPlugin = _this$app10.getPlugin) === null || _this$app10$getPlugin === void 0 ? void 0 : _this$app10$getPlugin.call(_this$app10, 'deviceTask')) || null;
4087
+ var _this$app9, _this$app9$getPlugin;
4088
+ return ((_this$app9 = this.app) === null || _this$app9 === void 0 || (_this$app9$getPlugin = _this$app9.getPlugin) === null || _this$app9$getPlugin === void 0 ? void 0 : _this$app9$getPlugin.call(_this$app9, 'deviceTask')) || null;
3977
4089
  }
3978
4090
  }, {
3979
4091
  key: "getIdGeneratorPlugin",
3980
4092
  value: function getIdGeneratorPlugin() {
3981
- var _this$app11, _this$app11$getPlugin;
3982
- return ((_this$app11 = this.app) === null || _this$app11 === void 0 || (_this$app11$getPlugin = _this$app11.getPlugin) === null || _this$app11$getPlugin === void 0 ? void 0 : _this$app11$getPlugin.call(_this$app11, 'idGenerator')) || null;
4093
+ var _this$app10, _this$app10$getPlugin;
4094
+ return ((_this$app10 = this.app) === null || _this$app10 === void 0 || (_this$app10$getPlugin = _this$app10.getPlugin) === null || _this$app10$getPlugin === void 0 ? void 0 : _this$app10$getPlugin.call(_this$app10, 'idGenerator')) || null;
3983
4095
  }
3984
4096
  }, {
3985
4097
  key: "getAppData",
3986
4098
  value: function getAppData(key) {
3987
- var _this$core$getPlugin, _this$core$getPlugin$, _this$app12, _this$app12$getData, _this$app13, _this$app13$getStore, _this$app13$getStore$, _this$app13$getStore$2, _this$app14, _this$app14$getStore, _this$app14$getStore$, _this$app14$getStore$2, _this$app15, _this$app15$getStore, _this$app15$getStore$, _this$app15$getStore$2;
4099
+ var _this$core$getPlugin, _this$core$getPlugin$, _this$app11, _this$app11$getData, _this$app12, _this$app12$getStore, _this$app12$getStore$, _this$app12$getStore$2, _this$app13, _this$app13$getStore, _this$app13$getStore$, _this$app13$getStore$2, _this$app14, _this$app14$getStore, _this$app14$getStore$, _this$app14$getStore$2;
3988
4100
  var getData = (_this$core$getPlugin = this.core.getPlugin('app')) === null || _this$core$getPlugin === void 0 || (_this$core$getPlugin$ = _this$core$getPlugin.getData) === null || _this$core$getPlugin$ === void 0 ? void 0 : _this$core$getPlugin$.call(_this$core$getPlugin);
3989
4101
  if (typeof getData === 'function') return getData(key);
3990
- var directValue = (_this$app12 = this.app) === null || _this$app12 === void 0 || (_this$app12$getData = _this$app12.getData) === null || _this$app12$getData === void 0 ? void 0 : _this$app12$getData.call(_this$app12, key);
4102
+ var directValue = (_this$app11 = this.app) === null || _this$app11 === void 0 || (_this$app11$getData = _this$app11.getData) === null || _this$app11$getData === void 0 ? void 0 : _this$app11$getData.call(_this$app11, key);
3991
4103
  if (directValue !== undefined) return directValue;
3992
- var coreData = ((_this$app13 = this.app) === null || _this$app13 === void 0 || (_this$app13 = _this$app13.models) === null || _this$app13 === void 0 || (_this$app13$getStore = _this$app13.getStore) === null || _this$app13$getStore === void 0 || (_this$app13$getStore$ = (_this$app13$getStore$2 = _this$app13$getStore.call(_this$app13)).getDataByModel) === null || _this$app13$getStore$ === void 0 ? void 0 : _this$app13$getStore$.call(_this$app13$getStore$2, 'core', 'core')) || ((_this$app14 = this.app) === null || _this$app14 === void 0 || (_this$app14 = _this$app14.data) === null || _this$app14 === void 0 || (_this$app14 = _this$app14.store) === null || _this$app14 === void 0 || (_this$app14$getStore = _this$app14.getStore) === null || _this$app14$getStore === void 0 || (_this$app14$getStore$ = (_this$app14$getStore$2 = _this$app14$getStore.call(_this$app14)).getDataByModel) === null || _this$app14$getStore$ === void 0 ? void 0 : _this$app14$getStore$.call(_this$app14$getStore$2, 'core', 'core')) || ((_this$app15 = this.app) === null || _this$app15 === void 0 || (_this$app15 = _this$app15.data) === null || _this$app15 === void 0 || (_this$app15 = _this$app15.store) === null || _this$app15 === void 0 || (_this$app15$getStore = _this$app15.getStore) === null || _this$app15$getStore === void 0 || (_this$app15$getStore$ = (_this$app15$getStore$2 = _this$app15$getStore.call(_this$app15)).getDataByModel) === null || _this$app15$getStore$ === void 0 || (_this$app15$getStore$ = _this$app15$getStore$.call(_this$app15$getStore$2, 'core')) === null || _this$app15$getStore$ === void 0 ? void 0 : _this$app15$getStore$.core);
4104
+ var coreData = ((_this$app12 = this.app) === null || _this$app12 === void 0 || (_this$app12 = _this$app12.models) === null || _this$app12 === void 0 || (_this$app12$getStore = _this$app12.getStore) === null || _this$app12$getStore === void 0 || (_this$app12$getStore$ = (_this$app12$getStore$2 = _this$app12$getStore.call(_this$app12)).getDataByModel) === null || _this$app12$getStore$ === void 0 ? void 0 : _this$app12$getStore$.call(_this$app12$getStore$2, 'core', 'core')) || ((_this$app13 = this.app) === null || _this$app13 === void 0 || (_this$app13 = _this$app13.data) === null || _this$app13 === void 0 || (_this$app13 = _this$app13.store) === null || _this$app13 === void 0 || (_this$app13$getStore = _this$app13.getStore) === null || _this$app13$getStore === void 0 || (_this$app13$getStore$ = (_this$app13$getStore$2 = _this$app13$getStore.call(_this$app13)).getDataByModel) === null || _this$app13$getStore$ === void 0 ? void 0 : _this$app13$getStore$.call(_this$app13$getStore$2, 'core', 'core')) || ((_this$app14 = this.app) === null || _this$app14 === void 0 || (_this$app14 = _this$app14.data) === null || _this$app14 === void 0 || (_this$app14 = _this$app14.store) === null || _this$app14 === void 0 || (_this$app14$getStore = _this$app14.getStore) === null || _this$app14$getStore === void 0 || (_this$app14$getStore$ = (_this$app14$getStore$2 = _this$app14$getStore.call(_this$app14)).getDataByModel) === null || _this$app14$getStore$ === void 0 || (_this$app14$getStore$ = _this$app14$getStore$.call(_this$app14$getStore$2, 'core')) === null || _this$app14$getStore$ === void 0 ? void 0 : _this$app14$getStore$.core);
3993
4105
  return coreData === null || coreData === void 0 ? void 0 : coreData[key];
3994
4106
  }
3995
4107
  }, {
@@ -4040,32 +4152,32 @@ var Server = /*#__PURE__*/function () {
4040
4152
  }, {
4041
4153
  key: "getShortNumberOrDeviceId",
4042
4154
  value: function () {
4043
- var _getShortNumberOrDeviceId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42() {
4155
+ var _getShortNumberOrDeviceId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43() {
4044
4156
  var getAsyncIotDeviceInfo, res;
4045
- return _regeneratorRuntime().wrap(function _callee42$(_context42) {
4046
- while (1) switch (_context42.prev = _context42.next) {
4157
+ return _regeneratorRuntime().wrap(function _callee43$(_context43) {
4158
+ while (1) switch (_context43.prev = _context43.next) {
4047
4159
  case 0:
4048
4160
  getAsyncIotDeviceInfo = this.getAppData('async_iot_device_info');
4049
4161
  if (!getAsyncIotDeviceInfo) {
4050
- _context42.next = 7;
4162
+ _context43.next = 7;
4051
4163
  break;
4052
4164
  }
4053
- _context42.next = 4;
4165
+ _context43.next = 4;
4054
4166
  return getAsyncIotDeviceInfo === null || getAsyncIotDeviceInfo === void 0 ? void 0 : getAsyncIotDeviceInfo();
4055
4167
  case 4:
4056
- res = _context42.sent;
4168
+ res = _context43.sent;
4057
4169
  if (!(res !== null && res !== void 0 && res.short_number)) {
4058
- _context42.next = 7;
4170
+ _context43.next = 7;
4059
4171
  break;
4060
4172
  }
4061
- return _context42.abrupt("return", res === null || res === void 0 ? void 0 : res.short_number);
4173
+ return _context43.abrupt("return", res === null || res === void 0 ? void 0 : res.short_number);
4062
4174
  case 7:
4063
- return _context42.abrupt("return", String(this.getAppData('device_id') || 0).slice(-2));
4175
+ return _context43.abrupt("return", String(this.getAppData('device_id') || 0).slice(-2));
4064
4176
  case 8:
4065
4177
  case "end":
4066
- return _context42.stop();
4178
+ return _context43.stop();
4067
4179
  }
4068
- }, _callee42, this);
4180
+ }, _callee43, this);
4069
4181
  }));
4070
4182
  function getShortNumberOrDeviceId() {
4071
4183
  return _getShortNumberOrDeviceId.apply(this, arguments);
@@ -4092,16 +4204,16 @@ var Server = /*#__PURE__*/function () {
4092
4204
  }, {
4093
4205
  key: "normalizeCheckoutSubmitData",
4094
4206
  value: function () {
4095
- var _normalizeCheckoutSubmitData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(data, title) {
4207
+ var _normalizeCheckoutSubmitData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(data, title) {
4096
4208
  var next, externalSaleNumber, shouldClearLocalOrderId, hasCheckoutOrderNumbers, localOrder;
4097
- return _regeneratorRuntime().wrap(function _callee43$(_context43) {
4098
- while (1) switch (_context43.prev = _context43.next) {
4209
+ return _regeneratorRuntime().wrap(function _callee44$(_context44) {
4210
+ while (1) switch (_context44.prev = _context44.next) {
4099
4211
  case 0:
4100
4212
  if (!(!data || _typeof(data) !== 'object')) {
4101
- _context43.next = 2;
4213
+ _context44.next = 2;
4102
4214
  break;
4103
4215
  }
4104
- return _context43.abrupt("return", data);
4216
+ return _context44.abrupt("return", data);
4105
4217
  case 2:
4106
4218
  next = _objectSpread({}, data);
4107
4219
  externalSaleNumber = next.external_sale_number;
@@ -4111,7 +4223,7 @@ var Server = /*#__PURE__*/function () {
4111
4223
  delete next.vouchers;
4112
4224
  hasCheckoutOrderNumbers = !this.isBlankCheckoutValue(next.shop_order_number) && !this.isBlankCheckoutValue(next.shop_full_order_number);
4113
4225
  if (!hasCheckoutOrderNumbers) {
4114
- _context43.next = 11;
4226
+ _context44.next = 11;
4115
4227
  break;
4116
4228
  }
4117
4229
  this.logInfo("".concat(title, ": checkout \u5DF2\u643A\u5E26\u8BA2\u5355\u53F7\uFF0C\u8DF3\u8FC7\u67E5\u91CD"), {
@@ -4121,10 +4233,10 @@ var Server = /*#__PURE__*/function () {
4121
4233
  shop_order_number: next.shop_order_number,
4122
4234
  shop_full_order_number: next.shop_full_order_number
4123
4235
  });
4124
- return _context43.abrupt("return", next);
4236
+ return _context44.abrupt("return", next);
4125
4237
  case 11:
4126
4238
  if (!this.isBlankCheckoutValue(externalSaleNumber)) {
4127
- _context43.next = 14;
4239
+ _context44.next = 14;
4128
4240
  break;
4129
4241
  }
4130
4242
  if (shouldClearLocalOrderId) {
@@ -4133,10 +4245,10 @@ var Server = /*#__PURE__*/function () {
4133
4245
  order_id: next.order_id
4134
4246
  });
4135
4247
  }
4136
- return _context43.abrupt("return", next);
4248
+ return _context44.abrupt("return", next);
4137
4249
  case 14:
4138
4250
  if (!(!this.order || typeof this.order.getLocalOrderFromMemoryByLookup !== 'function')) {
4139
- _context43.next = 17;
4251
+ _context44.next = 17;
4140
4252
  break;
4141
4253
  }
4142
4254
  if (shouldClearLocalOrderId) {
@@ -4145,12 +4257,12 @@ var Server = /*#__PURE__*/function () {
4145
4257
  external_sale_number: externalSaleNumber
4146
4258
  });
4147
4259
  }
4148
- return _context43.abrupt("return", next);
4260
+ return _context44.abrupt("return", next);
4149
4261
  case 17:
4150
- _context43.prev = 17;
4262
+ _context44.prev = 17;
4151
4263
  localOrder = this.order.getLocalOrderFromMemoryByLookup(externalSaleNumber);
4152
4264
  if (localOrder) {
4153
- _context43.next = 22;
4265
+ _context44.next = 22;
4154
4266
  break;
4155
4267
  }
4156
4268
  if (shouldClearLocalOrderId) {
@@ -4160,7 +4272,7 @@ var Server = /*#__PURE__*/function () {
4160
4272
  localOrderFound: false
4161
4273
  });
4162
4274
  }
4163
- return _context43.abrupt("return", next);
4275
+ return _context44.abrupt("return", next);
4164
4276
  case 22:
4165
4277
  if (this.isBlankCheckoutValue(next.shop_order_number)) {
4166
4278
  next.shop_order_number = localOrder.shop_order_number;
@@ -4177,23 +4289,23 @@ var Server = /*#__PURE__*/function () {
4177
4289
  shop_full_order_number: next.shop_full_order_number
4178
4290
  });
4179
4291
  // 删除 数据体中的 vouchers,对小票和后端来说他们不需要,这个字段只是单向同步给前端用的,而且目前对订单来说还没什么用
4180
- return _context43.abrupt("return", next);
4292
+ return _context44.abrupt("return", next);
4181
4293
  case 28:
4182
- _context43.prev = 28;
4183
- _context43.t0 = _context43["catch"](17);
4294
+ _context44.prev = 28;
4295
+ _context44.t0 = _context44["catch"](17);
4184
4296
  this.logWarning("".concat(title, ": checkout \u67E5\u627E\u672C\u5730\u8BA2\u5355\u5931\u8D25"), {
4185
4297
  external_sale_number: externalSaleNumber,
4186
- error: this.getUnknownErrorMessage(_context43.t0),
4187
- error_detail: this.normalizeUnknownError(_context43.t0)
4298
+ error: this.getUnknownErrorMessage(_context44.t0),
4299
+ error_detail: this.normalizeUnknownError(_context44.t0)
4188
4300
  });
4189
- return _context43.abrupt("return", next);
4301
+ return _context44.abrupt("return", next);
4190
4302
  case 32:
4191
4303
  case "end":
4192
- return _context43.stop();
4304
+ return _context44.stop();
4193
4305
  }
4194
- }, _callee43, this, [[17, 28]]);
4306
+ }, _callee44, this, [[17, 28]]);
4195
4307
  }));
4196
- function normalizeCheckoutSubmitData(_x45, _x46) {
4308
+ function normalizeCheckoutSubmitData(_x47, _x48) {
4197
4309
  return _normalizeCheckoutSubmitData.apply(this, arguments);
4198
4310
  }
4199
4311
  return normalizeCheckoutSubmitData;
@@ -4201,81 +4313,81 @@ var Server = /*#__PURE__*/function () {
4201
4313
  }, {
4202
4314
  key: "ensureCheckoutOrderNumbers",
4203
4315
  value: function () {
4204
- var _ensureCheckoutOrderNumbers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(data, title) {
4316
+ var _ensureCheckoutOrderNumbers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45(data, title) {
4205
4317
  var next, needsShopOrderNumber, needsShopFullOrderNumber, idGenerator;
4206
- return _regeneratorRuntime().wrap(function _callee44$(_context44) {
4207
- while (1) switch (_context44.prev = _context44.next) {
4318
+ return _regeneratorRuntime().wrap(function _callee45$(_context45) {
4319
+ while (1) switch (_context45.prev = _context45.next) {
4208
4320
  case 0:
4209
4321
  if (!(!data || _typeof(data) !== 'object')) {
4210
- _context44.next = 2;
4322
+ _context45.next = 2;
4211
4323
  break;
4212
4324
  }
4213
- return _context44.abrupt("return", data);
4325
+ return _context45.abrupt("return", data);
4214
4326
  case 2:
4215
4327
  next = _objectSpread({}, data);
4216
4328
  needsShopOrderNumber = next.shop_order_number === undefined || next.shop_order_number === null || next.shop_order_number === '';
4217
4329
  needsShopFullOrderNumber = next.shop_full_order_number === undefined || next.shop_full_order_number === null || next.shop_full_order_number === '';
4218
4330
  if (!(!needsShopOrderNumber && !needsShopFullOrderNumber)) {
4219
- _context44.next = 7;
4331
+ _context45.next = 7;
4220
4332
  break;
4221
4333
  }
4222
- return _context44.abrupt("return", next);
4334
+ return _context45.abrupt("return", next);
4223
4335
  case 7:
4224
4336
  idGenerator = this.getIdGeneratorPlugin();
4225
4337
  if (idGenerator) {
4226
- _context44.next = 11;
4338
+ _context45.next = 11;
4227
4339
  break;
4228
4340
  }
4229
4341
  this.logWarning("".concat(title, ": idGenerator \u63D2\u4EF6\u4E0D\u53EF\u7528\uFF0C\u65E0\u6CD5\u751F\u6210\u8BA2\u5355\u53F7"), {
4230
4342
  needsShopOrderNumber: needsShopOrderNumber,
4231
4343
  needsShopFullOrderNumber: needsShopFullOrderNumber
4232
4344
  });
4233
- return _context44.abrupt("return", next);
4345
+ return _context45.abrupt("return", next);
4234
4346
  case 11:
4235
- _context44.prev = 11;
4347
+ _context45.prev = 11;
4236
4348
  if (!(needsShopOrderNumber && idGenerator.generateShopOrderNumber)) {
4237
- _context44.next = 16;
4349
+ _context45.next = 16;
4238
4350
  break;
4239
4351
  }
4240
- _context44.next = 15;
4352
+ _context45.next = 15;
4241
4353
  return idGenerator.generateShopOrderNumber({
4242
4354
  biz: next.business_code || 'ticket'
4243
4355
  });
4244
4356
  case 15:
4245
- next.shop_order_number = _context44.sent;
4357
+ next.shop_order_number = _context45.sent;
4246
4358
  case 16:
4247
4359
  if (!(needsShopFullOrderNumber && idGenerator.generateReceiptId)) {
4248
- _context44.next = 20;
4360
+ _context45.next = 20;
4249
4361
  break;
4250
4362
  }
4251
- _context44.next = 19;
4363
+ _context45.next = 19;
4252
4364
  return idGenerator.generateReceiptId({
4253
4365
  biz: next.business_code || 'ticket'
4254
4366
  });
4255
4367
  case 19:
4256
- next.shop_full_order_number = _context44.sent;
4368
+ next.shop_full_order_number = _context45.sent;
4257
4369
  case 20:
4258
4370
  this.logInfo("".concat(title, ": checkout \u8BA2\u5355\u53F7\u5DF2\u51C6\u5907"), {
4259
4371
  shop_order_number: next.shop_order_number,
4260
4372
  shop_full_order_number: next.shop_full_order_number
4261
4373
  });
4262
- _context44.next = 26;
4374
+ _context45.next = 26;
4263
4375
  break;
4264
4376
  case 23:
4265
- _context44.prev = 23;
4266
- _context44.t0 = _context44["catch"](11);
4377
+ _context45.prev = 23;
4378
+ _context45.t0 = _context45["catch"](11);
4267
4379
  this.logError("".concat(title, ": \u751F\u6210 checkout \u8BA2\u5355\u53F7\u5931\u8D25"), {
4268
- error: _context44.t0 instanceof Error ? _context44.t0.message : String(_context44.t0)
4380
+ error: _context45.t0 instanceof Error ? _context45.t0.message : String(_context45.t0)
4269
4381
  });
4270
4382
  case 26:
4271
- return _context44.abrupt("return", next);
4383
+ return _context45.abrupt("return", next);
4272
4384
  case 27:
4273
4385
  case "end":
4274
- return _context44.stop();
4386
+ return _context45.stop();
4275
4387
  }
4276
- }, _callee44, this, [[11, 23]]);
4388
+ }, _callee45, this, [[11, 23]]);
4277
4389
  }));
4278
- function ensureCheckoutOrderNumbers(_x47, _x48) {
4390
+ function ensureCheckoutOrderNumbers(_x49, _x50) {
4279
4391
  return _ensureCheckoutOrderNumbers.apply(this, arguments);
4280
4392
  }
4281
4393
  return ensureCheckoutOrderNumbers;
@@ -4283,27 +4395,27 @@ var Server = /*#__PURE__*/function () {
4283
4395
  }, {
4284
4396
  key: "dispatchCheckoutSyncTask",
4285
4397
  value: function () {
4286
- var _dispatchCheckoutSyncTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45(params) {
4398
+ var _dispatchCheckoutSyncTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46(params) {
4287
4399
  var deviceTask, debugDeviceId, debugIdempotencyKey, _params$data, _params$data2, _params$data3, _params$data4, result;
4288
- return _regeneratorRuntime().wrap(function _callee45$(_context45) {
4289
- while (1) switch (_context45.prev = _context45.next) {
4400
+ return _regeneratorRuntime().wrap(function _callee46$(_context46) {
4401
+ while (1) switch (_context46.prev = _context46.next) {
4290
4402
  case 0:
4291
4403
  this.registerDeviceTaskActions();
4292
4404
  deviceTask = this.getDeviceTaskPlugin();
4293
- _context45.next = 4;
4405
+ _context46.next = 4;
4294
4406
  return this.getShortNumberOrDeviceId();
4295
4407
  case 4:
4296
- debugDeviceId = _context45.sent;
4408
+ debugDeviceId = _context46.sent;
4297
4409
  debugIdempotencyKey = this.buildCheckoutTaskIdempotencyKey(params.data);
4298
4410
  if (deviceTask !== null && deviceTask !== void 0 && deviceTask.dispatch) {
4299
- _context45.next = 9;
4411
+ _context46.next = 9;
4300
4412
  break;
4301
4413
  }
4302
4414
  this.logError("".concat(params.title, ": deviceTask.dispatch \u4E0D\u53EF\u7528"));
4303
- return _context45.abrupt("return");
4415
+ return _context46.abrupt("return");
4304
4416
  case 9:
4305
- _context45.prev = 9;
4306
- _context45.next = 12;
4417
+ _context46.prev = 9;
4418
+ _context46.next = 12;
4307
4419
  return deviceTask.dispatch({
4308
4420
  action: 'sync_sales',
4309
4421
  device_id: debugDeviceId,
@@ -4321,27 +4433,27 @@ var Server = /*#__PURE__*/function () {
4321
4433
  source_id: ((_params$data2 = params.data) === null || _params$data2 === void 0 ? void 0 : _params$data2.order_id) || ((_params$data3 = params.data) === null || _params$data3 === void 0 ? void 0 : _params$data3.external_sale_number) || ((_params$data4 = params.data) === null || _params$data4 === void 0 ? void 0 : _params$data4.shop_order_number)
4322
4434
  });
4323
4435
  case 12:
4324
- result = _context45.sent;
4436
+ result = _context46.sent;
4325
4437
  this.logInfo("".concat(params.title, ": sync_sales \u4EFB\u52A1\u5DF2\u6D3E\u53D1"), {
4326
4438
  uuid: result === null || result === void 0 ? void 0 : result.uuid,
4327
4439
  status: result === null || result === void 0 ? void 0 : result.status,
4328
4440
  reused: result === null || result === void 0 ? void 0 : result.reused
4329
4441
  });
4330
- _context45.next = 19;
4442
+ _context46.next = 19;
4331
4443
  break;
4332
4444
  case 16:
4333
- _context45.prev = 16;
4334
- _context45.t0 = _context45["catch"](9);
4445
+ _context46.prev = 16;
4446
+ _context46.t0 = _context46["catch"](9);
4335
4447
  this.logError("".concat(params.title, ": \u6D3E\u53D1 sync_sales \u4EFB\u52A1\u5931\u8D25"), {
4336
- error: _context45.t0 instanceof Error ? _context45.t0.message : String(_context45.t0)
4448
+ error: _context46.t0 instanceof Error ? _context46.t0.message : String(_context46.t0)
4337
4449
  });
4338
4450
  case 19:
4339
4451
  case "end":
4340
- return _context45.stop();
4452
+ return _context46.stop();
4341
4453
  }
4342
- }, _callee45, this, [[9, 16]]);
4454
+ }, _callee46, this, [[9, 16]]);
4343
4455
  }));
4344
- function dispatchCheckoutSyncTask(_x49) {
4456
+ function dispatchCheckoutSyncTask(_x51) {
4345
4457
  return _dispatchCheckoutSyncTask.apply(this, arguments);
4346
4458
  }
4347
4459
  return dispatchCheckoutSyncTask;
@@ -4349,36 +4461,34 @@ var Server = /*#__PURE__*/function () {
4349
4461
  }, {
4350
4462
  key: "dispatchPrintOtherReceiptTask",
4351
4463
  value: function () {
4352
- var _dispatchPrintOtherReceiptTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46(params) {
4464
+ var _dispatchPrintOtherReceiptTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee47(params) {
4353
4465
  var deviceTask, _params$deviceId, _params$syncedOrder, _params$syncedOrder2, _params$syncedOrder3, printIdentity, deviceId;
4354
- return _regeneratorRuntime().wrap(function _callee46$(_context46) {
4355
- while (1) switch (_context46.prev = _context46.next) {
4466
+ return _regeneratorRuntime().wrap(function _callee47$(_context47) {
4467
+ while (1) switch (_context47.prev = _context47.next) {
4356
4468
  case 0:
4357
4469
  deviceTask = this.getDeviceTaskPlugin();
4358
4470
  if (deviceTask !== null && deviceTask !== void 0 && deviceTask.dispatch) {
4359
- _context46.next = 4;
4471
+ _context47.next = 4;
4360
4472
  break;
4361
4473
  }
4362
4474
  this.logWarning('dispatchPrintOtherReceiptTask: deviceTask.dispatch 不可用');
4363
- return _context46.abrupt("return");
4475
+ return _context47.abrupt("return");
4364
4476
  case 4:
4365
- _context46.prev = 4;
4477
+ _context47.prev = 4;
4366
4478
  printIdentity = this.getPrintOrderIdentity(params.syncedOrder);
4367
- _context46.next = 8;
4479
+ _context47.next = 8;
4368
4480
  return this.getShortNumberOrDeviceId();
4369
4481
  case 8:
4370
- deviceId = _context46.sent;
4371
- _context46.next = 11;
4482
+ deviceId = _context47.sent;
4483
+ _context47.next = 11;
4372
4484
  return deviceTask.dispatch({
4373
4485
  action: 'print_all',
4374
4486
  device_id: (_params$deviceId = params.deviceId) !== null && _params$deviceId !== void 0 ? _params$deviceId : deviceId,
4375
4487
  payload: {
4376
- type: params.isManualPrint ? '0' : '99',
4488
+ type: params.receiptOnly ? '0' : '99',
4377
4489
  data: params.receiptOnly ? {
4378
4490
  order_id: printIdentity,
4379
- small_ticket_data: (_params$syncedOrder = params.syncedOrder) === null || _params$syncedOrder === void 0 || (_params$syncedOrder = _params$syncedOrder.payment_info) === null || _params$syncedOrder === void 0 ? void 0 : _params$syncedOrder.small_ticket_data,
4380
- skip_wristband: true,
4381
- skip_voucher: true
4491
+ small_ticket_data: (_params$syncedOrder = params.syncedOrder) === null || _params$syncedOrder === void 0 || (_params$syncedOrder = _params$syncedOrder.payment_info) === null || _params$syncedOrder === void 0 ? void 0 : _params$syncedOrder.small_ticket_data
4382
4492
  } : {
4383
4493
  order_id: printIdentity,
4384
4494
  machine_code_print_info: (_params$syncedOrder2 = params.syncedOrder) === null || _params$syncedOrder2 === void 0 || (_params$syncedOrder2 = _params$syncedOrder2.payment_info) === null || _params$syncedOrder2 === void 0 ? void 0 : _params$syncedOrder2.machine_code_print_info,
@@ -4389,27 +4499,27 @@ var Server = /*#__PURE__*/function () {
4389
4499
  idempotency_key: this.buildPrintOtherReceiptIdempotencyKey(params.syncedOrder, {
4390
4500
  receiptOnly: params.receiptOnly
4391
4501
  }),
4392
- name: 'PRINT_V1',
4502
+ name: '打印转发',
4393
4503
  source: 'server',
4394
4504
  source_type: 'order',
4395
4505
  source_id: printIdentity
4396
4506
  });
4397
4507
  case 11:
4398
- _context46.next = 16;
4508
+ _context47.next = 16;
4399
4509
  break;
4400
4510
  case 13:
4401
- _context46.prev = 13;
4402
- _context46.t0 = _context46["catch"](4);
4511
+ _context47.prev = 13;
4512
+ _context47.t0 = _context47["catch"](4);
4403
4513
  this.logError('dispatchPrintOtherReceiptTask: 派发失败', {
4404
- error: _context46.t0 instanceof Error ? _context46.t0.message : String(_context46.t0)
4514
+ error: _context47.t0 instanceof Error ? _context47.t0.message : String(_context47.t0)
4405
4515
  });
4406
4516
  case 16:
4407
4517
  case "end":
4408
- return _context46.stop();
4518
+ return _context47.stop();
4409
4519
  }
4410
- }, _callee46, this, [[4, 13]]);
4520
+ }, _callee47, this, [[4, 13]]);
4411
4521
  }));
4412
- function dispatchPrintOtherReceiptTask(_x50) {
4522
+ function dispatchPrintOtherReceiptTask(_x52) {
4413
4523
  return _dispatchPrintOtherReceiptTask.apply(this, arguments);
4414
4524
  }
4415
4525
  return dispatchPrintOtherReceiptTask;
@@ -4429,32 +4539,32 @@ var Server = /*#__PURE__*/function () {
4429
4539
  }, {
4430
4540
  key: "dispatchLocalReceiptPrint",
4431
4541
  value: function () {
4432
- var _dispatchLocalReceiptPrint = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee47(params) {
4542
+ var _dispatchLocalReceiptPrint = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee48(params) {
4433
4543
  var _payment_info;
4434
4544
  var printableOrder;
4435
- return _regeneratorRuntime().wrap(function _callee47$(_context47) {
4436
- while (1) switch (_context47.prev = _context47.next) {
4545
+ return _regeneratorRuntime().wrap(function _callee48$(_context48) {
4546
+ while (1) switch (_context48.prev = _context48.next) {
4437
4547
  case 0:
4438
4548
  if (!(params.requireFullyPaid && !this.isSalesOrderFullyPaid(params.order))) {
4439
- _context47.next = 2;
4549
+ _context48.next = 2;
4440
4550
  break;
4441
4551
  }
4442
- return _context47.abrupt("return", {
4552
+ return _context48.abrupt("return", {
4443
4553
  printed: false,
4444
4554
  order: params.order
4445
4555
  });
4446
4556
  case 2:
4447
- _context47.next = 4;
4557
+ _context48.next = 4;
4448
4558
  return this.withLocalSmallTicketData(params.order, {
4449
4559
  requireFullyPaid: params.requireFullyPaid
4450
4560
  });
4451
4561
  case 4:
4452
- printableOrder = _context47.sent;
4562
+ printableOrder = _context48.sent;
4453
4563
  if (hasSmallTicketData((_payment_info = printableOrder.payment_info) === null || _payment_info === void 0 ? void 0 : _payment_info.small_ticket_data)) {
4454
- _context47.next = 7;
4564
+ _context48.next = 7;
4455
4565
  break;
4456
4566
  }
4457
- return _context47.abrupt("return", {
4567
+ return _context48.abrupt("return", {
4458
4568
  printed: false,
4459
4569
  order: printableOrder
4460
4570
  });
@@ -4464,26 +4574,25 @@ var Server = /*#__PURE__*/function () {
4464
4574
  printableOrder: printableOrder,
4465
4575
  response: params.response
4466
4576
  });
4467
- _context47.next = 10;
4577
+ _context48.next = 10;
4468
4578
  return this.dispatchPrintOtherReceiptTask({
4469
4579
  checkoutData: params.checkoutData,
4470
4580
  syncedOrder: printableOrder,
4471
4581
  response: params.response,
4472
- receiptOnly: true,
4473
- isManualPrint: params.isManualPrint
4582
+ receiptOnly: true
4474
4583
  });
4475
4584
  case 10:
4476
- return _context47.abrupt("return", {
4585
+ return _context48.abrupt("return", {
4477
4586
  printed: true,
4478
4587
  order: printableOrder
4479
4588
  });
4480
4589
  case 11:
4481
4590
  case "end":
4482
- return _context47.stop();
4591
+ return _context48.stop();
4483
4592
  }
4484
- }, _callee47, this);
4593
+ }, _callee48, this);
4485
4594
  }));
4486
- function dispatchLocalReceiptPrint(_x51) {
4595
+ function dispatchLocalReceiptPrint(_x53) {
4487
4596
  return _dispatchLocalReceiptPrint.apply(this, arguments);
4488
4597
  }
4489
4598
  return dispatchLocalReceiptPrint;
@@ -4507,146 +4616,6 @@ var Server = /*#__PURE__*/function () {
4507
4616
  }
4508
4617
  return undefined;
4509
4618
  }
4510
- }, {
4511
- key: "resolveMachinecodeBatchMetadataLookup",
4512
- value: function resolveMachinecodeBatchMetadataLookup(data) {
4513
- var candidates = [data === null || data === void 0 ? void 0 : data.order_lookup, data === null || data === void 0 ? void 0 : data.orderLookup, data === null || data === void 0 ? void 0 : data.external_sale_number, data === null || data === void 0 ? void 0 : data.externalSaleNumber, data === null || data === void 0 ? void 0 : data.order_id, data === null || data === void 0 ? void 0 : data.orderId, data === null || data === void 0 ? void 0 : data.order_number, data === null || data === void 0 ? void 0 : data.orderNumber, data === null || data === void 0 ? void 0 : data.shop_order_number, data === null || data === void 0 ? void 0 : data.shopOrderNumber, data === null || data === void 0 ? void 0 : data.shop_full_order_number, data === null || data === void 0 ? void 0 : data.shopFullOrderNumber];
4514
- return candidates.find(function (candidate) {
4515
- return candidate !== undefined && candidate !== null && candidate !== '';
4516
- });
4517
- }
4518
- }, {
4519
- key: "syncMachinecodeRedeemStatusToLocalOrder",
4520
- value: function () {
4521
- var _syncMachinecodeRedeemStatusToLocalOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee48(data, ids, status) {
4522
- var _this$order3;
4523
- var title, lookup, localOrder, voucherIdSet, vouchers, hasUpdatedVoucher, nextVouchers;
4524
- return _regeneratorRuntime().wrap(function _callee48$(_context48) {
4525
- while (1) switch (_context48.prev = _context48.next) {
4526
- case 0:
4527
- title = 'handleMachinecodeBatchMetadata';
4528
- lookup = this.resolveMachinecodeBatchMetadataLookup(data);
4529
- if (!(lookup === undefined)) {
4530
- _context48.next = 5;
4531
- break;
4532
- }
4533
- this.logWarning("".concat(title, ": order lookup \u7F3A\u5931\uFF0C\u8DF3\u8FC7\u672C\u5730\u8BA2\u5355\u6838\u9500\u72B6\u6001\u66F4\u65B0"), {
4534
- batchSize: ids.length,
4535
- status: status
4536
- });
4537
- return _context48.abrupt("return");
4538
- case 5:
4539
- if ((_this$order3 = this.order) !== null && _this$order3 !== void 0 && _this$order3.getLocalOrderByLookup) {
4540
- _context48.next = 8;
4541
- break;
4542
- }
4543
- this.logWarning("".concat(title, ": Order \u6A21\u5757\u672A\u6CE8\u518C\uFF0C\u8DF3\u8FC7\u672C\u5730\u8BA2\u5355\u6838\u9500\u72B6\u6001\u66F4\u65B0"), {
4544
- lookup: lookup,
4545
- status: status
4546
- });
4547
- return _context48.abrupt("return");
4548
- case 8:
4549
- _context48.next = 10;
4550
- return this.order.getLocalOrderByLookup(lookup);
4551
- case 10:
4552
- localOrder = _context48.sent;
4553
- if (localOrder) {
4554
- _context48.next = 14;
4555
- break;
4556
- }
4557
- this.logWarning("".concat(title, ": \u672C\u5730\u8BA2\u5355\u4E0D\u5B58\u5728\uFF0C\u8DF3\u8FC7\u6838\u9500\u72B6\u6001\u66F4\u65B0"), {
4558
- lookup: lookup,
4559
- status: status
4560
- });
4561
- return _context48.abrupt("return");
4562
- case 14:
4563
- voucherIdSet = new Set(ids.filter(function (id) {
4564
- return id !== undefined && id !== null && id !== '';
4565
- }).map(function (id) {
4566
- return String(id);
4567
- }));
4568
- if (!(voucherIdSet.size === 0)) {
4569
- _context48.next = 18;
4570
- break;
4571
- }
4572
- this.logWarning("".concat(title, ": voucher ids \u7F3A\u5931\uFF0C\u8DF3\u8FC7\u672C\u5730\u8BA2\u5355\u6838\u9500\u72B6\u6001\u66F4\u65B0"), {
4573
- lookup: lookup,
4574
- status: status
4575
- });
4576
- return _context48.abrupt("return");
4577
- case 18:
4578
- vouchers = Array.isArray(localOrder.vouchers) ? localOrder.vouchers : [];
4579
- hasUpdatedVoucher = false;
4580
- nextVouchers = vouchers.map(function (voucher) {
4581
- var voucherId = voucher === null || voucher === void 0 ? void 0 : voucher.voucher_id;
4582
- if (voucherId === undefined || voucherId === null) return voucher;
4583
- if (!voucherIdSet.has(String(voucherId))) return voucher;
4584
- hasUpdatedVoucher = true;
4585
- return _objectSpread(_objectSpread({}, voucher), {}, {
4586
- status: status
4587
- });
4588
- });
4589
- if (hasUpdatedVoucher) {
4590
- _context48.next = 24;
4591
- break;
4592
- }
4593
- this.logWarning("".concat(title, ": \u672C\u5730\u8BA2\u5355\u672A\u547D\u4E2D\u4EFB\u4F55 voucher\uFF0C\u8DF3\u8FC7\u6838\u9500\u72B6\u6001\u66F4\u65B0"), {
4594
- lookup: lookup,
4595
- voucher_ids: Array.from(voucherIdSet),
4596
- status: status
4597
- });
4598
- return _context48.abrupt("return");
4599
- case 24:
4600
- if (!(typeof this.order.overwriteExistingOrder === 'function')) {
4601
- _context48.next = 29;
4602
- break;
4603
- }
4604
- _context48.next = 27;
4605
- return this.order.overwriteExistingOrder(_objectSpread(_objectSpread({}, localOrder), {}, {
4606
- vouchers: nextVouchers
4607
- }));
4608
- case 27:
4609
- this.logInfo("".concat(title, ": \u672C\u5730\u8BA2\u5355 vouchers \u6838\u9500\u72B6\u6001\u5DF2\u66F4\u65B0"), {
4610
- lookup: lookup,
4611
- updatedCount: voucherIdSet.size,
4612
- status: status
4613
- });
4614
- return _context48.abrupt("return");
4615
- case 29:
4616
- if (!(data !== null && data !== void 0 && data.external_sale_number && typeof this.order.markOrderSyncedByExternalSaleNumber === 'function')) {
4617
- _context48.next = 34;
4618
- break;
4619
- }
4620
- _context48.next = 32;
4621
- return this.order.markOrderSyncedByExternalSaleNumber({
4622
- externalSaleNumber: data.external_sale_number,
4623
- patch: {
4624
- vouchers: nextVouchers
4625
- }
4626
- });
4627
- case 32:
4628
- this.logInfo("".concat(title, ": \u672C\u5730\u8BA2\u5355 vouchers \u6838\u9500\u72B6\u6001\u5DF2\u66F4\u65B0"), {
4629
- lookup: lookup,
4630
- updatedCount: voucherIdSet.size,
4631
- status: status
4632
- });
4633
- return _context48.abrupt("return");
4634
- case 34:
4635
- this.logWarning("".concat(title, ": Order \u6A21\u5757\u4E0D\u652F\u6301\u672C\u5730\u8BA2\u5355\u8986\u76D6\uFF0C\u8DF3\u8FC7\u6838\u9500\u72B6\u6001\u66F4\u65B0"), {
4636
- lookup: lookup,
4637
- status: status
4638
- });
4639
- case 35:
4640
- case "end":
4641
- return _context48.stop();
4642
- }
4643
- }, _callee48, this);
4644
- }));
4645
- function syncMachinecodeRedeemStatusToLocalOrder(_x52, _x53, _x54) {
4646
- return _syncMachinecodeRedeemStatusToLocalOrder.apply(this, arguments);
4647
- }
4648
- return syncMachinecodeRedeemStatusToLocalOrder;
4649
- }()
4650
4619
  }, {
4651
4620
  key: "handleOrderCheckoutSubmit",
4652
4621
  value: function () {
@@ -4733,7 +4702,7 @@ var Server = /*#__PURE__*/function () {
4733
4702
  }
4734
4703
  }, _callee49, this);
4735
4704
  }));
4736
- function handleOrderCheckoutSubmit(_x55) {
4705
+ function handleOrderCheckoutSubmit(_x54) {
4737
4706
  return _handleOrderCheckoutSubmit.apply(this, arguments);
4738
4707
  }
4739
4708
  return handleOrderCheckoutSubmit;
@@ -4742,13 +4711,13 @@ var Server = /*#__PURE__*/function () {
4742
4711
  key: "handleSyncCheckoutSubmit",
4743
4712
  value: function () {
4744
4713
  var _handleSyncCheckoutSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee50(params) {
4745
- var _this$app16;
4714
+ var _this$app15;
4746
4715
  var backendPath, data, title, syncResult, _normalized$data, normalized, backendError, _normalized$data2, _normalized, message;
4747
4716
  return _regeneratorRuntime().wrap(function _callee50$(_context50) {
4748
4717
  while (1) switch (_context50.prev = _context50.next) {
4749
4718
  case 0:
4750
4719
  backendPath = params.backendPath, data = params.data, title = params.title;
4751
- if ((_this$app16 = this.app) !== null && _this$app16 !== void 0 && (_this$app16 = _this$app16.request) !== null && _this$app16 !== void 0 && _this$app16.post) {
4720
+ if ((_this$app15 = this.app) !== null && _this$app15 !== void 0 && (_this$app15 = _this$app15.request) !== null && _this$app15 !== void 0 && _this$app15.post) {
4752
4721
  _context50.next = 4;
4753
4722
  break;
4754
4723
  }
@@ -4815,7 +4784,7 @@ var Server = /*#__PURE__*/function () {
4815
4784
  }
4816
4785
  }, _callee50, this, [[4, 14]]);
4817
4786
  }));
4818
- function handleSyncCheckoutSubmit(_x56) {
4787
+ function handleSyncCheckoutSubmit(_x55) {
4819
4788
  return _handleSyncCheckoutSubmit.apply(this, arguments);
4820
4789
  }
4821
4790
  return handleSyncCheckoutSubmit;
@@ -4824,7 +4793,7 @@ var Server = /*#__PURE__*/function () {
4824
4793
  key: "handlePendingSyncCheckoutOrder",
4825
4794
  value: function () {
4826
4795
  var _handlePendingSyncCheckoutOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee51(params) {
4827
- var _this10 = this;
4796
+ var _this11 = this;
4828
4797
  var backendPath, data, title, reason, pendingOrder, _pendingOrder$payment, _pendingOrder$summary, _pendingOrder$summary2, _pendingOrder$summary3, changeGivenAmount, errorMessage;
4829
4798
  return _regeneratorRuntime().wrap(function _callee51$(_context51) {
4830
4799
  while (1) switch (_context51.prev = _context51.next) {
@@ -4877,7 +4846,7 @@ var Server = /*#__PURE__*/function () {
4877
4846
  });
4878
4847
  changeGivenAmount = pendingOrder === null || pendingOrder === void 0 || (_pendingOrder$payment = pendingOrder.payments) === null || _pendingOrder$payment === void 0 ? void 0 : _pendingOrder$payment.reduce(function (sum, payment) {
4879
4848
  var _payment$metadata;
4880
- return sum + _this10.toAmountNumber(payment === null || payment === void 0 || (_payment$metadata = payment.metadata) === null || _payment$metadata === void 0 ? void 0 : _payment$metadata.change_given_amount);
4849
+ return sum + _this11.toAmountNumber(payment === null || payment === void 0 || (_payment$metadata = payment.metadata) === null || _payment$metadata === void 0 ? void 0 : _payment$metadata.change_given_amount);
4881
4850
  }, 0);
4882
4851
  return _context51.abrupt("return", {
4883
4852
  code: 200,
@@ -4914,7 +4883,7 @@ var Server = /*#__PURE__*/function () {
4914
4883
  }
4915
4884
  }, _callee51, this, [[10, 18]]);
4916
4885
  }));
4917
- function handlePendingSyncCheckoutOrder(_x57) {
4886
+ function handlePendingSyncCheckoutOrder(_x56) {
4918
4887
  return _handlePendingSyncCheckoutOrder.apply(this, arguments);
4919
4888
  }
4920
4889
  return handlePendingSyncCheckoutOrder;
@@ -4958,7 +4927,7 @@ var Server = /*#__PURE__*/function () {
4958
4927
  }
4959
4928
  }, _callee52, this);
4960
4929
  }));
4961
- function buildPendingSyncCheckoutOrder(_x58) {
4930
+ function buildPendingSyncCheckoutOrder(_x57) {
4962
4931
  return _buildPendingSyncCheckoutOrder.apply(this, arguments);
4963
4932
  }
4964
4933
  return buildPendingSyncCheckoutOrder;
@@ -4966,10 +4935,10 @@ var Server = /*#__PURE__*/function () {
4966
4935
  }, {
4967
4936
  key: "shouldBuildSmallTicketData",
4968
4937
  value: function shouldBuildSmallTicketData(order) {
4969
- var _ref56, _order$small_ticket_d;
4938
+ var _order$payment_info, _ref54, _order$small_ticket_d;
4970
4939
  if (!order || _typeof(order) !== 'object') return false;
4971
- // if (hasSmallTicketData(order.payment_info?.small_ticket_data)) return false;
4972
- return Number((_ref56 = (_order$small_ticket_d = order.small_ticket_data_flag) !== null && _order$small_ticket_d !== void 0 ? _order$small_ticket_d : order.smallTicketDataFlag) !== null && _ref56 !== void 0 ? _ref56 : 0) === 1;
4940
+ if (hasSmallTicketData((_order$payment_info = order.payment_info) === null || _order$payment_info === void 0 ? void 0 : _order$payment_info.small_ticket_data)) return false;
4941
+ return Number((_ref54 = (_order$small_ticket_d = order.small_ticket_data_flag) !== null && _order$small_ticket_d !== void 0 ? _order$small_ticket_d : order.smallTicketDataFlag) !== null && _ref54 !== void 0 ? _ref54 : 0) === 1;
4973
4942
  }
4974
4943
  }, {
4975
4944
  key: "shouldPrintSyncedOrder",
@@ -4987,7 +4956,7 @@ var Server = /*#__PURE__*/function () {
4987
4956
  }, {
4988
4957
  key: "isSalesOrderFullyPaid",
4989
4958
  value: function isSalesOrderFullyPaid(order) {
4990
- var _order$summary$amount, _order$summary, _ref57, _ref58, _order$summary$expect, _order$summary2, _order$summary3;
4959
+ var _order$summary$amount, _order$summary, _ref55, _ref56, _order$summary$expect, _order$summary2, _order$summary3;
4991
4960
  if (!order || _typeof(order) !== 'object') return false;
4992
4961
  var paymentStatus = String(order.payment_status || '').toLowerCase();
4993
4962
  if (paymentStatus === 'paid' || paymentStatus === 'finished') return true;
@@ -4999,20 +4968,20 @@ var Server = /*#__PURE__*/function () {
4999
4968
  return this.toAmountNumber(amountGap) <= 0;
5000
4969
  }
5001
4970
  var paidAmount = this.sumPaidOrderPayments(order.payments);
5002
- var targetAmount = this.toAmountNumber((_ref57 = (_ref58 = (_order$summary$expect = (_order$summary2 = order.summary) === null || _order$summary2 === void 0 ? void 0 : _order$summary2.expect_amount) !== null && _order$summary$expect !== void 0 ? _order$summary$expect : (_order$summary3 = order.summary) === null || _order$summary3 === void 0 ? void 0 : _order$summary3.total_amount) !== null && _ref58 !== void 0 ? _ref58 : order.expect_amount) !== null && _ref57 !== void 0 ? _ref57 : order.total_amount);
4971
+ var targetAmount = this.toAmountNumber((_ref55 = (_ref56 = (_order$summary$expect = (_order$summary2 = order.summary) === null || _order$summary2 === void 0 ? void 0 : _order$summary2.expect_amount) !== null && _order$summary$expect !== void 0 ? _order$summary$expect : (_order$summary3 = order.summary) === null || _order$summary3 === void 0 ? void 0 : _order$summary3.total_amount) !== null && _ref56 !== void 0 ? _ref56 : order.expect_amount) !== null && _ref55 !== void 0 ? _ref55 : order.total_amount);
5003
4972
  if (targetAmount <= 0) return paidAmount > 0;
5004
4973
  return paidAmount >= targetAmount;
5005
4974
  }
5006
4975
  }, {
5007
4976
  key: "sumPaidOrderPayments",
5008
4977
  value: function sumPaidOrderPayments(payments) {
5009
- var _this11 = this;
4978
+ var _this12 = this;
5010
4979
  if (!Array.isArray(payments)) return 0;
5011
4980
  return payments.reduce(function (sum, payment) {
5012
4981
  var _payment$amount;
5013
4982
  var status = String((payment === null || payment === void 0 ? void 0 : payment.status) || '').toLowerCase();
5014
4983
  if (status === 'voided' || status === 'failed' || status === 'cancelled') return sum;
5015
- return sum + _this11.toAmountNumber((_payment$amount = payment === null || payment === void 0 ? void 0 : payment.amount) !== null && _payment$amount !== void 0 ? _payment$amount : payment === null || payment === void 0 ? void 0 : payment.origin_amount);
4984
+ return sum + _this12.toAmountNumber((_payment$amount = payment === null || payment === void 0 ? void 0 : payment.amount) !== null && _payment$amount !== void 0 ? _payment$amount : payment === null || payment === void 0 ? void 0 : payment.origin_amount);
5016
4985
  }, 0);
5017
4986
  }
5018
4987
  }, {
@@ -5027,8 +4996,8 @@ var Server = /*#__PURE__*/function () {
5027
4996
  key: "buildSmallTicketProductMap",
5028
4997
  value: function () {
5029
4998
  var _buildSmallTicketProductMap = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee54(order) {
5030
- var _this$products,
5031
- _this12 = this;
4999
+ var _this$products3,
5000
+ _this13 = this;
5032
5001
  var products, productIdSet, productIds, entries;
5033
5002
  return _regeneratorRuntime().wrap(function _callee54$(_context54) {
5034
5003
  while (1) switch (_context54.prev = _context54.next) {
@@ -5043,8 +5012,8 @@ var Server = /*#__PURE__*/function () {
5043
5012
  }
5044
5013
  if (Array.isArray(product === null || product === void 0 ? void 0 : product.product_bundle)) {
5045
5014
  product.product_bundle.forEach(function (bundle) {
5046
- var _ref59, _bundle$bundle_produc;
5047
- var bundleProductId = (_ref59 = (_bundle$bundle_produc = bundle === null || bundle === void 0 ? void 0 : bundle.bundle_product_id) !== null && _bundle$bundle_produc !== void 0 ? _bundle$bundle_produc : bundle === null || bundle === void 0 ? void 0 : bundle._bundle_product_id) !== null && _ref59 !== void 0 ? _ref59 : bundle === null || bundle === void 0 ? void 0 : bundle.product_id;
5015
+ var _ref57, _bundle$bundle_produc;
5016
+ var bundleProductId = (_ref57 = (_bundle$bundle_produc = bundle === null || bundle === void 0 ? void 0 : bundle.bundle_product_id) !== null && _bundle$bundle_produc !== void 0 ? _bundle$bundle_produc : bundle === null || bundle === void 0 ? void 0 : bundle._bundle_product_id) !== null && _ref57 !== void 0 ? _ref57 : bundle === null || bundle === void 0 ? void 0 : bundle.product_id;
5048
5017
  if (bundleProductId !== undefined && bundleProductId !== null && bundleProductId !== '') {
5049
5018
  productIdSet.add(bundleProductId);
5050
5019
  }
@@ -5052,7 +5021,7 @@ var Server = /*#__PURE__*/function () {
5052
5021
  }
5053
5022
  });
5054
5023
  productIds = Array.from(productIdSet);
5055
- if (!(!productIds.length || typeof ((_this$products = this.products) === null || _this$products === void 0 ? void 0 : _this$products.getProductById) !== 'function')) {
5024
+ if (!(!productIds.length || typeof ((_this$products3 = this.products) === null || _this$products3 === void 0 ? void 0 : _this$products3.getProductById) !== 'function')) {
5056
5025
  _context54.next = 6;
5057
5026
  break;
5058
5027
  }
@@ -5060,21 +5029,21 @@ var Server = /*#__PURE__*/function () {
5060
5029
  case 6:
5061
5030
  _context54.next = 8;
5062
5031
  return Promise.all(productIds.map( /*#__PURE__*/function () {
5063
- var _ref60 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee53(id) {
5064
- var _this12$products, _this12$products$getP, product;
5032
+ var _ref58 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee53(id) {
5033
+ var _this13$products, _this13$products$getP, product;
5065
5034
  return _regeneratorRuntime().wrap(function _callee53$(_context53) {
5066
5035
  while (1) switch (_context53.prev = _context53.next) {
5067
5036
  case 0:
5068
5037
  _context53.prev = 0;
5069
5038
  _context53.next = 3;
5070
- return (_this12$products = _this12.products) === null || _this12$products === void 0 || (_this12$products$getP = _this12$products.getProductById) === null || _this12$products$getP === void 0 ? void 0 : _this12$products$getP.call(_this12$products, Number(id));
5039
+ return (_this13$products = _this13.products) === null || _this13$products === void 0 || (_this13$products$getP = _this13$products.getProductById) === null || _this13$products$getP === void 0 ? void 0 : _this13$products$getP.call(_this13$products, Number(id));
5071
5040
  case 3:
5072
5041
  product = _context53.sent;
5073
5042
  return _context53.abrupt("return", product ? [String(id), product] : null);
5074
5043
  case 7:
5075
5044
  _context53.prev = 7;
5076
5045
  _context53.t0 = _context53["catch"](0);
5077
- _this12.logWarning('buildSmallTicketProductMap: 查询本地商品失败', {
5046
+ _this13.logWarning('buildSmallTicketProductMap: 查询本地商品失败', {
5078
5047
  product_id: id,
5079
5048
  error: _context53.t0 instanceof Error ? _context53.t0.message : String(_context53.t0)
5080
5049
  });
@@ -5085,8 +5054,8 @@ var Server = /*#__PURE__*/function () {
5085
5054
  }
5086
5055
  }, _callee53, null, [[0, 7]]);
5087
5056
  }));
5088
- return function (_x60) {
5089
- return _ref60.apply(this, arguments);
5057
+ return function (_x59) {
5058
+ return _ref58.apply(this, arguments);
5090
5059
  };
5091
5060
  }()));
5092
5061
  case 8:
@@ -5105,7 +5074,7 @@ var Server = /*#__PURE__*/function () {
5105
5074
  }
5106
5075
  }, _callee54, this);
5107
5076
  }));
5108
- function buildSmallTicketProductMap(_x59) {
5077
+ function buildSmallTicketProductMap(_x58) {
5109
5078
  return _buildSmallTicketProductMap.apply(this, arguments);
5110
5079
  }
5111
5080
  return buildSmallTicketProductMap;
@@ -5113,13 +5082,13 @@ var Server = /*#__PURE__*/function () {
5113
5082
  }, {
5114
5083
  key: "withPendingSyncProductTitles",
5115
5084
  value: function withPendingSyncProductTitles(order, productMap) {
5116
- var _this13 = this;
5085
+ var _this14 = this;
5117
5086
  var products = Array.isArray(order.products) ? order.products : null;
5118
5087
  if (!(products !== null && products !== void 0 && products.length)) return order;
5119
5088
  return _objectSpread(_objectSpread({}, order), {}, {
5120
5089
  products: products.map(function (product) {
5121
5090
  return _objectSpread(_objectSpread({}, product), {}, {
5122
- product_title: _this13.buildProductTitleSnapshot(product, productMap)
5091
+ product_title: _this14.buildProductTitleSnapshot(product, productMap)
5123
5092
  });
5124
5093
  })
5125
5094
  });
@@ -5130,7 +5099,7 @@ var Server = /*#__PURE__*/function () {
5130
5099
  var _product$product_id2,
5131
5100
  _product$product,
5132
5101
  _fallbackProduct$prod,
5133
- _this14 = this;
5102
+ _this15 = this;
5134
5103
  var productId = (_product$product_id2 = product.product_id) !== null && _product$product_id2 !== void 0 ? _product$product_id2 : product.id;
5135
5104
  var fallbackProduct = productId !== undefined && productId !== null ? productMap[productId] || productMap[String(productId)] : null;
5136
5105
  var ownTitle = product.product_title || product.title || product.name || ((_product$product = product.product) === null || _product$product === void 0 ? void 0 : _product$product.title);
@@ -5138,7 +5107,7 @@ var Server = /*#__PURE__*/function () {
5138
5107
  var currentLocale = this.getProductTitleSnapshotCurrentLocale();
5139
5108
  var autoTitle = this.resolveFirstProductTitleValue(ownTitle) || this.resolveFirstProductTitleValue(fallbackTitle);
5140
5109
  return PRODUCT_TITLE_SNAPSHOT_KEYS.reduce(function (snapshot, key) {
5141
- snapshot[key] = _this14.resolveProductTitleValue(ownTitle, key, currentLocale) || _this14.resolveProductTitleValue(fallbackTitle, key, currentLocale) || (key === 'auto' || key === 'original' ? autoTitle : null);
5110
+ snapshot[key] = _this15.resolveProductTitleValue(ownTitle, key, currentLocale) || _this15.resolveProductTitleValue(fallbackTitle, key, currentLocale) || (key === 'auto' || key === 'original' ? autoTitle : null);
5142
5111
  return snapshot;
5143
5112
  }, {});
5144
5113
  }
@@ -5163,7 +5132,7 @@ var Server = /*#__PURE__*/function () {
5163
5132
  }, {
5164
5133
  key: "resolveProductTitleValue",
5165
5134
  value: function resolveProductTitleValue(value, key, currentLocale) {
5166
- var _ref61, _ref62, _value$key;
5135
+ var _ref59, _ref60, _value$key;
5167
5136
  if (value === undefined || value === null || value === '') return null;
5168
5137
  if (_typeof(value) !== 'object') {
5169
5138
  var title = String(value);
@@ -5173,7 +5142,7 @@ var Server = /*#__PURE__*/function () {
5173
5142
  }
5174
5143
  var normalizedKey = key.replace('-', '_');
5175
5144
  var dashedKey = key.replace('_', '-');
5176
- var rawValue = (_ref61 = (_ref62 = (_value$key = value[key]) !== null && _value$key !== void 0 ? _value$key : value[normalizedKey]) !== null && _ref62 !== void 0 ? _ref62 : value[dashedKey]) !== null && _ref61 !== void 0 ? _ref61 : key === 'auto' ? value.default : undefined;
5145
+ var rawValue = (_ref59 = (_ref60 = (_value$key = value[key]) !== null && _value$key !== void 0 ? _value$key : value[normalizedKey]) !== null && _ref60 !== void 0 ? _ref60 : value[dashedKey]) !== null && _ref59 !== void 0 ? _ref59 : key === 'auto' ? value.default : undefined;
5177
5146
  if (rawValue === undefined || rawValue === null || rawValue === '') return null;
5178
5147
  if (_typeof(rawValue) === 'object') return this.resolveFirstProductTitleValue(rawValue);
5179
5148
  return String(rawValue);
@@ -5237,14 +5206,14 @@ var Server = /*#__PURE__*/function () {
5237
5206
  key: "enrichPaymentNamesByCode",
5238
5207
  value: function () {
5239
5208
  var _enrichPaymentNamesByCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee55(order) {
5240
- var _this15 = this;
5241
- var payments, hasMissingName, paymentModule, payMethods, nameByCode, _iterator12, _step12, method, codeKey, name, hasResolvedName, enrichedPayments;
5209
+ var _this16 = this;
5210
+ var payments, hasMissingName, paymentModule, payMethods, nameByCode, _iterator13, _step13, method, codeKey, name, hasResolvedName, enrichedPayments;
5242
5211
  return _regeneratorRuntime().wrap(function _callee55$(_context55) {
5243
5212
  while (1) switch (_context55.prev = _context55.next) {
5244
5213
  case 0:
5245
5214
  payments = Array.isArray(order === null || order === void 0 ? void 0 : order.payments) ? order.payments : [];
5246
5215
  hasMissingName = payments.some(function (payment) {
5247
- return _this15.isBlankPaymentName(payment === null || payment === void 0 ? void 0 : payment.name) && _this15.shouldLookupPaymentMethodNameByCode(payment === null || payment === void 0 ? void 0 : payment.code);
5216
+ return _this16.isBlankPaymentName(payment === null || payment === void 0 ? void 0 : payment.name) && _this16.shouldLookupPaymentMethodNameByCode(payment === null || payment === void 0 ? void 0 : payment.code);
5248
5217
  });
5249
5218
  if (hasMissingName) {
5250
5219
  _context55.next = 4;
@@ -5262,24 +5231,24 @@ var Server = /*#__PURE__*/function () {
5262
5231
  case 10:
5263
5232
  payMethods = _context55.sent;
5264
5233
  nameByCode = new Map();
5265
- _iterator12 = _createForOfIteratorHelper(payMethods || []);
5234
+ _iterator13 = _createForOfIteratorHelper(payMethods || []);
5266
5235
  try {
5267
- for (_iterator12.s(); !(_step12 = _iterator12.n()).done;) {
5268
- method = _step12.value;
5236
+ for (_iterator13.s(); !(_step13 = _iterator13.n()).done;) {
5237
+ method = _step13.value;
5269
5238
  codeKey = this.getPaymentCodeKey(method === null || method === void 0 ? void 0 : method.code);
5270
5239
  name = this.resolveFirstProductTitleValue(method === null || method === void 0 ? void 0 : method.name);
5271
5240
  if (codeKey && name) nameByCode.set(codeKey, name);
5272
5241
  }
5273
5242
  } catch (err) {
5274
- _iterator12.e(err);
5243
+ _iterator13.e(err);
5275
5244
  } finally {
5276
- _iterator12.f();
5245
+ _iterator13.f();
5277
5246
  }
5278
5247
  hasResolvedName = false;
5279
5248
  enrichedPayments = payments.map(function (payment) {
5280
- if (!_this15.isBlankPaymentName(payment === null || payment === void 0 ? void 0 : payment.name)) return payment;
5281
- if (!_this15.shouldLookupPaymentMethodNameByCode(payment === null || payment === void 0 ? void 0 : payment.code)) return payment;
5282
- var name = nameByCode.get(_this15.getPaymentCodeKey(payment === null || payment === void 0 ? void 0 : payment.code));
5249
+ if (!_this16.isBlankPaymentName(payment === null || payment === void 0 ? void 0 : payment.name)) return payment;
5250
+ if (!_this16.shouldLookupPaymentMethodNameByCode(payment === null || payment === void 0 ? void 0 : payment.code)) return payment;
5251
+ var name = nameByCode.get(_this16.getPaymentCodeKey(payment === null || payment === void 0 ? void 0 : payment.code));
5283
5252
  if (!name) return payment;
5284
5253
  hasResolvedName = true;
5285
5254
  return _objectSpread(_objectSpread({}, payment), {}, {
@@ -5308,7 +5277,7 @@ var Server = /*#__PURE__*/function () {
5308
5277
  }
5309
5278
  }, _callee55, this, [[4, 21]]);
5310
5279
  }));
5311
- function enrichPaymentNamesByCode(_x61) {
5280
+ function enrichPaymentNamesByCode(_x60) {
5312
5281
  return _enrichPaymentNamesByCode.apply(this, arguments);
5313
5282
  }
5314
5283
  return enrichPaymentNamesByCode;
@@ -5375,7 +5344,7 @@ var Server = /*#__PURE__*/function () {
5375
5344
  }
5376
5345
  }, _callee56, this, [[4, 20]]);
5377
5346
  }));
5378
- function withLocalSmallTicketData(_x62, _x63) {
5347
+ function withLocalSmallTicketData(_x61, _x62) {
5379
5348
  return _withLocalSmallTicketData.apply(this, arguments);
5380
5349
  }
5381
5350
  return withLocalSmallTicketData;
@@ -5438,8 +5407,8 @@ var Server = /*#__PURE__*/function () {
5438
5407
  key: "handleUpdateLocalOrdersBatch",
5439
5408
  value: (function () {
5440
5409
  var _handleUpdateLocalOrdersBatch = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee57(orderIds) {
5441
- var _this$app17;
5442
- var existedBefore, _iterator13, _step13, id, fetched, message, fetchedMap, _iterator14, _step14, order, oid, freshOrders, succeedIds, failed, _iterator15, _step15, _id, fresh, _message2, overwritten, inserted;
5410
+ var _this$app16;
5411
+ var existedBefore, _iterator14, _step14, id, fetched, message, fetchedMap, _iterator15, _step15, order, oid, freshOrders, succeedIds, failed, _iterator16, _step16, _id, fresh, _message, overwritten, inserted;
5443
5412
  return _regeneratorRuntime().wrap(function _callee57$(_context57) {
5444
5413
  while (1) switch (_context57.prev = _context57.next) {
5445
5414
  case 0:
@@ -5459,7 +5428,7 @@ var Server = /*#__PURE__*/function () {
5459
5428
  data: null
5460
5429
  });
5461
5430
  case 4:
5462
- if ((_this$app17 = this.app) !== null && _this$app17 !== void 0 && _this$app17.request) {
5431
+ if ((_this$app16 = this.app) !== null && _this$app16 !== void 0 && _this$app16.request) {
5463
5432
  _context57.next = 7;
5464
5433
  break;
5465
5434
  }
@@ -5473,18 +5442,18 @@ var Server = /*#__PURE__*/function () {
5473
5442
  case 7:
5474
5443
  // 拉取前先记录"本地是否已存在",用于区分 overwritten / inserted
5475
5444
  existedBefore = new Map();
5476
- _iterator13 = _createForOfIteratorHelper(orderIds);
5445
+ _iterator14 = _createForOfIteratorHelper(orderIds);
5477
5446
  try {
5478
- for (_iterator13.s(); !(_step13 = _iterator13.n()).done;) {
5479
- id = _step13.value;
5447
+ for (_iterator14.s(); !(_step14 = _iterator14.n()).done;) {
5448
+ id = _step14.value;
5480
5449
  existedBefore.set(id, !!this.order.getOrderByOrderId(id));
5481
5450
  }
5482
5451
 
5483
5452
  // 走 orderDataSource 的批量 HTTP 通道,一次请求拉回多笔详情
5484
5453
  } catch (err) {
5485
- _iterator13.e(err);
5454
+ _iterator14.e(err);
5486
5455
  } finally {
5487
- _iterator13.f();
5456
+ _iterator14.f();
5488
5457
  }
5489
5458
  fetched = [];
5490
5459
  _context57.prev = 11;
@@ -5510,15 +5479,15 @@ var Server = /*#__PURE__*/function () {
5510
5479
  case 22:
5511
5480
  // 按返回结果中的 order_id 建索引,未命中即视为单笔失败
5512
5481
  fetchedMap = new Map();
5513
- _iterator14 = _createForOfIteratorHelper(fetched);
5482
+ _iterator15 = _createForOfIteratorHelper(fetched);
5514
5483
  _context57.prev = 24;
5515
- _iterator14.s();
5484
+ _iterator15.s();
5516
5485
  case 26:
5517
- if ((_step14 = _iterator14.n()).done) {
5486
+ if ((_step15 = _iterator15.n()).done) {
5518
5487
  _context57.next = 34;
5519
5488
  break;
5520
5489
  }
5521
- order = _step14.value;
5490
+ order = _step15.value;
5522
5491
  oid = order === null || order === void 0 ? void 0 : order.order_id;
5523
5492
  if (!(oid === undefined || oid === null)) {
5524
5493
  _context57.next = 31;
@@ -5536,19 +5505,19 @@ var Server = /*#__PURE__*/function () {
5536
5505
  case 36:
5537
5506
  _context57.prev = 36;
5538
5507
  _context57.t1 = _context57["catch"](24);
5539
- _iterator14.e(_context57.t1);
5508
+ _iterator15.e(_context57.t1);
5540
5509
  case 39:
5541
5510
  _context57.prev = 39;
5542
- _iterator14.f();
5511
+ _iterator15.f();
5543
5512
  return _context57.finish(39);
5544
5513
  case 42:
5545
5514
  freshOrders = [];
5546
5515
  succeedIds = [];
5547
5516
  failed = [];
5548
- _iterator15 = _createForOfIteratorHelper(orderIds);
5517
+ _iterator16 = _createForOfIteratorHelper(orderIds);
5549
5518
  try {
5550
- for (_iterator15.s(); !(_step15 = _iterator15.n()).done;) {
5551
- _id = _step15.value;
5519
+ for (_iterator16.s(); !(_step16 = _iterator16.n()).done;) {
5520
+ _id = _step16.value;
5552
5521
  fresh = fetchedMap.get(_id);
5553
5522
  if (fresh) {
5554
5523
  freshOrders.push(fresh);
@@ -5561,9 +5530,9 @@ var Server = /*#__PURE__*/function () {
5561
5530
  }
5562
5531
  }
5563
5532
  } catch (err) {
5564
- _iterator15.e(err);
5533
+ _iterator16.e(err);
5565
5534
  } finally {
5566
- _iterator15.f();
5535
+ _iterator16.f();
5567
5536
  }
5568
5537
  if (!(freshOrders.length > 0)) {
5569
5538
  _context57.next = 58;
@@ -5578,14 +5547,14 @@ var Server = /*#__PURE__*/function () {
5578
5547
  case 53:
5579
5548
  _context57.prev = 53;
5580
5549
  _context57.t2 = _context57["catch"](48);
5581
- _message2 = _context57.t2 instanceof Error ? _context57.t2.message : String(_context57.t2);
5550
+ _message = _context57.t2 instanceof Error ? _context57.t2.message : String(_context57.t2);
5582
5551
  this.logError('handleUpdateLocalOrdersBatch: 合并写入失败', {
5583
- message: _message2
5552
+ message: _message
5584
5553
  });
5585
5554
  return _context57.abrupt("return", {
5586
5555
  code: 500,
5587
5556
  status: false,
5588
- message: _message2,
5557
+ message: _message,
5589
5558
  data: null
5590
5559
  });
5591
5560
  case 58:
@@ -5617,7 +5586,7 @@ var Server = /*#__PURE__*/function () {
5617
5586
  }
5618
5587
  }, _callee57, this, [[11, 17], [24, 36, 39, 42], [48, 53]]);
5619
5588
  }));
5620
- function handleUpdateLocalOrdersBatch(_x64) {
5589
+ function handleUpdateLocalOrdersBatch(_x63) {
5621
5590
  return _handleUpdateLocalOrdersBatch.apply(this, arguments);
5622
5591
  }
5623
5592
  return handleUpdateLocalOrdersBatch;
@@ -5638,11 +5607,11 @@ var Server = /*#__PURE__*/function () {
5638
5607
  var queryIndex = url.indexOf('?');
5639
5608
  if (queryIndex < 0) return null;
5640
5609
  var query = url.slice(queryIndex + 1);
5641
- var _iterator16 = _createForOfIteratorHelper(query.split('&')),
5642
- _step16;
5610
+ var _iterator17 = _createForOfIteratorHelper(query.split('&')),
5611
+ _step17;
5643
5612
  try {
5644
- for (_iterator16.s(); !(_step16 = _iterator16.n()).done;) {
5645
- var pair = _step16.value;
5613
+ for (_iterator17.s(); !(_step17 = _iterator17.n()).done;) {
5614
+ var pair = _step17.value;
5646
5615
  if (!pair) continue;
5647
5616
  var _pair$split = pair.split('='),
5648
5617
  _pair$split2 = _slicedToArray(_pair$split, 2),
@@ -5658,9 +5627,9 @@ var Server = /*#__PURE__*/function () {
5658
5627
  }
5659
5628
  }
5660
5629
  } catch (err) {
5661
- _iterator16.e(err);
5630
+ _iterator17.e(err);
5662
5631
  } finally {
5663
- _iterator16.f();
5632
+ _iterator17.f();
5664
5633
  }
5665
5634
  return null;
5666
5635
  }
@@ -5694,8 +5663,8 @@ var Server = /*#__PURE__*/function () {
5694
5663
  }, {
5695
5664
  key: "extractOrderDataFromCheckoutResponse",
5696
5665
  value: function extractOrderDataFromCheckoutResponse(response) {
5697
- var _response$data6, _response$data7;
5698
- var candidates = [response === null || response === void 0 || (_response$data6 = response.data) === null || _response$data6 === void 0 ? void 0 : _response$data6.order, response === null || response === void 0 || (_response$data7 = response.data) === null || _response$data7 === void 0 ? void 0 : _response$data7.sales, response === null || response === void 0 ? void 0 : response.data, response === null || response === void 0 ? void 0 : response.order, response === null || response === void 0 ? void 0 : response.sales, response];
5666
+ var _response$data5, _response$data6;
5667
+ var candidates = [response === null || response === void 0 || (_response$data5 = response.data) === null || _response$data5 === void 0 ? void 0 : _response$data5.order, response === null || response === void 0 || (_response$data6 = response.data) === null || _response$data6 === void 0 ? void 0 : _response$data6.sales, response === null || response === void 0 ? void 0 : response.data, response === null || response === void 0 ? void 0 : response.order, response === null || response === void 0 ? void 0 : response.sales, response];
5699
5668
  for (var _i4 = 0, _candidates = candidates; _i4 < _candidates.length; _i4++) {
5700
5669
  var candidate = _candidates[_i4];
5701
5670
  if (!candidate || _typeof(candidate) !== 'object') continue;
@@ -5859,10 +5828,10 @@ var Server = /*#__PURE__*/function () {
5859
5828
  value: function extractBackendErrorResponse(error) {
5860
5829
  var _error$response3,
5861
5830
  _error$response4,
5862
- _this16 = this;
5831
+ _this17 = this;
5863
5832
  var candidates = [error === null || error === void 0 || (_error$response3 = error.response) === null || _error$response3 === void 0 ? void 0 : _error$response3.data, error === null || error === void 0 ? void 0 : error.data, error === null || error === void 0 || (_error$response4 = error.response) === null || _error$response4 === void 0 ? void 0 : _error$response4.body, error === null || error === void 0 ? void 0 : error.body];
5864
5833
  return candidates.find(function (candidate) {
5865
- return _this16.isExplicitBackendErrorResponse(candidate);
5834
+ return _this17.isExplicitBackendErrorResponse(candidate);
5866
5835
  }) || null;
5867
5836
  }
5868
5837
  }, {
@@ -5982,7 +5951,7 @@ var Server = /*#__PURE__*/function () {
5982
5951
  key: "recomputeAndNotifyFloorPlanQuery",
5983
5952
  value: (function () {
5984
5953
  var _recomputeAndNotifyFloorPlanQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee58() {
5985
- var _iterator17, _step17, _step17$value, subscriberId, sub, result, errorMessage;
5954
+ var _iterator18, _step18, _step18$value, subscriberId, sub, result, errorMessage;
5986
5955
  return _regeneratorRuntime().wrap(function _callee58$(_context58) {
5987
5956
  while (1) switch (_context58.prev = _context58.next) {
5988
5957
  case 0:
@@ -5995,10 +5964,10 @@ var Server = /*#__PURE__*/function () {
5995
5964
  this.logInfo('recomputeAndNotifyFloorPlanQuery: 开始推送', {
5996
5965
  subscriberCount: this.floorPlanQuerySubscribers.size
5997
5966
  });
5998
- _iterator17 = _createForOfIteratorHelper(this.floorPlanQuerySubscribers.entries());
5967
+ _iterator18 = _createForOfIteratorHelper(this.floorPlanQuerySubscribers.entries());
5999
5968
  try {
6000
- for (_iterator17.s(); !(_step17 = _iterator17.n()).done;) {
6001
- _step17$value = _slicedToArray(_step17.value, 2), subscriberId = _step17$value[0], sub = _step17$value[1];
5969
+ for (_iterator18.s(); !(_step18 = _iterator18.n()).done;) {
5970
+ _step18$value = _slicedToArray(_step18.value, 2), subscriberId = _step18$value[0], sub = _step18$value[1];
6002
5971
  try {
6003
5972
  result = this.computeFloorPlanQueryResult(sub.context);
6004
5973
  sub.callback(result);
@@ -6014,9 +5983,9 @@ var Server = /*#__PURE__*/function () {
6014
5983
  }
6015
5984
  }
6016
5985
  } catch (err) {
6017
- _iterator17.e(err);
5986
+ _iterator18.e(err);
6018
5987
  } finally {
6019
- _iterator17.f();
5988
+ _iterator18.f();
6020
5989
  }
6021
5990
  case 5:
6022
5991
  case "end":
@@ -6102,7 +6071,7 @@ var Server = /*#__PURE__*/function () {
6102
6071
  }
6103
6072
  }, _callee59, this);
6104
6073
  }));
6105
- function computeOrderQueryResult(_x65) {
6074
+ function computeOrderQueryResult(_x64) {
6106
6075
  return _computeOrderQueryResult.apply(this, arguments);
6107
6076
  }
6108
6077
  return computeOrderQueryResult;
@@ -6156,7 +6125,7 @@ var Server = /*#__PURE__*/function () {
6156
6125
  }
6157
6126
  }, _callee60, this);
6158
6127
  }));
6159
- function computeBookingQueryResult(_x66) {
6128
+ function computeBookingQueryResult(_x65) {
6160
6129
  return _computeBookingQueryResult.apply(this, arguments);
6161
6130
  }
6162
6131
  return computeBookingQueryResult;
@@ -6217,18 +6186,24 @@ var Server = /*#__PURE__*/function () {
6217
6186
  value: (function () {
6218
6187
  var _computeProductQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee61(context, options) {
6219
6188
  var _menu_list_ids$length3,
6220
- _this17 = this;
6221
- var tTotal, menu_list_ids, ids, schedule_date, schedule_datetime, customer_id, extension_type, product_id, queryIds, uniqueIds, _tPrice, productsWithPrice, _filteredProducts, extensionFilteredProducts, _published$find, pid, _tPrice2, allProductsWithPrice, published, item, _tPrice3, _filteredProducts2, _tStatus, _beforeStatusCount, _tExtensionType, _beforeExtensionTypeCount, _tSort, activeMenuList, tMenu, menuList, tFilter, productScope, scopedProductIds, tPrice, filteredProducts, tStatus, beforeStatusCount, tExtensionType, beforeExtensionTypeCount, tSort;
6189
+ _this18 = this;
6190
+ var tTotal, menu_list_ids, ids, schedule_date, schedule_datetime, customer_id, extension_type, product_id, strategy_context, queryIds, formatterContext, uniqueIds, _tPrice, productsWithPrice, _filteredProducts, extensionFilteredProducts, _published$find, pid, _tPrice2, allProductsWithPrice, published, item, _tPrice3, _filteredProducts2, _tStatus, _beforeStatusCount, _tExtensionType, _beforeExtensionTypeCount, _tSort, activeMenuList, tMenu, menuList, tFilter, productScope, scopedProductIds, tPrice, filteredProducts, tStatus, beforeStatusCount, tExtensionType, beforeExtensionTypeCount, tSort;
6222
6191
  return _regeneratorRuntime().wrap(function _callee61$(_context61) {
6223
6192
  while (1) switch (_context61.prev = _context61.next) {
6224
6193
  case 0:
6225
6194
  tTotal = performance.now();
6226
- menu_list_ids = context.menu_list_ids, ids = context.ids, schedule_date = context.schedule_date, schedule_datetime = context.schedule_datetime, customer_id = context.customer_id, extension_type = context.extension_type, product_id = context.product_id;
6195
+ menu_list_ids = context.menu_list_ids, ids = context.ids, schedule_date = context.schedule_date, schedule_datetime = context.schedule_datetime, customer_id = context.customer_id, extension_type = context.extension_type, product_id = context.product_id, strategy_context = context.strategy_context;
6227
6196
  queryIds = Array.isArray(ids) ? ids.map(function (id) {
6228
6197
  return Number(id);
6229
6198
  }).filter(function (id) {
6230
6199
  return Number.isFinite(id);
6231
6200
  }) : [];
6201
+ formatterContext = this.buildProductFormatterContext({
6202
+ schedule_date: schedule_date,
6203
+ schedule_datetime: schedule_datetime,
6204
+ customer_id: customer_id,
6205
+ strategy_context: strategy_context
6206
+ });
6232
6207
  this.logInfo('computeProductQueryResult 开始', {
6233
6208
  menuListIdsCount: (_menu_list_ids$length3 = menu_list_ids === null || menu_list_ids === void 0 ? void 0 : menu_list_ids.length) !== null && _menu_list_ids$length3 !== void 0 ? _menu_list_ids$length3 : 0,
6234
6209
  ids: queryIds,
@@ -6237,37 +6212,31 @@ var Server = /*#__PURE__*/function () {
6237
6212
  customer_id: customer_id,
6238
6213
  extension_type: extension_type,
6239
6214
  product_id: product_id,
6215
+ strategyContextKeys: strategy_context ? Object.keys(strategy_context) : [],
6240
6216
  changedIds: options === null || options === void 0 ? void 0 : options.changedIds
6241
6217
  });
6242
6218
  if (this.products) {
6243
- _context61.next = 7;
6219
+ _context61.next = 8;
6244
6220
  break;
6245
6221
  }
6246
6222
  this.logError('computeProductQueryResult: Products 模块未注册');
6247
6223
  return _context61.abrupt("return", {
6248
6224
  message: 'Products 模块未注册',
6249
- data: {
6250
- list: [],
6251
- count: 0
6252
- }
6225
+ data: this.buildProductQueryResultPayload([], 0)
6253
6226
  });
6254
- case 7:
6227
+ case 8:
6255
6228
  if (!(queryIds.length > 0)) {
6256
- _context61.next = 19;
6229
+ _context61.next = 20;
6257
6230
  break;
6258
6231
  }
6259
6232
  uniqueIds = Array.from(new Set(queryIds));
6260
6233
  _tPrice = performance.now();
6261
- _context61.next = 12;
6262
- return this.products.getProductsWithPrice(schedule_date, {
6263
- scheduleModule: this.getSchedule(),
6264
- schedule_datetime: schedule_datetime,
6265
- customer_id: customer_id
6266
- }, {
6234
+ _context61.next = 13;
6235
+ return this.products.getProductsWithPrice(schedule_date, formatterContext, {
6267
6236
  changedIds: options === null || options === void 0 ? void 0 : options.changedIds,
6268
6237
  productIds: uniqueIds
6269
6238
  });
6270
- case 12:
6239
+ case 13:
6271
6240
  productsWithPrice = _context61.sent;
6272
6241
  perfMark('computeQuery.getProductsWithPrice(ids)', performance.now() - _tPrice, {
6273
6242
  count: productsWithPrice.length,
@@ -6290,27 +6259,22 @@ var Server = /*#__PURE__*/function () {
6290
6259
  });
6291
6260
  return _context61.abrupt("return", {
6292
6261
  code: 200,
6293
- data: {
6294
- list: extensionFilteredProducts,
6295
- count: extensionFilteredProducts.length
6296
- },
6262
+ data: this.buildProductQueryResultPayload(extensionFilteredProducts),
6297
6263
  message: '',
6298
6264
  status: true
6299
6265
  });
6300
- case 19:
6266
+ case 20:
6301
6267
  if (!(product_id != null && Number.isFinite(Number(product_id)))) {
6302
- _context61.next = 31;
6268
+ _context61.next = 32;
6303
6269
  break;
6304
6270
  }
6305
6271
  pid = Number(product_id);
6306
6272
  _tPrice2 = performance.now();
6307
- _context61.next = 24;
6308
- return this.products.getProductsWithPrice(schedule_date, {
6309
- scheduleModule: this.getSchedule()
6310
- }, {
6273
+ _context61.next = 25;
6274
+ return this.products.getProductsWithPrice(schedule_date, formatterContext, {
6311
6275
  changedIds: options === null || options === void 0 ? void 0 : options.changedIds
6312
6276
  });
6313
- case 24:
6277
+ case 25:
6314
6278
  allProductsWithPrice = _context61.sent;
6315
6279
  perfMark('computeQuery.getProductsWithPrice(single)', performance.now() - _tPrice2, {
6316
6280
  count: allProductsWithPrice.length,
@@ -6337,21 +6301,17 @@ var Server = /*#__PURE__*/function () {
6337
6301
  message: item ? '' : '商品不存在或未发布',
6338
6302
  status: true
6339
6303
  });
6340
- case 31:
6304
+ case 32:
6341
6305
  if (!this.shouldQueryProductsByExtensionTypes(extension_type)) {
6342
- _context61.next = 51;
6306
+ _context61.next = 52;
6343
6307
  break;
6344
6308
  }
6345
6309
  _tPrice3 = performance.now();
6346
- _context61.next = 35;
6347
- return this.products.getProductsWithPrice(schedule_date, {
6348
- scheduleModule: this.getSchedule(),
6349
- schedule_datetime: schedule_datetime,
6350
- customer_id: customer_id
6351
- }, {
6310
+ _context61.next = 36;
6311
+ return this.products.getProductsWithPrice(schedule_date, formatterContext, {
6352
6312
  changedIds: options === null || options === void 0 ? void 0 : options.changedIds
6353
6313
  });
6354
- case 35:
6314
+ case 36:
6355
6315
  _filteredProducts2 = _context61.sent;
6356
6316
  perfMark('computeQuery.getProductsWithPrice(extensionType)', performance.now() - _tPrice3, {
6357
6317
  count: _filteredProducts2.length,
@@ -6393,47 +6353,38 @@ var Server = /*#__PURE__*/function () {
6393
6353
  });
6394
6354
  return _context61.abrupt("return", {
6395
6355
  code: 200,
6396
- data: {
6397
- list: _filteredProducts2,
6398
- count: _filteredProducts2.length
6399
- },
6356
+ data: this.buildProductQueryResultPayload(_filteredProducts2),
6400
6357
  message: '',
6401
6358
  status: true
6402
6359
  });
6403
- case 51:
6360
+ case 52:
6404
6361
  if (this.menu) {
6405
- _context61.next = 54;
6362
+ _context61.next = 55;
6406
6363
  break;
6407
6364
  }
6408
6365
  this.logError('computeProductQueryResult: Menu 模块未注册');
6409
6366
  return _context61.abrupt("return", {
6410
6367
  message: 'Menu 模块未注册',
6411
- data: {
6412
- list: [],
6413
- count: 0
6414
- }
6368
+ data: this.buildProductQueryResultPayload([], 0)
6415
6369
  });
6416
- case 54:
6370
+ case 55:
6417
6371
  if (this.schedule) {
6418
- _context61.next = 57;
6372
+ _context61.next = 58;
6419
6373
  break;
6420
6374
  }
6421
6375
  this.logError('computeProductQueryResult: Schedule 模块未注册');
6422
6376
  return _context61.abrupt("return", {
6423
6377
  message: 'Schedule 模块未注册',
6424
- data: {
6425
- list: [],
6426
- count: 0
6427
- }
6378
+ data: this.buildProductQueryResultPayload([], 0)
6428
6379
  });
6429
- case 57:
6380
+ case 58:
6430
6381
  activeMenuList = [];
6431
6382
  if (menu_list_ids && Array.isArray(menu_list_ids) && menu_list_ids.length > 0) {
6432
6383
  tMenu = performance.now();
6433
6384
  menuList = this.menu.getMenuByIds(menu_list_ids);
6434
6385
  activeMenuList = menuList.filter(function (menu) {
6435
- var _this17$schedule;
6436
- return ((_this17$schedule = _this17.schedule) === null || _this17$schedule === void 0 ? void 0 : _this17$schedule.getDateIsInSchedule(schedule_datetime, menu.schedule)) || false;
6386
+ var _this18$schedule;
6387
+ return ((_this18$schedule = _this18.schedule) === null || _this18$schedule === void 0 ? void 0 : _this18$schedule.getDateIsInSchedule(schedule_datetime, menu.schedule)) || false;
6437
6388
  });
6438
6389
  perfMark('computeQuery.filterActiveMenu', performance.now() - tMenu, {
6439
6390
  totalMenu: menuList.length,
@@ -6450,25 +6401,21 @@ var Server = /*#__PURE__*/function () {
6450
6401
  });
6451
6402
  tPrice = performance.now();
6452
6403
  if (!(scopedProductIds.length > 0)) {
6453
- _context61.next = 70;
6404
+ _context61.next = 71;
6454
6405
  break;
6455
6406
  }
6456
- _context61.next = 67;
6457
- return this.products.getProductsWithPrice(schedule_date, {
6458
- scheduleModule: this.getSchedule(),
6459
- schedule_datetime: schedule_datetime,
6460
- customer_id: customer_id
6461
- }, {
6407
+ _context61.next = 68;
6408
+ return this.products.getProductsWithPrice(schedule_date, formatterContext, {
6462
6409
  changedIds: options === null || options === void 0 ? void 0 : options.changedIds,
6463
6410
  productIds: productScope.isAllProducts ? undefined : scopedProductIds
6464
6411
  });
6465
- case 67:
6412
+ case 68:
6466
6413
  _context61.t0 = _context61.sent;
6467
- _context61.next = 71;
6414
+ _context61.next = 72;
6468
6415
  break;
6469
- case 70:
6470
- _context61.t0 = [];
6471
6416
  case 71:
6417
+ _context61.t0 = [];
6418
+ case 72:
6472
6419
  filteredProducts = _context61.t0;
6473
6420
  perfMark('computeQuery.getProductsWithPrice', performance.now() - tPrice, {
6474
6421
  count: filteredProducts.length,
@@ -6512,36 +6459,54 @@ var Server = /*#__PURE__*/function () {
6512
6459
  });
6513
6460
  return _context61.abrupt("return", {
6514
6461
  code: 200,
6515
- data: {
6516
- list: filteredProducts,
6517
- count: filteredProducts.length
6518
- },
6462
+ data: this.buildProductQueryResultPayload(filteredProducts),
6519
6463
  message: '',
6520
6464
  status: true
6521
6465
  });
6522
- case 87:
6466
+ case 88:
6523
6467
  case "end":
6524
6468
  return _context61.stop();
6525
6469
  }
6526
6470
  }, _callee61, this);
6527
6471
  }));
6528
- function computeProductQueryResult(_x67, _x68) {
6472
+ function computeProductQueryResult(_x66, _x67) {
6529
6473
  return _computeProductQueryResult.apply(this, arguments);
6530
6474
  }
6531
6475
  return computeProductQueryResult;
6532
6476
  }()
6477
+ /**
6478
+ * 构建商品格式化上下文。
6479
+ *
6480
+ * 智能定价条件使用全量 menuList/scheduleList;Product Query 顶层参数只保留筛选商品集合所需字段。
6481
+ */
6482
+ )
6483
+ }, {
6484
+ key: "buildProductFormatterContext",
6485
+ value: function buildProductFormatterContext(context) {
6486
+ var _this$menu, _this$menu$getMenuLis, _scheduleModule$getSc, _this$core$context4;
6487
+ var scheduleModule = this.getSchedule();
6488
+ return {
6489
+ scheduleModule: scheduleModule,
6490
+ schedule_datetime: context.schedule_datetime,
6491
+ customer_id: context.customer_id,
6492
+ strategy_context: context.strategy_context,
6493
+ menuList: ((_this$menu = this.menu) === null || _this$menu === void 0 || (_this$menu$getMenuLis = _this$menu.getMenuList) === null || _this$menu$getMenuLis === void 0 ? void 0 : _this$menu$getMenuLis.call(_this$menu)) || [],
6494
+ scheduleList: (scheduleModule === null || scheduleModule === void 0 || (_scheduleModule$getSc = scheduleModule.getScheduleList) === null || _scheduleModule$getSc === void 0 ? void 0 : _scheduleModule$getSc.call(scheduleModule)) || [],
6495
+ dataVariantEvaluator: (_this$core$context4 = this.core.context) === null || _this$core$context4 === void 0 ? void 0 : _this$core$context4.dataVariantEvaluator
6496
+ };
6497
+ }
6498
+
6533
6499
  /**
6534
6500
  * 数据变更后,遍历所有订阅者重新计算查询结果并通过 callback 推送
6535
6501
  * 由 ProductsModule 的 onProductsSyncCompleted 事件触发
6536
6502
  * @param options 可选参数
6537
6503
  * @param options.changedIds 变更的商品 IDs,用于增量更新价格缓存
6538
6504
  */
6539
- )
6540
6505
  }, {
6541
6506
  key: "recomputeAndNotifyProductQuery",
6542
6507
  value: (function () {
6543
6508
  var _recomputeAndNotifyProductQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee62(options) {
6544
- var _iterator18, _step18, _step18$value, subscriberId, subscriber, result, errorMessage;
6509
+ var _iterator19, _step19, _step19$value, subscriberId, subscriber, result, errorMessage;
6545
6510
  return _regeneratorRuntime().wrap(function _callee62$(_context62) {
6546
6511
  while (1) switch (_context62.prev = _context62.next) {
6547
6512
  case 0:
@@ -6555,15 +6520,15 @@ var Server = /*#__PURE__*/function () {
6555
6520
  subscriberCount: this.productQuerySubscribers.size,
6556
6521
  changedIds: options === null || options === void 0 ? void 0 : options.changedIds
6557
6522
  });
6558
- _iterator18 = _createForOfIteratorHelper(this.productQuerySubscribers.entries());
6523
+ _iterator19 = _createForOfIteratorHelper(this.productQuerySubscribers.entries());
6559
6524
  _context62.prev = 4;
6560
- _iterator18.s();
6525
+ _iterator19.s();
6561
6526
  case 6:
6562
- if ((_step18 = _iterator18.n()).done) {
6527
+ if ((_step19 = _iterator19.n()).done) {
6563
6528
  _context62.next = 22;
6564
6529
  break;
6565
6530
  }
6566
- _step18$value = _slicedToArray(_step18.value, 2), subscriberId = _step18$value[0], subscriber = _step18$value[1];
6531
+ _step19$value = _slicedToArray(_step19.value, 2), subscriberId = _step19$value[0], subscriber = _step19$value[1];
6567
6532
  _context62.prev = 8;
6568
6533
  _context62.next = 11;
6569
6534
  return this.computeProductQueryResult(subscriber.context, {
@@ -6594,10 +6559,10 @@ var Server = /*#__PURE__*/function () {
6594
6559
  case 24:
6595
6560
  _context62.prev = 24;
6596
6561
  _context62.t1 = _context62["catch"](4);
6597
- _iterator18.e(_context62.t1);
6562
+ _iterator19.e(_context62.t1);
6598
6563
  case 27:
6599
6564
  _context62.prev = 27;
6600
- _iterator18.f();
6565
+ _iterator19.f();
6601
6566
  return _context62.finish(27);
6602
6567
  case 30:
6603
6568
  case "end":
@@ -6605,7 +6570,7 @@ var Server = /*#__PURE__*/function () {
6605
6570
  }
6606
6571
  }, _callee62, this, [[4, 24, 27, 30], [8, 16]]);
6607
6572
  }));
6608
- function recomputeAndNotifyProductQuery(_x69) {
6573
+ function recomputeAndNotifyProductQuery(_x68) {
6609
6574
  return _recomputeAndNotifyProductQuery.apply(this, arguments);
6610
6575
  }
6611
6576
  return recomputeAndNotifyProductQuery;
@@ -6618,7 +6583,7 @@ var Server = /*#__PURE__*/function () {
6618
6583
  key: "recomputeAndNotifyOrderQuery",
6619
6584
  value: (function () {
6620
6585
  var _recomputeAndNotifyOrderQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee63() {
6621
- var notifyStartAt, _iterator19, _step19, _step19$value, subscriberId, subscriber, computeStartAt, result, computeEndAt, callbackStartAt, callbackEndAt, errorMessage, notifyEndAt;
6586
+ var notifyStartAt, _iterator20, _step20, _step20$value, subscriberId, subscriber, computeStartAt, result, computeEndAt, callbackStartAt, callbackEndAt, errorMessage, notifyEndAt;
6622
6587
  return _regeneratorRuntime().wrap(function _callee63$(_context63) {
6623
6588
  while (1) switch (_context63.prev = _context63.next) {
6624
6589
  case 0:
@@ -6633,15 +6598,15 @@ var Server = /*#__PURE__*/function () {
6633
6598
  subscriberCount: this.orderQuerySubscribers.size,
6634
6599
  notifyStartAt: new Date(notifyStartAt).toISOString()
6635
6600
  });
6636
- _iterator19 = _createForOfIteratorHelper(this.orderQuerySubscribers.entries());
6601
+ _iterator20 = _createForOfIteratorHelper(this.orderQuerySubscribers.entries());
6637
6602
  _context63.prev = 5;
6638
- _iterator19.s();
6603
+ _iterator20.s();
6639
6604
  case 7:
6640
- if ((_step19 = _iterator19.n()).done) {
6605
+ if ((_step20 = _iterator20.n()).done) {
6641
6606
  _context63.next = 27;
6642
6607
  break;
6643
6608
  }
6644
- _step19$value = _slicedToArray(_step19.value, 2), subscriberId = _step19$value[0], subscriber = _step19$value[1];
6609
+ _step20$value = _slicedToArray(_step20.value, 2), subscriberId = _step20$value[0], subscriber = _step20$value[1];
6645
6610
  _context63.prev = 9;
6646
6611
  computeStartAt = Date.now();
6647
6612
  _context63.next = 13;
@@ -6677,10 +6642,10 @@ var Server = /*#__PURE__*/function () {
6677
6642
  case 29:
6678
6643
  _context63.prev = 29;
6679
6644
  _context63.t1 = _context63["catch"](5);
6680
- _iterator19.e(_context63.t1);
6645
+ _iterator20.e(_context63.t1);
6681
6646
  case 32:
6682
6647
  _context63.prev = 32;
6683
- _iterator19.f();
6648
+ _iterator20.f();
6684
6649
  return _context63.finish(32);
6685
6650
  case 35:
6686
6651
  notifyEndAt = Date.now();
@@ -6710,7 +6675,7 @@ var Server = /*#__PURE__*/function () {
6710
6675
  }, {
6711
6676
  key: "notifySalesSearchSubscribers",
6712
6677
  value: function notifySalesSearchSubscribers(payload) {
6713
- var _this18 = this;
6678
+ var _this19 = this;
6714
6679
  if (this.salesSearchSubscribers.size === 0) return;
6715
6680
  var changedOrders = this.extractChangedOrdersFromPayload(payload);
6716
6681
  if (changedOrders.length === 0) {
@@ -6719,42 +6684,42 @@ var Server = /*#__PURE__*/function () {
6719
6684
  // 如果当前开启了 checkout 弹窗,先不进行刷新,下面的代码会导致在全局搜索页调用 bookingTicket.destroy()
6720
6685
  // 导致模块被销毁 ,checkout 弹窗永远无法关闭
6721
6686
  if (window.isPaymentModalPluginOpen) return;
6722
- var _iterator20 = _createForOfIteratorHelper(this.salesSearchSubscribers.entries()),
6723
- _step20;
6687
+ var _iterator21 = _createForOfIteratorHelper(this.salesSearchSubscribers.entries()),
6688
+ _step21;
6724
6689
  try {
6725
- var _loop = function _loop() {
6726
- var _step20$value = _slicedToArray(_step20.value, 2),
6727
- subscriberId = _step20$value[0],
6728
- subscriber = _step20$value[1];
6690
+ var _loop2 = function _loop2() {
6691
+ var _step21$value = _slicedToArray(_step21.value, 2),
6692
+ subscriberId = _step21$value[0],
6693
+ subscriber = _step21$value[1];
6729
6694
  try {
6730
6695
  var changedVisibleOrders = changedOrders.filter(function (order) {
6731
- var orderId = _this18.getSalesSearchOrderId(order);
6696
+ var orderId = _this19.getSalesSearchOrderId(order);
6732
6697
  return !!orderId && subscriber.visibleOrderIds.has(orderId);
6733
6698
  });
6734
6699
  if (changedVisibleOrders.length === 0) {
6735
6700
  return 1; // continue
6736
6701
  }
6737
- subscriber.callback(_this18.buildSalesSearchDeltaResponse(subscriber, changedVisibleOrders));
6738
- _this18.logInfo('notifySalesSearchSubscribers: 已推送 delta', {
6702
+ subscriber.callback(_this19.buildSalesSearchDeltaResponse(subscriber, changedVisibleOrders));
6703
+ _this19.logInfo('notifySalesSearchSubscribers: 已推送 delta', {
6739
6704
  subscriberId: subscriberId,
6740
6705
  kind: subscriber.kind,
6741
6706
  count: changedVisibleOrders.length
6742
6707
  });
6743
6708
  } catch (error) {
6744
6709
  var errorMessage = error instanceof Error ? error.message : String(error);
6745
- _this18.logError('notifySalesSearchSubscribers: 推送失败', {
6710
+ _this19.logError('notifySalesSearchSubscribers: 推送失败', {
6746
6711
  subscriberId: subscriberId,
6747
6712
  error: errorMessage
6748
6713
  });
6749
6714
  }
6750
6715
  };
6751
- for (_iterator20.s(); !(_step20 = _iterator20.n()).done;) {
6752
- if (_loop()) continue;
6716
+ for (_iterator21.s(); !(_step21 = _iterator21.n()).done;) {
6717
+ if (_loop2()) continue;
6753
6718
  }
6754
6719
  } catch (err) {
6755
- _iterator20.e(err);
6720
+ _iterator21.e(err);
6756
6721
  } finally {
6757
- _iterator20.f();
6722
+ _iterator21.f();
6758
6723
  }
6759
6724
  }
6760
6725
 
@@ -6834,7 +6799,7 @@ var Server = /*#__PURE__*/function () {
6834
6799
  key: "recomputeAndNotifyBookingQuery",
6835
6800
  value: (function () {
6836
6801
  var _recomputeAndNotifyBookingQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee64() {
6837
- var _iterator21, _step21, _step21$value, subscriberId, subscriber, result, errorMessage;
6802
+ var _iterator22, _step22, _step22$value, subscriberId, subscriber, result, errorMessage;
6838
6803
  return _regeneratorRuntime().wrap(function _callee64$(_context64) {
6839
6804
  while (1) switch (_context64.prev = _context64.next) {
6840
6805
  case 0:
@@ -6847,15 +6812,15 @@ var Server = /*#__PURE__*/function () {
6847
6812
  this.logInfo('recomputeAndNotifyBookingQuery: 开始推送', {
6848
6813
  subscriberCount: this.bookingQuerySubscribers.size
6849
6814
  });
6850
- _iterator21 = _createForOfIteratorHelper(this.bookingQuerySubscribers.entries());
6815
+ _iterator22 = _createForOfIteratorHelper(this.bookingQuerySubscribers.entries());
6851
6816
  _context64.prev = 4;
6852
- _iterator21.s();
6817
+ _iterator22.s();
6853
6818
  case 6:
6854
- if ((_step21 = _iterator21.n()).done) {
6819
+ if ((_step22 = _iterator22.n()).done) {
6855
6820
  _context64.next = 22;
6856
6821
  break;
6857
6822
  }
6858
- _step21$value = _slicedToArray(_step21.value, 2), subscriberId = _step21$value[0], subscriber = _step21$value[1];
6823
+ _step22$value = _slicedToArray(_step22.value, 2), subscriberId = _step22$value[0], subscriber = _step22$value[1];
6859
6824
  _context64.prev = 8;
6860
6825
  _context64.next = 11;
6861
6826
  return this.computeBookingQueryResult(subscriber.context);
@@ -6884,10 +6849,10 @@ var Server = /*#__PURE__*/function () {
6884
6849
  case 24:
6885
6850
  _context64.prev = 24;
6886
6851
  _context64.t1 = _context64["catch"](4);
6887
- _iterator21.e(_context64.t1);
6852
+ _iterator22.e(_context64.t1);
6888
6853
  case 27:
6889
6854
  _context64.prev = 27;
6890
- _iterator21.f();
6855
+ _iterator22.f();
6891
6856
  return _context64.finish(27);
6892
6857
  case 30:
6893
6858
  case "end":
@@ -6923,11 +6888,11 @@ var Server = /*#__PURE__*/function () {
6923
6888
  var allowedProductIds = new Set();
6924
6889
  var allowedCollectionIds = new Set();
6925
6890
  var hasProductAll = false;
6926
- var _iterator22 = _createForOfIteratorHelper(activeMenuList),
6927
- _step22;
6891
+ var _iterator23 = _createForOfIteratorHelper(activeMenuList),
6892
+ _step23;
6928
6893
  try {
6929
- for (_iterator22.s(); !(_step22 = _iterator22.n()).done;) {
6930
- var menu = _step22.value;
6894
+ for (_iterator23.s(); !(_step23 = _iterator23.n()).done;) {
6895
+ var menu = _step23.value;
6931
6896
  var config = menu.partyroom_package;
6932
6897
  if (!config) {
6933
6898
  console.warn('[Server] 餐牌缺少 partyroom_package 配置:', menu);
@@ -6987,9 +6952,9 @@ var Server = /*#__PURE__*/function () {
6987
6952
 
6988
6953
  // 如果有餐牌允许所有商品,返回所有商品
6989
6954
  } catch (err) {
6990
- _iterator22.e(err);
6955
+ _iterator23.e(err);
6991
6956
  } finally {
6992
- _iterator22.f();
6957
+ _iterator23.f();
6993
6958
  }
6994
6959
  if (hasProductAll) {
6995
6960
  this.logInfo('getProductScopeByMenuConfig: 返回所有商品 scope(product_all)');