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