@pisell/pisellos 2.2.273 → 2.2.274

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 (105) hide show
  1. package/dist/core/index.d.ts +0 -2
  2. package/dist/core/index.js +0 -7
  3. package/dist/model/strategy/adapter/promotion/adapter.d.ts +0 -4
  4. package/dist/model/strategy/adapter/promotion/adapter.js +0 -23
  5. package/dist/model/strategy/adapter/promotion/evaluator.d.ts +0 -17
  6. package/dist/model/strategy/adapter/promotion/evaluator.js +6 -279
  7. package/dist/model/strategy/adapter/promotion/examples.d.ts +0 -86
  8. package/dist/model/strategy/adapter/promotion/examples.js +0 -99
  9. package/dist/model/strategy/adapter/promotion/index.d.ts +1 -1
  10. package/dist/model/strategy/adapter/promotion/index.js +9 -0
  11. package/dist/model/strategy/adapter/promotion/type.d.ts +2 -90
  12. package/dist/model/strategy/adapter/promotion/type.js +0 -45
  13. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +12 -10
  14. package/dist/modules/OpenData/index.d.ts +0 -2
  15. package/dist/modules/OpenData/index.js +0 -8
  16. package/dist/modules/Order/index.d.ts +13 -32
  17. package/dist/modules/Order/index.js +555 -771
  18. package/dist/modules/Order/types.d.ts +22 -36
  19. package/dist/modules/Order/types.js +11 -0
  20. package/dist/modules/Order/utils/orderCollectionIdentity.js +2 -7
  21. package/dist/modules/Order/utils.js +6 -10
  22. package/dist/modules/Payment/index.d.ts +0 -2
  23. package/dist/modules/Payment/index.js +50 -79
  24. package/dist/modules/Payment/types.d.ts +27 -29
  25. package/dist/modules/Payment/types.js +3 -5
  26. package/dist/modules/Rules/index.d.ts +0 -1
  27. package/dist/modules/Rules/index.js +39 -55
  28. package/dist/modules/SalesSummary/utils.js +7 -1
  29. package/dist/server/index.d.ts +0 -16
  30. package/dist/server/index.js +1036 -1933
  31. package/dist/server/modules/order/index.d.ts +4 -54
  32. package/dist/server/modules/order/index.js +695 -1595
  33. package/dist/server/modules/order/types.d.ts +3 -11
  34. package/dist/server/modules/order/types.js +1 -1
  35. package/dist/solution/BaseSales/index.d.ts +25 -59
  36. package/dist/solution/BaseSales/index.js +490 -767
  37. package/dist/solution/BaseSales/utils/cartPromotion.d.ts +1 -3
  38. package/dist/solution/BaseSales/utils/cartPromotion.js +36 -93
  39. package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +1 -6
  40. package/dist/solution/BookingByStep/index.d.ts +1 -1
  41. package/dist/solution/BookingTicket/index.d.ts +5 -21
  42. package/dist/solution/BookingTicket/index.js +49 -126
  43. package/dist/solution/BookingTicket/types.d.ts +3 -0
  44. package/dist/solution/BookingTicket/utils/cartView.js +44 -32
  45. package/dist/solution/Sales/index.d.ts +0 -1
  46. package/dist/solution/Sales/index.js +2 -10
  47. package/dist/solution/ScanOrder/index.js +20 -31
  48. package/dist/solution/VenueBooking/index.js +19 -30
  49. package/dist/types/index.d.ts +0 -1
  50. package/lib/core/index.d.ts +0 -2
  51. package/lib/core/index.js +0 -4
  52. package/lib/model/strategy/adapter/promotion/adapter.d.ts +0 -4
  53. package/lib/model/strategy/adapter/promotion/adapter.js +0 -20
  54. package/lib/model/strategy/adapter/promotion/evaluator.d.ts +0 -17
  55. package/lib/model/strategy/adapter/promotion/evaluator.js +0 -235
  56. package/lib/model/strategy/adapter/promotion/examples.d.ts +0 -86
  57. package/lib/model/strategy/adapter/promotion/examples.js +0 -91
  58. package/lib/model/strategy/adapter/promotion/index.d.ts +1 -1
  59. package/lib/model/strategy/adapter/promotion/index.js +0 -2
  60. package/lib/model/strategy/adapter/promotion/type.d.ts +2 -90
  61. package/lib/model/strategy/adapter/promotion/type.js +0 -2
  62. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +3 -1
  63. package/lib/modules/OpenData/index.d.ts +0 -2
  64. package/lib/modules/OpenData/index.js +0 -5
  65. package/lib/modules/Order/index.d.ts +13 -32
  66. package/lib/modules/Order/index.js +142 -201
  67. package/lib/modules/Order/types.d.ts +22 -36
  68. package/lib/modules/Order/utils/orderCollectionIdentity.js +0 -3
  69. package/lib/modules/Order/utils.js +4 -11
  70. package/lib/modules/Payment/index.d.ts +0 -2
  71. package/lib/modules/Payment/index.js +13 -34
  72. package/lib/modules/Payment/types.d.ts +27 -29
  73. package/lib/modules/Payment/types.js +3 -3
  74. package/lib/modules/Rules/index.d.ts +0 -1
  75. package/lib/modules/Rules/index.js +22 -41
  76. package/lib/modules/SalesSummary/utils.js +5 -1
  77. package/lib/server/index.d.ts +0 -16
  78. package/lib/server/index.js +18 -670
  79. package/lib/server/modules/order/index.d.ts +4 -54
  80. package/lib/server/modules/order/index.js +66 -679
  81. package/lib/server/modules/order/types.d.ts +3 -11
  82. package/lib/solution/BaseSales/index.d.ts +25 -59
  83. package/lib/solution/BaseSales/index.js +79 -246
  84. package/lib/solution/BaseSales/utils/cartPromotion.d.ts +1 -3
  85. package/lib/solution/BaseSales/utils/cartPromotion.js +17 -65
  86. package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +1 -6
  87. package/lib/solution/BookingByStep/index.d.ts +1 -1
  88. package/lib/solution/BookingTicket/index.d.ts +5 -21
  89. package/lib/solution/BookingTicket/index.js +8 -59
  90. package/lib/solution/BookingTicket/types.d.ts +3 -0
  91. package/lib/solution/BookingTicket/utils/cartView.js +43 -30
  92. package/lib/solution/Sales/index.d.ts +0 -1
  93. package/lib/solution/Sales/index.js +3 -5
  94. package/lib/solution/ScanOrder/index.js +0 -8
  95. package/lib/solution/VenueBooking/index.js +0 -8
  96. package/lib/types/index.d.ts +0 -1
  97. package/package.json +1 -1
  98. package/dist/modules/Order/payment-utils.d.ts +0 -26
  99. package/dist/modules/Order/payment-utils.js +0 -225
  100. package/dist/utils/payment-number.d.ts +0 -9
  101. package/dist/utils/payment-number.js +0 -69
  102. package/lib/modules/Order/payment-utils.d.ts +0 -26
  103. package/lib/modules/Order/payment-utils.js +0 -224
  104. package/lib/utils/payment-number.d.ts +0 -9
  105. package/lib/utils/payment-number.js +0 -64
