@pisell/pisellos 3.0.92 → 3.0.93
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/Discount/types.d.ts +2 -0
- package/dist/modules/Rules/index.js +13 -0
- package/dist/modules/Summary/utils.js +42 -21
- package/dist/solution/VenueBooking/index.d.ts +5 -0
- package/dist/solution/VenueBooking/index.js +312 -265
- package/lib/model/strategy/adapter/promotion/index.js +49 -0
- package/lib/modules/Discount/types.d.ts +2 -0
- package/lib/modules/Rules/index.js +8 -0
- package/lib/modules/Summary/utils.js +23 -3
- package/lib/solution/VenueBooking/index.d.ts +5 -0
- package/lib/solution/VenueBooking/index.js +18 -0
- package/package.json +1 -1
|
@@ -2385,21 +2385,68 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2385
2385
|
}
|
|
2386
2386
|
return submitOrder;
|
|
2387
2387
|
}()
|
|
2388
|
+
/**
|
|
2389
|
+
* 0 元订单免费领取(非定金场景)
|
|
2390
|
+
* 与 appointment getFreeProduct 同接口:POST /pay/order/free-pay/:id
|
|
2391
|
+
*/
|
|
2392
|
+
}, {
|
|
2393
|
+
key: "submitFreeOrder",
|
|
2394
|
+
value: (function () {
|
|
2395
|
+
var _submitFreeOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(id) {
|
|
2396
|
+
var res;
|
|
2397
|
+
return _regeneratorRuntime().wrap(function _callee25$(_context25) {
|
|
2398
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
2399
|
+
case 0:
|
|
2400
|
+
this.logMethodStart('submitFreeOrder', {
|
|
2401
|
+
id: id
|
|
2402
|
+
});
|
|
2403
|
+
_context25.prev = 1;
|
|
2404
|
+
if (id) {
|
|
2405
|
+
_context25.next = 4;
|
|
2406
|
+
break;
|
|
2407
|
+
}
|
|
2408
|
+
throw new Error('订单 ID 不能为空');
|
|
2409
|
+
case 4:
|
|
2410
|
+
_context25.next = 6;
|
|
2411
|
+
return this.request.post("/pay/order/free-pay/".concat(id));
|
|
2412
|
+
case 6:
|
|
2413
|
+
res = _context25.sent;
|
|
2414
|
+
this.logMethodSuccess('submitFreeOrder', {
|
|
2415
|
+
id: id,
|
|
2416
|
+
status: res === null || res === void 0 ? void 0 : res.status
|
|
2417
|
+
});
|
|
2418
|
+
return _context25.abrupt("return", res);
|
|
2419
|
+
case 11:
|
|
2420
|
+
_context25.prev = 11;
|
|
2421
|
+
_context25.t0 = _context25["catch"](1);
|
|
2422
|
+
this.logMethodError('submitFreeOrder', _context25.t0);
|
|
2423
|
+
throw _context25.t0;
|
|
2424
|
+
case 15:
|
|
2425
|
+
case "end":
|
|
2426
|
+
return _context25.stop();
|
|
2427
|
+
}
|
|
2428
|
+
}, _callee25, this, [[1, 11]]);
|
|
2429
|
+
}));
|
|
2430
|
+
function submitFreeOrder(_x16) {
|
|
2431
|
+
return _submitFreeOrder.apply(this, arguments);
|
|
2432
|
+
}
|
|
2433
|
+
return submitFreeOrder;
|
|
2434
|
+
}())
|
|
2388
2435
|
}, {
|
|
2389
2436
|
key: "addProductToOrder",
|
|
2390
2437
|
value: function () {
|
|
2391
|
-
var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2438
|
+
var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(product) {
|
|
2392
2439
|
var _product$metadata5, _product$product_vari2, quotationPrice, products;
|
|
2393
|
-
return _regeneratorRuntime().wrap(function
|
|
2394
|
-
while (1) switch (
|
|
2440
|
+
return _regeneratorRuntime().wrap(function _callee26$(_context26) {
|
|
2441
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
2395
2442
|
case 0:
|
|
2396
2443
|
this.logMethodStart('addProductToOrder', {
|
|
2397
2444
|
product_id: product.product_id,
|
|
2398
2445
|
product_variant_id: product.product_variant_id
|
|
2399
2446
|
});
|
|
2400
|
-
|
|
2447
|
+
_context26.prev = 1;
|
|
2401
2448
|
if (this.store.order) {
|
|
2402
|
-
|
|
2449
|
+
_context26.next = 4;
|
|
2403
2450
|
break;
|
|
2404
2451
|
}
|
|
2405
2452
|
throw new Error('order 模块未初始化');
|
|
@@ -2417,32 +2464,32 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2417
2464
|
product.original_price = product.selling_price;
|
|
2418
2465
|
}
|
|
2419
2466
|
}
|
|
2420
|
-
|
|
2467
|
+
_context26.next = 7;
|
|
2421
2468
|
return this.store.order.addProductToOrder(product);
|
|
2422
2469
|
case 7:
|
|
2423
|
-
products =
|
|
2424
|
-
|
|
2470
|
+
products = _context26.sent;
|
|
2471
|
+
_context26.next = 10;
|
|
2425
2472
|
return this.refreshItemRuleQuantityLimits();
|
|
2426
2473
|
case 10:
|
|
2427
|
-
|
|
2474
|
+
_context26.next = 12;
|
|
2428
2475
|
return this.refreshCartValidationPassed();
|
|
2429
2476
|
case 12:
|
|
2430
2477
|
this.logMethodSuccess('addProductToOrder', {
|
|
2431
2478
|
productCount: products.length
|
|
2432
2479
|
});
|
|
2433
|
-
return
|
|
2480
|
+
return _context26.abrupt("return", products);
|
|
2434
2481
|
case 16:
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
this.logMethodError('addProductToOrder',
|
|
2438
|
-
throw
|
|
2482
|
+
_context26.prev = 16;
|
|
2483
|
+
_context26.t0 = _context26["catch"](1);
|
|
2484
|
+
this.logMethodError('addProductToOrder', _context26.t0);
|
|
2485
|
+
throw _context26.t0;
|
|
2439
2486
|
case 20:
|
|
2440
2487
|
case "end":
|
|
2441
|
-
return
|
|
2488
|
+
return _context26.stop();
|
|
2442
2489
|
}
|
|
2443
|
-
},
|
|
2490
|
+
}, _callee26, this, [[1, 16]]);
|
|
2444
2491
|
}));
|
|
2445
|
-
function addProductToOrder(
|
|
2492
|
+
function addProductToOrder(_x17) {
|
|
2446
2493
|
return _addProductToOrder.apply(this, arguments);
|
|
2447
2494
|
}
|
|
2448
2495
|
return addProductToOrder;
|
|
@@ -2450,48 +2497,48 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2450
2497
|
}, {
|
|
2451
2498
|
key: "updateProductInOrder",
|
|
2452
2499
|
value: function () {
|
|
2453
|
-
var _updateProductInOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2500
|
+
var _updateProductInOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(params) {
|
|
2454
2501
|
var products;
|
|
2455
|
-
return _regeneratorRuntime().wrap(function
|
|
2456
|
-
while (1) switch (
|
|
2502
|
+
return _regeneratorRuntime().wrap(function _callee27$(_context27) {
|
|
2503
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
2457
2504
|
case 0:
|
|
2458
2505
|
this.logMethodStart('updateProductInOrder', {
|
|
2459
2506
|
product_id: params.product_id,
|
|
2460
2507
|
product_variant_id: params.product_variant_id
|
|
2461
2508
|
});
|
|
2462
|
-
|
|
2509
|
+
_context27.prev = 1;
|
|
2463
2510
|
if (this.store.order) {
|
|
2464
|
-
|
|
2511
|
+
_context27.next = 4;
|
|
2465
2512
|
break;
|
|
2466
2513
|
}
|
|
2467
2514
|
throw new Error('order 模块未初始化');
|
|
2468
2515
|
case 4:
|
|
2469
|
-
|
|
2516
|
+
_context27.next = 6;
|
|
2470
2517
|
return this.store.order.updateProductInOrder(params);
|
|
2471
2518
|
case 6:
|
|
2472
|
-
products =
|
|
2473
|
-
|
|
2519
|
+
products = _context27.sent;
|
|
2520
|
+
_context27.next = 9;
|
|
2474
2521
|
return this.refreshItemRuleQuantityLimits();
|
|
2475
2522
|
case 9:
|
|
2476
|
-
|
|
2523
|
+
_context27.next = 11;
|
|
2477
2524
|
return this.refreshCartValidationPassed();
|
|
2478
2525
|
case 11:
|
|
2479
2526
|
this.logMethodSuccess('updateProductInOrder', {
|
|
2480
2527
|
productCount: products.length
|
|
2481
2528
|
});
|
|
2482
|
-
return
|
|
2529
|
+
return _context27.abrupt("return", products);
|
|
2483
2530
|
case 15:
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
this.logMethodError('updateProductInOrder',
|
|
2487
|
-
throw
|
|
2531
|
+
_context27.prev = 15;
|
|
2532
|
+
_context27.t0 = _context27["catch"](1);
|
|
2533
|
+
this.logMethodError('updateProductInOrder', _context27.t0);
|
|
2534
|
+
throw _context27.t0;
|
|
2488
2535
|
case 19:
|
|
2489
2536
|
case "end":
|
|
2490
|
-
return
|
|
2537
|
+
return _context27.stop();
|
|
2491
2538
|
}
|
|
2492
|
-
},
|
|
2539
|
+
}, _callee27, this, [[1, 15]]);
|
|
2493
2540
|
}));
|
|
2494
|
-
function updateProductInOrder(
|
|
2541
|
+
function updateProductInOrder(_x18) {
|
|
2495
2542
|
return _updateProductInOrder.apply(this, arguments);
|
|
2496
2543
|
}
|
|
2497
2544
|
return updateProductInOrder;
|
|
@@ -2499,66 +2546,66 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2499
2546
|
}, {
|
|
2500
2547
|
key: "removeProductFromOrder",
|
|
2501
2548
|
value: function () {
|
|
2502
|
-
var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2549
|
+
var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(identity) {
|
|
2503
2550
|
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
|
|
2505
|
-
while (1) switch (
|
|
2551
|
+
return _regeneratorRuntime().wrap(function _callee28$(_context28) {
|
|
2552
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
2506
2553
|
case 0:
|
|
2507
2554
|
this.logMethodStart('removeProductFromOrder', {
|
|
2508
2555
|
product_id: identity.product_id,
|
|
2509
2556
|
product_variant_id: identity.product_variant_id
|
|
2510
2557
|
});
|
|
2511
|
-
|
|
2558
|
+
_context28.prev = 1;
|
|
2512
2559
|
if (this.store.order) {
|
|
2513
|
-
|
|
2560
|
+
_context28.next = 4;
|
|
2514
2561
|
break;
|
|
2515
2562
|
}
|
|
2516
2563
|
throw new Error('order 模块未初始化');
|
|
2517
2564
|
case 4:
|
|
2518
2565
|
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
|
-
|
|
2566
|
+
_context28.next = 7;
|
|
2520
2567
|
return this.store.order.removeProductFromOrder(identity);
|
|
2521
2568
|
case 7:
|
|
2522
|
-
products =
|
|
2569
|
+
products = _context28.sent;
|
|
2523
2570
|
if (!(tempOrder !== null && tempOrder !== void 0 && (_tempOrder$bookings = tempOrder.bookings) !== null && _tempOrder$bookings !== void 0 && _tempOrder$bookings.length)) {
|
|
2524
|
-
|
|
2571
|
+
_context28.next = 33;
|
|
2525
2572
|
break;
|
|
2526
2573
|
}
|
|
2527
2574
|
venueProductUids = new Set();
|
|
2528
2575
|
venueBookingUids = new Set();
|
|
2529
2576
|
_iterator15 = _createForOfIteratorHelper(tempOrder.products || []);
|
|
2530
|
-
|
|
2577
|
+
_context28.prev = 12;
|
|
2531
2578
|
_iterator15.s();
|
|
2532
2579
|
case 14:
|
|
2533
2580
|
if ((_step15 = _iterator15.n()).done) {
|
|
2534
|
-
|
|
2581
|
+
_context28.next = 22;
|
|
2535
2582
|
break;
|
|
2536
2583
|
}
|
|
2537
2584
|
product = _step15.value;
|
|
2538
2585
|
if (product !== null && product !== void 0 && (_product$metadata6 = product.metadata) !== null && _product$metadata6 !== void 0 && _product$metadata6.venue_booking) {
|
|
2539
|
-
|
|
2586
|
+
_context28.next = 18;
|
|
2540
2587
|
break;
|
|
2541
2588
|
}
|
|
2542
|
-
return
|
|
2589
|
+
return _context28.abrupt("continue", 20);
|
|
2543
2590
|
case 18:
|
|
2544
2591
|
if (product.identity_key) venueProductUids.add(String(product.identity_key));
|
|
2545
2592
|
if ((_product$metadata7 = product.metadata) !== null && _product$metadata7 !== void 0 && _product$metadata7.booking_uid) {
|
|
2546
2593
|
venueBookingUids.add(String(product.metadata.booking_uid));
|
|
2547
2594
|
}
|
|
2548
2595
|
case 20:
|
|
2549
|
-
|
|
2596
|
+
_context28.next = 14;
|
|
2550
2597
|
break;
|
|
2551
2598
|
case 22:
|
|
2552
|
-
|
|
2599
|
+
_context28.next = 27;
|
|
2553
2600
|
break;
|
|
2554
2601
|
case 24:
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
_iterator15.e(
|
|
2602
|
+
_context28.prev = 24;
|
|
2603
|
+
_context28.t0 = _context28["catch"](12);
|
|
2604
|
+
_iterator15.e(_context28.t0);
|
|
2558
2605
|
case 27:
|
|
2559
|
-
|
|
2606
|
+
_context28.prev = 27;
|
|
2560
2607
|
_iterator15.f();
|
|
2561
|
-
return
|
|
2608
|
+
return _context28.finish(27);
|
|
2562
2609
|
case 30:
|
|
2563
2610
|
beforeBookingCount = ((_tempOrder$bookings2 = tempOrder.bookings) === null || _tempOrder$bookings2 === void 0 ? void 0 : _tempOrder$bookings2.length) || 0;
|
|
2564
2611
|
tempOrder.bookings = (tempOrder.bookings || []).filter(function (booking) {
|
|
@@ -2575,28 +2622,28 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2575
2622
|
(_this$store$order$per = (_this$store$order8 = this.store.order).persistTempOrder) === null || _this$store$order$per === void 0 || _this$store$order$per.call(_this$store$order8);
|
|
2576
2623
|
}
|
|
2577
2624
|
case 33:
|
|
2578
|
-
|
|
2625
|
+
_context28.next = 35;
|
|
2579
2626
|
return this.refreshItemRuleQuantityLimits();
|
|
2580
2627
|
case 35:
|
|
2581
|
-
|
|
2628
|
+
_context28.next = 37;
|
|
2582
2629
|
return this.refreshCartValidationPassed();
|
|
2583
2630
|
case 37:
|
|
2584
2631
|
this.logMethodSuccess('removeProductFromOrder', {
|
|
2585
2632
|
productCount: products.length
|
|
2586
2633
|
});
|
|
2587
|
-
return
|
|
2634
|
+
return _context28.abrupt("return", products);
|
|
2588
2635
|
case 41:
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
this.logMethodError('removeProductFromOrder',
|
|
2592
|
-
throw
|
|
2636
|
+
_context28.prev = 41;
|
|
2637
|
+
_context28.t1 = _context28["catch"](1);
|
|
2638
|
+
this.logMethodError('removeProductFromOrder', _context28.t1);
|
|
2639
|
+
throw _context28.t1;
|
|
2593
2640
|
case 45:
|
|
2594
2641
|
case "end":
|
|
2595
|
-
return
|
|
2642
|
+
return _context28.stop();
|
|
2596
2643
|
}
|
|
2597
|
-
},
|
|
2644
|
+
}, _callee28, this, [[1, 41], [12, 24, 27, 30]]);
|
|
2598
2645
|
}));
|
|
2599
|
-
function removeProductFromOrder(
|
|
2646
|
+
function removeProductFromOrder(_x19) {
|
|
2600
2647
|
return _removeProductFromOrder.apply(this, arguments);
|
|
2601
2648
|
}
|
|
2602
2649
|
return removeProductFromOrder;
|
|
@@ -2604,27 +2651,27 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2604
2651
|
}, {
|
|
2605
2652
|
key: "getProductList",
|
|
2606
2653
|
value: function () {
|
|
2607
|
-
var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2654
|
+
var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29() {
|
|
2608
2655
|
var result;
|
|
2609
|
-
return _regeneratorRuntime().wrap(function
|
|
2610
|
-
while (1) switch (
|
|
2656
|
+
return _regeneratorRuntime().wrap(function _callee29$(_context29) {
|
|
2657
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
2611
2658
|
case 0:
|
|
2612
2659
|
if (!this.productsLoaded) {
|
|
2613
|
-
|
|
2660
|
+
_context29.next = 2;
|
|
2614
2661
|
break;
|
|
2615
2662
|
}
|
|
2616
|
-
return
|
|
2663
|
+
return _context29.abrupt("return", attachItemRuleLimitsToTopLevelProducts(this.getAddonProductsList(), this.store.itemRuleQuantityLimits || []));
|
|
2617
2664
|
case 2:
|
|
2618
|
-
|
|
2665
|
+
_context29.next = 4;
|
|
2619
2666
|
return this.loadAllProducts();
|
|
2620
2667
|
case 4:
|
|
2621
|
-
result =
|
|
2622
|
-
return
|
|
2668
|
+
result = _context29.sent;
|
|
2669
|
+
return _context29.abrupt("return", attachItemRuleLimitsToTopLevelProducts(result.addonProducts, this.store.itemRuleQuantityLimits || []));
|
|
2623
2670
|
case 6:
|
|
2624
2671
|
case "end":
|
|
2625
|
-
return
|
|
2672
|
+
return _context29.stop();
|
|
2626
2673
|
}
|
|
2627
|
-
},
|
|
2674
|
+
}, _callee29, this);
|
|
2628
2675
|
}));
|
|
2629
2676
|
function getProductList() {
|
|
2630
2677
|
return _getProductList.apply(this, arguments);
|
|
@@ -2634,13 +2681,13 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2634
2681
|
}, {
|
|
2635
2682
|
key: "loadOpenDataConfig",
|
|
2636
2683
|
value: function () {
|
|
2637
|
-
var _loadOpenDataConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2684
|
+
var _loadOpenDataConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30() {
|
|
2638
2685
|
var lastFetchedAt, cachedData, openDataConfig;
|
|
2639
|
-
return _regeneratorRuntime().wrap(function
|
|
2640
|
-
while (1) switch (
|
|
2686
|
+
return _regeneratorRuntime().wrap(function _callee30$(_context30) {
|
|
2687
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
2641
2688
|
case 0:
|
|
2642
2689
|
if (this.store.openData) {
|
|
2643
|
-
|
|
2690
|
+
_context30.next = 2;
|
|
2644
2691
|
break;
|
|
2645
2692
|
}
|
|
2646
2693
|
throw new Error('openData 模块未初始化');
|
|
@@ -2648,42 +2695,42 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2648
2695
|
lastFetchedAt = this.store.openData.getLastFetchedAt();
|
|
2649
2696
|
cachedData = this.store.openData.getOpenData();
|
|
2650
2697
|
if (!(cachedData && lastFetchedAt && Date.now() - lastFetchedAt < VenueBookingImpl.OPEN_DATA_CACHE_TTL)) {
|
|
2651
|
-
|
|
2698
|
+
_context30.next = 7;
|
|
2652
2699
|
break;
|
|
2653
2700
|
}
|
|
2654
2701
|
this.otherParams.openData = cachedData;
|
|
2655
|
-
return
|
|
2702
|
+
return _context30.abrupt("return", cachedData);
|
|
2656
2703
|
case 7:
|
|
2657
2704
|
if (!this.loadOpenDataConfigInFlight) {
|
|
2658
|
-
|
|
2705
|
+
_context30.next = 11;
|
|
2659
2706
|
break;
|
|
2660
2707
|
}
|
|
2661
|
-
|
|
2708
|
+
_context30.next = 10;
|
|
2662
2709
|
return this.loadOpenDataConfigInFlight;
|
|
2663
2710
|
case 10:
|
|
2664
|
-
return
|
|
2711
|
+
return _context30.abrupt("return", _context30.sent);
|
|
2665
2712
|
case 11:
|
|
2666
2713
|
this.loadOpenDataConfigInFlight = this.store.openData.fetchOpenData({
|
|
2667
2714
|
scope: 'board',
|
|
2668
2715
|
target: 'venue_booking+online_store',
|
|
2669
2716
|
section_code: [].concat(OPEN_DATA_SECTION_CODES)
|
|
2670
2717
|
});
|
|
2671
|
-
|
|
2672
|
-
|
|
2718
|
+
_context30.prev = 12;
|
|
2719
|
+
_context30.next = 15;
|
|
2673
2720
|
return this.loadOpenDataConfigInFlight;
|
|
2674
2721
|
case 15:
|
|
2675
|
-
openDataConfig =
|
|
2722
|
+
openDataConfig = _context30.sent;
|
|
2676
2723
|
this.otherParams.openData = openDataConfig;
|
|
2677
|
-
return
|
|
2724
|
+
return _context30.abrupt("return", openDataConfig);
|
|
2678
2725
|
case 18:
|
|
2679
|
-
|
|
2726
|
+
_context30.prev = 18;
|
|
2680
2727
|
this.loadOpenDataConfigInFlight = null;
|
|
2681
|
-
return
|
|
2728
|
+
return _context30.finish(18);
|
|
2682
2729
|
case 21:
|
|
2683
2730
|
case "end":
|
|
2684
|
-
return
|
|
2731
|
+
return _context30.stop();
|
|
2685
2732
|
}
|
|
2686
|
-
},
|
|
2733
|
+
}, _callee30, this, [[12,, 18, 21]]);
|
|
2687
2734
|
}));
|
|
2688
2735
|
function loadOpenDataConfig() {
|
|
2689
2736
|
return _loadOpenDataConfig.apply(this, arguments);
|
|
@@ -2693,29 +2740,29 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2693
2740
|
}, {
|
|
2694
2741
|
key: "loadRuntimeConfigs",
|
|
2695
2742
|
value: function () {
|
|
2696
|
-
var _loadRuntimeConfigs = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2743
|
+
var _loadRuntimeConfigs = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31() {
|
|
2697
2744
|
var itemRuleConfigs;
|
|
2698
|
-
return _regeneratorRuntime().wrap(function
|
|
2699
|
-
while (1) switch (
|
|
2745
|
+
return _regeneratorRuntime().wrap(function _callee31$(_context31) {
|
|
2746
|
+
while (1) switch (_context31.prev = _context31.next) {
|
|
2700
2747
|
case 0:
|
|
2701
|
-
|
|
2748
|
+
_context31.next = 2;
|
|
2702
2749
|
return this.loadOpenDataConfig();
|
|
2703
2750
|
case 2:
|
|
2704
|
-
|
|
2751
|
+
_context31.next = 4;
|
|
2705
2752
|
return this.ensureItemRuleConfigsLoaded();
|
|
2706
2753
|
case 4:
|
|
2707
|
-
itemRuleConfigs =
|
|
2754
|
+
itemRuleConfigs = _context31.sent;
|
|
2708
2755
|
this.logMethodSuccess('loadRuntimeConfigs', {
|
|
2709
2756
|
itemRuleCount: itemRuleConfigs.length
|
|
2710
2757
|
});
|
|
2711
|
-
return
|
|
2758
|
+
return _context31.abrupt("return", {
|
|
2712
2759
|
itemRuleConfigs: itemRuleConfigs
|
|
2713
2760
|
});
|
|
2714
2761
|
case 7:
|
|
2715
2762
|
case "end":
|
|
2716
|
-
return
|
|
2763
|
+
return _context31.stop();
|
|
2717
2764
|
}
|
|
2718
|
-
},
|
|
2765
|
+
}, _callee31, this);
|
|
2719
2766
|
}));
|
|
2720
2767
|
function loadRuntimeConfigs() {
|
|
2721
2768
|
return _loadRuntimeConfigs.apply(this, arguments);
|
|
@@ -2725,22 +2772,22 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2725
2772
|
}, {
|
|
2726
2773
|
key: "fetchItemRuleConfigsByModelIds",
|
|
2727
2774
|
value: function () {
|
|
2728
|
-
var _fetchItemRuleConfigsByModelIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2775
|
+
var _fetchItemRuleConfigsByModelIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(strategyModelIds) {
|
|
2729
2776
|
var result, configs;
|
|
2730
|
-
return _regeneratorRuntime().wrap(function
|
|
2731
|
-
while (1) switch (
|
|
2777
|
+
return _regeneratorRuntime().wrap(function _callee32$(_context32) {
|
|
2778
|
+
while (1) switch (_context32.prev = _context32.next) {
|
|
2732
2779
|
case 0:
|
|
2733
2780
|
this.logMethodStart('fetchItemRuleConfigsByModelIds', {
|
|
2734
2781
|
strategyModelIds: strategyModelIds
|
|
2735
2782
|
});
|
|
2736
2783
|
if (strategyModelIds.length) {
|
|
2737
|
-
|
|
2784
|
+
_context32.next = 3;
|
|
2738
2785
|
break;
|
|
2739
2786
|
}
|
|
2740
|
-
return
|
|
2787
|
+
return _context32.abrupt("return", []);
|
|
2741
2788
|
case 3:
|
|
2742
|
-
|
|
2743
|
-
|
|
2789
|
+
_context32.prev = 3;
|
|
2790
|
+
_context32.next = 6;
|
|
2744
2791
|
return this.request.get('/promotion', {
|
|
2745
2792
|
skip: 1,
|
|
2746
2793
|
num: 99,
|
|
@@ -2748,7 +2795,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2748
2795
|
ids: strategyModelIds
|
|
2749
2796
|
});
|
|
2750
2797
|
case 6:
|
|
2751
|
-
result =
|
|
2798
|
+
result = _context32.sent;
|
|
2752
2799
|
configs = [];
|
|
2753
2800
|
if (result.code === 200) {
|
|
2754
2801
|
configs = result.data.list.map(function (item) {
|
|
@@ -2759,21 +2806,21 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2759
2806
|
strategyModelIds: strategyModelIds,
|
|
2760
2807
|
strategyCount: configs.length
|
|
2761
2808
|
});
|
|
2762
|
-
return
|
|
2809
|
+
return _context32.abrupt("return", configs);
|
|
2763
2810
|
case 13:
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
this.logMethodError('fetchItemRuleConfigsByModelIds',
|
|
2811
|
+
_context32.prev = 13;
|
|
2812
|
+
_context32.t0 = _context32["catch"](3);
|
|
2813
|
+
this.logMethodError('fetchItemRuleConfigsByModelIds', _context32.t0, {
|
|
2767
2814
|
strategyModelIds: strategyModelIds
|
|
2768
2815
|
});
|
|
2769
|
-
return
|
|
2816
|
+
return _context32.abrupt("return", []);
|
|
2770
2817
|
case 17:
|
|
2771
2818
|
case "end":
|
|
2772
|
-
return
|
|
2819
|
+
return _context32.stop();
|
|
2773
2820
|
}
|
|
2774
|
-
},
|
|
2821
|
+
}, _callee32, this, [[3, 13]]);
|
|
2775
2822
|
}));
|
|
2776
|
-
function fetchItemRuleConfigsByModelIds(
|
|
2823
|
+
function fetchItemRuleConfigsByModelIds(_x20) {
|
|
2777
2824
|
return _fetchItemRuleConfigsByModelIds.apply(this, arguments);
|
|
2778
2825
|
}
|
|
2779
2826
|
return fetchItemRuleConfigsByModelIds;
|
|
@@ -2781,22 +2828,22 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2781
2828
|
}, {
|
|
2782
2829
|
key: "buildPrefillProductSourceMap",
|
|
2783
2830
|
value: function () {
|
|
2784
|
-
var _buildPrefillProductSourceMap = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2831
|
+
var _buildPrefillProductSourceMap = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33() {
|
|
2785
2832
|
var sourceMap, productList, visited, collectFromValue;
|
|
2786
|
-
return _regeneratorRuntime().wrap(function
|
|
2787
|
-
while (1) switch (
|
|
2833
|
+
return _regeneratorRuntime().wrap(function _callee33$(_context33) {
|
|
2834
|
+
while (1) switch (_context33.prev = _context33.next) {
|
|
2788
2835
|
case 0:
|
|
2789
2836
|
sourceMap = new Map();
|
|
2790
|
-
|
|
2791
|
-
|
|
2837
|
+
_context33.prev = 1;
|
|
2838
|
+
_context33.next = 4;
|
|
2792
2839
|
return this.getProductList();
|
|
2793
2840
|
case 4:
|
|
2794
|
-
productList =
|
|
2841
|
+
productList = _context33.sent;
|
|
2795
2842
|
if (Array.isArray(productList)) {
|
|
2796
|
-
|
|
2843
|
+
_context33.next = 7;
|
|
2797
2844
|
break;
|
|
2798
2845
|
}
|
|
2799
|
-
return
|
|
2846
|
+
return _context33.abrupt("return", sourceMap);
|
|
2800
2847
|
case 7:
|
|
2801
2848
|
visited = new Set();
|
|
2802
2849
|
collectFromValue = function collectFromValue(value) {
|
|
@@ -2835,19 +2882,19 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2835
2882
|
}
|
|
2836
2883
|
};
|
|
2837
2884
|
collectFromValue(productList);
|
|
2838
|
-
|
|
2885
|
+
_context33.next = 15;
|
|
2839
2886
|
break;
|
|
2840
2887
|
case 12:
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
this.logMethodError('buildPrefillProductSourceMap',
|
|
2888
|
+
_context33.prev = 12;
|
|
2889
|
+
_context33.t0 = _context33["catch"](1);
|
|
2890
|
+
this.logMethodError('buildPrefillProductSourceMap', _context33.t0);
|
|
2844
2891
|
case 15:
|
|
2845
|
-
return
|
|
2892
|
+
return _context33.abrupt("return", sourceMap);
|
|
2846
2893
|
case 16:
|
|
2847
2894
|
case "end":
|
|
2848
|
-
return
|
|
2895
|
+
return _context33.stop();
|
|
2849
2896
|
}
|
|
2850
|
-
},
|
|
2897
|
+
}, _callee33, this, [[1, 12]]);
|
|
2851
2898
|
}));
|
|
2852
2899
|
function buildPrefillProductSourceMap() {
|
|
2853
2900
|
return _buildPrefillProductSourceMap.apply(this, arguments);
|
|
@@ -2862,56 +2909,56 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2862
2909
|
}, {
|
|
2863
2910
|
key: "ensureItemRuleConfigsLoaded",
|
|
2864
2911
|
value: function () {
|
|
2865
|
-
var _ensureItemRuleConfigsLoaded = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2912
|
+
var _ensureItemRuleConfigsLoaded = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35() {
|
|
2866
2913
|
var _this11 = this;
|
|
2867
|
-
return _regeneratorRuntime().wrap(function
|
|
2868
|
-
while (1) switch (
|
|
2914
|
+
return _regeneratorRuntime().wrap(function _callee35$(_context35) {
|
|
2915
|
+
while (1) switch (_context35.prev = _context35.next) {
|
|
2869
2916
|
case 0:
|
|
2870
2917
|
if (!(this.itemRuleConfigs.length > 0)) {
|
|
2871
|
-
|
|
2918
|
+
_context35.next = 2;
|
|
2872
2919
|
break;
|
|
2873
2920
|
}
|
|
2874
|
-
return
|
|
2921
|
+
return _context35.abrupt("return", this.itemRuleConfigs);
|
|
2875
2922
|
case 2:
|
|
2876
2923
|
if (!this.itemRuleConfigsPromise) {
|
|
2877
|
-
|
|
2924
|
+
_context35.next = 4;
|
|
2878
2925
|
break;
|
|
2879
2926
|
}
|
|
2880
|
-
return
|
|
2927
|
+
return _context35.abrupt("return", this.itemRuleConfigsPromise);
|
|
2881
2928
|
case 4:
|
|
2882
|
-
this.itemRuleConfigsPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2929
|
+
this.itemRuleConfigsPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34() {
|
|
2883
2930
|
var runtimeConfig, staticConfigs;
|
|
2884
|
-
return _regeneratorRuntime().wrap(function
|
|
2885
|
-
while (1) switch (
|
|
2931
|
+
return _regeneratorRuntime().wrap(function _callee34$(_context34) {
|
|
2932
|
+
while (1) switch (_context34.prev = _context34.next) {
|
|
2886
2933
|
case 0:
|
|
2887
2934
|
runtimeConfig = _this11.getItemRuleRuntimeConfig();
|
|
2888
2935
|
staticConfigs = normalizeItemRuleStrategies(runtimeConfig.strategyConfigs);
|
|
2889
2936
|
if (!(staticConfigs.length > 0)) {
|
|
2890
|
-
|
|
2937
|
+
_context34.next = 6;
|
|
2891
2938
|
break;
|
|
2892
2939
|
}
|
|
2893
2940
|
_this11.itemRuleConfigs = staticConfigs;
|
|
2894
2941
|
_this11.itemRuleEvaluator.setStrategyConfigs(staticConfigs);
|
|
2895
|
-
return
|
|
2942
|
+
return _context34.abrupt("return", _this11.itemRuleConfigs);
|
|
2896
2943
|
case 6:
|
|
2897
2944
|
_this11.itemRuleConfigs = [];
|
|
2898
2945
|
_this11.itemRuleEvaluator.setStrategyConfigs([]);
|
|
2899
|
-
return
|
|
2946
|
+
return _context34.abrupt("return", _this11.itemRuleConfigs);
|
|
2900
2947
|
case 9:
|
|
2901
2948
|
case "end":
|
|
2902
|
-
return
|
|
2949
|
+
return _context34.stop();
|
|
2903
2950
|
}
|
|
2904
|
-
},
|
|
2951
|
+
}, _callee34);
|
|
2905
2952
|
}))();
|
|
2906
|
-
|
|
2953
|
+
_context35.next = 7;
|
|
2907
2954
|
return this.itemRuleConfigsPromise;
|
|
2908
2955
|
case 7:
|
|
2909
|
-
return
|
|
2956
|
+
return _context35.abrupt("return", _context35.sent);
|
|
2910
2957
|
case 8:
|
|
2911
2958
|
case "end":
|
|
2912
|
-
return
|
|
2959
|
+
return _context35.stop();
|
|
2913
2960
|
}
|
|
2914
|
-
},
|
|
2961
|
+
}, _callee35, this);
|
|
2915
2962
|
}));
|
|
2916
2963
|
function ensureItemRuleConfigsLoaded() {
|
|
2917
2964
|
return _ensureItemRuleConfigsLoaded.apply(this, arguments);
|
|
@@ -2921,22 +2968,22 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2921
2968
|
}, {
|
|
2922
2969
|
key: "refreshItemRuleQuantityLimits",
|
|
2923
2970
|
value: function () {
|
|
2924
|
-
var _refreshItemRuleQuantityLimits = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2971
|
+
var _refreshItemRuleQuantityLimits = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36() {
|
|
2925
2972
|
var strategyConfigs, businessData, limits;
|
|
2926
|
-
return _regeneratorRuntime().wrap(function
|
|
2927
|
-
while (1) switch (
|
|
2973
|
+
return _regeneratorRuntime().wrap(function _callee36$(_context36) {
|
|
2974
|
+
while (1) switch (_context36.prev = _context36.next) {
|
|
2928
2975
|
case 0:
|
|
2929
|
-
|
|
2930
|
-
|
|
2976
|
+
_context36.prev = 0;
|
|
2977
|
+
_context36.next = 3;
|
|
2931
2978
|
return this.ensureItemRuleConfigsLoaded();
|
|
2932
2979
|
case 3:
|
|
2933
|
-
strategyConfigs =
|
|
2980
|
+
strategyConfigs = _context36.sent;
|
|
2934
2981
|
if (strategyConfigs.length) {
|
|
2935
|
-
|
|
2982
|
+
_context36.next = 7;
|
|
2936
2983
|
break;
|
|
2937
2984
|
}
|
|
2938
2985
|
this.store.itemRuleQuantityLimits = [];
|
|
2939
|
-
return
|
|
2986
|
+
return _context36.abrupt("return", []);
|
|
2940
2987
|
case 7:
|
|
2941
2988
|
businessData = buildItemRuleBusinessData({
|
|
2942
2989
|
tempOrder: this.ensureTempOrder(),
|
|
@@ -2948,18 +2995,18 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2948
2995
|
this.logMethodSuccess('refreshItemRuleQuantityLimits', {
|
|
2949
2996
|
limitCount: limits.length
|
|
2950
2997
|
});
|
|
2951
|
-
return
|
|
2998
|
+
return _context36.abrupt("return", limits);
|
|
2952
2999
|
case 14:
|
|
2953
|
-
|
|
2954
|
-
|
|
3000
|
+
_context36.prev = 14;
|
|
3001
|
+
_context36.t0 = _context36["catch"](0);
|
|
2955
3002
|
this.store.itemRuleQuantityLimits = [];
|
|
2956
|
-
this.logMethodError('refreshItemRuleQuantityLimits',
|
|
2957
|
-
return
|
|
3003
|
+
this.logMethodError('refreshItemRuleQuantityLimits', _context36.t0);
|
|
3004
|
+
return _context36.abrupt("return", []);
|
|
2958
3005
|
case 19:
|
|
2959
3006
|
case "end":
|
|
2960
|
-
return
|
|
3007
|
+
return _context36.stop();
|
|
2961
3008
|
}
|
|
2962
|
-
},
|
|
3009
|
+
}, _callee36, this, [[0, 14]]);
|
|
2963
3010
|
}));
|
|
2964
3011
|
function refreshItemRuleQuantityLimits() {
|
|
2965
3012
|
return _refreshItemRuleQuantityLimits.apply(this, arguments);
|
|
@@ -2969,32 +3016,32 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2969
3016
|
}, {
|
|
2970
3017
|
key: "applyPrefillByItemRule",
|
|
2971
3018
|
value: function () {
|
|
2972
|
-
var _applyPrefillByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3019
|
+
var _applyPrefillByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37() {
|
|
2973
3020
|
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
|
|
2975
|
-
while (1) switch (
|
|
3021
|
+
return _regeneratorRuntime().wrap(function _callee37$(_context37) {
|
|
3022
|
+
while (1) switch (_context37.prev = _context37.next) {
|
|
2976
3023
|
case 0:
|
|
2977
3024
|
if (!this.itemRulePrefillApplied) {
|
|
2978
|
-
|
|
3025
|
+
_context37.next = 2;
|
|
2979
3026
|
break;
|
|
2980
3027
|
}
|
|
2981
|
-
return
|
|
3028
|
+
return _context37.abrupt("return");
|
|
2982
3029
|
case 2:
|
|
2983
3030
|
if (this.store.order) {
|
|
2984
|
-
|
|
3031
|
+
_context37.next = 4;
|
|
2985
3032
|
break;
|
|
2986
3033
|
}
|
|
2987
|
-
return
|
|
3034
|
+
return _context37.abrupt("return");
|
|
2988
3035
|
case 4:
|
|
2989
|
-
|
|
3036
|
+
_context37.next = 6;
|
|
2990
3037
|
return this.ensureItemRuleConfigsLoaded();
|
|
2991
3038
|
case 6:
|
|
2992
|
-
strategyConfigs =
|
|
3039
|
+
strategyConfigs = _context37.sent;
|
|
2993
3040
|
if (strategyConfigs.length) {
|
|
2994
|
-
|
|
3041
|
+
_context37.next = 9;
|
|
2995
3042
|
break;
|
|
2996
3043
|
}
|
|
2997
|
-
return
|
|
3044
|
+
return _context37.abrupt("return");
|
|
2998
3045
|
case 9:
|
|
2999
3046
|
businessData = buildItemRuleBusinessData({
|
|
3000
3047
|
tempOrder: this.ensureTempOrder(),
|
|
@@ -3003,24 +3050,24 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3003
3050
|
});
|
|
3004
3051
|
prefillItems = this.itemRuleEvaluator.getPrefillItems(businessData);
|
|
3005
3052
|
if (prefillItems.length) {
|
|
3006
|
-
|
|
3053
|
+
_context37.next = 14;
|
|
3007
3054
|
break;
|
|
3008
3055
|
}
|
|
3009
3056
|
this.itemRulePrefillApplied = true;
|
|
3010
|
-
return
|
|
3057
|
+
return _context37.abrupt("return");
|
|
3011
3058
|
case 14:
|
|
3012
|
-
|
|
3059
|
+
_context37.next = 16;
|
|
3013
3060
|
return this.buildPrefillProductSourceMap();
|
|
3014
3061
|
case 16:
|
|
3015
|
-
productSourceMap =
|
|
3062
|
+
productSourceMap = _context37.sent;
|
|
3016
3063
|
tempOrder = this.ensureTempOrder();
|
|
3017
3064
|
hasChanges = false;
|
|
3018
3065
|
_iterator17 = _createForOfIteratorHelper(prefillItems);
|
|
3019
|
-
|
|
3066
|
+
_context37.prev = 20;
|
|
3020
3067
|
_iterator17.s();
|
|
3021
3068
|
case 22:
|
|
3022
3069
|
if ((_step17 = _iterator17.n()).done) {
|
|
3023
|
-
|
|
3070
|
+
_context37.next = 45;
|
|
3024
3071
|
break;
|
|
3025
3072
|
}
|
|
3026
3073
|
prefillItem = _step17.value;
|
|
@@ -3028,16 +3075,16 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3028
3075
|
productVariantId = Number((_prefillItem$product_ = prefillItem.product_variant_id) !== null && _prefillItem$product_ !== void 0 ? _prefillItem$product_ : 0);
|
|
3029
3076
|
targetQuantity = toNonNegativeInt(prefillItem.quantity);
|
|
3030
3077
|
if (!(!Number.isFinite(productId) || targetQuantity <= 0)) {
|
|
3031
|
-
|
|
3078
|
+
_context37.next = 29;
|
|
3032
3079
|
break;
|
|
3033
3080
|
}
|
|
3034
|
-
return
|
|
3081
|
+
return _context37.abrupt("continue", 43);
|
|
3035
3082
|
case 29:
|
|
3036
3083
|
if (!Number.isNaN(productVariantId)) {
|
|
3037
|
-
|
|
3084
|
+
_context37.next = 31;
|
|
3038
3085
|
break;
|
|
3039
3086
|
}
|
|
3040
|
-
return
|
|
3087
|
+
return _context37.abrupt("continue", 43);
|
|
3041
3088
|
case 31:
|
|
3042
3089
|
sourceItem = productSourceMap.get(buildProductKey(productId, productVariantId)) || productSourceMap.get(buildProductKey(productId, 0)) || null;
|
|
3043
3090
|
productIndex = getProductIdentityIndex(tempOrder.products, {
|
|
@@ -3045,7 +3092,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3045
3092
|
product_variant_id: productVariantId
|
|
3046
3093
|
});
|
|
3047
3094
|
if (!(productIndex === -1)) {
|
|
3048
|
-
|
|
3095
|
+
_context37.next = 38;
|
|
3049
3096
|
break;
|
|
3050
3097
|
}
|
|
3051
3098
|
sellingPrice = toPriceString((_sourceItem$price = sourceItem === null || sourceItem === void 0 ? void 0 : sourceItem.price) !== null && _sourceItem$price !== void 0 ? _sourceItem$price : sourceItem === null || sourceItem === void 0 ? void 0 : sourceItem.selling_price, '0.00');
|
|
@@ -3065,7 +3112,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3065
3112
|
})
|
|
3066
3113
|
}));
|
|
3067
3114
|
hasChanges = true;
|
|
3068
|
-
return
|
|
3115
|
+
return _context37.abrupt("continue", 43);
|
|
3069
3116
|
case 38:
|
|
3070
3117
|
targetProduct = tempOrder.products[productIndex];
|
|
3071
3118
|
existedQuantity = toNonNegativeInt(targetProduct.num);
|
|
@@ -3084,34 +3131,34 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3084
3131
|
hasChanges = true;
|
|
3085
3132
|
}
|
|
3086
3133
|
case 43:
|
|
3087
|
-
|
|
3134
|
+
_context37.next = 22;
|
|
3088
3135
|
break;
|
|
3089
3136
|
case 45:
|
|
3090
|
-
|
|
3137
|
+
_context37.next = 50;
|
|
3091
3138
|
break;
|
|
3092
3139
|
case 47:
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
_iterator17.e(
|
|
3140
|
+
_context37.prev = 47;
|
|
3141
|
+
_context37.t0 = _context37["catch"](20);
|
|
3142
|
+
_iterator17.e(_context37.t0);
|
|
3096
3143
|
case 50:
|
|
3097
|
-
|
|
3144
|
+
_context37.prev = 50;
|
|
3098
3145
|
_iterator17.f();
|
|
3099
|
-
return
|
|
3146
|
+
return _context37.finish(50);
|
|
3100
3147
|
case 53:
|
|
3101
3148
|
if (!hasChanges) {
|
|
3102
|
-
|
|
3149
|
+
_context37.next = 58;
|
|
3103
3150
|
break;
|
|
3104
3151
|
}
|
|
3105
3152
|
// Prefill 属于 products CRUD 的一种形式:新增后让 Rules 重算,以支持自动应用可用优惠券。
|
|
3106
3153
|
this.store.order.applyDiscount();
|
|
3107
|
-
|
|
3154
|
+
_context37.next = 57;
|
|
3108
3155
|
return this.store.order.recalculateSummary({
|
|
3109
3156
|
createIfMissing: true
|
|
3110
3157
|
});
|
|
3111
3158
|
case 57:
|
|
3112
3159
|
this.store.order.persistTempOrder();
|
|
3113
3160
|
case 58:
|
|
3114
|
-
|
|
3161
|
+
_context37.next = 60;
|
|
3115
3162
|
return this.refreshItemRuleQuantityLimits();
|
|
3116
3163
|
case 60:
|
|
3117
3164
|
this.itemRulePrefillApplied = true;
|
|
@@ -3121,9 +3168,9 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3121
3168
|
});
|
|
3122
3169
|
case 62:
|
|
3123
3170
|
case "end":
|
|
3124
|
-
return
|
|
3171
|
+
return _context37.stop();
|
|
3125
3172
|
}
|
|
3126
|
-
},
|
|
3173
|
+
}, _callee37, this, [[20, 47, 50, 53]]);
|
|
3127
3174
|
}));
|
|
3128
3175
|
function applyPrefillByItemRule() {
|
|
3129
3176
|
return _applyPrefillByItemRule.apply(this, arguments);
|
|
@@ -3133,24 +3180,24 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3133
3180
|
}, {
|
|
3134
3181
|
key: "applyItemRulePrefill",
|
|
3135
3182
|
value: function () {
|
|
3136
|
-
var _applyItemRulePrefill = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3137
|
-
return _regeneratorRuntime().wrap(function
|
|
3138
|
-
while (1) switch (
|
|
3183
|
+
var _applyItemRulePrefill = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38() {
|
|
3184
|
+
return _regeneratorRuntime().wrap(function _callee38$(_context38) {
|
|
3185
|
+
while (1) switch (_context38.prev = _context38.next) {
|
|
3139
3186
|
case 0:
|
|
3140
3187
|
this.logMethodStart('applyItemRulePrefill');
|
|
3141
|
-
|
|
3188
|
+
_context38.next = 3;
|
|
3142
3189
|
return this.applyPrefillByItemRule();
|
|
3143
3190
|
case 3:
|
|
3144
|
-
|
|
3191
|
+
_context38.next = 5;
|
|
3145
3192
|
return this.refreshItemRuleQuantityLimits();
|
|
3146
3193
|
case 5:
|
|
3147
|
-
|
|
3194
|
+
_context38.next = 7;
|
|
3148
3195
|
return this.refreshCartValidationPassed();
|
|
3149
3196
|
case 7:
|
|
3150
3197
|
case "end":
|
|
3151
|
-
return
|
|
3198
|
+
return _context38.stop();
|
|
3152
3199
|
}
|
|
3153
|
-
},
|
|
3200
|
+
}, _callee38, this);
|
|
3154
3201
|
}));
|
|
3155
3202
|
function applyItemRulePrefill() {
|
|
3156
3203
|
return _applyItemRulePrefill.apply(this, arguments);
|
|
@@ -3160,20 +3207,20 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3160
3207
|
}, {
|
|
3161
3208
|
key: "evaluateCartValidationByItemRule",
|
|
3162
3209
|
value: function () {
|
|
3163
|
-
var _evaluateCartValidationByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3210
|
+
var _evaluateCartValidationByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39() {
|
|
3164
3211
|
var strategyConfigs, businessData;
|
|
3165
|
-
return _regeneratorRuntime().wrap(function
|
|
3166
|
-
while (1) switch (
|
|
3212
|
+
return _regeneratorRuntime().wrap(function _callee39$(_context39) {
|
|
3213
|
+
while (1) switch (_context39.prev = _context39.next) {
|
|
3167
3214
|
case 0:
|
|
3168
|
-
|
|
3215
|
+
_context39.next = 2;
|
|
3169
3216
|
return this.ensureItemRuleConfigsLoaded();
|
|
3170
3217
|
case 2:
|
|
3171
|
-
strategyConfigs =
|
|
3218
|
+
strategyConfigs = _context39.sent;
|
|
3172
3219
|
if (strategyConfigs.length) {
|
|
3173
|
-
|
|
3220
|
+
_context39.next = 5;
|
|
3174
3221
|
break;
|
|
3175
3222
|
}
|
|
3176
|
-
return
|
|
3223
|
+
return _context39.abrupt("return", {
|
|
3177
3224
|
passed: true,
|
|
3178
3225
|
failures: []
|
|
3179
3226
|
});
|
|
@@ -3183,12 +3230,12 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3183
3230
|
runtimeConfig: this.getItemRuleRuntimeConfig(),
|
|
3184
3231
|
itemRuleConfigs: this.itemRuleConfigs
|
|
3185
3232
|
});
|
|
3186
|
-
return
|
|
3233
|
+
return _context39.abrupt("return", this.itemRuleEvaluator.validateCart(businessData));
|
|
3187
3234
|
case 7:
|
|
3188
3235
|
case "end":
|
|
3189
|
-
return
|
|
3236
|
+
return _context39.stop();
|
|
3190
3237
|
}
|
|
3191
|
-
},
|
|
3238
|
+
}, _callee39, this);
|
|
3192
3239
|
}));
|
|
3193
3240
|
function evaluateCartValidationByItemRule() {
|
|
3194
3241
|
return _evaluateCartValidationByItemRule.apply(this, arguments);
|
|
@@ -3198,20 +3245,20 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3198
3245
|
}, {
|
|
3199
3246
|
key: "validateBeforeSubmitByItemRule",
|
|
3200
3247
|
value: function () {
|
|
3201
|
-
var _validateBeforeSubmitByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3248
|
+
var _validateBeforeSubmitByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40() {
|
|
3202
3249
|
var validationResult, firstFailure, errorMessage, error;
|
|
3203
|
-
return _regeneratorRuntime().wrap(function
|
|
3204
|
-
while (1) switch (
|
|
3250
|
+
return _regeneratorRuntime().wrap(function _callee40$(_context40) {
|
|
3251
|
+
while (1) switch (_context40.prev = _context40.next) {
|
|
3205
3252
|
case 0:
|
|
3206
|
-
|
|
3253
|
+
_context40.next = 2;
|
|
3207
3254
|
return this.evaluateCartValidationByItemRule();
|
|
3208
3255
|
case 2:
|
|
3209
|
-
validationResult =
|
|
3256
|
+
validationResult = _context40.sent;
|
|
3210
3257
|
if (!validationResult.passed) {
|
|
3211
|
-
|
|
3258
|
+
_context40.next = 5;
|
|
3212
3259
|
break;
|
|
3213
3260
|
}
|
|
3214
|
-
return
|
|
3261
|
+
return _context40.abrupt("return");
|
|
3215
3262
|
case 5:
|
|
3216
3263
|
firstFailure = validationResult.failures[0];
|
|
3217
3264
|
errorMessage = (firstFailure === null || firstFailure === void 0 ? void 0 : firstFailure.validationMessage) || '当前购物车未满足商品规则,请调整后再提交';
|
|
@@ -3220,9 +3267,9 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3220
3267
|
throw error;
|
|
3221
3268
|
case 10:
|
|
3222
3269
|
case "end":
|
|
3223
|
-
return
|
|
3270
|
+
return _context40.stop();
|
|
3224
3271
|
}
|
|
3225
|
-
},
|
|
3272
|
+
}, _callee40, this);
|
|
3226
3273
|
}));
|
|
3227
3274
|
function validateBeforeSubmitByItemRule() {
|
|
3228
3275
|
return _validateBeforeSubmitByItemRule.apply(this, arguments);
|
|
@@ -3232,10 +3279,10 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3232
3279
|
}, {
|
|
3233
3280
|
key: "refreshCartValidationPassed",
|
|
3234
3281
|
value: function () {
|
|
3235
|
-
var _refreshCartValidationPassed = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3282
|
+
var _refreshCartValidationPassed = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41() {
|
|
3236
3283
|
var previous, nextState, validationResult, changed;
|
|
3237
|
-
return _regeneratorRuntime().wrap(function
|
|
3238
|
-
while (1) switch (
|
|
3284
|
+
return _regeneratorRuntime().wrap(function _callee41$(_context41) {
|
|
3285
|
+
while (1) switch (_context41.prev = _context41.next) {
|
|
3239
3286
|
case 0:
|
|
3240
3287
|
previous = this.store.cartValidation || {
|
|
3241
3288
|
passed: null,
|
|
@@ -3245,20 +3292,20 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3245
3292
|
passed: null,
|
|
3246
3293
|
failures: []
|
|
3247
3294
|
};
|
|
3248
|
-
|
|
3249
|
-
|
|
3295
|
+
_context41.prev = 2;
|
|
3296
|
+
_context41.next = 5;
|
|
3250
3297
|
return this.evaluateCartValidationByItemRule();
|
|
3251
3298
|
case 5:
|
|
3252
|
-
validationResult =
|
|
3299
|
+
validationResult = _context41.sent;
|
|
3253
3300
|
nextState = {
|
|
3254
3301
|
passed: validationResult.passed,
|
|
3255
3302
|
failures: validationResult.failures || []
|
|
3256
3303
|
};
|
|
3257
|
-
|
|
3304
|
+
_context41.next = 12;
|
|
3258
3305
|
break;
|
|
3259
3306
|
case 9:
|
|
3260
|
-
|
|
3261
|
-
|
|
3307
|
+
_context41.prev = 9;
|
|
3308
|
+
_context41.t0 = _context41["catch"](2);
|
|
3262
3309
|
nextState = {
|
|
3263
3310
|
passed: false,
|
|
3264
3311
|
failures: []
|
|
@@ -3267,21 +3314,21 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3267
3314
|
this.store.cartValidation = nextState;
|
|
3268
3315
|
changed = previous.passed !== nextState.passed || previous.failures !== nextState.failures;
|
|
3269
3316
|
if (!changed) {
|
|
3270
|
-
|
|
3317
|
+
_context41.next = 17;
|
|
3271
3318
|
break;
|
|
3272
3319
|
}
|
|
3273
|
-
|
|
3320
|
+
_context41.next = 17;
|
|
3274
3321
|
return this.core.effects.emit(VenueBookingHooks.onCartValidationChanged, {
|
|
3275
3322
|
cartValidation: nextState,
|
|
3276
3323
|
cartValidationPassed: nextState.passed
|
|
3277
3324
|
});
|
|
3278
3325
|
case 17:
|
|
3279
|
-
return
|
|
3326
|
+
return _context41.abrupt("return", nextState.passed);
|
|
3280
3327
|
case 18:
|
|
3281
3328
|
case "end":
|
|
3282
|
-
return
|
|
3329
|
+
return _context41.stop();
|
|
3283
3330
|
}
|
|
3284
|
-
},
|
|
3331
|
+
}, _callee41, this, [[2, 9]]);
|
|
3285
3332
|
}));
|
|
3286
3333
|
function refreshCartValidationPassed() {
|
|
3287
3334
|
return _refreshCartValidationPassed.apply(this, arguments);
|
|
@@ -3291,14 +3338,14 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3291
3338
|
}, {
|
|
3292
3339
|
key: "setItemRuleRuntimeConfig",
|
|
3293
3340
|
value: function () {
|
|
3294
|
-
var _setItemRuleRuntimeConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3341
|
+
var _setItemRuleRuntimeConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42() {
|
|
3295
3342
|
var _this$itemRuleRuntime, _this$itemRuleRuntime2;
|
|
3296
3343
|
var config,
|
|
3297
|
-
|
|
3298
|
-
return _regeneratorRuntime().wrap(function
|
|
3299
|
-
while (1) switch (
|
|
3344
|
+
_args42 = arguments;
|
|
3345
|
+
return _regeneratorRuntime().wrap(function _callee42$(_context42) {
|
|
3346
|
+
while (1) switch (_context42.prev = _context42.next) {
|
|
3300
3347
|
case 0:
|
|
3301
|
-
config =
|
|
3348
|
+
config = _args42.length > 0 && _args42[0] !== undefined ? _args42[0] : {};
|
|
3302
3349
|
this.logMethodStart('setItemRuleRuntimeConfig');
|
|
3303
3350
|
this.itemRuleRuntimeConfig = _objectSpread(_objectSpread(_objectSpread({}, this.itemRuleRuntimeConfig), config), {}, {
|
|
3304
3351
|
pax: _objectSpread(_objectSpread({}, ((_this$itemRuleRuntime = this.itemRuleRuntimeConfig) === null || _this$itemRuleRuntime === void 0 ? void 0 : _this$itemRuleRuntime.pax) || {}), (config === null || config === void 0 ? void 0 : config.pax) || {}),
|
|
@@ -3310,10 +3357,10 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3310
3357
|
this.itemRuleEvaluator.setStrategyConfigs([]);
|
|
3311
3358
|
}
|
|
3312
3359
|
this.itemRulePrefillApplied = false;
|
|
3313
|
-
|
|
3360
|
+
_context42.next = 7;
|
|
3314
3361
|
return this.refreshItemRuleQuantityLimits();
|
|
3315
3362
|
case 7:
|
|
3316
|
-
|
|
3363
|
+
_context42.next = 9;
|
|
3317
3364
|
return this.refreshCartValidationPassed();
|
|
3318
3365
|
case 9:
|
|
3319
3366
|
this.logMethodSuccess('setItemRuleRuntimeConfig', {
|
|
@@ -3321,9 +3368,9 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3321
3368
|
});
|
|
3322
3369
|
case 10:
|
|
3323
3370
|
case "end":
|
|
3324
|
-
return
|
|
3371
|
+
return _context42.stop();
|
|
3325
3372
|
}
|
|
3326
|
-
},
|
|
3373
|
+
}, _callee42, this);
|
|
3327
3374
|
}));
|
|
3328
3375
|
function setItemRuleRuntimeConfig() {
|
|
3329
3376
|
return _setItemRuleRuntimeConfig.apply(this, arguments);
|
|
@@ -3412,25 +3459,25 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3412
3459
|
}, {
|
|
3413
3460
|
key: "checkOpenDataAvailability",
|
|
3414
3461
|
value: function () {
|
|
3415
|
-
var _checkOpenDataAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3416
|
-
return _regeneratorRuntime().wrap(function
|
|
3417
|
-
while (1) switch (
|
|
3462
|
+
var _checkOpenDataAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43() {
|
|
3463
|
+
return _regeneratorRuntime().wrap(function _callee43$(_context43) {
|
|
3464
|
+
while (1) switch (_context43.prev = _context43.next) {
|
|
3418
3465
|
case 0:
|
|
3419
3466
|
if (this.store.openData) {
|
|
3420
|
-
|
|
3467
|
+
_context43.next = 2;
|
|
3421
3468
|
break;
|
|
3422
3469
|
}
|
|
3423
3470
|
throw new Error('openData 模块未初始化');
|
|
3424
3471
|
case 2:
|
|
3425
|
-
|
|
3472
|
+
_context43.next = 4;
|
|
3426
3473
|
return this.loadOpenDataConfig();
|
|
3427
3474
|
case 4:
|
|
3428
|
-
return
|
|
3475
|
+
return _context43.abrupt("return", this.store.openData.checkAvailability(this.store.schedule));
|
|
3429
3476
|
case 5:
|
|
3430
3477
|
case "end":
|
|
3431
|
-
return
|
|
3478
|
+
return _context43.stop();
|
|
3432
3479
|
}
|
|
3433
|
-
},
|
|
3480
|
+
}, _callee43, this);
|
|
3434
3481
|
}));
|
|
3435
3482
|
function checkOpenDataAvailability() {
|
|
3436
3483
|
return _checkOpenDataAvailability.apply(this, arguments);
|
|
@@ -3440,15 +3487,15 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3440
3487
|
}, {
|
|
3441
3488
|
key: "setOtherParams",
|
|
3442
3489
|
value: function () {
|
|
3443
|
-
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3490
|
+
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(params) {
|
|
3444
3491
|
var _ref5,
|
|
3445
3492
|
_ref5$cover,
|
|
3446
3493
|
cover,
|
|
3447
|
-
|
|
3448
|
-
return _regeneratorRuntime().wrap(function
|
|
3449
|
-
while (1) switch (
|
|
3494
|
+
_args44 = arguments;
|
|
3495
|
+
return _regeneratorRuntime().wrap(function _callee44$(_context44) {
|
|
3496
|
+
while (1) switch (_context44.prev = _context44.next) {
|
|
3450
3497
|
case 0:
|
|
3451
|
-
_ref5 =
|
|
3498
|
+
_ref5 = _args44.length > 1 && _args44[1] !== undefined ? _args44[1] : {}, _ref5$cover = _ref5.cover, cover = _ref5$cover === void 0 ? false : _ref5$cover;
|
|
3452
3499
|
if (cover) {
|
|
3453
3500
|
this.otherParams = params;
|
|
3454
3501
|
} else {
|
|
@@ -3456,11 +3503,11 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3456
3503
|
}
|
|
3457
3504
|
case 2:
|
|
3458
3505
|
case "end":
|
|
3459
|
-
return
|
|
3506
|
+
return _context44.stop();
|
|
3460
3507
|
}
|
|
3461
|
-
},
|
|
3508
|
+
}, _callee44, this);
|
|
3462
3509
|
}));
|
|
3463
|
-
function setOtherParams(
|
|
3510
|
+
function setOtherParams(_x21) {
|
|
3464
3511
|
return _setOtherParams.apply(this, arguments);
|
|
3465
3512
|
}
|
|
3466
3513
|
return setOtherParams;
|