@pisell/pisellos 2.3.36 → 2.3.38

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 (90) hide show
  1. package/dist/core/index.d.ts +2 -0
  2. package/dist/core/index.js +7 -0
  3. package/dist/model/strategy/adapter/promotion/adapter.d.ts +4 -0
  4. package/dist/model/strategy/adapter/promotion/adapter.js +23 -0
  5. package/dist/model/strategy/adapter/promotion/evaluator.d.ts +17 -0
  6. package/dist/model/strategy/adapter/promotion/evaluator.js +279 -6
  7. package/dist/model/strategy/adapter/promotion/examples.d.ts +86 -0
  8. package/dist/model/strategy/adapter/promotion/examples.js +99 -0
  9. package/dist/model/strategy/adapter/promotion/index.d.ts +1 -1
  10. package/dist/model/strategy/adapter/promotion/type.d.ts +90 -2
  11. package/dist/model/strategy/adapter/promotion/type.js +45 -0
  12. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +5 -3
  13. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +6 -3
  14. package/dist/modules/OpenData/index.d.ts +2 -0
  15. package/dist/modules/OpenData/index.js +8 -0
  16. package/dist/modules/Order/index.js +21 -14
  17. package/dist/modules/Order/utils.js +2 -1
  18. package/dist/modules/Payment/index.js +1 -1
  19. package/dist/modules/Payment/types.d.ts +73 -4
  20. package/dist/modules/Payment/types.js +18 -3
  21. package/dist/modules/Payment/walletpass.d.ts +25 -1
  22. package/dist/modules/Payment/walletpass.js +707 -157
  23. package/dist/modules/Rules/index.d.ts +1 -0
  24. package/dist/modules/Rules/index.js +75 -49
  25. package/dist/server/index.js +28 -24
  26. package/dist/server/modules/order/index.d.ts +5 -0
  27. package/dist/server/modules/order/index.js +52 -31
  28. package/dist/solution/BaseSales/index.d.ts +77 -11
  29. package/dist/solution/BaseSales/index.js +1476 -434
  30. package/dist/solution/BaseSales/types.d.ts +52 -0
  31. package/dist/solution/BaseSales/types.js +2 -1
  32. package/dist/solution/BaseSales/utils/cartPromotion.d.ts +3 -1
  33. package/dist/solution/BaseSales/utils/cartPromotion.js +90 -31
  34. package/dist/solution/BookingByStep/index.d.ts +1 -1
  35. package/dist/solution/BookingTicket/index.d.ts +7 -3
  36. package/dist/solution/BookingTicket/index.js +130 -48
  37. package/dist/solution/BookingTicket/utils/addProductDecision.js +6 -0
  38. package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +8 -0
  39. package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +172 -82
  40. package/dist/solution/BookingTicket/utils/weighingProductSku.d.ts +5 -0
  41. package/dist/solution/BookingTicket/utils/weighingProductSku.js +45 -0
  42. package/dist/solution/ScanOrder/index.js +31 -20
  43. package/dist/solution/VenueBooking/index.js +30 -19
  44. package/dist/types/index.d.ts +1 -0
  45. package/lib/core/index.d.ts +2 -0
  46. package/lib/core/index.js +4 -0
  47. package/lib/model/strategy/adapter/promotion/adapter.d.ts +4 -0
  48. package/lib/model/strategy/adapter/promotion/adapter.js +20 -0
  49. package/lib/model/strategy/adapter/promotion/evaluator.d.ts +17 -0
  50. package/lib/model/strategy/adapter/promotion/evaluator.js +235 -0
  51. package/lib/model/strategy/adapter/promotion/examples.d.ts +86 -0
  52. package/lib/model/strategy/adapter/promotion/examples.js +91 -0
  53. package/lib/model/strategy/adapter/promotion/index.d.ts +1 -1
  54. package/lib/model/strategy/adapter/promotion/index.js +2 -0
  55. package/lib/model/strategy/adapter/promotion/type.d.ts +90 -2
  56. package/lib/model/strategy/adapter/promotion/type.js +2 -0
  57. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +2 -1
  58. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +2 -1
  59. package/lib/modules/OpenData/index.d.ts +2 -0
  60. package/lib/modules/OpenData/index.js +5 -0
  61. package/lib/modules/Order/index.js +10 -4
  62. package/lib/modules/Order/utils.js +6 -1
  63. package/lib/modules/Payment/index.js +1 -1
  64. package/lib/modules/Payment/types.d.ts +73 -4
  65. package/lib/modules/Payment/types.js +4 -3
  66. package/lib/modules/Payment/walletpass.d.ts +25 -1
  67. package/lib/modules/Payment/walletpass.js +470 -21
  68. package/lib/modules/Rules/index.d.ts +1 -0
  69. package/lib/modules/Rules/index.js +30 -7
  70. package/lib/server/index.js +11 -8
  71. package/lib/server/modules/order/index.d.ts +5 -0
  72. package/lib/server/modules/order/index.js +24 -2
  73. package/lib/solution/BaseSales/index.d.ts +77 -11
  74. package/lib/solution/BaseSales/index.js +699 -41
  75. package/lib/solution/BaseSales/types.d.ts +52 -0
  76. package/lib/solution/BaseSales/types.js +2 -1
  77. package/lib/solution/BaseSales/utils/cartPromotion.d.ts +3 -1
  78. package/lib/solution/BaseSales/utils/cartPromotion.js +63 -12
  79. package/lib/solution/BookingByStep/index.d.ts +1 -1
  80. package/lib/solution/BookingTicket/index.d.ts +7 -3
  81. package/lib/solution/BookingTicket/index.js +60 -8
  82. package/lib/solution/BookingTicket/utils/addProductDecision.js +4 -0
  83. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +8 -0
  84. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +36 -4
  85. package/lib/solution/BookingTicket/utils/weighingProductSku.d.ts +5 -0
  86. package/lib/solution/BookingTicket/utils/weighingProductSku.js +63 -0
  87. package/lib/solution/ScanOrder/index.js +8 -0
  88. package/lib/solution/VenueBooking/index.js +8 -0
  89. package/lib/types/index.d.ts +1 -0
  90. package/package.json +2 -2
