@pisell/pisellos 2.3.83 → 2.3.85

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.
@@ -582,7 +582,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
582
582
  break;
583
583
  }
584
584
  _context5.next = 6;
585
- return _this3.store.quotation.loadQuotations({
585
+ return _this3.ensureQuotationsLoaded({
586
586
  channel: (_this3$otherParams = _this3.otherParams) === null || _this3$otherParams === void 0 ? void 0 : _this3$otherParams.channel
587
587
  });
588
588
  case 6:
@@ -670,7 +670,6 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
670
670
  holderModule,
671
671
  _this$store$order,
672
672
  _this$store$order2,
673
- _this$store$quotation,
674
673
  _this$otherParams11,
675
674
  _args7 = arguments;
676
675
  return _regeneratorRuntime().wrap(function _callee7$(_context7) {
@@ -840,7 +839,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
840
839
  return this.store.schedule.loadAllSchedule();
841
840
  case 54:
842
841
  this.injectScheduleResolverToQuotation();
843
- (_this$store$quotation = this.store.quotation) === null || _this$store$quotation === void 0 || _this$store$quotation.loadQuotations({
842
+ this.preloadQuotations({
844
843
  channel: (_this$otherParams11 = this.otherParams) === null || _this$otherParams11 === void 0 ? void 0 : _this$otherParams11.channel
845
844
  });
846
845
  case 56:
@@ -1200,40 +1199,79 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1200
1199
 
1201
1200
  // ─── 报价单 ───
1202
1201
  }, {
1203
- key: "loadQuotations",
1202
+ key: "ensureQuotationsLoaded",
1204
1203
  value: function () {
1205
- var _loadQuotations = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(params) {
1204
+ var _ensureQuotationsLoaded = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(params) {
1205
+ var quotation, load;
1206
1206
  return _regeneratorRuntime().wrap(function _callee15$(_context15) {
1207
1207
  while (1) switch (_context15.prev = _context15.next) {
1208
+ case 0:
1209
+ quotation = this.store.quotation;
1210
+ if (quotation) {
1211
+ _context15.next = 3;
1212
+ break;
1213
+ }
1214
+ return _context15.abrupt("return");
1215
+ case 3:
1216
+ load = typeof quotation.ensureQuotations === 'function' ? quotation.ensureQuotations.bind(quotation) : quotation.loadQuotations.bind(quotation);
1217
+ _context15.next = 6;
1218
+ return load(params);
1219
+ case 6:
1220
+ case "end":
1221
+ return _context15.stop();
1222
+ }
1223
+ }, _callee15, this);
1224
+ }));
1225
+ function ensureQuotationsLoaded(_x7) {
1226
+ return _ensureQuotationsLoaded.apply(this, arguments);
1227
+ }
1228
+ return ensureQuotationsLoaded;
1229
+ }()
1230
+ }, {
1231
+ key: "preloadQuotations",
1232
+ value: function preloadQuotations(params) {
1233
+ var _this6 = this;
1234
+ void this.ensureQuotationsLoaded(params).catch(function (error) {
1235
+ _this6.logMethodError('preloadQuotations', error, {
1236
+ channel: params === null || params === void 0 ? void 0 : params.channel
1237
+ });
1238
+ });
1239
+ }
1240
+ }, {
1241
+ key: "loadQuotations",
1242
+ value: function () {
1243
+ var _loadQuotations = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(params) {
1244
+ return _regeneratorRuntime().wrap(function _callee16$(_context16) {
1245
+ while (1) switch (_context16.prev = _context16.next) {
1208
1246
  case 0:
1209
1247
  this.logMethodStart('loadQuotations');
1210
- _context15.prev = 1;
1248
+ _context16.prev = 1;
1211
1249
  if (this.store.quotation) {
1212
- _context15.next = 4;
1250
+ _context16.next = 4;
1213
1251
  break;
1214
1252
  }
1215
1253
  throw new Error('quotation 模块未初始化');
1216
1254
  case 4:
1217
- _context15.next = 6;
1255
+ _context16.next = 6;
1218
1256
  return this.store.quotation.loadQuotations(params);
1219
1257
  case 6:
1220
1258
  this.logMethodSuccess('loadQuotations', {
1221
1259
  count: this.store.quotation.getQuotationList().length
1222
1260
  });
1223
- _context15.next = 13;
1261
+ _context16.next = 13;
1224
1262
  break;
1225
1263
  case 9:
1226
- _context15.prev = 9;
1227
- _context15.t0 = _context15["catch"](1);
1228
- this.logMethodError('loadQuotations', _context15.t0);
1229
- throw _context15.t0;
1264
+ _context16.prev = 9;
1265
+ _context16.t0 = _context16["catch"](1);
1266
+ this.logMethodError('loadQuotations', _context16.t0);
1267
+ throw _context16.t0;
1230
1268
  case 13:
1231
1269
  case "end":
1232
- return _context15.stop();
1270
+ return _context16.stop();
1233
1271
  }
1234
- }, _callee15, this, [[1, 9]]);
1272
+ }, _callee16, this, [[1, 9]]);
1235
1273
  }));
1236
- function loadQuotations(_x7) {
1274
+ function loadQuotations(_x8) {
1237
1275
  return _loadQuotations.apply(this, arguments);
1238
1276
  }
1239
1277
  return loadQuotations;
@@ -1241,46 +1279,46 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1241
1279
  }, {
1242
1280
  key: "fetchResourceAvailability",
1243
1281
  value: function () {
1244
- var _fetchResourceAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(params) {
1282
+ var _fetchResourceAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(params) {
1245
1283
  var venueProducts, resourceIds, config, crossDay, effectiveEndDate, res, rawData, _iterator3, _step3, item, _i3, _rawData, _item, mappings, _iterator4, _step4, mapping;
1246
- return _regeneratorRuntime().wrap(function _callee16$(_context16) {
1247
- while (1) switch (_context16.prev = _context16.next) {
1284
+ return _regeneratorRuntime().wrap(function _callee17$(_context17) {
1285
+ while (1) switch (_context17.prev = _context17.next) {
1248
1286
  case 0:
1249
1287
  this.logMethodStart('fetchResourceAvailability', params);
1250
- _context16.prev = 1;
1288
+ _context17.prev = 1;
1251
1289
  venueProducts = this.getVenueProducts();
1252
1290
  if (venueProducts.length) {
1253
- _context16.next = 7;
1291
+ _context17.next = 7;
1254
1292
  break;
1255
1293
  }
1256
1294
  this.store.rawResourceData = [];
1257
1295
  this.logMethodSuccess('fetchResourceAvailability', {
1258
1296
  resourceCount: 0
1259
1297
  });
1260
- return _context16.abrupt("return");
1298
+ return _context17.abrupt("return");
1261
1299
  case 7:
1262
1300
  resourceIds = extractResourceIds(venueProducts);
1263
1301
  if (resourceIds.length) {
1264
- _context16.next = 12;
1302
+ _context17.next = 12;
1265
1303
  break;
1266
1304
  }
1267
1305
  this.store.rawResourceData = [];
1268
1306
  this.logMethodSuccess('fetchResourceAvailability', {
1269
1307
  resourceIds: []
1270
1308
  });
1271
- return _context16.abrupt("return");
1309
+ return _context17.abrupt("return");
1272
1310
  case 12:
1273
1311
  // 跨天营业时,endDate 扩展一天以覆盖次日凌晨时段
1274
1312
  config = this.store.slotConfig;
1275
1313
  crossDay = isBusinessHoursCrossDay(config);
1276
1314
  effectiveEndDate = crossDay ? dayjs(params.endDate).add(1, 'day').format('YYYY-MM-DD') : params.endDate;
1277
1315
  if (this.store.date) {
1278
- _context16.next = 17;
1316
+ _context17.next = 17;
1279
1317
  break;
1280
1318
  }
1281
1319
  throw new Error('date 模块未初始化');
1282
1320
  case 17:
1283
- _context16.next = 19;
1321
+ _context17.next = 19;
1284
1322
  return this.store.date.fetchResourceDates({
1285
1323
  query: {
1286
1324
  start_date: params.startDate,
@@ -1290,7 +1328,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1290
1328
  useCache: false
1291
1329
  });
1292
1330
  case 19:
1293
- res = _context16.sent;
1331
+ res = _context17.sent;
1294
1332
  rawData = [];
1295
1333
  if (res !== null && res !== void 0 && res.data && Array.isArray(res.data)) {
1296
1334
  _iterator3 = _createForOfIteratorHelper(res.data);
@@ -1313,16 +1351,16 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1313
1351
  _i3 = 0, _rawData = rawData;
1314
1352
  case 24:
1315
1353
  if (!(_i3 < _rawData.length)) {
1316
- _context16.next = 34;
1354
+ _context17.next = 34;
1317
1355
  break;
1318
1356
  }
1319
1357
  _item = _rawData[_i3];
1320
1358
  mappings = this.resourceProductMap.get(_item.resourceId);
1321
1359
  if (mappings) {
1322
- _context16.next = 29;
1360
+ _context17.next = 29;
1323
1361
  break;
1324
1362
  }
1325
- return _context16.abrupt("continue", 31);
1363
+ return _context17.abrupt("continue", 31);
1326
1364
  case 29:
1327
1365
  _iterator4 = _createForOfIteratorHelper(mappings);
1328
1366
  try {
@@ -1338,7 +1376,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1338
1376
  }
1339
1377
  case 31:
1340
1378
  _i3++;
1341
- _context16.next = 24;
1379
+ _context17.next = 24;
1342
1380
  break;
1343
1381
  case 34:
1344
1382
  this.logMethodSuccess('fetchResourceAvailability', {
@@ -1347,21 +1385,21 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1347
1385
  return sum + r.times.length;
1348
1386
  }, 0)
1349
1387
  });
1350
- _context16.next = 42;
1388
+ _context17.next = 42;
1351
1389
  break;
1352
1390
  case 37:
1353
- _context16.prev = 37;
1354
- _context16.t0 = _context16["catch"](1);
1391
+ _context17.prev = 37;
1392
+ _context17.t0 = _context17["catch"](1);
1355
1393
  this.store.rawResourceData = [];
1356
- this.logMethodError('fetchResourceAvailability', _context16.t0);
1357
- throw _context16.t0;
1394
+ this.logMethodError('fetchResourceAvailability', _context17.t0);
1395
+ throw _context17.t0;
1358
1396
  case 42:
1359
1397
  case "end":
1360
- return _context16.stop();
1398
+ return _context17.stop();
1361
1399
  }
1362
- }, _callee16, this, [[1, 37]]);
1400
+ }, _callee17, this, [[1, 37]]);
1363
1401
  }));
1364
- function fetchResourceAvailability(_x8) {
1402
+ function fetchResourceAvailability(_x9) {
1365
1403
  return _fetchResourceAvailability.apply(this, arguments);
1366
1404
  }
1367
1405
  return fetchResourceAvailability;
@@ -1442,7 +1480,8 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1442
1480
  }, {
1443
1481
  key: "getDateRangeSummary",
1444
1482
  value: function getDateRangeSummary(params) {
1445
- var _this6 = this;
1483
+ var _this$otherParams13,
1484
+ _this7 = this;
1446
1485
  return buildDateRangeSummary({
1447
1486
  startDate: params.startDate,
1448
1487
  endDate: params.endDate,
@@ -1450,8 +1489,9 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1450
1489
  rawResources: this.store.rawResourceData,
1451
1490
  resourceProductMap: this.resourceProductMap,
1452
1491
  quotationModule: this.store.quotation,
1492
+ channel: (_this$otherParams13 = this.otherParams) === null || _this$otherParams13 === void 0 ? void 0 : _this$otherParams13.channel,
1453
1493
  resolveConfig: function resolveConfig(date) {
1454
- return _this6.resolveSlotConfigForDate(date);
1494
+ return _this7.resolveSlotConfigForDate(date);
1455
1495
  }
1456
1496
  });
1457
1497
  }
@@ -1461,6 +1501,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1461
1501
  var resolvedSlotConfig = this.syncOperatingHoursToSlotConfig(date);
1462
1502
  var quotationPriceMap;
1463
1503
  if (this.store.quotation) {
1504
+ var _this$otherParams14;
1464
1505
  var productIds = _toConsumableArray(new Set(_toConsumableArray(this.resourceProductMap.values()).flat().map(function (m) {
1465
1506
  return m.productId;
1466
1507
  })));
@@ -1470,7 +1511,8 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1470
1511
  });
1471
1512
  quotationPriceMap = this.store.quotation.buildProductPriceMap({
1472
1513
  productIds: productIds,
1473
- timePoints: timePoints
1514
+ timePoints: timePoints,
1515
+ channel: (_this$otherParams14 = this.otherParams) === null || _this$otherParams14 === void 0 ? void 0 : _this$otherParams14.channel
1474
1516
  });
1475
1517
  }
1476
1518
  return buildTimeSlotGrid({
@@ -1494,20 +1536,20 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1494
1536
  }, {
1495
1537
  key: "toggleSlot",
1496
1538
  value: function () {
1497
- var _toggleSlot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(slot) {
1539
+ var _toggleSlot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(slot) {
1498
1540
  var mappings, mapping, currentSlots, existIndex, nextSlots, products;
1499
- return _regeneratorRuntime().wrap(function _callee17$(_context17) {
1500
- while (1) switch (_context17.prev = _context17.next) {
1541
+ return _regeneratorRuntime().wrap(function _callee18$(_context18) {
1542
+ while (1) switch (_context18.prev = _context18.next) {
1501
1543
  case 0:
1502
1544
  this.logMethodStart('toggleSlot', {
1503
1545
  resourceId: slot.resourceId,
1504
1546
  productId: slot.productId,
1505
1547
  startTime: slot.startTime
1506
1548
  });
1507
- _context17.prev = 1;
1549
+ _context18.prev = 1;
1508
1550
  mappings = this.resourceProductMap.get(slot.resourceId);
1509
1551
  if (!(!mappings || !mappings.length)) {
1510
- _context17.next = 5;
1552
+ _context18.next = 5;
1511
1553
  break;
1512
1554
  }
1513
1555
  throw new Error("\u672A\u627E\u5230\u8D44\u6E90 ".concat(slot.resourceId, " \u7684\u5546\u54C1\u6620\u5C04"));
@@ -1516,13 +1558,13 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1516
1558
  return m.productId === slot.productId;
1517
1559
  });
1518
1560
  if (mapping) {
1519
- _context17.next = 8;
1561
+ _context18.next = 8;
1520
1562
  break;
1521
1563
  }
1522
1564
  throw new Error("\u8D44\u6E90 ".concat(slot.resourceId, " \u672A\u5173\u8054\u5546\u54C1 ").concat(slot.productId));
1523
1565
  case 8:
1524
1566
  if (this.store.order) {
1525
- _context17.next = 10;
1567
+ _context18.next = 10;
1526
1568
  break;
1527
1569
  }
1528
1570
  throw new Error('order 模块未初始化');
@@ -1538,14 +1580,14 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1538
1580
  } else {
1539
1581
  nextSlots = [].concat(_toConsumableArray(currentSlots), [slot]);
1540
1582
  }
1541
- _context17.next = 15;
1583
+ _context18.next = 15;
1542
1584
  return this.reconcileOrderForResourceProduct(slot.resourceId, slot.productId, nextSlots);
1543
1585
  case 15:
1544
1586
  products = this.store.order.getOrderProducts();
1545
- _context17.next = 18;
1587
+ _context18.next = 18;
1546
1588
  return this.refreshItemRuleQuantityLimits();
1547
1589
  case 18:
1548
- _context17.next = 20;
1590
+ _context18.next = 20;
1549
1591
  return this.refreshCartValidationPassed();
1550
1592
  case 20:
1551
1593
  this.logMethodSuccess('toggleSlot', {
@@ -1554,19 +1596,19 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1554
1596
  productId: slot.productId,
1555
1597
  slotCount: nextSlots.length
1556
1598
  });
1557
- return _context17.abrupt("return", products);
1599
+ return _context18.abrupt("return", products);
1558
1600
  case 24:
1559
- _context17.prev = 24;
1560
- _context17.t0 = _context17["catch"](1);
1561
- this.logMethodError('toggleSlot', _context17.t0);
1562
- throw _context17.t0;
1601
+ _context18.prev = 24;
1602
+ _context18.t0 = _context18["catch"](1);
1603
+ this.logMethodError('toggleSlot', _context18.t0);
1604
+ throw _context18.t0;
1563
1605
  case 28:
1564
1606
  case "end":
1565
- return _context17.stop();
1607
+ return _context18.stop();
1566
1608
  }
1567
- }, _callee17, this, [[1, 24]]);
1609
+ }, _callee18, this, [[1, 24]]);
1568
1610
  }));
1569
- function toggleSlot(_x9) {
1611
+ function toggleSlot(_x10) {
1570
1612
  return _toggleSlot.apply(this, arguments);
1571
1613
  }
1572
1614
  return toggleSlot;
@@ -1644,7 +1686,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1644
1686
  }, {
1645
1687
  key: "isSlotDisabledBySelection",
1646
1688
  value: function isSlotDisabledBySelection(params) {
1647
- var _this7 = this;
1689
+ var _this8 = this;
1648
1690
  var resourceId = params.resourceId,
1649
1691
  productId = params.productId,
1650
1692
  startTime = params.startTime;
@@ -1666,7 +1708,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1666
1708
 
1667
1709
  // 组合资源字段缓存
1668
1710
  var getCombinedChildIds = function getCombinedChildIds(resId) {
1669
- var raw = _this7.store.rawResourceData.find(function (r) {
1711
+ var raw = _this8.store.rawResourceData.find(function (r) {
1670
1712
  return String(r.resourceId) === String(resId);
1671
1713
  });
1672
1714
  var combined = raw === null || raw === void 0 ? void 0 : raw.combined_resource;
@@ -1801,27 +1843,27 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1801
1843
  }, {
1802
1844
  key: "reconcileOrderForResourceProduct",
1803
1845
  value: (function () {
1804
- var _reconcileOrderForResourceProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(resourceId, productId, slots) {
1846
+ var _reconcileOrderForResourceProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(resourceId, productId, slots) {
1805
1847
  var _this$store$order6, _this$store$order6$ge;
1806
- var mappings, mapping, tempOrder, matchesCurrent, merged, rawResource, childRawResources, venueProduct, i, _rawResource$form_id, _venueProduct$is_char, group, identityKey, bookingUuid, startMoment, endMoment, duration, customDepositData, productTitle, resourceEntry, venueProductOrigin, normalizedVenueOrderProduct, venueOrderProduct, booking, products;
1807
- return _regeneratorRuntime().wrap(function _callee18$(_context18) {
1808
- while (1) switch (_context18.prev = _context18.next) {
1848
+ var mappings, mapping, tempOrder, matchesCurrent, merged, rawResource, childRawResources, venueProduct, i, _rawResource$form_id, _venueProduct$is_char, _this$otherParams15, group, identityKey, bookingUuid, startMoment, endMoment, duration, customDepositData, productTitle, resourceEntry, venueProductOrigin, normalizedVenueOrderProduct, venueOrderProduct, booking, products;
1849
+ return _regeneratorRuntime().wrap(function _callee19$(_context19) {
1850
+ while (1) switch (_context19.prev = _context19.next) {
1809
1851
  case 0:
1810
1852
  mappings = this.resourceProductMap.get(resourceId);
1811
1853
  if (!(!mappings || !mappings.length || !this.store.order)) {
1812
- _context18.next = 3;
1854
+ _context19.next = 3;
1813
1855
  break;
1814
1856
  }
1815
- return _context18.abrupt("return");
1857
+ return _context19.abrupt("return");
1816
1858
  case 3:
1817
1859
  mapping = mappings.find(function (m) {
1818
1860
  return m.productId === productId;
1819
1861
  });
1820
1862
  if (mapping) {
1821
- _context18.next = 6;
1863
+ _context19.next = 6;
1822
1864
  break;
1823
1865
  }
1824
- return _context18.abrupt("return");
1866
+ return _context19.abrupt("return");
1825
1867
  case 6:
1826
1868
  tempOrder = this.store.order.ensureTempOrder();
1827
1869
  matchesCurrent = function matchesCurrent(meta, pid) {
@@ -1839,17 +1881,17 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1839
1881
  return Number(bookingProductId) !== Number(productId);
1840
1882
  });
1841
1883
  if (slots.length) {
1842
- _context18.next = 16;
1884
+ _context19.next = 16;
1843
1885
  break;
1844
1886
  }
1845
1887
  this.store.order.applyDiscount();
1846
- _context18.next = 14;
1888
+ _context19.next = 14;
1847
1889
  return this.store.order.recalculateSummary({
1848
1890
  createIfMissing: true
1849
1891
  });
1850
1892
  case 14:
1851
1893
  this.store.order.persistTempOrder();
1852
- return _context18.abrupt("return");
1894
+ return _context19.abrupt("return");
1853
1895
  case 16:
1854
1896
  merged = mergeConsecutiveSlots(slots);
1855
1897
  rawResource = this.store.rawResourceData.find(function (r) {
@@ -1958,7 +2000,8 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1958
2000
  price_breakdown: buildPriceBreakdown({
1959
2001
  group: group,
1960
2002
  productId: mapping.productId,
1961
- quotation: this.store.quotation
2003
+ quotation: this.store.quotation,
2004
+ channel: (_this$otherParams15 = this.otherParams) === null || _this$otherParams15 === void 0 ? void 0 : _this$otherParams15.channel
1962
2005
  })
1963
2006
  }),
1964
2007
  _origin: venueProductOrigin
@@ -1982,11 +2025,11 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1982
2025
 
1983
2026
  // 获取表单信息
1984
2027
  products = ((_this$store$order6 = this.store.order) === null || _this$store$order6 === void 0 || (_this$store$order6$ge = _this$store$order6.getOrderProducts) === null || _this$store$order6$ge === void 0 ? void 0 : _this$store$order6$ge.call(_this$store$order6)) || [];
1985
- _context18.next = 25;
2028
+ _context19.next = 25;
1986
2029
  return this.preloadHolderForms(products);
1987
2030
  case 25:
1988
2031
  this.store.order.applyDiscount();
1989
- _context18.next = 28;
2032
+ _context19.next = 28;
1990
2033
  return this.store.order.recalculateSummary({
1991
2034
  createIfMissing: true
1992
2035
  });
@@ -1994,11 +2037,11 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1994
2037
  this.store.order.persistTempOrder();
1995
2038
  case 29:
1996
2039
  case "end":
1997
- return _context18.stop();
2040
+ return _context19.stop();
1998
2041
  }
1999
- }, _callee18, this);
2042
+ }, _callee19, this);
2000
2043
  }));
2001
- function reconcileOrderForResourceProduct(_x10, _x11, _x12) {
2044
+ function reconcileOrderForResourceProduct(_x11, _x12, _x13) {
2002
2045
  return _reconcileOrderForResourceProduct.apply(this, arguments);
2003
2046
  }
2004
2047
  return reconcileOrderForResourceProduct;
@@ -2006,7 +2049,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2006
2049
  }, {
2007
2050
  key: "getCombinedChildRawResources",
2008
2051
  value: function getCombinedChildRawResources(rawResource) {
2009
- var _this8 = this;
2052
+ var _this9 = this;
2010
2053
  if (!rawResource) return undefined;
2011
2054
  var combined = rawResource.combined_resource;
2012
2055
  if (!combined || combined.status !== 1 || !Array.isArray(combined.resource_ids) || !combined.resource_ids.length) {
@@ -2018,7 +2061,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2018
2061
  try {
2019
2062
  var _loop3 = function _loop3() {
2020
2063
  var id = _step12.value;
2021
- var child = _this8.store.rawResourceData.find(function (r) {
2064
+ var child = _this9.store.rawResourceData.find(function (r) {
2022
2065
  return String(r.resourceId) === String(id);
2023
2066
  });
2024
2067
  if (child) children.push(child);
@@ -2051,35 +2094,35 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2051
2094
  }, {
2052
2095
  key: "loadSchedules",
2053
2096
  value: function () {
2054
- var _loadSchedules = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19() {
2055
- return _regeneratorRuntime().wrap(function _callee19$(_context19) {
2056
- while (1) switch (_context19.prev = _context19.next) {
2097
+ var _loadSchedules = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20() {
2098
+ return _regeneratorRuntime().wrap(function _callee20$(_context20) {
2099
+ while (1) switch (_context20.prev = _context20.next) {
2057
2100
  case 0:
2058
2101
  this.logMethodStart('loadSchedules');
2059
- _context19.prev = 1;
2102
+ _context20.prev = 1;
2060
2103
  if (this.store.schedule) {
2061
- _context19.next = 4;
2104
+ _context20.next = 4;
2062
2105
  break;
2063
2106
  }
2064
2107
  throw new Error('schedule 模块未初始化');
2065
2108
  case 4:
2066
- _context19.next = 6;
2109
+ _context20.next = 6;
2067
2110
  return this.store.schedule.loadAllSchedule();
2068
2111
  case 6:
2069
2112
  this.injectScheduleResolverToQuotation();
2070
2113
  this.logMethodSuccess('loadSchedules');
2071
- _context19.next = 14;
2114
+ _context20.next = 14;
2072
2115
  break;
2073
2116
  case 10:
2074
- _context19.prev = 10;
2075
- _context19.t0 = _context19["catch"](1);
2076
- this.logMethodError('loadSchedules', _context19.t0);
2077
- throw _context19.t0;
2117
+ _context20.prev = 10;
2118
+ _context20.t0 = _context20["catch"](1);
2119
+ this.logMethodError('loadSchedules', _context20.t0);
2120
+ throw _context20.t0;
2078
2121
  case 14:
2079
2122
  case "end":
2080
- return _context19.stop();
2123
+ return _context20.stop();
2081
2124
  }
2082
- }, _callee19, this, [[1, 10]]);
2125
+ }, _callee20, this, [[1, 10]]);
2083
2126
  }));
2084
2127
  function loadSchedules() {
2085
2128
  return _loadSchedules.apply(this, arguments);
@@ -2089,10 +2132,10 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2089
2132
  }, {
2090
2133
  key: "injectScheduleResolverToQuotation",
2091
2134
  value: function injectScheduleResolverToQuotation() {
2092
- var _this9 = this;
2135
+ var _this10 = this;
2093
2136
  if (this.store.quotation && this.store.schedule) {
2094
2137
  this.store.quotation.setScheduleResolver(function (id) {
2095
- return _this9.store.schedule.getScheduleListByIds([id])[0];
2138
+ return _this10.store.schedule.getScheduleListByIds([id])[0];
2096
2139
  });
2097
2140
  }
2098
2141
  }
@@ -2133,15 +2176,15 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2133
2176
  }, {
2134
2177
  key: "onCustomerLogin",
2135
2178
  value: function () {
2136
- var _onCustomerLogin = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(params) {
2137
- return _regeneratorRuntime().wrap(function _callee20$(_context20) {
2138
- while (1) switch (_context20.prev = _context20.next) {
2179
+ var _onCustomerLogin = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(params) {
2180
+ return _regeneratorRuntime().wrap(function _callee21$(_context21) {
2181
+ while (1) switch (_context21.prev = _context21.next) {
2139
2182
  case 0:
2140
2183
  this.logMethodStart('onCustomerLogin', {
2141
2184
  customerId: params.customerId
2142
2185
  });
2143
- _context20.prev = 1;
2144
- _context20.next = 4;
2186
+ _context21.prev = 1;
2187
+ _context21.next = 4;
2145
2188
  return this.refreshOrderMarketingAfterLogin({
2146
2189
  customerId: params.customerId
2147
2190
  });
@@ -2149,20 +2192,20 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2149
2192
  this.logMethodSuccess('onCustomerLogin', {
2150
2193
  customerId: params.customerId
2151
2194
  });
2152
- _context20.next = 11;
2195
+ _context21.next = 11;
2153
2196
  break;
2154
2197
  case 7:
2155
- _context20.prev = 7;
2156
- _context20.t0 = _context20["catch"](1);
2157
- this.logMethodError('onCustomerLogin', _context20.t0);
2158
- throw _context20.t0;
2198
+ _context21.prev = 7;
2199
+ _context21.t0 = _context21["catch"](1);
2200
+ this.logMethodError('onCustomerLogin', _context21.t0);
2201
+ throw _context21.t0;
2159
2202
  case 11:
2160
2203
  case "end":
2161
- return _context20.stop();
2204
+ return _context21.stop();
2162
2205
  }
2163
- }, _callee20, this, [[1, 7]]);
2206
+ }, _callee21, this, [[1, 7]]);
2164
2207
  }));
2165
- function onCustomerLogin(_x13) {
2208
+ function onCustomerLogin(_x14) {
2166
2209
  return _onCustomerLogin.apply(this, arguments);
2167
2210
  }
2168
2211
  return onCustomerLogin;
@@ -2171,7 +2214,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2171
2214
  key: "recalculateOrderPricesFromQuotation",
2172
2215
  value: function recalculateOrderPricesFromQuotation() {
2173
2216
  var _tempOrder$products,
2174
- _this10 = this;
2217
+ _this11 = this;
2175
2218
  if (!this.store.order || !this.store.quotation) return;
2176
2219
  var tempOrder = this.store.order.getTempOrder();
2177
2220
  if (!(tempOrder !== null && tempOrder !== void 0 && (_tempOrder$products = tempOrder.products) !== null && _tempOrder$products !== void 0 && _tempOrder$products.length)) return;
@@ -2183,39 +2226,43 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2183
2226
  var _product$metadata3;
2184
2227
  var product = _step13.value;
2185
2228
  if ((_product$metadata3 = product.metadata) !== null && _product$metadata3 !== void 0 && _product$metadata3.venue_booking) {
2186
- var mappings = _this10.resourceProductMap.get(product.metadata.resource_id);
2229
+ var mappings = _this11.resourceProductMap.get(product.metadata.resource_id);
2187
2230
  if (!mappings || !mappings.length) return 0; // continue
2188
2231
  var mapping = mappings.find(function (m) {
2189
2232
  return Number(m.productId) === Number(product.product_id);
2190
2233
  }) || mappings[0];
2191
2234
  if (!mapping) return 0; // continue
2192
- var slots = expandMergedSlotToIndividual(product, _this10.store.slotConfig.slotDurationMinutes);
2235
+ var slots = expandMergedSlotToIndividual(product, _this11.store.slotConfig.slotDurationMinutes);
2193
2236
  var updatedSlots = slots.map(function (slot) {
2194
- var _getPriceForProduct;
2237
+ var _getPriceForProduct, _this11$otherParams;
2195
2238
  return _objectSpread(_objectSpread({}, slot), {}, {
2196
2239
  productId: mapping.productId,
2197
- price: (_getPriceForProduct = _this10.store.quotation.getPriceForProduct({
2240
+ price: (_getPriceForProduct = _this11.store.quotation.getPriceForProduct({
2198
2241
  productId: mapping.productId,
2199
- datetime: slot.startTime
2242
+ datetime: slot.startTime,
2243
+ channel: (_this11$otherParams = _this11.otherParams) === null || _this11$otherParams === void 0 ? void 0 : _this11$otherParams.channel
2200
2244
  })) !== null && _getPriceForProduct !== void 0 ? _getPriceForProduct : mapping.price
2201
2245
  });
2202
2246
  });
2203
2247
  var merged = mergeConsecutiveSlots(updatedSlots);
2204
2248
  if (merged.length === 1) {
2249
+ var _this11$otherParams2;
2205
2250
  product.selling_price = merged[0].totalPrice;
2206
2251
  product.original_price = merged[0].totalPrice;
2207
2252
  product.metadata.price_breakdown = buildPriceBreakdown({
2208
2253
  group: merged[0],
2209
2254
  productId: mapping.productId,
2210
- quotation: _this10.store.quotation
2255
+ quotation: _this11.store.quotation,
2256
+ channel: (_this11$otherParams2 = _this11.otherParams) === null || _this11$otherParams2 === void 0 ? void 0 : _this11$otherParams2.channel
2211
2257
  });
2212
2258
  }
2213
2259
  } else if (product.product_id != null) {
2214
- var _product$product_vari;
2215
- var quotationPrice = _this10.store.quotation.getPriceForProduct({
2260
+ var _product$product_vari, _this11$otherParams3;
2261
+ var quotationPrice = _this11.store.quotation.getPriceForProduct({
2216
2262
  productId: product.product_id,
2217
2263
  variantId: (_product$product_vari = product.product_variant_id) !== null && _product$product_vari !== void 0 ? _product$product_vari : undefined,
2218
- datetime: now
2264
+ datetime: now,
2265
+ channel: (_this11$otherParams3 = _this11.otherParams) === null || _this11$otherParams3 === void 0 ? void 0 : _this11$otherParams3.channel
2219
2266
  });
2220
2267
  if (quotationPrice !== null) {
2221
2268
  product.selling_price = quotationPrice;
@@ -2237,30 +2284,30 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2237
2284
  }, {
2238
2285
  key: "scanCode",
2239
2286
  value: function () {
2240
- var _scanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(code, customerId) {
2287
+ var _scanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(code, customerId) {
2241
2288
  var result;
2242
- return _regeneratorRuntime().wrap(function _callee21$(_context21) {
2243
- while (1) switch (_context21.prev = _context21.next) {
2289
+ return _regeneratorRuntime().wrap(function _callee22$(_context22) {
2290
+ while (1) switch (_context22.prev = _context22.next) {
2244
2291
  case 0:
2245
2292
  this.logMethodStart('scanCode', {
2246
2293
  code: code
2247
2294
  });
2248
- _context21.prev = 1;
2295
+ _context22.prev = 1;
2249
2296
  if (this.store.order) {
2250
- _context21.next = 4;
2297
+ _context22.next = 4;
2251
2298
  break;
2252
2299
  }
2253
2300
  throw new Error('order 模块未初始化');
2254
2301
  case 4:
2255
- _context21.next = 6;
2302
+ _context22.next = 6;
2256
2303
  return this.store.order.scanCode(code, customerId);
2257
2304
  case 6:
2258
- result = _context21.sent;
2305
+ result = _context22.sent;
2259
2306
  if (!result.isAvailable) {
2260
- _context21.next = 11;
2307
+ _context22.next = 11;
2261
2308
  break;
2262
2309
  }
2263
- _context21.next = 10;
2310
+ _context22.next = 10;
2264
2311
  return this.store.order.recalculateSummary({
2265
2312
  createIfMissing: true
2266
2313
  });
@@ -2270,19 +2317,19 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2270
2317
  this.logMethodSuccess('scanCode', {
2271
2318
  isAvailable: result.isAvailable
2272
2319
  });
2273
- return _context21.abrupt("return", result);
2320
+ return _context22.abrupt("return", result);
2274
2321
  case 15:
2275
- _context21.prev = 15;
2276
- _context21.t0 = _context21["catch"](1);
2277
- this.logMethodError('scanCode', _context21.t0);
2278
- throw _context21.t0;
2322
+ _context22.prev = 15;
2323
+ _context22.t0 = _context22["catch"](1);
2324
+ this.logMethodError('scanCode', _context22.t0);
2325
+ throw _context22.t0;
2279
2326
  case 19:
2280
2327
  case "end":
2281
- return _context21.stop();
2328
+ return _context22.stop();
2282
2329
  }
2283
- }, _callee21, this, [[1, 15]]);
2330
+ }, _callee22, this, [[1, 15]]);
2284
2331
  }));
2285
- function scanCode(_x14, _x15) {
2332
+ function scanCode(_x15, _x16) {
2286
2333
  return _scanCode.apply(this, arguments);
2287
2334
  }
2288
2335
  return scanCode;
@@ -2298,15 +2345,15 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2298
2345
  }, {
2299
2346
  key: "setDiscountSelected",
2300
2347
  value: (function () {
2301
- var _setDiscountSelected = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(params) {
2348
+ var _setDiscountSelected = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(params) {
2302
2349
  var _tempOrder$holder, _this$store$order$get, _this$store$order$get2, list, beforeTarget, updated, updatedTarget, tempOrder, orderStore, discountModule, rulesModule, holders, nextDiscountList, _tempOrder$holder2, result, beforeSelectedIds, _iterator14, _step14, d, selectedResourceIds, _iterator15, _step15, _origin, _product$metadata$sou, _product$metadata4, _product$metadata5, _product$original_pri, product, totalPerUnitDiscount, optionSum, sourcePrice, newSourceSellingPrice, newMainSellingPrice, afterApplyTarget, finalSummary, finalProduct, finalTarget;
2303
- return _regeneratorRuntime().wrap(function _callee22$(_context22) {
2304
- while (1) switch (_context22.prev = _context22.next) {
2350
+ return _regeneratorRuntime().wrap(function _callee23$(_context23) {
2351
+ while (1) switch (_context23.prev = _context23.next) {
2305
2352
  case 0:
2306
2353
  this.logMethodStart('setDiscountSelected', params);
2307
- _context22.prev = 1;
2354
+ _context23.prev = 1;
2308
2355
  if (this.store.order) {
2309
- _context22.next = 4;
2356
+ _context23.next = 4;
2310
2357
  break;
2311
2358
  }
2312
2359
  throw new Error('order 模块未初始化');
@@ -2332,7 +2379,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2332
2379
  form_record_id: tempOrder.holder.form_record_id
2333
2380
  }] : [];
2334
2381
  nextDiscountList = updated;
2335
- _context22.next = 16;
2382
+ _context23.next = 16;
2336
2383
  return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(updated);
2337
2384
  case 16:
2338
2385
  if (rulesModule) {
@@ -2384,26 +2431,26 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2384
2431
  // 目的:避免 unselect 后 selling_price 残留、reselect 时把残留价带进下一轮 Rules 造成双折扣。
2385
2432
  // 手动改价商品(_origin.isManualDiscount=true)不参与券流程归一化,保留手工价。
2386
2433
  _iterator15 = _createForOfIteratorHelper(tempOrder.products);
2387
- _context22.prev = 19;
2434
+ _context23.prev = 19;
2388
2435
  _iterator15.s();
2389
2436
  case 21:
2390
2437
  if ((_step15 = _iterator15.n()).done) {
2391
- _context22.next = 38;
2438
+ _context23.next = 38;
2392
2439
  break;
2393
2440
  }
2394
2441
  product = _step15.value;
2395
2442
  if (!((_origin = product._origin) !== null && _origin !== void 0 && _origin.isManualDiscount)) {
2396
- _context22.next = 25;
2443
+ _context23.next = 25;
2397
2444
  break;
2398
2445
  }
2399
- return _context22.abrupt("continue", 36);
2446
+ return _context23.abrupt("continue", 36);
2400
2447
  case 25:
2401
2448
  if (!(product.discount_list || []).some(isItemRewardProductDiscount)) {
2402
- _context22.next = 28;
2449
+ _context23.next = 28;
2403
2450
  break;
2404
2451
  }
2405
2452
  product.discount_list = (product.discount_list || []).filter(isItemRewardProductDiscount);
2406
- return _context22.abrupt("continue", 36);
2453
+ return _context23.abrupt("continue", 36);
2407
2454
  case 28:
2408
2455
  // 1. 把 product.discount_list 和当前选中的 discount 对齐(剔除已取消的券)
2409
2456
  product.discount_list = (product.discount_list || []).filter(function (pd) {
@@ -2430,22 +2477,22 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2430
2477
  bundle: product.product_bundle
2431
2478
  });
2432
2479
  case 36:
2433
- _context22.next = 21;
2480
+ _context23.next = 21;
2434
2481
  break;
2435
2482
  case 38:
2436
- _context22.next = 43;
2483
+ _context23.next = 43;
2437
2484
  break;
2438
2485
  case 40:
2439
- _context22.prev = 40;
2440
- _context22.t0 = _context22["catch"](19);
2441
- _iterator15.e(_context22.t0);
2486
+ _context23.prev = 40;
2487
+ _context23.t0 = _context23["catch"](19);
2488
+ _iterator15.e(_context23.t0);
2442
2489
  case 43:
2443
- _context22.prev = 43;
2490
+ _context23.prev = 43;
2444
2491
  _iterator15.f();
2445
- return _context22.finish(43);
2492
+ return _context23.finish(43);
2446
2493
  case 46:
2447
2494
  OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
2448
- _context22.next = 49;
2495
+ _context23.next = 49;
2449
2496
  return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
2450
2497
  case 49:
2451
2498
  tempOrder.discount_list = (nextDiscountList || []).filter(function (d) {
@@ -2454,7 +2501,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2454
2501
  afterApplyTarget = this.store.order.getDiscountList().find(function (d) {
2455
2502
  return d.id === params.discountId;
2456
2503
  }) || null;
2457
- _context22.next = 53;
2504
+ _context23.next = 53;
2458
2505
  return this.store.order.recalculateSummary({
2459
2506
  createIfMissing: true
2460
2507
  });
@@ -2466,19 +2513,19 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2466
2513
  finalTarget = this.store.order.getDiscountList().find(function (d) {
2467
2514
  return d.id === params.discountId;
2468
2515
  }) || null;
2469
- return _context22.abrupt("return", this.store.order.getDiscountList());
2516
+ return _context23.abrupt("return", this.store.order.getDiscountList());
2470
2517
  case 61:
2471
- _context22.prev = 61;
2472
- _context22.t1 = _context22["catch"](1);
2473
- this.logMethodError('setDiscountSelected', _context22.t1);
2474
- throw _context22.t1;
2518
+ _context23.prev = 61;
2519
+ _context23.t1 = _context23["catch"](1);
2520
+ this.logMethodError('setDiscountSelected', _context23.t1);
2521
+ throw _context23.t1;
2475
2522
  case 65:
2476
2523
  case "end":
2477
- return _context22.stop();
2524
+ return _context23.stop();
2478
2525
  }
2479
- }, _callee22, this, [[1, 61], [19, 40, 43, 46]]);
2526
+ }, _callee23, this, [[1, 61], [19, 40, 43, 46]]);
2480
2527
  }));
2481
- function setDiscountSelected(_x16) {
2528
+ function setDiscountSelected(_x17) {
2482
2529
  return _setDiscountSelected.apply(this, arguments);
2483
2530
  }
2484
2531
  return setDiscountSelected;
@@ -2486,37 +2533,37 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2486
2533
  }, {
2487
2534
  key: "addNewOrder",
2488
2535
  value: function () {
2489
- var _addNewOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23() {
2536
+ var _addNewOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
2490
2537
  var tempOrder;
2491
- return _regeneratorRuntime().wrap(function _callee23$(_context23) {
2492
- while (1) switch (_context23.prev = _context23.next) {
2538
+ return _regeneratorRuntime().wrap(function _callee24$(_context24) {
2539
+ while (1) switch (_context24.prev = _context24.next) {
2493
2540
  case 0:
2494
2541
  this.logMethodStart('addNewOrder');
2495
- _context23.prev = 1;
2542
+ _context24.prev = 1;
2496
2543
  if (this.store.order) {
2497
- _context23.next = 4;
2544
+ _context24.next = 4;
2498
2545
  break;
2499
2546
  }
2500
2547
  throw new Error('order 模块未初始化');
2501
2548
  case 4:
2502
- _context23.next = 6;
2549
+ _context24.next = 6;
2503
2550
  return this.store.order.addNewOrder();
2504
2551
  case 6:
2505
- tempOrder = _context23.sent;
2552
+ tempOrder = _context24.sent;
2506
2553
  this.logMethodSuccess('addNewOrder', {
2507
2554
  productCount: tempOrder.products.length
2508
2555
  });
2509
- return _context23.abrupt("return", tempOrder);
2556
+ return _context24.abrupt("return", tempOrder);
2510
2557
  case 11:
2511
- _context23.prev = 11;
2512
- _context23.t0 = _context23["catch"](1);
2513
- this.logMethodError('addNewOrder', _context23.t0);
2514
- throw _context23.t0;
2558
+ _context24.prev = 11;
2559
+ _context24.t0 = _context24["catch"](1);
2560
+ this.logMethodError('addNewOrder', _context24.t0);
2561
+ throw _context24.t0;
2515
2562
  case 15:
2516
2563
  case "end":
2517
- return _context23.stop();
2564
+ return _context24.stop();
2518
2565
  }
2519
- }, _callee23, this, [[1, 11]]);
2566
+ }, _callee24, this, [[1, 11]]);
2520
2567
  }));
2521
2568
  function addNewOrder() {
2522
2569
  return _addNewOrder.apply(this, arguments);
@@ -2533,37 +2580,37 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2533
2580
  }, {
2534
2581
  key: "getSummary",
2535
2582
  value: function () {
2536
- var _getSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
2583
+ var _getSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
2537
2584
  var summary;
2538
- return _regeneratorRuntime().wrap(function _callee24$(_context24) {
2539
- while (1) switch (_context24.prev = _context24.next) {
2585
+ return _regeneratorRuntime().wrap(function _callee25$(_context25) {
2586
+ while (1) switch (_context25.prev = _context25.next) {
2540
2587
  case 0:
2541
2588
  this.logMethodStart('getSummary');
2542
- _context24.prev = 1;
2589
+ _context25.prev = 1;
2543
2590
  if (this.store.order) {
2544
- _context24.next = 4;
2591
+ _context25.next = 4;
2545
2592
  break;
2546
2593
  }
2547
2594
  throw new Error('order 模块未初始化');
2548
2595
  case 4:
2549
- _context24.next = 6;
2596
+ _context25.next = 6;
2550
2597
  return this.store.order.getOrderSummary();
2551
2598
  case 6:
2552
- summary = _context24.sent;
2599
+ summary = _context25.sent;
2553
2600
  this.logMethodSuccess('getSummary', {
2554
2601
  totalAmount: summary.total_amount
2555
2602
  });
2556
- return _context24.abrupt("return", summary);
2603
+ return _context25.abrupt("return", summary);
2557
2604
  case 11:
2558
- _context24.prev = 11;
2559
- _context24.t0 = _context24["catch"](1);
2560
- this.logMethodError('getSummary', _context24.t0);
2561
- throw _context24.t0;
2605
+ _context25.prev = 11;
2606
+ _context25.t0 = _context25["catch"](1);
2607
+ this.logMethodError('getSummary', _context25.t0);
2608
+ throw _context25.t0;
2562
2609
  case 15:
2563
2610
  case "end":
2564
- return _context24.stop();
2611
+ return _context25.stop();
2565
2612
  }
2566
- }, _callee24, this, [[1, 11]]);
2613
+ }, _callee25, this, [[1, 11]]);
2567
2614
  }));
2568
2615
  function getSummary() {
2569
2616
  return _getSummary.apply(this, arguments);
@@ -2573,47 +2620,47 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2573
2620
  }, {
2574
2621
  key: "submitOrder",
2575
2622
  value: function () {
2576
- var _submitOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
2577
- var _this$otherParams13, _this$otherParams14, _this$otherParams15, _this$otherParams16, _tempOrder$products2, result, tempOrder;
2578
- return _regeneratorRuntime().wrap(function _callee25$(_context25) {
2579
- while (1) switch (_context25.prev = _context25.next) {
2623
+ var _submitOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26() {
2624
+ var _this$otherParams16, _this$otherParams17, _this$otherParams18, _this$otherParams19, _tempOrder$products2, result, tempOrder;
2625
+ return _regeneratorRuntime().wrap(function _callee26$(_context26) {
2626
+ while (1) switch (_context26.prev = _context26.next) {
2580
2627
  case 0:
2581
2628
  this.logMethodStart('submitOrder');
2582
- _context25.prev = 1;
2583
- _context25.next = 4;
2629
+ _context26.prev = 1;
2630
+ _context26.next = 4;
2584
2631
  return this.validateBeforeSubmitByItemRule();
2585
2632
  case 4:
2586
2633
  if (this.store.order) {
2587
- _context25.next = 6;
2634
+ _context26.next = 6;
2588
2635
  break;
2589
2636
  }
2590
2637
  throw new Error('venueBooking解决方案需要 order 模块支持');
2591
2638
  case 6:
2592
- _context25.next = 8;
2639
+ _context26.next = 8;
2593
2640
  return this.store.order.submitTempOrder({
2594
2641
  cacheId: this.cacheId,
2595
- platform: (_this$otherParams13 = this.otherParams) === null || _this$otherParams13 === void 0 ? void 0 : _this$otherParams13.platform,
2596
- businessCode: (_this$otherParams14 = this.otherParams) === null || _this$otherParams14 === void 0 ? void 0 : _this$otherParams14.businessCode,
2597
- channel: (_this$otherParams15 = this.otherParams) === null || _this$otherParams15 === void 0 ? void 0 : _this$otherParams15.channel,
2598
- type: (_this$otherParams16 = this.otherParams) === null || _this$otherParams16 === void 0 ? void 0 : _this$otherParams16.type
2642
+ platform: (_this$otherParams16 = this.otherParams) === null || _this$otherParams16 === void 0 ? void 0 : _this$otherParams16.platform,
2643
+ businessCode: (_this$otherParams17 = this.otherParams) === null || _this$otherParams17 === void 0 ? void 0 : _this$otherParams17.businessCode,
2644
+ channel: (_this$otherParams18 = this.otherParams) === null || _this$otherParams18 === void 0 ? void 0 : _this$otherParams18.channel,
2645
+ type: (_this$otherParams19 = this.otherParams) === null || _this$otherParams19 === void 0 ? void 0 : _this$otherParams19.type
2599
2646
  });
2600
2647
  case 8:
2601
- result = _context25.sent;
2648
+ result = _context26.sent;
2602
2649
  tempOrder = this.store.order.getTempOrder();
2603
2650
  this.logMethodSuccess('submitOrder', {
2604
2651
  productCount: (tempOrder === null || tempOrder === void 0 || (_tempOrder$products2 = tempOrder.products) === null || _tempOrder$products2 === void 0 ? void 0 : _tempOrder$products2.length) || 0
2605
2652
  });
2606
- return _context25.abrupt("return", result);
2653
+ return _context26.abrupt("return", result);
2607
2654
  case 14:
2608
- _context25.prev = 14;
2609
- _context25.t0 = _context25["catch"](1);
2610
- this.logMethodError('submitOrder', _context25.t0);
2611
- throw _context25.t0;
2655
+ _context26.prev = 14;
2656
+ _context26.t0 = _context26["catch"](1);
2657
+ this.logMethodError('submitOrder', _context26.t0);
2658
+ throw _context26.t0;
2612
2659
  case 18:
2613
2660
  case "end":
2614
- return _context25.stop();
2661
+ return _context26.stop();
2615
2662
  }
2616
- }, _callee25, this, [[1, 14]]);
2663
+ }, _callee26, this, [[1, 14]]);
2617
2664
  }));
2618
2665
  function submitOrder() {
2619
2666
  return _submitOrder.apply(this, arguments);
@@ -2623,18 +2670,18 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2623
2670
  }, {
2624
2671
  key: "addProductToOrder",
2625
2672
  value: function () {
2626
- var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(product) {
2627
- var _product$metadata6, _product$product_vari2, quotationPrice, products;
2628
- return _regeneratorRuntime().wrap(function _callee26$(_context26) {
2629
- while (1) switch (_context26.prev = _context26.next) {
2673
+ var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(product) {
2674
+ var _product$metadata6, _product$product_vari2, _this$otherParams20, quotationPrice, products;
2675
+ return _regeneratorRuntime().wrap(function _callee27$(_context27) {
2676
+ while (1) switch (_context27.prev = _context27.next) {
2630
2677
  case 0:
2631
2678
  this.logMethodStart('addProductToOrder', {
2632
2679
  product_id: product.product_id,
2633
2680
  product_variant_id: product.product_variant_id
2634
2681
  });
2635
- _context26.prev = 1;
2682
+ _context27.prev = 1;
2636
2683
  if (this.store.order) {
2637
- _context26.next = 4;
2684
+ _context27.next = 4;
2638
2685
  break;
2639
2686
  }
2640
2687
  throw new Error('order 模块未初始化');
@@ -2643,7 +2690,8 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2643
2690
  quotationPrice = this.store.quotation.getPriceForProduct({
2644
2691
  productId: product.product_id,
2645
2692
  variantId: (_product$product_vari2 = product.product_variant_id) !== null && _product$product_vari2 !== void 0 ? _product$product_vari2 : undefined,
2646
- datetime: dayjs().format('YYYY-MM-DD HH:mm:ss')
2693
+ datetime: dayjs().format('YYYY-MM-DD HH:mm:ss'),
2694
+ channel: (_this$otherParams20 = this.otherParams) === null || _this$otherParams20 === void 0 ? void 0 : _this$otherParams20.channel
2647
2695
  });
2648
2696
  if (quotationPrice !== null) {
2649
2697
  product.selling_price = quotationPrice;
@@ -2652,32 +2700,32 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2652
2700
  product.original_price = product.selling_price;
2653
2701
  }
2654
2702
  }
2655
- _context26.next = 7;
2703
+ _context27.next = 7;
2656
2704
  return this.store.order.addProductToOrder(product);
2657
2705
  case 7:
2658
- products = _context26.sent;
2659
- _context26.next = 10;
2706
+ products = _context27.sent;
2707
+ _context27.next = 10;
2660
2708
  return this.refreshItemRuleQuantityLimits();
2661
2709
  case 10:
2662
- _context26.next = 12;
2710
+ _context27.next = 12;
2663
2711
  return this.refreshCartValidationPassed();
2664
2712
  case 12:
2665
2713
  this.logMethodSuccess('addProductToOrder', {
2666
2714
  productCount: products.length
2667
2715
  });
2668
- return _context26.abrupt("return", products);
2716
+ return _context27.abrupt("return", products);
2669
2717
  case 16:
2670
- _context26.prev = 16;
2671
- _context26.t0 = _context26["catch"](1);
2672
- this.logMethodError('addProductToOrder', _context26.t0);
2673
- throw _context26.t0;
2718
+ _context27.prev = 16;
2719
+ _context27.t0 = _context27["catch"](1);
2720
+ this.logMethodError('addProductToOrder', _context27.t0);
2721
+ throw _context27.t0;
2674
2722
  case 20:
2675
2723
  case "end":
2676
- return _context26.stop();
2724
+ return _context27.stop();
2677
2725
  }
2678
- }, _callee26, this, [[1, 16]]);
2726
+ }, _callee27, this, [[1, 16]]);
2679
2727
  }));
2680
- function addProductToOrder(_x17) {
2728
+ function addProductToOrder(_x18) {
2681
2729
  return _addProductToOrder.apply(this, arguments);
2682
2730
  }
2683
2731
  return addProductToOrder;
@@ -2685,48 +2733,48 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2685
2733
  }, {
2686
2734
  key: "updateOrderProduct",
2687
2735
  value: function () {
2688
- var _updateOrderProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(params) {
2736
+ var _updateOrderProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(params) {
2689
2737
  var products;
2690
- return _regeneratorRuntime().wrap(function _callee27$(_context27) {
2691
- while (1) switch (_context27.prev = _context27.next) {
2738
+ return _regeneratorRuntime().wrap(function _callee28$(_context28) {
2739
+ while (1) switch (_context28.prev = _context28.next) {
2692
2740
  case 0:
2693
2741
  this.logMethodStart('updateOrderProduct', {
2694
2742
  product_id: params.product_id,
2695
2743
  product_variant_id: params.product_variant_id
2696
2744
  });
2697
- _context27.prev = 1;
2745
+ _context28.prev = 1;
2698
2746
  if (this.store.order) {
2699
- _context27.next = 4;
2747
+ _context28.next = 4;
2700
2748
  break;
2701
2749
  }
2702
2750
  throw new Error('order 模块未初始化');
2703
2751
  case 4:
2704
- _context27.next = 6;
2752
+ _context28.next = 6;
2705
2753
  return this.store.order.updateOrderProduct(params);
2706
2754
  case 6:
2707
- products = _context27.sent;
2708
- _context27.next = 9;
2755
+ products = _context28.sent;
2756
+ _context28.next = 9;
2709
2757
  return this.refreshItemRuleQuantityLimits();
2710
2758
  case 9:
2711
- _context27.next = 11;
2759
+ _context28.next = 11;
2712
2760
  return this.refreshCartValidationPassed();
2713
2761
  case 11:
2714
2762
  this.logMethodSuccess('updateOrderProduct', {
2715
2763
  productCount: products.length
2716
2764
  });
2717
- return _context27.abrupt("return", products);
2765
+ return _context28.abrupt("return", products);
2718
2766
  case 15:
2719
- _context27.prev = 15;
2720
- _context27.t0 = _context27["catch"](1);
2721
- this.logMethodError('updateOrderProduct', _context27.t0);
2722
- throw _context27.t0;
2767
+ _context28.prev = 15;
2768
+ _context28.t0 = _context28["catch"](1);
2769
+ this.logMethodError('updateOrderProduct', _context28.t0);
2770
+ throw _context28.t0;
2723
2771
  case 19:
2724
2772
  case "end":
2725
- return _context27.stop();
2773
+ return _context28.stop();
2726
2774
  }
2727
- }, _callee27, this, [[1, 15]]);
2775
+ }, _callee28, this, [[1, 15]]);
2728
2776
  }));
2729
- function updateOrderProduct(_x18) {
2777
+ function updateOrderProduct(_x19) {
2730
2778
  return _updateOrderProduct.apply(this, arguments);
2731
2779
  }
2732
2780
  return updateOrderProduct;
@@ -2734,66 +2782,66 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2734
2782
  }, {
2735
2783
  key: "removeProductFromOrder",
2736
2784
  value: function () {
2737
- var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(identity) {
2785
+ var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(identity) {
2738
2786
  var _this$store$order$get3, _this$store$order8, _this$store$order$ens, _this$store$order9, _tempOrder$bookings, tempOrder, products, _tempOrder$bookings2, _tempOrder$bookings3, venueProductUids, venueBookingUids, _iterator16, _step16, _product$metadata7, _product$metadata8, product, beforeBookingCount, _this$store$order$per, _this$store$order10;
2739
- return _regeneratorRuntime().wrap(function _callee28$(_context28) {
2740
- while (1) switch (_context28.prev = _context28.next) {
2787
+ return _regeneratorRuntime().wrap(function _callee29$(_context29) {
2788
+ while (1) switch (_context29.prev = _context29.next) {
2741
2789
  case 0:
2742
2790
  this.logMethodStart('removeProductFromOrder', {
2743
2791
  product_id: identity.product_id,
2744
2792
  product_variant_id: identity.product_variant_id
2745
2793
  });
2746
- _context28.prev = 1;
2794
+ _context29.prev = 1;
2747
2795
  if (this.store.order) {
2748
- _context28.next = 4;
2796
+ _context29.next = 4;
2749
2797
  break;
2750
2798
  }
2751
2799
  throw new Error('order 模块未初始化');
2752
2800
  case 4:
2753
2801
  tempOrder = ((_this$store$order$get3 = (_this$store$order8 = this.store.order).getTempOrder) === null || _this$store$order$get3 === void 0 ? void 0 : _this$store$order$get3.call(_this$store$order8)) || ((_this$store$order$ens = (_this$store$order9 = this.store.order).ensureTempOrder) === null || _this$store$order$ens === void 0 ? void 0 : _this$store$order$ens.call(_this$store$order9));
2754
- _context28.next = 7;
2802
+ _context29.next = 7;
2755
2803
  return this.store.order.removeProductFromOrder(identity);
2756
2804
  case 7:
2757
- products = _context28.sent;
2805
+ products = _context29.sent;
2758
2806
  if (!(tempOrder !== null && tempOrder !== void 0 && (_tempOrder$bookings = tempOrder.bookings) !== null && _tempOrder$bookings !== void 0 && _tempOrder$bookings.length)) {
2759
- _context28.next = 33;
2807
+ _context29.next = 33;
2760
2808
  break;
2761
2809
  }
2762
2810
  venueProductUids = new Set();
2763
2811
  venueBookingUids = new Set();
2764
2812
  _iterator16 = _createForOfIteratorHelper(tempOrder.products || []);
2765
- _context28.prev = 12;
2813
+ _context29.prev = 12;
2766
2814
  _iterator16.s();
2767
2815
  case 14:
2768
2816
  if ((_step16 = _iterator16.n()).done) {
2769
- _context28.next = 22;
2817
+ _context29.next = 22;
2770
2818
  break;
2771
2819
  }
2772
2820
  product = _step16.value;
2773
2821
  if (product !== null && product !== void 0 && (_product$metadata7 = product.metadata) !== null && _product$metadata7 !== void 0 && _product$metadata7.venue_booking) {
2774
- _context28.next = 18;
2822
+ _context29.next = 18;
2775
2823
  break;
2776
2824
  }
2777
- return _context28.abrupt("continue", 20);
2825
+ return _context29.abrupt("continue", 20);
2778
2826
  case 18:
2779
2827
  if (product.identity_key) venueProductUids.add(String(product.identity_key));
2780
2828
  if ((_product$metadata8 = product.metadata) !== null && _product$metadata8 !== void 0 && _product$metadata8.booking_uid) {
2781
2829
  venueBookingUids.add(String(product.metadata.booking_uid));
2782
2830
  }
2783
2831
  case 20:
2784
- _context28.next = 14;
2832
+ _context29.next = 14;
2785
2833
  break;
2786
2834
  case 22:
2787
- _context28.next = 27;
2835
+ _context29.next = 27;
2788
2836
  break;
2789
2837
  case 24:
2790
- _context28.prev = 24;
2791
- _context28.t0 = _context28["catch"](12);
2792
- _iterator16.e(_context28.t0);
2838
+ _context29.prev = 24;
2839
+ _context29.t0 = _context29["catch"](12);
2840
+ _iterator16.e(_context29.t0);
2793
2841
  case 27:
2794
- _context28.prev = 27;
2842
+ _context29.prev = 27;
2795
2843
  _iterator16.f();
2796
- return _context28.finish(27);
2844
+ return _context29.finish(27);
2797
2845
  case 30:
2798
2846
  beforeBookingCount = ((_tempOrder$bookings2 = tempOrder.bookings) === null || _tempOrder$bookings2 === void 0 ? void 0 : _tempOrder$bookings2.length) || 0;
2799
2847
  tempOrder.bookings = (tempOrder.bookings || []).filter(function (booking) {
@@ -2810,28 +2858,28 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2810
2858
  (_this$store$order$per = (_this$store$order10 = this.store.order).persistTempOrder) === null || _this$store$order$per === void 0 || _this$store$order$per.call(_this$store$order10);
2811
2859
  }
2812
2860
  case 33:
2813
- _context28.next = 35;
2861
+ _context29.next = 35;
2814
2862
  return this.refreshItemRuleQuantityLimits();
2815
2863
  case 35:
2816
- _context28.next = 37;
2864
+ _context29.next = 37;
2817
2865
  return this.refreshCartValidationPassed();
2818
2866
  case 37:
2819
2867
  this.logMethodSuccess('removeProductFromOrder', {
2820
2868
  productCount: products.length
2821
2869
  });
2822
- return _context28.abrupt("return", products);
2870
+ return _context29.abrupt("return", products);
2823
2871
  case 41:
2824
- _context28.prev = 41;
2825
- _context28.t1 = _context28["catch"](1);
2826
- this.logMethodError('removeProductFromOrder', _context28.t1);
2827
- throw _context28.t1;
2872
+ _context29.prev = 41;
2873
+ _context29.t1 = _context29["catch"](1);
2874
+ this.logMethodError('removeProductFromOrder', _context29.t1);
2875
+ throw _context29.t1;
2828
2876
  case 45:
2829
2877
  case "end":
2830
- return _context28.stop();
2878
+ return _context29.stop();
2831
2879
  }
2832
- }, _callee28, this, [[1, 41], [12, 24, 27, 30]]);
2880
+ }, _callee29, this, [[1, 41], [12, 24, 27, 30]]);
2833
2881
  }));
2834
- function removeProductFromOrder(_x19) {
2882
+ function removeProductFromOrder(_x20) {
2835
2883
  return _removeProductFromOrder.apply(this, arguments);
2836
2884
  }
2837
2885
  return removeProductFromOrder;
@@ -2839,27 +2887,27 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2839
2887
  }, {
2840
2888
  key: "getProductList",
2841
2889
  value: function () {
2842
- var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29() {
2890
+ var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30() {
2843
2891
  var result;
2844
- return _regeneratorRuntime().wrap(function _callee29$(_context29) {
2845
- while (1) switch (_context29.prev = _context29.next) {
2892
+ return _regeneratorRuntime().wrap(function _callee30$(_context30) {
2893
+ while (1) switch (_context30.prev = _context30.next) {
2846
2894
  case 0:
2847
2895
  if (!this.productsLoaded) {
2848
- _context29.next = 2;
2896
+ _context30.next = 2;
2849
2897
  break;
2850
2898
  }
2851
- return _context29.abrupt("return", attachItemRuleLimitsToTopLevelProducts(this.getAddonProductsList(), this.store.itemRuleQuantityLimits || []));
2899
+ return _context30.abrupt("return", attachItemRuleLimitsToTopLevelProducts(this.getAddonProductsList(), this.store.itemRuleQuantityLimits || []));
2852
2900
  case 2:
2853
- _context29.next = 4;
2901
+ _context30.next = 4;
2854
2902
  return this.loadAllProducts();
2855
2903
  case 4:
2856
- result = _context29.sent;
2857
- return _context29.abrupt("return", attachItemRuleLimitsToTopLevelProducts(result.addonProducts, this.store.itemRuleQuantityLimits || []));
2904
+ result = _context30.sent;
2905
+ return _context30.abrupt("return", attachItemRuleLimitsToTopLevelProducts(result.addonProducts, this.store.itemRuleQuantityLimits || []));
2858
2906
  case 6:
2859
2907
  case "end":
2860
- return _context29.stop();
2908
+ return _context30.stop();
2861
2909
  }
2862
- }, _callee29, this);
2910
+ }, _callee30, this);
2863
2911
  }));
2864
2912
  function getProductList() {
2865
2913
  return _getProductList.apply(this, arguments);
@@ -2869,13 +2917,13 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2869
2917
  }, {
2870
2918
  key: "loadOpenDataConfig",
2871
2919
  value: function () {
2872
- var _loadOpenDataConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30() {
2920
+ var _loadOpenDataConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31() {
2873
2921
  var lastFetchedAt, cachedData, openDataConfig;
2874
- return _regeneratorRuntime().wrap(function _callee30$(_context30) {
2875
- while (1) switch (_context30.prev = _context30.next) {
2922
+ return _regeneratorRuntime().wrap(function _callee31$(_context31) {
2923
+ while (1) switch (_context31.prev = _context31.next) {
2876
2924
  case 0:
2877
2925
  if (this.store.openData) {
2878
- _context30.next = 2;
2926
+ _context31.next = 2;
2879
2927
  break;
2880
2928
  }
2881
2929
  throw new Error('openData 模块未初始化');
@@ -2883,42 +2931,42 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2883
2931
  lastFetchedAt = this.store.openData.getLastFetchedAt();
2884
2932
  cachedData = this.store.openData.getOpenData();
2885
2933
  if (!(cachedData && lastFetchedAt && Date.now() - lastFetchedAt < VenueBookingImpl.OPEN_DATA_CACHE_TTL)) {
2886
- _context30.next = 7;
2934
+ _context31.next = 7;
2887
2935
  break;
2888
2936
  }
2889
2937
  this.otherParams.openData = cachedData;
2890
- return _context30.abrupt("return", cachedData);
2938
+ return _context31.abrupt("return", cachedData);
2891
2939
  case 7:
2892
2940
  if (!this.loadOpenDataConfigInFlight) {
2893
- _context30.next = 11;
2941
+ _context31.next = 11;
2894
2942
  break;
2895
2943
  }
2896
- _context30.next = 10;
2944
+ _context31.next = 10;
2897
2945
  return this.loadOpenDataConfigInFlight;
2898
2946
  case 10:
2899
- return _context30.abrupt("return", _context30.sent);
2947
+ return _context31.abrupt("return", _context31.sent);
2900
2948
  case 11:
2901
2949
  this.loadOpenDataConfigInFlight = this.store.openData.fetchOpenData({
2902
2950
  scope: 'board',
2903
2951
  target: 'venue_booking+online_store',
2904
2952
  section_code: [].concat(OPEN_DATA_SECTION_CODES)
2905
2953
  });
2906
- _context30.prev = 12;
2907
- _context30.next = 15;
2954
+ _context31.prev = 12;
2955
+ _context31.next = 15;
2908
2956
  return this.loadOpenDataConfigInFlight;
2909
2957
  case 15:
2910
- openDataConfig = _context30.sent;
2958
+ openDataConfig = _context31.sent;
2911
2959
  this.otherParams.openData = openDataConfig;
2912
- return _context30.abrupt("return", openDataConfig);
2960
+ return _context31.abrupt("return", openDataConfig);
2913
2961
  case 18:
2914
- _context30.prev = 18;
2962
+ _context31.prev = 18;
2915
2963
  this.loadOpenDataConfigInFlight = null;
2916
- return _context30.finish(18);
2964
+ return _context31.finish(18);
2917
2965
  case 21:
2918
2966
  case "end":
2919
- return _context30.stop();
2967
+ return _context31.stop();
2920
2968
  }
2921
- }, _callee30, this, [[12,, 18, 21]]);
2969
+ }, _callee31, this, [[12,, 18, 21]]);
2922
2970
  }));
2923
2971
  function loadOpenDataConfig() {
2924
2972
  return _loadOpenDataConfig.apply(this, arguments);
@@ -2928,29 +2976,29 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2928
2976
  }, {
2929
2977
  key: "loadRuntimeConfigs",
2930
2978
  value: function () {
2931
- var _loadRuntimeConfigs = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31() {
2979
+ var _loadRuntimeConfigs = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32() {
2932
2980
  var itemRuleConfigs;
2933
- return _regeneratorRuntime().wrap(function _callee31$(_context31) {
2934
- while (1) switch (_context31.prev = _context31.next) {
2981
+ return _regeneratorRuntime().wrap(function _callee32$(_context32) {
2982
+ while (1) switch (_context32.prev = _context32.next) {
2935
2983
  case 0:
2936
- _context31.next = 2;
2984
+ _context32.next = 2;
2937
2985
  return this.loadOpenDataConfig();
2938
2986
  case 2:
2939
- _context31.next = 4;
2987
+ _context32.next = 4;
2940
2988
  return this.ensureItemRuleConfigsLoaded();
2941
2989
  case 4:
2942
- itemRuleConfigs = _context31.sent;
2990
+ itemRuleConfigs = _context32.sent;
2943
2991
  this.logMethodSuccess('loadRuntimeConfigs', {
2944
2992
  itemRuleCount: itemRuleConfigs.length
2945
2993
  });
2946
- return _context31.abrupt("return", {
2994
+ return _context32.abrupt("return", {
2947
2995
  itemRuleConfigs: itemRuleConfigs
2948
2996
  });
2949
2997
  case 7:
2950
2998
  case "end":
2951
- return _context31.stop();
2999
+ return _context32.stop();
2952
3000
  }
2953
- }, _callee31, this);
3001
+ }, _callee32, this);
2954
3002
  }));
2955
3003
  function loadRuntimeConfigs() {
2956
3004
  return _loadRuntimeConfigs.apply(this, arguments);
@@ -2960,22 +3008,22 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2960
3008
  }, {
2961
3009
  key: "fetchItemRuleConfigsByModelIds",
2962
3010
  value: function () {
2963
- var _fetchItemRuleConfigsByModelIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(strategyModelIds) {
3011
+ var _fetchItemRuleConfigsByModelIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(strategyModelIds) {
2964
3012
  var result, configs;
2965
- return _regeneratorRuntime().wrap(function _callee32$(_context32) {
2966
- while (1) switch (_context32.prev = _context32.next) {
3013
+ return _regeneratorRuntime().wrap(function _callee33$(_context33) {
3014
+ while (1) switch (_context33.prev = _context33.next) {
2967
3015
  case 0:
2968
3016
  this.logMethodStart('fetchItemRuleConfigsByModelIds', {
2969
3017
  strategyModelIds: strategyModelIds
2970
3018
  });
2971
3019
  if (strategyModelIds.length) {
2972
- _context32.next = 3;
3020
+ _context33.next = 3;
2973
3021
  break;
2974
3022
  }
2975
- return _context32.abrupt("return", []);
3023
+ return _context33.abrupt("return", []);
2976
3024
  case 3:
2977
- _context32.prev = 3;
2978
- _context32.next = 6;
3025
+ _context33.prev = 3;
3026
+ _context33.next = 6;
2979
3027
  return this.request.get('/promotion', {
2980
3028
  skip: 1,
2981
3029
  num: 99,
@@ -2983,7 +3031,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2983
3031
  ids: strategyModelIds
2984
3032
  });
2985
3033
  case 6:
2986
- result = _context32.sent;
3034
+ result = _context33.sent;
2987
3035
  configs = [];
2988
3036
  if (result.code === 200) {
2989
3037
  configs = result.data.list.map(function (item) {
@@ -2994,21 +3042,21 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2994
3042
  strategyModelIds: strategyModelIds,
2995
3043
  strategyCount: configs.length
2996
3044
  });
2997
- return _context32.abrupt("return", configs);
3045
+ return _context33.abrupt("return", configs);
2998
3046
  case 13:
2999
- _context32.prev = 13;
3000
- _context32.t0 = _context32["catch"](3);
3001
- this.logMethodError('fetchItemRuleConfigsByModelIds', _context32.t0, {
3047
+ _context33.prev = 13;
3048
+ _context33.t0 = _context33["catch"](3);
3049
+ this.logMethodError('fetchItemRuleConfigsByModelIds', _context33.t0, {
3002
3050
  strategyModelIds: strategyModelIds
3003
3051
  });
3004
- return _context32.abrupt("return", []);
3052
+ return _context33.abrupt("return", []);
3005
3053
  case 17:
3006
3054
  case "end":
3007
- return _context32.stop();
3055
+ return _context33.stop();
3008
3056
  }
3009
- }, _callee32, this, [[3, 13]]);
3057
+ }, _callee33, this, [[3, 13]]);
3010
3058
  }));
3011
- function fetchItemRuleConfigsByModelIds(_x20) {
3059
+ function fetchItemRuleConfigsByModelIds(_x21) {
3012
3060
  return _fetchItemRuleConfigsByModelIds.apply(this, arguments);
3013
3061
  }
3014
3062
  return fetchItemRuleConfigsByModelIds;
@@ -3016,22 +3064,22 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3016
3064
  }, {
3017
3065
  key: "buildPrefillProductSourceMap",
3018
3066
  value: function () {
3019
- var _buildPrefillProductSourceMap = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33() {
3067
+ var _buildPrefillProductSourceMap = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34() {
3020
3068
  var sourceMap, productList, visited, collectFromValue;
3021
- return _regeneratorRuntime().wrap(function _callee33$(_context33) {
3022
- while (1) switch (_context33.prev = _context33.next) {
3069
+ return _regeneratorRuntime().wrap(function _callee34$(_context34) {
3070
+ while (1) switch (_context34.prev = _context34.next) {
3023
3071
  case 0:
3024
3072
  sourceMap = new Map();
3025
- _context33.prev = 1;
3026
- _context33.next = 4;
3073
+ _context34.prev = 1;
3074
+ _context34.next = 4;
3027
3075
  return this.getProductList();
3028
3076
  case 4:
3029
- productList = _context33.sent;
3077
+ productList = _context34.sent;
3030
3078
  if (Array.isArray(productList)) {
3031
- _context33.next = 7;
3079
+ _context34.next = 7;
3032
3080
  break;
3033
3081
  }
3034
- return _context33.abrupt("return", sourceMap);
3082
+ return _context34.abrupt("return", sourceMap);
3035
3083
  case 7:
3036
3084
  visited = new Set();
3037
3085
  collectFromValue = function collectFromValue(value) {
@@ -3070,19 +3118,19 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3070
3118
  }
3071
3119
  };
3072
3120
  collectFromValue(productList);
3073
- _context33.next = 15;
3121
+ _context34.next = 15;
3074
3122
  break;
3075
3123
  case 12:
3076
- _context33.prev = 12;
3077
- _context33.t0 = _context33["catch"](1);
3078
- this.logMethodError('buildPrefillProductSourceMap', _context33.t0);
3124
+ _context34.prev = 12;
3125
+ _context34.t0 = _context34["catch"](1);
3126
+ this.logMethodError('buildPrefillProductSourceMap', _context34.t0);
3079
3127
  case 15:
3080
- return _context33.abrupt("return", sourceMap);
3128
+ return _context34.abrupt("return", sourceMap);
3081
3129
  case 16:
3082
3130
  case "end":
3083
- return _context33.stop();
3131
+ return _context34.stop();
3084
3132
  }
3085
- }, _callee33, this, [[1, 12]]);
3133
+ }, _callee34, this, [[1, 12]]);
3086
3134
  }));
3087
3135
  function buildPrefillProductSourceMap() {
3088
3136
  return _buildPrefillProductSourceMap.apply(this, arguments);
@@ -3097,56 +3145,56 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3097
3145
  }, {
3098
3146
  key: "ensureItemRuleConfigsLoaded",
3099
3147
  value: function () {
3100
- var _ensureItemRuleConfigsLoaded = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35() {
3101
- var _this11 = this;
3102
- return _regeneratorRuntime().wrap(function _callee35$(_context35) {
3103
- while (1) switch (_context35.prev = _context35.next) {
3148
+ var _ensureItemRuleConfigsLoaded = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36() {
3149
+ var _this12 = this;
3150
+ return _regeneratorRuntime().wrap(function _callee36$(_context36) {
3151
+ while (1) switch (_context36.prev = _context36.next) {
3104
3152
  case 0:
3105
3153
  if (!(this.itemRuleConfigs.length > 0)) {
3106
- _context35.next = 2;
3154
+ _context36.next = 2;
3107
3155
  break;
3108
3156
  }
3109
- return _context35.abrupt("return", this.itemRuleConfigs);
3157
+ return _context36.abrupt("return", this.itemRuleConfigs);
3110
3158
  case 2:
3111
3159
  if (!this.itemRuleConfigsPromise) {
3112
- _context35.next = 4;
3160
+ _context36.next = 4;
3113
3161
  break;
3114
3162
  }
3115
- return _context35.abrupt("return", this.itemRuleConfigsPromise);
3163
+ return _context36.abrupt("return", this.itemRuleConfigsPromise);
3116
3164
  case 4:
3117
- this.itemRuleConfigsPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34() {
3165
+ this.itemRuleConfigsPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35() {
3118
3166
  var runtimeConfig, staticConfigs;
3119
- return _regeneratorRuntime().wrap(function _callee34$(_context34) {
3120
- while (1) switch (_context34.prev = _context34.next) {
3167
+ return _regeneratorRuntime().wrap(function _callee35$(_context35) {
3168
+ while (1) switch (_context35.prev = _context35.next) {
3121
3169
  case 0:
3122
- runtimeConfig = _this11.getItemRuleRuntimeConfig();
3170
+ runtimeConfig = _this12.getItemRuleRuntimeConfig();
3123
3171
  staticConfigs = normalizeItemRuleStrategies(runtimeConfig.strategyConfigs);
3124
3172
  if (!(staticConfigs.length > 0)) {
3125
- _context34.next = 6;
3173
+ _context35.next = 6;
3126
3174
  break;
3127
3175
  }
3128
- _this11.itemRuleConfigs = staticConfigs;
3129
- _this11.itemRuleEvaluator.setStrategyConfigs(staticConfigs);
3130
- return _context34.abrupt("return", _this11.itemRuleConfigs);
3176
+ _this12.itemRuleConfigs = staticConfigs;
3177
+ _this12.itemRuleEvaluator.setStrategyConfigs(staticConfigs);
3178
+ return _context35.abrupt("return", _this12.itemRuleConfigs);
3131
3179
  case 6:
3132
- _this11.itemRuleConfigs = [];
3133
- _this11.itemRuleEvaluator.setStrategyConfigs([]);
3134
- return _context34.abrupt("return", _this11.itemRuleConfigs);
3180
+ _this12.itemRuleConfigs = [];
3181
+ _this12.itemRuleEvaluator.setStrategyConfigs([]);
3182
+ return _context35.abrupt("return", _this12.itemRuleConfigs);
3135
3183
  case 9:
3136
3184
  case "end":
3137
- return _context34.stop();
3185
+ return _context35.stop();
3138
3186
  }
3139
- }, _callee34);
3187
+ }, _callee35);
3140
3188
  }))();
3141
- _context35.next = 7;
3189
+ _context36.next = 7;
3142
3190
  return this.itemRuleConfigsPromise;
3143
3191
  case 7:
3144
- return _context35.abrupt("return", _context35.sent);
3192
+ return _context36.abrupt("return", _context36.sent);
3145
3193
  case 8:
3146
3194
  case "end":
3147
- return _context35.stop();
3195
+ return _context36.stop();
3148
3196
  }
3149
- }, _callee35, this);
3197
+ }, _callee36, this);
3150
3198
  }));
3151
3199
  function ensureItemRuleConfigsLoaded() {
3152
3200
  return _ensureItemRuleConfigsLoaded.apply(this, arguments);
@@ -3156,22 +3204,22 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3156
3204
  }, {
3157
3205
  key: "refreshItemRuleQuantityLimits",
3158
3206
  value: function () {
3159
- var _refreshItemRuleQuantityLimits = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36() {
3207
+ var _refreshItemRuleQuantityLimits = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37() {
3160
3208
  var strategyConfigs, businessData, limits;
3161
- return _regeneratorRuntime().wrap(function _callee36$(_context36) {
3162
- while (1) switch (_context36.prev = _context36.next) {
3209
+ return _regeneratorRuntime().wrap(function _callee37$(_context37) {
3210
+ while (1) switch (_context37.prev = _context37.next) {
3163
3211
  case 0:
3164
- _context36.prev = 0;
3165
- _context36.next = 3;
3212
+ _context37.prev = 0;
3213
+ _context37.next = 3;
3166
3214
  return this.ensureItemRuleConfigsLoaded();
3167
3215
  case 3:
3168
- strategyConfigs = _context36.sent;
3216
+ strategyConfigs = _context37.sent;
3169
3217
  if (strategyConfigs.length) {
3170
- _context36.next = 7;
3218
+ _context37.next = 7;
3171
3219
  break;
3172
3220
  }
3173
3221
  this.store.itemRuleQuantityLimits = [];
3174
- return _context36.abrupt("return", []);
3222
+ return _context37.abrupt("return", []);
3175
3223
  case 7:
3176
3224
  businessData = buildItemRuleBusinessData({
3177
3225
  tempOrder: this.ensureVenueTempOrder(),
@@ -3183,18 +3231,18 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3183
3231
  this.logMethodSuccess('refreshItemRuleQuantityLimits', {
3184
3232
  limitCount: limits.length
3185
3233
  });
3186
- return _context36.abrupt("return", limits);
3234
+ return _context37.abrupt("return", limits);
3187
3235
  case 14:
3188
- _context36.prev = 14;
3189
- _context36.t0 = _context36["catch"](0);
3236
+ _context37.prev = 14;
3237
+ _context37.t0 = _context37["catch"](0);
3190
3238
  this.store.itemRuleQuantityLimits = [];
3191
- this.logMethodError('refreshItemRuleQuantityLimits', _context36.t0);
3192
- return _context36.abrupt("return", []);
3239
+ this.logMethodError('refreshItemRuleQuantityLimits', _context37.t0);
3240
+ return _context37.abrupt("return", []);
3193
3241
  case 19:
3194
3242
  case "end":
3195
- return _context36.stop();
3243
+ return _context37.stop();
3196
3244
  }
3197
- }, _callee36, this, [[0, 14]]);
3245
+ }, _callee37, this, [[0, 14]]);
3198
3246
  }));
3199
3247
  function refreshItemRuleQuantityLimits() {
3200
3248
  return _refreshItemRuleQuantityLimits.apply(this, arguments);
@@ -3204,32 +3252,32 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3204
3252
  }, {
3205
3253
  key: "applyPrefillByItemRule",
3206
3254
  value: function () {
3207
- var _applyPrefillByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37() {
3255
+ var _applyPrefillByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38() {
3208
3256
  var strategyConfigs, businessData, prefillItems, productSourceMap, tempOrder, hasChanges, _iterator18, _step18, _prefillItem$product_, prefillItem, productId, productVariantId, targetQuantity, sourceItem, productIndex, _sourceItem$price, _product$metadata9, sellingPrice, origin, product, productUid, targetProduct, previousOrigin, nextOrigin, existedQuantity, delta, nextProduct, _nextProduct$metadata, _productUid;
3209
- return _regeneratorRuntime().wrap(function _callee37$(_context37) {
3210
- while (1) switch (_context37.prev = _context37.next) {
3257
+ return _regeneratorRuntime().wrap(function _callee38$(_context38) {
3258
+ while (1) switch (_context38.prev = _context38.next) {
3211
3259
  case 0:
3212
3260
  if (!this.itemRulePrefillApplied) {
3213
- _context37.next = 2;
3261
+ _context38.next = 2;
3214
3262
  break;
3215
3263
  }
3216
- return _context37.abrupt("return");
3264
+ return _context38.abrupt("return");
3217
3265
  case 2:
3218
3266
  if (this.store.order) {
3219
- _context37.next = 4;
3267
+ _context38.next = 4;
3220
3268
  break;
3221
3269
  }
3222
- return _context37.abrupt("return");
3270
+ return _context38.abrupt("return");
3223
3271
  case 4:
3224
- _context37.next = 6;
3272
+ _context38.next = 6;
3225
3273
  return this.ensureItemRuleConfigsLoaded();
3226
3274
  case 6:
3227
- strategyConfigs = _context37.sent;
3275
+ strategyConfigs = _context38.sent;
3228
3276
  if (strategyConfigs.length) {
3229
- _context37.next = 9;
3277
+ _context38.next = 9;
3230
3278
  break;
3231
3279
  }
3232
- return _context37.abrupt("return");
3280
+ return _context38.abrupt("return");
3233
3281
  case 9:
3234
3282
  businessData = buildItemRuleBusinessData({
3235
3283
  tempOrder: this.ensureVenueTempOrder(),
@@ -3238,24 +3286,24 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3238
3286
  });
3239
3287
  prefillItems = this.itemRuleEvaluator.getPrefillItems(businessData);
3240
3288
  if (prefillItems.length) {
3241
- _context37.next = 14;
3289
+ _context38.next = 14;
3242
3290
  break;
3243
3291
  }
3244
3292
  this.itemRulePrefillApplied = true;
3245
- return _context37.abrupt("return");
3293
+ return _context38.abrupt("return");
3246
3294
  case 14:
3247
- _context37.next = 16;
3295
+ _context38.next = 16;
3248
3296
  return this.buildPrefillProductSourceMap();
3249
3297
  case 16:
3250
- productSourceMap = _context37.sent;
3298
+ productSourceMap = _context38.sent;
3251
3299
  tempOrder = this.ensureVenueTempOrder();
3252
3300
  hasChanges = false;
3253
3301
  _iterator18 = _createForOfIteratorHelper(prefillItems);
3254
- _context37.prev = 20;
3302
+ _context38.prev = 20;
3255
3303
  _iterator18.s();
3256
3304
  case 22:
3257
3305
  if ((_step18 = _iterator18.n()).done) {
3258
- _context37.next = 51;
3306
+ _context38.next = 51;
3259
3307
  break;
3260
3308
  }
3261
3309
  prefillItem = _step18.value;
@@ -3263,16 +3311,16 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3263
3311
  productVariantId = Number((_prefillItem$product_ = prefillItem.product_variant_id) !== null && _prefillItem$product_ !== void 0 ? _prefillItem$product_ : 0);
3264
3312
  targetQuantity = toNonNegativeInt(prefillItem.quantity);
3265
3313
  if (!(!Number.isFinite(productId) || targetQuantity <= 0)) {
3266
- _context37.next = 29;
3314
+ _context38.next = 29;
3267
3315
  break;
3268
3316
  }
3269
- return _context37.abrupt("continue", 49);
3317
+ return _context38.abrupt("continue", 49);
3270
3318
  case 29:
3271
3319
  if (!Number.isNaN(productVariantId)) {
3272
- _context37.next = 31;
3320
+ _context38.next = 31;
3273
3321
  break;
3274
3322
  }
3275
- return _context37.abrupt("continue", 49);
3323
+ return _context38.abrupt("continue", 49);
3276
3324
  case 31:
3277
3325
  sourceItem = productSourceMap.get(buildProductKey(productId, productVariantId)) || productSourceMap.get(buildProductKey(productId, 0)) || null;
3278
3326
  productIndex = getProductIdentityIndex(tempOrder.products, {
@@ -3280,7 +3328,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3280
3328
  product_variant_id: productVariantId
3281
3329
  });
3282
3330
  if (!(productIndex === -1)) {
3283
- _context37.next = 42;
3331
+ _context38.next = 42;
3284
3332
  break;
3285
3333
  }
3286
3334
  sellingPrice = toPriceString((_sourceItem$price = sourceItem === null || sourceItem === void 0 ? void 0 : sourceItem.price) !== null && _sourceItem$price !== void 0 ? _sourceItem$price : sourceItem === null || sourceItem === void 0 ? void 0 : sourceItem.selling_price, '0.00');
@@ -3304,7 +3352,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3304
3352
  this.attachProductOriginToTempOrder(tempOrder, productUid, origin);
3305
3353
  tempOrder.products.push(product);
3306
3354
  hasChanges = true;
3307
- return _context37.abrupt("continue", 49);
3355
+ return _context38.abrupt("continue", 49);
3308
3356
  case 42:
3309
3357
  targetProduct = tempOrder.products[productIndex];
3310
3358
  previousOrigin = this.readProductOriginFromTempOrder(tempOrder, targetProduct);
@@ -3326,34 +3374,34 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3326
3374
  hasChanges = true;
3327
3375
  }
3328
3376
  case 49:
3329
- _context37.next = 22;
3377
+ _context38.next = 22;
3330
3378
  break;
3331
3379
  case 51:
3332
- _context37.next = 56;
3380
+ _context38.next = 56;
3333
3381
  break;
3334
3382
  case 53:
3335
- _context37.prev = 53;
3336
- _context37.t0 = _context37["catch"](20);
3337
- _iterator18.e(_context37.t0);
3383
+ _context38.prev = 53;
3384
+ _context38.t0 = _context38["catch"](20);
3385
+ _iterator18.e(_context38.t0);
3338
3386
  case 56:
3339
- _context37.prev = 56;
3387
+ _context38.prev = 56;
3340
3388
  _iterator18.f();
3341
- return _context37.finish(56);
3389
+ return _context38.finish(56);
3342
3390
  case 59:
3343
3391
  if (!hasChanges) {
3344
- _context37.next = 64;
3392
+ _context38.next = 64;
3345
3393
  break;
3346
3394
  }
3347
3395
  // Prefill 属于 products CRUD 的一种形式:新增后让 Rules 重算,以支持自动应用可用优惠券。
3348
3396
  this.store.order.applyDiscount();
3349
- _context37.next = 63;
3397
+ _context38.next = 63;
3350
3398
  return this.store.order.recalculateSummary({
3351
3399
  createIfMissing: true
3352
3400
  });
3353
3401
  case 63:
3354
3402
  this.store.order.persistTempOrder();
3355
3403
  case 64:
3356
- _context37.next = 66;
3404
+ _context38.next = 66;
3357
3405
  return this.refreshItemRuleQuantityLimits();
3358
3406
  case 66:
3359
3407
  this.itemRulePrefillApplied = true;
@@ -3363,9 +3411,9 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3363
3411
  });
3364
3412
  case 68:
3365
3413
  case "end":
3366
- return _context37.stop();
3414
+ return _context38.stop();
3367
3415
  }
3368
- }, _callee37, this, [[20, 53, 56, 59]]);
3416
+ }, _callee38, this, [[20, 53, 56, 59]]);
3369
3417
  }));
3370
3418
  function applyPrefillByItemRule() {
3371
3419
  return _applyPrefillByItemRule.apply(this, arguments);
@@ -3375,24 +3423,24 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3375
3423
  }, {
3376
3424
  key: "applyItemRulePrefill",
3377
3425
  value: function () {
3378
- var _applyItemRulePrefill = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38() {
3379
- return _regeneratorRuntime().wrap(function _callee38$(_context38) {
3380
- while (1) switch (_context38.prev = _context38.next) {
3426
+ var _applyItemRulePrefill = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39() {
3427
+ return _regeneratorRuntime().wrap(function _callee39$(_context39) {
3428
+ while (1) switch (_context39.prev = _context39.next) {
3381
3429
  case 0:
3382
3430
  this.logMethodStart('applyItemRulePrefill');
3383
- _context38.next = 3;
3431
+ _context39.next = 3;
3384
3432
  return this.applyPrefillByItemRule();
3385
3433
  case 3:
3386
- _context38.next = 5;
3434
+ _context39.next = 5;
3387
3435
  return this.refreshItemRuleQuantityLimits();
3388
3436
  case 5:
3389
- _context38.next = 7;
3437
+ _context39.next = 7;
3390
3438
  return this.refreshCartValidationPassed();
3391
3439
  case 7:
3392
3440
  case "end":
3393
- return _context38.stop();
3441
+ return _context39.stop();
3394
3442
  }
3395
- }, _callee38, this);
3443
+ }, _callee39, this);
3396
3444
  }));
3397
3445
  function applyItemRulePrefill() {
3398
3446
  return _applyItemRulePrefill.apply(this, arguments);
@@ -3402,20 +3450,20 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3402
3450
  }, {
3403
3451
  key: "evaluateCartValidationByItemRule",
3404
3452
  value: function () {
3405
- var _evaluateCartValidationByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39() {
3453
+ var _evaluateCartValidationByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40() {
3406
3454
  var strategyConfigs, businessData;
3407
- return _regeneratorRuntime().wrap(function _callee39$(_context39) {
3408
- while (1) switch (_context39.prev = _context39.next) {
3455
+ return _regeneratorRuntime().wrap(function _callee40$(_context40) {
3456
+ while (1) switch (_context40.prev = _context40.next) {
3409
3457
  case 0:
3410
- _context39.next = 2;
3458
+ _context40.next = 2;
3411
3459
  return this.ensureItemRuleConfigsLoaded();
3412
3460
  case 2:
3413
- strategyConfigs = _context39.sent;
3461
+ strategyConfigs = _context40.sent;
3414
3462
  if (strategyConfigs.length) {
3415
- _context39.next = 5;
3463
+ _context40.next = 5;
3416
3464
  break;
3417
3465
  }
3418
- return _context39.abrupt("return", {
3466
+ return _context40.abrupt("return", {
3419
3467
  passed: true,
3420
3468
  failures: []
3421
3469
  });
@@ -3425,12 +3473,12 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3425
3473
  runtimeConfig: this.getItemRuleRuntimeConfig(),
3426
3474
  itemRuleConfigs: this.itemRuleConfigs
3427
3475
  });
3428
- return _context39.abrupt("return", this.itemRuleEvaluator.validateCart(businessData));
3476
+ return _context40.abrupt("return", this.itemRuleEvaluator.validateCart(businessData));
3429
3477
  case 7:
3430
3478
  case "end":
3431
- return _context39.stop();
3479
+ return _context40.stop();
3432
3480
  }
3433
- }, _callee39, this);
3481
+ }, _callee40, this);
3434
3482
  }));
3435
3483
  function evaluateCartValidationByItemRule() {
3436
3484
  return _evaluateCartValidationByItemRule.apply(this, arguments);
@@ -3440,20 +3488,20 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3440
3488
  }, {
3441
3489
  key: "validateBeforeSubmitByItemRule",
3442
3490
  value: function () {
3443
- var _validateBeforeSubmitByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40() {
3491
+ var _validateBeforeSubmitByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41() {
3444
3492
  var validationResult, firstFailure, errorMessage, error;
3445
- return _regeneratorRuntime().wrap(function _callee40$(_context40) {
3446
- while (1) switch (_context40.prev = _context40.next) {
3493
+ return _regeneratorRuntime().wrap(function _callee41$(_context41) {
3494
+ while (1) switch (_context41.prev = _context41.next) {
3447
3495
  case 0:
3448
- _context40.next = 2;
3496
+ _context41.next = 2;
3449
3497
  return this.evaluateCartValidationByItemRule();
3450
3498
  case 2:
3451
- validationResult = _context40.sent;
3499
+ validationResult = _context41.sent;
3452
3500
  if (!validationResult.passed) {
3453
- _context40.next = 5;
3501
+ _context41.next = 5;
3454
3502
  break;
3455
3503
  }
3456
- return _context40.abrupt("return");
3504
+ return _context41.abrupt("return");
3457
3505
  case 5:
3458
3506
  firstFailure = validationResult.failures[0];
3459
3507
  errorMessage = (firstFailure === null || firstFailure === void 0 ? void 0 : firstFailure.validationMessage) || '当前购物车未满足商品规则,请调整后再提交';
@@ -3462,9 +3510,9 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3462
3510
  throw error;
3463
3511
  case 10:
3464
3512
  case "end":
3465
- return _context40.stop();
3513
+ return _context41.stop();
3466
3514
  }
3467
- }, _callee40, this);
3515
+ }, _callee41, this);
3468
3516
  }));
3469
3517
  function validateBeforeSubmitByItemRule() {
3470
3518
  return _validateBeforeSubmitByItemRule.apply(this, arguments);
@@ -3474,10 +3522,10 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3474
3522
  }, {
3475
3523
  key: "refreshCartValidationPassed",
3476
3524
  value: function () {
3477
- var _refreshCartValidationPassed = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41() {
3525
+ var _refreshCartValidationPassed = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42() {
3478
3526
  var previous, nextState, validationResult, changed;
3479
- return _regeneratorRuntime().wrap(function _callee41$(_context41) {
3480
- while (1) switch (_context41.prev = _context41.next) {
3527
+ return _regeneratorRuntime().wrap(function _callee42$(_context42) {
3528
+ while (1) switch (_context42.prev = _context42.next) {
3481
3529
  case 0:
3482
3530
  previous = this.store.cartValidation || {
3483
3531
  passed: null,
@@ -3487,20 +3535,20 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3487
3535
  passed: null,
3488
3536
  failures: []
3489
3537
  };
3490
- _context41.prev = 2;
3491
- _context41.next = 5;
3538
+ _context42.prev = 2;
3539
+ _context42.next = 5;
3492
3540
  return this.evaluateCartValidationByItemRule();
3493
3541
  case 5:
3494
- validationResult = _context41.sent;
3542
+ validationResult = _context42.sent;
3495
3543
  nextState = {
3496
3544
  passed: validationResult.passed,
3497
3545
  failures: validationResult.failures || []
3498
3546
  };
3499
- _context41.next = 12;
3547
+ _context42.next = 12;
3500
3548
  break;
3501
3549
  case 9:
3502
- _context41.prev = 9;
3503
- _context41.t0 = _context41["catch"](2);
3550
+ _context42.prev = 9;
3551
+ _context42.t0 = _context42["catch"](2);
3504
3552
  nextState = {
3505
3553
  passed: false,
3506
3554
  failures: []
@@ -3509,21 +3557,21 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3509
3557
  this.store.cartValidation = nextState;
3510
3558
  changed = previous.passed !== nextState.passed || previous.failures !== nextState.failures;
3511
3559
  if (!changed) {
3512
- _context41.next = 17;
3560
+ _context42.next = 17;
3513
3561
  break;
3514
3562
  }
3515
- _context41.next = 17;
3563
+ _context42.next = 17;
3516
3564
  return this.core.effects.emit(VenueBookingHooks.onCartValidationChanged, {
3517
3565
  cartValidation: nextState,
3518
3566
  cartValidationPassed: nextState.passed
3519
3567
  });
3520
3568
  case 17:
3521
- return _context41.abrupt("return", nextState.passed);
3569
+ return _context42.abrupt("return", nextState.passed);
3522
3570
  case 18:
3523
3571
  case "end":
3524
- return _context41.stop();
3572
+ return _context42.stop();
3525
3573
  }
3526
- }, _callee41, this, [[2, 9]]);
3574
+ }, _callee42, this, [[2, 9]]);
3527
3575
  }));
3528
3576
  function refreshCartValidationPassed() {
3529
3577
  return _refreshCartValidationPassed.apply(this, arguments);
@@ -3533,14 +3581,14 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3533
3581
  }, {
3534
3582
  key: "setItemRuleRuntimeConfig",
3535
3583
  value: function () {
3536
- var _setItemRuleRuntimeConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42() {
3584
+ var _setItemRuleRuntimeConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43() {
3537
3585
  var _this$itemRuleRuntime, _this$itemRuleRuntime2;
3538
3586
  var config,
3539
- _args42 = arguments;
3540
- return _regeneratorRuntime().wrap(function _callee42$(_context42) {
3541
- while (1) switch (_context42.prev = _context42.next) {
3587
+ _args43 = arguments;
3588
+ return _regeneratorRuntime().wrap(function _callee43$(_context43) {
3589
+ while (1) switch (_context43.prev = _context43.next) {
3542
3590
  case 0:
3543
- config = _args42.length > 0 && _args42[0] !== undefined ? _args42[0] : {};
3591
+ config = _args43.length > 0 && _args43[0] !== undefined ? _args43[0] : {};
3544
3592
  this.logMethodStart('setItemRuleRuntimeConfig');
3545
3593
  this.itemRuleRuntimeConfig = _objectSpread(_objectSpread(_objectSpread({}, this.itemRuleRuntimeConfig), config), {}, {
3546
3594
  pax: _objectSpread(_objectSpread({}, ((_this$itemRuleRuntime = this.itemRuleRuntimeConfig) === null || _this$itemRuleRuntime === void 0 ? void 0 : _this$itemRuleRuntime.pax) || {}), (config === null || config === void 0 ? void 0 : config.pax) || {}),
@@ -3552,10 +3600,10 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3552
3600
  this.itemRuleEvaluator.setStrategyConfigs([]);
3553
3601
  }
3554
3602
  this.itemRulePrefillApplied = false;
3555
- _context42.next = 7;
3603
+ _context43.next = 7;
3556
3604
  return this.refreshItemRuleQuantityLimits();
3557
3605
  case 7:
3558
- _context42.next = 9;
3606
+ _context43.next = 9;
3559
3607
  return this.refreshCartValidationPassed();
3560
3608
  case 9:
3561
3609
  this.logMethodSuccess('setItemRuleRuntimeConfig', {
@@ -3563,9 +3611,9 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3563
3611
  });
3564
3612
  case 10:
3565
3613
  case "end":
3566
- return _context42.stop();
3614
+ return _context43.stop();
3567
3615
  }
3568
- }, _callee42, this);
3616
+ }, _callee43, this);
3569
3617
  }));
3570
3618
  function setItemRuleRuntimeConfig() {
3571
3619
  return _setItemRuleRuntimeConfig.apply(this, arguments);
@@ -3686,30 +3734,30 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3686
3734
  }, {
3687
3735
  key: "refreshAllHolderFormRecords",
3688
3736
  value: (function () {
3689
- var _refreshAllHolderFormRecords = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(params) {
3737
+ var _refreshAllHolderFormRecords = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(params) {
3690
3738
  var _params$customer_id, _params$useCache;
3691
3739
  var customer_id;
3692
- return _regeneratorRuntime().wrap(function _callee43$(_context43) {
3693
- while (1) switch (_context43.prev = _context43.next) {
3740
+ return _regeneratorRuntime().wrap(function _callee44$(_context44) {
3741
+ while (1) switch (_context44.prev = _context44.next) {
3694
3742
  case 0:
3695
3743
  if (this.store.holder) {
3696
- _context43.next = 2;
3744
+ _context44.next = 2;
3697
3745
  break;
3698
3746
  }
3699
3747
  throw new Error('[VenueBooking] holder 模块未初始化');
3700
3748
  case 2:
3701
3749
  customer_id = (_params$customer_id = params === null || params === void 0 ? void 0 : params.customer_id) !== null && _params$customer_id !== void 0 ? _params$customer_id : this.resolveHolderCustomerId();
3702
- return _context43.abrupt("return", this.store.holder.refreshAllFormRecords(_objectSpread(_objectSpread({}, params), {}, {
3750
+ return _context44.abrupt("return", this.store.holder.refreshAllFormRecords(_objectSpread(_objectSpread({}, params), {}, {
3703
3751
  customer_id: customer_id,
3704
3752
  useCache: (_params$useCache = params === null || params === void 0 ? void 0 : params.useCache) !== null && _params$useCache !== void 0 ? _params$useCache : false
3705
3753
  })));
3706
3754
  case 4:
3707
3755
  case "end":
3708
- return _context43.stop();
3756
+ return _context44.stop();
3709
3757
  }
3710
- }, _callee43, this);
3758
+ }, _callee44, this);
3711
3759
  }));
3712
- function refreshAllHolderFormRecords(_x21) {
3760
+ function refreshAllHolderFormRecords(_x22) {
3713
3761
  return _refreshAllHolderFormRecords.apply(this, arguments);
3714
3762
  }
3715
3763
  return refreshAllHolderFormRecords;
@@ -3729,25 +3777,25 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3729
3777
  }, {
3730
3778
  key: "checkOpenDataAvailability",
3731
3779
  value: function () {
3732
- var _checkOpenDataAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44() {
3733
- return _regeneratorRuntime().wrap(function _callee44$(_context44) {
3734
- while (1) switch (_context44.prev = _context44.next) {
3780
+ var _checkOpenDataAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45() {
3781
+ return _regeneratorRuntime().wrap(function _callee45$(_context45) {
3782
+ while (1) switch (_context45.prev = _context45.next) {
3735
3783
  case 0:
3736
3784
  if (this.store.openData) {
3737
- _context44.next = 2;
3785
+ _context45.next = 2;
3738
3786
  break;
3739
3787
  }
3740
3788
  throw new Error('openData 模块未初始化');
3741
3789
  case 2:
3742
- _context44.next = 4;
3790
+ _context45.next = 4;
3743
3791
  return this.loadOpenDataConfig();
3744
3792
  case 4:
3745
- return _context44.abrupt("return", this.store.openData.checkAvailability(this.store.schedule));
3793
+ return _context45.abrupt("return", this.store.openData.checkAvailability(this.store.schedule));
3746
3794
  case 5:
3747
3795
  case "end":
3748
- return _context44.stop();
3796
+ return _context45.stop();
3749
3797
  }
3750
- }, _callee44, this);
3798
+ }, _callee45, this);
3751
3799
  }));
3752
3800
  function checkOpenDataAvailability() {
3753
3801
  return _checkOpenDataAvailability.apply(this, arguments);
@@ -3757,15 +3805,15 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3757
3805
  }, {
3758
3806
  key: "setOtherParams",
3759
3807
  value: function () {
3760
- var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45(params) {
3808
+ var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46(params) {
3761
3809
  var _ref7,
3762
3810
  _ref7$cover,
3763
3811
  cover,
3764
- _args45 = arguments;
3765
- return _regeneratorRuntime().wrap(function _callee45$(_context45) {
3766
- while (1) switch (_context45.prev = _context45.next) {
3812
+ _args46 = arguments;
3813
+ return _regeneratorRuntime().wrap(function _callee46$(_context46) {
3814
+ while (1) switch (_context46.prev = _context46.next) {
3767
3815
  case 0:
3768
- _ref7 = _args45.length > 1 && _args45[1] !== undefined ? _args45[1] : {}, _ref7$cover = _ref7.cover, cover = _ref7$cover === void 0 ? false : _ref7$cover;
3816
+ _ref7 = _args46.length > 1 && _args46[1] !== undefined ? _args46[1] : {}, _ref7$cover = _ref7.cover, cover = _ref7$cover === void 0 ? false : _ref7$cover;
3769
3817
  if (cover) {
3770
3818
  this.otherParams = params;
3771
3819
  } else {
@@ -3773,11 +3821,11 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3773
3821
  }
3774
3822
  case 2:
3775
3823
  case "end":
3776
- return _context45.stop();
3824
+ return _context46.stop();
3777
3825
  }
3778
- }, _callee45, this);
3826
+ }, _callee46, this);
3779
3827
  }));
3780
- function setOtherParams(_x22) {
3828
+ function setOtherParams(_x23) {
3781
3829
  return _setOtherParams.apply(this, arguments);
3782
3830
  }
3783
3831
  return setOtherParams;