@pisell/pisellos 0.0.549 → 0.0.551
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.
- package/dist/modules/Order/index.d.ts +1 -0
- package/dist/modules/Order/index.js +14 -1
- package/dist/modules/Order/types.d.ts +2 -0
- package/dist/modules/Order/utils.d.ts +9 -0
- package/dist/modules/Order/utils.js +41 -13
- package/dist/plugins/window.d.ts +1 -0
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingByStep/index.js +10 -7
- package/dist/solution/VenueBooking/index.d.ts +17 -0
- package/dist/solution/VenueBooking/index.js +932 -717
- package/dist/solution/VenueBooking/types.d.ts +2 -0
- package/dist/types/index.d.ts +1 -0
- package/lib/modules/Order/index.d.ts +1 -0
- package/lib/modules/Order/index.js +11 -0
- package/lib/modules/Order/types.d.ts +2 -0
- package/lib/modules/Order/utils.d.ts +9 -0
- package/lib/modules/Order/utils.js +32 -5
- package/lib/plugins/window.d.ts +1 -0
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingByStep/index.js +10 -6
- package/lib/solution/VenueBooking/index.d.ts +17 -0
- package/lib/solution/VenueBooking/index.js +114 -6
- package/lib/solution/VenueBooking/types.d.ts +2 -0
- package/lib/types/index.d.ts +1 -0
- package/package.json +2 -2
|
@@ -49,6 +49,8 @@ import { composeLinePrice, createUuidV4, sumOptionUnitPrice } from "../../module
|
|
|
49
49
|
import { OrderModule } from "../../modules/Order";
|
|
50
50
|
import { RegisterAndLoginHooks } from "../RegisterAndLogin/types";
|
|
51
51
|
import Decimal from 'decimal.js';
|
|
52
|
+
import { HolderModule } from "../../modules/Holder";
|
|
53
|
+
import { getFormIdFromHolderConfig, getProductHolderConfig } from "../../modules/Holder/utils";
|
|
52
54
|
export * from "./types";
|
|
53
55
|
var OPEN_DATA_SECTION_CODES = ['basic', 'fulfillment', 'reservation', 'sale', 'menu', 'availability', 'workflow', 'checkout'];
|
|
54
56
|
function cloneCustomDepositData(customDepositData) {
|
|
@@ -288,20 +290,140 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
288
290
|
}
|
|
289
291
|
return null;
|
|
290
292
|
}
|
|
293
|
+
}, {
|
|
294
|
+
key: "resolveHolderCustomerId",
|
|
295
|
+
value: function resolveHolderCustomerId() {
|
|
296
|
+
var _this$window, _this$window$getLocal;
|
|
297
|
+
var customer = JSON.parse(((_this$window = this.window) === null || _this$window === void 0 || (_this$window$getLocal = _this$window.getLocalStorage) === null || _this$window$getLocal === void 0 ? void 0 : _this$window$getLocal.call(_this$window, 'customer')) || '{}');
|
|
298
|
+
if (customer !== null && customer !== void 0 && customer.id) return Number(customer.id);
|
|
299
|
+
return undefined;
|
|
300
|
+
}
|
|
301
|
+
}, {
|
|
302
|
+
key: "ensureProductHolderForm",
|
|
303
|
+
value: function () {
|
|
304
|
+
var _ensureProductHolderForm = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(product) {
|
|
305
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
306
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
307
|
+
case 0:
|
|
308
|
+
if (product) {
|
|
309
|
+
_context3.next = 2;
|
|
310
|
+
break;
|
|
311
|
+
}
|
|
312
|
+
return _context3.abrupt("return");
|
|
313
|
+
case 2:
|
|
314
|
+
_context3.next = 4;
|
|
315
|
+
return this.preloadHolderForms([product]);
|
|
316
|
+
case 4:
|
|
317
|
+
case "end":
|
|
318
|
+
return _context3.stop();
|
|
319
|
+
}
|
|
320
|
+
}, _callee3, this);
|
|
321
|
+
}));
|
|
322
|
+
function ensureProductHolderForm(_x3) {
|
|
323
|
+
return _ensureProductHolderForm.apply(this, arguments);
|
|
324
|
+
}
|
|
325
|
+
return ensureProductHolderForm;
|
|
326
|
+
}()
|
|
327
|
+
/**
|
|
328
|
+
* 按商品 holder_config 预加载表单数据到 holderMap。
|
|
329
|
+
* appointment_booking 在加购时触发;venueBooking 在商品加载后预加载,避免 getHolderFormMap 为空。
|
|
330
|
+
*/
|
|
331
|
+
}, {
|
|
332
|
+
key: "preloadHolderForms",
|
|
333
|
+
value: (function () {
|
|
334
|
+
var _preloadHolderForms = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(products) {
|
|
335
|
+
var seenFormIds, _iterator, _step, product, holderConfig, formId;
|
|
336
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
337
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
338
|
+
case 0:
|
|
339
|
+
if (!(!this.store.holder || !products.length)) {
|
|
340
|
+
_context4.next = 2;
|
|
341
|
+
break;
|
|
342
|
+
}
|
|
343
|
+
return _context4.abrupt("return");
|
|
344
|
+
case 2:
|
|
345
|
+
seenFormIds = new Set();
|
|
346
|
+
_iterator = _createForOfIteratorHelper(products);
|
|
347
|
+
_context4.prev = 4;
|
|
348
|
+
_iterator.s();
|
|
349
|
+
case 6:
|
|
350
|
+
if ((_step = _iterator.n()).done) {
|
|
351
|
+
_context4.next = 25;
|
|
352
|
+
break;
|
|
353
|
+
}
|
|
354
|
+
product = _step.value;
|
|
355
|
+
holderConfig = getProductHolderConfig(product);
|
|
356
|
+
if (holderConfig) {
|
|
357
|
+
_context4.next = 11;
|
|
358
|
+
break;
|
|
359
|
+
}
|
|
360
|
+
return _context4.abrupt("continue", 23);
|
|
361
|
+
case 11:
|
|
362
|
+
formId = getFormIdFromHolderConfig(holderConfig);
|
|
363
|
+
if (!seenFormIds.has(formId)) {
|
|
364
|
+
_context4.next = 14;
|
|
365
|
+
break;
|
|
366
|
+
}
|
|
367
|
+
return _context4.abrupt("continue", 23);
|
|
368
|
+
case 14:
|
|
369
|
+
seenFormIds.add(formId);
|
|
370
|
+
_context4.prev = 15;
|
|
371
|
+
_context4.next = 18;
|
|
372
|
+
return this.store.holder.ensureFormByProduct({
|
|
373
|
+
product: product,
|
|
374
|
+
customer_id: this.resolveHolderCustomerId(),
|
|
375
|
+
shop_id: product.shop_id,
|
|
376
|
+
useCache: true
|
|
377
|
+
});
|
|
378
|
+
case 18:
|
|
379
|
+
_context4.next = 23;
|
|
380
|
+
break;
|
|
381
|
+
case 20:
|
|
382
|
+
_context4.prev = 20;
|
|
383
|
+
_context4.t0 = _context4["catch"](15);
|
|
384
|
+
console.error('[VenueBooking] 预加载 holder 表单失败', {
|
|
385
|
+
formId: formId,
|
|
386
|
+
error: _context4.t0
|
|
387
|
+
});
|
|
388
|
+
case 23:
|
|
389
|
+
_context4.next = 6;
|
|
390
|
+
break;
|
|
391
|
+
case 25:
|
|
392
|
+
_context4.next = 30;
|
|
393
|
+
break;
|
|
394
|
+
case 27:
|
|
395
|
+
_context4.prev = 27;
|
|
396
|
+
_context4.t1 = _context4["catch"](4);
|
|
397
|
+
_iterator.e(_context4.t1);
|
|
398
|
+
case 30:
|
|
399
|
+
_context4.prev = 30;
|
|
400
|
+
_iterator.f();
|
|
401
|
+
return _context4.finish(30);
|
|
402
|
+
case 33:
|
|
403
|
+
case "end":
|
|
404
|
+
return _context4.stop();
|
|
405
|
+
}
|
|
406
|
+
}, _callee4, this, [[4, 27, 30, 33], [15, 20]]);
|
|
407
|
+
}));
|
|
408
|
+
function preloadHolderForms(_x4) {
|
|
409
|
+
return _preloadHolderForms.apply(this, arguments);
|
|
410
|
+
}
|
|
411
|
+
return preloadHolderForms;
|
|
412
|
+
}())
|
|
291
413
|
}, {
|
|
292
414
|
key: "clearLoginEffectListeners",
|
|
293
415
|
value: function clearLoginEffectListeners() {
|
|
294
|
-
var
|
|
295
|
-
|
|
416
|
+
var _iterator2 = _createForOfIteratorHelper(this.loginEffectDisposers),
|
|
417
|
+
_step2;
|
|
296
418
|
try {
|
|
297
|
-
for (
|
|
298
|
-
var dispose =
|
|
419
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
420
|
+
var dispose = _step2.value;
|
|
299
421
|
dispose();
|
|
300
422
|
}
|
|
301
423
|
} catch (err) {
|
|
302
|
-
|
|
424
|
+
_iterator2.e(err);
|
|
303
425
|
} finally {
|
|
304
|
-
|
|
426
|
+
_iterator2.f();
|
|
305
427
|
}
|
|
306
428
|
this.loginEffectDisposers = [];
|
|
307
429
|
}
|
|
@@ -332,29 +454,29 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
332
454
|
var currentAccount = (accountModule === null || accountModule === void 0 || (_accountModule$getCur = accountModule.getCurrentAccount) === null || _accountModule$getCur === void 0 ? void 0 : _accountModule$getCur.call(accountModule)) || (accountModule === null || accountModule === void 0 || (_accountModule$getAcc = accountModule.getAccount) === null || _accountModule$getAcc === void 0 ? void 0 : _accountModule$getAcc.call(accountModule)) || null;
|
|
333
455
|
var createHandleLogin = function createHandleLogin(eventName) {
|
|
334
456
|
return /*#__PURE__*/function () {
|
|
335
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
457
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(payload) {
|
|
336
458
|
var customerId;
|
|
337
|
-
return _regeneratorRuntime().wrap(function
|
|
338
|
-
while (1) switch (
|
|
459
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
460
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
339
461
|
case 0:
|
|
340
462
|
customerId = _this2.resolveCustomerIdFromLoginPayload(payload);
|
|
341
463
|
if (customerId) {
|
|
342
|
-
|
|
464
|
+
_context5.next = 3;
|
|
343
465
|
break;
|
|
344
466
|
}
|
|
345
|
-
return
|
|
467
|
+
return _context5.abrupt("return");
|
|
346
468
|
case 3:
|
|
347
|
-
|
|
469
|
+
_context5.next = 5;
|
|
348
470
|
return _this2.refreshOrderMarketingAfterLogin({
|
|
349
471
|
customerId: customerId
|
|
350
472
|
});
|
|
351
473
|
case 5:
|
|
352
474
|
case "end":
|
|
353
|
-
return
|
|
475
|
+
return _context5.stop();
|
|
354
476
|
}
|
|
355
|
-
},
|
|
477
|
+
}, _callee5);
|
|
356
478
|
}));
|
|
357
|
-
return function (
|
|
479
|
+
return function (_x5) {
|
|
358
480
|
return _ref.apply(this, arguments);
|
|
359
481
|
};
|
|
360
482
|
}();
|
|
@@ -365,97 +487,97 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
365
487
|
}, {
|
|
366
488
|
key: "refreshOrderMarketingAfterLogin",
|
|
367
489
|
value: function () {
|
|
368
|
-
var _refreshOrderMarketingAfterLogin = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
490
|
+
var _refreshOrderMarketingAfterLogin = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(params) {
|
|
369
491
|
var _this3 = this;
|
|
370
492
|
var refreshTask;
|
|
371
|
-
return _regeneratorRuntime().wrap(function
|
|
372
|
-
while (1) switch (
|
|
493
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
494
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
373
495
|
case 0:
|
|
374
496
|
if (this.store.order) {
|
|
375
|
-
|
|
497
|
+
_context7.next = 2;
|
|
376
498
|
break;
|
|
377
499
|
}
|
|
378
500
|
throw new Error('order 模块未初始化');
|
|
379
501
|
case 2:
|
|
380
502
|
if (!this.customerLoginRefreshInFlight) {
|
|
381
|
-
|
|
503
|
+
_context7.next = 9;
|
|
382
504
|
break;
|
|
383
505
|
}
|
|
384
506
|
if (!(this.customerLoginRefreshIdInFlight === params.customerId)) {
|
|
385
|
-
|
|
507
|
+
_context7.next = 7;
|
|
386
508
|
break;
|
|
387
509
|
}
|
|
388
|
-
|
|
510
|
+
_context7.next = 6;
|
|
389
511
|
return this.customerLoginRefreshInFlight;
|
|
390
512
|
case 6:
|
|
391
|
-
return
|
|
513
|
+
return _context7.abrupt("return");
|
|
392
514
|
case 7:
|
|
393
|
-
|
|
515
|
+
_context7.next = 9;
|
|
394
516
|
return this.customerLoginRefreshInFlight;
|
|
395
517
|
case 9:
|
|
396
518
|
this.customerLoginRefreshIdInFlight = params.customerId;
|
|
397
|
-
refreshTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
519
|
+
refreshTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
398
520
|
var _this3$otherParams;
|
|
399
|
-
return _regeneratorRuntime().wrap(function
|
|
400
|
-
while (1) switch (
|
|
521
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
522
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
401
523
|
case 0:
|
|
402
524
|
if (!_this3.store.quotation) {
|
|
403
|
-
|
|
525
|
+
_context6.next = 3;
|
|
404
526
|
break;
|
|
405
527
|
}
|
|
406
|
-
|
|
528
|
+
_context6.next = 3;
|
|
407
529
|
return _this3.store.quotation.loadQuotations({
|
|
408
530
|
channel: (_this3$otherParams = _this3.otherParams) === null || _this3$otherParams === void 0 ? void 0 : _this3$otherParams.channel
|
|
409
531
|
});
|
|
410
532
|
case 3:
|
|
411
533
|
_this3.recalculateOrderPricesFromQuotation();
|
|
412
|
-
|
|
534
|
+
_context6.next = 6;
|
|
413
535
|
return _this3.store.order.loadDiscountConfig({
|
|
414
536
|
customerId: params.customerId
|
|
415
537
|
});
|
|
416
538
|
case 6:
|
|
417
|
-
|
|
539
|
+
_context6.next = 8;
|
|
418
540
|
return _this3.store.order.recalculateSummary({
|
|
419
541
|
createIfMissing: true
|
|
420
542
|
});
|
|
421
543
|
case 8:
|
|
422
544
|
_this3.store.order.persistTempOrder();
|
|
423
|
-
|
|
545
|
+
_context6.next = 11;
|
|
424
546
|
return _this3.refreshItemRuleQuantityLimits();
|
|
425
547
|
case 11:
|
|
426
|
-
|
|
548
|
+
_context6.next = 13;
|
|
427
549
|
return _this3.refreshCartValidationPassed();
|
|
428
550
|
case 13:
|
|
429
551
|
case "end":
|
|
430
|
-
return
|
|
552
|
+
return _context6.stop();
|
|
431
553
|
}
|
|
432
|
-
},
|
|
554
|
+
}, _callee6);
|
|
433
555
|
}))();
|
|
434
556
|
this.customerLoginRefreshInFlight = refreshTask;
|
|
435
|
-
|
|
436
|
-
|
|
557
|
+
_context7.prev = 12;
|
|
558
|
+
_context7.next = 15;
|
|
437
559
|
return refreshTask;
|
|
438
560
|
case 15:
|
|
439
|
-
|
|
561
|
+
_context7.next = 20;
|
|
440
562
|
break;
|
|
441
563
|
case 17:
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
throw
|
|
564
|
+
_context7.prev = 17;
|
|
565
|
+
_context7.t0 = _context7["catch"](12);
|
|
566
|
+
throw _context7.t0;
|
|
445
567
|
case 20:
|
|
446
|
-
|
|
568
|
+
_context7.prev = 20;
|
|
447
569
|
if (this.customerLoginRefreshInFlight === refreshTask) {
|
|
448
570
|
this.customerLoginRefreshInFlight = null;
|
|
449
571
|
this.customerLoginRefreshIdInFlight = null;
|
|
450
572
|
}
|
|
451
|
-
return
|
|
573
|
+
return _context7.finish(20);
|
|
452
574
|
case 23:
|
|
453
575
|
case "end":
|
|
454
|
-
return
|
|
576
|
+
return _context7.stop();
|
|
455
577
|
}
|
|
456
|
-
},
|
|
578
|
+
}, _callee7, this, [[12, 17, 20, 23]]);
|
|
457
579
|
}));
|
|
458
|
-
function refreshOrderMarketingAfterLogin(
|
|
580
|
+
function refreshOrderMarketingAfterLogin(_x6) {
|
|
459
581
|
return _refreshOrderMarketingAfterLogin.apply(this, arguments);
|
|
460
582
|
}
|
|
461
583
|
return refreshOrderMarketingAfterLogin;
|
|
@@ -463,7 +585,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
463
585
|
}, {
|
|
464
586
|
key: "initialize",
|
|
465
587
|
value: function () {
|
|
466
|
-
var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
588
|
+
var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(core) {
|
|
467
589
|
var _options$otherParams,
|
|
468
590
|
_options$otherParams2,
|
|
469
591
|
_this$otherParams,
|
|
@@ -471,7 +593,10 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
471
593
|
_this$otherParams3,
|
|
472
594
|
_this4 = this,
|
|
473
595
|
_this$otherParams4,
|
|
474
|
-
_this$otherParams5
|
|
596
|
+
_this$otherParams5,
|
|
597
|
+
_this$otherParams6,
|
|
598
|
+
_this$otherParams7,
|
|
599
|
+
_this$otherParams8;
|
|
475
600
|
var options,
|
|
476
601
|
baseModules,
|
|
477
602
|
venueProductsModule,
|
|
@@ -480,15 +605,20 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
480
605
|
scheduleModule,
|
|
481
606
|
quotationModule,
|
|
482
607
|
openDataModule,
|
|
608
|
+
holderCacheState,
|
|
609
|
+
sessionData,
|
|
610
|
+
_data$this$otherParam,
|
|
611
|
+
data,
|
|
612
|
+
holderModule,
|
|
483
613
|
_this$store$order,
|
|
484
614
|
_this$store$order2,
|
|
485
615
|
_this$store$quotation,
|
|
486
|
-
_this$
|
|
487
|
-
|
|
488
|
-
return _regeneratorRuntime().wrap(function
|
|
489
|
-
while (1) switch (
|
|
616
|
+
_this$otherParams9,
|
|
617
|
+
_args8 = arguments;
|
|
618
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
619
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
490
620
|
case 0:
|
|
491
|
-
options =
|
|
621
|
+
options = _args8.length > 1 && _args8[1] !== undefined ? _args8[1] : {};
|
|
492
622
|
this.logMethodStart('initialize');
|
|
493
623
|
this.core = core;
|
|
494
624
|
this.initializeOptions = options || {};
|
|
@@ -513,14 +643,14 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
513
643
|
this.window = core.getPlugin('window');
|
|
514
644
|
this.request = core.getPlugin('request');
|
|
515
645
|
if (this.window) {
|
|
516
|
-
|
|
646
|
+
_context8.next = 24;
|
|
517
647
|
break;
|
|
518
648
|
}
|
|
519
649
|
this.logMethodError('initialize', 'window plugin missing');
|
|
520
650
|
throw new Error('venueBooking解决方案需要 window 插件支持');
|
|
521
651
|
case 24:
|
|
522
652
|
if (this.request) {
|
|
523
|
-
|
|
653
|
+
_context8.next = 27;
|
|
524
654
|
break;
|
|
525
655
|
}
|
|
526
656
|
this.logMethodError('initialize', 'request plugin missing');
|
|
@@ -617,65 +747,86 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
617
747
|
cacheId: (_this$otherParams5 = this.otherParams) === null || _this$otherParams5 === void 0 ? void 0 : _this$otherParams5.cacheId
|
|
618
748
|
})
|
|
619
749
|
});
|
|
750
|
+
if ((_this$otherParams6 = this.otherParams) !== null && _this$otherParams6 !== void 0 && _this$otherParams6.cacheId) {
|
|
751
|
+
sessionData = this.window.sessionStorage.getItem(this.name);
|
|
752
|
+
if (sessionData) {
|
|
753
|
+
try {
|
|
754
|
+
data = JSON.parse(sessionData);
|
|
755
|
+
holderCacheState = (_data$this$otherParam = data[this.otherParams.cacheId]) === null || _data$this$otherParam === void 0 ? void 0 : _data$this$otherParam["".concat(this.name, "_holder")];
|
|
756
|
+
} catch (_unused2) {
|
|
757
|
+
// ignore invalid session cache
|
|
758
|
+
}
|
|
759
|
+
}
|
|
760
|
+
}
|
|
761
|
+
holderModule = new HolderModule("".concat(this.name, "_holder"));
|
|
762
|
+
this.store.holder = holderModule;
|
|
763
|
+
this.core.registerModule(holderModule, {
|
|
764
|
+
initialState: holderCacheState,
|
|
765
|
+
otherParams: _objectSpread(_objectSpread({}, this.otherParams), {}, {
|
|
766
|
+
fatherModule: this.name,
|
|
767
|
+
openCache: !!((_this$otherParams7 = this.otherParams) !== null && _this$otherParams7 !== void 0 && _this$otherParams7.cacheId),
|
|
768
|
+
cacheId: (_this$otherParams8 = this.otherParams) === null || _this$otherParams8 === void 0 ? void 0 : _this$otherParams8.cacheId
|
|
769
|
+
})
|
|
770
|
+
});
|
|
620
771
|
if (this.store.scanOrderLogger) {
|
|
621
772
|
this.store.scanOrderLogger.setContext(this.getLoggerContext());
|
|
622
773
|
}
|
|
623
774
|
this.registerCustomerLoginListeners();
|
|
624
775
|
console.log('[VenueBooking] 初始化开始');
|
|
625
|
-
|
|
626
|
-
|
|
776
|
+
_context8.prev = 54;
|
|
777
|
+
_context8.next = 57;
|
|
627
778
|
return (_this$store$order = this.store.order) === null || _this$store$order === void 0 ? void 0 : _this$store$order.recalculateSummary({
|
|
628
779
|
createIfMissing: false
|
|
629
780
|
});
|
|
630
|
-
case
|
|
781
|
+
case 57:
|
|
631
782
|
(_this$store$order2 = this.store.order) === null || _this$store$order2 === void 0 || _this$store$order2.persistTempOrder();
|
|
632
|
-
|
|
783
|
+
_context8.next = 60;
|
|
633
784
|
return this.loadRuntimeConfigs();
|
|
634
|
-
case
|
|
785
|
+
case 60:
|
|
635
786
|
if (!this.store.schedule) {
|
|
636
|
-
|
|
787
|
+
_context8.next = 65;
|
|
637
788
|
break;
|
|
638
789
|
}
|
|
639
|
-
|
|
790
|
+
_context8.next = 63;
|
|
640
791
|
return this.store.schedule.loadAllSchedule();
|
|
641
|
-
case
|
|
792
|
+
case 63:
|
|
642
793
|
this.injectScheduleResolverToQuotation();
|
|
643
794
|
(_this$store$quotation = this.store.quotation) === null || _this$store$quotation === void 0 || _this$store$quotation.loadQuotations({
|
|
644
|
-
channel: (_this$
|
|
795
|
+
channel: (_this$otherParams9 = this.otherParams) === null || _this$otherParams9 === void 0 ? void 0 : _this$otherParams9.channel
|
|
645
796
|
});
|
|
646
|
-
case
|
|
647
|
-
|
|
797
|
+
case 65:
|
|
798
|
+
_context8.next = 67;
|
|
648
799
|
return this.refreshItemRuleQuantityLimits();
|
|
649
|
-
case
|
|
800
|
+
case 67:
|
|
650
801
|
this.store.status = 'ready';
|
|
651
802
|
console.log('[VenueBooking] 初始化完成');
|
|
652
|
-
|
|
803
|
+
_context8.next = 71;
|
|
653
804
|
return this.core.effects.emit(VenueBookingHooks.onInited, {
|
|
654
805
|
status: this.store.status
|
|
655
806
|
});
|
|
656
|
-
case
|
|
807
|
+
case 71:
|
|
657
808
|
this.logMethodSuccess('initialize', {
|
|
658
809
|
status: this.store.status
|
|
659
810
|
});
|
|
660
|
-
|
|
811
|
+
_context8.next = 81;
|
|
661
812
|
break;
|
|
662
|
-
case
|
|
663
|
-
|
|
664
|
-
|
|
813
|
+
case 74:
|
|
814
|
+
_context8.prev = 74;
|
|
815
|
+
_context8.t0 = _context8["catch"](54);
|
|
665
816
|
this.store.status = 'error';
|
|
666
|
-
this.store.error =
|
|
667
|
-
console.error('[VenueBooking] 初始化失败',
|
|
668
|
-
this.logMethodError('initialize',
|
|
817
|
+
this.store.error = _context8.t0 instanceof Error ? _context8.t0.message : '初始化失败';
|
|
818
|
+
console.error('[VenueBooking] 初始化失败', _context8.t0);
|
|
819
|
+
this.logMethodError('initialize', _context8.t0, {
|
|
669
820
|
status: this.store.status
|
|
670
821
|
});
|
|
671
|
-
throw
|
|
672
|
-
case
|
|
822
|
+
throw _context8.t0;
|
|
823
|
+
case 81:
|
|
673
824
|
case "end":
|
|
674
|
-
return
|
|
825
|
+
return _context8.stop();
|
|
675
826
|
}
|
|
676
|
-
},
|
|
827
|
+
}, _callee8, this, [[54, 74]]);
|
|
677
828
|
}));
|
|
678
|
-
function initialize(
|
|
829
|
+
function initialize(_x7) {
|
|
679
830
|
return _initialize.apply(this, arguments);
|
|
680
831
|
}
|
|
681
832
|
return initialize;
|
|
@@ -683,22 +834,22 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
683
834
|
}, {
|
|
684
835
|
key: "destroy",
|
|
685
836
|
value: function () {
|
|
686
|
-
var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
687
|
-
return _regeneratorRuntime().wrap(function
|
|
688
|
-
while (1) switch (
|
|
837
|
+
var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
|
|
838
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
839
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
689
840
|
case 0:
|
|
690
841
|
this.logMethodStart('destroy');
|
|
691
842
|
this.clearLoginEffectListeners();
|
|
692
|
-
|
|
843
|
+
_context9.next = 4;
|
|
693
844
|
return this.core.effects.emit(VenueBookingHooks.onDestroy, {});
|
|
694
845
|
case 4:
|
|
695
846
|
console.log('[VenueBooking] 已销毁');
|
|
696
847
|
this.logMethodSuccess('destroy');
|
|
697
848
|
case 6:
|
|
698
849
|
case "end":
|
|
699
|
-
return
|
|
850
|
+
return _context9.stop();
|
|
700
851
|
}
|
|
701
|
-
},
|
|
852
|
+
}, _callee9, this);
|
|
702
853
|
}));
|
|
703
854
|
function destroy() {
|
|
704
855
|
return _destroy.apply(this, arguments);
|
|
@@ -708,32 +859,32 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
708
859
|
}, {
|
|
709
860
|
key: "retryInit",
|
|
710
861
|
value: function () {
|
|
711
|
-
var _retryInit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
712
|
-
return _regeneratorRuntime().wrap(function
|
|
713
|
-
while (1) switch (
|
|
862
|
+
var _retryInit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
|
|
863
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
864
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
714
865
|
case 0:
|
|
715
866
|
this.logMethodStart('retryInit');
|
|
716
867
|
console.log('[VenueBooking] retryInit 调用');
|
|
717
|
-
|
|
868
|
+
_context10.next = 4;
|
|
718
869
|
return this.core.effects.emit(VenueBookingHooks.onRetryInit, {});
|
|
719
870
|
case 4:
|
|
720
|
-
|
|
721
|
-
|
|
871
|
+
_context10.prev = 4;
|
|
872
|
+
_context10.next = 7;
|
|
722
873
|
return this.initialize(this.core, this.initializeOptions);
|
|
723
874
|
case 7:
|
|
724
875
|
this.logMethodSuccess('retryInit');
|
|
725
|
-
|
|
876
|
+
_context10.next = 14;
|
|
726
877
|
break;
|
|
727
878
|
case 10:
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
this.logMethodError('retryInit',
|
|
731
|
-
throw
|
|
879
|
+
_context10.prev = 10;
|
|
880
|
+
_context10.t0 = _context10["catch"](4);
|
|
881
|
+
this.logMethodError('retryInit', _context10.t0);
|
|
882
|
+
throw _context10.t0;
|
|
732
883
|
case 14:
|
|
733
884
|
case "end":
|
|
734
|
-
return
|
|
885
|
+
return _context10.stop();
|
|
735
886
|
}
|
|
736
|
-
},
|
|
887
|
+
}, _callee10, this, [[4, 10]]);
|
|
737
888
|
}));
|
|
738
889
|
function retryInit() {
|
|
739
890
|
return _retryInit.apply(this, arguments);
|
|
@@ -743,22 +894,22 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
743
894
|
}, {
|
|
744
895
|
key: "refresh",
|
|
745
896
|
value: function () {
|
|
746
|
-
var _refresh = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
747
|
-
return _regeneratorRuntime().wrap(function
|
|
748
|
-
while (1) switch (
|
|
897
|
+
var _refresh = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
|
|
898
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
899
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
749
900
|
case 0:
|
|
750
901
|
this.logMethodStart('refresh');
|
|
751
902
|
console.log('[VenueBooking] refresh 调用');
|
|
752
|
-
|
|
903
|
+
_context11.prev = 2;
|
|
753
904
|
this.store.status = 'initializing';
|
|
754
|
-
|
|
905
|
+
_context11.next = 6;
|
|
755
906
|
return this.loadRuntimeConfigs();
|
|
756
907
|
case 6:
|
|
757
|
-
|
|
908
|
+
_context11.next = 8;
|
|
758
909
|
return this.refreshItemRuleQuantityLimits();
|
|
759
910
|
case 8:
|
|
760
911
|
this.store.status = 'ready';
|
|
761
|
-
|
|
912
|
+
_context11.next = 11;
|
|
762
913
|
return this.core.effects.emit(VenueBookingHooks.onRefresh, {
|
|
763
914
|
status: this.store.status
|
|
764
915
|
});
|
|
@@ -766,18 +917,18 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
766
917
|
this.logMethodSuccess('refresh', {
|
|
767
918
|
status: this.store.status
|
|
768
919
|
});
|
|
769
|
-
|
|
920
|
+
_context11.next = 18;
|
|
770
921
|
break;
|
|
771
922
|
case 14:
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
this.logMethodError('refresh',
|
|
775
|
-
throw
|
|
923
|
+
_context11.prev = 14;
|
|
924
|
+
_context11.t0 = _context11["catch"](2);
|
|
925
|
+
this.logMethodError('refresh', _context11.t0);
|
|
926
|
+
throw _context11.t0;
|
|
776
927
|
case 18:
|
|
777
928
|
case "end":
|
|
778
|
-
return
|
|
929
|
+
return _context11.stop();
|
|
779
930
|
}
|
|
780
|
-
},
|
|
931
|
+
}, _callee11, this, [[2, 14]]);
|
|
781
932
|
}));
|
|
782
933
|
function refresh() {
|
|
783
934
|
return _refresh.apply(this, arguments);
|
|
@@ -818,26 +969,26 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
818
969
|
}, {
|
|
819
970
|
key: "loadAllProducts",
|
|
820
971
|
value: function () {
|
|
821
|
-
var _loadAllProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
972
|
+
var _loadAllProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
|
|
822
973
|
var _this5 = this;
|
|
823
|
-
return _regeneratorRuntime().wrap(function
|
|
824
|
-
while (1) switch (
|
|
974
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
975
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
825
976
|
case 0:
|
|
826
977
|
if (!this.loadAllProductsInFlight) {
|
|
827
|
-
|
|
978
|
+
_context12.next = 2;
|
|
828
979
|
break;
|
|
829
980
|
}
|
|
830
|
-
return
|
|
981
|
+
return _context12.abrupt("return", this.loadAllProductsInFlight);
|
|
831
982
|
case 2:
|
|
832
983
|
this.loadAllProductsInFlight = this._doLoadAllProducts().finally(function () {
|
|
833
984
|
_this5.loadAllProductsInFlight = null;
|
|
834
985
|
});
|
|
835
|
-
return
|
|
986
|
+
return _context12.abrupt("return", this.loadAllProductsInFlight);
|
|
836
987
|
case 4:
|
|
837
988
|
case "end":
|
|
838
|
-
return
|
|
989
|
+
return _context12.stop();
|
|
839
990
|
}
|
|
840
|
-
},
|
|
991
|
+
}, _callee12, this);
|
|
841
992
|
}));
|
|
842
993
|
function loadAllProducts() {
|
|
843
994
|
return _loadAllProducts.apply(this, arguments);
|
|
@@ -847,31 +998,31 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
847
998
|
}, {
|
|
848
999
|
key: "_doLoadAllProducts",
|
|
849
1000
|
value: function () {
|
|
850
|
-
var _doLoadAllProducts2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
851
|
-
var _this$
|
|
852
|
-
return _regeneratorRuntime().wrap(function
|
|
853
|
-
while (1) switch (
|
|
1001
|
+
var _doLoadAllProducts2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
|
|
1002
|
+
var _this$otherParams10, _this$store$venueProd, associatedMenus, menuListIds, allProducts, list, venueList, addonList, venueStore;
|
|
1003
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
1004
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
854
1005
|
case 0:
|
|
855
1006
|
this.logMethodStart('loadAllProducts');
|
|
856
|
-
|
|
1007
|
+
_context13.prev = 1;
|
|
857
1008
|
if (this.store.venueProducts) {
|
|
858
|
-
|
|
1009
|
+
_context13.next = 4;
|
|
859
1010
|
break;
|
|
860
1011
|
}
|
|
861
1012
|
throw new Error('venueProducts 模块未初始化');
|
|
862
1013
|
case 4:
|
|
863
1014
|
if (this.store.addonProducts) {
|
|
864
|
-
|
|
1015
|
+
_context13.next = 6;
|
|
865
1016
|
break;
|
|
866
1017
|
}
|
|
867
1018
|
throw new Error('addonProducts 模块未初始化');
|
|
868
1019
|
case 6:
|
|
869
|
-
|
|
1020
|
+
_context13.next = 8;
|
|
870
1021
|
return this.loadOpenDataConfig();
|
|
871
1022
|
case 8:
|
|
872
|
-
associatedMenus = ((_this$
|
|
1023
|
+
associatedMenus = ((_this$otherParams10 = this.otherParams) === null || _this$otherParams10 === void 0 || (_this$otherParams10 = _this$otherParams10.openData) === null || _this$otherParams10 === void 0 ? void 0 : _this$otherParams10['menu.associated_menus']) || [];
|
|
873
1024
|
if (associatedMenus.length) {
|
|
874
|
-
|
|
1025
|
+
_context13.next = 12;
|
|
875
1026
|
break;
|
|
876
1027
|
}
|
|
877
1028
|
this.logMethodError('loadAllProducts', new Error('未获取到餐牌配置(menu.associated_menus),请检查 OpenData 配置'));
|
|
@@ -880,7 +1031,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
880
1031
|
menuListIds = associatedMenus.map(function (n) {
|
|
881
1032
|
return Number(n.value);
|
|
882
1033
|
});
|
|
883
|
-
|
|
1034
|
+
_context13.next = 15;
|
|
884
1035
|
return this.store.venueProducts.loadProducts({
|
|
885
1036
|
menu_list_ids: menuListIds,
|
|
886
1037
|
cacheId: this.cacheId,
|
|
@@ -888,7 +1039,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
888
1039
|
schedule_datetime: dayjs().format('YYYY-MM-DD HH:mm:ss')
|
|
889
1040
|
});
|
|
890
1041
|
case 15:
|
|
891
|
-
allProducts =
|
|
1042
|
+
allProducts = _context13.sent;
|
|
892
1043
|
list = Array.isArray(allProducts) ? allProducts : [];
|
|
893
1044
|
venueList = list.filter(function (p) {
|
|
894
1045
|
return p.duration != null;
|
|
@@ -904,6 +1055,11 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
904
1055
|
}
|
|
905
1056
|
this.store.addonProducts.addProduct(addonList);
|
|
906
1057
|
this.resourceProductMap = buildResourceProductMap(venueList);
|
|
1058
|
+
|
|
1059
|
+
// 加载 holder 表单
|
|
1060
|
+
_context13.next = 25;
|
|
1061
|
+
return this.preloadHolderForms(venueList);
|
|
1062
|
+
case 25:
|
|
907
1063
|
this.productsLoaded = true;
|
|
908
1064
|
this.logMethodSuccess('loadAllProducts', {
|
|
909
1065
|
total: list.length,
|
|
@@ -911,20 +1067,20 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
911
1067
|
addonCount: addonList.length,
|
|
912
1068
|
resourceCount: this.resourceProductMap.size
|
|
913
1069
|
});
|
|
914
|
-
return
|
|
1070
|
+
return _context13.abrupt("return", {
|
|
915
1071
|
venueProducts: venueList,
|
|
916
1072
|
addonProducts: addonList
|
|
917
1073
|
});
|
|
918
|
-
case
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
this.logMethodError('loadAllProducts',
|
|
922
|
-
throw
|
|
923
|
-
case
|
|
1074
|
+
case 30:
|
|
1075
|
+
_context13.prev = 30;
|
|
1076
|
+
_context13.t0 = _context13["catch"](1);
|
|
1077
|
+
this.logMethodError('loadAllProducts', _context13.t0);
|
|
1078
|
+
throw _context13.t0;
|
|
1079
|
+
case 34:
|
|
924
1080
|
case "end":
|
|
925
|
-
return
|
|
1081
|
+
return _context13.stop();
|
|
926
1082
|
}
|
|
927
|
-
},
|
|
1083
|
+
}, _callee13, this, [[1, 30]]);
|
|
928
1084
|
}));
|
|
929
1085
|
function _doLoadAllProducts() {
|
|
930
1086
|
return _doLoadAllProducts2.apply(this, arguments);
|
|
@@ -934,21 +1090,21 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
934
1090
|
}, {
|
|
935
1091
|
key: "loadVenueProducts",
|
|
936
1092
|
value: function () {
|
|
937
|
-
var _loadVenueProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1093
|
+
var _loadVenueProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
|
|
938
1094
|
var result;
|
|
939
|
-
return _regeneratorRuntime().wrap(function
|
|
940
|
-
while (1) switch (
|
|
1095
|
+
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
1096
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
941
1097
|
case 0:
|
|
942
|
-
|
|
1098
|
+
_context14.next = 2;
|
|
943
1099
|
return this.loadAllProducts();
|
|
944
1100
|
case 2:
|
|
945
|
-
result =
|
|
946
|
-
return
|
|
1101
|
+
result = _context14.sent;
|
|
1102
|
+
return _context14.abrupt("return", result.venueProducts);
|
|
947
1103
|
case 4:
|
|
948
1104
|
case "end":
|
|
949
|
-
return
|
|
1105
|
+
return _context14.stop();
|
|
950
1106
|
}
|
|
951
|
-
},
|
|
1107
|
+
}, _callee14, this);
|
|
952
1108
|
}));
|
|
953
1109
|
function loadVenueProducts() {
|
|
954
1110
|
return _loadVenueProducts.apply(this, arguments);
|
|
@@ -958,21 +1114,21 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
958
1114
|
}, {
|
|
959
1115
|
key: "loadAddonProducts",
|
|
960
1116
|
value: function () {
|
|
961
|
-
var _loadAddonProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1117
|
+
var _loadAddonProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
|
|
962
1118
|
var result;
|
|
963
|
-
return _regeneratorRuntime().wrap(function
|
|
964
|
-
while (1) switch (
|
|
1119
|
+
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
1120
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
965
1121
|
case 0:
|
|
966
|
-
|
|
1122
|
+
_context15.next = 2;
|
|
967
1123
|
return this.loadAllProducts();
|
|
968
1124
|
case 2:
|
|
969
|
-
result =
|
|
970
|
-
return
|
|
1125
|
+
result = _context15.sent;
|
|
1126
|
+
return _context15.abrupt("return", result.addonProducts);
|
|
971
1127
|
case 4:
|
|
972
1128
|
case "end":
|
|
973
|
-
return
|
|
1129
|
+
return _context15.stop();
|
|
974
1130
|
}
|
|
975
|
-
},
|
|
1131
|
+
}, _callee15, this);
|
|
976
1132
|
}));
|
|
977
1133
|
function loadAddonProducts() {
|
|
978
1134
|
return _loadAddonProducts.apply(this, arguments);
|
|
@@ -996,38 +1152,38 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
996
1152
|
}, {
|
|
997
1153
|
key: "loadQuotations",
|
|
998
1154
|
value: function () {
|
|
999
|
-
var _loadQuotations = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1000
|
-
return _regeneratorRuntime().wrap(function
|
|
1001
|
-
while (1) switch (
|
|
1155
|
+
var _loadQuotations = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(params) {
|
|
1156
|
+
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
1157
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
1002
1158
|
case 0:
|
|
1003
1159
|
this.logMethodStart('loadQuotations');
|
|
1004
|
-
|
|
1160
|
+
_context16.prev = 1;
|
|
1005
1161
|
if (this.store.quotation) {
|
|
1006
|
-
|
|
1162
|
+
_context16.next = 4;
|
|
1007
1163
|
break;
|
|
1008
1164
|
}
|
|
1009
1165
|
throw new Error('quotation 模块未初始化');
|
|
1010
1166
|
case 4:
|
|
1011
|
-
|
|
1167
|
+
_context16.next = 6;
|
|
1012
1168
|
return this.store.quotation.loadQuotations(params);
|
|
1013
1169
|
case 6:
|
|
1014
1170
|
this.logMethodSuccess('loadQuotations', {
|
|
1015
1171
|
count: this.store.quotation.getQuotationList().length
|
|
1016
1172
|
});
|
|
1017
|
-
|
|
1173
|
+
_context16.next = 13;
|
|
1018
1174
|
break;
|
|
1019
1175
|
case 9:
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
this.logMethodError('loadQuotations',
|
|
1023
|
-
throw
|
|
1176
|
+
_context16.prev = 9;
|
|
1177
|
+
_context16.t0 = _context16["catch"](1);
|
|
1178
|
+
this.logMethodError('loadQuotations', _context16.t0);
|
|
1179
|
+
throw _context16.t0;
|
|
1024
1180
|
case 13:
|
|
1025
1181
|
case "end":
|
|
1026
|
-
return
|
|
1182
|
+
return _context16.stop();
|
|
1027
1183
|
}
|
|
1028
|
-
},
|
|
1184
|
+
}, _callee16, this, [[1, 9]]);
|
|
1029
1185
|
}));
|
|
1030
|
-
function loadQuotations(
|
|
1186
|
+
function loadQuotations(_x8) {
|
|
1031
1187
|
return _loadQuotations.apply(this, arguments);
|
|
1032
1188
|
}
|
|
1033
1189
|
return loadQuotations;
|
|
@@ -1035,46 +1191,46 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1035
1191
|
}, {
|
|
1036
1192
|
key: "fetchResourceAvailability",
|
|
1037
1193
|
value: function () {
|
|
1038
|
-
var _fetchResourceAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1039
|
-
var venueProducts, resourceIds, config, crossDay, effectiveEndDate, res, rawData,
|
|
1040
|
-
return _regeneratorRuntime().wrap(function
|
|
1041
|
-
while (1) switch (
|
|
1194
|
+
var _fetchResourceAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(params) {
|
|
1195
|
+
var venueProducts, resourceIds, config, crossDay, effectiveEndDate, res, rawData, _iterator3, _step3, item, _i3, _rawData, _item, mappings, _iterator4, _step4, mapping;
|
|
1196
|
+
return _regeneratorRuntime().wrap(function _callee17$(_context17) {
|
|
1197
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
1042
1198
|
case 0:
|
|
1043
1199
|
this.logMethodStart('fetchResourceAvailability', params);
|
|
1044
|
-
|
|
1200
|
+
_context17.prev = 1;
|
|
1045
1201
|
venueProducts = this.getVenueProducts();
|
|
1046
1202
|
if (venueProducts.length) {
|
|
1047
|
-
|
|
1203
|
+
_context17.next = 7;
|
|
1048
1204
|
break;
|
|
1049
1205
|
}
|
|
1050
1206
|
this.store.rawResourceData = [];
|
|
1051
1207
|
this.logMethodSuccess('fetchResourceAvailability', {
|
|
1052
1208
|
resourceCount: 0
|
|
1053
1209
|
});
|
|
1054
|
-
return
|
|
1210
|
+
return _context17.abrupt("return");
|
|
1055
1211
|
case 7:
|
|
1056
1212
|
resourceIds = extractResourceIds(venueProducts);
|
|
1057
1213
|
if (resourceIds.length) {
|
|
1058
|
-
|
|
1214
|
+
_context17.next = 12;
|
|
1059
1215
|
break;
|
|
1060
1216
|
}
|
|
1061
1217
|
this.store.rawResourceData = [];
|
|
1062
1218
|
this.logMethodSuccess('fetchResourceAvailability', {
|
|
1063
1219
|
resourceIds: []
|
|
1064
1220
|
});
|
|
1065
|
-
return
|
|
1221
|
+
return _context17.abrupt("return");
|
|
1066
1222
|
case 12:
|
|
1067
1223
|
// 跨天营业时,endDate 扩展一天以覆盖次日凌晨时段
|
|
1068
1224
|
config = this.store.slotConfig;
|
|
1069
1225
|
crossDay = isBusinessHoursCrossDay(config);
|
|
1070
1226
|
effectiveEndDate = crossDay ? dayjs(params.endDate).add(1, 'day').format('YYYY-MM-DD') : params.endDate;
|
|
1071
1227
|
if (this.store.date) {
|
|
1072
|
-
|
|
1228
|
+
_context17.next = 17;
|
|
1073
1229
|
break;
|
|
1074
1230
|
}
|
|
1075
1231
|
throw new Error('date 模块未初始化');
|
|
1076
1232
|
case 17:
|
|
1077
|
-
|
|
1233
|
+
_context17.next = 19;
|
|
1078
1234
|
return this.store.date.fetchResourceDates({
|
|
1079
1235
|
query: {
|
|
1080
1236
|
start_date: params.startDate,
|
|
@@ -1084,13 +1240,13 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1084
1240
|
useCache: false
|
|
1085
1241
|
});
|
|
1086
1242
|
case 19:
|
|
1087
|
-
res =
|
|
1243
|
+
res = _context17.sent;
|
|
1088
1244
|
rawData = [];
|
|
1089
1245
|
if (res !== null && res !== void 0 && res.data && Array.isArray(res.data)) {
|
|
1090
|
-
|
|
1246
|
+
_iterator3 = _createForOfIteratorHelper(res.data);
|
|
1091
1247
|
try {
|
|
1092
|
-
for (
|
|
1093
|
-
item =
|
|
1248
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
1249
|
+
item = _step3.value;
|
|
1094
1250
|
rawData.push(_objectSpread({
|
|
1095
1251
|
resourceId: item.id,
|
|
1096
1252
|
formId: item.form_id,
|
|
@@ -1098,41 +1254,41 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1098
1254
|
}, item));
|
|
1099
1255
|
}
|
|
1100
1256
|
} catch (err) {
|
|
1101
|
-
|
|
1257
|
+
_iterator3.e(err);
|
|
1102
1258
|
} finally {
|
|
1103
|
-
|
|
1259
|
+
_iterator3.f();
|
|
1104
1260
|
}
|
|
1105
1261
|
}
|
|
1106
1262
|
this.store.rawResourceData = rawData;
|
|
1107
1263
|
_i3 = 0, _rawData = rawData;
|
|
1108
1264
|
case 24:
|
|
1109
1265
|
if (!(_i3 < _rawData.length)) {
|
|
1110
|
-
|
|
1266
|
+
_context17.next = 34;
|
|
1111
1267
|
break;
|
|
1112
1268
|
}
|
|
1113
1269
|
_item = _rawData[_i3];
|
|
1114
1270
|
mappings = this.resourceProductMap.get(_item.resourceId);
|
|
1115
1271
|
if (mappings) {
|
|
1116
|
-
|
|
1272
|
+
_context17.next = 29;
|
|
1117
1273
|
break;
|
|
1118
1274
|
}
|
|
1119
|
-
return
|
|
1275
|
+
return _context17.abrupt("continue", 31);
|
|
1120
1276
|
case 29:
|
|
1121
|
-
|
|
1277
|
+
_iterator4 = _createForOfIteratorHelper(mappings);
|
|
1122
1278
|
try {
|
|
1123
|
-
for (
|
|
1124
|
-
mapping =
|
|
1279
|
+
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
1280
|
+
mapping = _step4.value;
|
|
1125
1281
|
if (_item.main_field) mapping.resourceName = _item.main_field;
|
|
1126
1282
|
if (_item.resource_form_id) mapping.formId = _item.resource_form_id;
|
|
1127
1283
|
}
|
|
1128
1284
|
} catch (err) {
|
|
1129
|
-
|
|
1285
|
+
_iterator4.e(err);
|
|
1130
1286
|
} finally {
|
|
1131
|
-
|
|
1287
|
+
_iterator4.f();
|
|
1132
1288
|
}
|
|
1133
1289
|
case 31:
|
|
1134
1290
|
_i3++;
|
|
1135
|
-
|
|
1291
|
+
_context17.next = 24;
|
|
1136
1292
|
break;
|
|
1137
1293
|
case 34:
|
|
1138
1294
|
this.logMethodSuccess('fetchResourceAvailability', {
|
|
@@ -1141,21 +1297,21 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1141
1297
|
return sum + r.times.length;
|
|
1142
1298
|
}, 0)
|
|
1143
1299
|
});
|
|
1144
|
-
|
|
1300
|
+
_context17.next = 42;
|
|
1145
1301
|
break;
|
|
1146
1302
|
case 37:
|
|
1147
|
-
|
|
1148
|
-
|
|
1303
|
+
_context17.prev = 37;
|
|
1304
|
+
_context17.t0 = _context17["catch"](1);
|
|
1149
1305
|
this.store.rawResourceData = [];
|
|
1150
|
-
this.logMethodError('fetchResourceAvailability',
|
|
1151
|
-
throw
|
|
1306
|
+
this.logMethodError('fetchResourceAvailability', _context17.t0);
|
|
1307
|
+
throw _context17.t0;
|
|
1152
1308
|
case 42:
|
|
1153
1309
|
case "end":
|
|
1154
|
-
return
|
|
1310
|
+
return _context17.stop();
|
|
1155
1311
|
}
|
|
1156
|
-
},
|
|
1312
|
+
}, _callee17, this, [[1, 37]]);
|
|
1157
1313
|
}));
|
|
1158
|
-
function fetchResourceAvailability(
|
|
1314
|
+
function fetchResourceAvailability(_x9) {
|
|
1159
1315
|
return _fetchResourceAvailability.apply(this, arguments);
|
|
1160
1316
|
}
|
|
1161
1317
|
return fetchResourceAvailability;
|
|
@@ -1187,18 +1343,18 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1187
1343
|
var timeRangeMap = calcMinTimeMaxTimeBySchedules(scheduleList, undefined, date);
|
|
1188
1344
|
var earliestStart = null;
|
|
1189
1345
|
var latestEnd = null;
|
|
1190
|
-
var
|
|
1191
|
-
|
|
1346
|
+
var _iterator5 = _createForOfIteratorHelper(scheduleList),
|
|
1347
|
+
_step5;
|
|
1192
1348
|
try {
|
|
1193
|
-
for (
|
|
1349
|
+
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
|
|
1194
1350
|
var _timeRangeMap$schedul;
|
|
1195
|
-
var schedule =
|
|
1351
|
+
var schedule = _step5.value;
|
|
1196
1352
|
var dateRangeList = (timeRangeMap === null || timeRangeMap === void 0 || (_timeRangeMap$schedul = timeRangeMap[schedule.id]) === null || _timeRangeMap$schedul === void 0 ? void 0 : _timeRangeMap$schedul.dateRangeFormat) || [];
|
|
1197
|
-
var
|
|
1198
|
-
|
|
1353
|
+
var _iterator6 = _createForOfIteratorHelper(dateRangeList),
|
|
1354
|
+
_step6;
|
|
1199
1355
|
try {
|
|
1200
|
-
for (
|
|
1201
|
-
var range =
|
|
1356
|
+
for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
|
|
1357
|
+
var range = _step6.value;
|
|
1202
1358
|
var start = dayjs(range === null || range === void 0 ? void 0 : range.start);
|
|
1203
1359
|
var end = dayjs(range === null || range === void 0 ? void 0 : range.end);
|
|
1204
1360
|
if (!start.isValid() || !end.isValid()) continue;
|
|
@@ -1210,15 +1366,15 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1210
1366
|
}
|
|
1211
1367
|
}
|
|
1212
1368
|
} catch (err) {
|
|
1213
|
-
|
|
1369
|
+
_iterator6.e(err);
|
|
1214
1370
|
} finally {
|
|
1215
|
-
|
|
1371
|
+
_iterator6.f();
|
|
1216
1372
|
}
|
|
1217
1373
|
}
|
|
1218
1374
|
} catch (err) {
|
|
1219
|
-
|
|
1375
|
+
_iterator5.e(err);
|
|
1220
1376
|
} finally {
|
|
1221
|
-
|
|
1377
|
+
_iterator5.f();
|
|
1222
1378
|
}
|
|
1223
1379
|
if (!earliestStart || !latestEnd) return nextSlotConfig;
|
|
1224
1380
|
return _objectSpread(_objectSpread({}, nextSlotConfig), {}, {
|
|
@@ -1288,20 +1444,20 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1288
1444
|
}, {
|
|
1289
1445
|
key: "toggleSlot",
|
|
1290
1446
|
value: function () {
|
|
1291
|
-
var _toggleSlot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1447
|
+
var _toggleSlot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(slot) {
|
|
1292
1448
|
var mappings, mapping, currentSlots, existIndex, nextSlots, products;
|
|
1293
|
-
return _regeneratorRuntime().wrap(function
|
|
1294
|
-
while (1) switch (
|
|
1449
|
+
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
1450
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
1295
1451
|
case 0:
|
|
1296
1452
|
this.logMethodStart('toggleSlot', {
|
|
1297
1453
|
resourceId: slot.resourceId,
|
|
1298
1454
|
productId: slot.productId,
|
|
1299
1455
|
startTime: slot.startTime
|
|
1300
1456
|
});
|
|
1301
|
-
|
|
1457
|
+
_context18.prev = 1;
|
|
1302
1458
|
mappings = this.resourceProductMap.get(slot.resourceId);
|
|
1303
1459
|
if (!(!mappings || !mappings.length)) {
|
|
1304
|
-
|
|
1460
|
+
_context18.next = 5;
|
|
1305
1461
|
break;
|
|
1306
1462
|
}
|
|
1307
1463
|
throw new Error("\u672A\u627E\u5230\u8D44\u6E90 ".concat(slot.resourceId, " \u7684\u5546\u54C1\u6620\u5C04"));
|
|
@@ -1310,13 +1466,13 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1310
1466
|
return m.productId === slot.productId;
|
|
1311
1467
|
});
|
|
1312
1468
|
if (mapping) {
|
|
1313
|
-
|
|
1469
|
+
_context18.next = 8;
|
|
1314
1470
|
break;
|
|
1315
1471
|
}
|
|
1316
1472
|
throw new Error("\u8D44\u6E90 ".concat(slot.resourceId, " \u672A\u5173\u8054\u5546\u54C1 ").concat(slot.productId));
|
|
1317
1473
|
case 8:
|
|
1318
1474
|
if (this.store.order) {
|
|
1319
|
-
|
|
1475
|
+
_context18.next = 10;
|
|
1320
1476
|
break;
|
|
1321
1477
|
}
|
|
1322
1478
|
throw new Error('order 模块未初始化');
|
|
@@ -1332,14 +1488,14 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1332
1488
|
} else {
|
|
1333
1489
|
nextSlots = [].concat(_toConsumableArray(currentSlots), [slot]);
|
|
1334
1490
|
}
|
|
1335
|
-
|
|
1491
|
+
_context18.next = 15;
|
|
1336
1492
|
return this.reconcileOrderForResourceProduct(slot.resourceId, slot.productId, nextSlots);
|
|
1337
1493
|
case 15:
|
|
1338
1494
|
products = this.store.order.getOrderProducts();
|
|
1339
|
-
|
|
1495
|
+
_context18.next = 18;
|
|
1340
1496
|
return this.refreshItemRuleQuantityLimits();
|
|
1341
1497
|
case 18:
|
|
1342
|
-
|
|
1498
|
+
_context18.next = 20;
|
|
1343
1499
|
return this.refreshCartValidationPassed();
|
|
1344
1500
|
case 20:
|
|
1345
1501
|
this.logMethodSuccess('toggleSlot', {
|
|
@@ -1348,19 +1504,19 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1348
1504
|
productId: slot.productId,
|
|
1349
1505
|
slotCount: nextSlots.length
|
|
1350
1506
|
});
|
|
1351
|
-
return
|
|
1507
|
+
return _context18.abrupt("return", products);
|
|
1352
1508
|
case 24:
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
this.logMethodError('toggleSlot',
|
|
1356
|
-
throw
|
|
1509
|
+
_context18.prev = 24;
|
|
1510
|
+
_context18.t0 = _context18["catch"](1);
|
|
1511
|
+
this.logMethodError('toggleSlot', _context18.t0);
|
|
1512
|
+
throw _context18.t0;
|
|
1357
1513
|
case 28:
|
|
1358
1514
|
case "end":
|
|
1359
|
-
return
|
|
1515
|
+
return _context18.stop();
|
|
1360
1516
|
}
|
|
1361
|
-
},
|
|
1517
|
+
}, _callee18, this, [[1, 24]]);
|
|
1362
1518
|
}));
|
|
1363
|
-
function toggleSlot(
|
|
1519
|
+
function toggleSlot(_x10) {
|
|
1364
1520
|
return _toggleSlot.apply(this, arguments);
|
|
1365
1521
|
}
|
|
1366
1522
|
return toggleSlot;
|
|
@@ -1384,24 +1540,24 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1384
1540
|
});
|
|
1385
1541
|
var slotDuration = this.store.slotConfig.slotDurationMinutes;
|
|
1386
1542
|
var slots = [];
|
|
1387
|
-
var
|
|
1388
|
-
|
|
1543
|
+
var _iterator7 = _createForOfIteratorHelper(venueProducts),
|
|
1544
|
+
_step7;
|
|
1389
1545
|
try {
|
|
1390
1546
|
var _loop = function _loop() {
|
|
1391
|
-
var product =
|
|
1547
|
+
var product = _step7.value;
|
|
1392
1548
|
slots.push.apply(slots, _toConsumableArray(expandMergedSlotToIndividual(product, slotDuration).map(function (s) {
|
|
1393
1549
|
return _objectSpread(_objectSpread({}, s), {}, {
|
|
1394
1550
|
productId: Number(product.product_id)
|
|
1395
1551
|
});
|
|
1396
1552
|
})));
|
|
1397
1553
|
};
|
|
1398
|
-
for (
|
|
1554
|
+
for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
|
|
1399
1555
|
_loop();
|
|
1400
1556
|
}
|
|
1401
1557
|
} catch (err) {
|
|
1402
|
-
|
|
1558
|
+
_iterator7.e(err);
|
|
1403
1559
|
} finally {
|
|
1404
|
-
|
|
1560
|
+
_iterator7.f();
|
|
1405
1561
|
}
|
|
1406
1562
|
return slots.sort(function (a, b) {
|
|
1407
1563
|
return a.startTime.localeCompare(b.startTime);
|
|
@@ -1474,28 +1630,28 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1474
1630
|
|
|
1475
1631
|
// 规则 2:当前是组合资源,任一子资源被选 → 禁用
|
|
1476
1632
|
if (currentIsCombined) {
|
|
1477
|
-
var
|
|
1478
|
-
|
|
1633
|
+
var _iterator8 = _createForOfIteratorHelper(currentChildIds),
|
|
1634
|
+
_step8;
|
|
1479
1635
|
try {
|
|
1480
|
-
for (
|
|
1481
|
-
var childId =
|
|
1636
|
+
for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
|
|
1637
|
+
var childId = _step8.value;
|
|
1482
1638
|
if (getSelectedAt(childId).length > 0) return true;
|
|
1483
1639
|
}
|
|
1484
1640
|
} catch (err) {
|
|
1485
|
-
|
|
1641
|
+
_iterator8.e(err);
|
|
1486
1642
|
} finally {
|
|
1487
|
-
|
|
1643
|
+
_iterator8.f();
|
|
1488
1644
|
}
|
|
1489
1645
|
}
|
|
1490
1646
|
|
|
1491
1647
|
// 规则 3 & 4:扫描所有已选的 (resId),若是组合资源,检查其 children 是否包含当前 resourceId 或与当前 child 集合有交集
|
|
1492
|
-
var
|
|
1493
|
-
|
|
1648
|
+
var _iterator9 = _createForOfIteratorHelper(allSelected),
|
|
1649
|
+
_step9;
|
|
1494
1650
|
try {
|
|
1495
|
-
for (
|
|
1496
|
-
var
|
|
1497
|
-
selectedResId =
|
|
1498
|
-
slots =
|
|
1651
|
+
for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
|
|
1652
|
+
var _step9$value = _slicedToArray(_step9.value, 2),
|
|
1653
|
+
selectedResId = _step9$value[0],
|
|
1654
|
+
slots = _step9$value[1];
|
|
1499
1655
|
if (!slots.some(function (s) {
|
|
1500
1656
|
return s.startTime === startTime;
|
|
1501
1657
|
})) continue;
|
|
@@ -1521,9 +1677,9 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1521
1677
|
}
|
|
1522
1678
|
}
|
|
1523
1679
|
} catch (err) {
|
|
1524
|
-
|
|
1680
|
+
_iterator9.e(err);
|
|
1525
1681
|
} finally {
|
|
1526
|
-
|
|
1682
|
+
_iterator9.f();
|
|
1527
1683
|
}
|
|
1528
1684
|
return false;
|
|
1529
1685
|
}
|
|
@@ -1543,12 +1699,12 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1543
1699
|
return (_p$metadata3 = p.metadata) === null || _p$metadata3 === void 0 ? void 0 : _p$metadata3.venue_booking;
|
|
1544
1700
|
});
|
|
1545
1701
|
var slotDuration = this.store.slotConfig.slotDurationMinutes;
|
|
1546
|
-
var
|
|
1547
|
-
|
|
1702
|
+
var _iterator10 = _createForOfIteratorHelper(venueProducts),
|
|
1703
|
+
_step10;
|
|
1548
1704
|
try {
|
|
1549
1705
|
var _loop2 = function _loop2() {
|
|
1550
1706
|
var _product$metadata;
|
|
1551
|
-
var product =
|
|
1707
|
+
var product = _step10.value;
|
|
1552
1708
|
var resourceId = (_product$metadata = product.metadata) === null || _product$metadata === void 0 ? void 0 : _product$metadata.resource_id;
|
|
1553
1709
|
if (resourceId == null) return 1; // continue
|
|
1554
1710
|
var productId = Number(product.product_id);
|
|
@@ -1560,29 +1716,29 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1560
1716
|
})));
|
|
1561
1717
|
result.set(resourceId, existing);
|
|
1562
1718
|
};
|
|
1563
|
-
for (
|
|
1719
|
+
for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
|
|
1564
1720
|
if (_loop2()) continue;
|
|
1565
1721
|
}
|
|
1566
1722
|
} catch (err) {
|
|
1567
|
-
|
|
1723
|
+
_iterator10.e(err);
|
|
1568
1724
|
} finally {
|
|
1569
|
-
|
|
1725
|
+
_iterator10.f();
|
|
1570
1726
|
}
|
|
1571
|
-
var
|
|
1572
|
-
|
|
1727
|
+
var _iterator11 = _createForOfIteratorHelper(result),
|
|
1728
|
+
_step11;
|
|
1573
1729
|
try {
|
|
1574
|
-
for (
|
|
1575
|
-
var
|
|
1576
|
-
key =
|
|
1577
|
-
slots =
|
|
1730
|
+
for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) {
|
|
1731
|
+
var _step11$value = _slicedToArray(_step11.value, 2),
|
|
1732
|
+
key = _step11$value[0],
|
|
1733
|
+
slots = _step11$value[1];
|
|
1578
1734
|
result.set(key, slots.sort(function (a, b) {
|
|
1579
1735
|
return a.startTime.localeCompare(b.startTime);
|
|
1580
1736
|
}));
|
|
1581
1737
|
}
|
|
1582
1738
|
} catch (err) {
|
|
1583
|
-
|
|
1739
|
+
_iterator11.e(err);
|
|
1584
1740
|
} finally {
|
|
1585
|
-
|
|
1741
|
+
_iterator11.f();
|
|
1586
1742
|
}
|
|
1587
1743
|
return result;
|
|
1588
1744
|
}
|
|
@@ -1595,26 +1751,26 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1595
1751
|
}, {
|
|
1596
1752
|
key: "reconcileOrderForResourceProduct",
|
|
1597
1753
|
value: (function () {
|
|
1598
|
-
var _reconcileOrderForResourceProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1754
|
+
var _reconcileOrderForResourceProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(resourceId, productId, slots) {
|
|
1599
1755
|
var mappings, mapping, tempOrder, matchesCurrent, merged, rawResource, childRawResources, venueProduct, i, _rawResource$form_id, _venueProduct$is_char, group, identityKey, bookingUuid, startMoment, endMoment, duration, customDepositData, resourceEntry, booking;
|
|
1600
|
-
return _regeneratorRuntime().wrap(function
|
|
1601
|
-
while (1) switch (
|
|
1756
|
+
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
|
1757
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
1602
1758
|
case 0:
|
|
1603
1759
|
mappings = this.resourceProductMap.get(resourceId);
|
|
1604
1760
|
if (!(!mappings || !mappings.length || !this.store.order)) {
|
|
1605
|
-
|
|
1761
|
+
_context19.next = 3;
|
|
1606
1762
|
break;
|
|
1607
1763
|
}
|
|
1608
|
-
return
|
|
1764
|
+
return _context19.abrupt("return");
|
|
1609
1765
|
case 3:
|
|
1610
1766
|
mapping = mappings.find(function (m) {
|
|
1611
1767
|
return m.productId === productId;
|
|
1612
1768
|
});
|
|
1613
1769
|
if (mapping) {
|
|
1614
|
-
|
|
1770
|
+
_context19.next = 6;
|
|
1615
1771
|
break;
|
|
1616
1772
|
}
|
|
1617
|
-
return
|
|
1773
|
+
return _context19.abrupt("return");
|
|
1618
1774
|
case 6:
|
|
1619
1775
|
tempOrder = this.store.order.ensureTempOrder();
|
|
1620
1776
|
matchesCurrent = function matchesCurrent(meta, pid) {
|
|
@@ -1632,17 +1788,17 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1632
1788
|
return Number(bookingProductId) !== Number(productId);
|
|
1633
1789
|
});
|
|
1634
1790
|
if (slots.length) {
|
|
1635
|
-
|
|
1791
|
+
_context19.next = 16;
|
|
1636
1792
|
break;
|
|
1637
1793
|
}
|
|
1638
1794
|
this.store.order.applyDiscount();
|
|
1639
|
-
|
|
1795
|
+
_context19.next = 14;
|
|
1640
1796
|
return this.store.order.recalculateSummary({
|
|
1641
1797
|
createIfMissing: true
|
|
1642
1798
|
});
|
|
1643
1799
|
case 14:
|
|
1644
1800
|
this.store.order.persistTempOrder();
|
|
1645
|
-
return
|
|
1801
|
+
return _context19.abrupt("return");
|
|
1646
1802
|
case 16:
|
|
1647
1803
|
merged = mergeConsecutiveSlots(slots);
|
|
1648
1804
|
rawResource = this.store.rawResourceData.find(function (r) {
|
|
@@ -1653,6 +1809,11 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1653
1809
|
return p.id === mapping.productId;
|
|
1654
1810
|
});
|
|
1655
1811
|
tempOrder.bookings = tempOrder.bookings || [];
|
|
1812
|
+
|
|
1813
|
+
// 获取表单信息
|
|
1814
|
+
_context19.next = 23;
|
|
1815
|
+
return this.ensureProductHolderForm(venueProduct);
|
|
1816
|
+
case 23:
|
|
1656
1817
|
for (i = 0; i < merged.length; i++) {
|
|
1657
1818
|
group = merged[i];
|
|
1658
1819
|
identityKey = buildVenueIdentityKey(resourceId, i);
|
|
@@ -1729,7 +1890,9 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1729
1890
|
product_option_item: [],
|
|
1730
1891
|
discount_list: [],
|
|
1731
1892
|
custom_deposit_data: customDepositData,
|
|
1732
|
-
metadata: {}
|
|
1893
|
+
metadata: {},
|
|
1894
|
+
holder_config: venueProduct === null || venueProduct === void 0 ? void 0 : venueProduct.holder_config,
|
|
1895
|
+
bookingUuid: bookingUuid
|
|
1733
1896
|
},
|
|
1734
1897
|
sub_type: 'minutes',
|
|
1735
1898
|
duration: duration,
|
|
@@ -1760,19 +1923,19 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1760
1923
|
tempOrder.bookings.push(booking);
|
|
1761
1924
|
}
|
|
1762
1925
|
this.store.order.applyDiscount();
|
|
1763
|
-
|
|
1926
|
+
_context19.next = 27;
|
|
1764
1927
|
return this.store.order.recalculateSummary({
|
|
1765
1928
|
createIfMissing: true
|
|
1766
1929
|
});
|
|
1767
|
-
case
|
|
1930
|
+
case 27:
|
|
1768
1931
|
this.store.order.persistTempOrder();
|
|
1769
|
-
case
|
|
1932
|
+
case 28:
|
|
1770
1933
|
case "end":
|
|
1771
|
-
return
|
|
1934
|
+
return _context19.stop();
|
|
1772
1935
|
}
|
|
1773
|
-
},
|
|
1936
|
+
}, _callee19, this);
|
|
1774
1937
|
}));
|
|
1775
|
-
function reconcileOrderForResourceProduct(
|
|
1938
|
+
function reconcileOrderForResourceProduct(_x11, _x12, _x13) {
|
|
1776
1939
|
return _reconcileOrderForResourceProduct.apply(this, arguments);
|
|
1777
1940
|
}
|
|
1778
1941
|
return reconcileOrderForResourceProduct;
|
|
@@ -1787,23 +1950,23 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1787
1950
|
return undefined;
|
|
1788
1951
|
}
|
|
1789
1952
|
var children = [];
|
|
1790
|
-
var
|
|
1791
|
-
|
|
1953
|
+
var _iterator12 = _createForOfIteratorHelper(combined.resource_ids),
|
|
1954
|
+
_step12;
|
|
1792
1955
|
try {
|
|
1793
1956
|
var _loop3 = function _loop3() {
|
|
1794
|
-
var id =
|
|
1957
|
+
var id = _step12.value;
|
|
1795
1958
|
var child = _this8.store.rawResourceData.find(function (r) {
|
|
1796
1959
|
return String(r.resourceId) === String(id);
|
|
1797
1960
|
});
|
|
1798
1961
|
if (child) children.push(child);
|
|
1799
1962
|
};
|
|
1800
|
-
for (
|
|
1963
|
+
for (_iterator12.s(); !(_step12 = _iterator12.n()).done;) {
|
|
1801
1964
|
_loop3();
|
|
1802
1965
|
}
|
|
1803
1966
|
} catch (err) {
|
|
1804
|
-
|
|
1967
|
+
_iterator12.e(err);
|
|
1805
1968
|
} finally {
|
|
1806
|
-
|
|
1969
|
+
_iterator12.f();
|
|
1807
1970
|
}
|
|
1808
1971
|
return children.length ? children : undefined;
|
|
1809
1972
|
}
|
|
@@ -1825,35 +1988,35 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1825
1988
|
}, {
|
|
1826
1989
|
key: "loadSchedules",
|
|
1827
1990
|
value: function () {
|
|
1828
|
-
var _loadSchedules = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1829
|
-
return _regeneratorRuntime().wrap(function
|
|
1830
|
-
while (1) switch (
|
|
1991
|
+
var _loadSchedules = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20() {
|
|
1992
|
+
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
|
1993
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
1831
1994
|
case 0:
|
|
1832
1995
|
this.logMethodStart('loadSchedules');
|
|
1833
|
-
|
|
1996
|
+
_context20.prev = 1;
|
|
1834
1997
|
if (this.store.schedule) {
|
|
1835
|
-
|
|
1998
|
+
_context20.next = 4;
|
|
1836
1999
|
break;
|
|
1837
2000
|
}
|
|
1838
2001
|
throw new Error('schedule 模块未初始化');
|
|
1839
2002
|
case 4:
|
|
1840
|
-
|
|
2003
|
+
_context20.next = 6;
|
|
1841
2004
|
return this.store.schedule.loadAllSchedule();
|
|
1842
2005
|
case 6:
|
|
1843
2006
|
this.injectScheduleResolverToQuotation();
|
|
1844
2007
|
this.logMethodSuccess('loadSchedules');
|
|
1845
|
-
|
|
2008
|
+
_context20.next = 14;
|
|
1846
2009
|
break;
|
|
1847
2010
|
case 10:
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
this.logMethodError('loadSchedules',
|
|
1851
|
-
throw
|
|
2011
|
+
_context20.prev = 10;
|
|
2012
|
+
_context20.t0 = _context20["catch"](1);
|
|
2013
|
+
this.logMethodError('loadSchedules', _context20.t0);
|
|
2014
|
+
throw _context20.t0;
|
|
1852
2015
|
case 14:
|
|
1853
2016
|
case "end":
|
|
1854
|
-
return
|
|
2017
|
+
return _context20.stop();
|
|
1855
2018
|
}
|
|
1856
|
-
},
|
|
2019
|
+
}, _callee20, this, [[1, 10]]);
|
|
1857
2020
|
}));
|
|
1858
2021
|
function loadSchedules() {
|
|
1859
2022
|
return _loadSchedules.apply(this, arguments);
|
|
@@ -1906,15 +2069,15 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1906
2069
|
}, {
|
|
1907
2070
|
key: "onCustomerLogin",
|
|
1908
2071
|
value: function () {
|
|
1909
|
-
var _onCustomerLogin = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1910
|
-
return _regeneratorRuntime().wrap(function
|
|
1911
|
-
while (1) switch (
|
|
2072
|
+
var _onCustomerLogin = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(params) {
|
|
2073
|
+
return _regeneratorRuntime().wrap(function _callee21$(_context21) {
|
|
2074
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
1912
2075
|
case 0:
|
|
1913
2076
|
this.logMethodStart('onCustomerLogin', {
|
|
1914
2077
|
customerId: params.customerId
|
|
1915
2078
|
});
|
|
1916
|
-
|
|
1917
|
-
|
|
2079
|
+
_context21.prev = 1;
|
|
2080
|
+
_context21.next = 4;
|
|
1918
2081
|
return this.refreshOrderMarketingAfterLogin({
|
|
1919
2082
|
customerId: params.customerId
|
|
1920
2083
|
});
|
|
@@ -1922,20 +2085,20 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1922
2085
|
this.logMethodSuccess('onCustomerLogin', {
|
|
1923
2086
|
customerId: params.customerId
|
|
1924
2087
|
});
|
|
1925
|
-
|
|
2088
|
+
_context21.next = 11;
|
|
1926
2089
|
break;
|
|
1927
2090
|
case 7:
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
this.logMethodError('onCustomerLogin',
|
|
1931
|
-
throw
|
|
2091
|
+
_context21.prev = 7;
|
|
2092
|
+
_context21.t0 = _context21["catch"](1);
|
|
2093
|
+
this.logMethodError('onCustomerLogin', _context21.t0);
|
|
2094
|
+
throw _context21.t0;
|
|
1932
2095
|
case 11:
|
|
1933
2096
|
case "end":
|
|
1934
|
-
return
|
|
2097
|
+
return _context21.stop();
|
|
1935
2098
|
}
|
|
1936
|
-
},
|
|
2099
|
+
}, _callee21, this, [[1, 7]]);
|
|
1937
2100
|
}));
|
|
1938
|
-
function onCustomerLogin(
|
|
2101
|
+
function onCustomerLogin(_x14) {
|
|
1939
2102
|
return _onCustomerLogin.apply(this, arguments);
|
|
1940
2103
|
}
|
|
1941
2104
|
return onCustomerLogin;
|
|
@@ -1949,12 +2112,12 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1949
2112
|
var tempOrder = this.store.order.getTempOrder();
|
|
1950
2113
|
if (!(tempOrder !== null && tempOrder !== void 0 && (_tempOrder$products = tempOrder.products) !== null && _tempOrder$products !== void 0 && _tempOrder$products.length)) return;
|
|
1951
2114
|
var now = dayjs().format('YYYY-MM-DD HH:mm:ss');
|
|
1952
|
-
var
|
|
1953
|
-
|
|
2115
|
+
var _iterator13 = _createForOfIteratorHelper(tempOrder.products),
|
|
2116
|
+
_step13;
|
|
1954
2117
|
try {
|
|
1955
2118
|
var _loop4 = function _loop4() {
|
|
1956
2119
|
var _product$metadata2;
|
|
1957
|
-
var product =
|
|
2120
|
+
var product = _step13.value;
|
|
1958
2121
|
if ((_product$metadata2 = product.metadata) !== null && _product$metadata2 !== void 0 && _product$metadata2.venue_booking) {
|
|
1959
2122
|
var mappings = _this10.resourceProductMap.get(product.metadata.resource_id);
|
|
1960
2123
|
if (!mappings || !mappings.length) return 0; // continue
|
|
@@ -1997,43 +2160,43 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1997
2160
|
}
|
|
1998
2161
|
},
|
|
1999
2162
|
_ret;
|
|
2000
|
-
for (
|
|
2163
|
+
for (_iterator13.s(); !(_step13 = _iterator13.n()).done;) {
|
|
2001
2164
|
_ret = _loop4();
|
|
2002
2165
|
if (_ret === 0) continue;
|
|
2003
2166
|
}
|
|
2004
2167
|
} catch (err) {
|
|
2005
|
-
|
|
2168
|
+
_iterator13.e(err);
|
|
2006
2169
|
} finally {
|
|
2007
|
-
|
|
2170
|
+
_iterator13.f();
|
|
2008
2171
|
}
|
|
2009
2172
|
}
|
|
2010
2173
|
}, {
|
|
2011
2174
|
key: "scanCode",
|
|
2012
2175
|
value: function () {
|
|
2013
|
-
var _scanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2176
|
+
var _scanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(code, customerId) {
|
|
2014
2177
|
var result;
|
|
2015
|
-
return _regeneratorRuntime().wrap(function
|
|
2016
|
-
while (1) switch (
|
|
2178
|
+
return _regeneratorRuntime().wrap(function _callee22$(_context22) {
|
|
2179
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
2017
2180
|
case 0:
|
|
2018
2181
|
this.logMethodStart('scanCode', {
|
|
2019
2182
|
code: code
|
|
2020
2183
|
});
|
|
2021
|
-
|
|
2184
|
+
_context22.prev = 1;
|
|
2022
2185
|
if (this.store.order) {
|
|
2023
|
-
|
|
2186
|
+
_context22.next = 4;
|
|
2024
2187
|
break;
|
|
2025
2188
|
}
|
|
2026
2189
|
throw new Error('order 模块未初始化');
|
|
2027
2190
|
case 4:
|
|
2028
|
-
|
|
2191
|
+
_context22.next = 6;
|
|
2029
2192
|
return this.store.order.scanCode(code, customerId);
|
|
2030
2193
|
case 6:
|
|
2031
|
-
result =
|
|
2194
|
+
result = _context22.sent;
|
|
2032
2195
|
if (!result.isAvailable) {
|
|
2033
|
-
|
|
2196
|
+
_context22.next = 11;
|
|
2034
2197
|
break;
|
|
2035
2198
|
}
|
|
2036
|
-
|
|
2199
|
+
_context22.next = 10;
|
|
2037
2200
|
return this.store.order.recalculateSummary({
|
|
2038
2201
|
createIfMissing: true
|
|
2039
2202
|
});
|
|
@@ -2043,19 +2206,19 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2043
2206
|
this.logMethodSuccess('scanCode', {
|
|
2044
2207
|
isAvailable: result.isAvailable
|
|
2045
2208
|
});
|
|
2046
|
-
return
|
|
2209
|
+
return _context22.abrupt("return", result);
|
|
2047
2210
|
case 15:
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
this.logMethodError('scanCode',
|
|
2051
|
-
throw
|
|
2211
|
+
_context22.prev = 15;
|
|
2212
|
+
_context22.t0 = _context22["catch"](1);
|
|
2213
|
+
this.logMethodError('scanCode', _context22.t0);
|
|
2214
|
+
throw _context22.t0;
|
|
2052
2215
|
case 19:
|
|
2053
2216
|
case "end":
|
|
2054
|
-
return
|
|
2217
|
+
return _context22.stop();
|
|
2055
2218
|
}
|
|
2056
|
-
},
|
|
2219
|
+
}, _callee22, this, [[1, 15]]);
|
|
2057
2220
|
}));
|
|
2058
|
-
function scanCode(
|
|
2221
|
+
function scanCode(_x15, _x16) {
|
|
2059
2222
|
return _scanCode.apply(this, arguments);
|
|
2060
2223
|
}
|
|
2061
2224
|
return scanCode;
|
|
@@ -2071,15 +2234,15 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2071
2234
|
}, {
|
|
2072
2235
|
key: "setDiscountSelected",
|
|
2073
2236
|
value: (function () {
|
|
2074
|
-
var _setDiscountSelected = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2075
|
-
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,
|
|
2076
|
-
return _regeneratorRuntime().wrap(function
|
|
2077
|
-
while (1) switch (
|
|
2237
|
+
var _setDiscountSelected = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(params) {
|
|
2238
|
+
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, _product$_origin, _product$metadata$sou, _product$metadata3, _product$metadata4, _product$original_pri, product, totalPerUnitDiscount, optionSum, sourcePrice, newSourceSellingPrice, newMainSellingPrice, afterApplyTarget, finalSummary, finalProduct, finalTarget;
|
|
2239
|
+
return _regeneratorRuntime().wrap(function _callee23$(_context23) {
|
|
2240
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
2078
2241
|
case 0:
|
|
2079
2242
|
this.logMethodStart('setDiscountSelected', params);
|
|
2080
|
-
|
|
2243
|
+
_context23.prev = 1;
|
|
2081
2244
|
if (this.store.order) {
|
|
2082
|
-
|
|
2245
|
+
_context23.next = 4;
|
|
2083
2246
|
break;
|
|
2084
2247
|
}
|
|
2085
2248
|
throw new Error('order 模块未初始化');
|
|
@@ -2105,7 +2268,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2105
2268
|
form_record_id: tempOrder.holder.form_record_id
|
|
2106
2269
|
}] : [];
|
|
2107
2270
|
nextDiscountList = updated;
|
|
2108
|
-
|
|
2271
|
+
_context23.next = 16;
|
|
2109
2272
|
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(updated);
|
|
2110
2273
|
case 16:
|
|
2111
2274
|
if (rulesModule) {
|
|
@@ -2132,18 +2295,18 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2132
2295
|
}).map(function (d) {
|
|
2133
2296
|
return d.id;
|
|
2134
2297
|
}));
|
|
2135
|
-
|
|
2298
|
+
_iterator14 = _createForOfIteratorHelper(nextDiscountList);
|
|
2136
2299
|
try {
|
|
2137
|
-
for (
|
|
2138
|
-
d =
|
|
2300
|
+
for (_iterator14.s(); !(_step14 = _iterator14.n()).done;) {
|
|
2301
|
+
d = _step14.value;
|
|
2139
2302
|
if (d.isSelected && !beforeSelectedIds.has(d.id)) {
|
|
2140
2303
|
d.isSelected = false;
|
|
2141
2304
|
}
|
|
2142
2305
|
}
|
|
2143
2306
|
} catch (err) {
|
|
2144
|
-
|
|
2307
|
+
_iterator14.e(err);
|
|
2145
2308
|
} finally {
|
|
2146
|
-
|
|
2309
|
+
_iterator14.f();
|
|
2147
2310
|
}
|
|
2148
2311
|
}
|
|
2149
2312
|
}
|
|
@@ -2156,20 +2319,20 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2156
2319
|
// 都以 original_price - Σ (当前选中 discount_list.amount) 重算 selling_price。
|
|
2157
2320
|
// 目的:避免 unselect 后 selling_price 残留、reselect 时把残留价带进下一轮 Rules 造成双折扣。
|
|
2158
2321
|
// 手动改价商品(_origin.isManualDiscount=true)不参与券流程归一化,保留手工价。
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2322
|
+
_iterator15 = _createForOfIteratorHelper(tempOrder.products);
|
|
2323
|
+
_context23.prev = 19;
|
|
2324
|
+
_iterator15.s();
|
|
2162
2325
|
case 21:
|
|
2163
|
-
if ((
|
|
2164
|
-
|
|
2326
|
+
if ((_step15 = _iterator15.n()).done) {
|
|
2327
|
+
_context23.next = 35;
|
|
2165
2328
|
break;
|
|
2166
2329
|
}
|
|
2167
|
-
product =
|
|
2330
|
+
product = _step15.value;
|
|
2168
2331
|
if (!((_product$_origin = product._origin) !== null && _product$_origin !== void 0 && _product$_origin.isManualDiscount)) {
|
|
2169
|
-
|
|
2332
|
+
_context23.next = 25;
|
|
2170
2333
|
break;
|
|
2171
2334
|
}
|
|
2172
|
-
return
|
|
2335
|
+
return _context23.abrupt("continue", 33);
|
|
2173
2336
|
case 25:
|
|
2174
2337
|
// 1. 把 product.discount_list 和当前选中的 discount 对齐(剔除已取消的券)
|
|
2175
2338
|
product.discount_list = (product.discount_list || []).filter(function (pd) {
|
|
@@ -2196,22 +2359,22 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2196
2359
|
bundle: product.product_bundle
|
|
2197
2360
|
});
|
|
2198
2361
|
case 33:
|
|
2199
|
-
|
|
2362
|
+
_context23.next = 21;
|
|
2200
2363
|
break;
|
|
2201
2364
|
case 35:
|
|
2202
|
-
|
|
2365
|
+
_context23.next = 40;
|
|
2203
2366
|
break;
|
|
2204
2367
|
case 37:
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2368
|
+
_context23.prev = 37;
|
|
2369
|
+
_context23.t0 = _context23["catch"](19);
|
|
2370
|
+
_iterator15.e(_context23.t0);
|
|
2208
2371
|
case 40:
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
return
|
|
2372
|
+
_context23.prev = 40;
|
|
2373
|
+
_iterator15.f();
|
|
2374
|
+
return _context23.finish(40);
|
|
2212
2375
|
case 43:
|
|
2213
2376
|
OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
|
|
2214
|
-
|
|
2377
|
+
_context23.next = 46;
|
|
2215
2378
|
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
|
|
2216
2379
|
case 46:
|
|
2217
2380
|
tempOrder.discount_list = (nextDiscountList || []).filter(function (d) {
|
|
@@ -2220,7 +2383,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2220
2383
|
afterApplyTarget = this.store.order.getDiscountList().find(function (d) {
|
|
2221
2384
|
return d.id === params.discountId;
|
|
2222
2385
|
}) || null;
|
|
2223
|
-
|
|
2386
|
+
_context23.next = 50;
|
|
2224
2387
|
return this.store.order.recalculateSummary({
|
|
2225
2388
|
createIfMissing: true
|
|
2226
2389
|
});
|
|
@@ -2232,19 +2395,19 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2232
2395
|
finalTarget = this.store.order.getDiscountList().find(function (d) {
|
|
2233
2396
|
return d.id === params.discountId;
|
|
2234
2397
|
}) || null;
|
|
2235
|
-
return
|
|
2398
|
+
return _context23.abrupt("return", this.store.order.getDiscountList());
|
|
2236
2399
|
case 58:
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
this.logMethodError('setDiscountSelected',
|
|
2240
|
-
throw
|
|
2400
|
+
_context23.prev = 58;
|
|
2401
|
+
_context23.t1 = _context23["catch"](1);
|
|
2402
|
+
this.logMethodError('setDiscountSelected', _context23.t1);
|
|
2403
|
+
throw _context23.t1;
|
|
2241
2404
|
case 62:
|
|
2242
2405
|
case "end":
|
|
2243
|
-
return
|
|
2406
|
+
return _context23.stop();
|
|
2244
2407
|
}
|
|
2245
|
-
},
|
|
2408
|
+
}, _callee23, this, [[1, 58], [19, 37, 40, 43]]);
|
|
2246
2409
|
}));
|
|
2247
|
-
function setDiscountSelected(
|
|
2410
|
+
function setDiscountSelected(_x17) {
|
|
2248
2411
|
return _setDiscountSelected.apply(this, arguments);
|
|
2249
2412
|
}
|
|
2250
2413
|
return setDiscountSelected;
|
|
@@ -2252,37 +2415,37 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2252
2415
|
}, {
|
|
2253
2416
|
key: "addNewOrder",
|
|
2254
2417
|
value: function () {
|
|
2255
|
-
var _addNewOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2418
|
+
var _addNewOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
|
|
2256
2419
|
var tempOrder;
|
|
2257
|
-
return _regeneratorRuntime().wrap(function
|
|
2258
|
-
while (1) switch (
|
|
2420
|
+
return _regeneratorRuntime().wrap(function _callee24$(_context24) {
|
|
2421
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
2259
2422
|
case 0:
|
|
2260
2423
|
this.logMethodStart('addNewOrder');
|
|
2261
|
-
|
|
2424
|
+
_context24.prev = 1;
|
|
2262
2425
|
if (this.store.order) {
|
|
2263
|
-
|
|
2426
|
+
_context24.next = 4;
|
|
2264
2427
|
break;
|
|
2265
2428
|
}
|
|
2266
2429
|
throw new Error('order 模块未初始化');
|
|
2267
2430
|
case 4:
|
|
2268
|
-
|
|
2431
|
+
_context24.next = 6;
|
|
2269
2432
|
return this.store.order.addNewOrder();
|
|
2270
2433
|
case 6:
|
|
2271
|
-
tempOrder =
|
|
2434
|
+
tempOrder = _context24.sent;
|
|
2272
2435
|
this.logMethodSuccess('addNewOrder', {
|
|
2273
2436
|
productCount: tempOrder.products.length
|
|
2274
2437
|
});
|
|
2275
|
-
return
|
|
2438
|
+
return _context24.abrupt("return", tempOrder);
|
|
2276
2439
|
case 11:
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
this.logMethodError('addNewOrder',
|
|
2280
|
-
throw
|
|
2440
|
+
_context24.prev = 11;
|
|
2441
|
+
_context24.t0 = _context24["catch"](1);
|
|
2442
|
+
this.logMethodError('addNewOrder', _context24.t0);
|
|
2443
|
+
throw _context24.t0;
|
|
2281
2444
|
case 15:
|
|
2282
2445
|
case "end":
|
|
2283
|
-
return
|
|
2446
|
+
return _context24.stop();
|
|
2284
2447
|
}
|
|
2285
|
-
},
|
|
2448
|
+
}, _callee24, this, [[1, 11]]);
|
|
2286
2449
|
}));
|
|
2287
2450
|
function addNewOrder() {
|
|
2288
2451
|
return _addNewOrder.apply(this, arguments);
|
|
@@ -2298,37 +2461,37 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2298
2461
|
}, {
|
|
2299
2462
|
key: "getSummary",
|
|
2300
2463
|
value: function () {
|
|
2301
|
-
var _getSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2464
|
+
var _getSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
|
|
2302
2465
|
var summary;
|
|
2303
|
-
return _regeneratorRuntime().wrap(function
|
|
2304
|
-
while (1) switch (
|
|
2466
|
+
return _regeneratorRuntime().wrap(function _callee25$(_context25) {
|
|
2467
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
2305
2468
|
case 0:
|
|
2306
2469
|
this.logMethodStart('getSummary');
|
|
2307
|
-
|
|
2470
|
+
_context25.prev = 1;
|
|
2308
2471
|
if (this.store.order) {
|
|
2309
|
-
|
|
2472
|
+
_context25.next = 4;
|
|
2310
2473
|
break;
|
|
2311
2474
|
}
|
|
2312
2475
|
throw new Error('order 模块未初始化');
|
|
2313
2476
|
case 4:
|
|
2314
|
-
|
|
2477
|
+
_context25.next = 6;
|
|
2315
2478
|
return this.store.order.getScanOrderSummary();
|
|
2316
2479
|
case 6:
|
|
2317
|
-
summary =
|
|
2480
|
+
summary = _context25.sent;
|
|
2318
2481
|
this.logMethodSuccess('getSummary', {
|
|
2319
2482
|
totalAmount: summary.total_amount
|
|
2320
2483
|
});
|
|
2321
|
-
return
|
|
2484
|
+
return _context25.abrupt("return", summary);
|
|
2322
2485
|
case 11:
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
this.logMethodError('getSummary',
|
|
2326
|
-
throw
|
|
2486
|
+
_context25.prev = 11;
|
|
2487
|
+
_context25.t0 = _context25["catch"](1);
|
|
2488
|
+
this.logMethodError('getSummary', _context25.t0);
|
|
2489
|
+
throw _context25.t0;
|
|
2327
2490
|
case 15:
|
|
2328
2491
|
case "end":
|
|
2329
|
-
return
|
|
2492
|
+
return _context25.stop();
|
|
2330
2493
|
}
|
|
2331
|
-
},
|
|
2494
|
+
}, _callee25, this, [[1, 11]]);
|
|
2332
2495
|
}));
|
|
2333
2496
|
function getSummary() {
|
|
2334
2497
|
return _getSummary.apply(this, arguments);
|
|
@@ -2338,47 +2501,47 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2338
2501
|
}, {
|
|
2339
2502
|
key: "submitOrder",
|
|
2340
2503
|
value: function () {
|
|
2341
|
-
var _submitOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2342
|
-
var _this$
|
|
2343
|
-
return _regeneratorRuntime().wrap(function
|
|
2344
|
-
while (1) switch (
|
|
2504
|
+
var _submitOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26() {
|
|
2505
|
+
var _this$otherParams11, _this$otherParams12, _this$otherParams13, _this$otherParams14, _tempOrder$products2, result, tempOrder;
|
|
2506
|
+
return _regeneratorRuntime().wrap(function _callee26$(_context26) {
|
|
2507
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
2345
2508
|
case 0:
|
|
2346
2509
|
this.logMethodStart('submitOrder');
|
|
2347
|
-
|
|
2348
|
-
|
|
2510
|
+
_context26.prev = 1;
|
|
2511
|
+
_context26.next = 4;
|
|
2349
2512
|
return this.validateBeforeSubmitByItemRule();
|
|
2350
2513
|
case 4:
|
|
2351
2514
|
if (this.store.order) {
|
|
2352
|
-
|
|
2515
|
+
_context26.next = 6;
|
|
2353
2516
|
break;
|
|
2354
2517
|
}
|
|
2355
2518
|
throw new Error('venueBooking解决方案需要 order 模块支持');
|
|
2356
2519
|
case 6:
|
|
2357
|
-
|
|
2520
|
+
_context26.next = 8;
|
|
2358
2521
|
return this.store.order.submitTempOrder({
|
|
2359
2522
|
cacheId: this.cacheId,
|
|
2360
|
-
platform: (_this$
|
|
2361
|
-
businessCode: (_this$
|
|
2362
|
-
channel: (_this$
|
|
2363
|
-
type: (_this$
|
|
2523
|
+
platform: (_this$otherParams11 = this.otherParams) === null || _this$otherParams11 === void 0 ? void 0 : _this$otherParams11.platform,
|
|
2524
|
+
businessCode: (_this$otherParams12 = this.otherParams) === null || _this$otherParams12 === void 0 ? void 0 : _this$otherParams12.businessCode,
|
|
2525
|
+
channel: (_this$otherParams13 = this.otherParams) === null || _this$otherParams13 === void 0 ? void 0 : _this$otherParams13.channel,
|
|
2526
|
+
type: (_this$otherParams14 = this.otherParams) === null || _this$otherParams14 === void 0 ? void 0 : _this$otherParams14.type
|
|
2364
2527
|
});
|
|
2365
2528
|
case 8:
|
|
2366
|
-
result =
|
|
2529
|
+
result = _context26.sent;
|
|
2367
2530
|
tempOrder = this.store.order.getTempOrder();
|
|
2368
2531
|
this.logMethodSuccess('submitOrder', {
|
|
2369
2532
|
productCount: (tempOrder === null || tempOrder === void 0 || (_tempOrder$products2 = tempOrder.products) === null || _tempOrder$products2 === void 0 ? void 0 : _tempOrder$products2.length) || 0
|
|
2370
2533
|
});
|
|
2371
|
-
return
|
|
2534
|
+
return _context26.abrupt("return", result);
|
|
2372
2535
|
case 14:
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
this.logMethodError('submitOrder',
|
|
2376
|
-
throw
|
|
2536
|
+
_context26.prev = 14;
|
|
2537
|
+
_context26.t0 = _context26["catch"](1);
|
|
2538
|
+
this.logMethodError('submitOrder', _context26.t0);
|
|
2539
|
+
throw _context26.t0;
|
|
2377
2540
|
case 18:
|
|
2378
2541
|
case "end":
|
|
2379
|
-
return
|
|
2542
|
+
return _context26.stop();
|
|
2380
2543
|
}
|
|
2381
|
-
},
|
|
2544
|
+
}, _callee26, this, [[1, 14]]);
|
|
2382
2545
|
}));
|
|
2383
2546
|
function submitOrder() {
|
|
2384
2547
|
return _submitOrder.apply(this, arguments);
|
|
@@ -2388,18 +2551,18 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2388
2551
|
}, {
|
|
2389
2552
|
key: "addProductToOrder",
|
|
2390
2553
|
value: function () {
|
|
2391
|
-
var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2554
|
+
var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(product) {
|
|
2392
2555
|
var _product$metadata5, _product$product_vari2, quotationPrice, products;
|
|
2393
|
-
return _regeneratorRuntime().wrap(function
|
|
2394
|
-
while (1) switch (
|
|
2556
|
+
return _regeneratorRuntime().wrap(function _callee27$(_context27) {
|
|
2557
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
2395
2558
|
case 0:
|
|
2396
2559
|
this.logMethodStart('addProductToOrder', {
|
|
2397
2560
|
product_id: product.product_id,
|
|
2398
2561
|
product_variant_id: product.product_variant_id
|
|
2399
2562
|
});
|
|
2400
|
-
|
|
2563
|
+
_context27.prev = 1;
|
|
2401
2564
|
if (this.store.order) {
|
|
2402
|
-
|
|
2565
|
+
_context27.next = 4;
|
|
2403
2566
|
break;
|
|
2404
2567
|
}
|
|
2405
2568
|
throw new Error('order 模块未初始化');
|
|
@@ -2417,32 +2580,32 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2417
2580
|
product.original_price = product.selling_price;
|
|
2418
2581
|
}
|
|
2419
2582
|
}
|
|
2420
|
-
|
|
2583
|
+
_context27.next = 7;
|
|
2421
2584
|
return this.store.order.addProductToOrder(product);
|
|
2422
2585
|
case 7:
|
|
2423
|
-
products =
|
|
2424
|
-
|
|
2586
|
+
products = _context27.sent;
|
|
2587
|
+
_context27.next = 10;
|
|
2425
2588
|
return this.refreshItemRuleQuantityLimits();
|
|
2426
2589
|
case 10:
|
|
2427
|
-
|
|
2590
|
+
_context27.next = 12;
|
|
2428
2591
|
return this.refreshCartValidationPassed();
|
|
2429
2592
|
case 12:
|
|
2430
2593
|
this.logMethodSuccess('addProductToOrder', {
|
|
2431
2594
|
productCount: products.length
|
|
2432
2595
|
});
|
|
2433
|
-
return
|
|
2596
|
+
return _context27.abrupt("return", products);
|
|
2434
2597
|
case 16:
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
this.logMethodError('addProductToOrder',
|
|
2438
|
-
throw
|
|
2598
|
+
_context27.prev = 16;
|
|
2599
|
+
_context27.t0 = _context27["catch"](1);
|
|
2600
|
+
this.logMethodError('addProductToOrder', _context27.t0);
|
|
2601
|
+
throw _context27.t0;
|
|
2439
2602
|
case 20:
|
|
2440
2603
|
case "end":
|
|
2441
|
-
return
|
|
2604
|
+
return _context27.stop();
|
|
2442
2605
|
}
|
|
2443
|
-
},
|
|
2606
|
+
}, _callee27, this, [[1, 16]]);
|
|
2444
2607
|
}));
|
|
2445
|
-
function addProductToOrder(
|
|
2608
|
+
function addProductToOrder(_x18) {
|
|
2446
2609
|
return _addProductToOrder.apply(this, arguments);
|
|
2447
2610
|
}
|
|
2448
2611
|
return addProductToOrder;
|
|
@@ -2450,48 +2613,48 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2450
2613
|
}, {
|
|
2451
2614
|
key: "updateProductInOrder",
|
|
2452
2615
|
value: function () {
|
|
2453
|
-
var _updateProductInOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2616
|
+
var _updateProductInOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(params) {
|
|
2454
2617
|
var products;
|
|
2455
|
-
return _regeneratorRuntime().wrap(function
|
|
2456
|
-
while (1) switch (
|
|
2618
|
+
return _regeneratorRuntime().wrap(function _callee28$(_context28) {
|
|
2619
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
2457
2620
|
case 0:
|
|
2458
2621
|
this.logMethodStart('updateProductInOrder', {
|
|
2459
2622
|
product_id: params.product_id,
|
|
2460
2623
|
product_variant_id: params.product_variant_id
|
|
2461
2624
|
});
|
|
2462
|
-
|
|
2625
|
+
_context28.prev = 1;
|
|
2463
2626
|
if (this.store.order) {
|
|
2464
|
-
|
|
2627
|
+
_context28.next = 4;
|
|
2465
2628
|
break;
|
|
2466
2629
|
}
|
|
2467
2630
|
throw new Error('order 模块未初始化');
|
|
2468
2631
|
case 4:
|
|
2469
|
-
|
|
2632
|
+
_context28.next = 6;
|
|
2470
2633
|
return this.store.order.updateProductInOrder(params);
|
|
2471
2634
|
case 6:
|
|
2472
|
-
products =
|
|
2473
|
-
|
|
2635
|
+
products = _context28.sent;
|
|
2636
|
+
_context28.next = 9;
|
|
2474
2637
|
return this.refreshItemRuleQuantityLimits();
|
|
2475
2638
|
case 9:
|
|
2476
|
-
|
|
2639
|
+
_context28.next = 11;
|
|
2477
2640
|
return this.refreshCartValidationPassed();
|
|
2478
2641
|
case 11:
|
|
2479
2642
|
this.logMethodSuccess('updateProductInOrder', {
|
|
2480
2643
|
productCount: products.length
|
|
2481
2644
|
});
|
|
2482
|
-
return
|
|
2645
|
+
return _context28.abrupt("return", products);
|
|
2483
2646
|
case 15:
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
this.logMethodError('updateProductInOrder',
|
|
2487
|
-
throw
|
|
2647
|
+
_context28.prev = 15;
|
|
2648
|
+
_context28.t0 = _context28["catch"](1);
|
|
2649
|
+
this.logMethodError('updateProductInOrder', _context28.t0);
|
|
2650
|
+
throw _context28.t0;
|
|
2488
2651
|
case 19:
|
|
2489
2652
|
case "end":
|
|
2490
|
-
return
|
|
2653
|
+
return _context28.stop();
|
|
2491
2654
|
}
|
|
2492
|
-
},
|
|
2655
|
+
}, _callee28, this, [[1, 15]]);
|
|
2493
2656
|
}));
|
|
2494
|
-
function updateProductInOrder(
|
|
2657
|
+
function updateProductInOrder(_x19) {
|
|
2495
2658
|
return _updateProductInOrder.apply(this, arguments);
|
|
2496
2659
|
}
|
|
2497
2660
|
return updateProductInOrder;
|
|
@@ -2499,66 +2662,66 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2499
2662
|
}, {
|
|
2500
2663
|
key: "removeProductFromOrder",
|
|
2501
2664
|
value: function () {
|
|
2502
|
-
var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2503
|
-
var _this$store$order$get3, _this$store$order6, _this$store$order$ens, _this$store$order7, _tempOrder$bookings, tempOrder, products, _tempOrder$bookings2, _tempOrder$bookings3, venueProductUids, venueBookingUids,
|
|
2504
|
-
return _regeneratorRuntime().wrap(function
|
|
2505
|
-
while (1) switch (
|
|
2665
|
+
var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(identity) {
|
|
2666
|
+
var _this$store$order$get3, _this$store$order6, _this$store$order$ens, _this$store$order7, _tempOrder$bookings, tempOrder, products, _tempOrder$bookings2, _tempOrder$bookings3, venueProductUids, venueBookingUids, _iterator16, _step16, _product$metadata6, _product$metadata7, product, beforeBookingCount, _this$store$order$per, _this$store$order8;
|
|
2667
|
+
return _regeneratorRuntime().wrap(function _callee29$(_context29) {
|
|
2668
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
2506
2669
|
case 0:
|
|
2507
2670
|
this.logMethodStart('removeProductFromOrder', {
|
|
2508
2671
|
product_id: identity.product_id,
|
|
2509
2672
|
product_variant_id: identity.product_variant_id
|
|
2510
2673
|
});
|
|
2511
|
-
|
|
2674
|
+
_context29.prev = 1;
|
|
2512
2675
|
if (this.store.order) {
|
|
2513
|
-
|
|
2676
|
+
_context29.next = 4;
|
|
2514
2677
|
break;
|
|
2515
2678
|
}
|
|
2516
2679
|
throw new Error('order 模块未初始化');
|
|
2517
2680
|
case 4:
|
|
2518
2681
|
tempOrder = ((_this$store$order$get3 = (_this$store$order6 = this.store.order).getTempOrder) === null || _this$store$order$get3 === void 0 ? void 0 : _this$store$order$get3.call(_this$store$order6)) || ((_this$store$order$ens = (_this$store$order7 = this.store.order).ensureTempOrder) === null || _this$store$order$ens === void 0 ? void 0 : _this$store$order$ens.call(_this$store$order7));
|
|
2519
|
-
|
|
2682
|
+
_context29.next = 7;
|
|
2520
2683
|
return this.store.order.removeProductFromOrder(identity);
|
|
2521
2684
|
case 7:
|
|
2522
|
-
products =
|
|
2685
|
+
products = _context29.sent;
|
|
2523
2686
|
if (!(tempOrder !== null && tempOrder !== void 0 && (_tempOrder$bookings = tempOrder.bookings) !== null && _tempOrder$bookings !== void 0 && _tempOrder$bookings.length)) {
|
|
2524
|
-
|
|
2687
|
+
_context29.next = 33;
|
|
2525
2688
|
break;
|
|
2526
2689
|
}
|
|
2527
2690
|
venueProductUids = new Set();
|
|
2528
2691
|
venueBookingUids = new Set();
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2692
|
+
_iterator16 = _createForOfIteratorHelper(tempOrder.products || []);
|
|
2693
|
+
_context29.prev = 12;
|
|
2694
|
+
_iterator16.s();
|
|
2532
2695
|
case 14:
|
|
2533
|
-
if ((
|
|
2534
|
-
|
|
2696
|
+
if ((_step16 = _iterator16.n()).done) {
|
|
2697
|
+
_context29.next = 22;
|
|
2535
2698
|
break;
|
|
2536
2699
|
}
|
|
2537
|
-
product =
|
|
2700
|
+
product = _step16.value;
|
|
2538
2701
|
if (product !== null && product !== void 0 && (_product$metadata6 = product.metadata) !== null && _product$metadata6 !== void 0 && _product$metadata6.venue_booking) {
|
|
2539
|
-
|
|
2702
|
+
_context29.next = 18;
|
|
2540
2703
|
break;
|
|
2541
2704
|
}
|
|
2542
|
-
return
|
|
2705
|
+
return _context29.abrupt("continue", 20);
|
|
2543
2706
|
case 18:
|
|
2544
2707
|
if (product.identity_key) venueProductUids.add(String(product.identity_key));
|
|
2545
2708
|
if ((_product$metadata7 = product.metadata) !== null && _product$metadata7 !== void 0 && _product$metadata7.booking_uid) {
|
|
2546
2709
|
venueBookingUids.add(String(product.metadata.booking_uid));
|
|
2547
2710
|
}
|
|
2548
2711
|
case 20:
|
|
2549
|
-
|
|
2712
|
+
_context29.next = 14;
|
|
2550
2713
|
break;
|
|
2551
2714
|
case 22:
|
|
2552
|
-
|
|
2715
|
+
_context29.next = 27;
|
|
2553
2716
|
break;
|
|
2554
2717
|
case 24:
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2718
|
+
_context29.prev = 24;
|
|
2719
|
+
_context29.t0 = _context29["catch"](12);
|
|
2720
|
+
_iterator16.e(_context29.t0);
|
|
2558
2721
|
case 27:
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
return
|
|
2722
|
+
_context29.prev = 27;
|
|
2723
|
+
_iterator16.f();
|
|
2724
|
+
return _context29.finish(27);
|
|
2562
2725
|
case 30:
|
|
2563
2726
|
beforeBookingCount = ((_tempOrder$bookings2 = tempOrder.bookings) === null || _tempOrder$bookings2 === void 0 ? void 0 : _tempOrder$bookings2.length) || 0;
|
|
2564
2727
|
tempOrder.bookings = (tempOrder.bookings || []).filter(function (booking) {
|
|
@@ -2575,28 +2738,28 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2575
2738
|
(_this$store$order$per = (_this$store$order8 = this.store.order).persistTempOrder) === null || _this$store$order$per === void 0 || _this$store$order$per.call(_this$store$order8);
|
|
2576
2739
|
}
|
|
2577
2740
|
case 33:
|
|
2578
|
-
|
|
2741
|
+
_context29.next = 35;
|
|
2579
2742
|
return this.refreshItemRuleQuantityLimits();
|
|
2580
2743
|
case 35:
|
|
2581
|
-
|
|
2744
|
+
_context29.next = 37;
|
|
2582
2745
|
return this.refreshCartValidationPassed();
|
|
2583
2746
|
case 37:
|
|
2584
2747
|
this.logMethodSuccess('removeProductFromOrder', {
|
|
2585
2748
|
productCount: products.length
|
|
2586
2749
|
});
|
|
2587
|
-
return
|
|
2750
|
+
return _context29.abrupt("return", products);
|
|
2588
2751
|
case 41:
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
this.logMethodError('removeProductFromOrder',
|
|
2592
|
-
throw
|
|
2752
|
+
_context29.prev = 41;
|
|
2753
|
+
_context29.t1 = _context29["catch"](1);
|
|
2754
|
+
this.logMethodError('removeProductFromOrder', _context29.t1);
|
|
2755
|
+
throw _context29.t1;
|
|
2593
2756
|
case 45:
|
|
2594
2757
|
case "end":
|
|
2595
|
-
return
|
|
2758
|
+
return _context29.stop();
|
|
2596
2759
|
}
|
|
2597
|
-
},
|
|
2760
|
+
}, _callee29, this, [[1, 41], [12, 24, 27, 30]]);
|
|
2598
2761
|
}));
|
|
2599
|
-
function removeProductFromOrder(
|
|
2762
|
+
function removeProductFromOrder(_x20) {
|
|
2600
2763
|
return _removeProductFromOrder.apply(this, arguments);
|
|
2601
2764
|
}
|
|
2602
2765
|
return removeProductFromOrder;
|
|
@@ -2604,27 +2767,27 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2604
2767
|
}, {
|
|
2605
2768
|
key: "getProductList",
|
|
2606
2769
|
value: function () {
|
|
2607
|
-
var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2770
|
+
var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30() {
|
|
2608
2771
|
var result;
|
|
2609
|
-
return _regeneratorRuntime().wrap(function
|
|
2610
|
-
while (1) switch (
|
|
2772
|
+
return _regeneratorRuntime().wrap(function _callee30$(_context30) {
|
|
2773
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
2611
2774
|
case 0:
|
|
2612
2775
|
if (!this.productsLoaded) {
|
|
2613
|
-
|
|
2776
|
+
_context30.next = 2;
|
|
2614
2777
|
break;
|
|
2615
2778
|
}
|
|
2616
|
-
return
|
|
2779
|
+
return _context30.abrupt("return", attachItemRuleLimitsToTopLevelProducts(this.getAddonProductsList(), this.store.itemRuleQuantityLimits || []));
|
|
2617
2780
|
case 2:
|
|
2618
|
-
|
|
2781
|
+
_context30.next = 4;
|
|
2619
2782
|
return this.loadAllProducts();
|
|
2620
2783
|
case 4:
|
|
2621
|
-
result =
|
|
2622
|
-
return
|
|
2784
|
+
result = _context30.sent;
|
|
2785
|
+
return _context30.abrupt("return", attachItemRuleLimitsToTopLevelProducts(result.addonProducts, this.store.itemRuleQuantityLimits || []));
|
|
2623
2786
|
case 6:
|
|
2624
2787
|
case "end":
|
|
2625
|
-
return
|
|
2788
|
+
return _context30.stop();
|
|
2626
2789
|
}
|
|
2627
|
-
},
|
|
2790
|
+
}, _callee30, this);
|
|
2628
2791
|
}));
|
|
2629
2792
|
function getProductList() {
|
|
2630
2793
|
return _getProductList.apply(this, arguments);
|
|
@@ -2634,13 +2797,13 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2634
2797
|
}, {
|
|
2635
2798
|
key: "loadOpenDataConfig",
|
|
2636
2799
|
value: function () {
|
|
2637
|
-
var _loadOpenDataConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2800
|
+
var _loadOpenDataConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31() {
|
|
2638
2801
|
var lastFetchedAt, cachedData, openDataConfig;
|
|
2639
|
-
return _regeneratorRuntime().wrap(function
|
|
2640
|
-
while (1) switch (
|
|
2802
|
+
return _regeneratorRuntime().wrap(function _callee31$(_context31) {
|
|
2803
|
+
while (1) switch (_context31.prev = _context31.next) {
|
|
2641
2804
|
case 0:
|
|
2642
2805
|
if (this.store.openData) {
|
|
2643
|
-
|
|
2806
|
+
_context31.next = 2;
|
|
2644
2807
|
break;
|
|
2645
2808
|
}
|
|
2646
2809
|
throw new Error('openData 模块未初始化');
|
|
@@ -2648,42 +2811,42 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2648
2811
|
lastFetchedAt = this.store.openData.getLastFetchedAt();
|
|
2649
2812
|
cachedData = this.store.openData.getOpenData();
|
|
2650
2813
|
if (!(cachedData && lastFetchedAt && Date.now() - lastFetchedAt < VenueBookingImpl.OPEN_DATA_CACHE_TTL)) {
|
|
2651
|
-
|
|
2814
|
+
_context31.next = 7;
|
|
2652
2815
|
break;
|
|
2653
2816
|
}
|
|
2654
2817
|
this.otherParams.openData = cachedData;
|
|
2655
|
-
return
|
|
2818
|
+
return _context31.abrupt("return", cachedData);
|
|
2656
2819
|
case 7:
|
|
2657
2820
|
if (!this.loadOpenDataConfigInFlight) {
|
|
2658
|
-
|
|
2821
|
+
_context31.next = 11;
|
|
2659
2822
|
break;
|
|
2660
2823
|
}
|
|
2661
|
-
|
|
2824
|
+
_context31.next = 10;
|
|
2662
2825
|
return this.loadOpenDataConfigInFlight;
|
|
2663
2826
|
case 10:
|
|
2664
|
-
return
|
|
2827
|
+
return _context31.abrupt("return", _context31.sent);
|
|
2665
2828
|
case 11:
|
|
2666
2829
|
this.loadOpenDataConfigInFlight = this.store.openData.fetchOpenData({
|
|
2667
2830
|
scope: 'board',
|
|
2668
2831
|
target: 'venue_booking+online_store',
|
|
2669
2832
|
section_code: [].concat(OPEN_DATA_SECTION_CODES)
|
|
2670
2833
|
});
|
|
2671
|
-
|
|
2672
|
-
|
|
2834
|
+
_context31.prev = 12;
|
|
2835
|
+
_context31.next = 15;
|
|
2673
2836
|
return this.loadOpenDataConfigInFlight;
|
|
2674
2837
|
case 15:
|
|
2675
|
-
openDataConfig =
|
|
2838
|
+
openDataConfig = _context31.sent;
|
|
2676
2839
|
this.otherParams.openData = openDataConfig;
|
|
2677
|
-
return
|
|
2840
|
+
return _context31.abrupt("return", openDataConfig);
|
|
2678
2841
|
case 18:
|
|
2679
|
-
|
|
2842
|
+
_context31.prev = 18;
|
|
2680
2843
|
this.loadOpenDataConfigInFlight = null;
|
|
2681
|
-
return
|
|
2844
|
+
return _context31.finish(18);
|
|
2682
2845
|
case 21:
|
|
2683
2846
|
case "end":
|
|
2684
|
-
return
|
|
2847
|
+
return _context31.stop();
|
|
2685
2848
|
}
|
|
2686
|
-
},
|
|
2849
|
+
}, _callee31, this, [[12,, 18, 21]]);
|
|
2687
2850
|
}));
|
|
2688
2851
|
function loadOpenDataConfig() {
|
|
2689
2852
|
return _loadOpenDataConfig.apply(this, arguments);
|
|
@@ -2693,29 +2856,29 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2693
2856
|
}, {
|
|
2694
2857
|
key: "loadRuntimeConfigs",
|
|
2695
2858
|
value: function () {
|
|
2696
|
-
var _loadRuntimeConfigs = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2859
|
+
var _loadRuntimeConfigs = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32() {
|
|
2697
2860
|
var itemRuleConfigs;
|
|
2698
|
-
return _regeneratorRuntime().wrap(function
|
|
2699
|
-
while (1) switch (
|
|
2861
|
+
return _regeneratorRuntime().wrap(function _callee32$(_context32) {
|
|
2862
|
+
while (1) switch (_context32.prev = _context32.next) {
|
|
2700
2863
|
case 0:
|
|
2701
|
-
|
|
2864
|
+
_context32.next = 2;
|
|
2702
2865
|
return this.loadOpenDataConfig();
|
|
2703
2866
|
case 2:
|
|
2704
|
-
|
|
2867
|
+
_context32.next = 4;
|
|
2705
2868
|
return this.ensureItemRuleConfigsLoaded();
|
|
2706
2869
|
case 4:
|
|
2707
|
-
itemRuleConfigs =
|
|
2870
|
+
itemRuleConfigs = _context32.sent;
|
|
2708
2871
|
this.logMethodSuccess('loadRuntimeConfigs', {
|
|
2709
2872
|
itemRuleCount: itemRuleConfigs.length
|
|
2710
2873
|
});
|
|
2711
|
-
return
|
|
2874
|
+
return _context32.abrupt("return", {
|
|
2712
2875
|
itemRuleConfigs: itemRuleConfigs
|
|
2713
2876
|
});
|
|
2714
2877
|
case 7:
|
|
2715
2878
|
case "end":
|
|
2716
|
-
return
|
|
2879
|
+
return _context32.stop();
|
|
2717
2880
|
}
|
|
2718
|
-
},
|
|
2881
|
+
}, _callee32, this);
|
|
2719
2882
|
}));
|
|
2720
2883
|
function loadRuntimeConfigs() {
|
|
2721
2884
|
return _loadRuntimeConfigs.apply(this, arguments);
|
|
@@ -2725,22 +2888,22 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2725
2888
|
}, {
|
|
2726
2889
|
key: "fetchItemRuleConfigsByModelIds",
|
|
2727
2890
|
value: function () {
|
|
2728
|
-
var _fetchItemRuleConfigsByModelIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2891
|
+
var _fetchItemRuleConfigsByModelIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(strategyModelIds) {
|
|
2729
2892
|
var result, configs;
|
|
2730
|
-
return _regeneratorRuntime().wrap(function
|
|
2731
|
-
while (1) switch (
|
|
2893
|
+
return _regeneratorRuntime().wrap(function _callee33$(_context33) {
|
|
2894
|
+
while (1) switch (_context33.prev = _context33.next) {
|
|
2732
2895
|
case 0:
|
|
2733
2896
|
this.logMethodStart('fetchItemRuleConfigsByModelIds', {
|
|
2734
2897
|
strategyModelIds: strategyModelIds
|
|
2735
2898
|
});
|
|
2736
2899
|
if (strategyModelIds.length) {
|
|
2737
|
-
|
|
2900
|
+
_context33.next = 3;
|
|
2738
2901
|
break;
|
|
2739
2902
|
}
|
|
2740
|
-
return
|
|
2903
|
+
return _context33.abrupt("return", []);
|
|
2741
2904
|
case 3:
|
|
2742
|
-
|
|
2743
|
-
|
|
2905
|
+
_context33.prev = 3;
|
|
2906
|
+
_context33.next = 6;
|
|
2744
2907
|
return this.request.get('/promotion', {
|
|
2745
2908
|
skip: 1,
|
|
2746
2909
|
num: 99,
|
|
@@ -2748,7 +2911,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2748
2911
|
ids: strategyModelIds
|
|
2749
2912
|
});
|
|
2750
2913
|
case 6:
|
|
2751
|
-
result =
|
|
2914
|
+
result = _context33.sent;
|
|
2752
2915
|
configs = [];
|
|
2753
2916
|
if (result.code === 200) {
|
|
2754
2917
|
configs = result.data.list.map(function (item) {
|
|
@@ -2759,21 +2922,21 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2759
2922
|
strategyModelIds: strategyModelIds,
|
|
2760
2923
|
strategyCount: configs.length
|
|
2761
2924
|
});
|
|
2762
|
-
return
|
|
2925
|
+
return _context33.abrupt("return", configs);
|
|
2763
2926
|
case 13:
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
this.logMethodError('fetchItemRuleConfigsByModelIds',
|
|
2927
|
+
_context33.prev = 13;
|
|
2928
|
+
_context33.t0 = _context33["catch"](3);
|
|
2929
|
+
this.logMethodError('fetchItemRuleConfigsByModelIds', _context33.t0, {
|
|
2767
2930
|
strategyModelIds: strategyModelIds
|
|
2768
2931
|
});
|
|
2769
|
-
return
|
|
2932
|
+
return _context33.abrupt("return", []);
|
|
2770
2933
|
case 17:
|
|
2771
2934
|
case "end":
|
|
2772
|
-
return
|
|
2935
|
+
return _context33.stop();
|
|
2773
2936
|
}
|
|
2774
|
-
},
|
|
2937
|
+
}, _callee33, this, [[3, 13]]);
|
|
2775
2938
|
}));
|
|
2776
|
-
function fetchItemRuleConfigsByModelIds(
|
|
2939
|
+
function fetchItemRuleConfigsByModelIds(_x21) {
|
|
2777
2940
|
return _fetchItemRuleConfigsByModelIds.apply(this, arguments);
|
|
2778
2941
|
}
|
|
2779
2942
|
return fetchItemRuleConfigsByModelIds;
|
|
@@ -2781,22 +2944,22 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2781
2944
|
}, {
|
|
2782
2945
|
key: "buildPrefillProductSourceMap",
|
|
2783
2946
|
value: function () {
|
|
2784
|
-
var _buildPrefillProductSourceMap = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2947
|
+
var _buildPrefillProductSourceMap = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34() {
|
|
2785
2948
|
var sourceMap, productList, visited, collectFromValue;
|
|
2786
|
-
return _regeneratorRuntime().wrap(function
|
|
2787
|
-
while (1) switch (
|
|
2949
|
+
return _regeneratorRuntime().wrap(function _callee34$(_context34) {
|
|
2950
|
+
while (1) switch (_context34.prev = _context34.next) {
|
|
2788
2951
|
case 0:
|
|
2789
2952
|
sourceMap = new Map();
|
|
2790
|
-
|
|
2791
|
-
|
|
2953
|
+
_context34.prev = 1;
|
|
2954
|
+
_context34.next = 4;
|
|
2792
2955
|
return this.getProductList();
|
|
2793
2956
|
case 4:
|
|
2794
|
-
productList =
|
|
2957
|
+
productList = _context34.sent;
|
|
2795
2958
|
if (Array.isArray(productList)) {
|
|
2796
|
-
|
|
2959
|
+
_context34.next = 7;
|
|
2797
2960
|
break;
|
|
2798
2961
|
}
|
|
2799
|
-
return
|
|
2962
|
+
return _context34.abrupt("return", sourceMap);
|
|
2800
2963
|
case 7:
|
|
2801
2964
|
visited = new Set();
|
|
2802
2965
|
collectFromValue = function collectFromValue(value) {
|
|
@@ -2805,17 +2968,17 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2805
2968
|
if (visited.has(value)) return;
|
|
2806
2969
|
visited.add(value);
|
|
2807
2970
|
if (Array.isArray(value)) {
|
|
2808
|
-
var
|
|
2809
|
-
|
|
2971
|
+
var _iterator17 = _createForOfIteratorHelper(value),
|
|
2972
|
+
_step17;
|
|
2810
2973
|
try {
|
|
2811
|
-
for (
|
|
2812
|
-
var item =
|
|
2974
|
+
for (_iterator17.s(); !(_step17 = _iterator17.n()).done;) {
|
|
2975
|
+
var item = _step17.value;
|
|
2813
2976
|
collectFromValue(item);
|
|
2814
2977
|
}
|
|
2815
2978
|
} catch (err) {
|
|
2816
|
-
|
|
2979
|
+
_iterator17.e(err);
|
|
2817
2980
|
} finally {
|
|
2818
|
-
|
|
2981
|
+
_iterator17.f();
|
|
2819
2982
|
}
|
|
2820
2983
|
return;
|
|
2821
2984
|
}
|
|
@@ -2835,19 +2998,19 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2835
2998
|
}
|
|
2836
2999
|
};
|
|
2837
3000
|
collectFromValue(productList);
|
|
2838
|
-
|
|
3001
|
+
_context34.next = 15;
|
|
2839
3002
|
break;
|
|
2840
3003
|
case 12:
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
this.logMethodError('buildPrefillProductSourceMap',
|
|
3004
|
+
_context34.prev = 12;
|
|
3005
|
+
_context34.t0 = _context34["catch"](1);
|
|
3006
|
+
this.logMethodError('buildPrefillProductSourceMap', _context34.t0);
|
|
2844
3007
|
case 15:
|
|
2845
|
-
return
|
|
3008
|
+
return _context34.abrupt("return", sourceMap);
|
|
2846
3009
|
case 16:
|
|
2847
3010
|
case "end":
|
|
2848
|
-
return
|
|
3011
|
+
return _context34.stop();
|
|
2849
3012
|
}
|
|
2850
|
-
},
|
|
3013
|
+
}, _callee34, this, [[1, 12]]);
|
|
2851
3014
|
}));
|
|
2852
3015
|
function buildPrefillProductSourceMap() {
|
|
2853
3016
|
return _buildPrefillProductSourceMap.apply(this, arguments);
|
|
@@ -2862,56 +3025,56 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2862
3025
|
}, {
|
|
2863
3026
|
key: "ensureItemRuleConfigsLoaded",
|
|
2864
3027
|
value: function () {
|
|
2865
|
-
var _ensureItemRuleConfigsLoaded = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3028
|
+
var _ensureItemRuleConfigsLoaded = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36() {
|
|
2866
3029
|
var _this11 = this;
|
|
2867
|
-
return _regeneratorRuntime().wrap(function
|
|
2868
|
-
while (1) switch (
|
|
3030
|
+
return _regeneratorRuntime().wrap(function _callee36$(_context36) {
|
|
3031
|
+
while (1) switch (_context36.prev = _context36.next) {
|
|
2869
3032
|
case 0:
|
|
2870
3033
|
if (!(this.itemRuleConfigs.length > 0)) {
|
|
2871
|
-
|
|
3034
|
+
_context36.next = 2;
|
|
2872
3035
|
break;
|
|
2873
3036
|
}
|
|
2874
|
-
return
|
|
3037
|
+
return _context36.abrupt("return", this.itemRuleConfigs);
|
|
2875
3038
|
case 2:
|
|
2876
3039
|
if (!this.itemRuleConfigsPromise) {
|
|
2877
|
-
|
|
3040
|
+
_context36.next = 4;
|
|
2878
3041
|
break;
|
|
2879
3042
|
}
|
|
2880
|
-
return
|
|
3043
|
+
return _context36.abrupt("return", this.itemRuleConfigsPromise);
|
|
2881
3044
|
case 4:
|
|
2882
|
-
this.itemRuleConfigsPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3045
|
+
this.itemRuleConfigsPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35() {
|
|
2883
3046
|
var runtimeConfig, staticConfigs;
|
|
2884
|
-
return _regeneratorRuntime().wrap(function
|
|
2885
|
-
while (1) switch (
|
|
3047
|
+
return _regeneratorRuntime().wrap(function _callee35$(_context35) {
|
|
3048
|
+
while (1) switch (_context35.prev = _context35.next) {
|
|
2886
3049
|
case 0:
|
|
2887
3050
|
runtimeConfig = _this11.getItemRuleRuntimeConfig();
|
|
2888
3051
|
staticConfigs = normalizeItemRuleStrategies(runtimeConfig.strategyConfigs);
|
|
2889
3052
|
if (!(staticConfigs.length > 0)) {
|
|
2890
|
-
|
|
3053
|
+
_context35.next = 6;
|
|
2891
3054
|
break;
|
|
2892
3055
|
}
|
|
2893
3056
|
_this11.itemRuleConfigs = staticConfigs;
|
|
2894
3057
|
_this11.itemRuleEvaluator.setStrategyConfigs(staticConfigs);
|
|
2895
|
-
return
|
|
3058
|
+
return _context35.abrupt("return", _this11.itemRuleConfigs);
|
|
2896
3059
|
case 6:
|
|
2897
3060
|
_this11.itemRuleConfigs = [];
|
|
2898
3061
|
_this11.itemRuleEvaluator.setStrategyConfigs([]);
|
|
2899
|
-
return
|
|
3062
|
+
return _context35.abrupt("return", _this11.itemRuleConfigs);
|
|
2900
3063
|
case 9:
|
|
2901
3064
|
case "end":
|
|
2902
|
-
return
|
|
3065
|
+
return _context35.stop();
|
|
2903
3066
|
}
|
|
2904
|
-
},
|
|
3067
|
+
}, _callee35);
|
|
2905
3068
|
}))();
|
|
2906
|
-
|
|
3069
|
+
_context36.next = 7;
|
|
2907
3070
|
return this.itemRuleConfigsPromise;
|
|
2908
3071
|
case 7:
|
|
2909
|
-
return
|
|
3072
|
+
return _context36.abrupt("return", _context36.sent);
|
|
2910
3073
|
case 8:
|
|
2911
3074
|
case "end":
|
|
2912
|
-
return
|
|
3075
|
+
return _context36.stop();
|
|
2913
3076
|
}
|
|
2914
|
-
},
|
|
3077
|
+
}, _callee36, this);
|
|
2915
3078
|
}));
|
|
2916
3079
|
function ensureItemRuleConfigsLoaded() {
|
|
2917
3080
|
return _ensureItemRuleConfigsLoaded.apply(this, arguments);
|
|
@@ -2921,22 +3084,22 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2921
3084
|
}, {
|
|
2922
3085
|
key: "refreshItemRuleQuantityLimits",
|
|
2923
3086
|
value: function () {
|
|
2924
|
-
var _refreshItemRuleQuantityLimits = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3087
|
+
var _refreshItemRuleQuantityLimits = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37() {
|
|
2925
3088
|
var strategyConfigs, businessData, limits;
|
|
2926
|
-
return _regeneratorRuntime().wrap(function
|
|
2927
|
-
while (1) switch (
|
|
3089
|
+
return _regeneratorRuntime().wrap(function _callee37$(_context37) {
|
|
3090
|
+
while (1) switch (_context37.prev = _context37.next) {
|
|
2928
3091
|
case 0:
|
|
2929
|
-
|
|
2930
|
-
|
|
3092
|
+
_context37.prev = 0;
|
|
3093
|
+
_context37.next = 3;
|
|
2931
3094
|
return this.ensureItemRuleConfigsLoaded();
|
|
2932
3095
|
case 3:
|
|
2933
|
-
strategyConfigs =
|
|
3096
|
+
strategyConfigs = _context37.sent;
|
|
2934
3097
|
if (strategyConfigs.length) {
|
|
2935
|
-
|
|
3098
|
+
_context37.next = 7;
|
|
2936
3099
|
break;
|
|
2937
3100
|
}
|
|
2938
3101
|
this.store.itemRuleQuantityLimits = [];
|
|
2939
|
-
return
|
|
3102
|
+
return _context37.abrupt("return", []);
|
|
2940
3103
|
case 7:
|
|
2941
3104
|
businessData = buildItemRuleBusinessData({
|
|
2942
3105
|
tempOrder: this.ensureTempOrder(),
|
|
@@ -2948,18 +3111,18 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2948
3111
|
this.logMethodSuccess('refreshItemRuleQuantityLimits', {
|
|
2949
3112
|
limitCount: limits.length
|
|
2950
3113
|
});
|
|
2951
|
-
return
|
|
3114
|
+
return _context37.abrupt("return", limits);
|
|
2952
3115
|
case 14:
|
|
2953
|
-
|
|
2954
|
-
|
|
3116
|
+
_context37.prev = 14;
|
|
3117
|
+
_context37.t0 = _context37["catch"](0);
|
|
2955
3118
|
this.store.itemRuleQuantityLimits = [];
|
|
2956
|
-
this.logMethodError('refreshItemRuleQuantityLimits',
|
|
2957
|
-
return
|
|
3119
|
+
this.logMethodError('refreshItemRuleQuantityLimits', _context37.t0);
|
|
3120
|
+
return _context37.abrupt("return", []);
|
|
2958
3121
|
case 19:
|
|
2959
3122
|
case "end":
|
|
2960
|
-
return
|
|
3123
|
+
return _context37.stop();
|
|
2961
3124
|
}
|
|
2962
|
-
},
|
|
3125
|
+
}, _callee37, this, [[0, 14]]);
|
|
2963
3126
|
}));
|
|
2964
3127
|
function refreshItemRuleQuantityLimits() {
|
|
2965
3128
|
return _refreshItemRuleQuantityLimits.apply(this, arguments);
|
|
@@ -2969,32 +3132,32 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2969
3132
|
}, {
|
|
2970
3133
|
key: "applyPrefillByItemRule",
|
|
2971
3134
|
value: function () {
|
|
2972
|
-
var _applyPrefillByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2973
|
-
var strategyConfigs, businessData, prefillItems, productSourceMap, tempOrder, hasChanges,
|
|
2974
|
-
return _regeneratorRuntime().wrap(function
|
|
2975
|
-
while (1) switch (
|
|
3135
|
+
var _applyPrefillByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38() {
|
|
3136
|
+
var strategyConfigs, businessData, prefillItems, productSourceMap, tempOrder, hasChanges, _iterator18, _step18, _prefillItem$product_, _targetProduct$_origi, prefillItem, productId, productVariantId, targetQuantity, sourceItem, productIndex, _sourceItem$price, sellingPrice, targetProduct, existedQuantity, delta, nextProduct;
|
|
3137
|
+
return _regeneratorRuntime().wrap(function _callee38$(_context38) {
|
|
3138
|
+
while (1) switch (_context38.prev = _context38.next) {
|
|
2976
3139
|
case 0:
|
|
2977
3140
|
if (!this.itemRulePrefillApplied) {
|
|
2978
|
-
|
|
3141
|
+
_context38.next = 2;
|
|
2979
3142
|
break;
|
|
2980
3143
|
}
|
|
2981
|
-
return
|
|
3144
|
+
return _context38.abrupt("return");
|
|
2982
3145
|
case 2:
|
|
2983
3146
|
if (this.store.order) {
|
|
2984
|
-
|
|
3147
|
+
_context38.next = 4;
|
|
2985
3148
|
break;
|
|
2986
3149
|
}
|
|
2987
|
-
return
|
|
3150
|
+
return _context38.abrupt("return");
|
|
2988
3151
|
case 4:
|
|
2989
|
-
|
|
3152
|
+
_context38.next = 6;
|
|
2990
3153
|
return this.ensureItemRuleConfigsLoaded();
|
|
2991
3154
|
case 6:
|
|
2992
|
-
strategyConfigs =
|
|
3155
|
+
strategyConfigs = _context38.sent;
|
|
2993
3156
|
if (strategyConfigs.length) {
|
|
2994
|
-
|
|
3157
|
+
_context38.next = 9;
|
|
2995
3158
|
break;
|
|
2996
3159
|
}
|
|
2997
|
-
return
|
|
3160
|
+
return _context38.abrupt("return");
|
|
2998
3161
|
case 9:
|
|
2999
3162
|
businessData = buildItemRuleBusinessData({
|
|
3000
3163
|
tempOrder: this.ensureTempOrder(),
|
|
@@ -3003,41 +3166,41 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3003
3166
|
});
|
|
3004
3167
|
prefillItems = this.itemRuleEvaluator.getPrefillItems(businessData);
|
|
3005
3168
|
if (prefillItems.length) {
|
|
3006
|
-
|
|
3169
|
+
_context38.next = 14;
|
|
3007
3170
|
break;
|
|
3008
3171
|
}
|
|
3009
3172
|
this.itemRulePrefillApplied = true;
|
|
3010
|
-
return
|
|
3173
|
+
return _context38.abrupt("return");
|
|
3011
3174
|
case 14:
|
|
3012
|
-
|
|
3175
|
+
_context38.next = 16;
|
|
3013
3176
|
return this.buildPrefillProductSourceMap();
|
|
3014
3177
|
case 16:
|
|
3015
|
-
productSourceMap =
|
|
3178
|
+
productSourceMap = _context38.sent;
|
|
3016
3179
|
tempOrder = this.ensureTempOrder();
|
|
3017
3180
|
hasChanges = false;
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
|
|
3181
|
+
_iterator18 = _createForOfIteratorHelper(prefillItems);
|
|
3182
|
+
_context38.prev = 20;
|
|
3183
|
+
_iterator18.s();
|
|
3021
3184
|
case 22:
|
|
3022
|
-
if ((
|
|
3023
|
-
|
|
3185
|
+
if ((_step18 = _iterator18.n()).done) {
|
|
3186
|
+
_context38.next = 45;
|
|
3024
3187
|
break;
|
|
3025
3188
|
}
|
|
3026
|
-
prefillItem =
|
|
3189
|
+
prefillItem = _step18.value;
|
|
3027
3190
|
productId = Number(prefillItem.product_id);
|
|
3028
3191
|
productVariantId = Number((_prefillItem$product_ = prefillItem.product_variant_id) !== null && _prefillItem$product_ !== void 0 ? _prefillItem$product_ : 0);
|
|
3029
3192
|
targetQuantity = toNonNegativeInt(prefillItem.quantity);
|
|
3030
3193
|
if (!(!Number.isFinite(productId) || targetQuantity <= 0)) {
|
|
3031
|
-
|
|
3194
|
+
_context38.next = 29;
|
|
3032
3195
|
break;
|
|
3033
3196
|
}
|
|
3034
|
-
return
|
|
3197
|
+
return _context38.abrupt("continue", 43);
|
|
3035
3198
|
case 29:
|
|
3036
3199
|
if (!Number.isNaN(productVariantId)) {
|
|
3037
|
-
|
|
3200
|
+
_context38.next = 31;
|
|
3038
3201
|
break;
|
|
3039
3202
|
}
|
|
3040
|
-
return
|
|
3203
|
+
return _context38.abrupt("continue", 43);
|
|
3041
3204
|
case 31:
|
|
3042
3205
|
sourceItem = productSourceMap.get(buildProductKey(productId, productVariantId)) || productSourceMap.get(buildProductKey(productId, 0)) || null;
|
|
3043
3206
|
productIndex = getProductIdentityIndex(tempOrder.products, {
|
|
@@ -3045,7 +3208,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3045
3208
|
product_variant_id: productVariantId
|
|
3046
3209
|
});
|
|
3047
3210
|
if (!(productIndex === -1)) {
|
|
3048
|
-
|
|
3211
|
+
_context38.next = 38;
|
|
3049
3212
|
break;
|
|
3050
3213
|
}
|
|
3051
3214
|
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');
|
|
@@ -3065,7 +3228,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3065
3228
|
})
|
|
3066
3229
|
}));
|
|
3067
3230
|
hasChanges = true;
|
|
3068
|
-
return
|
|
3231
|
+
return _context38.abrupt("continue", 43);
|
|
3069
3232
|
case 38:
|
|
3070
3233
|
targetProduct = tempOrder.products[productIndex];
|
|
3071
3234
|
existedQuantity = toNonNegativeInt(targetProduct.num);
|
|
@@ -3084,34 +3247,34 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3084
3247
|
hasChanges = true;
|
|
3085
3248
|
}
|
|
3086
3249
|
case 43:
|
|
3087
|
-
|
|
3250
|
+
_context38.next = 22;
|
|
3088
3251
|
break;
|
|
3089
3252
|
case 45:
|
|
3090
|
-
|
|
3253
|
+
_context38.next = 50;
|
|
3091
3254
|
break;
|
|
3092
3255
|
case 47:
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3256
|
+
_context38.prev = 47;
|
|
3257
|
+
_context38.t0 = _context38["catch"](20);
|
|
3258
|
+
_iterator18.e(_context38.t0);
|
|
3096
3259
|
case 50:
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
return
|
|
3260
|
+
_context38.prev = 50;
|
|
3261
|
+
_iterator18.f();
|
|
3262
|
+
return _context38.finish(50);
|
|
3100
3263
|
case 53:
|
|
3101
3264
|
if (!hasChanges) {
|
|
3102
|
-
|
|
3265
|
+
_context38.next = 58;
|
|
3103
3266
|
break;
|
|
3104
3267
|
}
|
|
3105
3268
|
// Prefill 属于 products CRUD 的一种形式:新增后让 Rules 重算,以支持自动应用可用优惠券。
|
|
3106
3269
|
this.store.order.applyDiscount();
|
|
3107
|
-
|
|
3270
|
+
_context38.next = 57;
|
|
3108
3271
|
return this.store.order.recalculateSummary({
|
|
3109
3272
|
createIfMissing: true
|
|
3110
3273
|
});
|
|
3111
3274
|
case 57:
|
|
3112
3275
|
this.store.order.persistTempOrder();
|
|
3113
3276
|
case 58:
|
|
3114
|
-
|
|
3277
|
+
_context38.next = 60;
|
|
3115
3278
|
return this.refreshItemRuleQuantityLimits();
|
|
3116
3279
|
case 60:
|
|
3117
3280
|
this.itemRulePrefillApplied = true;
|
|
@@ -3121,9 +3284,9 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3121
3284
|
});
|
|
3122
3285
|
case 62:
|
|
3123
3286
|
case "end":
|
|
3124
|
-
return
|
|
3287
|
+
return _context38.stop();
|
|
3125
3288
|
}
|
|
3126
|
-
},
|
|
3289
|
+
}, _callee38, this, [[20, 47, 50, 53]]);
|
|
3127
3290
|
}));
|
|
3128
3291
|
function applyPrefillByItemRule() {
|
|
3129
3292
|
return _applyPrefillByItemRule.apply(this, arguments);
|
|
@@ -3133,24 +3296,24 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3133
3296
|
}, {
|
|
3134
3297
|
key: "applyItemRulePrefill",
|
|
3135
3298
|
value: function () {
|
|
3136
|
-
var _applyItemRulePrefill = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3137
|
-
return _regeneratorRuntime().wrap(function
|
|
3138
|
-
while (1) switch (
|
|
3299
|
+
var _applyItemRulePrefill = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39() {
|
|
3300
|
+
return _regeneratorRuntime().wrap(function _callee39$(_context39) {
|
|
3301
|
+
while (1) switch (_context39.prev = _context39.next) {
|
|
3139
3302
|
case 0:
|
|
3140
3303
|
this.logMethodStart('applyItemRulePrefill');
|
|
3141
|
-
|
|
3304
|
+
_context39.next = 3;
|
|
3142
3305
|
return this.applyPrefillByItemRule();
|
|
3143
3306
|
case 3:
|
|
3144
|
-
|
|
3307
|
+
_context39.next = 5;
|
|
3145
3308
|
return this.refreshItemRuleQuantityLimits();
|
|
3146
3309
|
case 5:
|
|
3147
|
-
|
|
3310
|
+
_context39.next = 7;
|
|
3148
3311
|
return this.refreshCartValidationPassed();
|
|
3149
3312
|
case 7:
|
|
3150
3313
|
case "end":
|
|
3151
|
-
return
|
|
3314
|
+
return _context39.stop();
|
|
3152
3315
|
}
|
|
3153
|
-
},
|
|
3316
|
+
}, _callee39, this);
|
|
3154
3317
|
}));
|
|
3155
3318
|
function applyItemRulePrefill() {
|
|
3156
3319
|
return _applyItemRulePrefill.apply(this, arguments);
|
|
@@ -3160,20 +3323,20 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3160
3323
|
}, {
|
|
3161
3324
|
key: "evaluateCartValidationByItemRule",
|
|
3162
3325
|
value: function () {
|
|
3163
|
-
var _evaluateCartValidationByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3326
|
+
var _evaluateCartValidationByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40() {
|
|
3164
3327
|
var strategyConfigs, businessData;
|
|
3165
|
-
return _regeneratorRuntime().wrap(function
|
|
3166
|
-
while (1) switch (
|
|
3328
|
+
return _regeneratorRuntime().wrap(function _callee40$(_context40) {
|
|
3329
|
+
while (1) switch (_context40.prev = _context40.next) {
|
|
3167
3330
|
case 0:
|
|
3168
|
-
|
|
3331
|
+
_context40.next = 2;
|
|
3169
3332
|
return this.ensureItemRuleConfigsLoaded();
|
|
3170
3333
|
case 2:
|
|
3171
|
-
strategyConfigs =
|
|
3334
|
+
strategyConfigs = _context40.sent;
|
|
3172
3335
|
if (strategyConfigs.length) {
|
|
3173
|
-
|
|
3336
|
+
_context40.next = 5;
|
|
3174
3337
|
break;
|
|
3175
3338
|
}
|
|
3176
|
-
return
|
|
3339
|
+
return _context40.abrupt("return", {
|
|
3177
3340
|
passed: true,
|
|
3178
3341
|
failures: []
|
|
3179
3342
|
});
|
|
@@ -3183,12 +3346,12 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3183
3346
|
runtimeConfig: this.getItemRuleRuntimeConfig(),
|
|
3184
3347
|
itemRuleConfigs: this.itemRuleConfigs
|
|
3185
3348
|
});
|
|
3186
|
-
return
|
|
3349
|
+
return _context40.abrupt("return", this.itemRuleEvaluator.validateCart(businessData));
|
|
3187
3350
|
case 7:
|
|
3188
3351
|
case "end":
|
|
3189
|
-
return
|
|
3352
|
+
return _context40.stop();
|
|
3190
3353
|
}
|
|
3191
|
-
},
|
|
3354
|
+
}, _callee40, this);
|
|
3192
3355
|
}));
|
|
3193
3356
|
function evaluateCartValidationByItemRule() {
|
|
3194
3357
|
return _evaluateCartValidationByItemRule.apply(this, arguments);
|
|
@@ -3198,20 +3361,20 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3198
3361
|
}, {
|
|
3199
3362
|
key: "validateBeforeSubmitByItemRule",
|
|
3200
3363
|
value: function () {
|
|
3201
|
-
var _validateBeforeSubmitByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3364
|
+
var _validateBeforeSubmitByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41() {
|
|
3202
3365
|
var validationResult, firstFailure, errorMessage, error;
|
|
3203
|
-
return _regeneratorRuntime().wrap(function
|
|
3204
|
-
while (1) switch (
|
|
3366
|
+
return _regeneratorRuntime().wrap(function _callee41$(_context41) {
|
|
3367
|
+
while (1) switch (_context41.prev = _context41.next) {
|
|
3205
3368
|
case 0:
|
|
3206
|
-
|
|
3369
|
+
_context41.next = 2;
|
|
3207
3370
|
return this.evaluateCartValidationByItemRule();
|
|
3208
3371
|
case 2:
|
|
3209
|
-
validationResult =
|
|
3372
|
+
validationResult = _context41.sent;
|
|
3210
3373
|
if (!validationResult.passed) {
|
|
3211
|
-
|
|
3374
|
+
_context41.next = 5;
|
|
3212
3375
|
break;
|
|
3213
3376
|
}
|
|
3214
|
-
return
|
|
3377
|
+
return _context41.abrupt("return");
|
|
3215
3378
|
case 5:
|
|
3216
3379
|
firstFailure = validationResult.failures[0];
|
|
3217
3380
|
errorMessage = (firstFailure === null || firstFailure === void 0 ? void 0 : firstFailure.validationMessage) || '当前购物车未满足商品规则,请调整后再提交';
|
|
@@ -3220,9 +3383,9 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3220
3383
|
throw error;
|
|
3221
3384
|
case 10:
|
|
3222
3385
|
case "end":
|
|
3223
|
-
return
|
|
3386
|
+
return _context41.stop();
|
|
3224
3387
|
}
|
|
3225
|
-
},
|
|
3388
|
+
}, _callee41, this);
|
|
3226
3389
|
}));
|
|
3227
3390
|
function validateBeforeSubmitByItemRule() {
|
|
3228
3391
|
return _validateBeforeSubmitByItemRule.apply(this, arguments);
|
|
@@ -3232,10 +3395,10 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3232
3395
|
}, {
|
|
3233
3396
|
key: "refreshCartValidationPassed",
|
|
3234
3397
|
value: function () {
|
|
3235
|
-
var _refreshCartValidationPassed = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3398
|
+
var _refreshCartValidationPassed = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42() {
|
|
3236
3399
|
var previous, nextState, validationResult, changed;
|
|
3237
|
-
return _regeneratorRuntime().wrap(function
|
|
3238
|
-
while (1) switch (
|
|
3400
|
+
return _regeneratorRuntime().wrap(function _callee42$(_context42) {
|
|
3401
|
+
while (1) switch (_context42.prev = _context42.next) {
|
|
3239
3402
|
case 0:
|
|
3240
3403
|
previous = this.store.cartValidation || {
|
|
3241
3404
|
passed: null,
|
|
@@ -3245,20 +3408,20 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3245
3408
|
passed: null,
|
|
3246
3409
|
failures: []
|
|
3247
3410
|
};
|
|
3248
|
-
|
|
3249
|
-
|
|
3411
|
+
_context42.prev = 2;
|
|
3412
|
+
_context42.next = 5;
|
|
3250
3413
|
return this.evaluateCartValidationByItemRule();
|
|
3251
3414
|
case 5:
|
|
3252
|
-
validationResult =
|
|
3415
|
+
validationResult = _context42.sent;
|
|
3253
3416
|
nextState = {
|
|
3254
3417
|
passed: validationResult.passed,
|
|
3255
3418
|
failures: validationResult.failures || []
|
|
3256
3419
|
};
|
|
3257
|
-
|
|
3420
|
+
_context42.next = 12;
|
|
3258
3421
|
break;
|
|
3259
3422
|
case 9:
|
|
3260
|
-
|
|
3261
|
-
|
|
3423
|
+
_context42.prev = 9;
|
|
3424
|
+
_context42.t0 = _context42["catch"](2);
|
|
3262
3425
|
nextState = {
|
|
3263
3426
|
passed: false,
|
|
3264
3427
|
failures: []
|
|
@@ -3267,21 +3430,21 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3267
3430
|
this.store.cartValidation = nextState;
|
|
3268
3431
|
changed = previous.passed !== nextState.passed || previous.failures !== nextState.failures;
|
|
3269
3432
|
if (!changed) {
|
|
3270
|
-
|
|
3433
|
+
_context42.next = 17;
|
|
3271
3434
|
break;
|
|
3272
3435
|
}
|
|
3273
|
-
|
|
3436
|
+
_context42.next = 17;
|
|
3274
3437
|
return this.core.effects.emit(VenueBookingHooks.onCartValidationChanged, {
|
|
3275
3438
|
cartValidation: nextState,
|
|
3276
3439
|
cartValidationPassed: nextState.passed
|
|
3277
3440
|
});
|
|
3278
3441
|
case 17:
|
|
3279
|
-
return
|
|
3442
|
+
return _context42.abrupt("return", nextState.passed);
|
|
3280
3443
|
case 18:
|
|
3281
3444
|
case "end":
|
|
3282
|
-
return
|
|
3445
|
+
return _context42.stop();
|
|
3283
3446
|
}
|
|
3284
|
-
},
|
|
3447
|
+
}, _callee42, this, [[2, 9]]);
|
|
3285
3448
|
}));
|
|
3286
3449
|
function refreshCartValidationPassed() {
|
|
3287
3450
|
return _refreshCartValidationPassed.apply(this, arguments);
|
|
@@ -3291,14 +3454,14 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3291
3454
|
}, {
|
|
3292
3455
|
key: "setItemRuleRuntimeConfig",
|
|
3293
3456
|
value: function () {
|
|
3294
|
-
var _setItemRuleRuntimeConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3457
|
+
var _setItemRuleRuntimeConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43() {
|
|
3295
3458
|
var _this$itemRuleRuntime, _this$itemRuleRuntime2;
|
|
3296
3459
|
var config,
|
|
3297
|
-
|
|
3298
|
-
return _regeneratorRuntime().wrap(function
|
|
3299
|
-
while (1) switch (
|
|
3460
|
+
_args43 = arguments;
|
|
3461
|
+
return _regeneratorRuntime().wrap(function _callee43$(_context43) {
|
|
3462
|
+
while (1) switch (_context43.prev = _context43.next) {
|
|
3300
3463
|
case 0:
|
|
3301
|
-
config =
|
|
3464
|
+
config = _args43.length > 0 && _args43[0] !== undefined ? _args43[0] : {};
|
|
3302
3465
|
this.logMethodStart('setItemRuleRuntimeConfig');
|
|
3303
3466
|
this.itemRuleRuntimeConfig = _objectSpread(_objectSpread(_objectSpread({}, this.itemRuleRuntimeConfig), config), {}, {
|
|
3304
3467
|
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) || {}),
|
|
@@ -3310,10 +3473,10 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3310
3473
|
this.itemRuleEvaluator.setStrategyConfigs([]);
|
|
3311
3474
|
}
|
|
3312
3475
|
this.itemRulePrefillApplied = false;
|
|
3313
|
-
|
|
3476
|
+
_context43.next = 7;
|
|
3314
3477
|
return this.refreshItemRuleQuantityLimits();
|
|
3315
3478
|
case 7:
|
|
3316
|
-
|
|
3479
|
+
_context43.next = 9;
|
|
3317
3480
|
return this.refreshCartValidationPassed();
|
|
3318
3481
|
case 9:
|
|
3319
3482
|
this.logMethodSuccess('setItemRuleRuntimeConfig', {
|
|
@@ -3321,9 +3484,9 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3321
3484
|
});
|
|
3322
3485
|
case 10:
|
|
3323
3486
|
case "end":
|
|
3324
|
-
return
|
|
3487
|
+
return _context43.stop();
|
|
3325
3488
|
}
|
|
3326
|
-
},
|
|
3489
|
+
}, _callee43, this);
|
|
3327
3490
|
}));
|
|
3328
3491
|
function setItemRuleRuntimeConfig() {
|
|
3329
3492
|
return _setItemRuleRuntimeConfig.apply(this, arguments);
|
|
@@ -3350,23 +3513,23 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3350
3513
|
}, {
|
|
3351
3514
|
key: "readUIStateBucket",
|
|
3352
3515
|
value: function readUIStateBucket() {
|
|
3353
|
-
var _this$
|
|
3516
|
+
var _this$window2;
|
|
3354
3517
|
var key = this.getUIStateBucketKey();
|
|
3355
|
-
if (!key || !((_this$
|
|
3518
|
+
if (!key || !((_this$window2 = this.window) !== null && _this$window2 !== void 0 && _this$window2.sessionStorage)) return {};
|
|
3356
3519
|
try {
|
|
3357
3520
|
var raw = this.window.sessionStorage.getItem(key) || '{}';
|
|
3358
3521
|
var parsed = JSON.parse(raw);
|
|
3359
3522
|
return parsed && _typeof(parsed) === 'object' ? parsed : {};
|
|
3360
|
-
} catch (
|
|
3523
|
+
} catch (_unused4) {
|
|
3361
3524
|
return {};
|
|
3362
3525
|
}
|
|
3363
3526
|
}
|
|
3364
3527
|
}, {
|
|
3365
3528
|
key: "writeUIStateBucket",
|
|
3366
3529
|
value: function writeUIStateBucket(bucket) {
|
|
3367
|
-
var _this$
|
|
3530
|
+
var _this$window3;
|
|
3368
3531
|
var key = this.getUIStateBucketKey();
|
|
3369
|
-
if (!key || !((_this$
|
|
3532
|
+
if (!key || !((_this$window3 = this.window) !== null && _this$window3 !== void 0 && _this$window3.sessionStorage)) return;
|
|
3370
3533
|
this.window.sessionStorage.setItem(key, JSON.stringify(bucket));
|
|
3371
3534
|
}
|
|
3372
3535
|
}, {
|
|
@@ -3394,30 +3557,82 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3394
3557
|
this.writeUIStateBucket(bucket);
|
|
3395
3558
|
}
|
|
3396
3559
|
}
|
|
3560
|
+
}, {
|
|
3561
|
+
key: "setBookingHolder",
|
|
3562
|
+
value: function setBookingHolder(bookingUid, holder) {
|
|
3563
|
+
var _tempOrder$bookings4;
|
|
3564
|
+
if (!this.store.order) return;
|
|
3565
|
+
var tempOrder = this.store.order.ensureTempOrder();
|
|
3566
|
+
var booking = (_tempOrder$bookings4 = tempOrder.bookings) === null || _tempOrder$bookings4 === void 0 ? void 0 : _tempOrder$bookings4.find(function (b) {
|
|
3567
|
+
var _b$metadata4;
|
|
3568
|
+
return ((_b$metadata4 = b.metadata) === null || _b$metadata4 === void 0 ? void 0 : _b$metadata4.unique_identification_number) === bookingUid;
|
|
3569
|
+
});
|
|
3570
|
+
if (booking) {
|
|
3571
|
+
booking.holder = holder;
|
|
3572
|
+
}
|
|
3573
|
+
var _iterator19 = _createForOfIteratorHelper(tempOrder.products),
|
|
3574
|
+
_step19;
|
|
3575
|
+
try {
|
|
3576
|
+
for (_iterator19.s(); !(_step19 = _iterator19.n()).done;) {
|
|
3577
|
+
var _product$metadata$boo, _product$metadata8, _product$_origin2;
|
|
3578
|
+
var product = _step19.value;
|
|
3579
|
+
var productBookingUid = (_product$metadata$boo = (_product$metadata8 = product.metadata) === null || _product$metadata8 === void 0 ? void 0 : _product$metadata8.booking_uid) !== null && _product$metadata$boo !== void 0 ? _product$metadata$boo : (_product$_origin2 = product._origin) === null || _product$_origin2 === void 0 || (_product$_origin2 = _product$_origin2.product) === null || _product$_origin2 === void 0 ? void 0 : _product$_origin2.bookingUuid;
|
|
3580
|
+
if (String(productBookingUid) !== String(bookingUid)) continue;
|
|
3581
|
+
var origin = product._origin && _typeof(product._origin) === 'object' ? product._origin : {};
|
|
3582
|
+
origin.holder = holder;
|
|
3583
|
+
product._origin = origin;
|
|
3584
|
+
}
|
|
3585
|
+
} catch (err) {
|
|
3586
|
+
_iterator19.e(err);
|
|
3587
|
+
} finally {
|
|
3588
|
+
_iterator19.f();
|
|
3589
|
+
}
|
|
3590
|
+
this.store.order.notifyTempOrderChanged();
|
|
3591
|
+
}
|
|
3592
|
+
|
|
3593
|
+
/**
|
|
3594
|
+
* 获取 holder 表单 map
|
|
3595
|
+
*/
|
|
3596
|
+
}, {
|
|
3597
|
+
key: "getHolderFormMap",
|
|
3598
|
+
value: function getHolderFormMap() {
|
|
3599
|
+
if (!this.store.holder) throw new Error('[VenueBooking] holder 模块未初始化');
|
|
3600
|
+
return this.store.holder.getHolderFormMap();
|
|
3601
|
+
}
|
|
3602
|
+
|
|
3603
|
+
/**
|
|
3604
|
+
* 添加表单记录
|
|
3605
|
+
*/
|
|
3606
|
+
}, {
|
|
3607
|
+
key: "appendFormRecord",
|
|
3608
|
+
value: function appendFormRecord(params) {
|
|
3609
|
+
if (!this.store.holder) throw new Error('[VenueBooking] holder 模块未初始化');
|
|
3610
|
+
return this.store.holder.appendFormRecord(params);
|
|
3611
|
+
}
|
|
3397
3612
|
|
|
3398
3613
|
// ─── OpenData 可用性 ───
|
|
3399
3614
|
}, {
|
|
3400
3615
|
key: "checkOpenDataAvailability",
|
|
3401
3616
|
value: function () {
|
|
3402
|
-
var _checkOpenDataAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3403
|
-
return _regeneratorRuntime().wrap(function
|
|
3404
|
-
while (1) switch (
|
|
3617
|
+
var _checkOpenDataAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44() {
|
|
3618
|
+
return _regeneratorRuntime().wrap(function _callee44$(_context44) {
|
|
3619
|
+
while (1) switch (_context44.prev = _context44.next) {
|
|
3405
3620
|
case 0:
|
|
3406
3621
|
if (this.store.openData) {
|
|
3407
|
-
|
|
3622
|
+
_context44.next = 2;
|
|
3408
3623
|
break;
|
|
3409
3624
|
}
|
|
3410
3625
|
throw new Error('openData 模块未初始化');
|
|
3411
3626
|
case 2:
|
|
3412
|
-
|
|
3627
|
+
_context44.next = 4;
|
|
3413
3628
|
return this.loadOpenDataConfig();
|
|
3414
3629
|
case 4:
|
|
3415
|
-
return
|
|
3630
|
+
return _context44.abrupt("return", this.store.openData.checkAvailability(this.store.schedule));
|
|
3416
3631
|
case 5:
|
|
3417
3632
|
case "end":
|
|
3418
|
-
return
|
|
3633
|
+
return _context44.stop();
|
|
3419
3634
|
}
|
|
3420
|
-
},
|
|
3635
|
+
}, _callee44, this);
|
|
3421
3636
|
}));
|
|
3422
3637
|
function checkOpenDataAvailability() {
|
|
3423
3638
|
return _checkOpenDataAvailability.apply(this, arguments);
|
|
@@ -3427,15 +3642,15 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3427
3642
|
}, {
|
|
3428
3643
|
key: "setOtherParams",
|
|
3429
3644
|
value: function () {
|
|
3430
|
-
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3645
|
+
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45(params) {
|
|
3431
3646
|
var _ref5,
|
|
3432
3647
|
_ref5$cover,
|
|
3433
3648
|
cover,
|
|
3434
|
-
|
|
3435
|
-
return _regeneratorRuntime().wrap(function
|
|
3436
|
-
while (1) switch (
|
|
3649
|
+
_args45 = arguments;
|
|
3650
|
+
return _regeneratorRuntime().wrap(function _callee45$(_context45) {
|
|
3651
|
+
while (1) switch (_context45.prev = _context45.next) {
|
|
3437
3652
|
case 0:
|
|
3438
|
-
_ref5 =
|
|
3653
|
+
_ref5 = _args45.length > 1 && _args45[1] !== undefined ? _args45[1] : {}, _ref5$cover = _ref5.cover, cover = _ref5$cover === void 0 ? false : _ref5$cover;
|
|
3439
3654
|
if (cover) {
|
|
3440
3655
|
this.otherParams = params;
|
|
3441
3656
|
} else {
|
|
@@ -3443,11 +3658,11 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3443
3658
|
}
|
|
3444
3659
|
case 2:
|
|
3445
3660
|
case "end":
|
|
3446
|
-
return
|
|
3661
|
+
return _context45.stop();
|
|
3447
3662
|
}
|
|
3448
|
-
},
|
|
3663
|
+
}, _callee45, this);
|
|
3449
3664
|
}));
|
|
3450
|
-
function setOtherParams(
|
|
3665
|
+
function setOtherParams(_x22) {
|
|
3451
3666
|
return _setOtherParams.apply(this, arguments);
|
|
3452
3667
|
}
|
|
3453
3668
|
return setOtherParams;
|