@@ -337,11 +337,10 @@ 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;
341
340
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
342
341
  while (1) switch (_context3.prev = _context3.next) {
343
342
  case 0:
344
- return _context3.abrupt("return", (_this$store$openData = this.store.openData) === null || _this$store$openData === void 0 ? void 0 : _this$store$openData.getOpenData());
343
+ return _context3.abrupt("return", this.loadOpenDataConfig());
345
344
  case 1:
346
345
  case "end":
347
346
  return _context3.stop();
@@ -352,7 +351,15 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
352
351
  return _getOpenData.apply(this, arguments);
353
352
  }
354
353
  return getOpenData;
355
- }()
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
+ }
356
363
  }, {
357
364
  key: "getShortNumberOrDeviceId",
358
365
  value: function () {
@@ -397,49 +404,52 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
397
404
  return _regeneratorRuntime().wrap(function _callee5$(_context5) {
398
405
  while (1) switch (_context5.prev = _context5.next) {
399
406
  case 0:
407
+ // 业务码切换或配置失败时不能复用上一次初始化的短号。
408
+ this.setPaymentNumberDevicePrefix(null);
400
409
  openDataConfig = null;
401
- _context5.prev = 1;
402
- _context5.next = 4;
410
+ _context5.prev = 2;
411
+ _context5.next = 5;
403
412
  return this.loadOpenDataConfig();
404
- case 4:
413
+ case 5:
405
414
  openDataConfig = _context5.sent;
406
- _context5.next = 11;
415
+ _context5.next = 12;
407
416
  break;
408
- case 7:
409
- _context5.prev = 7;
410
- _context5.t0 = _context5["catch"](1);
417
+ case 8:
418
+ _context5.prev = 8;
419
+ _context5.t0 = _context5["catch"](2);
411
420
  console.warn('[BookingTicket] OpenData 配置加载失败,跳过 idGenerator 配置', _context5.t0);
412
421
  return _context5.abrupt("return");
413
- case 11:
422
+ case 12:
414
423
  // if (!openDataConfig) return;
415
424
  idGenerator = this.getIdGeneratorPlugin();
416
425
  if (idGenerator !== null && idGenerator !== void 0 && idGenerator.configure) {
417
- _context5.next = 15;
426
+ _context5.next = 16;
418
427
  break;
419
428
  }
420
429
  console.warn('[BookingTicket] idGenerator 插件不可用,跳过配置');
421
430
  return _context5.abrupt("return");
422
- case 15:
431
+ case 16:
423
432
  receiptSequenceLength = this.normalizePositiveInteger((_openDataConfig = openDataConfig) === null || _openDataConfig === void 0 ? void 0 : _openDataConfig['sale.short_number_digits'], 5);
424
433
  receiptSequenceStart = this.normalizePositiveInteger((_openDataConfig2 = openDataConfig) === null || _openDataConfig2 === void 0 ? void 0 : _openDataConfig2['sale.short_number_start_number'], 1);
425
434
  prefix = this.normalizeIdPrefix((_openDataConfig3 = openDataConfig) === null || _openDataConfig3 === void 0 ? void 0 : _openDataConfig3['sale.short_number_prefix'], '');
426
435
  shopOrderPrefix = this.normalizeIdPrefix((_openDataConfig4 = openDataConfig) === null || _openDataConfig4 === void 0 ? void 0 : _openDataConfig4['sale.sale_number_prefix'], '');
427
436
  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;
428
437
  operatingDayBoundary = this.getAppData('operating_day_boundary');
429
- _context5.next = 23;
438
+ _context5.next = 24;
430
439
  return this.getShortNumberOrDeviceId();
431
- case 23:
440
+ case 24:
432
441
  deviceId = _context5.sent;
442
+ this.setPaymentNumberDevicePrefix(deviceId);
433
443
  businessCode = this.getBookingTicketBusinessCode();
434
444
  if (businessCode) {
435
- _context5.next = 28;
445
+ _context5.next = 30;
436
446
  break;
437
447
  }
438
448
  console.warn('[BookingTicket] businessCode 缺失,跳过 idGenerator 配置');
439
449
  return _context5.abrupt("return");
440
- case 28:
441
- _context5.prev = 28;
442
- _context5.next = 31;
450
+ case 30:
451
+ _context5.prev = 30;
452
+ _context5.next = 33;
443
453
  return idGenerator.configure({
444
454
  biz: businessCode,
445
455
  config: {
@@ -454,18 +464,18 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
454
464
  shopOrderPrefix: shopOrderPrefix
455
465
  }
456
466
  });
457
- case 31:
458
- _context5.next = 36;
459
- break;
460
467
  case 33:
461
- _context5.prev = 33;
462
- _context5.t1 = _context5["catch"](28);
468
+ _context5.next = 38;
469
+ break;
470
+ case 35:
471
+ _context5.prev = 35;
472
+ _context5.t1 = _context5["catch"](30);
463
473
  console.warn('[BookingTicket] idGenerator 配置失败', _context5.t1);
464
- case 36:
474
+ case 38:
465
475
  case "end":
466
476
  return _context5.stop();
467
477
  }
468
- }, _callee5, this, [[1, 7], [28, 33]]);
478
+ }, _callee5, this, [[2, 8], [30, 35]]);
469
479
  }));