@@ -337,10 +337,11 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
337
337
  key: "getOpenData",
338
338
  value: function () {
339
339
  var _getOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
340
+ var _this$store$openData;
340
341
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
341
342
  while (1) switch (_context3.prev = _context3.next) {
342
343
  case 0:
343
- return _context3.abrupt("return", this.loadOpenDataConfig());
344
+ return _context3.abrupt("return", (_this$store$openData = this.store.openData) === null || _this$store$openData === void 0 ? void 0 : _this$store$openData.getOpenData());
344
345
  case 1:
345
346
  case "end":
346
347
  return _context3.stop();
@@ -351,15 +352,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
351
352
  return _getOpenData.apply(this, arguments);
352
353
  }
353
354
  return getOpenData;
354
- }() /** 清除店铺级 OpenData;下一次 getOpenData 时会重新拉取。 */
355
- }, {
356
- key: "clearOpenDataCache",
357
- value: function clearOpenDataCache() {
358
- var _this$store$openData;
359
- this.loadOpenDataConfigInFlight = null;
360
- this.otherParams.openData = null;
361
- (_this$store$openData = this.store.openData) === null || _this$store$openData === void 0 || _this$store$openData.clearCache();
362
- }
355
+ }()
363
356
  }, {
364
357
  key: "getShortNumberOrDeviceId",
365
358
  value: function () {
@@ -404,52 +397,49 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
404
397
  return _regeneratorRuntime().wrap(function _callee5$(_context5) {
405
398
  while (1) switch (_context5.prev = _context5.next) {
406
399
  case 0:
407
- // 业务码切换或配置失败时不能复用上一次初始化的短号。
408
- this.setPaymentNumberDevicePrefix(null);
409
400
  openDataConfig = null;
410
- _context5.prev = 2;
411
- _context5.next = 5;
401
+ _context5.prev = 1;
402
+ _context5.next = 4;
412
403
  return this.loadOpenDataConfig();
413
- case 5:
404
+ case 4:
414
405
  openDataConfig = _context5.sent;
415
- _context5.next = 12;
406
+ _context5.next = 11;
416
407
  break;
417
- case 8:
418
- _context5.prev = 8;
419
- _context5.t0 = _context5["catch"](2);
408
+ case 7:
409
+ _context5.prev = 7;
410
+ _context5.t0 = _context5["catch"](1);
420
411
  console.warn('[BookingTicket] OpenData 配置加载失败,跳过 idGenerator 配置', _context5.t0);
421
412
  return _context5.abrupt("return");
422
- case 12:
413
+ case 11:
423
414
  // if (!openDataConfig) return;
424
415
  idGenerator = this.getIdGeneratorPlugin();
425
416
  if (idGenerator !== null && idGenerator !== void 0 && idGenerator.configure) {
426
- _context5.next = 16;
417
+ _context5.next = 15;
427
418
  break;
428
419
  }
429
420
  console.warn('[BookingTicket] idGenerator 插件不可用,跳过配置');
430
421
  return _context5.abrupt("return");
431
- case 16:
422
+ case 15:
432
423
  receiptSequenceLength = this.normalizePositiveInteger((_openDataConfig = openDataConfig) === null || _openDataConfig === void 0 ? void 0 : _openDataConfig['sale.short_number_digits'], 5);
433
424
  receiptSequenceStart = this.normalizePositiveInteger((_openDataConfig2 = openDataConfig) === null || _openDataConfig2 === void 0 ? void 0 : _openDataConfig2['sale.short_number_start_number'], 1);
434
425
  prefix = this.normalizeIdPrefix((_openDataConfig3 = openDataConfig) === null || _openDataConfig3 === void 0 ? void 0 : _openDataConfig3['sale.short_number_prefix'], '');
435
426
  shopOrderPrefix = this.normalizeIdPrefix((_openDataConfig4 = openDataConfig) === null || _openDataConfig4 === void 0 ? void 0 : _openDataConfig4['sale.sale_number_prefix'], '');
436
427
  resetReceiptSequenceDaily = typeof ((_openDataConfig5 = openDataConfig) === null || _openDataConfig5 === void 0 ? void 0 : _openDataConfig5['sale.short_number_daily_reset']) === 'boolean' ? (_openDataConfig6 = openDataConfig) === null || _openDataConfig6 === void 0 ? void 0 : _openDataConfig6['sale.short_number_daily_reset'] : false;
437
428
  operatingDayBoundary = this.getAppData('operating_day_boundary');
438
- _context5.next = 24;
429
+ _context5.next = 23;
439
430
  return this.getShortNumberOrDeviceId();
440
- case 24:
431
+ case 23:
441
432
  deviceId = _context5.sent;
442
- this.setPaymentNumberDevicePrefix(deviceId);
443
433
  businessCode = this.getBookingTicketBusinessCode();
444
434
  if (businessCode) {
445
- _context5.next = 30;
435
+ _context5.next = 28;
446
436
  break;
447
437
  }
448
438
  console.warn('[BookingTicket] businessCode 缺失,跳过 idGenerator 配置');
449
439
  return _context5.abrupt("return");
450
- case 30:
451
- _context5.prev = 30;
452
- _context5.next = 33;
440
+ case 28:
441
+ _context5.prev = 28;
442
+ _context5.next = 31;
453
443
  return idGenerator.configure({
454
444
  biz: businessCode,
455
445
  config: {
@@ -464,18 +454,18 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
464
454
  shopOrderPrefix: shopOrderPrefix
465
455
  }
466
456
  });
467
- case 33:
468
- _context5.next = 38;
457
+ case 31:
458
+ _context5.next = 36;
469
459
  break;
470
- case 35:
471
- _context5.prev = 35;
472
- _context5.t1 = _context5["catch"](30);
460
+ case 33:
461
+ _context5.prev = 33;
462
+ _context5.t1 = _context5["catch"](28);
473
463
  console.warn('[BookingTicket] idGenerator 配置失败', _context5.t1);
474
- case 38:
464
+ case 36:
475
465
  case "end":
476
466
  return _context5.stop();
477
467
  }
478
- }, _callee5, this, [[2, 8], [30, 35]]);
468
+ }, _callee5, this, [[1, 7], [28, 33]]);
479
469
  }));
