@pisell/pisellos 0.0.551 → 0.0.552
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/model/strategy/adapter/promotion/index.js +0 -9
- package/dist/modules/Holder/index.d.ts +7 -1
- package/dist/modules/Holder/index.js +153 -14
- package/dist/modules/Holder/types.d.ts +9 -1
- package/dist/modules/Holder/utils.d.ts +7 -3
- package/dist/modules/Holder/utils.js +16 -2
- package/dist/modules/Order/index.d.ts +1 -1
- package/dist/modules/Order/index.js +5 -1
- package/dist/modules/Order/utils.d.ts +2 -1
- package/dist/modules/Order/utils.js +21 -17
- package/dist/solution/BookingByStep/index.d.ts +8 -2
- package/dist/solution/BookingByStep/index.js +251 -212
- package/dist/solution/ScanOrder/types.d.ts +1 -0
- package/dist/solution/VenueBooking/index.d.ts +5 -2
- package/dist/solution/VenueBooking/index.js +684 -656
- package/lib/modules/Holder/index.d.ts +7 -1
- package/lib/modules/Holder/index.js +75 -3
- package/lib/modules/Holder/types.d.ts +9 -1
- package/lib/modules/Holder/utils.d.ts +7 -3
- package/lib/modules/Holder/utils.js +18 -4
- package/lib/modules/Order/index.d.ts +1 -1
- package/lib/modules/Order/index.js +4 -1
- package/lib/modules/Order/utils.d.ts +2 -1
- package/lib/modules/Order/utils.js +11 -7
- package/lib/solution/BookingByStep/index.d.ts +8 -2
- package/lib/solution/BookingByStep/index.js +22 -10
- package/lib/solution/ScanOrder/types.d.ts +1 -0
- package/lib/solution/VenueBooking/index.d.ts +5 -2
- package/lib/solution/VenueBooking/index.js +37 -16
- package/package.json +1 -1
|
@@ -298,32 +298,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
298
298
|
if (customer !== null && customer !== void 0 && customer.id) return Number(customer.id);
|
|
299
299
|
return undefined;
|
|
300
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
|
-
}()
|
|
301
|
+
|
|
327
302
|
/**
|
|
328
303
|
* 按商品 holder_config 预加载表单数据到 holderMap。
|
|
329
304
|
* appointment_booking 在加购时触发;venueBooking 在商品加载后预加载,避免 getHolderFormMap 为空。
|
|
@@ -331,81 +306,81 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
331
306
|
}, {
|
|
332
307
|
key: "preloadHolderForms",
|
|
333
308
|
value: (function () {
|
|
334
|
-
var _preloadHolderForms = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
335
|
-
var seenFormIds, _iterator, _step,
|
|
336
|
-
return _regeneratorRuntime().wrap(function
|
|
337
|
-
while (1) switch (
|
|
309
|
+
var _preloadHolderForms = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(products) {
|
|
310
|
+
var seenFormIds, _iterator, _step, _item$_origin, item, holderConfig, formId, _item$_origin2, _item$_origin3;
|
|
311
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
312
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
338
313
|
case 0:
|
|
339
314
|
if (!(!this.store.holder || !products.length)) {
|
|
340
|
-
|
|
315
|
+
_context3.next = 2;
|
|
341
316
|
break;
|
|
342
317
|
}
|
|
343
|
-
return
|
|
318
|
+
return _context3.abrupt("return");
|
|
344
319
|
case 2:
|
|
345
320
|
seenFormIds = new Set();
|
|
346
321
|
_iterator = _createForOfIteratorHelper(products);
|
|
347
|
-
|
|
322
|
+
_context3.prev = 4;
|
|
348
323
|
_iterator.s();
|
|
349
324
|
case 6:
|
|
350
325
|
if ((_step = _iterator.n()).done) {
|
|
351
|
-
|
|
326
|
+
_context3.next = 25;
|
|
352
327
|
break;
|
|
353
328
|
}
|
|
354
|
-
|
|
355
|
-
holderConfig = getProductHolderConfig(product);
|
|
329
|
+
item = _step.value;
|
|
330
|
+
holderConfig = getProductHolderConfig(item === null || item === void 0 || (_item$_origin = item._origin) === null || _item$_origin === void 0 ? void 0 : _item$_origin.product);
|
|
356
331
|
if (holderConfig) {
|
|
357
|
-
|
|
332
|
+
_context3.next = 11;
|
|
358
333
|
break;
|
|
359
334
|
}
|
|
360
|
-
return
|
|
335
|
+
return _context3.abrupt("continue", 23);
|
|
361
336
|
case 11:
|
|
362
337
|
formId = getFormIdFromHolderConfig(holderConfig);
|
|
363
338
|
if (!seenFormIds.has(formId)) {
|
|
364
|
-
|
|
339
|
+
_context3.next = 14;
|
|
365
340
|
break;
|
|
366
341
|
}
|
|
367
|
-
return
|
|
342
|
+
return _context3.abrupt("continue", 23);
|
|
368
343
|
case 14:
|
|
369
344
|
seenFormIds.add(formId);
|
|
370
|
-
|
|
371
|
-
|
|
345
|
+
_context3.prev = 15;
|
|
346
|
+
_context3.next = 18;
|
|
372
347
|
return this.store.holder.ensureFormByProduct({
|
|
373
|
-
product: product,
|
|
348
|
+
product: (item === null || item === void 0 || (_item$_origin2 = item._origin) === null || _item$_origin2 === void 0 ? void 0 : _item$_origin2.product) || {},
|
|
374
349
|
customer_id: this.resolveHolderCustomerId(),
|
|
375
|
-
shop_id: product.shop_id,
|
|
350
|
+
shop_id: item === null || item === void 0 || (_item$_origin3 = item._origin) === null || _item$_origin3 === void 0 || (_item$_origin3 = _item$_origin3.product) === null || _item$_origin3 === void 0 ? void 0 : _item$_origin3.shop_id,
|
|
376
351
|
useCache: true
|
|
377
352
|
});
|
|
378
353
|
case 18:
|
|
379
|
-
|
|
354
|
+
_context3.next = 23;
|
|
380
355
|
break;
|
|
381
356
|
case 20:
|
|
382
|
-
|
|
383
|
-
|
|
357
|
+
_context3.prev = 20;
|
|
358
|
+
_context3.t0 = _context3["catch"](15);
|
|
384
359
|
console.error('[VenueBooking] 预加载 holder 表单失败', {
|
|
385
360
|
formId: formId,
|
|
386
|
-
error:
|
|
361
|
+
error: _context3.t0
|
|
387
362
|
});
|
|
388
363
|
case 23:
|
|
389
|
-
|
|
364
|
+
_context3.next = 6;
|
|
390
365
|
break;
|
|
391
366
|
case 25:
|
|
392
|
-
|
|
367
|
+
_context3.next = 30;
|
|
393
368
|
break;
|
|
394
369
|
case 27:
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
_iterator.e(
|
|
370
|
+
_context3.prev = 27;
|
|
371
|
+
_context3.t1 = _context3["catch"](4);
|
|
372
|
+
_iterator.e(_context3.t1);
|
|
398
373
|
case 30:
|
|
399
|
-
|
|
374
|
+
_context3.prev = 30;
|
|
400
375
|
_iterator.f();
|
|
401
|
-
return
|
|
376
|
+
return _context3.finish(30);
|
|
402
377
|
case 33:
|
|
403
378
|
case "end":
|
|
404
|
-
return
|
|
379
|
+
return _context3.stop();
|
|
405
380
|
}
|
|
406
|
-
},
|
|
381
|
+
}, _callee3, this, [[4, 27, 30, 33], [15, 20]]);
|
|
407
382
|
}));
|
|
408
|
-
function preloadHolderForms(
|
|
383
|
+
function preloadHolderForms(_x3) {
|
|
409
384
|
return _preloadHolderForms.apply(this, arguments);
|
|
410
385
|
}
|
|
411
386
|
return preloadHolderForms;
|
|
@@ -454,29 +429,29 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
454
429
|
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;
|
|
455
430
|
var createHandleLogin = function createHandleLogin(eventName) {
|
|
456
431
|
return /*#__PURE__*/function () {
|
|
457
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
432
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(payload) {
|
|
458
433
|
var customerId;
|
|
459
|
-
return _regeneratorRuntime().wrap(function
|
|
460
|
-
while (1) switch (
|
|
434
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
435
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
461
436
|
case 0:
|
|
462
437
|
customerId = _this2.resolveCustomerIdFromLoginPayload(payload);
|
|
463
438
|
if (customerId) {
|
|
464
|
-
|
|
439
|
+
_context4.next = 3;
|
|
465
440
|
break;
|
|
466
441
|
}
|
|
467
|
-
return
|
|
442
|
+
return _context4.abrupt("return");
|
|
468
443
|
case 3:
|
|
469
|
-
|
|
444
|
+
_context4.next = 5;
|
|
470
445
|
return _this2.refreshOrderMarketingAfterLogin({
|
|
471
446
|
customerId: customerId
|
|
472
447
|
});
|
|
473
448
|
case 5:
|
|
474
449
|
case "end":
|
|
475
|
-
return
|
|
450
|
+
return _context4.stop();
|
|
476
451
|
}
|
|
477
|
-
},
|
|
452
|
+
}, _callee4);
|
|
478
453
|
}));
|
|
479
|
-
return function (
|
|
454
|
+
return function (_x4) {
|
|
480
455
|
return _ref.apply(this, arguments);
|
|
481
456
|
};
|
|
482
457
|
}();
|
|
@@ -487,97 +462,107 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
487
462
|
}, {
|
|
488
463
|
key: "refreshOrderMarketingAfterLogin",
|
|
489
464
|
value: function () {
|
|
490
|
-
var _refreshOrderMarketingAfterLogin = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
465
|
+
var _refreshOrderMarketingAfterLogin = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(params) {
|
|
491
466
|
var _this3 = this;
|
|
492
467
|
var refreshTask;
|
|
493
|
-
return _regeneratorRuntime().wrap(function
|
|
494
|
-
while (1) switch (
|
|
468
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
469
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
495
470
|
case 0:
|
|
496
471
|
if (this.store.order) {
|
|
497
|
-
|
|
472
|
+
_context6.next = 2;
|
|
498
473
|
break;
|
|
499
474
|
}
|
|
500
475
|
throw new Error('order 模块未初始化');
|
|
501
476
|
case 2:
|
|
502
477
|
if (!this.customerLoginRefreshInFlight) {
|
|
503
|
-
|
|
478
|
+
_context6.next = 9;
|
|
504
479
|
break;
|
|
505
480
|
}
|
|
506
481
|
if (!(this.customerLoginRefreshIdInFlight === params.customerId)) {
|
|
507
|
-
|
|
482
|
+
_context6.next = 7;
|
|
508
483
|
break;
|
|
509
484
|
}
|
|
510
|
-
|
|
485
|
+
_context6.next = 6;
|
|
511
486
|
return this.customerLoginRefreshInFlight;
|
|
512
487
|
case 6:
|
|
513
|
-
return
|
|
488
|
+
return _context6.abrupt("return");
|
|
514
489
|
case 7:
|
|
515
|
-
|
|
490
|
+
_context6.next = 9;
|
|
516
491
|
return this.customerLoginRefreshInFlight;
|
|
517
492
|
case 9:
|
|
518
493
|
this.customerLoginRefreshIdInFlight = params.customerId;
|
|
519
|
-
refreshTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
494
|
+
refreshTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
520
495
|
var _this3$otherParams;
|
|
521
|
-
return _regeneratorRuntime().wrap(function
|
|
522
|
-
while (1) switch (
|
|
496
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
497
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
523
498
|
case 0:
|
|
499
|
+
if (!_this3.store.holder) {
|
|
500
|
+
_context5.next = 3;
|
|
501
|
+
break;
|
|
502
|
+
}
|
|
503
|
+
_context5.next = 3;
|
|
504
|
+
return _this3.store.holder.refreshAllFormRecords({
|
|
505
|
+
customer_id: params.customerId,
|
|
506
|
+
useCache: false
|
|
507
|
+
});
|
|
508
|
+
case 3:
|
|
524
509
|
if (!_this3.store.quotation) {
|
|
525
|
-
|
|
510
|
+
_context5.next = 6;
|
|
526
511
|
break;
|
|
527
512
|
}
|
|
528
|
-
|
|
513
|
+
_context5.next = 6;
|
|
529
514
|
return _this3.store.quotation.loadQuotations({
|
|
530
515
|
channel: (_this3$otherParams = _this3.otherParams) === null || _this3$otherParams === void 0 ? void 0 : _this3$otherParams.channel
|
|
531
516
|
});
|
|
532
|
-
case
|
|
517
|
+
case 6:
|
|
533
518
|
_this3.recalculateOrderPricesFromQuotation();
|
|
534
|
-
|
|
519
|
+
_context5.next = 9;
|
|
535
520
|
return _this3.store.order.loadDiscountConfig({
|
|
536
521
|
customerId: params.customerId
|
|
537
522
|
});
|
|
538
|
-
case
|
|
539
|
-
|
|
523
|
+
case 9:
|
|
524
|
+
_context5.next = 11;
|
|
540
525
|
return _this3.store.order.recalculateSummary({
|
|
541
526
|
createIfMissing: true
|
|
542
527
|
});
|
|
543
|
-
case
|
|
528
|
+
case 11:
|
|
544
529
|
_this3.store.order.persistTempOrder();
|
|
545
|
-
|
|
530
|
+
_context5.next = 14;
|
|
546
531
|
return _this3.refreshItemRuleQuantityLimits();
|
|
547
|
-
case
|
|
548
|
-
|
|
532
|
+
case 14:
|
|
533
|
+
_context5.next = 16;
|
|
549
534
|
return _this3.refreshCartValidationPassed();
|
|
550
|
-
case
|
|
535
|
+
case 16:
|
|
551
536
|
case "end":
|
|
552
|
-
return
|
|
537
|
+
return _context5.stop();
|
|
553
538
|
}
|
|
554
|
-
},
|
|
539
|
+
}, _callee5);
|
|
555
540
|
}))();
|
|
556
541
|
this.customerLoginRefreshInFlight = refreshTask;
|
|
557
|
-
|
|
558
|
-
|
|
542
|
+
_context6.prev = 12;
|
|
543
|
+
_context6.next = 15;
|
|
559
544
|
return refreshTask;
|
|
560
545
|
case 15:
|
|
561
|
-
|
|
546
|
+
_context6.next = 20;
|
|
562
547
|
break;
|
|
563
548
|
case 17:
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
throw
|
|
549
|
+
_context6.prev = 17;
|
|
550
|
+
_context6.t0 = _context6["catch"](12);
|
|
551
|
+
throw _context6.t0;
|
|
567
552
|
case 20:
|
|
568
|
-
|
|
553
|
+
_context6.prev = 20;
|
|
569
554
|
if (this.customerLoginRefreshInFlight === refreshTask) {
|
|
570
555
|
this.customerLoginRefreshInFlight = null;
|
|
571
556
|
this.customerLoginRefreshIdInFlight = null;
|
|
572
557
|
}
|
|
573
|
-
return
|
|
558
|
+
return _context6.finish(20);
|
|
574
559
|
case 23:
|
|
575
560
|
case "end":
|
|
576
|
-
return
|
|
561
|
+
return _context6.stop();
|
|
577
562
|
}
|
|
578
|
-
},
|
|
563
|
+
}, _callee6, this, [[12, 17, 20, 23]]);
|
|
579
564
|
}));
|
|
580
|
-
function refreshOrderMarketingAfterLogin(
|
|
565
|
+
function refreshOrderMarketingAfterLogin(_x5) {
|
|
581
566
|
return _refreshOrderMarketingAfterLogin.apply(this, arguments);
|
|
582
567
|
}
|
|
583
568
|
return refreshOrderMarketingAfterLogin;
|
|
@@ -585,7 +570,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
585
570
|
}, {
|
|
586
571
|
key: "initialize",
|
|
587
572
|
value: function () {
|
|
588
|
-
var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
573
|
+
var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(core) {
|
|
589
574
|
var _options$otherParams,
|
|
590
575
|
_options$otherParams2,
|
|
591
576
|
_this$otherParams,
|
|
@@ -614,11 +599,11 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
614
599
|
_this$store$order2,
|
|
615
600
|
_this$store$quotation,
|
|
616
601
|
_this$otherParams9,
|
|
617
|
-
|
|
618
|
-
return _regeneratorRuntime().wrap(function
|
|
619
|
-
while (1) switch (
|
|
602
|
+
_args7 = arguments;
|
|
603
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
604
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
620
605
|
case 0:
|
|
621
|
-
options =
|
|
606
|
+
options = _args7.length > 1 && _args7[1] !== undefined ? _args7[1] : {};
|
|
622
607
|
this.logMethodStart('initialize');
|
|
623
608
|
this.core = core;
|
|
624
609
|
this.initializeOptions = options || {};
|
|
@@ -643,14 +628,14 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
643
628
|
this.window = core.getPlugin('window');
|
|
644
629
|
this.request = core.getPlugin('request');
|
|
645
630
|
if (this.window) {
|
|
646
|
-
|
|
631
|
+
_context7.next = 24;
|
|
647
632
|
break;
|
|
648
633
|
}
|
|
649
634
|
this.logMethodError('initialize', 'window plugin missing');
|
|
650
635
|
throw new Error('venueBooking解决方案需要 window 插件支持');
|
|
651
636
|
case 24:
|
|
652
637
|
if (this.request) {
|
|
653
|
-
|
|
638
|
+
_context7.next = 27;
|
|
654
639
|
break;
|
|
655
640
|
}
|
|
656
641
|
this.logMethodError('initialize', 'request plugin missing');
|
|
@@ -773,21 +758,21 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
773
758
|
}
|
|
774
759
|
this.registerCustomerLoginListeners();
|
|
775
760
|
console.log('[VenueBooking] 初始化开始');
|
|
776
|
-
|
|
777
|
-
|
|
761
|
+
_context7.prev = 54;
|
|
762
|
+
_context7.next = 57;
|
|
778
763
|
return (_this$store$order = this.store.order) === null || _this$store$order === void 0 ? void 0 : _this$store$order.recalculateSummary({
|
|
779
764
|
createIfMissing: false
|
|
780
765
|
});
|
|
781
766
|
case 57:
|
|
782
767
|
(_this$store$order2 = this.store.order) === null || _this$store$order2 === void 0 || _this$store$order2.persistTempOrder();
|
|
783
|
-
|
|
768
|
+
_context7.next = 60;
|
|
784
769
|
return this.loadRuntimeConfigs();
|
|
785
770
|
case 60:
|
|
786
771
|
if (!this.store.schedule) {
|
|
787
|
-
|
|
772
|
+
_context7.next = 65;
|
|
788
773
|
break;
|
|
789
774
|
}
|
|
790
|
-
|
|
775
|
+
_context7.next = 63;
|
|
791
776
|
return this.store.schedule.loadAllSchedule();
|
|
792
777
|
case 63:
|
|
793
778
|
this.injectScheduleResolverToQuotation();
|
|
@@ -795,12 +780,12 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
795
780
|
channel: (_this$otherParams9 = this.otherParams) === null || _this$otherParams9 === void 0 ? void 0 : _this$otherParams9.channel
|
|
796
781
|
});
|
|
797
782
|
case 65:
|
|
798
|
-
|
|
783
|
+
_context7.next = 67;
|
|
799
784
|
return this.refreshItemRuleQuantityLimits();
|
|
800
785
|
case 67:
|
|
801
786
|
this.store.status = 'ready';
|
|
802
787
|
console.log('[VenueBooking] 初始化完成');
|
|
803
|
-
|
|
788
|
+
_context7.next = 71;
|
|
804
789
|
return this.core.effects.emit(VenueBookingHooks.onInited, {
|
|
805
790
|
status: this.store.status
|
|
806
791
|
});
|
|
@@ -808,25 +793,25 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
808
793
|
this.logMethodSuccess('initialize', {
|
|
809
794
|
status: this.store.status
|
|
810
795
|
});
|
|
811
|
-
|
|
796
|
+
_context7.next = 81;
|
|
812
797
|
break;
|
|
813
798
|
case 74:
|
|
814
|
-
|
|
815
|
-
|
|
799
|
+
_context7.prev = 74;
|
|
800
|
+
_context7.t0 = _context7["catch"](54);
|
|
816
801
|
this.store.status = 'error';
|
|
817
|
-
this.store.error =
|
|
818
|
-
console.error('[VenueBooking] 初始化失败',
|
|
819
|
-
this.logMethodError('initialize',
|
|
802
|
+
this.store.error = _context7.t0 instanceof Error ? _context7.t0.message : '初始化失败';
|
|
803
|
+
console.error('[VenueBooking] 初始化失败', _context7.t0);
|
|
804
|
+
this.logMethodError('initialize', _context7.t0, {
|
|
820
805
|
status: this.store.status
|
|
821
806
|
});
|
|
822
|
-
throw
|
|
807
|
+
throw _context7.t0;
|
|
823
808
|
case 81:
|
|
824
809
|
case "end":
|
|
825
|
-
return
|
|
810
|
+
return _context7.stop();
|
|
826
811
|
}
|
|
827
|
-
},
|
|
812
|
+
}, _callee7, this, [[54, 74]]);
|
|
828
813
|
}));
|
|
829
|
-
function initialize(
|
|
814
|
+
function initialize(_x6) {
|
|
830
815
|
return _initialize.apply(this, arguments);
|
|
831
816
|
}
|
|
832
817
|
return initialize;
|
|
@@ -834,22 +819,22 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
834
819
|
}, {
|
|
835
820
|
key: "destroy",
|
|
836
821
|
value: function () {
|
|
837
|
-
var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
838
|
-
return _regeneratorRuntime().wrap(function
|
|
839
|
-
while (1) switch (
|
|
822
|
+
var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
|
|
823
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
824
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
840
825
|
case 0:
|
|
841
826
|
this.logMethodStart('destroy');
|
|
842
827
|
this.clearLoginEffectListeners();
|
|
843
|
-
|
|
828
|
+
_context8.next = 4;
|
|
844
829
|
return this.core.effects.emit(VenueBookingHooks.onDestroy, {});
|
|
845
830
|
case 4:
|
|
846
831
|
console.log('[VenueBooking] 已销毁');
|
|
847
832
|
this.logMethodSuccess('destroy');
|
|
848
833
|
case 6:
|
|
849
834
|
case "end":
|
|
850
|
-
return
|
|
835
|
+
return _context8.stop();
|
|
851
836
|
}
|
|
852
|
-
},
|
|
837
|
+
}, _callee8, this);
|
|
853
838
|
}));
|
|
854
839
|
function destroy() {
|
|
855
840
|
return _destroy.apply(this, arguments);
|
|
@@ -859,32 +844,32 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
859
844
|
}, {
|
|
860
845
|
key: "retryInit",
|
|
861
846
|
value: function () {
|
|
862
|
-
var _retryInit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
863
|
-
return _regeneratorRuntime().wrap(function
|
|
864
|
-
while (1) switch (
|
|
847
|
+
var _retryInit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
|
|
848
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
849
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
865
850
|
case 0:
|
|
866
851
|
this.logMethodStart('retryInit');
|
|
867
852
|
console.log('[VenueBooking] retryInit 调用');
|
|
868
|
-
|
|
853
|
+
_context9.next = 4;
|
|
869
854
|
return this.core.effects.emit(VenueBookingHooks.onRetryInit, {});
|
|
870
855
|
case 4:
|
|
871
|
-
|
|
872
|
-
|
|
856
|
+
_context9.prev = 4;
|
|
857
|
+
_context9.next = 7;
|
|
873
858
|
return this.initialize(this.core, this.initializeOptions);
|
|
874
859
|
case 7:
|
|
875
860
|
this.logMethodSuccess('retryInit');
|
|
876
|
-
|
|
861
|
+
_context9.next = 14;
|
|
877
862
|
break;
|
|
878
863
|
case 10:
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
this.logMethodError('retryInit',
|
|
882
|
-
throw
|
|
864
|
+
_context9.prev = 10;
|
|
865
|
+
_context9.t0 = _context9["catch"](4);
|
|
866
|
+
this.logMethodError('retryInit', _context9.t0);
|
|
867
|
+
throw _context9.t0;
|
|
883
868
|
case 14:
|
|
884
869
|
case "end":
|
|
885
|
-
return
|
|
870
|
+
return _context9.stop();
|
|
886
871
|
}
|
|
887
|
-
},
|
|
872
|
+
}, _callee9, this, [[4, 10]]);
|
|
888
873
|
}));
|
|
889
874
|
function retryInit() {
|
|
890
875
|
return _retryInit.apply(this, arguments);
|
|
@@ -894,22 +879,22 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
894
879
|
}, {
|
|
895
880
|
key: "refresh",
|
|
896
881
|
value: function () {
|
|
897
|
-
var _refresh = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
898
|
-
return _regeneratorRuntime().wrap(function
|
|
899
|
-
while (1) switch (
|
|
882
|
+
var _refresh = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
|
|
883
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
884
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
900
885
|
case 0:
|
|
901
886
|
this.logMethodStart('refresh');
|
|
902
887
|
console.log('[VenueBooking] refresh 调用');
|
|
903
|
-
|
|
888
|
+
_context10.prev = 2;
|
|
904
889
|
this.store.status = 'initializing';
|
|
905
|
-
|
|
890
|
+
_context10.next = 6;
|
|
906
891
|
return this.loadRuntimeConfigs();
|
|
907
892
|
case 6:
|
|
908
|
-
|
|
893
|
+
_context10.next = 8;
|
|
909
894
|
return this.refreshItemRuleQuantityLimits();
|
|
910
895
|
case 8:
|
|
911
896
|
this.store.status = 'ready';
|
|
912
|
-
|
|
897
|
+
_context10.next = 11;
|
|
913
898
|
return this.core.effects.emit(VenueBookingHooks.onRefresh, {
|
|
914
899
|
status: this.store.status
|
|
915
900
|
});
|
|
@@ -917,18 +902,18 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
917
902
|
this.logMethodSuccess('refresh', {
|
|
918
903
|
status: this.store.status
|
|
919
904
|
});
|
|
920
|
-
|
|
905
|
+
_context10.next = 18;
|
|
921
906
|
break;
|
|
922
907
|
case 14:
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
this.logMethodError('refresh',
|
|
926
|
-
throw
|
|
908
|
+
_context10.prev = 14;
|
|
909
|
+
_context10.t0 = _context10["catch"](2);
|
|
910
|
+
this.logMethodError('refresh', _context10.t0);
|
|
911
|
+
throw _context10.t0;
|
|
927
912
|
case 18:
|
|
928
913
|
case "end":
|
|
929
|
-
return
|
|
914
|
+
return _context10.stop();
|
|
930
915
|
}
|
|
931
|
-
},
|
|
916
|
+
}, _callee10, this, [[2, 14]]);
|
|
932
917
|
}));
|
|
933
918
|
function refresh() {
|
|
934
919
|
return _refresh.apply(this, arguments);
|
|
@@ -969,26 +954,26 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
969
954
|
}, {
|
|
970
955
|
key: "loadAllProducts",
|
|
971
956
|
value: function () {
|
|
972
|
-
var _loadAllProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
957
|
+
var _loadAllProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
|
|
973
958
|
var _this5 = this;
|
|
974
|
-
return _regeneratorRuntime().wrap(function
|
|
975
|
-
while (1) switch (
|
|
959
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
960
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
976
961
|
case 0:
|
|
977
962
|
if (!this.loadAllProductsInFlight) {
|
|
978
|
-
|
|
963
|
+
_context11.next = 2;
|
|
979
964
|
break;
|
|
980
965
|
}
|
|
981
|
-
return
|
|
966
|
+
return _context11.abrupt("return", this.loadAllProductsInFlight);
|
|
982
967
|
case 2:
|
|
983
968
|
this.loadAllProductsInFlight = this._doLoadAllProducts().finally(function () {
|
|
984
969
|
_this5.loadAllProductsInFlight = null;
|
|
985
970
|
});
|
|
986
|
-
return
|
|
971
|
+
return _context11.abrupt("return", this.loadAllProductsInFlight);
|
|
987
972
|
case 4:
|
|
988
973
|
case "end":
|
|
989
|
-
return
|
|
974
|
+
return _context11.stop();
|
|
990
975
|
}
|
|
991
|
-
},
|
|
976
|
+
}, _callee11, this);
|
|
992
977
|
}));
|
|
993
978
|
function loadAllProducts() {
|
|
994
979
|
return _loadAllProducts.apply(this, arguments);
|
|
@@ -998,31 +983,31 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
998
983
|
}, {
|
|
999
984
|
key: "_doLoadAllProducts",
|
|
1000
985
|
value: function () {
|
|
1001
|
-
var _doLoadAllProducts2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1002
|
-
var _this$otherParams10, _this$store$venueProd, associatedMenus, menuListIds, allProducts, list, venueList, addonList, venueStore;
|
|
1003
|
-
return _regeneratorRuntime().wrap(function
|
|
1004
|
-
while (1) switch (
|
|
986
|
+
var _doLoadAllProducts2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
|
|
987
|
+
var _this$otherParams10, _this$store$venueProd, associatedMenus, menuListIds, allProducts, list, venueList, addonList, venueStore, _this$store$order3, _this$store$order3$ge, products;
|
|
988
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
989
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
1005
990
|
case 0:
|
|
1006
991
|
this.logMethodStart('loadAllProducts');
|
|
1007
|
-
|
|
992
|
+
_context12.prev = 1;
|
|
1008
993
|
if (this.store.venueProducts) {
|
|
1009
|
-
|
|
994
|
+
_context12.next = 4;
|
|
1010
995
|
break;
|
|
1011
996
|
}
|
|
1012
997
|
throw new Error('venueProducts 模块未初始化');
|
|
1013
998
|
case 4:
|
|
1014
999
|
if (this.store.addonProducts) {
|
|
1015
|
-
|
|
1000
|
+
_context12.next = 6;
|
|
1016
1001
|
break;
|
|
1017
1002
|
}
|
|
1018
1003
|
throw new Error('addonProducts 模块未初始化');
|
|
1019
1004
|
case 6:
|
|
1020
|
-
|
|
1005
|
+
_context12.next = 8;
|
|
1021
1006
|
return this.loadOpenDataConfig();
|
|
1022
1007
|
case 8:
|
|
1023
1008
|
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']) || [];
|
|
1024
1009
|
if (associatedMenus.length) {
|
|
1025
|
-
|
|
1010
|
+
_context12.next = 12;
|
|
1026
1011
|
break;
|
|
1027
1012
|
}
|
|
1028
1013
|
this.logMethodError('loadAllProducts', new Error('未获取到餐牌配置(menu.associated_menus),请检查 OpenData 配置'));
|
|
@@ -1031,7 +1016,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1031
1016
|
menuListIds = associatedMenus.map(function (n) {
|
|
1032
1017
|
return Number(n.value);
|
|
1033
1018
|
});
|
|
1034
|
-
|
|
1019
|
+
_context12.next = 15;
|
|
1035
1020
|
return this.store.venueProducts.loadProducts({
|
|
1036
1021
|
menu_list_ids: menuListIds,
|
|
1037
1022
|
cacheId: this.cacheId,
|
|
@@ -1039,7 +1024,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1039
1024
|
schedule_datetime: dayjs().format('YYYY-MM-DD HH:mm:ss')
|
|
1040
1025
|
});
|
|
1041
1026
|
case 15:
|
|
1042
|
-
allProducts =
|
|
1027
|
+
allProducts = _context12.sent;
|
|
1043
1028
|
list = Array.isArray(allProducts) ? allProducts : [];
|
|
1044
1029
|
venueList = list.filter(function (p) {
|
|
1045
1030
|
return p.duration != null;
|
|
@@ -1057,9 +1042,14 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1057
1042
|
this.resourceProductMap = buildResourceProductMap(venueList);
|
|
1058
1043
|
|
|
1059
1044
|
// 加载 holder 表单
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1045
|
+
if (!this.store.order) {
|
|
1046
|
+
_context12.next = 27;
|
|
1047
|
+
break;
|
|
1048
|
+
}
|
|
1049
|
+
products = ((_this$store$order3 = this.store.order) === null || _this$store$order3 === void 0 || (_this$store$order3$ge = _this$store$order3.getOrderProducts) === null || _this$store$order3$ge === void 0 ? void 0 : _this$store$order3$ge.call(_this$store$order3)) || [];
|
|
1050
|
+
_context12.next = 27;
|
|
1051
|
+
return this.preloadHolderForms(products);
|
|
1052
|
+
case 27:
|
|
1063
1053
|
this.productsLoaded = true;
|
|
1064
1054
|
this.logMethodSuccess('loadAllProducts', {
|
|
1065
1055
|
total: list.length,
|
|
@@ -1067,20 +1057,20 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1067
1057
|
addonCount: addonList.length,
|
|
1068
1058
|
resourceCount: this.resourceProductMap.size
|
|
1069
1059
|
});
|
|
1070
|
-
return
|
|
1060
|
+
return _context12.abrupt("return", {
|
|
1071
1061
|
venueProducts: venueList,
|
|
1072
1062
|
addonProducts: addonList
|
|
1073
1063
|
});
|
|
1074
|
-
case
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
this.logMethodError('loadAllProducts',
|
|
1078
|
-
throw
|
|
1079
|
-
case
|
|
1064
|
+
case 32:
|
|
1065
|
+
_context12.prev = 32;
|
|
1066
|
+
_context12.t0 = _context12["catch"](1);
|
|
1067
|
+
this.logMethodError('loadAllProducts', _context12.t0);
|
|
1068
|
+
throw _context12.t0;
|
|
1069
|
+
case 36:
|
|
1080
1070
|
case "end":
|
|
1081
|
-
return
|
|
1071
|
+
return _context12.stop();
|
|
1082
1072
|
}
|
|
1083
|
-
},
|
|
1073
|
+
}, _callee12, this, [[1, 32]]);
|
|
1084
1074
|
}));
|
|
1085
1075
|
function _doLoadAllProducts() {
|
|
1086
1076
|
return _doLoadAllProducts2.apply(this, arguments);
|
|
@@ -1090,21 +1080,21 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1090
1080
|
}, {
|
|
1091
1081
|
key: "loadVenueProducts",
|
|
1092
1082
|
value: function () {
|
|
1093
|
-
var _loadVenueProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1083
|
+
var _loadVenueProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
|
|
1094
1084
|
var result;
|
|
1095
|
-
return _regeneratorRuntime().wrap(function
|
|
1096
|
-
while (1) switch (
|
|
1085
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
1086
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
1097
1087
|
case 0:
|
|
1098
|
-
|
|
1088
|
+
_context13.next = 2;
|
|
1099
1089
|
return this.loadAllProducts();
|
|
1100
1090
|
case 2:
|
|
1101
|
-
result =
|
|
1102
|
-
return
|
|
1091
|
+
result = _context13.sent;
|
|
1092
|
+
return _context13.abrupt("return", result.venueProducts);
|
|
1103
1093
|
case 4:
|
|
1104
1094
|
case "end":
|
|
1105
|
-
return
|
|
1095
|
+
return _context13.stop();
|
|
1106
1096
|
}
|
|
1107
|
-
},
|
|
1097
|
+
}, _callee13, this);
|
|
1108
1098
|
}));
|
|
1109
1099
|
function loadVenueProducts() {
|
|
1110
1100
|
return _loadVenueProducts.apply(this, arguments);
|
|
@@ -1114,21 +1104,21 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1114
1104
|
}, {
|
|
1115
1105
|
key: "loadAddonProducts",
|
|
1116
1106
|
value: function () {
|
|
1117
|
-
var _loadAddonProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1107
|
+
var _loadAddonProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
|
|
1118
1108
|
var result;
|
|
1119
|
-
return _regeneratorRuntime().wrap(function
|
|
1120
|
-
while (1) switch (
|
|
1109
|
+
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
1110
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
1121
1111
|
case 0:
|
|
1122
|
-
|
|
1112
|
+
_context14.next = 2;
|
|
1123
1113
|
return this.loadAllProducts();
|
|
1124
1114
|
case 2:
|
|
1125
|
-
result =
|
|
1126
|
-
return
|
|
1115
|
+
result = _context14.sent;
|
|
1116
|
+
return _context14.abrupt("return", result.addonProducts);
|
|
1127
1117
|
case 4:
|
|
1128
1118
|
case "end":
|
|
1129
|
-
return
|
|
1119
|
+
return _context14.stop();
|
|
1130
1120
|
}
|
|
1131
|
-
},
|
|
1121
|
+
}, _callee14, this);
|
|
1132
1122
|
}));
|
|
1133
1123
|
function loadAddonProducts() {
|
|
1134
1124
|
return _loadAddonProducts.apply(this, arguments);
|
|
@@ -1152,38 +1142,38 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1152
1142
|
}, {
|
|
1153
1143
|
key: "loadQuotations",
|
|
1154
1144
|
value: function () {
|
|
1155
|
-
var _loadQuotations = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1156
|
-
return _regeneratorRuntime().wrap(function
|
|
1157
|
-
while (1) switch (
|
|
1145
|
+
var _loadQuotations = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(params) {
|
|
1146
|
+
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
1147
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
1158
1148
|
case 0:
|
|
1159
1149
|
this.logMethodStart('loadQuotations');
|
|
1160
|
-
|
|
1150
|
+
_context15.prev = 1;
|
|
1161
1151
|
if (this.store.quotation) {
|
|
1162
|
-
|
|
1152
|
+
_context15.next = 4;
|
|
1163
1153
|
break;
|
|
1164
1154
|
}
|
|
1165
1155
|
throw new Error('quotation 模块未初始化');
|
|
1166
1156
|
case 4:
|
|
1167
|
-
|
|
1157
|
+
_context15.next = 6;
|
|
1168
1158
|
return this.store.quotation.loadQuotations(params);
|
|
1169
1159
|
case 6:
|
|
1170
1160
|
this.logMethodSuccess('loadQuotations', {
|
|
1171
1161
|
count: this.store.quotation.getQuotationList().length
|
|
1172
1162
|
});
|
|
1173
|
-
|
|
1163
|
+
_context15.next = 13;
|
|
1174
1164
|
break;
|
|
1175
1165
|
case 9:
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
this.logMethodError('loadQuotations',
|
|
1179
|
-
throw
|
|
1166
|
+
_context15.prev = 9;
|
|
1167
|
+
_context15.t0 = _context15["catch"](1);
|
|
1168
|
+
this.logMethodError('loadQuotations', _context15.t0);
|
|
1169
|
+
throw _context15.t0;
|
|
1180
1170
|
case 13:
|
|
1181
1171
|
case "end":
|
|
1182
|
-
return
|
|
1172
|
+
return _context15.stop();
|
|
1183
1173
|
}
|
|
1184
|
-
},
|
|
1174
|
+
}, _callee15, this, [[1, 9]]);
|
|
1185
1175
|
}));
|
|
1186
|
-
function loadQuotations(
|
|
1176
|
+
function loadQuotations(_x7) {
|
|
1187
1177
|
return _loadQuotations.apply(this, arguments);
|
|
1188
1178
|
}
|
|
1189
1179
|
return loadQuotations;
|
|
@@ -1191,46 +1181,46 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1191
1181
|
}, {
|
|
1192
1182
|
key: "fetchResourceAvailability",
|
|
1193
1183
|
value: function () {
|
|
1194
|
-
var _fetchResourceAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1184
|
+
var _fetchResourceAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(params) {
|
|
1195
1185
|
var venueProducts, resourceIds, config, crossDay, effectiveEndDate, res, rawData, _iterator3, _step3, item, _i3, _rawData, _item, mappings, _iterator4, _step4, mapping;
|
|
1196
|
-
return _regeneratorRuntime().wrap(function
|
|
1197
|
-
while (1) switch (
|
|
1186
|
+
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
1187
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
1198
1188
|
case 0:
|
|
1199
1189
|
this.logMethodStart('fetchResourceAvailability', params);
|
|
1200
|
-
|
|
1190
|
+
_context16.prev = 1;
|
|
1201
1191
|
venueProducts = this.getVenueProducts();
|
|
1202
1192
|
if (venueProducts.length) {
|
|
1203
|
-
|
|
1193
|
+
_context16.next = 7;
|
|
1204
1194
|
break;
|
|
1205
1195
|
}
|
|
1206
1196
|
this.store.rawResourceData = [];
|
|
1207
1197
|
this.logMethodSuccess('fetchResourceAvailability', {
|
|
1208
1198
|
resourceCount: 0
|
|
1209
1199
|
});
|
|
1210
|
-
return
|
|
1200
|
+
return _context16.abrupt("return");
|
|
1211
1201
|
case 7:
|
|
1212
1202
|
resourceIds = extractResourceIds(venueProducts);
|
|
1213
1203
|
if (resourceIds.length) {
|
|
1214
|
-
|
|
1204
|
+
_context16.next = 12;
|
|
1215
1205
|
break;
|
|
1216
1206
|
}
|
|
1217
1207
|
this.store.rawResourceData = [];
|
|
1218
1208
|
this.logMethodSuccess('fetchResourceAvailability', {
|
|
1219
1209
|
resourceIds: []
|
|
1220
1210
|
});
|
|
1221
|
-
return
|
|
1211
|
+
return _context16.abrupt("return");
|
|
1222
1212
|
case 12:
|
|
1223
1213
|
// 跨天营业时,endDate 扩展一天以覆盖次日凌晨时段
|
|
1224
1214
|
config = this.store.slotConfig;
|
|
1225
1215
|
crossDay = isBusinessHoursCrossDay(config);
|
|
1226
1216
|
effectiveEndDate = crossDay ? dayjs(params.endDate).add(1, 'day').format('YYYY-MM-DD') : params.endDate;
|
|
1227
1217
|
if (this.store.date) {
|
|
1228
|
-
|
|
1218
|
+
_context16.next = 17;
|
|
1229
1219
|
break;
|
|
1230
1220
|
}
|
|
1231
1221
|
throw new Error('date 模块未初始化');
|
|
1232
1222
|
case 17:
|
|
1233
|
-
|
|
1223
|
+
_context16.next = 19;
|
|
1234
1224
|
return this.store.date.fetchResourceDates({
|
|
1235
1225
|
query: {
|
|
1236
1226
|
start_date: params.startDate,
|
|
@@ -1240,7 +1230,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1240
1230
|
useCache: false
|
|
1241
1231
|
});
|
|
1242
1232
|
case 19:
|
|
1243
|
-
res =
|
|
1233
|
+
res = _context16.sent;
|
|
1244
1234
|
rawData = [];
|
|
1245
1235
|
if (res !== null && res !== void 0 && res.data && Array.isArray(res.data)) {
|
|
1246
1236
|
_iterator3 = _createForOfIteratorHelper(res.data);
|
|
@@ -1263,16 +1253,16 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1263
1253
|
_i3 = 0, _rawData = rawData;
|
|
1264
1254
|
case 24:
|
|
1265
1255
|
if (!(_i3 < _rawData.length)) {
|
|
1266
|
-
|
|
1256
|
+
_context16.next = 34;
|
|
1267
1257
|
break;
|
|
1268
1258
|
}
|
|
1269
1259
|
_item = _rawData[_i3];
|
|
1270
1260
|
mappings = this.resourceProductMap.get(_item.resourceId);
|
|
1271
1261
|
if (mappings) {
|
|
1272
|
-
|
|
1262
|
+
_context16.next = 29;
|
|
1273
1263
|
break;
|
|
1274
1264
|
}
|
|
1275
|
-
return
|
|
1265
|
+
return _context16.abrupt("continue", 31);
|
|
1276
1266
|
case 29:
|
|
1277
1267
|
_iterator4 = _createForOfIteratorHelper(mappings);
|
|
1278
1268
|
try {
|
|
@@ -1288,7 +1278,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1288
1278
|
}
|
|
1289
1279
|
case 31:
|
|
1290
1280
|
_i3++;
|
|
1291
|
-
|
|
1281
|
+
_context16.next = 24;
|
|
1292
1282
|
break;
|
|
1293
1283
|
case 34:
|
|
1294
1284
|
this.logMethodSuccess('fetchResourceAvailability', {
|
|
@@ -1297,21 +1287,21 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1297
1287
|
return sum + r.times.length;
|
|
1298
1288
|
}, 0)
|
|
1299
1289
|
});
|
|
1300
|
-
|
|
1290
|
+
_context16.next = 42;
|
|
1301
1291
|
break;
|
|
1302
1292
|
case 37:
|
|
1303
|
-
|
|
1304
|
-
|
|
1293
|
+
_context16.prev = 37;
|
|
1294
|
+
_context16.t0 = _context16["catch"](1);
|
|
1305
1295
|
this.store.rawResourceData = [];
|
|
1306
|
-
this.logMethodError('fetchResourceAvailability',
|
|
1307
|
-
throw
|
|
1296
|
+
this.logMethodError('fetchResourceAvailability', _context16.t0);
|
|
1297
|
+
throw _context16.t0;
|
|
1308
1298
|
case 42:
|
|
1309
1299
|
case "end":
|
|
1310
|
-
return
|
|
1300
|
+
return _context16.stop();
|
|
1311
1301
|
}
|
|
1312
|
-
},
|
|
1302
|
+
}, _callee16, this, [[1, 37]]);
|
|
1313
1303
|
}));
|
|
1314
|
-
function fetchResourceAvailability(
|
|
1304
|
+
function fetchResourceAvailability(_x8) {
|
|
1315
1305
|
return _fetchResourceAvailability.apply(this, arguments);
|
|
1316
1306
|
}
|
|
1317
1307
|
return fetchResourceAvailability;
|
|
@@ -1444,20 +1434,20 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1444
1434
|
}, {
|
|
1445
1435
|
key: "toggleSlot",
|
|
1446
1436
|
value: function () {
|
|
1447
|
-
var _toggleSlot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1437
|
+
var _toggleSlot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(slot) {
|
|
1448
1438
|
var mappings, mapping, currentSlots, existIndex, nextSlots, products;
|
|
1449
|
-
return _regeneratorRuntime().wrap(function
|
|
1450
|
-
while (1) switch (
|
|
1439
|
+
return _regeneratorRuntime().wrap(function _callee17$(_context17) {
|
|
1440
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
1451
1441
|
case 0:
|
|
1452
1442
|
this.logMethodStart('toggleSlot', {
|
|
1453
1443
|
resourceId: slot.resourceId,
|
|
1454
1444
|
productId: slot.productId,
|
|
1455
1445
|
startTime: slot.startTime
|
|
1456
1446
|
});
|
|
1457
|
-
|
|
1447
|
+
_context17.prev = 1;
|
|
1458
1448
|
mappings = this.resourceProductMap.get(slot.resourceId);
|
|
1459
1449
|
if (!(!mappings || !mappings.length)) {
|
|
1460
|
-
|
|
1450
|
+
_context17.next = 5;
|
|
1461
1451
|
break;
|
|
1462
1452
|
}
|
|
1463
1453
|
throw new Error("\u672A\u627E\u5230\u8D44\u6E90 ".concat(slot.resourceId, " \u7684\u5546\u54C1\u6620\u5C04"));
|
|
@@ -1466,13 +1456,13 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1466
1456
|
return m.productId === slot.productId;
|
|
1467
1457
|
});
|
|
1468
1458
|
if (mapping) {
|
|
1469
|
-
|
|
1459
|
+
_context17.next = 8;
|
|
1470
1460
|
break;
|
|
1471
1461
|
}
|
|
1472
1462
|
throw new Error("\u8D44\u6E90 ".concat(slot.resourceId, " \u672A\u5173\u8054\u5546\u54C1 ").concat(slot.productId));
|
|
1473
1463
|
case 8:
|
|
1474
1464
|
if (this.store.order) {
|
|
1475
|
-
|
|
1465
|
+
_context17.next = 10;
|
|
1476
1466
|
break;
|
|
1477
1467
|
}
|
|
1478
1468
|
throw new Error('order 模块未初始化');
|
|
@@ -1488,14 +1478,14 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1488
1478
|
} else {
|
|
1489
1479
|
nextSlots = [].concat(_toConsumableArray(currentSlots), [slot]);
|
|
1490
1480
|
}
|
|
1491
|
-
|
|
1481
|
+
_context17.next = 15;
|
|
1492
1482
|
return this.reconcileOrderForResourceProduct(slot.resourceId, slot.productId, nextSlots);
|
|
1493
1483
|
case 15:
|
|
1494
1484
|
products = this.store.order.getOrderProducts();
|
|
1495
|
-
|
|
1485
|
+
_context17.next = 18;
|
|
1496
1486
|
return this.refreshItemRuleQuantityLimits();
|
|
1497
1487
|
case 18:
|
|
1498
|
-
|
|
1488
|
+
_context17.next = 20;
|
|
1499
1489
|
return this.refreshCartValidationPassed();
|
|
1500
1490
|
case 20:
|
|
1501
1491
|
this.logMethodSuccess('toggleSlot', {
|
|
@@ -1504,19 +1494,19 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1504
1494
|
productId: slot.productId,
|
|
1505
1495
|
slotCount: nextSlots.length
|
|
1506
1496
|
});
|
|
1507
|
-
return
|
|
1497
|
+
return _context17.abrupt("return", products);
|
|
1508
1498
|
case 24:
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
this.logMethodError('toggleSlot',
|
|
1512
|
-
throw
|
|
1499
|
+
_context17.prev = 24;
|
|
1500
|
+
_context17.t0 = _context17["catch"](1);
|
|
1501
|
+
this.logMethodError('toggleSlot', _context17.t0);
|
|
1502
|
+
throw _context17.t0;
|
|
1513
1503
|
case 28:
|
|
1514
1504
|
case "end":
|
|
1515
|
-
return
|
|
1505
|
+
return _context17.stop();
|
|
1516
1506
|
}
|
|
1517
|
-
},
|
|
1507
|
+
}, _callee17, this, [[1, 24]]);
|
|
1518
1508
|
}));
|
|
1519
|
-
function toggleSlot(
|
|
1509
|
+
function toggleSlot(_x9) {
|
|
1520
1510
|
return _toggleSlot.apply(this, arguments);
|
|
1521
1511
|
}
|
|
1522
1512
|
return toggleSlot;
|
|
@@ -1528,8 +1518,8 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1528
1518
|
}, {
|
|
1529
1519
|
key: "getSelectedSlotsForResource",
|
|
1530
1520
|
value: function getSelectedSlotsForResource(resourceId, productId) {
|
|
1531
|
-
var _this$store$
|
|
1532
|
-
var tempOrder = (_this$store$
|
|
1521
|
+
var _this$store$order4;
|
|
1522
|
+
var tempOrder = (_this$store$order4 = this.store.order) === null || _this$store$order4 === void 0 ? void 0 : _this$store$order4.getTempOrder();
|
|
1533
1523
|
if (!tempOrder) return [];
|
|
1534
1524
|
var venueProducts = tempOrder.products.filter(function (p) {
|
|
1535
1525
|
var _p$metadata, _p$metadata2;
|
|
@@ -1690,9 +1680,9 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1690
1680
|
}, {
|
|
1691
1681
|
key: "getAllSelectedSlots",
|
|
1692
1682
|
value: function getAllSelectedSlots() {
|
|
1693
|
-
var _this$store$
|
|
1683
|
+
var _this$store$order5;
|
|
1694
1684
|
var result = new Map();
|
|
1695
|
-
var tempOrder = (_this$store$
|
|
1685
|
+
var tempOrder = (_this$store$order5 = this.store.order) === null || _this$store$order5 === void 0 ? void 0 : _this$store$order5.getTempOrder();
|
|
1696
1686
|
if (!tempOrder) return result;
|
|
1697
1687
|
var venueProducts = tempOrder.products.filter(function (p) {
|
|
1698
1688
|
var _p$metadata3;
|
|
@@ -1751,26 +1741,27 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1751
1741
|
}, {
|
|
1752
1742
|
key: "reconcileOrderForResourceProduct",
|
|
1753
1743
|
value: (function () {
|
|
1754
|
-
var _reconcileOrderForResourceProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1755
|
-
var
|
|
1756
|
-
|
|
1757
|
-
|
|
1744
|
+
var _reconcileOrderForResourceProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(resourceId, productId, slots) {
|
|
1745
|
+
var _this$store$order6, _this$store$order6$ge;
|
|
1746
|
+
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, products;
|
|
1747
|
+
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
1748
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
1758
1749
|
case 0:
|
|
1759
1750
|
mappings = this.resourceProductMap.get(resourceId);
|
|
1760
1751
|
if (!(!mappings || !mappings.length || !this.store.order)) {
|
|
1761
|
-
|
|
1752
|
+
_context18.next = 3;
|
|
1762
1753
|
break;
|
|
1763
1754
|
}
|
|
1764
|
-
return
|
|
1755
|
+
return _context18.abrupt("return");
|
|
1765
1756
|
case 3:
|
|
1766
1757
|
mapping = mappings.find(function (m) {
|
|
1767
1758
|
return m.productId === productId;
|
|
1768
1759
|
});
|
|
1769
1760
|
if (mapping) {
|
|
1770
|
-
|
|
1761
|
+
_context18.next = 6;
|
|
1771
1762
|
break;
|
|
1772
1763
|
}
|
|
1773
|
-
return
|
|
1764
|
+
return _context18.abrupt("return");
|
|
1774
1765
|
case 6:
|
|
1775
1766
|
tempOrder = this.store.order.ensureTempOrder();
|
|
1776
1767
|
matchesCurrent = function matchesCurrent(meta, pid) {
|
|
@@ -1788,17 +1779,17 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1788
1779
|
return Number(bookingProductId) !== Number(productId);
|
|
1789
1780
|
});
|
|
1790
1781
|
if (slots.length) {
|
|
1791
|
-
|
|
1782
|
+
_context18.next = 16;
|
|
1792
1783
|
break;
|
|
1793
1784
|
}
|
|
1794
1785
|
this.store.order.applyDiscount();
|
|
1795
|
-
|
|
1786
|
+
_context18.next = 14;
|
|
1796
1787
|
return this.store.order.recalculateSummary({
|
|
1797
1788
|
createIfMissing: true
|
|
1798
1789
|
});
|
|
1799
1790
|
case 14:
|
|
1800
1791
|
this.store.order.persistTempOrder();
|
|
1801
|
-
return
|
|
1792
|
+
return _context18.abrupt("return");
|
|
1802
1793
|
case 16:
|
|
1803
1794
|
merged = mergeConsecutiveSlots(slots);
|
|
1804
1795
|
rawResource = this.store.rawResourceData.find(function (r) {
|
|
@@ -1809,11 +1800,6 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1809
1800
|
return p.id === mapping.productId;
|
|
1810
1801
|
});
|
|
1811
1802
|
tempOrder.bookings = tempOrder.bookings || [];
|
|
1812
|
-
|
|
1813
|
-
// 获取表单信息
|
|
1814
|
-
_context19.next = 23;
|
|
1815
|
-
return this.ensureProductHolderForm(venueProduct);
|
|
1816
|
-
case 23:
|
|
1817
1803
|
for (i = 0; i < merged.length; i++) {
|
|
1818
1804
|
group = merged[i];
|
|
1819
1805
|
identityKey = buildVenueIdentityKey(resourceId, i);
|
|
@@ -1892,7 +1878,8 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1892
1878
|
custom_deposit_data: customDepositData,
|
|
1893
1879
|
metadata: {},
|
|
1894
1880
|
holder_config: venueProduct === null || venueProduct === void 0 ? void 0 : venueProduct.holder_config,
|
|
1895
|
-
bookingUuid: bookingUuid
|
|
1881
|
+
bookingUuid: bookingUuid,
|
|
1882
|
+
shop_id: (venueProduct === null || venueProduct === void 0 ? void 0 : venueProduct.shop_id) || 0
|
|
1896
1883
|
},
|
|
1897
1884
|
sub_type: 'minutes',
|
|
1898
1885
|
duration: duration,
|
|
@@ -1922,20 +1909,26 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1922
1909
|
});
|
|
1923
1910
|
tempOrder.bookings.push(booking);
|
|
1924
1911
|
}
|
|
1912
|
+
|
|
1913
|
+
// 获取表单信息
|
|
1914
|
+
products = ((_this$store$order6 = this.store.order) === null || _this$store$order6 === void 0 || (_this$store$order6$ge = _this$store$order6.getOrderProducts) === null || _this$store$order6$ge === void 0 ? void 0 : _this$store$order6$ge.call(_this$store$order6)) || [];
|
|
1915
|
+
_context18.next = 25;
|
|
1916
|
+
return this.preloadHolderForms(products);
|
|
1917
|
+
case 25:
|
|
1925
1918
|
this.store.order.applyDiscount();
|
|
1926
|
-
|
|
1919
|
+
_context18.next = 28;
|
|
1927
1920
|
return this.store.order.recalculateSummary({
|
|
1928
1921
|
createIfMissing: true
|
|
1929
1922
|
});
|
|
1930
|
-
case 27:
|
|
1931
|
-
this.store.order.persistTempOrder();
|
|
1932
1923
|
case 28:
|
|
1924
|
+
this.store.order.persistTempOrder();
|
|
1925
|
+
case 29:
|
|
1933
1926
|
case "end":
|
|
1934
|
-
return
|
|
1927
|
+
return _context18.stop();
|
|
1935
1928
|
}
|
|
1936
|
-
},
|
|
1929
|
+
}, _callee18, this);
|
|
1937
1930
|
}));
|
|
1938
|
-
function reconcileOrderForResourceProduct(_x11, _x12
|
|
1931
|
+
function reconcileOrderForResourceProduct(_x10, _x11, _x12) {
|
|
1939
1932
|
return _reconcileOrderForResourceProduct.apply(this, arguments);
|
|
1940
1933
|
}
|
|
1941
1934
|
return reconcileOrderForResourceProduct;
|
|
@@ -1988,35 +1981,35 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1988
1981
|
}, {
|
|
1989
1982
|
key: "loadSchedules",
|
|
1990
1983
|
value: function () {
|
|
1991
|
-
var _loadSchedules = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1992
|
-
return _regeneratorRuntime().wrap(function
|
|
1993
|
-
while (1) switch (
|
|
1984
|
+
var _loadSchedules = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19() {
|
|
1985
|
+
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
|
1986
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
1994
1987
|
case 0:
|
|
1995
1988
|
this.logMethodStart('loadSchedules');
|
|
1996
|
-
|
|
1989
|
+
_context19.prev = 1;
|
|
1997
1990
|
if (this.store.schedule) {
|
|
1998
|
-
|
|
1991
|
+
_context19.next = 4;
|
|
1999
1992
|
break;
|
|
2000
1993
|
}
|
|
2001
1994
|
throw new Error('schedule 模块未初始化');
|
|
2002
1995
|
case 4:
|
|
2003
|
-
|
|
1996
|
+
_context19.next = 6;
|
|
2004
1997
|
return this.store.schedule.loadAllSchedule();
|
|
2005
1998
|
case 6:
|
|
2006
1999
|
this.injectScheduleResolverToQuotation();
|
|
2007
2000
|
this.logMethodSuccess('loadSchedules');
|
|
2008
|
-
|
|
2001
|
+
_context19.next = 14;
|
|
2009
2002
|
break;
|
|
2010
2003
|
case 10:
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
this.logMethodError('loadSchedules',
|
|
2014
|
-
throw
|
|
2004
|
+
_context19.prev = 10;
|
|
2005
|
+
_context19.t0 = _context19["catch"](1);
|
|
2006
|
+
this.logMethodError('loadSchedules', _context19.t0);
|
|
2007
|
+
throw _context19.t0;
|
|
2015
2008
|
case 14:
|
|
2016
2009
|
case "end":
|
|
2017
|
-
return
|
|
2010
|
+
return _context19.stop();
|
|
2018
2011
|
}
|
|
2019
|
-
},
|
|
2012
|
+
}, _callee19, this, [[1, 10]]);
|
|
2020
2013
|
}));
|
|
2021
2014
|
function loadSchedules() {
|
|
2022
2015
|
return _loadSchedules.apply(this, arguments);
|
|
@@ -2044,8 +2037,8 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2044
2037
|
}, {
|
|
2045
2038
|
key: "getTempOrder",
|
|
2046
2039
|
value: function getTempOrder() {
|
|
2047
|
-
var _this$store$
|
|
2048
|
-
var result = ((_this$store$
|
|
2040
|
+
var _this$store$order7;
|
|
2041
|
+
var result = ((_this$store$order7 = this.store.order) === null || _this$store$order7 === void 0 ? void 0 : _this$store$order7.getTempOrder()) || null;
|
|
2049
2042
|
return result;
|
|
2050
2043
|
}
|
|
2051
2044
|
}, {
|
|
@@ -2069,15 +2062,15 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2069
2062
|
}, {
|
|
2070
2063
|
key: "onCustomerLogin",
|
|
2071
2064
|
value: function () {
|
|
2072
|
-
var _onCustomerLogin = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2073
|
-
return _regeneratorRuntime().wrap(function
|
|
2074
|
-
while (1) switch (
|
|
2065
|
+
var _onCustomerLogin = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(params) {
|
|
2066
|
+
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
|
2067
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
2075
2068
|
case 0:
|
|
2076
2069
|
this.logMethodStart('onCustomerLogin', {
|
|
2077
2070
|
customerId: params.customerId
|
|
2078
2071
|
});
|
|
2079
|
-
|
|
2080
|
-
|
|
2072
|
+
_context20.prev = 1;
|
|
2073
|
+
_context20.next = 4;
|
|
2081
2074
|
return this.refreshOrderMarketingAfterLogin({
|
|
2082
2075
|
customerId: params.customerId
|
|
2083
2076
|
});
|
|
@@ -2085,20 +2078,20 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2085
2078
|
this.logMethodSuccess('onCustomerLogin', {
|
|
2086
2079
|
customerId: params.customerId
|
|
2087
2080
|
});
|
|
2088
|
-
|
|
2081
|
+
_context20.next = 11;
|
|
2089
2082
|
break;
|
|
2090
2083
|
case 7:
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
this.logMethodError('onCustomerLogin',
|
|
2094
|
-
throw
|
|
2084
|
+
_context20.prev = 7;
|
|
2085
|
+
_context20.t0 = _context20["catch"](1);
|
|
2086
|
+
this.logMethodError('onCustomerLogin', _context20.t0);
|
|
2087
|
+
throw _context20.t0;
|
|
2095
2088
|
case 11:
|
|
2096
2089
|
case "end":
|
|
2097
|
-
return
|
|
2090
|
+
return _context20.stop();
|
|
2098
2091
|
}
|
|
2099
|
-
},
|
|
2092
|
+
}, _callee20, this, [[1, 7]]);
|
|
2100
2093
|
}));
|
|
2101
|
-
function onCustomerLogin(
|
|
2094
|
+
function onCustomerLogin(_x13) {
|
|
2102
2095
|
return _onCustomerLogin.apply(this, arguments);
|
|
2103
2096
|
}
|
|
2104
2097
|
return onCustomerLogin;
|
|
@@ -2173,30 +2166,30 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2173
2166
|
}, {
|
|
2174
2167
|
key: "scanCode",
|
|
2175
2168
|
value: function () {
|
|
2176
|
-
var _scanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2169
|
+
var _scanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(code, customerId) {
|
|
2177
2170
|
var result;
|
|
2178
|
-
return _regeneratorRuntime().wrap(function
|
|
2179
|
-
while (1) switch (
|
|
2171
|
+
return _regeneratorRuntime().wrap(function _callee21$(_context21) {
|
|
2172
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
2180
2173
|
case 0:
|
|
2181
2174
|
this.logMethodStart('scanCode', {
|
|
2182
2175
|
code: code
|
|
2183
2176
|
});
|
|
2184
|
-
|
|
2177
|
+
_context21.prev = 1;
|
|
2185
2178
|
if (this.store.order) {
|
|
2186
|
-
|
|
2179
|
+
_context21.next = 4;
|
|
2187
2180
|
break;
|
|
2188
2181
|
}
|
|
2189
2182
|
throw new Error('order 模块未初始化');
|
|
2190
2183
|
case 4:
|
|
2191
|
-
|
|
2184
|
+
_context21.next = 6;
|
|
2192
2185
|
return this.store.order.scanCode(code, customerId);
|
|
2193
2186
|
case 6:
|
|
2194
|
-
result =
|
|
2187
|
+
result = _context21.sent;
|
|
2195
2188
|
if (!result.isAvailable) {
|
|
2196
|
-
|
|
2189
|
+
_context21.next = 11;
|
|
2197
2190
|
break;
|
|
2198
2191
|
}
|
|
2199
|
-
|
|
2192
|
+
_context21.next = 10;
|
|
2200
2193
|
return this.store.order.recalculateSummary({
|
|
2201
2194
|
createIfMissing: true
|
|
2202
2195
|
});
|
|
@@ -2206,19 +2199,19 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2206
2199
|
this.logMethodSuccess('scanCode', {
|
|
2207
2200
|
isAvailable: result.isAvailable
|
|
2208
2201
|
});
|
|
2209
|
-
return
|
|
2202
|
+
return _context21.abrupt("return", result);
|
|
2210
2203
|
case 15:
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
this.logMethodError('scanCode',
|
|
2214
|
-
throw
|
|
2204
|
+
_context21.prev = 15;
|
|
2205
|
+
_context21.t0 = _context21["catch"](1);
|
|
2206
|
+
this.logMethodError('scanCode', _context21.t0);
|
|
2207
|
+
throw _context21.t0;
|
|
2215
2208
|
case 19:
|
|
2216
2209
|
case "end":
|
|
2217
|
-
return
|
|
2210
|
+
return _context21.stop();
|
|
2218
2211
|
}
|
|
2219
|
-
},
|
|
2212
|
+
}, _callee21, this, [[1, 15]]);
|
|
2220
2213
|
}));
|
|
2221
|
-
function scanCode(
|
|
2214
|
+
function scanCode(_x14, _x15) {
|
|
2222
2215
|
return _scanCode.apply(this, arguments);
|
|
2223
2216
|
}
|
|
2224
2217
|
return scanCode;
|
|
@@ -2234,15 +2227,15 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2234
2227
|
}, {
|
|
2235
2228
|
key: "setDiscountSelected",
|
|
2236
2229
|
value: (function () {
|
|
2237
|
-
var _setDiscountSelected = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2230
|
+
var _setDiscountSelected = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(params) {
|
|
2238
2231
|
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
|
|
2240
|
-
while (1) switch (
|
|
2232
|
+
return _regeneratorRuntime().wrap(function _callee22$(_context22) {
|
|
2233
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
2241
2234
|
case 0:
|
|
2242
2235
|
this.logMethodStart('setDiscountSelected', params);
|
|
2243
|
-
|
|
2236
|
+
_context22.prev = 1;
|
|
2244
2237
|
if (this.store.order) {
|
|
2245
|
-
|
|
2238
|
+
_context22.next = 4;
|
|
2246
2239
|
break;
|
|
2247
2240
|
}
|
|
2248
2241
|
throw new Error('order 模块未初始化');
|
|
@@ -2268,7 +2261,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2268
2261
|
form_record_id: tempOrder.holder.form_record_id
|
|
2269
2262
|
}] : [];
|
|
2270
2263
|
nextDiscountList = updated;
|
|
2271
|
-
|
|
2264
|
+
_context22.next = 16;
|
|
2272
2265
|
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(updated);
|
|
2273
2266
|
case 16:
|
|
2274
2267
|
if (rulesModule) {
|
|
@@ -2320,19 +2313,19 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2320
2313
|
// 目的:避免 unselect 后 selling_price 残留、reselect 时把残留价带进下一轮 Rules 造成双折扣。
|
|
2321
2314
|
// 手动改价商品(_origin.isManualDiscount=true)不参与券流程归一化,保留手工价。
|
|
2322
2315
|
_iterator15 = _createForOfIteratorHelper(tempOrder.products);
|
|
2323
|
-
|
|
2316
|
+
_context22.prev = 19;
|
|
2324
2317
|
_iterator15.s();
|
|
2325
2318
|
case 21:
|
|
2326
2319
|
if ((_step15 = _iterator15.n()).done) {
|
|
2327
|
-
|
|
2320
|
+
_context22.next = 35;
|
|
2328
2321
|
break;
|
|
2329
2322
|
}
|
|
2330
2323
|
product = _step15.value;
|
|
2331
2324
|
if (!((_product$_origin = product._origin) !== null && _product$_origin !== void 0 && _product$_origin.isManualDiscount)) {
|
|
2332
|
-
|
|
2325
|
+
_context22.next = 25;
|
|
2333
2326
|
break;
|
|
2334
2327
|
}
|
|
2335
|
-
return
|
|
2328
|
+
return _context22.abrupt("continue", 33);
|
|
2336
2329
|
case 25:
|
|
2337
2330
|
// 1. 把 product.discount_list 和当前选中的 discount 对齐(剔除已取消的券)
|
|
2338
2331
|
product.discount_list = (product.discount_list || []).filter(function (pd) {
|
|
@@ -2359,22 +2352,22 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2359
2352
|
bundle: product.product_bundle
|
|
2360
2353
|
});
|
|
2361
2354
|
case 33:
|
|
2362
|
-
|
|
2355
|
+
_context22.next = 21;
|
|
2363
2356
|
break;
|
|
2364
2357
|
case 35:
|
|
2365
|
-
|
|
2358
|
+
_context22.next = 40;
|
|
2366
2359
|
break;
|
|
2367
2360
|
case 37:
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
_iterator15.e(
|
|
2361
|
+
_context22.prev = 37;
|
|
2362
|
+
_context22.t0 = _context22["catch"](19);
|
|
2363
|
+
_iterator15.e(_context22.t0);
|
|
2371
2364
|
case 40:
|
|
2372
|
-
|
|
2365
|
+
_context22.prev = 40;
|
|
2373
2366
|
_iterator15.f();
|
|
2374
|
-
return
|
|
2367
|
+
return _context22.finish(40);
|
|
2375
2368
|
case 43:
|
|
2376
2369
|
OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
|
|
2377
|
-
|
|
2370
|
+
_context22.next = 46;
|
|
2378
2371
|
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
|
|
2379
2372
|
case 46:
|
|
2380
2373
|
tempOrder.discount_list = (nextDiscountList || []).filter(function (d) {
|
|
@@ -2383,7 +2376,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2383
2376
|
afterApplyTarget = this.store.order.getDiscountList().find(function (d) {
|
|
2384
2377
|
return d.id === params.discountId;
|
|
2385
2378
|
}) || null;
|
|
2386
|
-
|
|
2379
|
+
_context22.next = 50;
|
|
2387
2380
|
return this.store.order.recalculateSummary({
|
|
2388
2381
|
createIfMissing: true
|
|
2389
2382
|
});
|
|
@@ -2395,19 +2388,19 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2395
2388
|
finalTarget = this.store.order.getDiscountList().find(function (d) {
|
|
2396
2389
|
return d.id === params.discountId;
|
|
2397
2390
|
}) || null;
|
|
2398
|
-
return
|
|
2391
|
+
return _context22.abrupt("return", this.store.order.getDiscountList());
|
|
2399
2392
|
case 58:
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
this.logMethodError('setDiscountSelected',
|
|
2403
|
-
throw
|
|
2393
|
+
_context22.prev = 58;
|
|
2394
|
+
_context22.t1 = _context22["catch"](1);
|
|
2395
|
+
this.logMethodError('setDiscountSelected', _context22.t1);
|
|
2396
|
+
throw _context22.t1;
|
|
2404
2397
|
case 62:
|
|
2405
2398
|
case "end":
|
|
2406
|
-
return
|
|
2399
|
+
return _context22.stop();
|
|
2407
2400
|
}
|
|
2408
|
-
},
|
|
2401
|
+
}, _callee22, this, [[1, 58], [19, 37, 40, 43]]);
|
|
2409
2402
|
}));
|
|
2410
|
-
function setDiscountSelected(
|
|
2403
|
+
function setDiscountSelected(_x16) {
|
|
2411
2404
|
return _setDiscountSelected.apply(this, arguments);
|
|
2412
2405
|
}
|
|
2413
2406
|
return setDiscountSelected;
|
|
@@ -2415,37 +2408,37 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2415
2408
|
}, {
|
|
2416
2409
|
key: "addNewOrder",
|
|
2417
2410
|
value: function () {
|
|
2418
|
-
var _addNewOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2411
|
+
var _addNewOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23() {
|
|
2419
2412
|
var tempOrder;
|
|
2420
|
-
return _regeneratorRuntime().wrap(function
|
|
2421
|
-
while (1) switch (
|
|
2413
|
+
return _regeneratorRuntime().wrap(function _callee23$(_context23) {
|
|
2414
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
2422
2415
|
case 0:
|
|
2423
2416
|
this.logMethodStart('addNewOrder');
|
|
2424
|
-
|
|
2417
|
+
_context23.prev = 1;
|
|
2425
2418
|
if (this.store.order) {
|
|
2426
|
-
|
|
2419
|
+
_context23.next = 4;
|
|
2427
2420
|
break;
|
|
2428
2421
|
}
|
|
2429
2422
|
throw new Error('order 模块未初始化');
|
|
2430
2423
|
case 4:
|
|
2431
|
-
|
|
2424
|
+
_context23.next = 6;
|
|
2432
2425
|
return this.store.order.addNewOrder();
|
|
2433
2426
|
case 6:
|
|
2434
|
-
tempOrder =
|
|
2427
|
+
tempOrder = _context23.sent;
|
|
2435
2428
|
this.logMethodSuccess('addNewOrder', {
|
|
2436
2429
|
productCount: tempOrder.products.length
|
|
2437
2430
|
});
|
|
2438
|
-
return
|
|
2431
|
+
return _context23.abrupt("return", tempOrder);
|
|
2439
2432
|
case 11:
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
this.logMethodError('addNewOrder',
|
|
2443
|
-
throw
|
|
2433
|
+
_context23.prev = 11;
|
|
2434
|
+
_context23.t0 = _context23["catch"](1);
|
|
2435
|
+
this.logMethodError('addNewOrder', _context23.t0);
|
|
2436
|
+
throw _context23.t0;
|
|
2444
2437
|
case 15:
|
|
2445
2438
|
case "end":
|
|
2446
|
-
return
|
|
2439
|
+
return _context23.stop();
|
|
2447
2440
|
}
|
|
2448
|
-
},
|
|
2441
|
+
}, _callee23, this, [[1, 11]]);
|
|
2449
2442
|
}));
|
|
2450
2443
|
function addNewOrder() {
|
|
2451
2444
|
return _addNewOrder.apply(this, arguments);
|
|
@@ -2461,37 +2454,37 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2461
2454
|
}, {
|
|
2462
2455
|
key: "getSummary",
|
|
2463
2456
|
value: function () {
|
|
2464
|
-
var _getSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2457
|
+
var _getSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
|
|
2465
2458
|
var summary;
|
|
2466
|
-
return _regeneratorRuntime().wrap(function
|
|
2467
|
-
while (1) switch (
|
|
2459
|
+
return _regeneratorRuntime().wrap(function _callee24$(_context24) {
|
|
2460
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
2468
2461
|
case 0:
|
|
2469
2462
|
this.logMethodStart('getSummary');
|
|
2470
|
-
|
|
2463
|
+
_context24.prev = 1;
|
|
2471
2464
|
if (this.store.order) {
|
|
2472
|
-
|
|
2465
|
+
_context24.next = 4;
|
|
2473
2466
|
break;
|
|
2474
2467
|
}
|
|
2475
2468
|
throw new Error('order 模块未初始化');
|
|
2476
2469
|
case 4:
|
|
2477
|
-
|
|
2470
|
+
_context24.next = 6;
|
|
2478
2471
|
return this.store.order.getScanOrderSummary();
|
|
2479
2472
|
case 6:
|
|
2480
|
-
summary =
|
|
2473
|
+
summary = _context24.sent;
|
|
2481
2474
|
this.logMethodSuccess('getSummary', {
|
|
2482
2475
|
totalAmount: summary.total_amount
|
|
2483
2476
|
});
|
|
2484
|
-
return
|
|
2477
|
+
return _context24.abrupt("return", summary);
|
|
2485
2478
|
case 11:
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
this.logMethodError('getSummary',
|
|
2489
|
-
throw
|
|
2479
|
+
_context24.prev = 11;
|
|
2480
|
+
_context24.t0 = _context24["catch"](1);
|
|
2481
|
+
this.logMethodError('getSummary', _context24.t0);
|
|
2482
|
+
throw _context24.t0;
|
|
2490
2483
|
case 15:
|
|
2491
2484
|
case "end":
|
|
2492
|
-
return
|
|
2485
|
+
return _context24.stop();
|
|
2493
2486
|
}
|
|
2494
|
-
},
|
|
2487
|
+
}, _callee24, this, [[1, 11]]);
|
|
2495
2488
|
}));
|
|
2496
2489
|
function getSummary() {
|
|
2497
2490
|
return _getSummary.apply(this, arguments);
|
|
@@ -2501,23 +2494,23 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2501
2494
|
}, {
|
|
2502
2495
|
key: "submitOrder",
|
|
2503
2496
|
value: function () {
|
|
2504
|
-
var _submitOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2497
|
+
var _submitOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
|
|
2505
2498
|
var _this$otherParams11, _this$otherParams12, _this$otherParams13, _this$otherParams14, _tempOrder$products2, result, tempOrder;
|
|
2506
|
-
return _regeneratorRuntime().wrap(function
|
|
2507
|
-
while (1) switch (
|
|
2499
|
+
return _regeneratorRuntime().wrap(function _callee25$(_context25) {
|
|
2500
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
2508
2501
|
case 0:
|
|
2509
2502
|
this.logMethodStart('submitOrder');
|
|
2510
|
-
|
|
2511
|
-
|
|
2503
|
+
_context25.prev = 1;
|
|
2504
|
+
_context25.next = 4;
|
|
2512
2505
|
return this.validateBeforeSubmitByItemRule();
|
|
2513
2506
|
case 4:
|
|
2514
2507
|
if (this.store.order) {
|
|
2515
|
-
|
|
2508
|
+
_context25.next = 6;
|
|
2516
2509
|
break;
|
|
2517
2510
|
}
|
|
2518
2511
|
throw new Error('venueBooking解决方案需要 order 模块支持');
|
|
2519
2512
|
case 6:
|
|
2520
|
-
|
|
2513
|
+
_context25.next = 8;
|
|
2521
2514
|
return this.store.order.submitTempOrder({
|
|
2522
2515
|
cacheId: this.cacheId,
|
|
2523
2516
|
platform: (_this$otherParams11 = this.otherParams) === null || _this$otherParams11 === void 0 ? void 0 : _this$otherParams11.platform,
|
|
@@ -2526,22 +2519,22 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2526
2519
|
type: (_this$otherParams14 = this.otherParams) === null || _this$otherParams14 === void 0 ? void 0 : _this$otherParams14.type
|
|
2527
2520
|
});
|
|
2528
2521
|
case 8:
|
|
2529
|
-
result =
|
|
2522
|
+
result = _context25.sent;
|
|
2530
2523
|
tempOrder = this.store.order.getTempOrder();
|
|
2531
2524
|
this.logMethodSuccess('submitOrder', {
|
|
2532
2525
|
productCount: (tempOrder === null || tempOrder === void 0 || (_tempOrder$products2 = tempOrder.products) === null || _tempOrder$products2 === void 0 ? void 0 : _tempOrder$products2.length) || 0
|
|
2533
2526
|
});
|
|
2534
|
-
return
|
|
2527
|
+
return _context25.abrupt("return", result);
|
|
2535
2528
|
case 14:
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
this.logMethodError('submitOrder',
|
|
2539
|
-
throw
|
|
2529
|
+
_context25.prev = 14;
|
|
2530
|
+
_context25.t0 = _context25["catch"](1);
|
|
2531
|
+
this.logMethodError('submitOrder', _context25.t0);
|
|
2532
|
+
throw _context25.t0;
|
|
2540
2533
|
case 18:
|
|
2541
2534
|
case "end":
|
|
2542
|
-
return
|
|
2535
|
+
return _context25.stop();
|
|
2543
2536
|
}
|
|
2544
|
-
},
|
|
2537
|
+
}, _callee25, this, [[1, 14]]);
|
|
2545
2538
|
}));
|
|
2546
2539
|
function submitOrder() {
|
|
2547
2540
|
return _submitOrder.apply(this, arguments);
|
|
@@ -2551,18 +2544,18 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2551
2544
|
}, {
|
|
2552
2545
|
key: "addProductToOrder",
|
|
2553
2546
|
value: function () {
|
|
2554
|
-
var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2547
|
+
var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(product) {
|
|
2555
2548
|
var _product$metadata5, _product$product_vari2, quotationPrice, products;
|
|
2556
|
-
return _regeneratorRuntime().wrap(function
|
|
2557
|
-
while (1) switch (
|
|
2549
|
+
return _regeneratorRuntime().wrap(function _callee26$(_context26) {
|
|
2550
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
2558
2551
|
case 0:
|
|
2559
2552
|
this.logMethodStart('addProductToOrder', {
|
|
2560
2553
|
product_id: product.product_id,
|
|
2561
2554
|
product_variant_id: product.product_variant_id
|
|
2562
2555
|
});
|
|
2563
|
-
|
|
2556
|
+
_context26.prev = 1;
|
|
2564
2557
|
if (this.store.order) {
|
|
2565
|
-
|
|
2558
|
+
_context26.next = 4;
|
|
2566
2559
|
break;
|
|
2567
2560
|
}
|
|
2568
2561
|
throw new Error('order 模块未初始化');
|
|
@@ -2580,32 +2573,32 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2580
2573
|
product.original_price = product.selling_price;
|
|
2581
2574
|
}
|
|
2582
2575
|
}
|
|
2583
|
-
|
|
2576
|
+
_context26.next = 7;
|
|
2584
2577
|
return this.store.order.addProductToOrder(product);
|
|
2585
2578
|
case 7:
|
|
2586
|
-
products =
|
|
2587
|
-
|
|
2579
|
+
products = _context26.sent;
|
|
2580
|
+
_context26.next = 10;
|
|
2588
2581
|
return this.refreshItemRuleQuantityLimits();
|
|
2589
2582
|
case 10:
|
|
2590
|
-
|
|
2583
|
+
_context26.next = 12;
|
|
2591
2584
|
return this.refreshCartValidationPassed();
|
|
2592
2585
|
case 12:
|
|
2593
2586
|
this.logMethodSuccess('addProductToOrder', {
|
|
2594
2587
|
productCount: products.length
|
|
2595
2588
|
});
|
|
2596
|
-
return
|
|
2589
|
+
return _context26.abrupt("return", products);
|
|
2597
2590
|
case 16:
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
this.logMethodError('addProductToOrder',
|
|
2601
|
-
throw
|
|
2591
|
+
_context26.prev = 16;
|
|
2592
|
+
_context26.t0 = _context26["catch"](1);
|
|
2593
|
+
this.logMethodError('addProductToOrder', _context26.t0);
|
|
2594
|
+
throw _context26.t0;
|
|
2602
2595
|
case 20:
|
|
2603
2596
|
case "end":
|
|
2604
|
-
return
|
|
2597
|
+
return _context26.stop();
|
|
2605
2598
|
}
|
|
2606
|
-
},
|
|
2599
|
+
}, _callee26, this, [[1, 16]]);
|
|
2607
2600
|
}));
|
|
2608
|
-
function addProductToOrder(
|
|
2601
|
+
function addProductToOrder(_x17) {
|
|
2609
2602
|
return _addProductToOrder.apply(this, arguments);
|
|
2610
2603
|
}
|
|
2611
2604
|
return addProductToOrder;
|
|
@@ -2613,48 +2606,48 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2613
2606
|
}, {
|
|
2614
2607
|
key: "updateProductInOrder",
|
|
2615
2608
|
value: function () {
|
|
2616
|
-
var _updateProductInOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2609
|
+
var _updateProductInOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(params) {
|
|
2617
2610
|
var products;
|
|
2618
|
-
return _regeneratorRuntime().wrap(function
|
|
2619
|
-
while (1) switch (
|
|
2611
|
+
return _regeneratorRuntime().wrap(function _callee27$(_context27) {
|
|
2612
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
2620
2613
|
case 0:
|
|
2621
2614
|
this.logMethodStart('updateProductInOrder', {
|
|
2622
2615
|
product_id: params.product_id,
|
|
2623
2616
|
product_variant_id: params.product_variant_id
|
|
2624
2617
|
});
|
|
2625
|
-
|
|
2618
|
+
_context27.prev = 1;
|
|
2626
2619
|
if (this.store.order) {
|
|
2627
|
-
|
|
2620
|
+
_context27.next = 4;
|
|
2628
2621
|
break;
|
|
2629
2622
|
}
|
|
2630
2623
|
throw new Error('order 模块未初始化');
|
|
2631
2624
|
case 4:
|
|
2632
|
-
|
|
2625
|
+
_context27.next = 6;
|
|
2633
2626
|
return this.store.order.updateProductInOrder(params);
|
|
2634
2627
|
case 6:
|
|
2635
|
-
products =
|
|
2636
|
-
|
|
2628
|
+
products = _context27.sent;
|
|
2629
|
+
_context27.next = 9;
|
|
2637
2630
|
return this.refreshItemRuleQuantityLimits();
|
|
2638
2631
|
case 9:
|
|
2639
|
-
|
|
2632
|
+
_context27.next = 11;
|
|
2640
2633
|
return this.refreshCartValidationPassed();
|
|
2641
2634
|
case 11:
|
|
2642
2635
|
this.logMethodSuccess('updateProductInOrder', {
|
|
2643
2636
|
productCount: products.length
|
|
2644
2637
|
});
|
|
2645
|
-
return
|
|
2638
|
+
return _context27.abrupt("return", products);
|
|
2646
2639
|
case 15:
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
this.logMethodError('updateProductInOrder',
|
|
2650
|
-
throw
|
|
2640
|
+
_context27.prev = 15;
|
|
2641
|
+
_context27.t0 = _context27["catch"](1);
|
|
2642
|
+
this.logMethodError('updateProductInOrder', _context27.t0);
|
|
2643
|
+
throw _context27.t0;
|
|
2651
2644
|
case 19:
|
|
2652
2645
|
case "end":
|
|
2653
|
-
return
|
|
2646
|
+
return _context27.stop();
|
|
2654
2647
|
}
|
|
2655
|
-
},
|
|
2648
|
+
}, _callee27, this, [[1, 15]]);
|
|
2656
2649
|
}));
|
|
2657
|
-
function updateProductInOrder(
|
|
2650
|
+
function updateProductInOrder(_x18) {
|
|
2658
2651
|
return _updateProductInOrder.apply(this, arguments);
|
|
2659
2652
|
}
|
|
2660
2653
|
return updateProductInOrder;
|
|
@@ -2662,66 +2655,66 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2662
2655
|
}, {
|
|
2663
2656
|
key: "removeProductFromOrder",
|
|
2664
2657
|
value: function () {
|
|
2665
|
-
var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2666
|
-
var _this$store$order$get3, _this$store$
|
|
2667
|
-
return _regeneratorRuntime().wrap(function
|
|
2668
|
-
while (1) switch (
|
|
2658
|
+
var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(identity) {
|
|
2659
|
+
var _this$store$order$get3, _this$store$order8, _this$store$order$ens, _this$store$order9, _tempOrder$bookings, tempOrder, products, _tempOrder$bookings2, _tempOrder$bookings3, venueProductUids, venueBookingUids, _iterator16, _step16, _product$metadata6, _product$metadata7, product, beforeBookingCount, _this$store$order$per, _this$store$order10;
|
|
2660
|
+
return _regeneratorRuntime().wrap(function _callee28$(_context28) {
|
|
2661
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
2669
2662
|
case 0:
|
|
2670
2663
|
this.logMethodStart('removeProductFromOrder', {
|
|
2671
2664
|
product_id: identity.product_id,
|
|
2672
2665
|
product_variant_id: identity.product_variant_id
|
|
2673
2666
|
});
|
|
2674
|
-
|
|
2667
|
+
_context28.prev = 1;
|
|
2675
2668
|
if (this.store.order) {
|
|
2676
|
-
|
|
2669
|
+
_context28.next = 4;
|
|
2677
2670
|
break;
|
|
2678
2671
|
}
|
|
2679
2672
|
throw new Error('order 模块未初始化');
|
|
2680
2673
|
case 4:
|
|
2681
|
-
tempOrder = ((_this$store$order$get3 = (_this$store$
|
|
2682
|
-
|
|
2674
|
+
tempOrder = ((_this$store$order$get3 = (_this$store$order8 = this.store.order).getTempOrder) === null || _this$store$order$get3 === void 0 ? void 0 : _this$store$order$get3.call(_this$store$order8)) || ((_this$store$order$ens = (_this$store$order9 = this.store.order).ensureTempOrder) === null || _this$store$order$ens === void 0 ? void 0 : _this$store$order$ens.call(_this$store$order9));
|
|
2675
|
+
_context28.next = 7;
|
|
2683
2676
|
return this.store.order.removeProductFromOrder(identity);
|
|
2684
2677
|
case 7:
|
|
2685
|
-
products =
|
|
2678
|
+
products = _context28.sent;
|
|
2686
2679
|
if (!(tempOrder !== null && tempOrder !== void 0 && (_tempOrder$bookings = tempOrder.bookings) !== null && _tempOrder$bookings !== void 0 && _tempOrder$bookings.length)) {
|
|
2687
|
-
|
|
2680
|
+
_context28.next = 33;
|
|
2688
2681
|
break;
|
|
2689
2682
|
}
|
|
2690
2683
|
venueProductUids = new Set();
|
|
2691
2684
|
venueBookingUids = new Set();
|
|
2692
2685
|
_iterator16 = _createForOfIteratorHelper(tempOrder.products || []);
|
|
2693
|
-
|
|
2686
|
+
_context28.prev = 12;
|
|
2694
2687
|
_iterator16.s();
|
|
2695
2688
|
case 14:
|
|
2696
2689
|
if ((_step16 = _iterator16.n()).done) {
|
|
2697
|
-
|
|
2690
|
+
_context28.next = 22;
|
|
2698
2691
|
break;
|
|
2699
2692
|
}
|
|
2700
2693
|
product = _step16.value;
|
|
2701
2694
|
if (product !== null && product !== void 0 && (_product$metadata6 = product.metadata) !== null && _product$metadata6 !== void 0 && _product$metadata6.venue_booking) {
|
|
2702
|
-
|
|
2695
|
+
_context28.next = 18;
|
|
2703
2696
|
break;
|
|
2704
2697
|
}
|
|
2705
|
-
return
|
|
2698
|
+
return _context28.abrupt("continue", 20);
|
|
2706
2699
|
case 18:
|
|
2707
2700
|
if (product.identity_key) venueProductUids.add(String(product.identity_key));
|
|
2708
2701
|
if ((_product$metadata7 = product.metadata) !== null && _product$metadata7 !== void 0 && _product$metadata7.booking_uid) {
|
|
2709
2702
|
venueBookingUids.add(String(product.metadata.booking_uid));
|
|
2710
2703
|
}
|
|
2711
2704
|
case 20:
|
|
2712
|
-
|
|
2705
|
+
_context28.next = 14;
|
|
2713
2706
|
break;
|
|
2714
2707
|
case 22:
|
|
2715
|
-
|
|
2708
|
+
_context28.next = 27;
|
|
2716
2709
|
break;
|
|
2717
2710
|
case 24:
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
_iterator16.e(
|
|
2711
|
+
_context28.prev = 24;
|
|
2712
|
+
_context28.t0 = _context28["catch"](12);
|
|
2713
|
+
_iterator16.e(_context28.t0);
|
|
2721
2714
|
case 27:
|
|
2722
|
-
|
|
2715
|
+
_context28.prev = 27;
|
|
2723
2716
|
_iterator16.f();
|
|
2724
|
-
return
|
|
2717
|
+
return _context28.finish(27);
|
|
2725
2718
|
case 30:
|
|
2726
2719
|
beforeBookingCount = ((_tempOrder$bookings2 = tempOrder.bookings) === null || _tempOrder$bookings2 === void 0 ? void 0 : _tempOrder$bookings2.length) || 0;
|
|
2727
2720
|
tempOrder.bookings = (tempOrder.bookings || []).filter(function (booking) {
|
|
@@ -2735,31 +2728,31 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2735
2728
|
return true;
|
|
2736
2729
|
});
|
|
2737
2730
|
if ((((_tempOrder$bookings3 = tempOrder.bookings) === null || _tempOrder$bookings3 === void 0 ? void 0 : _tempOrder$bookings3.length) || 0) !== beforeBookingCount) {
|
|
2738
|
-
(_this$store$order$per = (_this$store$
|
|
2731
|
+
(_this$store$order$per = (_this$store$order10 = this.store.order).persistTempOrder) === null || _this$store$order$per === void 0 || _this$store$order$per.call(_this$store$order10);
|
|
2739
2732
|
}
|
|
2740
2733
|
case 33:
|
|
2741
|
-
|
|
2734
|
+
_context28.next = 35;
|
|
2742
2735
|
return this.refreshItemRuleQuantityLimits();
|
|
2743
2736
|
case 35:
|
|
2744
|
-
|
|
2737
|
+
_context28.next = 37;
|
|
2745
2738
|
return this.refreshCartValidationPassed();
|
|
2746
2739
|
case 37:
|
|
2747
2740
|
this.logMethodSuccess('removeProductFromOrder', {
|
|
2748
2741
|
productCount: products.length
|
|
2749
2742
|
});
|
|
2750
|
-
return
|
|
2743
|
+
return _context28.abrupt("return", products);
|
|
2751
2744
|
case 41:
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
this.logMethodError('removeProductFromOrder',
|
|
2755
|
-
throw
|
|
2745
|
+
_context28.prev = 41;
|
|
2746
|
+
_context28.t1 = _context28["catch"](1);
|
|
2747
|
+
this.logMethodError('removeProductFromOrder', _context28.t1);
|
|
2748
|
+
throw _context28.t1;
|
|
2756
2749
|
case 45:
|
|
2757
2750
|
case "end":
|
|
2758
|
-
return
|
|
2751
|
+
return _context28.stop();
|
|
2759
2752
|
}
|
|
2760
|
-
},
|
|
2753
|
+
}, _callee28, this, [[1, 41], [12, 24, 27, 30]]);
|
|
2761
2754
|
}));
|
|
2762
|
-
function removeProductFromOrder(
|
|
2755
|
+
function removeProductFromOrder(_x19) {
|
|
2763
2756
|
return _removeProductFromOrder.apply(this, arguments);
|
|
2764
2757
|
}
|
|
2765
2758
|
return removeProductFromOrder;
|
|
@@ -2767,27 +2760,27 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2767
2760
|
}, {
|
|
2768
2761
|
key: "getProductList",
|
|
2769
2762
|
value: function () {
|
|
2770
|
-
var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2763
|
+
var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29() {
|
|
2771
2764
|
var result;
|
|
2772
|
-
return _regeneratorRuntime().wrap(function
|
|
2773
|
-
while (1) switch (
|
|
2765
|
+
return _regeneratorRuntime().wrap(function _callee29$(_context29) {
|
|
2766
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
2774
2767
|
case 0:
|
|
2775
2768
|
if (!this.productsLoaded) {
|
|
2776
|
-
|
|
2769
|
+
_context29.next = 2;
|
|
2777
2770
|
break;
|
|
2778
2771
|
}
|
|
2779
|
-
return
|
|
2772
|
+
return _context29.abrupt("return", attachItemRuleLimitsToTopLevelProducts(this.getAddonProductsList(), this.store.itemRuleQuantityLimits || []));
|
|
2780
2773
|
case 2:
|
|
2781
|
-
|
|
2774
|
+
_context29.next = 4;
|
|
2782
2775
|
return this.loadAllProducts();
|
|
2783
2776
|
case 4:
|
|
2784
|
-
result =
|
|
2785
|
-
return
|
|
2777
|
+
result = _context29.sent;
|
|
2778
|
+
return _context29.abrupt("return", attachItemRuleLimitsToTopLevelProducts(result.addonProducts, this.store.itemRuleQuantityLimits || []));
|
|
2786
2779
|
case 6:
|
|
2787
2780
|
case "end":
|
|
2788
|
-
return
|
|
2781
|
+
return _context29.stop();
|
|
2789
2782
|
}
|
|
2790
|
-
},
|
|
2783
|
+
}, _callee29, this);
|
|
2791
2784
|
}));
|
|
2792
2785
|
function getProductList() {
|
|
2793
2786
|
return _getProductList.apply(this, arguments);
|
|
@@ -2797,13 +2790,13 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2797
2790
|
}, {
|
|
2798
2791
|
key: "loadOpenDataConfig",
|
|
2799
2792
|
value: function () {
|
|
2800
|
-
var _loadOpenDataConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2793
|
+
var _loadOpenDataConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30() {
|
|
2801
2794
|
var lastFetchedAt, cachedData, openDataConfig;
|
|
2802
|
-
return _regeneratorRuntime().wrap(function
|
|
2803
|
-
while (1) switch (
|
|
2795
|
+
return _regeneratorRuntime().wrap(function _callee30$(_context30) {
|
|
2796
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
2804
2797
|
case 0:
|
|
2805
2798
|
if (this.store.openData) {
|
|
2806
|
-
|
|
2799
|
+
_context30.next = 2;
|
|
2807
2800
|
break;
|
|
2808
2801
|
}
|
|
2809
2802
|
throw new Error('openData 模块未初始化');
|
|
@@ -2811,42 +2804,42 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2811
2804
|
lastFetchedAt = this.store.openData.getLastFetchedAt();
|
|
2812
2805
|
cachedData = this.store.openData.getOpenData();
|
|
2813
2806
|
if (!(cachedData && lastFetchedAt && Date.now() - lastFetchedAt < VenueBookingImpl.OPEN_DATA_CACHE_TTL)) {
|
|
2814
|
-
|
|
2807
|
+
_context30.next = 7;
|
|
2815
2808
|
break;
|
|
2816
2809
|
}
|
|
2817
2810
|
this.otherParams.openData = cachedData;
|
|
2818
|
-
return
|
|
2811
|
+
return _context30.abrupt("return", cachedData);
|
|
2819
2812
|
case 7:
|
|
2820
2813
|
if (!this.loadOpenDataConfigInFlight) {
|
|
2821
|
-
|
|
2814
|
+
_context30.next = 11;
|
|
2822
2815
|
break;
|
|
2823
2816
|
}
|
|
2824
|
-
|
|
2817
|
+
_context30.next = 10;
|
|
2825
2818
|
return this.loadOpenDataConfigInFlight;
|
|
2826
2819
|
case 10:
|
|
2827
|
-
return
|
|
2820
|
+
return _context30.abrupt("return", _context30.sent);
|
|
2828
2821
|
case 11:
|
|
2829
2822
|
this.loadOpenDataConfigInFlight = this.store.openData.fetchOpenData({
|
|
2830
2823
|
scope: 'board',
|
|
2831
2824
|
target: 'venue_booking+online_store',
|
|
2832
2825
|
section_code: [].concat(OPEN_DATA_SECTION_CODES)
|
|
2833
2826
|
});
|
|
2834
|
-
|
|
2835
|
-
|
|
2827
|
+
_context30.prev = 12;
|
|
2828
|
+
_context30.next = 15;
|
|
2836
2829
|
return this.loadOpenDataConfigInFlight;
|
|
2837
2830
|
case 15:
|
|
2838
|
-
openDataConfig =
|
|
2831
|
+
openDataConfig = _context30.sent;
|
|
2839
2832
|
this.otherParams.openData = openDataConfig;
|
|
2840
|
-
return
|
|
2833
|
+
return _context30.abrupt("return", openDataConfig);
|
|
2841
2834
|
case 18:
|
|
2842
|
-
|
|
2835
|
+
_context30.prev = 18;
|
|
2843
2836
|
this.loadOpenDataConfigInFlight = null;
|
|
2844
|
-
return
|
|
2837
|
+
return _context30.finish(18);
|
|
2845
2838
|
case 21:
|
|
2846
2839
|
case "end":
|
|
2847
|
-
return
|
|
2840
|
+
return _context30.stop();
|
|
2848
2841
|
}
|
|
2849
|
-
},
|
|
2842
|
+
}, _callee30, this, [[12,, 18, 21]]);
|
|
2850
2843
|
}));
|
|
2851
2844
|
function loadOpenDataConfig() {
|
|
2852
2845
|
return _loadOpenDataConfig.apply(this, arguments);
|
|
@@ -2856,29 +2849,29 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2856
2849
|
}, {
|
|
2857
2850
|
key: "loadRuntimeConfigs",
|
|
2858
2851
|
value: function () {
|
|
2859
|
-
var _loadRuntimeConfigs = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2852
|
+
var _loadRuntimeConfigs = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31() {
|
|
2860
2853
|
var itemRuleConfigs;
|
|
2861
|
-
return _regeneratorRuntime().wrap(function
|
|
2862
|
-
while (1) switch (
|
|
2854
|
+
return _regeneratorRuntime().wrap(function _callee31$(_context31) {
|
|
2855
|
+
while (1) switch (_context31.prev = _context31.next) {
|
|
2863
2856
|
case 0:
|
|
2864
|
-
|
|
2857
|
+
_context31.next = 2;
|
|
2865
2858
|
return this.loadOpenDataConfig();
|
|
2866
2859
|
case 2:
|
|
2867
|
-
|
|
2860
|
+
_context31.next = 4;
|
|
2868
2861
|
return this.ensureItemRuleConfigsLoaded();
|
|
2869
2862
|
case 4:
|
|
2870
|
-
itemRuleConfigs =
|
|
2863
|
+
itemRuleConfigs = _context31.sent;
|
|
2871
2864
|
this.logMethodSuccess('loadRuntimeConfigs', {
|
|
2872
2865
|
itemRuleCount: itemRuleConfigs.length
|
|
2873
2866
|
});
|
|
2874
|
-
return
|
|
2867
|
+
return _context31.abrupt("return", {
|
|
2875
2868
|
itemRuleConfigs: itemRuleConfigs
|
|
2876
2869
|
});
|
|
2877
2870
|
case 7:
|
|
2878
2871
|
case "end":
|
|
2879
|
-
return
|
|
2872
|
+
return _context31.stop();
|
|
2880
2873
|
}
|
|
2881
|
-
},
|
|
2874
|
+
}, _callee31, this);
|
|
2882
2875
|
}));
|
|
2883
2876
|
function loadRuntimeConfigs() {
|
|
2884
2877
|
return _loadRuntimeConfigs.apply(this, arguments);
|
|
@@ -2888,22 +2881,22 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2888
2881
|
}, {
|
|
2889
2882
|
key: "fetchItemRuleConfigsByModelIds",
|
|
2890
2883
|
value: function () {
|
|
2891
|
-
var _fetchItemRuleConfigsByModelIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2884
|
+
var _fetchItemRuleConfigsByModelIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(strategyModelIds) {
|
|
2892
2885
|
var result, configs;
|
|
2893
|
-
return _regeneratorRuntime().wrap(function
|
|
2894
|
-
while (1) switch (
|
|
2886
|
+
return _regeneratorRuntime().wrap(function _callee32$(_context32) {
|
|
2887
|
+
while (1) switch (_context32.prev = _context32.next) {
|
|
2895
2888
|
case 0:
|
|
2896
2889
|
this.logMethodStart('fetchItemRuleConfigsByModelIds', {
|
|
2897
2890
|
strategyModelIds: strategyModelIds
|
|
2898
2891
|
});
|
|
2899
2892
|
if (strategyModelIds.length) {
|
|
2900
|
-
|
|
2893
|
+
_context32.next = 3;
|
|
2901
2894
|
break;
|
|
2902
2895
|
}
|
|
2903
|
-
return
|
|
2896
|
+
return _context32.abrupt("return", []);
|
|
2904
2897
|
case 3:
|
|
2905
|
-
|
|
2906
|
-
|
|
2898
|
+
_context32.prev = 3;
|
|
2899
|
+
_context32.next = 6;
|
|
2907
2900
|
return this.request.get('/promotion', {
|
|
2908
2901
|
skip: 1,
|
|
2909
2902
|
num: 99,
|
|
@@ -2911,7 +2904,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2911
2904
|
ids: strategyModelIds
|
|
2912
2905
|
});
|
|
2913
2906
|
case 6:
|
|
2914
|
-
result =
|
|
2907
|
+
result = _context32.sent;
|
|
2915
2908
|
configs = [];
|
|
2916
2909
|
if (result.code === 200) {
|
|
2917
2910
|
configs = result.data.list.map(function (item) {
|
|
@@ -2922,21 +2915,21 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2922
2915
|
strategyModelIds: strategyModelIds,
|
|
2923
2916
|
strategyCount: configs.length
|
|
2924
2917
|
});
|
|
2925
|
-
return
|
|
2918
|
+
return _context32.abrupt("return", configs);
|
|
2926
2919
|
case 13:
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
this.logMethodError('fetchItemRuleConfigsByModelIds',
|
|
2920
|
+
_context32.prev = 13;
|
|
2921
|
+
_context32.t0 = _context32["catch"](3);
|
|
2922
|
+
this.logMethodError('fetchItemRuleConfigsByModelIds', _context32.t0, {
|
|
2930
2923
|
strategyModelIds: strategyModelIds
|
|
2931
2924
|
});
|
|
2932
|
-
return
|
|
2925
|
+
return _context32.abrupt("return", []);
|
|
2933
2926
|
case 17:
|
|
2934
2927
|
case "end":
|
|
2935
|
-
return
|
|
2928
|
+
return _context32.stop();
|
|
2936
2929
|
}
|
|
2937
|
-
},
|
|
2930
|
+
}, _callee32, this, [[3, 13]]);
|
|
2938
2931
|
}));
|
|
2939
|
-
function fetchItemRuleConfigsByModelIds(
|
|
2932
|
+
function fetchItemRuleConfigsByModelIds(_x20) {
|
|
2940
2933
|
return _fetchItemRuleConfigsByModelIds.apply(this, arguments);
|
|
2941
2934
|
}
|
|
2942
2935
|
return fetchItemRuleConfigsByModelIds;
|
|
@@ -2944,22 +2937,22 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2944
2937
|
}, {
|
|
2945
2938
|
key: "buildPrefillProductSourceMap",
|
|
2946
2939
|
value: function () {
|
|
2947
|
-
var _buildPrefillProductSourceMap = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2940
|
+
var _buildPrefillProductSourceMap = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33() {
|
|
2948
2941
|
var sourceMap, productList, visited, collectFromValue;
|
|
2949
|
-
return _regeneratorRuntime().wrap(function
|
|
2950
|
-
while (1) switch (
|
|
2942
|
+
return _regeneratorRuntime().wrap(function _callee33$(_context33) {
|
|
2943
|
+
while (1) switch (_context33.prev = _context33.next) {
|
|
2951
2944
|
case 0:
|
|
2952
2945
|
sourceMap = new Map();
|
|
2953
|
-
|
|
2954
|
-
|
|
2946
|
+
_context33.prev = 1;
|
|
2947
|
+
_context33.next = 4;
|
|
2955
2948
|
return this.getProductList();
|
|
2956
2949
|
case 4:
|
|
2957
|
-
productList =
|
|
2950
|
+
productList = _context33.sent;
|
|
2958
2951
|
if (Array.isArray(productList)) {
|
|
2959
|
-
|
|
2952
|
+
_context33.next = 7;
|
|
2960
2953
|
break;
|
|
2961
2954
|
}
|
|
2962
|
-
return
|
|
2955
|
+
return _context33.abrupt("return", sourceMap);
|
|
2963
2956
|
case 7:
|
|
2964
2957
|
visited = new Set();
|
|
2965
2958
|
collectFromValue = function collectFromValue(value) {
|
|
@@ -2998,19 +2991,19 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2998
2991
|
}
|
|
2999
2992
|
};
|
|
3000
2993
|
collectFromValue(productList);
|
|
3001
|
-
|
|
2994
|
+
_context33.next = 15;
|
|
3002
2995
|
break;
|
|
3003
2996
|
case 12:
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
this.logMethodError('buildPrefillProductSourceMap',
|
|
2997
|
+
_context33.prev = 12;
|
|
2998
|
+
_context33.t0 = _context33["catch"](1);
|
|
2999
|
+
this.logMethodError('buildPrefillProductSourceMap', _context33.t0);
|
|
3007
3000
|
case 15:
|
|
3008
|
-
return
|
|
3001
|
+
return _context33.abrupt("return", sourceMap);
|
|
3009
3002
|
case 16:
|
|
3010
3003
|
case "end":
|
|
3011
|
-
return
|
|
3004
|
+
return _context33.stop();
|
|
3012
3005
|
}
|
|
3013
|
-
},
|
|
3006
|
+
}, _callee33, this, [[1, 12]]);
|
|
3014
3007
|
}));
|
|
3015
3008
|
function buildPrefillProductSourceMap() {
|
|
3016
3009
|
return _buildPrefillProductSourceMap.apply(this, arguments);
|
|
@@ -3025,56 +3018,56 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3025
3018
|
}, {
|
|
3026
3019
|
key: "ensureItemRuleConfigsLoaded",
|
|
3027
3020
|
value: function () {
|
|
3028
|
-
var _ensureItemRuleConfigsLoaded = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3021
|
+
var _ensureItemRuleConfigsLoaded = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35() {
|
|
3029
3022
|
var _this11 = this;
|
|
3030
|
-
return _regeneratorRuntime().wrap(function
|
|
3031
|
-
while (1) switch (
|
|
3023
|
+
return _regeneratorRuntime().wrap(function _callee35$(_context35) {
|
|
3024
|
+
while (1) switch (_context35.prev = _context35.next) {
|
|
3032
3025
|
case 0:
|
|
3033
3026
|
if (!(this.itemRuleConfigs.length > 0)) {
|
|
3034
|
-
|
|
3027
|
+
_context35.next = 2;
|
|
3035
3028
|
break;
|
|
3036
3029
|
}
|
|
3037
|
-
return
|
|
3030
|
+
return _context35.abrupt("return", this.itemRuleConfigs);
|
|
3038
3031
|
case 2:
|
|
3039
3032
|
if (!this.itemRuleConfigsPromise) {
|
|
3040
|
-
|
|
3033
|
+
_context35.next = 4;
|
|
3041
3034
|
break;
|
|
3042
3035
|
}
|
|
3043
|
-
return
|
|
3036
|
+
return _context35.abrupt("return", this.itemRuleConfigsPromise);
|
|
3044
3037
|
case 4:
|
|
3045
|
-
this.itemRuleConfigsPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3038
|
+
this.itemRuleConfigsPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34() {
|
|
3046
3039
|
var runtimeConfig, staticConfigs;
|
|
3047
|
-
return _regeneratorRuntime().wrap(function
|
|
3048
|
-
while (1) switch (
|
|
3040
|
+
return _regeneratorRuntime().wrap(function _callee34$(_context34) {
|
|
3041
|
+
while (1) switch (_context34.prev = _context34.next) {
|
|
3049
3042
|
case 0:
|
|
3050
3043
|
runtimeConfig = _this11.getItemRuleRuntimeConfig();
|
|
3051
3044
|
staticConfigs = normalizeItemRuleStrategies(runtimeConfig.strategyConfigs);
|
|
3052
3045
|
if (!(staticConfigs.length > 0)) {
|
|
3053
|
-
|
|
3046
|
+
_context34.next = 6;
|
|
3054
3047
|
break;
|
|
3055
3048
|
}
|
|
3056
3049
|
_this11.itemRuleConfigs = staticConfigs;
|
|
3057
3050
|
_this11.itemRuleEvaluator.setStrategyConfigs(staticConfigs);
|
|
3058
|
-
return
|
|
3051
|
+
return _context34.abrupt("return", _this11.itemRuleConfigs);
|
|
3059
3052
|
case 6:
|
|
3060
3053
|
_this11.itemRuleConfigs = [];
|
|
3061
3054
|
_this11.itemRuleEvaluator.setStrategyConfigs([]);
|
|
3062
|
-
return
|
|
3055
|
+
return _context34.abrupt("return", _this11.itemRuleConfigs);
|
|
3063
3056
|
case 9:
|
|
3064
3057
|
case "end":
|
|
3065
|
-
return
|
|
3058
|
+
return _context34.stop();
|
|
3066
3059
|
}
|
|
3067
|
-
},
|
|
3060
|
+
}, _callee34);
|
|
3068
3061
|
}))();
|
|
3069
|
-
|
|
3062
|
+
_context35.next = 7;
|
|
3070
3063
|
return this.itemRuleConfigsPromise;
|
|
3071
3064
|
case 7:
|
|
3072
|
-
return
|
|
3065
|
+
return _context35.abrupt("return", _context35.sent);
|
|
3073
3066
|
case 8:
|
|
3074
3067
|
case "end":
|
|
3075
|
-
return
|
|
3068
|
+
return _context35.stop();
|
|
3076
3069
|
}
|
|
3077
|
-
},
|
|
3070
|
+
}, _callee35, this);
|
|
3078
3071
|
}));
|
|
3079
3072
|
function ensureItemRuleConfigsLoaded() {
|
|
3080
3073
|
return _ensureItemRuleConfigsLoaded.apply(this, arguments);
|
|
@@ -3084,22 +3077,22 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3084
3077
|
}, {
|
|
3085
3078
|
key: "refreshItemRuleQuantityLimits",
|
|
3086
3079
|
value: function () {
|
|
3087
|
-
var _refreshItemRuleQuantityLimits = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3080
|
+
var _refreshItemRuleQuantityLimits = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36() {
|
|
3088
3081
|
var strategyConfigs, businessData, limits;
|
|
3089
|
-
return _regeneratorRuntime().wrap(function
|
|
3090
|
-
while (1) switch (
|
|
3082
|
+
return _regeneratorRuntime().wrap(function _callee36$(_context36) {
|
|
3083
|
+
while (1) switch (_context36.prev = _context36.next) {
|
|
3091
3084
|
case 0:
|
|
3092
|
-
|
|
3093
|
-
|
|
3085
|
+
_context36.prev = 0;
|
|
3086
|
+
_context36.next = 3;
|
|
3094
3087
|
return this.ensureItemRuleConfigsLoaded();
|
|
3095
3088
|
case 3:
|
|
3096
|
-
strategyConfigs =
|
|
3089
|
+
strategyConfigs = _context36.sent;
|
|
3097
3090
|
if (strategyConfigs.length) {
|
|
3098
|
-
|
|
3091
|
+
_context36.next = 7;
|
|
3099
3092
|
break;
|
|
3100
3093
|
}
|
|
3101
3094
|
this.store.itemRuleQuantityLimits = [];
|
|
3102
|
-
return
|
|
3095
|
+
return _context36.abrupt("return", []);
|
|
3103
3096
|
case 7:
|
|
3104
3097
|
businessData = buildItemRuleBusinessData({
|
|
3105
3098
|
tempOrder: this.ensureTempOrder(),
|
|
@@ -3111,18 +3104,18 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3111
3104
|
this.logMethodSuccess('refreshItemRuleQuantityLimits', {
|
|
3112
3105
|
limitCount: limits.length
|
|
3113
3106
|
});
|
|
3114
|
-
return
|
|
3107
|
+
return _context36.abrupt("return", limits);
|
|
3115
3108
|
case 14:
|
|
3116
|
-
|
|
3117
|
-
|
|
3109
|
+
_context36.prev = 14;
|
|
3110
|
+
_context36.t0 = _context36["catch"](0);
|
|
3118
3111
|
this.store.itemRuleQuantityLimits = [];
|
|
3119
|
-
this.logMethodError('refreshItemRuleQuantityLimits',
|
|
3120
|
-
return
|
|
3112
|
+
this.logMethodError('refreshItemRuleQuantityLimits', _context36.t0);
|
|
3113
|
+
return _context36.abrupt("return", []);
|
|
3121
3114
|
case 19:
|
|
3122
3115
|
case "end":
|
|
3123
|
-
return
|
|
3116
|
+
return _context36.stop();
|
|
3124
3117
|
}
|
|
3125
|
-
},
|
|
3118
|
+
}, _callee36, this, [[0, 14]]);
|
|
3126
3119
|
}));
|
|
3127
3120
|
function refreshItemRuleQuantityLimits() {
|
|
3128
3121
|
return _refreshItemRuleQuantityLimits.apply(this, arguments);
|
|
@@ -3132,32 +3125,32 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3132
3125
|
}, {
|
|
3133
3126
|
key: "applyPrefillByItemRule",
|
|
3134
3127
|
value: function () {
|
|
3135
|
-
var _applyPrefillByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3128
|
+
var _applyPrefillByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37() {
|
|
3136
3129
|
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
|
|
3138
|
-
while (1) switch (
|
|
3130
|
+
return _regeneratorRuntime().wrap(function _callee37$(_context37) {
|
|
3131
|
+
while (1) switch (_context37.prev = _context37.next) {
|
|
3139
3132
|
case 0:
|
|
3140
3133
|
if (!this.itemRulePrefillApplied) {
|
|
3141
|
-
|
|
3134
|
+
_context37.next = 2;
|
|
3142
3135
|
break;
|
|
3143
3136
|
}
|
|
3144
|
-
return
|
|
3137
|
+
return _context37.abrupt("return");
|
|
3145
3138
|
case 2:
|
|
3146
3139
|
if (this.store.order) {
|
|
3147
|
-
|
|
3140
|
+
_context37.next = 4;
|
|
3148
3141
|
break;
|
|
3149
3142
|
}
|
|
3150
|
-
return
|
|
3143
|
+
return _context37.abrupt("return");
|
|
3151
3144
|
case 4:
|
|
3152
|
-
|
|
3145
|
+
_context37.next = 6;
|
|
3153
3146
|
return this.ensureItemRuleConfigsLoaded();
|
|
3154
3147
|
case 6:
|
|
3155
|
-
strategyConfigs =
|
|
3148
|
+
strategyConfigs = _context37.sent;
|
|
3156
3149
|
if (strategyConfigs.length) {
|
|
3157
|
-
|
|
3150
|
+
_context37.next = 9;
|
|
3158
3151
|
break;
|
|
3159
3152
|
}
|
|
3160
|
-
return
|
|
3153
|
+
return _context37.abrupt("return");
|
|
3161
3154
|
case 9:
|
|
3162
3155
|
businessData = buildItemRuleBusinessData({
|
|
3163
3156
|
tempOrder: this.ensureTempOrder(),
|
|
@@ -3166,24 +3159,24 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3166
3159
|
});
|
|
3167
3160
|
prefillItems = this.itemRuleEvaluator.getPrefillItems(businessData);
|
|
3168
3161
|
if (prefillItems.length) {
|
|
3169
|
-
|
|
3162
|
+
_context37.next = 14;
|
|
3170
3163
|
break;
|
|
3171
3164
|
}
|
|
3172
3165
|
this.itemRulePrefillApplied = true;
|
|
3173
|
-
return
|
|
3166
|
+
return _context37.abrupt("return");
|
|
3174
3167
|
case 14:
|
|
3175
|
-
|
|
3168
|
+
_context37.next = 16;
|
|
3176
3169
|
return this.buildPrefillProductSourceMap();
|
|
3177
3170
|
case 16:
|
|
3178
|
-
productSourceMap =
|
|
3171
|
+
productSourceMap = _context37.sent;
|
|
3179
3172
|
tempOrder = this.ensureTempOrder();
|
|
3180
3173
|
hasChanges = false;
|
|
3181
3174
|
_iterator18 = _createForOfIteratorHelper(prefillItems);
|
|
3182
|
-
|
|
3175
|
+
_context37.prev = 20;
|
|
3183
3176
|
_iterator18.s();
|
|
3184
3177
|
case 22:
|
|
3185
3178
|
if ((_step18 = _iterator18.n()).done) {
|
|
3186
|
-
|
|
3179
|
+
_context37.next = 45;
|
|
3187
3180
|
break;
|
|
3188
3181
|
}
|
|
3189
3182
|
prefillItem = _step18.value;
|
|
@@ -3191,16 +3184,16 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3191
3184
|
productVariantId = Number((_prefillItem$product_ = prefillItem.product_variant_id) !== null && _prefillItem$product_ !== void 0 ? _prefillItem$product_ : 0);
|
|
3192
3185
|
targetQuantity = toNonNegativeInt(prefillItem.quantity);
|
|
3193
3186
|
if (!(!Number.isFinite(productId) || targetQuantity <= 0)) {
|
|
3194
|
-
|
|
3187
|
+
_context37.next = 29;
|
|
3195
3188
|
break;
|
|
3196
3189
|
}
|
|
3197
|
-
return
|
|
3190
|
+
return _context37.abrupt("continue", 43);
|
|
3198
3191
|
case 29:
|
|
3199
3192
|
if (!Number.isNaN(productVariantId)) {
|
|
3200
|
-
|
|
3193
|
+
_context37.next = 31;
|
|
3201
3194
|
break;
|
|
3202
3195
|
}
|
|
3203
|
-
return
|
|
3196
|
+
return _context37.abrupt("continue", 43);
|
|
3204
3197
|
case 31:
|
|
3205
3198
|
sourceItem = productSourceMap.get(buildProductKey(productId, productVariantId)) || productSourceMap.get(buildProductKey(productId, 0)) || null;
|
|
3206
3199
|
productIndex = getProductIdentityIndex(tempOrder.products, {
|
|
@@ -3208,7 +3201,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3208
3201
|
product_variant_id: productVariantId
|
|
3209
3202
|
});
|
|
3210
3203
|
if (!(productIndex === -1)) {
|
|
3211
|
-
|
|
3204
|
+
_context37.next = 38;
|
|
3212
3205
|
break;
|
|
3213
3206
|
}
|
|
3214
3207
|
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');
|
|
@@ -3228,7 +3221,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3228
3221
|
})
|
|
3229
3222
|
}));
|
|
3230
3223
|
hasChanges = true;
|
|
3231
|
-
return
|
|
3224
|
+
return _context37.abrupt("continue", 43);
|
|
3232
3225
|
case 38:
|
|
3233
3226
|
targetProduct = tempOrder.products[productIndex];
|
|
3234
3227
|
existedQuantity = toNonNegativeInt(targetProduct.num);
|
|
@@ -3247,34 +3240,34 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3247
3240
|
hasChanges = true;
|
|
3248
3241
|
}
|
|
3249
3242
|
case 43:
|
|
3250
|
-
|
|
3243
|
+
_context37.next = 22;
|
|
3251
3244
|
break;
|
|
3252
3245
|
case 45:
|
|
3253
|
-
|
|
3246
|
+
_context37.next = 50;
|
|
3254
3247
|
break;
|
|
3255
3248
|
case 47:
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
_iterator18.e(
|
|
3249
|
+
_context37.prev = 47;
|
|
3250
|
+
_context37.t0 = _context37["catch"](20);
|
|
3251
|
+
_iterator18.e(_context37.t0);
|
|
3259
3252
|
case 50:
|
|
3260
|
-
|
|
3253
|
+
_context37.prev = 50;
|
|
3261
3254
|
_iterator18.f();
|
|
3262
|
-
return
|
|
3255
|
+
return _context37.finish(50);
|
|
3263
3256
|
case 53:
|
|
3264
3257
|
if (!hasChanges) {
|
|
3265
|
-
|
|
3258
|
+
_context37.next = 58;
|
|
3266
3259
|
break;
|
|
3267
3260
|
}
|
|
3268
3261
|
// Prefill 属于 products CRUD 的一种形式:新增后让 Rules 重算,以支持自动应用可用优惠券。
|
|
3269
3262
|
this.store.order.applyDiscount();
|
|
3270
|
-
|
|
3263
|
+
_context37.next = 57;
|
|
3271
3264
|
return this.store.order.recalculateSummary({
|
|
3272
3265
|
createIfMissing: true
|
|
3273
3266
|
});
|
|
3274
3267
|
case 57:
|
|
3275
3268
|
this.store.order.persistTempOrder();
|
|
3276
3269
|
case 58:
|
|
3277
|
-
|
|
3270
|
+
_context37.next = 60;
|
|
3278
3271
|
return this.refreshItemRuleQuantityLimits();
|
|
3279
3272
|
case 60:
|
|
3280
3273
|
this.itemRulePrefillApplied = true;
|
|
@@ -3284,9 +3277,9 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3284
3277
|
});
|
|
3285
3278
|
case 62:
|
|
3286
3279
|
case "end":
|
|
3287
|
-
return
|
|
3280
|
+
return _context37.stop();
|
|
3288
3281
|
}
|
|
3289
|
-
},
|
|
3282
|
+
}, _callee37, this, [[20, 47, 50, 53]]);
|
|
3290
3283
|
}));
|
|
3291
3284
|
function applyPrefillByItemRule() {
|
|
3292
3285
|
return _applyPrefillByItemRule.apply(this, arguments);
|
|
@@ -3296,24 +3289,24 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3296
3289
|
}, {
|
|
3297
3290
|
key: "applyItemRulePrefill",
|
|
3298
3291
|
value: function () {
|
|
3299
|
-
var _applyItemRulePrefill = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3300
|
-
return _regeneratorRuntime().wrap(function
|
|
3301
|
-
while (1) switch (
|
|
3292
|
+
var _applyItemRulePrefill = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38() {
|
|
3293
|
+
return _regeneratorRuntime().wrap(function _callee38$(_context38) {
|
|
3294
|
+
while (1) switch (_context38.prev = _context38.next) {
|
|
3302
3295
|
case 0:
|
|
3303
3296
|
this.logMethodStart('applyItemRulePrefill');
|
|
3304
|
-
|
|
3297
|
+
_context38.next = 3;
|
|
3305
3298
|
return this.applyPrefillByItemRule();
|
|
3306
3299
|
case 3:
|
|
3307
|
-
|
|
3300
|
+
_context38.next = 5;
|
|
3308
3301
|
return this.refreshItemRuleQuantityLimits();
|
|
3309
3302
|
case 5:
|
|
3310
|
-
|
|
3303
|
+
_context38.next = 7;
|
|
3311
3304
|
return this.refreshCartValidationPassed();
|
|
3312
3305
|
case 7:
|
|
3313
3306
|
case "end":
|
|
3314
|
-
return
|
|
3307
|
+
return _context38.stop();
|
|
3315
3308
|
}
|
|
3316
|
-
},
|
|
3309
|
+
}, _callee38, this);
|
|
3317
3310
|
}));
|
|
3318
3311
|
function applyItemRulePrefill() {
|
|
3319
3312
|
return _applyItemRulePrefill.apply(this, arguments);
|
|
@@ -3323,20 +3316,20 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3323
3316
|
}, {
|
|
3324
3317
|
key: "evaluateCartValidationByItemRule",
|
|
3325
3318
|
value: function () {
|
|
3326
|
-
var _evaluateCartValidationByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3319
|
+
var _evaluateCartValidationByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39() {
|
|
3327
3320
|
var strategyConfigs, businessData;
|
|
3328
|
-
return _regeneratorRuntime().wrap(function
|
|
3329
|
-
while (1) switch (
|
|
3321
|
+
return _regeneratorRuntime().wrap(function _callee39$(_context39) {
|
|
3322
|
+
while (1) switch (_context39.prev = _context39.next) {
|
|
3330
3323
|
case 0:
|
|
3331
|
-
|
|
3324
|
+
_context39.next = 2;
|
|
3332
3325
|
return this.ensureItemRuleConfigsLoaded();
|
|
3333
3326
|
case 2:
|
|
3334
|
-
strategyConfigs =
|
|
3327
|
+
strategyConfigs = _context39.sent;
|
|
3335
3328
|
if (strategyConfigs.length) {
|
|
3336
|
-
|
|
3329
|
+
_context39.next = 5;
|
|
3337
3330
|
break;
|
|
3338
3331
|
}
|
|
3339
|
-
return
|
|
3332
|
+
return _context39.abrupt("return", {
|
|
3340
3333
|
passed: true,
|
|
3341
3334
|
failures: []
|
|
3342
3335
|
});
|
|
@@ -3346,12 +3339,12 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3346
3339
|
runtimeConfig: this.getItemRuleRuntimeConfig(),
|
|
3347
3340
|
itemRuleConfigs: this.itemRuleConfigs
|
|
3348
3341
|
});
|
|
3349
|
-
return
|
|
3342
|
+
return _context39.abrupt("return", this.itemRuleEvaluator.validateCart(businessData));
|
|
3350
3343
|
case 7:
|
|
3351
3344
|
case "end":
|
|
3352
|
-
return
|
|
3345
|
+
return _context39.stop();
|
|
3353
3346
|
}
|
|
3354
|
-
},
|
|
3347
|
+
}, _callee39, this);
|
|
3355
3348
|
}));
|
|
3356
3349
|
function evaluateCartValidationByItemRule() {
|
|
3357
3350
|
return _evaluateCartValidationByItemRule.apply(this, arguments);
|
|
@@ -3361,20 +3354,20 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3361
3354
|
}, {
|
|
3362
3355
|
key: "validateBeforeSubmitByItemRule",
|
|
3363
3356
|
value: function () {
|
|
3364
|
-
var _validateBeforeSubmitByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3357
|
+
var _validateBeforeSubmitByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40() {
|
|
3365
3358
|
var validationResult, firstFailure, errorMessage, error;
|
|
3366
|
-
return _regeneratorRuntime().wrap(function
|
|
3367
|
-
while (1) switch (
|
|
3359
|
+
return _regeneratorRuntime().wrap(function _callee40$(_context40) {
|
|
3360
|
+
while (1) switch (_context40.prev = _context40.next) {
|
|
3368
3361
|
case 0:
|
|
3369
|
-
|
|
3362
|
+
_context40.next = 2;
|
|
3370
3363
|
return this.evaluateCartValidationByItemRule();
|
|
3371
3364
|
case 2:
|
|
3372
|
-
validationResult =
|
|
3365
|
+
validationResult = _context40.sent;
|
|
3373
3366
|
if (!validationResult.passed) {
|
|
3374
|
-
|
|
3367
|
+
_context40.next = 5;
|
|
3375
3368
|
break;
|
|
3376
3369
|
}
|
|
3377
|
-
return
|
|
3370
|
+
return _context40.abrupt("return");
|
|
3378
3371
|
case 5:
|
|
3379
3372
|
firstFailure = validationResult.failures[0];
|
|
3380
3373
|
errorMessage = (firstFailure === null || firstFailure === void 0 ? void 0 : firstFailure.validationMessage) || '当前购物车未满足商品规则,请调整后再提交';
|
|
@@ -3383,9 +3376,9 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3383
3376
|
throw error;
|
|
3384
3377
|
case 10:
|
|
3385
3378
|
case "end":
|
|
3386
|
-
return
|
|
3379
|
+
return _context40.stop();
|
|
3387
3380
|
}
|
|
3388
|
-
},
|
|
3381
|
+
}, _callee40, this);
|
|
3389
3382
|
}));
|
|
3390
3383
|
function validateBeforeSubmitByItemRule() {
|
|
3391
3384
|
return _validateBeforeSubmitByItemRule.apply(this, arguments);
|
|
@@ -3395,10 +3388,10 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3395
3388
|
}, {
|
|
3396
3389
|
key: "refreshCartValidationPassed",
|
|
3397
3390
|
value: function () {
|
|
3398
|
-
var _refreshCartValidationPassed = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3391
|
+
var _refreshCartValidationPassed = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41() {
|
|
3399
3392
|
var previous, nextState, validationResult, changed;
|
|
3400
|
-
return _regeneratorRuntime().wrap(function
|
|
3401
|
-
while (1) switch (
|
|
3393
|
+
return _regeneratorRuntime().wrap(function _callee41$(_context41) {
|
|
3394
|
+
while (1) switch (_context41.prev = _context41.next) {
|
|
3402
3395
|
case 0:
|
|
3403
3396
|
previous = this.store.cartValidation || {
|
|
3404
3397
|
passed: null,
|
|
@@ -3408,20 +3401,20 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3408
3401
|
passed: null,
|
|
3409
3402
|
failures: []
|
|
3410
3403
|
};
|
|
3411
|
-
|
|
3412
|
-
|
|
3404
|
+
_context41.prev = 2;
|
|
3405
|
+
_context41.next = 5;
|
|
3413
3406
|
return this.evaluateCartValidationByItemRule();
|
|
3414
3407
|
case 5:
|
|
3415
|
-
validationResult =
|
|
3408
|
+
validationResult = _context41.sent;
|
|
3416
3409
|
nextState = {
|
|
3417
3410
|
passed: validationResult.passed,
|
|
3418
3411
|
failures: validationResult.failures || []
|
|
3419
3412
|
};
|
|
3420
|
-
|
|
3413
|
+
_context41.next = 12;
|
|
3421
3414
|
break;
|
|
3422
3415
|
case 9:
|
|
3423
|
-
|
|
3424
|
-
|
|
3416
|
+
_context41.prev = 9;
|
|
3417
|
+
_context41.t0 = _context41["catch"](2);
|
|
3425
3418
|
nextState = {
|
|
3426
3419
|
passed: false,
|
|
3427
3420
|
failures: []
|
|
@@ -3430,21 +3423,21 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3430
3423
|
this.store.cartValidation = nextState;
|
|
3431
3424
|
changed = previous.passed !== nextState.passed || previous.failures !== nextState.failures;
|
|
3432
3425
|
if (!changed) {
|
|
3433
|
-
|
|
3426
|
+
_context41.next = 17;
|
|
3434
3427
|
break;
|
|
3435
3428
|
}
|
|
3436
|
-
|
|
3429
|
+
_context41.next = 17;
|
|
3437
3430
|
return this.core.effects.emit(VenueBookingHooks.onCartValidationChanged, {
|
|
3438
3431
|
cartValidation: nextState,
|
|
3439
3432
|
cartValidationPassed: nextState.passed
|
|
3440
3433
|
});
|
|
3441
3434
|
case 17:
|
|
3442
|
-
return
|
|
3435
|
+
return _context41.abrupt("return", nextState.passed);
|
|
3443
3436
|
case 18:
|
|
3444
3437
|
case "end":
|
|
3445
|
-
return
|
|
3438
|
+
return _context41.stop();
|
|
3446
3439
|
}
|
|
3447
|
-
},
|
|
3440
|
+
}, _callee41, this, [[2, 9]]);
|
|
3448
3441
|
}));
|
|
3449
3442
|
function refreshCartValidationPassed() {
|
|
3450
3443
|
return _refreshCartValidationPassed.apply(this, arguments);
|
|
@@ -3454,14 +3447,14 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3454
3447
|
}, {
|
|
3455
3448
|
key: "setItemRuleRuntimeConfig",
|
|
3456
3449
|
value: function () {
|
|
3457
|
-
var _setItemRuleRuntimeConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3450
|
+
var _setItemRuleRuntimeConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42() {
|
|
3458
3451
|
var _this$itemRuleRuntime, _this$itemRuleRuntime2;
|
|
3459
3452
|
var config,
|
|
3460
|
-
|
|
3461
|
-
return _regeneratorRuntime().wrap(function
|
|
3462
|
-
while (1) switch (
|
|
3453
|
+
_args42 = arguments;
|
|
3454
|
+
return _regeneratorRuntime().wrap(function _callee42$(_context42) {
|
|
3455
|
+
while (1) switch (_context42.prev = _context42.next) {
|
|
3463
3456
|
case 0:
|
|
3464
|
-
config =
|
|
3457
|
+
config = _args42.length > 0 && _args42[0] !== undefined ? _args42[0] : {};
|
|
3465
3458
|
this.logMethodStart('setItemRuleRuntimeConfig');
|
|
3466
3459
|
this.itemRuleRuntimeConfig = _objectSpread(_objectSpread(_objectSpread({}, this.itemRuleRuntimeConfig), config), {}, {
|
|
3467
3460
|
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) || {}),
|
|
@@ -3473,10 +3466,10 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3473
3466
|
this.itemRuleEvaluator.setStrategyConfigs([]);
|
|
3474
3467
|
}
|
|
3475
3468
|
this.itemRulePrefillApplied = false;
|
|
3476
|
-
|
|
3469
|
+
_context42.next = 7;
|
|
3477
3470
|
return this.refreshItemRuleQuantityLimits();
|
|
3478
3471
|
case 7:
|
|
3479
|
-
|
|
3472
|
+
_context42.next = 9;
|
|
3480
3473
|
return this.refreshCartValidationPassed();
|
|
3481
3474
|
case 9:
|
|
3482
3475
|
this.logMethodSuccess('setItemRuleRuntimeConfig', {
|
|
@@ -3484,9 +3477,9 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3484
3477
|
});
|
|
3485
3478
|
case 10:
|
|
3486
3479
|
case "end":
|
|
3487
|
-
return
|
|
3480
|
+
return _context42.stop();
|
|
3488
3481
|
}
|
|
3489
|
-
},
|
|
3482
|
+
}, _callee42, this);
|
|
3490
3483
|
}));
|
|
3491
3484
|
function setItemRuleRuntimeConfig() {
|
|
3492
3485
|
return _setItemRuleRuntimeConfig.apply(this, arguments);
|
|
@@ -3600,9 +3593,44 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3600
3593
|
return this.store.holder.getHolderFormMap();
|
|
3601
3594
|
}
|
|
3602
3595
|
|
|
3596
|
+
/**
|
|
3597
|
+
* UI 层触发:按当前 holderMap 批量刷新所有表单的 records
|
|
3598
|
+
*/
|
|
3599
|
+
}, {
|
|
3600
|
+
key: "refreshAllHolderFormRecords",
|
|
3601
|
+
value: (function () {
|
|
3602
|
+
var _refreshAllHolderFormRecords = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(params) {
|
|
3603
|
+
var _params$customer_id, _params$useCache;
|
|
3604
|
+
var customer_id;
|
|
3605
|
+
return _regeneratorRuntime().wrap(function _callee43$(_context43) {
|
|
3606
|
+
while (1) switch (_context43.prev = _context43.next) {
|
|
3607
|
+
case 0:
|
|
3608
|
+
if (this.store.holder) {
|
|
3609
|
+
_context43.next = 2;
|
|
3610
|
+
break;
|
|
3611
|
+
}
|
|
3612
|
+
throw new Error('[VenueBooking] holder 模块未初始化');
|
|
3613
|
+
case 2:
|
|
3614
|
+
customer_id = (_params$customer_id = params === null || params === void 0 ? void 0 : params.customer_id) !== null && _params$customer_id !== void 0 ? _params$customer_id : this.resolveHolderCustomerId();
|
|
3615
|
+
return _context43.abrupt("return", this.store.holder.refreshAllFormRecords(_objectSpread(_objectSpread({}, params), {}, {
|
|
3616
|
+
customer_id: customer_id,
|
|
3617
|
+
useCache: (_params$useCache = params === null || params === void 0 ? void 0 : params.useCache) !== null && _params$useCache !== void 0 ? _params$useCache : false
|
|
3618
|
+
})));
|
|
3619
|
+
case 4:
|
|
3620
|
+
case "end":
|
|
3621
|
+
return _context43.stop();
|
|
3622
|
+
}
|
|
3623
|
+
}, _callee43, this);
|
|
3624
|
+
}));
|
|
3625
|
+
function refreshAllHolderFormRecords(_x21) {
|
|
3626
|
+
return _refreshAllHolderFormRecords.apply(this, arguments);
|
|
3627
|
+
}
|
|
3628
|
+
return refreshAllHolderFormRecords;
|
|
3629
|
+
}()
|
|
3603
3630
|
/**
|
|
3604
3631
|
* 添加表单记录
|
|
3605
3632
|
*/
|
|
3633
|
+
)
|
|
3606
3634
|
}, {
|
|
3607
3635
|
key: "appendFormRecord",
|
|
3608
3636
|
value: function appendFormRecord(params) {
|