470
480
  function configureIdGeneratorFromOpenData() {
471
481
  return _configureIdGeneratorFromOpenData.apply(this, arguments);
@@ -1260,24 +1270,88 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1260
1270
  }
1261
1271
 
1262
1272
  /**
1263
- * 通过 ids 获取商品列表(不加载到模块中)
1264
- * @returns 商品列表
1273
+ * 通过 ids 获取商品列表;默认只读取内存,显式开启 loadMissing 时按当前订单上下文补查缺失商品。
1274
+ * 补查直接写入 ProductList,不更新 BookingTicket.productCatalog,避免当前商品列表被查询子集覆盖。
1265
1275
  */
1266
1276
  }, {
1267
1277
  key: "getProductByIds",
1268
1278
  value: (function () {
1269
- var _getProductByIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(ids) {
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;
1270
1282
  return _regeneratorRuntime().wrap(function _callee18$(_context18) {
1271
1283
  while (1) switch (_context18.prev = _context18.next) {
1272
1284
  case 0:
1273
- return _context18.abrupt("return", this.store.products.getProductByIds(ids));
1274
- case 1:
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:
1275
1349
  case "end":
1276
1350
  return _context18.stop();
1277
1351
  }
1278
1352
  }, _callee18, this);
1279
1353
  }));
1280
- function getProductByIds(_x13) {
1354
+ function getProductByIds(_x13, _x14) {
1281
1355
  return _getProductByIds.apply(this, arguments);
1282
1356
  }
1283
1357
  return getProductByIds;
@@ -1311,7 +1385,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1311
1385
  }
1312
1386
  }, _callee19, this);