480
470
  function configureIdGeneratorFromOpenData() {
481
471
  return _configureIdGeneratorFromOpenData.apply(this, arguments);
@@ -1270,88 +1260,24 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1270
1260
  }
1271
1261
 
1272
1262
  /**
1273
- * 通过 ids 获取商品列表;默认只读取内存,显式开启 loadMissing 时按当前订单上下文补查缺失商品。
1274
- * 补查直接写入 ProductList,不更新 BookingTicket.productCatalog,避免当前商品列表被查询子集覆盖。
1263
+ * 通过 ids 获取商品列表(不加载到模块中)
1264
+ * @returns 商品列表
1275
1265
  */
1276
1266
  }, {
1277
1267
  key: "getProductByIds",
1278
1268
  value: (function () {
1279
- var _getProductByIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(ids, options) {
1280
- var _this$getOrderCustome, _this$getOrderCustome2, _this$getOrderCustome3;
1281
- var normalizedIds, localProducts, localProductIds, missingIds, rawBookingDate, bookingDate, customerId, loadedProducts, productById;
1269
+ var _getProductByIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(ids) {
1282
1270
  return _regeneratorRuntime().wrap(function _callee18$(_context18) {
1283
1271
  while (1) switch (_context18.prev = _context18.next) {
1284
1272
  case 0:
1285
- normalizedIds = Array.from(new Set((ids || []).map(function (id) {
1286
- return Number(id);
1287
- }).filter(function (id) {
1288
- return Number.isFinite(id);
1289
- })));
1290
- _context18.next = 3;
1291
- return this.store.products.getProductByIds(normalizedIds);
1292
- case 3:
1293
- _context18.t0 = _context18.sent;
1294
- if (_context18.t0) {
1295
- _context18.next = 6;
1296
- break;
1297
- }
1298
- _context18.t0 = [];
1299
- case 6:
1300
- localProducts = _context18.t0;
1301
- if (options !== null && options !== void 0 && options.loadMissing) {
1302
- _context18.next = 9;
1303
- break;
1304
- }
1305
- return _context18.abrupt("return", localProducts);
1306
- case 9:
1307
- localProductIds = new Set(localProducts.map(function (product) {
1308
- return Number(product.id);
1309
- }));
1310
- missingIds = normalizedIds.filter(function (id) {
1311
- return !localProductIds.has(id);
1312
- });
1313
- if (missingIds.length) {
1314
- _context18.next = 13;
1315
- break;
1316
- }
1317
- return _context18.abrupt("return", localProducts);
1318
- case 13:
1319
- rawBookingDate = this.getBookingDate();
1320
- bookingDate = rawBookingDate && dayjs(rawBookingDate).isValid() ? dayjs(rawBookingDate) : null;
1321
- customerId = Number((_this$getOrderCustome = (_this$getOrderCustome2 = this.getOrderCustomerSnapshot()) === null || _this$getOrderCustome2 === void 0 ? void 0 : _this$getOrderCustome2.id) !== null && _this$getOrderCustome !== void 0 ? _this$getOrderCustome : (_this$getOrderCustome3 = this.getOrderCustomer()) === null || _this$getOrderCustome3 === void 0 ? void 0 : _this$getOrderCustome3.customer_id);
1322
- _context18.next = 18;
1323
- return this.store.products.loadProducts(_objectSpread(_objectSpread({
1324
- product_ids: missingIds,
1325
- with_count: ['bundleGroup', 'optionGroup'],
1326
- with_schedule: 1,
1327
- cacheId: this.cacheId
1328
- }, bookingDate ? {
1329
- schedule_date: bookingDate.format('YYYY-MM-DD'),
1330
- schedule_datetime: bookingDate.format('YYYY-MM-DD HH:mm:ss')
1331
- } : {}), Number.isFinite(customerId) && customerId > 0 ? {
1332
- customer_id: customerId
1333
- } : {}));
1334
- case 18:
1335
- loadedProducts = _context18.sent;
1336
- productById = new Map();
1337
- [].concat(_toConsumableArray(localProducts), _toConsumableArray(loadedProducts || [])).forEach(function (product) {
1338
- var productId = Number(product.id);
1339
- if (Number.isFinite(productId)) {
1340
- productById.set(productId, product);
1341
- }
1342
- });
1343
- return _context18.abrupt("return", normalizedIds.map(function (id) {
1344
- return productById.get(id);
1345
- }).filter(function (product) {
1346
- return Boolean(product);
1347
- }));
1348
- case 22:
1273
+ return _context18.abrupt("return", this.store.products.getProductByIds(ids));
1274
+ case 1:
1349
1275
  case "end":
1350
1276
  return _context18.stop();
1351
1277
  }
1352
1278
  }, _callee18, this);
1353
1279
  }));
1354
- function getProductByIds(_x13, _x14) {
1280
+ function getProductByIds(_x13) {
1355
1281
  return _getProductByIds.apply(this, arguments);
1356
1282
  }
1357
1283
  return getProductByIds;
@@ -1385,7 +1311,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1385
1311
  }
1386
1312
  }, _callee19, this);
1387
1313
  }));
1388
- function getScheduleTimePoints(_x15) {
1314
+ function getScheduleTimePoints(_x14) {
1389
1315
  return _getScheduleTimePoints.apply(this, arguments);
1390
1316
  }
1391
1317
  return getScheduleTimePoints;
@@ -1775,7 +1701,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1775
1701
  }
1776
1702
  }, _callee23, this, [[0, 7]]);
1777
1703
  }));
1778
- function changeCustomerPage(_x16, _x17) {
1704
+ function changeCustomerPage(_x15, _x16) {
1779
1705
  return _changeCustomerPage.apply(this, arguments);
1780
1706
  }
1781
1707
  return changeCustomerPage;
@@ -2067,8 +1993,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2067
1993
  }, {
2068
1994
  key: "getBookingConfig",
2069
1995
  value: function getBookingConfig() {
2070
- var _this$store$bookingCo;
2071
- return (_this$store$bookingCo = this.store.bookingContext) === null || _this$store$bookingCo === void 0 ? void 0 : _this$store$bookingCo.getBookingConfig();
1996
+ return this.store.bookingContext.getBookingConfig();
2072
1997
  }
2073
1998
 
2074
1999
  /** 写入资源全集(来源:`/form/schedule`),同步派生 resourcesOriginMap。 */
@@ -2229,10 +2154,10 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2229
2154
  }, {
2230
2155
  key: "buildAddProductCtx",
2231
2156
  value: function buildAddProductCtx(extra) {
2232
- var _extra$date2, _ref12, _this$getOrderCustome4, _this$getOrderCustome5, _this$store$order$get4, _extra$presetStartTim2;
2157
+ var _extra$date2, _ref12, _this$getOrderCustome, _this$getOrderCustome2, _this$store$order$get4, _extra$presetStartTim2;
2233
2158
  var bookingContextState = this.store.bookingContext.getState();
2234
2159
  var date = (_extra$date2 = extra === null || extra === void 0 ? void 0 : extra.date) !== null && _extra$date2 !== void 0 ? _extra$date2 : bookingContextState.date;
2235
- var orderCustomerId = (_ref12 = (_this$getOrderCustome4 = (_this$getOrderCustome5 = this.getOrderCustomerSnapshot()) === null || _this$getOrderCustome5 === void 0 ? void 0 : _this$getOrderCustome5.id) !== null && _this$getOrderCustome4 !== void 0 ? _this$getOrderCustome4 : (_this$store$order$get4 = this.store.order.getTempOrder()) === null || _this$store$order$get4 === void 0 ? void 0 : _this$store$order$get4.customer_id) !== null && _ref12 !== void 0 ? _ref12 : undefined;
2160
+ var orderCustomerId = (_ref12 = (_this$getOrderCustome = (_this$getOrderCustome2 = this.getOrderCustomerSnapshot()) === null || _this$getOrderCustome2 === void 0 ? void 0 : _this$getOrderCustome2.id) !== null && _this$getOrderCustome !== void 0 ? _this$getOrderCustome : (_this$store$order$get4 = this.store.order.getTempOrder()) === null || _this$store$order$get4 === void 0 ? void 0 : _this$store$order$get4.customer_id) !== null && _ref12 !== void 0 ? _ref12 : undefined;
2236
2161
  return _objectSpread({
2237
2162
  bookingConfig: bookingContextState.bookingConfig,
2238
2163
  resourcesOrigin: bookingContextState.resourcesOrigin,
@@ -2349,7 +2274,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2349
2274
  }
2350
2275
  }, _callee27, this);
2351
2276
  }));