1313
1387
  }));
1314
- function getScheduleTimePoints(_x14) {
1388
+ function getScheduleTimePoints(_x15) {
1315
1389
  return _getScheduleTimePoints.apply(this, arguments);
1316
1390
  }
1317
1391
  return getScheduleTimePoints;
@@ -1701,7 +1775,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1701
1775
  }
1702
1776
  }, _callee23, this, [[0, 7]]);
1703
1777
  }));
1704
- function changeCustomerPage(_x15, _x16) {
1778
+ function changeCustomerPage(_x16, _x17) {
1705
1779
  return _changeCustomerPage.apply(this, arguments);
1706
1780
  }
1707
1781
  return changeCustomerPage;
@@ -2155,10 +2229,10 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2155
2229
  }, {
2156
2230
  key: "buildAddProductCtx",
2157
2231
  value: function buildAddProductCtx(extra) {
2158
- var _extra$date2, _ref12, _this$getOrderCustome, _this$getOrderCustome2, _this$store$order$get4, _extra$presetStartTim2;
2232
+ var _extra$date2, _ref12, _this$getOrderCustome4, _this$getOrderCustome5, _this$store$order$get4, _extra$presetStartTim2;
2159
2233
  var bookingContextState = this.store.bookingContext.getState();
2160
2234
  var date = (_extra$date2 = extra === null || extra === void 0 ? void 0 : extra.date) !== null && _extra$date2 !== void 0 ? _extra$date2 : bookingContextState.date;
2161
- 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;
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;
2162
2236
  return _objectSpread({
2163
2237
  bookingConfig: bookingContextState.bookingConfig,
2164
2238
  resourcesOrigin: bookingContextState.resourcesOrigin,
@@ -2275,7 +2349,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2275
2349
  }
2276
2350
  }, _callee27, this);
2277
2351
  }));
2278
- function updateProductInOrder(_x17) {
2352
+ function updateProductInOrder(_x18) {
2279
2353
  return _updateProductInOrder.apply(this, arguments);
2280
2354
  }
2281
2355
  return updateProductInOrder;
@@ -2363,6 +2437,12 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2363
2437
  },
2364
2438
  addProductToOrder: function addProductToOrder(product, booking) {
2365
2439
  return _this6.addProductToOrder(product, booking);
2440
+ },
2441
+ refreshWalletAssets: function refreshWalletAssets(params) {
2442
+ return _this6.refreshWalletAssets(params);
2443
+ },
2444
+ scanWalletAsset: function scanWalletAsset(scanCode) {
2445
+ return _this6.scanWalletAsset(scanCode);
2366
2446
  }
2367
2447
  }, formatted, bridge);
2368
2448
  case 16:
@@ -2384,7 +2464,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2384
2464
  }
2385
2465
  }, _callee28, this, [[4, 21]]);
2386
2466
  }));
2387
- function handleGlobalScanCode(_x18, _x19) {
2467
+ function handleGlobalScanCode(_x19, _x20) {
2388
2468
  return _handleGlobalScanCode.apply(this, arguments);
2389
2469
  }
2390
2470
  return handleGlobalScanCode;
@@ -2482,7 +2562,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2482
2562
  }
2483
2563
  }, _callee29, this);
2484
2564
  }));
2485
- function addAddTimeProductToBooking(_x20) {
2565
+ function addAddTimeProductToBooking(_x21) {
2486
2566
  return _addAddTimeProductToBooking.apply(this, arguments);
2487
2567
  }
2488
2568
  return addAddTimeProductToBooking;
@@ -2585,7 +2665,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2585
2665
  }
2586
2666
  }, _callee30, this, [[13, 31, 34, 37]]);
2587
2667
  }));
2588
- function addAddTimeProductsToBooking(_x21) {
2668
+ function addAddTimeProductsToBooking(_x22) {
2589
2669
  return _addAddTimeProductsToBooking.apply(this, arguments);
2590
2670
  }
2591
2671
  return addAddTimeProductsToBooking;
@@ -2602,22 +2682,24 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2602
2682
  while (1) switch (_context31.prev = _context31.next) {
2603
2683
  case 0:
2604
2684
  _ref19 = _args31.length > 1 && _args31[1] !== undefined ? _args31[1] : {}, _ref19$cover = _ref19.cover, cover = _ref19$cover === void 0 ? false : _ref19$cover;
2605
- _get(_getPrototypeOf(BookingTicketImpl.prototype), "setOtherParams", this).call(this, params, {
2685
+ _context31.next = 3;
2686
+ return _get(_getPrototypeOf(BookingTicketImpl.prototype), "setOtherParams", this).call(this, params, {
2606
2687
  cover: cover
2607
2688
  });
2608
- if (!(params !== null && params !== void 0 && params.businessCode)) {
2609
- _context31.next = 5;
2689
+ case 3:
2690
+ if (!((params === null || params === void 0 ? void 0 : params.businessCode) !== undefined || (params === null || params === void 0 ? void 0 : params.business_code) !== undefined)) {
2691
+ _context31.next = 6;
2610
2692
  break;
2611
2693
  }
2612
- _context31.next = 5;
2694
+ _context31.next = 6;
2613
2695
  return this.configureIdGeneratorFromOpenData();
2614
- case 5:
2696
+ case 6:
2615
2697
  case "end":
2616
2698
  return _context31.stop();
2617
2699
  }
2618
2700
  }, _callee31, this);
2619
2701
  }));
2620
- function setOtherParams(_x22) {
2702
+ function setOtherParams(_x23) {
2621
2703
  return _setOtherParams.apply(this, arguments);
2622
2704
  }
2623
2705
  return setOtherParams;
@@ -2688,7 +2770,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2688
2770
  }
2689
2771
  }, _callee32, this);
2690
2772
  }));
2691
- function handlePrintWristband(_x23) {
2773
+ function handlePrintWristband(_x24) {
2692
2774
  return _handlePrintWristband.apply(this, arguments);
2693
2775
  }
2694
2776
  return handlePrintWristband;
@@ -2763,7 +2845,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2763
2845
  }
2764
2846
  }, _callee33, this);
2765
2847
  }));