2352
- function updateProductInOrder(_x18) {
2277
+ function updateProductInOrder(_x17) {
2353
2278
  return _updateProductInOrder.apply(this, arguments);
2354
2279
  }
2355
2280
  return updateProductInOrder;
@@ -2458,7 +2383,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2458
2383
  }
2459
2384
  }, _callee28, this, [[4, 21]]);
2460
2385
  }));
2461
- function handleGlobalScanCode(_x19, _x20) {
2386
+ function handleGlobalScanCode(_x18, _x19) {
2462
2387
  return _handleGlobalScanCode.apply(this, arguments);
2463
2388
  }
2464
2389
  return handleGlobalScanCode;
@@ -2556,7 +2481,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2556
2481
  }
2557
2482
  }, _callee29, this);
2558
2483
  }));
2559
- function addAddTimeProductToBooking(_x21) {
2484
+ function addAddTimeProductToBooking(_x20) {
2560
2485
  return _addAddTimeProductToBooking.apply(this, arguments);
2561
2486
  }
2562
2487
  return addAddTimeProductToBooking;
@@ -2659,7 +2584,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2659
2584
  }
2660
2585
  }, _callee30, this, [[13, 31, 34, 37]]);
2661
2586
  }));
2662
- function addAddTimeProductsToBooking(_x22) {
2587
+ function addAddTimeProductsToBooking(_x21) {
2663
2588
  return _addAddTimeProductsToBooking.apply(this, arguments);
2664
2589
  }
2665
2590
  return addAddTimeProductsToBooking;
@@ -2676,24 +2601,22 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2676
2601
  while (1) switch (_context31.prev = _context31.next) {
2677
2602
  case 0:
2678
2603
  _ref19 = _args31.length > 1 && _args31[1] !== undefined ? _args31[1] : {}, _ref19$cover = _ref19.cover, cover = _ref19$cover === void 0 ? false : _ref19$cover;
2679
- _context31.next = 3;
2680
- return _get(_getPrototypeOf(BookingTicketImpl.prototype), "setOtherParams", this).call(this, params, {
2604
+ _get(_getPrototypeOf(BookingTicketImpl.prototype), "setOtherParams", this).call(this, params, {
2681
2605
  cover: cover
2682
2606
  });
2683
- case 3:
2684
- if (!((params === null || params === void 0 ? void 0 : params.businessCode) !== undefined || (params === null || params === void 0 ? void 0 : params.business_code) !== undefined)) {
2685
- _context31.next = 6;
2607
+ if (!(params !== null && params !== void 0 && params.businessCode)) {
2608
+ _context31.next = 5;
2686
2609
  break;
2687
2610
  }
2688
- _context31.next = 6;
2611
+ _context31.next = 5;
2689
2612
  return this.configureIdGeneratorFromOpenData();
2690
- case 6:
2613
+ case 5:
2691
2614
  case "end":
2692
2615
  return _context31.stop();
2693
2616
  }
2694
2617
  }, _callee31, this);
2695
2618
  }));
2696
- function setOtherParams(_x23) {
2619
+ function setOtherParams(_x22) {
2697
2620
  return _setOtherParams.apply(this, arguments);
2698
2621
  }
2699
2622
  return setOtherParams;
@@ -2764,7 +2687,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2764
2687
  }
2765
2688
  }, _callee32, this);
2766
2689
  }));
2767
- function handlePrintWristband(_x24) {
2690
+ function handlePrintWristband(_x23) {
2768
2691
  return _handlePrintWristband.apply(this, arguments);
2769
2692
  }
2770
2693
  return handlePrintWristband;
@@ -2839,7 +2762,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2839
2762
  }
2840
2763
  }, _callee33, this);
2841
2764
  }));
2842
- function handleRedeem(_x25) {
2765
+ function handleRedeem(_x24) {
2843
2766
  return _handleRedeem.apply(this, arguments);
2844
2767
  }
2845
2768
  return handleRedeem;
@@ -118,12 +118,15 @@ export interface BookingTicketCartBookingView extends ISalesBooking {
118
118
  canAddTime: boolean;
119
119
  };
120
120
  }
121
+ export type BookingTicketCartLineView = BookingTicketCartBookingView | BookingTicketCartItemView;
121
122
  /**
122
123
  * BookingTicket 面向 UI 的购物车视图。
123
124
  */
124
125
  export interface BookingTicketCartView {
125
126
  bookings: BookingTicketCartBookingView[];
126
127
  items: BookingTicketCartItemView[];
128
+ /** 以 tempOrder.products 为唯一顺序真源的统一购物车行(旧到新)。 */
129
+ lines: BookingTicketCartLineView[];
127
130
  }