2766
- function handleRedeem(_x24) {
2848
+ function handleRedeem(_x25) {
2767
2849
  return _handleRedeem.apply(this, arguments);
2768
2850
  }
2769
2851
  return handleRedeem;
@@ -7,6 +7,7 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
7
7
  import dayjs from 'dayjs';
8
8
  import { cacheItemToBookingInput, derivePresetStartTimeFromDate, getProductExtend, getIsAutoClose, isSessionProduct, isBookingProduct, applySessionTimesToExtend, hasActualResourceSelection, productNeedsResourceExtend } from "../../../modules/BookingContext";
9
9
  import { transformBaseProductToOrderProduct } from "../../BaseSales/utils/transformBaseProductToOrderProduct";
10
+ import { buildProductSkuFromCacheItem } from "./weighingProductSku";
10
11
 
11
12
  /**
12
13
  * cart.addProduct 两阶段决策(与 ticketBooking `handleSelectProduct` 对齐):
@@ -322,11 +323,16 @@ function buildBasePayloadFromCacheItem(cacheItem, ctx) {
322
323
  var quantity = (ctx === null || ctx === void 0 ? void 0 : ctx.quantity) != null && ctx.quantity > 0 ? ctx.quantity : (_cacheItem$_extend$qu = cacheItem === null || cacheItem === void 0 || (_cacheItem$_extend2 = cacheItem._extend) === null || _cacheItem$_extend2 === void 0 ? void 0 : _cacheItem$_extend2.quantity) !== null && _cacheItem$_extend$qu !== void 0 ? _cacheItem$_extend$qu : 1;
323
324
  var resolvedPid = (_cacheItem$product_id = cacheItem === null || cacheItem === void 0 ? void 0 : cacheItem.product_id) !== null && _cacheItem$product_id !== void 0 ? _cacheItem$product_id : cacheItem === null || cacheItem === void 0 ? void 0 : cacheItem.id;
324
325
  var extend = (cacheItem === null || cacheItem === void 0 ? void 0 : cacheItem._extend) || {};
326
+ var productSku = buildProductSkuFromCacheItem(cacheItem);
325
327
  return {
326
328
  id: (_cacheItem$id = cacheItem === null || cacheItem === void 0 ? void 0 : cacheItem.id) !== null && _cacheItem$id !== void 0 ? _cacheItem$id : cacheItem === null || cacheItem === void 0 ? void 0 : cacheItem.product_id,
327
329
  product_id: resolvedPid,
328
330
  variant_id: (_ref5 = (_other$product_varian = other === null || other === void 0 ? void 0 : other.product_variant_id) !== null && _other$product_varian !== void 0 ? _other$product_varian : other === null || other === void 0 ? void 0 : other.variant_id) !== null && _ref5 !== void 0 ? _ref5 : 0,
329
331
  quantity: quantity,
332
+ // 规格弹窗本次选择是 option 权威源,避免目录/旧订单里的空 option 覆盖它。
333
+ product_sku: productSku ? _objectSpread(_objectSpread({}, productSku), {}, {
334
+ option: (other === null || other === void 0 ? void 0 : other.option) || []
335
+ }) : undefined,
330
336
  option: (other === null || other === void 0 ? void 0 : other.option) || [],
331
337
  bundle: (other === null || other === void 0 ? void 0 : other.bundle) || (extend === null || extend === void 0 || (_extend$skuValue = extend.skuValue) === null || _extend$skuValue === void 0 ? void 0 : _extend$skuValue.bundle) || (extend === null || extend === void 0 || (_extend$_skuValue = extend._skuValue) === null || _extend$_skuValue === void 0 ? void 0 : _extend$_skuValue.bundle) || [],
332
338
  unique: other === null || other === void 0 ? void 0 : other.unique,
@@ -24,6 +24,14 @@ export interface GlobalScanApplyHost {
24
24
  cacheItem: any;
25
25
  };
26
26
  addProductToOrder(product: any, booking?: any): Promise<any>;
27
+ refreshWalletAssets?(params?: {
28
+ preserveSelection?: boolean;
29
+ }): Promise<any>;
30
+ scanWalletAsset?(code: string): Promise<{
31
+ type: 'walletCode' | 'normalCode';
32
+ asset?: any;
33
+ selected: boolean;
34
+ }>;
27
35
  }
28
36
  /**
29
37
  * 应用全局扫码格式化结果:设客户 / 加车 / 开单 / 弹窗链。