128
131
  /**
129
132
  * BookingTicket 面向 UI 的客户展示视图。
@@ -108,33 +108,28 @@ export function buildCartView(lines, bookings) {
108
108
  var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
109
109
  var productLines = Array.isArray(lines) ? lines : [];
110
110
  var bookingList = Array.isArray(bookings) ? bookings : [];
111
+ var childBookings = bookingList.filter(function (booking) {
112
+ return booking.parent_id !== 0;
113
+ });
114
+ var bookingsByProductUid = indexBookingsByProductUid(childBookings);
111
115
  var linesByUid = indexProductsByUid(productLines);
112
116
  var addTimeLinesByBookingUid = indexAddTimeProductsByBookingUid(productLines);
113
- var claimedUids = new Set();
114
117
  var claimedAddTimeLines = new Set();
115
- var cartBookings = bookingList.filter(function (booking) {
116
- return booking.parent_id !== 0;
117
- }).reduce(function (acc, booking) {
118
- var uid = booking === null || booking === void 0 ? void 0 : booking.product_uid;
118
+ childBookings.forEach(function (booking) {
119
119
  var bookingUid = getBookingUid(booking);
120
- var product = null;
121
- if (uid !== undefined && uid !== null && uid !== '') {
122
- var key = String(uid);
123
- if (!claimedUids.has(key)) {
124
- var line = linesByUid[key];
125
- // 赠品预约只作为提交数据保留,不在购物车顶部预约卡片区展示。
126
- if (isGiftProductLine(line)) return acc;
127
- if (line) {
128
- claimedUids.add(key);
129
- product = line;
130
- }
131
- }
132
- }
133
- var addTimeProduct = bookingUid ? addTimeLinesByBookingUid[bookingUid] || [] : [];
134
- addTimeProduct.forEach(function (line) {
135
- return claimedAddTimeLines.add(line);
120
+ if (!bookingUid) return;
121
+ (addTimeLinesByBookingUid[bookingUid] || []).forEach(function (line) {
122
+ claimedAddTimeLines.add(line);
136
123
  });
137
- acc.push(_objectSpread(_objectSpread({}, booking), {}, {
124
+ });
125
+ var claimedBookings = new Set();
126
+ var cartBookings = [];
127
+ var items = [];
128
+ var orderedLines = [];
129
+ var buildBookingView = function buildBookingView(booking, product) {
130
+ var bookingUid = getBookingUid(booking);
131
+ var addTimeProduct = bookingUid ? addTimeLinesByBookingUid[bookingUid] || [] : [];
132
+ return _objectSpread(_objectSpread({}, booking), {}, {
138
133
  _extend: {
139
134
  product: product,
140
135
  addTimeProduct: addTimeProduct,
@@ -147,21 +142,38 @@ export function buildCartView(lines, bookings) {
147
142
  shopOpeningHours: options.shopOpeningHours
148
143
  })
149
144
  }
150
- }));
151
- return acc;
152
- }, []);
153
- var items = productLines.filter(function (line) {
145
+ });
146
+ };
147
+ productLines.forEach(function (line) {
154
148
  var _line$metadata6;
155
- // 促销赠品行仅通过主商品 Gift 行展示,不在 items 单独占一行(对齐 legacy `isGift: !!_giftInfo`)
156
- if (isGiftProductLine(line)) return false;
157
- if (claimedAddTimeLines.has(line)) return false;
149
+ // 赠品由主商品 Gift 行展示;加时商品挂在 booking._extend.addTimeProduct。
150
+ if (isGiftProductLine(line) || claimedAddTimeLines.has(line)) return;
158
151
  var uid = (_line$metadata6 = line.metadata) === null || _line$metadata6 === void 0 ? void 0 : _line$metadata6.unique_identification_number;
159
- if (uid === undefined || uid === null || uid === '') return true;
160
- return !claimedUids.has(String(uid));
152
+ var matchedBooking = uid === undefined || uid === null || uid === '' ? undefined : (bookingsByProductUid[String(uid)] || []).find(function (booking) {
153
+ return !claimedBookings.has(booking);
154
+ });
155
+ if (matchedBooking) {
156
+ claimedBookings.add(matchedBooking);
157
+ var bookingView = buildBookingView(matchedBooking, line);
158
+ cartBookings.push(bookingView);
159
+ orderedLines.push(bookingView);
160
+ return;
161
+ }
162
+ items.push(line);
163
+ orderedLines.push(line);
164
+ });
165
+ childBookings.forEach(function (booking) {
166
+ if (claimedBookings.has(booking)) return;
167
+ var uid = booking === null || booking === void 0 ? void 0 : booking.product_uid;
168
+ var linkedProduct = uid === undefined || uid === null || uid === '' ? null : linesByUid[String(uid)] || null;
169
+ // 赠品预约只作为提交数据保留,不在购物车预约卡片区展示。
170
+ if (isGiftProductLine(linkedProduct)) return;
171
+ cartBookings.push(buildBookingView(booking, null));
161
172
  });
162
173
  return {
163
174
  bookings: cartBookings,
164
- items: items
175
+ items: items,
176
+ lines: orderedLines
165
177
  };
166
178
  }
167
179
  export function isWalkInCustomer(customer) {
@@ -83,7 +83,6 @@ export declare class SalesImpl extends BaseModule implements Module, SalesModule
83
83
  private getBookingAppointmentStatus;
84
84
  private isBookingIncludedInStats;
85
85
  private getBookingOrderPaymentStatus;
86
- private isUnpaidBooking;
87
86
  private countBookingOrders;
88
87
  private countCompletedBookings;
89
88
  private groupBookingsByResource;
@@ -29,7 +29,6 @@ import dayjs from 'dayjs';
29
29
  import { BaseModule } from "../../modules/BaseModule";
30
30
  import { SalesHooks } from "./types";
31
31
  export * from "./types";
32
- var UNPAID_PAYMENT_STATUSES = new Set(['unpaid', 'partially_paid', 'payment_processing']);
33
32
 
34
33
  /**
35
34
  * Sales 解决方案基础骨架
@@ -416,11 +415,6 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
416
415
  var _booking$order$paymen, _booking$order;
417
416
  return String((_booking$order$paymen = (_booking$order = booking.order) === null || _booking$order === void 0 ? void 0 : _booking$order.payment_status) !== null && _booking$order$paymen !== void 0 ? _booking$order$paymen : '');
418
417
  }
419
- }, {
420
- key: "isUnpaidBooking",
421
- value: function isUnpaidBooking(booking) {
422
- return UNPAID_PAYMENT_STATUSES.has(this.getBookingOrderPaymentStatus(booking));
423
- }
424
418
  }, {
425
419
  key: "countBookingOrders",
426
420
  value: function countBookingOrders(bookings) {
@@ -901,11 +895,9 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
901
895
  });
902
896
  completedBookingList = matchedBookingList.filter(function (booking) {
903
897
  return _this7.getBookingAppointmentStatus(booking) === 'completed';
904
- }); // const unpaidBookingList = matchedBookingList.filter(
905
- // (booking) => this.getBookingOrderPaymentStatus(booking) === 'unpaid' || this.getBookingOrderPaymentStatus(booking) === 'payment_processing',
906
- // );
898
+ });
907
899
  unpaidBookingList = matchedBookingList.filter(function (booking) {
908
- return _this7.isUnpaidBooking(booking);
900
+ return _this7.getBookingOrderPaymentStatus(booking) === 'unpaid' || _this7.getBookingOrderPaymentStatus(booking) === 'payment_processing';
909
901
  });
910
902
  bookings = this.pickBookingsForCurrentPoint(current, this.normalizeResourceBookings(current, deviceCurrent, matchedBookingList));
911
903
  completedBookings = completedBookingList.map(function (booking) {
@@ -41,10 +41,6 @@ import { composeLinePrice, createUuidV4, getProductSkuOptions, normalizeSubmitCo
41
41
  import dayjs from 'dayjs';
42
42
  import { ItemRuleEvaluator } from "../../model/strategy/adapter/itemRule";
43
43
  export * from "./types";
44
- function isItemRewardProductDiscount(discount) {
45
- var _discount$metadata, _discount$metadata2;
46
- return (discount === null || discount === void 0 ? void 0 : discount.type) === 'product' && (discount === null || discount === void 0 || (_discount$metadata = discount.metadata) === null || _discount$metadata === void 0 ? void 0 : _discount$metadata.source) === 'promotion' && (discount === null || discount === void 0 || (_discount$metadata2 = discount.metadata) === null || _discount$metadata2 === void 0 ? void 0 : _discount$metadata2.actionType) === 'ITEM_REWARD';
47
- }
48
44
  export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
49
45
  _inherits(ScanOrderImpl, _BaseModule);
50
46
  var _super = _createSuper(ScanOrderImpl);
@@ -1181,7 +1177,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1181
1177
  _iterator3.s();
1182
1178
  case 19:
1183
1179
  if ((_step3 = _iterator3.n()).done) {
1184
- _context15.next = 36;
1180
+ _context15.next = 33;
1185
1181
  break;
1186
1182
  }
1187
1183
  product = _step3.value;
@@ -1189,15 +1185,8 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1189
1185
  _context15.next = 23;
1190
1186
  break;
1191
1187
  }
1192
- return _context15.abrupt("continue", 34);
1188
+ return _context15.abrupt("continue", 31);
1193
1189
  case 23:
1194
- if (!(product.discount_list || []).some(isItemRewardProductDiscount)) {
1195
- _context15.next = 26;
1196
- break;
1197
- }
1198
- product.discount_list = (product.discount_list || []).filter(isItemRewardProductDiscount);
1199
- return _context15.abrupt("continue", 34);
1200
- case 26:
1201
1190
  product.discount_list = (product.discount_list || []).filter(function (pd) {
1202
1191
  var _pd$discount$resource, _pd$discount;
1203
1192
  var rid = (_pd$discount$resource = (_pd$discount = pd.discount) === null || _pd$discount === void 0 ? void 0 : _pd$discount.resource_id) !== null && _pd$discount$resource !== void 0 ? _pd$discount$resource : pd.id;
@@ -1221,47 +1210,47 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1221
1210
  mainPrice: newMainSellingPrice,
1222
1211
  bundle: product.product_bundle
1223
1212
  });
1224
- case 34:
1213
+ case 31:
1225
1214
  _context15.next = 19;
1226
1215
  break;
1227
- case 36:
1228
- _context15.next = 41;
1216
+ case 33:
1217
+ _context15.next = 38;
1229
1218
  break;
1230
- case 38:
1231
- _context15.prev = 38;
1219
+ case 35:
1220
+ _context15.prev = 35;
1232
1221
  _context15.t0 = _context15["catch"](17);
1233
1222
  _iterator3.e(_context15.t0);
1234
- case 41:
1235
- _context15.prev = 41;
1223
+ case 38:
1224
+ _context15.prev = 38;
1236
1225
  _iterator3.f();
1237
- return _context15.finish(41);
1238
- case 44:
1226
+ return _context15.finish(38);
1227
+ case 41:
1239
1228
  OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
1240
- _context15.next = 47;
1229
+ _context15.next = 44;
1241
1230
  return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
1242
- case 47:
1231
+ case 44:
1243
1232
  tempOrder.discount_list = (nextDiscountList || []).filter(function (d) {
1244
1233
  return d.isSelected;
1245
1234
  });
1246
- _context15.next = 50;
1235
+ _context15.next = 47;
1247
1236
  return this.store.order.recalculateSummary({
1248
1237
  createIfMissing: true
1249
1238
  });
1250
- case 50:
1239
+ case 47:
1251
1240
  this.store.order.persistTempOrder();
1252
1241
  this.logMethodSuccess('setDiscountSelected', params);
1253
- _context15.next = 58;
1242
+ _context15.next = 55;
1254
1243
  break;
1255
- case 54:
1256
- _context15.prev = 54;
1244
+ case 51:
1245
+ _context15.prev = 51;
1257
1246
  _context15.t1 = _context15["catch"](1);
1258
1247
  this.logMethodError('setDiscountSelected', _context15.t1);
1259
1248
  throw _context15.t1;
1260
- case 58:
1249
+ case 55:
1261
1250
  case "end":
1262
1251
  return _context15.stop();
1263
1252
  }
1264
- }, _callee15, this, [[1, 54], [17, 38, 41, 44]]);
1253
+ }, _callee15, this, [[1, 51], [17, 35, 38, 41]]);
1265
1254
  }));
1266
1255
  function setDiscountSelected(_x8) {
1267
1256
  return _setDiscountSelected.apply(this, arguments);