@pisell/pisellos 0.10.90 → 0.10.91
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/model/strategy/adapter/itemRule/adapter.d.ts +3 -1
- package/dist/model/strategy/adapter/itemRule/adapter.js +74 -7
- package/dist/model/strategy/adapter/itemRule/evaluator.d.ts +3 -1
- package/dist/model/strategy/adapter/itemRule/evaluator.js +13 -0
- package/dist/model/strategy/adapter/itemRule/type.d.ts +40 -1
- package/dist/model/strategy/adapter/itemRule/type.js +10 -0
- package/dist/model/strategy/adapter/promotion/evaluator.d.ts +2 -1
- package/dist/model/strategy/adapter/promotion/evaluator.js +103 -112
- package/dist/modules/BookingContext/utils/calendarBooking.d.ts +15 -0
- package/dist/modules/BookingContext/utils/calendarBooking.js +207 -0
- package/dist/modules/BookingContext/utils/index.d.ts +1 -0
- package/dist/modules/BookingContext/utils/index.js +1 -0
- package/dist/modules/BookingContext/utils/productExtend.d.ts +21 -0
- package/dist/modules/BookingContext/utils/productExtend.js +132 -33
- package/dist/modules/BookingContext/utils/resources.js +1 -1
- package/dist/modules/Cart/index.js +4 -3
- package/dist/modules/Cart/types.d.ts +2 -0
- package/dist/modules/Cart/utils/cartProduct.d.ts +3 -1
- package/dist/modules/Cart/utils/cartProduct.js +59 -32
- package/dist/modules/Date/index.d.ts +1 -1
- package/dist/modules/Date/index.js +60 -14
- package/dist/modules/Date/types.d.ts +5 -0
- package/dist/modules/OpenData/salesSettings.js +1 -1
- package/dist/modules/OpenData/types.d.ts +9 -0
- package/dist/modules/OpenData/utils.d.ts +1 -1
- package/dist/modules/OpenData/utils.js +3 -2
- package/dist/modules/Order/index.d.ts +22 -7
- package/dist/modules/Order/index.js +1565 -1161
- package/dist/modules/Order/localEftposState.d.ts +13 -0
- package/dist/modules/Order/localEftposState.js +39 -0
- package/dist/modules/Order/types.d.ts +33 -11
- package/dist/modules/Order/types.js +2 -2
- package/dist/modules/Order/unpaidAmountGap.d.ts +6 -0
- package/dist/modules/Order/unpaidAmountGap.js +72 -0
- package/dist/modules/Order/utils.d.ts +4 -1
- package/dist/modules/Order/utils.js +75 -52
- package/dist/modules/Payment/walletpass.js +32 -6
- package/dist/modules/Product/types.d.ts +16 -0
- package/dist/modules/ProductList/index.js +1 -1
- package/dist/modules/ResourcePlanner/planner.d.ts +2 -0
- package/dist/modules/ResourcePlanner/planner.js +383 -24
- package/dist/modules/ResourcePlanner/types.d.ts +42 -0
- package/dist/modules/Rules/index.js +86 -54
- package/dist/modules/Schedule/index.d.ts +7 -1
- package/dist/modules/Schedule/index.js +155 -39
- package/dist/modules/Schedule/types.d.ts +2 -0
- package/dist/modules/bookingReadValidation.d.ts +6 -0
- package/dist/modules/bookingReadValidation.js +72 -0
- package/dist/plugins/request.d.ts +2 -0
- package/dist/server/index.d.ts +9 -0
- package/dist/server/index.js +1928 -1462
- package/dist/server/modules/form/index.d.ts +19 -0
- package/dist/server/modules/form/index.js +205 -0
- package/dist/server/modules/form/types.d.ts +13 -0
- package/dist/server/modules/form/types.js +3 -0
- package/dist/server/modules/index.d.ts +3 -0
- package/dist/server/modules/index.js +4 -0
- package/dist/server/modules/order/index.d.ts +21 -0
- package/dist/server/modules/order/index.js +1399 -831
- package/dist/server/modules/order/types.d.ts +3 -0
- package/dist/server/modules/order/utils/filterOrders.js +20 -0
- package/dist/server/modules/products/index.d.ts +28 -7
- package/dist/server/modules/products/index.js +1295 -769
- package/dist/server/modules/products/replication.d.ts +8 -0
- package/dist/server/modules/products/replication.js +69 -0
- package/dist/server/modules/products/types.d.ts +12 -1
- package/dist/server/modules/products/types.js +4 -0
- package/dist/shared/receipt/customerInvoiceLanguages.d.ts +1 -1
- package/dist/shared/receipt/customerInvoiceLanguages.js +5 -3
- package/dist/shared/receipt/small-ticket.d.ts +1 -0
- package/dist/shared/receipt/small-ticket.js +58 -26
- package/dist/shared/receipt/templateVisibility.d.ts +3 -0
- package/dist/shared/receipt/templateVisibility.js +6 -2
- package/dist/solution/BaseSales/fulfillmentItemRules.d.ts +27 -0
- package/dist/solution/BaseSales/fulfillmentItemRules.js +750 -0
- package/dist/solution/BaseSales/index.d.ts +22 -6
- package/dist/solution/BaseSales/index.js +1881 -1347
- package/dist/solution/BaseSales/pickupTiming.d.ts +4 -0
- package/dist/solution/BaseSales/pickupTiming.js +35 -8
- package/dist/solution/BaseSales/types.d.ts +4 -0
- package/dist/solution/BaseSales/types.js +1 -0
- package/dist/solution/BaseSales/utils/posDurationPricing.d.ts +21 -0
- package/dist/solution/BaseSales/utils/posDurationPricing.js +174 -0
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +2 -0
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +8 -8
- package/dist/solution/BookingByStep/index.d.ts +18 -2
- package/dist/solution/BookingByStep/index.js +681 -361
- package/dist/solution/BookingByStep/utils/resources.d.ts +10 -0
- package/dist/solution/BookingByStep/utils/resources.js +117 -76
- package/dist/solution/BookingTicket/index.d.ts +6 -0
- package/dist/solution/BookingTicket/index.js +666 -593
- package/dist/solution/BookingTicket/types.d.ts +1 -1
- package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +2 -1
- package/dist/solution/BookingTicket/utils/addProductDecision.js +35 -8
- package/dist/solution/BookingTicket/utils/redeemArrival.d.ts +3 -3
- package/dist/solution/BookingTicket/utils/resolveUniqueCartDetail.d.ts +8 -0
- package/dist/solution/BookingTicket/utils/resolveUniqueCartDetail.js +188 -0
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +58 -94
- package/dist/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.d.ts +1 -3
- package/dist/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.js +33 -62
- package/dist/solution/OrderInvoicePreview/index.js +4 -3
- package/dist/solution/Sales/index.js +1 -1
- package/dist/solution/ScanOrder/index.d.ts +2 -0
- package/dist/solution/ScanOrder/index.js +230 -97
- package/dist/solution/ScanOrder/menuAvailability.d.ts +24 -0
- package/dist/solution/ScanOrder/menuAvailability.js +363 -0
- package/dist/solution/ScanOrder/types.d.ts +3 -0
- package/dist/solution/UnifiedBookingSales/index.d.ts +42 -10
- package/dist/solution/UnifiedBookingSales/index.js +2493 -1496
- package/dist/solution/UnifiedBookingSales/salesSettings.js +1 -1
- package/dist/solution/UnifiedBookingSales/types.d.ts +20 -5
- package/dist/utils/pos-receipt-auto-print.d.ts +4 -0
- package/dist/utils/pos-receipt-auto-print.js +14 -0
- package/lib/model/strategy/adapter/itemRule/adapter.d.ts +3 -1
- package/lib/model/strategy/adapter/itemRule/adapter.js +54 -4
- package/lib/model/strategy/adapter/itemRule/evaluator.d.ts +3 -1
- package/lib/model/strategy/adapter/itemRule/evaluator.js +9 -0
- package/lib/model/strategy/adapter/itemRule/type.d.ts +40 -1
- package/lib/model/strategy/adapter/itemRule/type.js +10 -0
- package/lib/model/strategy/adapter/promotion/evaluator.d.ts +2 -1
- package/lib/model/strategy/adapter/promotion/evaluator.js +22 -21
- package/lib/modules/BookingContext/utils/calendarBooking.d.ts +15 -0
- package/lib/modules/BookingContext/utils/calendarBooking.js +156 -0
- package/lib/modules/BookingContext/utils/index.d.ts +1 -0
- package/lib/modules/BookingContext/utils/index.js +11 -0
- package/lib/modules/BookingContext/utils/productExtend.d.ts +21 -0
- package/lib/modules/BookingContext/utils/productExtend.js +104 -5
- package/lib/modules/BookingContext/utils/resources.js +1 -1
- package/lib/modules/Cart/index.js +4 -2
- package/lib/modules/Cart/types.d.ts +2 -0
- package/lib/modules/Cart/utils/cartProduct.d.ts +3 -1
- package/lib/modules/Cart/utils/cartProduct.js +39 -20
- package/lib/modules/Date/index.d.ts +1 -1
- package/lib/modules/Date/index.js +28 -5
- package/lib/modules/Date/types.d.ts +5 -0
- package/lib/modules/OpenData/salesSettings.js +1 -1
- package/lib/modules/OpenData/types.d.ts +9 -0
- package/lib/modules/OpenData/utils.d.ts +1 -1
- package/lib/modules/OpenData/utils.js +3 -2
- package/lib/modules/Order/index.d.ts +22 -7
- package/lib/modules/Order/index.js +457 -174
- package/lib/modules/Order/localEftposState.d.ts +13 -0
- package/lib/modules/Order/localEftposState.js +44 -0
- package/lib/modules/Order/types.d.ts +33 -11
- package/lib/modules/Order/types.js +2 -2
- package/lib/modules/Order/unpaidAmountGap.d.ts +6 -0
- package/lib/modules/Order/unpaidAmountGap.js +60 -0
- package/lib/modules/Order/utils.d.ts +4 -1
- package/lib/modules/Order/utils.js +29 -3
- package/lib/modules/Payment/walletpass.js +23 -1
- package/lib/modules/Product/types.d.ts +16 -0
- package/lib/modules/ProductList/index.js +1 -1
- package/lib/modules/ResourcePlanner/planner.d.ts +2 -0
- package/lib/modules/ResourcePlanner/planner.js +299 -9
- package/lib/modules/ResourcePlanner/types.d.ts +42 -0
- package/lib/modules/Rules/index.js +32 -3
- package/lib/modules/Schedule/index.d.ts +7 -1
- package/lib/modules/Schedule/index.js +68 -4
- package/lib/modules/Schedule/types.d.ts +2 -0
- package/lib/modules/bookingReadValidation.d.ts +6 -0
- package/lib/modules/bookingReadValidation.js +56 -0
- package/lib/plugins/request.d.ts +2 -0
- package/lib/server/index.d.ts +9 -0
- package/lib/server/index.js +279 -30
- package/lib/server/modules/form/index.d.ts +19 -0
- package/lib/server/modules/form/index.js +73 -0
- package/lib/server/modules/form/types.d.ts +13 -0
- package/lib/server/modules/form/types.js +9 -0
- package/lib/server/modules/index.d.ts +3 -0
- package/lib/server/modules/index.js +15 -1
- package/lib/server/modules/order/index.d.ts +21 -0
- package/lib/server/modules/order/index.js +344 -35
- package/lib/server/modules/order/types.d.ts +3 -0
- package/lib/server/modules/order/utils/filterOrders.js +18 -0
- package/lib/server/modules/products/index.d.ts +28 -7
- package/lib/server/modules/products/index.js +224 -62
- package/lib/server/modules/products/replication.d.ts +8 -0
- package/lib/server/modules/products/replication.js +30 -0
- package/lib/server/modules/products/types.d.ts +12 -1
- package/lib/server/modules/products/types.js +3 -0
- package/lib/shared/receipt/customerInvoiceLanguages.d.ts +1 -1
- package/lib/shared/receipt/customerInvoiceLanguages.js +5 -3
- package/lib/shared/receipt/small-ticket.d.ts +1 -0
- package/lib/shared/receipt/small-ticket.js +53 -25
- package/lib/shared/receipt/templateVisibility.d.ts +3 -0
- package/lib/shared/receipt/templateVisibility.js +6 -2
- package/lib/solution/BaseSales/fulfillmentItemRules.d.ts +27 -0
- package/lib/solution/BaseSales/fulfillmentItemRules.js +259 -0
- package/lib/solution/BaseSales/index.d.ts +22 -6
- package/lib/solution/BaseSales/index.js +347 -59
- package/lib/solution/BaseSales/pickupTiming.d.ts +4 -0
- package/lib/solution/BaseSales/pickupTiming.js +24 -3
- package/lib/solution/BaseSales/types.d.ts +4 -0
- package/lib/solution/BaseSales/types.js +1 -0
- package/lib/solution/BaseSales/utils/posDurationPricing.d.ts +21 -0
- package/lib/solution/BaseSales/utils/posDurationPricing.js +133 -0
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +2 -0
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +1 -1
- package/lib/solution/BookingByStep/index.d.ts +18 -2
- package/lib/solution/BookingByStep/index.js +229 -17
- package/lib/solution/BookingByStep/utils/resources.d.ts +10 -0
- package/lib/solution/BookingByStep/utils/resources.js +25 -15
- package/lib/solution/BookingTicket/index.d.ts +6 -0
- package/lib/solution/BookingTicket/index.js +40 -5
- package/lib/solution/BookingTicket/types.d.ts +1 -1
- package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +2 -1
- package/lib/solution/BookingTicket/utils/addProductDecision.js +34 -4
- package/lib/solution/BookingTicket/utils/redeemArrival.d.ts +3 -3
- package/lib/solution/BookingTicket/utils/resolveUniqueCartDetail.d.ts +8 -0
- package/lib/solution/BookingTicket/utils/resolveUniqueCartDetail.js +136 -0
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +2 -14
- package/lib/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.d.ts +1 -3
- package/lib/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.js +17 -34
- package/lib/solution/OrderInvoicePreview/index.js +1 -0
- package/lib/solution/Sales/index.js +1 -1
- package/lib/solution/ScanOrder/index.d.ts +2 -0
- package/lib/solution/ScanOrder/index.js +131 -22
- package/lib/solution/ScanOrder/menuAvailability.d.ts +24 -0
- package/lib/solution/ScanOrder/menuAvailability.js +203 -0
- package/lib/solution/ScanOrder/types.d.ts +3 -0
- package/lib/solution/UnifiedBookingSales/index.d.ts +42 -10
- package/lib/solution/UnifiedBookingSales/index.js +717 -144
- package/lib/solution/UnifiedBookingSales/salesSettings.js +1 -1
- package/lib/solution/UnifiedBookingSales/types.d.ts +20 -5
- package/lib/utils/pos-receipt-auto-print.d.ts +4 -0
- package/lib/utils/pos-receipt-auto-print.js +13 -0
- package/package.json +1 -1
|
@@ -56,6 +56,7 @@ import { createUuidV4 } from "../../modules/Order/utils";
|
|
|
56
56
|
import { extractCustomerContactInfo, isContactRecord } from "../../modules/OpenData/contactInfo";
|
|
57
57
|
import { isCustomerUserPlatform } from "../../utils/platform";
|
|
58
58
|
import { cloneDeep } from 'lodash-es';
|
|
59
|
+
import { FormHooks } from "../../server/modules/form/types";
|
|
59
60
|
var OPEN_DATA_SECTION_CODES = ['sale', 'reservation', 'fulfillment', 'menu', 'workflow', 'documents'];
|
|
60
61
|
var OPEN_DATA_CACHE_TTL = 5 * 60 * 1000;
|
|
61
62
|
var USER_PLATFORM = ['pc', 'h5'];
|
|
@@ -214,6 +215,21 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
214
215
|
return !channel || channel === 'system' ? 'pos' : channel;
|
|
215
216
|
}
|
|
216
217
|
|
|
218
|
+
/** 供销售展示层按 booking.resources[].form_id 读取当前多语言表单标题。 */
|
|
219
|
+
}, {
|
|
220
|
+
key: "getFormTitleMap",
|
|
221
|
+
value: function getFormTitleMap() {
|
|
222
|
+
var _this$core2, _this$core2$getTitleM;
|
|
223
|
+
return ((_this$core2 = this.core) === null || _this$core2 === void 0 || (_this$core2 = _this$core2.server) === null || _this$core2 === void 0 || (_this$core2 = _this$core2.form) === null || _this$core2 === void 0 || (_this$core2$getTitleM = _this$core2.getTitleMap) === null || _this$core2$getTitleM === void 0 ? void 0 : _this$core2$getTitleM.call(_this$core2)) || {};
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/** 表单定义由 Ably 更新后通知展示层刷新,不改动订单里的历史 metadata。 */
|
|
227
|
+
}, {
|
|
228
|
+
key: "onFormTitlesChanged",
|
|
229
|
+
value: function onFormTitlesChanged(callback) {
|
|
230
|
+
return this.core.effects.on(FormHooks.onChanged, callback);
|
|
231
|
+
}
|
|
232
|
+
|
|
217
233
|
/**
|
|
218
234
|
* 业务侧子模块工厂:BookingTicket 自带的 createBookingTicketModule 优先匹配;
|
|
219
235
|
* 未识别的模块名(如 BookingByStep 公共类型)回退到父类工厂。
|
|
@@ -479,29 +495,48 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
479
495
|
return loadContactInfoOpenData;
|
|
480
496
|
}()
|
|
481
497
|
}, {
|
|
482
|
-
key: "
|
|
498
|
+
key: "loadFulfillmentItemRuleOpenData",
|
|
483
499
|
value: function () {
|
|
484
|
-
var
|
|
485
|
-
var openData;
|
|
500
|
+
var _loadFulfillmentItemRuleOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
486
501
|
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
487
502
|
while (1) switch (_context6.prev = _context6.next) {
|
|
488
503
|
case 0:
|
|
489
|
-
_context6.
|
|
504
|
+
return _context6.abrupt("return", this.store.openData ? this.getOpenData() : _get(_getPrototypeOf(BookingTicketImpl.prototype), "loadFulfillmentItemRuleOpenData", this).call(this));
|
|
505
|
+
case 1:
|
|
506
|
+
case "end":
|
|
507
|
+
return _context6.stop();
|
|
508
|
+
}
|
|
509
|
+
}, _callee6, this);
|
|
510
|
+
}));
|
|
511
|
+
function loadFulfillmentItemRuleOpenData() {
|
|
512
|
+
return _loadFulfillmentItemRuleOpenData.apply(this, arguments);
|
|
513
|
+
}
|
|
514
|
+
return loadFulfillmentItemRuleOpenData;
|
|
515
|
+
}()
|
|
516
|
+
}, {
|
|
517
|
+
key: "getInvoiceLayoutConfig",
|
|
518
|
+
value: function () {
|
|
519
|
+
var _getInvoiceLayoutConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
|
520
|
+
var openData;
|
|
521
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
522
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
523
|
+
case 0:
|
|
524
|
+
_context7.next = 2;
|
|
490
525
|
return this.loadOpenDataConfig();
|
|
491
526
|
case 2:
|
|
492
|
-
openData =
|
|
527
|
+
openData = _context7.sent;
|
|
493
528
|
if (openData) {
|
|
494
|
-
|
|
529
|
+
_context7.next = 5;
|
|
495
530
|
break;
|
|
496
531
|
}
|
|
497
|
-
return
|
|
532
|
+
return _context7.abrupt("return", getDefaultInvoiceLayoutConfig());
|
|
498
533
|
case 5:
|
|
499
|
-
return
|
|
534
|
+
return _context7.abrupt("return", this.store.openData.getInvoiceLayoutConfig());
|
|
500
535
|
case 6:
|
|
501
536
|
case "end":
|
|
502
|
-
return
|
|
537
|
+
return _context7.stop();
|
|
503
538
|
}
|
|
504
|
-
},
|
|
539
|
+
}, _callee7, this);
|
|
505
540
|
}));
|
|
506
541
|
function getInvoiceLayoutConfig() {
|
|
507
542
|
return _getInvoiceLayoutConfig.apply(this, arguments);
|
|
@@ -511,27 +546,27 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
511
546
|
}, {
|
|
512
547
|
key: "getInvoiceTemplateSettings",
|
|
513
548
|
value: function () {
|
|
514
|
-
var _getInvoiceTemplateSettings = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
549
|
+
var _getInvoiceTemplateSettings = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
|
|
515
550
|
var openData;
|
|
516
|
-
return _regeneratorRuntime().wrap(function
|
|
517
|
-
while (1) switch (
|
|
551
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
552
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
518
553
|
case 0:
|
|
519
|
-
|
|
554
|
+
_context8.next = 2;
|
|
520
555
|
return this.loadOpenDataConfig();
|
|
521
556
|
case 2:
|
|
522
|
-
openData =
|
|
557
|
+
openData = _context8.sent;
|
|
523
558
|
if (openData) {
|
|
524
|
-
|
|
559
|
+
_context8.next = 5;
|
|
525
560
|
break;
|
|
526
561
|
}
|
|
527
|
-
return
|
|
562
|
+
return _context8.abrupt("return", getDefaultInvoiceTemplateSettings());
|
|
528
563
|
case 5:
|
|
529
|
-
return
|
|
564
|
+
return _context8.abrupt("return", this.store.openData.getInvoiceTemplateSettings());
|
|
530
565
|
case 6:
|
|
531
566
|
case "end":
|
|
532
|
-
return
|
|
567
|
+
return _context8.stop();
|
|
533
568
|
}
|
|
534
|
-
},
|
|
569
|
+
}, _callee8, this);
|
|
535
570
|
}));
|
|
536
571
|
function getInvoiceTemplateSettings() {
|
|
537
572
|
return _getInvoiceTemplateSettings.apply(this, arguments);
|
|
@@ -561,32 +596,32 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
561
596
|
}, {
|
|
562
597
|
key: "getShortNumberOrDeviceId",
|
|
563
598
|
value: function () {
|
|
564
|
-
var _getShortNumberOrDeviceId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
599
|
+
var _getShortNumberOrDeviceId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
|
|
565
600
|
var getAsyncIotDeviceInfo, res;
|
|
566
|
-
return _regeneratorRuntime().wrap(function
|
|
567
|
-
while (1) switch (
|
|
601
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
602
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
568
603
|
case 0:
|
|
569
604
|
getAsyncIotDeviceInfo = this.getAppData('async_iot_device_info');
|
|
570
605
|
if (!getAsyncIotDeviceInfo) {
|
|
571
|
-
|
|
606
|
+
_context9.next = 7;
|
|
572
607
|
break;
|
|
573
608
|
}
|
|
574
|
-
|
|
609
|
+
_context9.next = 4;
|
|
575
610
|
return getAsyncIotDeviceInfo === null || getAsyncIotDeviceInfo === void 0 ? void 0 : getAsyncIotDeviceInfo();
|
|
576
611
|
case 4:
|
|
577
|
-
res =
|
|
612
|
+
res = _context9.sent;
|
|
578
613
|
if (!(res !== null && res !== void 0 && res.short_number)) {
|
|
579
|
-
|
|
614
|
+
_context9.next = 7;
|
|
580
615
|
break;
|
|
581
616
|
}
|
|
582
|
-
return
|
|
617
|
+
return _context9.abrupt("return", res === null || res === void 0 ? void 0 : res.short_number);
|
|
583
618
|
case 7:
|
|
584
|
-
return
|
|
619
|
+
return _context9.abrupt("return", String(this.getAppData('device_id') || 0).slice(-2));
|
|
585
620
|
case 8:
|
|
586
621
|
case "end":
|
|
587
|
-
return
|
|
622
|
+
return _context9.stop();
|
|
588
623
|
}
|
|
589
|
-
},
|
|
624
|
+
}, _callee9, this);
|
|
590
625
|
}));
|
|
591
626
|
function getShortNumberOrDeviceId() {
|
|
592
627
|
return _getShortNumberOrDeviceId.apply(this, arguments);
|
|
@@ -596,40 +631,40 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
596
631
|
}, {
|
|
597
632
|
key: "configureIdGeneratorFromOpenData",
|
|
598
633
|
value: function () {
|
|
599
|
-
var _configureIdGeneratorFromOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
634
|
+
var _configureIdGeneratorFromOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
|
|
600
635
|
var _this$otherParams5, _openDataConfig, _openDataConfig2, _openDataConfig3, _openDataConfig4, _openDataConfig5, _openDataConfig6;
|
|
601
|
-
var idGenerator, openDataConfig, receiptSequenceLength, receiptSequenceStart, prefix, shopOrderPrefix, resetReceiptSequenceDaily, operatingDayBoundary, deviceId, businessCode;
|
|
602
|
-
return _regeneratorRuntime().wrap(function
|
|
603
|
-
while (1) switch (
|
|
636
|
+
var idGenerator, openDataConfig, receiptSequenceLength, receiptSequenceStart, prefix, shopOrderPrefix, resetReceiptSequenceDaily, operatingDayBoundary, deviceId, businessCode, _openDataConfig7, _openDataConfig8, _openDataConfig9;
|
|
637
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
638
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
604
639
|
case 0:
|
|
605
640
|
if (!isCustomerUserPlatform((_this$otherParams5 = this.otherParams) === null || _this$otherParams5 === void 0 ? void 0 : _this$otherParams5.platform)) {
|
|
606
|
-
|
|
641
|
+
_context10.next = 2;
|
|
607
642
|
break;
|
|
608
643
|
}
|
|
609
|
-
return
|
|
644
|
+
return _context10.abrupt("return");
|
|
610
645
|
case 2:
|
|
611
646
|
// 业务码切换或配置失败时不能复用上一次初始化的短号。
|
|
612
647
|
this.setPaymentNumberDevicePrefix(null);
|
|
613
648
|
idGenerator = this.getIdGeneratorPlugin(); // Optional host capability. Do not warn or cache absence: POS may register it later.
|
|
614
649
|
if (!(typeof (idGenerator === null || idGenerator === void 0 ? void 0 : idGenerator.configure) !== 'function')) {
|
|
615
|
-
|
|
650
|
+
_context10.next = 6;
|
|
616
651
|
break;
|
|
617
652
|
}
|
|
618
|
-
return
|
|
653
|
+
return _context10.abrupt("return");
|
|
619
654
|
case 6:
|
|
620
655
|
openDataConfig = null;
|
|
621
|
-
|
|
622
|
-
|
|
656
|
+
_context10.prev = 7;
|
|
657
|
+
_context10.next = 10;
|
|
623
658
|
return this.loadOpenDataConfig();
|
|
624
659
|
case 10:
|
|
625
|
-
openDataConfig =
|
|
626
|
-
|
|
660
|
+
openDataConfig = _context10.sent;
|
|
661
|
+
_context10.next = 17;
|
|
627
662
|
break;
|
|
628
663
|
case 13:
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
console.warn('[BookingTicket] OpenData 配置加载失败,跳过 idGenerator 配置',
|
|
632
|
-
return
|
|
664
|
+
_context10.prev = 13;
|
|
665
|
+
_context10.t0 = _context10["catch"](7);
|
|
666
|
+
console.warn('[BookingTicket] OpenData 配置加载失败,跳过 idGenerator 配置', _context10.t0);
|
|
667
|
+
return _context10.abrupt("return");
|
|
633
668
|
case 17:
|
|
634
669
|
// if (!openDataConfig) return;
|
|
635
670
|
receiptSequenceLength = this.normalizePositiveInteger((_openDataConfig = openDataConfig) === null || _openDataConfig === void 0 ? void 0 : _openDataConfig['sale.short_number_digits'], 5);
|
|
@@ -641,29 +676,30 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
641
676
|
"type": "start_time",
|
|
642
677
|
"time": "00:00"
|
|
643
678
|
};
|
|
644
|
-
|
|
679
|
+
_context10.next = 25;
|
|
645
680
|
return this.getShortNumberOrDeviceId();
|
|
646
681
|
case 25:
|
|
647
|
-
deviceId =
|
|
682
|
+
deviceId = _context10.sent;
|
|
648
683
|
this.setPaymentNumberDevicePrefix(deviceId);
|
|
649
684
|
businessCode = this.getBookingTicketBusinessCode();
|
|
650
685
|
if (businessCode) {
|
|
651
|
-
|
|
686
|
+
_context10.next = 31;
|
|
652
687
|
break;
|
|
653
688
|
}
|
|
654
689
|
console.warn('[BookingTicket] businessCode 缺失,跳过 idGenerator 配置');
|
|
655
|
-
return
|
|
690
|
+
return _context10.abrupt("return");
|
|
656
691
|
case 31:
|
|
657
|
-
|
|
658
|
-
|
|
692
|
+
_context10.prev = 31;
|
|
693
|
+
_context10.next = 34;
|
|
659
694
|
return idGenerator.configure({
|
|
660
695
|
biz: businessCode,
|
|
661
696
|
config: {
|
|
662
697
|
prefix: prefix,
|
|
663
698
|
deviceCode: deviceId,
|
|
664
|
-
|
|
665
|
-
padReceiptSequence: false,
|
|
699
|
+
padReceiptSequence: ((_openDataConfig7 = openDataConfig) === null || _openDataConfig7 === void 0 ? void 0 : _openDataConfig7['sale.pad_with_leading_zeros']) === true,
|
|
666
700
|
receiptSequenceLength: receiptSequenceLength,
|
|
701
|
+
receiptSequenceMax: this.normalizeShortNumberMaximum((_openDataConfig8 = openDataConfig) === null || _openDataConfig8 === void 0 ? void 0 : _openDataConfig8['sale.maximum_number']),
|
|
702
|
+
randomReceiptSequence: ((_openDataConfig9 = openDataConfig) === null || _openDataConfig9 === void 0 ? void 0 : _openDataConfig9['sale.short_number_random']) === true,
|
|
667
703
|
resetReceiptSequenceDaily: resetReceiptSequenceDaily,
|
|
668
704
|
receiptSequenceResetTime: operatingDayBoundary === null || operatingDayBoundary === void 0 ? void 0 : operatingDayBoundary.time,
|
|
669
705
|
receiptSequenceStart: receiptSequenceStart,
|
|
@@ -671,17 +707,17 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
671
707
|
}
|
|
672
708
|
});
|
|
673
709
|
case 34:
|
|
674
|
-
|
|
710
|
+
_context10.next = 39;
|
|
675
711
|
break;
|
|
676
712
|
case 36:
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
console.warn('[BookingTicket] idGenerator 配置失败',
|
|
713
|
+
_context10.prev = 36;
|
|
714
|
+
_context10.t1 = _context10["catch"](31);
|
|
715
|
+
console.warn('[BookingTicket] idGenerator 配置失败', _context10.t1);
|
|
680
716
|
case 39:
|
|
681
717
|
case "end":
|
|
682
|
-
return
|
|
718
|
+
return _context10.stop();
|
|
683
719
|
}
|
|
684
|
-
},
|
|
720
|
+
}, _callee10, this, [[7, 13], [31, 36]]);
|
|
685
721
|
}));
|
|
686
722
|
function configureIdGeneratorFromOpenData() {
|
|
687
723
|
return _configureIdGeneratorFromOpenData.apply(this, arguments);
|
|
@@ -695,6 +731,19 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
695
731
|
if (!Number.isInteger(numeric) || numeric <= 0) return fallback;
|
|
696
732
|
return numeric;
|
|
697
733
|
}
|
|
734
|
+
}, {
|
|
735
|
+
key: "normalizeShortNumberMaximum",
|
|
736
|
+
value: function normalizeShortNumberMaximum(value) {
|
|
737
|
+
if (value === undefined || value === null || typeof value === 'string' && !value.trim()) return null;
|
|
738
|
+
if (typeof value !== 'number' && typeof value !== 'string') {
|
|
739
|
+
throw new Error('sale.maximum_number 必须是安全正整数或空值');
|
|
740
|
+
}
|
|
741
|
+
var numeric = Number(value);
|
|
742
|
+
if (!Number.isSafeInteger(numeric) || numeric <= 0) {
|
|
743
|
+
throw new Error('sale.maximum_number 必须是安全正整数或空值');
|
|
744
|
+
}
|
|
745
|
+
return numeric;
|
|
746
|
+
}
|
|
698
747
|
}, {
|
|
699
748
|
key: "normalizeIdPrefix",
|
|
700
749
|
value: function normalizeIdPrefix(value, fallback) {
|
|
@@ -713,16 +762,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
713
762
|
}, {
|
|
714
763
|
key: "loadSalesDetail",
|
|
715
764
|
value: (function () {
|
|
716
|
-
var _loadSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
765
|
+
var _loadSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(orderIdOrParams) {
|
|
717
766
|
var _ref3;
|
|
718
767
|
var sales, customerModule, detailCustomer, orderCustomerSnapshot, protocolCustomerId, protocolCustomer, selectedCustomer, _selectedCustomer$nam, _ref4, detailCustomerId, detailCustomerRest, rawId, customer;
|
|
719
|
-
return _regeneratorRuntime().wrap(function
|
|
720
|
-
while (1) switch (
|
|
768
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
769
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
721
770
|
case 0:
|
|
722
|
-
|
|
771
|
+
_context11.next = 2;
|
|
723
772
|
return _get(_getPrototypeOf(BookingTicketImpl.prototype), "loadSalesDetail", this).call(this, orderIdOrParams);
|
|
724
773
|
case 2:
|
|
725
|
-
sales =
|
|
774
|
+
sales = _context11.sent;
|
|
726
775
|
customerModule = this.store.customer;
|
|
727
776
|
detailCustomer = sales === null || sales === void 0 ? void 0 : sales.customer;
|
|
728
777
|
orderCustomerSnapshot = this.store.order.getOrderCustomerSnapshot();
|
|
@@ -754,12 +803,12 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
754
803
|
});
|
|
755
804
|
// await this.store.order.saveDraft();
|
|
756
805
|
}
|
|
757
|
-
return
|
|
806
|
+
return _context11.abrupt("return", sales);
|
|
758
807
|
case 11:
|
|
759
808
|
case "end":
|
|
760
|
-
return
|
|
809
|
+
return _context11.stop();
|
|
761
810
|
}
|
|
762
|
-
},
|
|
811
|
+
}, _callee11, this);
|
|
763
812
|
}));
|
|
764
813
|
function loadSalesDetail(_x3) {
|
|
765
814
|
return _loadSalesDetail.apply(this, arguments);
|
|
@@ -769,56 +818,56 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
769
818
|
}, {
|
|
770
819
|
key: "scanPromotionCode",
|
|
771
820
|
value: function () {
|
|
772
|
-
var _scanPromotionCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
821
|
+
var _scanPromotionCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(code, customerId) {
|
|
773
822
|
var raw, scannedList, extractedCustomerId, hasOrderCustomer, isUserPlatform, tempOrder;
|
|
774
|
-
return _regeneratorRuntime().wrap(function
|
|
775
|
-
while (1) switch (
|
|
823
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
824
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
776
825
|
case 0:
|
|
777
826
|
if (this.store.order) {
|
|
778
|
-
|
|
827
|
+
_context12.next = 2;
|
|
779
828
|
break;
|
|
780
829
|
}
|
|
781
830
|
throw new Error('order 模块未初始化');
|
|
782
831
|
case 2:
|
|
783
|
-
|
|
832
|
+
_context12.next = 4;
|
|
784
833
|
return this.store.order.scanCode(code, customerId);
|
|
785
834
|
case 4:
|
|
786
|
-
raw =
|
|
835
|
+
raw = _context12.sent;
|
|
787
836
|
scannedList = raw.scannedDiscountList || [];
|
|
788
837
|
extractedCustomerId = this.getDiscountCustomerId(scannedList);
|
|
789
838
|
hasOrderCustomer = Boolean(this.store.order.getOrderCustomer());
|
|
790
839
|
isUserPlatform = USER_PLATFORM.includes(this.otherParams.platform); // 缺 Holder 等场景 isAvailable=false,但仍需把 Pass 归属客户带入订单,供 Holder 弹窗使用。
|
|
791
840
|
if (!(!hasOrderCustomer && extractedCustomerId && !isUserPlatform)) {
|
|
792
|
-
|
|
841
|
+
_context12.next = 18;
|
|
793
842
|
break;
|
|
794
843
|
}
|
|
795
|
-
|
|
796
|
-
|
|
844
|
+
_context12.prev = 10;
|
|
845
|
+
_context12.next = 13;
|
|
797
846
|
return this.hydrateOrderCustomerFromScanDiscounts(scannedList);
|
|
798
847
|
case 13:
|
|
799
|
-
|
|
848
|
+
_context12.next = 18;
|
|
800
849
|
break;
|
|
801
850
|
case 15:
|
|
802
|
-
|
|
803
|
-
|
|
851
|
+
_context12.prev = 15;
|
|
852
|
+
_context12.t0 = _context12["catch"](10);
|
|
804
853
|
// 客户映射失败不能阻断原有 Pass 的可用性、展示或优惠处理。
|
|
805
854
|
console.warn('[BookingTicket] scan discount customer resolve failed', {
|
|
806
855
|
customerId: extractedCustomerId,
|
|
807
|
-
error:
|
|
856
|
+
error: _context12.t0
|
|
808
857
|
});
|
|
809
858
|
case 18:
|
|
810
859
|
if (!raw.isAvailable) {
|
|
811
|
-
|
|
860
|
+
_context12.next = 25;
|
|
812
861
|
break;
|
|
813
862
|
}
|
|
814
|
-
|
|
863
|
+
_context12.next = 21;
|
|
815
864
|
return this.store.order.recalculateSummary({
|
|
816
865
|
createIfMissing: true
|
|
817
866
|
});
|
|
818
867
|
case 21:
|
|
819
868
|
this.store.order.persistTempOrder();
|
|
820
869
|
tempOrder = this.store.order.ensureTempOrder();
|
|
821
|
-
|
|
870
|
+
_context12.next = 25;
|
|
822
871
|
return this.effectsEmit('onDiscountApplied', {
|
|
823
872
|
productList: tempOrder.products || [],
|
|
824
873
|
discountList: this.store.order.getDiscountList(),
|
|
@@ -826,7 +875,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
826
875
|
tempOrder: tempOrder
|
|
827
876
|
});
|
|
828
877
|
case 25:
|
|
829
|
-
return
|
|
878
|
+
return _context12.abrupt("return", _objectSpread(_objectSpread({
|
|
830
879
|
isAvailable: raw.isAvailable
|
|
831
880
|
}, raw.isAccepted !== undefined ? {
|
|
832
881
|
isAccepted: raw.isAccepted
|
|
@@ -837,9 +886,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
837
886
|
}));
|
|
838
887
|
case 26:
|
|
839
888
|
case "end":
|
|
840
|
-
return
|
|
889
|
+
return _context12.stop();
|
|
841
890
|
}
|
|
842
|
-
},
|
|
891
|
+
}, _callee12, this, [[10, 15]]);
|
|
843
892
|
}));
|
|
844
893
|
function scanPromotionCode(_x4, _x5) {
|
|
845
894
|
return _scanPromotionCode.apply(this, arguments);
|
|
@@ -849,42 +898,42 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
849
898
|
}, {
|
|
850
899
|
key: "hydrateOrderCustomerFromScanDiscounts",
|
|
851
900
|
value: function () {
|
|
852
|
-
var _hydrateOrderCustomerFromScanDiscounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
901
|
+
var _hydrateOrderCustomerFromScanDiscounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(discounts) {
|
|
853
902
|
var currentOrderCustomer, customerId, customer;
|
|
854
|
-
return _regeneratorRuntime().wrap(function
|
|
855
|
-
while (1) switch (
|
|
903
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
904
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
856
905
|
case 0:
|
|
857
906
|
currentOrderCustomer = this.store.order.getOrderCustomer();
|
|
858
907
|
if (!currentOrderCustomer) {
|
|
859
|
-
|
|
908
|
+
_context13.next = 3;
|
|
860
909
|
break;
|
|
861
910
|
}
|
|
862
|
-
return
|
|
911
|
+
return _context13.abrupt("return");
|
|
863
912
|
case 3:
|
|
864
913
|
customerId = this.getDiscountCustomerId(discounts);
|
|
865
914
|
if (customerId) {
|
|
866
|
-
|
|
915
|
+
_context13.next = 6;
|
|
867
916
|
break;
|
|
868
917
|
}
|
|
869
|
-
return
|
|
918
|
+
return _context13.abrupt("return");
|
|
870
919
|
case 6:
|
|
871
|
-
|
|
920
|
+
_context13.next = 8;
|
|
872
921
|
return this.resolveCustomerByDiscountCustomerId(customerId);
|
|
873
922
|
case 8:
|
|
874
|
-
customer =
|
|
923
|
+
customer = _context13.sent;
|
|
875
924
|
if (customer) {
|
|
876
|
-
|
|
925
|
+
_context13.next = 11;
|
|
877
926
|
break;
|
|
878
927
|
}
|
|
879
|
-
return
|
|
928
|
+
return _context13.abrupt("return");
|
|
880
929
|
case 11:
|
|
881
930
|
this.store.customer.setSelectedCustomer(customer);
|
|
882
931
|
this.setOrderCustomer(customer);
|
|
883
932
|
case 13:
|
|
884
933
|
case "end":
|
|
885
|
-
return
|
|
934
|
+
return _context13.stop();
|
|
886
935
|
}
|
|
887
|
-
},
|
|
936
|
+
}, _callee13, this);
|
|
888
937
|
}));
|
|
889
938
|
function hydrateOrderCustomerFromScanDiscounts(_x6) {
|
|
890
939
|
return _hydrateOrderCustomerFromScanDiscounts.apply(this, arguments);
|
|
@@ -920,27 +969,27 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
920
969
|
}, {
|
|
921
970
|
key: "resolveCustomerById",
|
|
922
971
|
value: function () {
|
|
923
|
-
var _resolveCustomerById = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
972
|
+
var _resolveCustomerById = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(customerId) {
|
|
924
973
|
var _this2 = this;
|
|
925
974
|
var rawCustomerId, numericCustomerId, normalizedCustomerId, existingRequest, request;
|
|
926
|
-
return _regeneratorRuntime().wrap(function
|
|
927
|
-
while (1) switch (
|
|
975
|
+
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
976
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
928
977
|
case 0:
|
|
929
978
|
rawCustomerId = String(customerId !== null && customerId !== void 0 ? customerId : '').trim();
|
|
930
979
|
numericCustomerId = Number(rawCustomerId);
|
|
931
980
|
if (!(!rawCustomerId || !Number.isInteger(numericCustomerId) || numericCustomerId <= 1)) {
|
|
932
|
-
|
|
981
|
+
_context14.next = 4;
|
|
933
982
|
break;
|
|
934
983
|
}
|
|
935
|
-
return
|
|
984
|
+
return _context14.abrupt("return", null);
|
|
936
985
|
case 4:
|
|
937
986
|
normalizedCustomerId = String(numericCustomerId);
|
|
938
987
|
existingRequest = this.customerResolveRequests.get(normalizedCustomerId);
|
|
939
988
|
if (!existingRequest) {
|
|
940
|
-
|
|
989
|
+
_context14.next = 8;
|
|
941
990
|
break;
|
|
942
991
|
}
|
|
943
|
-
return
|
|
992
|
+
return _context14.abrupt("return", existingRequest);
|
|
944
993
|
case 8:
|
|
945
994
|
request = this.request.post("/customer/resolve/".concat(encodeURIComponent(normalizedCustomerId)), {
|
|
946
995
|
with_franchisor_data: 1,
|
|
@@ -960,12 +1009,12 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
960
1009
|
}
|
|
961
1010
|
});
|
|
962
1011
|
this.customerResolveRequests.set(normalizedCustomerId, request);
|
|
963
|
-
return
|
|
1012
|
+
return _context14.abrupt("return", request);
|
|
964
1013
|
case 11:
|
|
965
1014
|
case "end":
|
|
966
|
-
return
|
|
1015
|
+
return _context14.stop();
|
|
967
1016
|
}
|
|
968
|
-
},
|
|
1017
|
+
}, _callee14, this);
|
|
969
1018
|
}));
|
|
970
1019
|
function resolveCustomerById(_x7) {
|
|
971
1020
|
return _resolveCustomerById.apply(this, arguments);
|
|
@@ -1017,60 +1066,60 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1017
1066
|
}, {
|
|
1018
1067
|
key: "setBookingStatus",
|
|
1019
1068
|
value: (function () {
|
|
1020
|
-
var _setBookingStatus = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1069
|
+
var _setBookingStatus = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(status) {
|
|
1021
1070
|
var _this$store$order2, _this$store$order2$ge;
|
|
1022
1071
|
var tempOrder, orderId, scheduleId, bookings, previous, _data, res;
|
|
1023
|
-
return _regeneratorRuntime().wrap(function
|
|
1024
|
-
while (1) switch (
|
|
1072
|
+
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
1073
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
1025
1074
|
case 0:
|
|
1026
1075
|
tempOrder = (_this$store$order2 = this.store.order) === null || _this$store$order2 === void 0 || (_this$store$order2$ge = _this$store$order2.getTempOrder) === null || _this$store$order2$ge === void 0 ? void 0 : _this$store$order2$ge.call(_this$store$order2);
|
|
1027
1076
|
if (tempOrder) {
|
|
1028
|
-
|
|
1077
|
+
_context15.next = 3;
|
|
1029
1078
|
break;
|
|
1030
1079
|
}
|
|
1031
1080
|
throw new Error('setBookingStatus: tempOrder 未加载');
|
|
1032
1081
|
case 3:
|
|
1033
1082
|
orderId = tempOrder.order_id;
|
|
1034
1083
|
if (!(orderId === undefined || orderId === null)) {
|
|
1035
|
-
|
|
1084
|
+
_context15.next = 6;
|
|
1036
1085
|
break;
|
|
1037
1086
|
}
|
|
1038
1087
|
throw new Error('setBookingStatus: tempOrder.order_id 缺失');
|
|
1039
1088
|
case 6:
|
|
1040
1089
|
scheduleId = resolveScheduleId(tempOrder);
|
|
1041
1090
|
if (!(scheduleId === null)) {
|
|
1042
|
-
|
|
1091
|
+
_context15.next = 9;
|
|
1043
1092
|
break;
|
|
1044
1093
|
}
|
|
1045
1094
|
throw new Error('setBookingStatus: 无法解析 schedule id(metadata 与 root booking 均缺失)');
|
|
1046
1095
|
case 9:
|
|
1047
1096
|
bookings = Array.isArray(tempOrder.bookings) ? tempOrder.bookings : [];
|
|
1048
1097
|
previous = applyBookingsStatus(bookings, status);
|
|
1049
|
-
|
|
1050
|
-
|
|
1098
|
+
_context15.prev = 11;
|
|
1099
|
+
_context15.next = 14;
|
|
1051
1100
|
return this.request.put("/schedule/booking/appointment-status/".concat(scheduleId), {
|
|
1052
1101
|
appointment_status: status
|
|
1053
1102
|
});
|
|
1054
1103
|
case 14:
|
|
1055
|
-
res =
|
|
1056
|
-
|
|
1104
|
+
res = _context15.sent;
|
|
1105
|
+
_context15.next = 17;
|
|
1057
1106
|
return this.refreshSalesDetail();
|
|
1058
1107
|
case 17:
|
|
1059
1108
|
this.core.effects.emit("".concat(this.name, ":onBookingStatusChange"), {
|
|
1060
1109
|
orderId: orderId,
|
|
1061
1110
|
status: status
|
|
1062
1111
|
});
|
|
1063
|
-
return
|
|
1112
|
+
return _context15.abrupt("return", (_data = res === null || res === void 0 ? void 0 : res.data) !== null && _data !== void 0 ? _data : res);
|
|
1064
1113
|
case 21:
|
|
1065
|
-
|
|
1066
|
-
|
|
1114
|
+
_context15.prev = 21;
|
|
1115
|
+
_context15.t0 = _context15["catch"](11);
|
|
1067
1116
|
restoreBookingsStatus(bookings, previous);
|
|
1068
|
-
throw
|
|
1117
|
+
throw _context15.t0;
|
|
1069
1118
|
case 25:
|
|
1070
1119
|
case "end":
|
|
1071
|
-
return
|
|
1120
|
+
return _context15.stop();
|
|
1072
1121
|
}
|
|
1073
|
-
},
|
|
1122
|
+
}, _callee15, this, [[11, 21]]);
|
|
1074
1123
|
}));
|
|
1075
1124
|
function setBookingStatus(_x8) {
|
|
1076
1125
|
return _setBookingStatus.apply(this, arguments);
|
|
@@ -1101,35 +1150,35 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1101
1150
|
}, {
|
|
1102
1151
|
key: "transitionChildBooking",
|
|
1103
1152
|
value: (function () {
|
|
1104
|
-
var _transitionChildBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1153
|
+
var _transitionChildBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(params) {
|
|
1105
1154
|
var _this$store$order3, _this$store$order3$ge;
|
|
1106
1155
|
var schedule_event_id, action, tempOrder, orderId, bookings, targetStatus, previous, _data2, res;
|
|
1107
|
-
return _regeneratorRuntime().wrap(function
|
|
1108
|
-
while (1) switch (
|
|
1156
|
+
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
1157
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
1109
1158
|
case 0:
|
|
1110
1159
|
schedule_event_id = params.schedule_event_id, action = params.action;
|
|
1111
1160
|
if (!(schedule_event_id === undefined || schedule_event_id === null || schedule_event_id === '')) {
|
|
1112
|
-
|
|
1161
|
+
_context16.next = 3;
|
|
1113
1162
|
break;
|
|
1114
1163
|
}
|
|
1115
1164
|
throw new Error('transitionChildBooking: schedule_event_id 不能为空');
|
|
1116
1165
|
case 3:
|
|
1117
1166
|
if (action) {
|
|
1118
|
-
|
|
1167
|
+
_context16.next = 5;
|
|
1119
1168
|
break;
|
|
1120
1169
|
}
|
|
1121
1170
|
throw new Error('transitionChildBooking: action 不能为空');
|
|
1122
1171
|
case 5:
|
|
1123
1172
|
tempOrder = (_this$store$order3 = this.store.order) === null || _this$store$order3 === void 0 || (_this$store$order3$ge = _this$store$order3.getTempOrder) === null || _this$store$order3$ge === void 0 ? void 0 : _this$store$order3$ge.call(_this$store$order3);
|
|
1124
1173
|
if (tempOrder) {
|
|
1125
|
-
|
|
1174
|
+
_context16.next = 8;
|
|
1126
1175
|
break;
|
|
1127
1176
|
}
|
|
1128
1177
|
throw new Error('transitionChildBooking: tempOrder 未加载');
|
|
1129
1178
|
case 8:
|
|
1130
1179
|
orderId = tempOrder.order_id;
|
|
1131
1180
|
if (!(orderId === undefined || orderId === null)) {
|
|
1132
|
-
|
|
1181
|
+
_context16.next = 11;
|
|
1133
1182
|
break;
|
|
1134
1183
|
}
|
|
1135
1184
|
throw new Error('transitionChildBooking: tempOrder.order_id 缺失');
|
|
@@ -1137,14 +1186,14 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1137
1186
|
bookings = Array.isArray(tempOrder.bookings) ? tempOrder.bookings : [];
|
|
1138
1187
|
targetStatus = resolveStatusAfterTransition(action);
|
|
1139
1188
|
previous = targetStatus !== null ? applyChildBookingStatus(bookings, schedule_event_id, targetStatus) : undefined;
|
|
1140
|
-
|
|
1141
|
-
|
|
1189
|
+
_context16.prev = 14;
|
|
1190
|
+
_context16.next = 17;
|
|
1142
1191
|
return this.request.post("/schedule/booking-transition/".concat(schedule_event_id), {
|
|
1143
1192
|
action: action
|
|
1144
1193
|
});
|
|
1145
1194
|
case 17:
|
|
1146
|
-
res =
|
|
1147
|
-
|
|
1195
|
+
res = _context16.sent;
|
|
1196
|
+
_context16.next = 20;
|
|
1148
1197
|
return this.refreshSalesDetail();
|
|
1149
1198
|
case 20:
|
|
1150
1199
|
this.core.effects.emit("".concat(this.name, ":onChildBookingStatusChange"), {
|
|
@@ -1153,19 +1202,19 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1153
1202
|
action: action,
|
|
1154
1203
|
status: targetStatus
|
|
1155
1204
|
});
|
|
1156
|
-
return
|
|
1205
|
+
return _context16.abrupt("return", (_data2 = res === null || res === void 0 ? void 0 : res.data) !== null && _data2 !== void 0 ? _data2 : res);
|
|
1157
1206
|
case 24:
|
|
1158
|
-
|
|
1159
|
-
|
|
1207
|
+
_context16.prev = 24;
|
|
1208
|
+
_context16.t0 = _context16["catch"](14);
|
|
1160
1209
|
if (previous !== undefined) {
|
|
1161
1210
|
restoreChildBookingStatus(bookings, schedule_event_id, previous);
|
|
1162
1211
|
}
|
|
1163
|
-
throw
|
|
1212
|
+
throw _context16.t0;
|
|
1164
1213
|
case 28:
|
|
1165
1214
|
case "end":
|
|
1166
|
-
return
|
|
1215
|
+
return _context16.stop();
|
|
1167
1216
|
}
|
|
1168
|
-
},
|
|
1217
|
+
}, _callee16, this, [[14, 24]]);
|
|
1169
1218
|
}));
|
|
1170
1219
|
function transitionChildBooking(_x9) {
|
|
1171
1220
|
return _transitionChildBooking.apply(this, arguments);
|
|
@@ -1186,19 +1235,19 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1186
1235
|
}, {
|
|
1187
1236
|
key: "refreshSalesDetail",
|
|
1188
1237
|
value: (function () {
|
|
1189
|
-
var _refreshSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1238
|
+
var _refreshSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
|
|
1190
1239
|
var _this$store$order4, _this$store$order4$ge;
|
|
1191
1240
|
var params,
|
|
1192
1241
|
tempOrder,
|
|
1193
1242
|
orderId,
|
|
1194
|
-
|
|
1195
|
-
return _regeneratorRuntime().wrap(function
|
|
1196
|
-
while (1) switch (
|
|
1243
|
+
_args17 = arguments;
|
|
1244
|
+
return _regeneratorRuntime().wrap(function _callee17$(_context17) {
|
|
1245
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
1197
1246
|
case 0:
|
|
1198
|
-
params =
|
|
1247
|
+
params = _args17.length > 0 && _args17[0] !== undefined ? _args17[0] : {};
|
|
1199
1248
|
tempOrder = (_this$store$order4 = this.store.order) === null || _this$store$order4 === void 0 || (_this$store$order4$ge = _this$store$order4.getTempOrder) === null || _this$store$order4$ge === void 0 ? void 0 : _this$store$order4$ge.call(_this$store$order4);
|
|
1200
1249
|
if (tempOrder) {
|
|
1201
|
-
|
|
1250
|
+
_context17.next = 4;
|
|
1202
1251
|
break;
|
|
1203
1252
|
}
|
|
1204
1253
|
throw new Error('refreshSalesDetail: tempOrder 未加载');
|
|
@@ -1206,21 +1255,21 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1206
1255
|
debugger;
|
|
1207
1256
|
orderId = tempOrder.order_id || tempOrder.external_sale_number;
|
|
1208
1257
|
if (!(orderId === undefined || orderId === null)) {
|
|
1209
|
-
|
|
1258
|
+
_context17.next = 8;
|
|
1210
1259
|
break;
|
|
1211
1260
|
}
|
|
1212
|
-
return
|
|
1261
|
+
return _context17.abrupt("return", {});
|
|
1213
1262
|
case 8:
|
|
1214
|
-
return
|
|
1263
|
+
return _context17.abrupt("return", this.loadSalesDetail({
|
|
1215
1264
|
orderId: orderId,
|
|
1216
1265
|
// merge: true
|
|
1217
1266
|
forceRemote: params.forceRemote
|
|
1218
1267
|
}));
|
|
1219
1268
|
case 9:
|
|
1220
1269
|
case "end":
|
|
1221
|
-
return
|
|
1270
|
+
return _context17.stop();
|
|
1222
1271
|
}
|
|
1223
|
-
},
|
|
1272
|
+
}, _callee17, this);
|
|
1224
1273
|
}));
|
|
1225
1274
|
function refreshSalesDetail() {
|
|
1226
1275
|
return _refreshSalesDetail.apply(this, arguments);
|
|
@@ -1236,7 +1285,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1236
1285
|
}, {
|
|
1237
1286
|
key: "loadProducts",
|
|
1238
1287
|
value: (function () {
|
|
1239
|
-
var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1288
|
+
var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18() {
|
|
1240
1289
|
var params,
|
|
1241
1290
|
options,
|
|
1242
1291
|
schedule_date,
|
|
@@ -1245,20 +1294,20 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1245
1294
|
schedule_datetime,
|
|
1246
1295
|
bookingDate,
|
|
1247
1296
|
_result,
|
|
1248
|
-
|
|
1249
|
-
return _regeneratorRuntime().wrap(function
|
|
1250
|
-
while (1) switch (
|
|
1297
|
+
_args18 = arguments;
|
|
1298
|
+
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
1299
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
1251
1300
|
case 0:
|
|
1252
|
-
params =
|
|
1253
|
-
options =
|
|
1301
|
+
params = _args18.length > 0 && _args18[0] !== undefined ? _args18[0] : {};
|
|
1302
|
+
options = _args18.length > 1 ? _args18[1] : undefined;
|
|
1254
1303
|
schedule_date = params.schedule_date, customer_id = params.customer_id, menu_list_ids = params.menu_list_ids, schedule_datetime = params.schedule_datetime; // 优先写入 schedule_datetime(含时分),供加购 presetStartTime 与 TimeBar 对齐;
|
|
1255
1304
|
// requiresDetail 弹窗仍通过 formatBookingDateForUI 只取日历日 YYYY-MM-DD。
|
|
1256
1305
|
bookingDate = schedule_datetime || schedule_date || '';
|
|
1257
1306
|
if (bookingDate) {
|
|
1258
1307
|
this.setBookingDate(bookingDate);
|
|
1259
1308
|
}
|
|
1260
|
-
|
|
1261
|
-
|
|
1309
|
+
_context18.prev = 5;
|
|
1310
|
+
_context18.next = 8;
|
|
1262
1311
|
return this.store.products.loadProducts(_objectSpread(_objectSpread({
|
|
1263
1312
|
with_count: ['bundleGroup', 'optionGroup'],
|
|
1264
1313
|
with_schedule: 1
|
|
@@ -1266,20 +1315,20 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1266
1315
|
cacheId: this.cacheId
|
|
1267
1316
|
}), options);
|
|
1268
1317
|
case 8:
|
|
1269
|
-
_result =
|
|
1318
|
+
_result = _context18.sent;
|
|
1270
1319
|
this.productCatalog = Array.isArray(_result) ? _toConsumableArray(_result) : [];
|
|
1271
1320
|
this.core.effects.emit("".concat(this.name, ":onProductsLoaded"), _result);
|
|
1272
|
-
return
|
|
1321
|
+
return _context18.abrupt("return", _result);
|
|
1273
1322
|
case 14:
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
console.error('Failed to load products:',
|
|
1277
|
-
throw
|
|
1323
|
+
_context18.prev = 14;
|
|
1324
|
+
_context18.t0 = _context18["catch"](5);
|
|
1325
|
+
console.error('Failed to load products:', _context18.t0);
|
|
1326
|
+
throw _context18.t0;
|
|
1278
1327
|
case 18:
|
|
1279
1328
|
case "end":
|
|
1280
|
-
return
|
|
1329
|
+
return _context18.stop();
|
|
1281
1330
|
}
|
|
1282
|
-
},
|
|
1331
|
+
}, _callee18, this, [[5, 14]]);
|
|
1283
1332
|
}));
|
|
1284
1333
|
function loadProducts() {
|
|
1285
1334
|
return _loadProducts.apply(this, arguments);
|
|
@@ -1296,27 +1345,27 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1296
1345
|
}, {
|
|
1297
1346
|
key: "getAddTimeProducts",
|
|
1298
1347
|
value: (function () {
|
|
1299
|
-
var _getAddTimeProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1348
|
+
var _getAddTimeProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19() {
|
|
1300
1349
|
var params,
|
|
1301
1350
|
result,
|
|
1302
|
-
|
|
1303
|
-
return _regeneratorRuntime().wrap(function
|
|
1304
|
-
while (1) switch (
|
|
1351
|
+
_args19 = arguments;
|
|
1352
|
+
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
|
1353
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
1305
1354
|
case 0:
|
|
1306
|
-
params =
|
|
1307
|
-
|
|
1355
|
+
params = _args19.length > 0 && _args19[0] !== undefined ? _args19[0] : {};
|
|
1356
|
+
_context19.next = 3;
|
|
1308
1357
|
return this.store.products.getAddTimeProducts(_objectSpread(_objectSpread({}, params), {}, {
|
|
1309
1358
|
cacheId: this.cacheId
|
|
1310
1359
|
}));
|
|
1311
1360
|
case 3:
|
|
1312
|
-
result =
|
|
1361
|
+
result = _context19.sent;
|
|
1313
1362
|
this.addTimeProductsCatalog = Array.isArray(result) ? _toConsumableArray(result) : [];
|
|
1314
|
-
return
|
|
1363
|
+
return _context19.abrupt("return", result);
|
|
1315
1364
|
case 6:
|
|
1316
1365
|
case "end":
|
|
1317
|
-
return
|
|
1366
|
+
return _context19.stop();
|
|
1318
1367
|
}
|
|
1319
|
-
},
|
|
1368
|
+
}, _callee19, this);
|
|
1320
1369
|
}));
|
|
1321
1370
|
function getAddTimeProducts() {
|
|
1322
1371
|
return _getAddTimeProducts.apply(this, arguments);
|
|
@@ -1341,14 +1390,14 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1341
1390
|
}, {
|
|
1342
1391
|
key: "queryProductDetail",
|
|
1343
1392
|
value: (function () {
|
|
1344
|
-
var _queryProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1393
|
+
var _queryProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(params, options) {
|
|
1345
1394
|
var product_id, queryParams, _result2, list;
|
|
1346
|
-
return _regeneratorRuntime().wrap(function
|
|
1347
|
-
while (1) switch (
|
|
1395
|
+
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
|
1396
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
1348
1397
|
case 0:
|
|
1349
1398
|
product_id = params.product_id, queryParams = _objectWithoutProperties(params, _excluded2);
|
|
1350
|
-
|
|
1351
|
-
|
|
1399
|
+
_context20.prev = 1;
|
|
1400
|
+
_context20.next = 4;
|
|
1352
1401
|
return this.store.products.loadProducts(_objectSpread(_objectSpread({
|
|
1353
1402
|
with_count: ['bundleGroup', 'optionGroup'],
|
|
1354
1403
|
with_schedule: 1
|
|
@@ -1357,21 +1406,21 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1357
1406
|
cacheId: this.cacheId
|
|
1358
1407
|
}), options);
|
|
1359
1408
|
case 4:
|
|
1360
|
-
_result2 =
|
|
1409
|
+
_result2 = _context20.sent;
|
|
1361
1410
|
list = Array.isArray(_result2) ? _result2 : [];
|
|
1362
|
-
return
|
|
1411
|
+
return _context20.abrupt("return", list.find(function (product) {
|
|
1363
1412
|
return Number(product.id) === Number(product_id);
|
|
1364
1413
|
}));
|
|
1365
1414
|
case 9:
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
console.error('Failed to query product detail:',
|
|
1369
|
-
throw
|
|
1415
|
+
_context20.prev = 9;
|
|
1416
|
+
_context20.t0 = _context20["catch"](1);
|
|
1417
|
+
console.error('Failed to query product detail:', _context20.t0);
|
|
1418
|
+
throw _context20.t0;
|
|
1370
1419
|
case 13:
|
|
1371
1420
|
case "end":
|
|
1372
|
-
return
|
|
1421
|
+
return _context20.stop();
|
|
1373
1422
|
}
|
|
1374
|
-
},
|
|
1423
|
+
}, _callee20, this, [[1, 9]]);
|
|
1375
1424
|
}));
|
|
1376
1425
|
function queryProductDetail(_x10, _x11) {
|
|
1377
1426
|
return _queryProductDetail.apply(this, arguments);
|
|
@@ -1386,26 +1435,26 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1386
1435
|
}, {
|
|
1387
1436
|
key: "loadProductDetail",
|
|
1388
1437
|
value: (function () {
|
|
1389
|
-
var _loadProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1438
|
+
var _loadProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(params, options) {
|
|
1390
1439
|
var product_id, queryParams, products;
|
|
1391
|
-
return _regeneratorRuntime().wrap(function
|
|
1392
|
-
while (1) switch (
|
|
1440
|
+
return _regeneratorRuntime().wrap(function _callee21$(_context21) {
|
|
1441
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
1393
1442
|
case 0:
|
|
1394
1443
|
product_id = params.product_id, queryParams = _objectWithoutProperties(params, _excluded3);
|
|
1395
|
-
|
|
1444
|
+
_context21.next = 3;
|
|
1396
1445
|
return this.loadProducts(_objectSpread(_objectSpread({}, queryParams), {}, {
|
|
1397
1446
|
product_ids: [product_id]
|
|
1398
1447
|
}), options);
|
|
1399
1448
|
case 3:
|
|
1400
|
-
products =
|
|
1401
|
-
return
|
|
1449
|
+
products = _context21.sent;
|
|
1450
|
+
return _context21.abrupt("return", products.find(function (product) {
|
|
1402
1451
|
return Number(product.id) === Number(product_id);
|
|
1403
1452
|
}));
|
|
1404
1453
|
case 5:
|
|
1405
1454
|
case "end":
|
|
1406
|
-
return
|
|
1455
|
+
return _context21.stop();
|
|
1407
1456
|
}
|
|
1408
|
-
},
|
|
1457
|
+
}, _callee21, this);
|
|
1409
1458
|
}));
|
|
1410
1459
|
function loadProductDetail(_x12, _x13) {
|
|
1411
1460
|
return _loadProductDetail.apply(this, arguments);
|
|
@@ -1440,16 +1489,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1440
1489
|
}, {
|
|
1441
1490
|
key: "getProducts",
|
|
1442
1491
|
value: (function () {
|
|
1443
|
-
var _getProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1444
|
-
return _regeneratorRuntime().wrap(function
|
|
1445
|
-
while (1) switch (
|
|
1492
|
+
var _getProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22() {
|
|
1493
|
+
return _regeneratorRuntime().wrap(function _callee22$(_context22) {
|
|
1494
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
1446
1495
|
case 0:
|
|
1447
|
-
return
|
|
1496
|
+
return _context22.abrupt("return", this.store.products.getProducts());
|
|
1448
1497
|
case 1:
|
|
1449
1498
|
case "end":
|
|
1450
|
-
return
|
|
1499
|
+
return _context22.stop();
|
|
1451
1500
|
}
|
|
1452
|
-
},
|
|
1501
|
+
}, _callee22, this);
|
|
1453
1502
|
}));
|
|
1454
1503
|
function getProducts() {
|
|
1455
1504
|
return _getProducts.apply(this, arguments);
|
|
@@ -1514,33 +1563,33 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1514
1563
|
}, {
|
|
1515
1564
|
key: "getProductByIds",
|
|
1516
1565
|
value: (function () {
|
|
1517
|
-
var _getProductByIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1566
|
+
var _getProductByIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(ids, options) {
|
|
1518
1567
|
var _this$getOrderCustome, _this$getOrderCustome2, _this$getOrderCustome3;
|
|
1519
1568
|
var normalizedIds, localProducts, localProductIds, missingIds, rawBookingDate, bookingDate, customerId, loadedProducts, productById;
|
|
1520
|
-
return _regeneratorRuntime().wrap(function
|
|
1521
|
-
while (1) switch (
|
|
1569
|
+
return _regeneratorRuntime().wrap(function _callee23$(_context23) {
|
|
1570
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
1522
1571
|
case 0:
|
|
1523
1572
|
normalizedIds = Array.from(new Set((ids || []).map(function (id) {
|
|
1524
1573
|
return Number(id);
|
|
1525
1574
|
}).filter(function (id) {
|
|
1526
1575
|
return Number.isFinite(id);
|
|
1527
1576
|
})));
|
|
1528
|
-
|
|
1577
|
+
_context23.next = 3;
|
|
1529
1578
|
return this.store.products.getProductByIds(normalizedIds);
|
|
1530
1579
|
case 3:
|
|
1531
|
-
|
|
1532
|
-
if (
|
|
1533
|
-
|
|
1580
|
+
_context23.t0 = _context23.sent;
|
|
1581
|
+
if (_context23.t0) {
|
|
1582
|
+
_context23.next = 6;
|
|
1534
1583
|
break;
|
|
1535
1584
|
}
|
|
1536
|
-
|
|
1585
|
+
_context23.t0 = [];
|
|
1537
1586
|
case 6:
|
|
1538
|
-
localProducts =
|
|
1587
|
+
localProducts = _context23.t0;
|
|
1539
1588
|
if (options !== null && options !== void 0 && options.loadMissing) {
|
|
1540
|
-
|
|
1589
|
+
_context23.next = 9;
|
|
1541
1590
|
break;
|
|
1542
1591
|
}
|
|
1543
|
-
return
|
|
1592
|
+
return _context23.abrupt("return", localProducts);
|
|
1544
1593
|
case 9:
|
|
1545
1594
|
localProductIds = new Set(localProducts.map(function (product) {
|
|
1546
1595
|
return Number(product.id);
|
|
@@ -1549,15 +1598,15 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1549
1598
|
return !localProductIds.has(id);
|
|
1550
1599
|
});
|
|
1551
1600
|
if (missingIds.length) {
|
|
1552
|
-
|
|
1601
|
+
_context23.next = 13;
|
|
1553
1602
|
break;
|
|
1554
1603
|
}
|
|
1555
|
-
return
|
|
1604
|
+
return _context23.abrupt("return", localProducts);
|
|
1556
1605
|
case 13:
|
|
1557
1606
|
rawBookingDate = this.getBookingDate();
|
|
1558
1607
|
bookingDate = rawBookingDate && dayjs(rawBookingDate).isValid() ? dayjs(rawBookingDate) : null;
|
|
1559
1608
|
customerId = Number((_this$getOrderCustome = (_this$getOrderCustome2 = this.getOrderCustomerSnapshot()) === null || _this$getOrderCustome2 === void 0 ? void 0 : _this$getOrderCustome2.id) !== null && _this$getOrderCustome !== void 0 ? _this$getOrderCustome : (_this$getOrderCustome3 = this.getOrderCustomer()) === null || _this$getOrderCustome3 === void 0 ? void 0 : _this$getOrderCustome3.customer_id);
|
|
1560
|
-
|
|
1609
|
+
_context23.next = 18;
|
|
1561
1610
|
return this.store.products.loadProducts(_objectSpread(_objectSpread({
|
|
1562
1611
|
product_ids: missingIds,
|
|
1563
1612
|
with_count: ['bundleGroup', 'optionGroup'],
|
|
@@ -1570,7 +1619,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1570
1619
|
customer_id: customerId
|
|
1571
1620
|
} : {}));
|
|
1572
1621
|
case 18:
|
|
1573
|
-
loadedProducts =
|
|
1622
|
+
loadedProducts = _context23.sent;
|
|
1574
1623
|
productById = new Map();
|
|
1575
1624
|
[].concat(_toConsumableArray(localProducts), _toConsumableArray(loadedProducts || [])).forEach(function (product) {
|
|
1576
1625
|
var productId = Number(product.id);
|
|
@@ -1578,16 +1627,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1578
1627
|
productById.set(productId, product);
|
|
1579
1628
|
}
|
|
1580
1629
|
});
|
|
1581
|
-
return
|
|
1630
|
+
return _context23.abrupt("return", normalizedIds.map(function (id) {
|
|
1582
1631
|
return productById.get(id);
|
|
1583
1632
|
}).filter(function (product) {
|
|
1584
1633
|
return Boolean(product);
|
|
1585
1634
|
}));
|
|
1586
1635
|
case 22:
|
|
1587
1636
|
case "end":
|
|
1588
|
-
return
|
|
1637
|
+
return _context23.stop();
|
|
1589
1638
|
}
|
|
1590
|
-
},
|
|
1639
|
+
}, _callee23, this);
|
|
1591
1640
|
}));
|
|
1592
1641
|
function getProductByIds(_x14, _x15) {
|
|
1593
1642
|
return _getProductByIds.apply(this, arguments);
|
|
@@ -1603,25 +1652,25 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1603
1652
|
}, {
|
|
1604
1653
|
key: "getScheduleTimePoints",
|
|
1605
1654
|
value: (function () {
|
|
1606
|
-
var _getScheduleTimePoints = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1655
|
+
var _getScheduleTimePoints = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(params) {
|
|
1607
1656
|
var result;
|
|
1608
|
-
return _regeneratorRuntime().wrap(function
|
|
1609
|
-
while (1) switch (
|
|
1657
|
+
return _regeneratorRuntime().wrap(function _callee24$(_context24) {
|
|
1658
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
1610
1659
|
case 0:
|
|
1611
|
-
|
|
1660
|
+
_context24.next = 2;
|
|
1612
1661
|
return this.request.post('/menu/schedule-time-points', {
|
|
1613
1662
|
menu_list_ids: params.menu_list_ids
|
|
1614
1663
|
}, {
|
|
1615
1664
|
osServer: true
|
|
1616
1665
|
});
|
|
1617
1666
|
case 2:
|
|
1618
|
-
result =
|
|
1619
|
-
return
|
|
1667
|
+
result = _context24.sent;
|
|
1668
|
+
return _context24.abrupt("return", result.data || []);
|
|
1620
1669
|
case 4:
|
|
1621
1670
|
case "end":
|
|
1622
|
-
return
|
|
1671
|
+
return _context24.stop();
|
|
1623
1672
|
}
|
|
1624
|
-
},
|
|
1673
|
+
}, _callee24, this);
|
|
1625
1674
|
}));
|
|
1626
1675
|
function getScheduleTimePoints(_x16) {
|
|
1627
1676
|
return _getScheduleTimePoints.apply(this, arguments);
|
|
@@ -1637,30 +1686,30 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1637
1686
|
}, {
|
|
1638
1687
|
key: "getCustomerList",
|
|
1639
1688
|
value: (function () {
|
|
1640
|
-
var _getCustomerList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1689
|
+
var _getCustomerList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
|
|
1641
1690
|
var params,
|
|
1642
1691
|
_result3,
|
|
1643
|
-
|
|
1644
|
-
return _regeneratorRuntime().wrap(function
|
|
1645
|
-
while (1) switch (
|
|
1692
|
+
_args25 = arguments;
|
|
1693
|
+
return _regeneratorRuntime().wrap(function _callee25$(_context25) {
|
|
1694
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
1646
1695
|
case 0:
|
|
1647
|
-
params =
|
|
1648
|
-
|
|
1649
|
-
|
|
1696
|
+
params = _args25.length > 0 && _args25[0] !== undefined ? _args25[0] : {};
|
|
1697
|
+
_context25.prev = 1;
|
|
1698
|
+
_context25.next = 4;
|
|
1650
1699
|
return this.store.customer.getCustomerList(params);
|
|
1651
1700
|
case 4:
|
|
1652
|
-
_result3 =
|
|
1653
|
-
return
|
|
1701
|
+
_result3 = _context25.sent;
|
|
1702
|
+
return _context25.abrupt("return", _result3);
|
|
1654
1703
|
case 8:
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
console.error('Failed to get customer list:',
|
|
1658
|
-
throw
|
|
1704
|
+
_context25.prev = 8;
|
|
1705
|
+
_context25.t0 = _context25["catch"](1);
|
|
1706
|
+
console.error('Failed to get customer list:', _context25.t0);
|
|
1707
|
+
throw _context25.t0;
|
|
1659
1708
|
case 12:
|
|
1660
1709
|
case "end":
|
|
1661
|
-
return
|
|
1710
|
+
return _context25.stop();
|
|
1662
1711
|
}
|
|
1663
|
-
},
|
|
1712
|
+
}, _callee25, this, [[1, 8]]);
|
|
1664
1713
|
}));
|
|
1665
1714
|
function getCustomerList() {
|
|
1666
1715
|
return _getCustomerList.apply(this, arguments);
|
|
@@ -1861,25 +1910,25 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1861
1910
|
}, {
|
|
1862
1911
|
key: "replaceTempOrder",
|
|
1863
1912
|
value: function () {
|
|
1864
|
-
var _replaceTempOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1913
|
+
var _replaceTempOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26() {
|
|
1865
1914
|
var _get2;
|
|
1866
1915
|
var _len2,
|
|
1867
1916
|
args,
|
|
1868
1917
|
_key2,
|
|
1869
|
-
|
|
1870
|
-
return _regeneratorRuntime().wrap(function
|
|
1871
|
-
while (1) switch (
|
|
1918
|
+
_args26 = arguments;
|
|
1919
|
+
return _regeneratorRuntime().wrap(function _callee26$(_context26) {
|
|
1920
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
1872
1921
|
case 0:
|
|
1873
1922
|
this.orderCustomerContactRequest = null;
|
|
1874
|
-
for (_len2 =
|
|
1875
|
-
args[_key2] =
|
|
1923
|
+
for (_len2 = _args26.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
1924
|
+
args[_key2] = _args26[_key2];
|
|
1876
1925
|
}
|
|
1877
|
-
return
|
|
1926
|
+
return _context26.abrupt("return", (_get2 = _get(_getPrototypeOf(BookingTicketImpl.prototype), "replaceTempOrder", this)).call.apply(_get2, [this].concat(args)));
|
|
1878
1927
|
case 3:
|
|
1879
1928
|
case "end":
|
|
1880
|
-
return
|
|
1929
|
+
return _context26.stop();
|
|
1881
1930
|
}
|
|
1882
|
-
},
|
|
1931
|
+
}, _callee26, this);
|
|
1883
1932
|
}));
|
|
1884
1933
|
function replaceTempOrder() {
|
|
1885
1934
|
return _replaceTempOrder.apply(this, arguments);
|
|
@@ -1889,21 +1938,21 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1889
1938
|
}, {
|
|
1890
1939
|
key: "applyDefaultOrderCustomerContactInfo",
|
|
1891
1940
|
value: function () {
|
|
1892
|
-
var _applyDefaultOrderCustomerContactInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1893
|
-
return _regeneratorRuntime().wrap(function
|
|
1894
|
-
while (1) switch (
|
|
1941
|
+
var _applyDefaultOrderCustomerContactInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(contact) {
|
|
1942
|
+
return _regeneratorRuntime().wrap(function _callee27$(_context27) {
|
|
1943
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
1895
1944
|
case 0:
|
|
1896
1945
|
this.store.order.updateTempOrderContactsInfo(cloneDeep(contact));
|
|
1897
1946
|
// Metadata may finish after promotion/discount refresh; publish the updated cart explicitly.
|
|
1898
|
-
|
|
1947
|
+
_context27.next = 3;
|
|
1899
1948
|
return this.effectsEmit('onTempOrderReplaced', {
|
|
1900
1949
|
tempOrder: this.getTempOrder()
|
|
1901
1950
|
});
|
|
1902
1951
|
case 3:
|
|
1903
1952
|
case "end":
|
|
1904
|
-
return
|
|
1953
|
+
return _context27.stop();
|
|
1905
1954
|
}
|
|
1906
|
-
},
|
|
1955
|
+
}, _callee27, this);
|
|
1907
1956
|
}));
|
|
1908
1957
|
function applyDefaultOrderCustomerContactInfo(_x17) {
|
|
1909
1958
|
return _applyDefaultOrderCustomerContactInfo.apply(this, arguments);
|
|
@@ -1948,69 +1997,69 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1948
1997
|
};
|
|
1949
1998
|
this.orderCustomerContactRequest = pending;
|
|
1950
1999
|
var loadContact = /*#__PURE__*/function () {
|
|
1951
|
-
var _ref11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2000
|
+
var _ref11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28() {
|
|
1952
2001
|
var _result4, resolved;
|
|
1953
|
-
return _regeneratorRuntime().wrap(function
|
|
1954
|
-
while (1) switch (
|
|
2002
|
+
return _regeneratorRuntime().wrap(function _callee28$(_context28) {
|
|
2003
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
1955
2004
|
case 0:
|
|
1956
2005
|
if (!userPlatform) {
|
|
1957
|
-
|
|
2006
|
+
_context28.next = 7;
|
|
1958
2007
|
break;
|
|
1959
2008
|
}
|
|
1960
|
-
|
|
2009
|
+
_context28.next = 3;
|
|
1961
2010
|
return _this4.request.get('/customer/metadata', {
|
|
1962
2011
|
key: 'contacts_info'
|
|
1963
2012
|
});
|
|
1964
2013
|
case 3:
|
|
1965
|
-
_result4 =
|
|
2014
|
+
_result4 = _context28.sent;
|
|
1966
2015
|
if (!((_result4 === null || _result4 === void 0 ? void 0 : _result4.code) !== 200 || (_result4 === null || _result4 === void 0 ? void 0 : _result4.status) === false)) {
|
|
1967
|
-
|
|
2016
|
+
_context28.next = 6;
|
|
1968
2017
|
break;
|
|
1969
2018
|
}
|
|
1970
2019
|
throw new Error('Customer contact lookup failed');
|
|
1971
2020
|
case 6:
|
|
1972
|
-
return
|
|
2021
|
+
return _context28.abrupt("return", isContactRecord(_result4.data) ? _result4.data : null);
|
|
1973
2022
|
case 7:
|
|
1974
|
-
|
|
2023
|
+
_context28.next = 9;
|
|
1975
2024
|
return _this4.resolveCustomerById(customerId);
|
|
1976
2025
|
case 9:
|
|
1977
|
-
resolved =
|
|
1978
|
-
return
|
|
2026
|
+
resolved = _context28.sent;
|
|
2027
|
+
return _context28.abrupt("return", Number(resolved === null || resolved === void 0 ? void 0 : resolved.id) === customerId ? extractCustomerContactInfo(resolved) : null);
|
|
1979
2028
|
case 11:
|
|
1980
2029
|
case "end":
|
|
1981
|
-
return
|
|
2030
|
+
return _context28.stop();
|
|
1982
2031
|
}
|
|
1983
|
-
},
|
|
2032
|
+
}, _callee28);
|
|
1984
2033
|
}));
|
|
1985
2034
|
return function loadContact() {
|
|
1986
2035
|
return _ref11.apply(this, arguments);
|
|
1987
2036
|
};
|
|
1988
2037
|
}();
|
|
1989
2038
|
pending.promise = loadContact().then( /*#__PURE__*/function () {
|
|
1990
|
-
var _ref12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2039
|
+
var _ref12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(value) {
|
|
1991
2040
|
var _current$_extend;
|
|
1992
2041
|
var current;
|
|
1993
|
-
return _regeneratorRuntime().wrap(function
|
|
1994
|
-
while (1) switch (
|
|
2042
|
+
return _regeneratorRuntime().wrap(function _callee29$(_context29) {
|
|
2043
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
1995
2044
|
case 0:
|
|
1996
2045
|
current = _this4.getTempOrder();
|
|
1997
2046
|
if (!(_this4.orderCustomerContactRequest !== pending || _this4.getCustomerContactOrderKey() !== orderKey || Number(current === null || current === void 0 ? void 0 : current.customer_id) !== customerId || scope !== _this4.getCustomerContactScope() || current !== null && current !== void 0 && (_current$_extend = current._extend) !== null && _current$_extend !== void 0 && _current$_extend.contactInfoEdited || (current === null || current === void 0 ? void 0 : current.contacts_info) != null || userPlatform && getAuthenticatedCustomerId() !== customerId)) {
|
|
1998
|
-
|
|
2047
|
+
_context29.next = 3;
|
|
1999
2048
|
break;
|
|
2000
2049
|
}
|
|
2001
|
-
return
|
|
2050
|
+
return _context29.abrupt("return");
|
|
2002
2051
|
case 3:
|
|
2003
2052
|
if (!value) {
|
|
2004
|
-
|
|
2053
|
+
_context29.next = 6;
|
|
2005
2054
|
break;
|
|
2006
2055
|
}
|
|
2007
|
-
|
|
2056
|
+
_context29.next = 6;
|
|
2008
2057
|
return _this4.applyDefaultOrderCustomerContactInfo(value);
|
|
2009
2058
|
case 6:
|
|
2010
2059
|
case "end":
|
|
2011
|
-
return
|
|
2060
|
+
return _context29.stop();
|
|
2012
2061
|
}
|
|
2013
|
-
},
|
|
2062
|
+
}, _callee29);
|
|
2014
2063
|
}));
|
|
2015
2064
|
return function (_x18) {
|
|
2016
2065
|
return _ref12.apply(this, arguments);
|
|
@@ -2030,31 +2079,31 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2030
2079
|
}, {
|
|
2031
2080
|
key: "validateContactInfo",
|
|
2032
2081
|
value: function () {
|
|
2033
|
-
var _validateContactInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2082
|
+
var _validateContactInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30() {
|
|
2034
2083
|
var _this$getTempOrder, _this$getTempOrder2;
|
|
2035
2084
|
var orderKey, customerId, scope;
|
|
2036
|
-
return _regeneratorRuntime().wrap(function
|
|
2037
|
-
while (1) switch (
|
|
2085
|
+
return _regeneratorRuntime().wrap(function _callee30$(_context30) {
|
|
2086
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
2038
2087
|
case 0:
|
|
2039
2088
|
orderKey = this.getCustomerContactOrderKey();
|
|
2040
2089
|
customerId = (_this$getTempOrder = this.getTempOrder()) === null || _this$getTempOrder === void 0 ? void 0 : _this$getTempOrder.customer_id;
|
|
2041
2090
|
scope = this.getCustomerContactScope();
|
|
2042
|
-
|
|
2091
|
+
_context30.next = 5;
|
|
2043
2092
|
return this.waitForOrderCustomerContactInfo();
|
|
2044
2093
|
case 5:
|
|
2045
2094
|
if (!(this.getCustomerContactOrderKey() !== orderKey || ((_this$getTempOrder2 = this.getTempOrder()) === null || _this$getTempOrder2 === void 0 ? void 0 : _this$getTempOrder2.customer_id) !== customerId || this.getCustomerContactScope() !== scope)) {
|
|
2046
|
-
|
|
2095
|
+
_context30.next = 7;
|
|
2047
2096
|
break;
|
|
2048
2097
|
}
|
|
2049
2098
|
throw new Error('The order changed. Please try again.');
|
|
2050
2099
|
case 7:
|
|
2051
|
-
|
|
2100
|
+
_context30.next = 9;
|
|
2052
2101
|
return _get(_getPrototypeOf(BookingTicketImpl.prototype), "validateContactInfo", this).call(this);
|
|
2053
2102
|
case 9:
|
|
2054
2103
|
case "end":
|
|
2055
|
-
return
|
|
2104
|
+
return _context30.stop();
|
|
2056
2105
|
}
|
|
2057
|
-
},
|
|
2106
|
+
}, _callee30, this);
|
|
2058
2107
|
}));
|
|
2059
2108
|
function validateContactInfo() {
|
|
2060
2109
|
return _validateContactInfo.apply(this, arguments);
|
|
@@ -2129,24 +2178,24 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2129
2178
|
}, {
|
|
2130
2179
|
key: "restoreOrder",
|
|
2131
2180
|
value: (function () {
|
|
2132
|
-
var _restoreOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2181
|
+
var _restoreOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31() {
|
|
2133
2182
|
var _this$store$customer;
|
|
2134
2183
|
var tempOrder;
|
|
2135
|
-
return _regeneratorRuntime().wrap(function
|
|
2136
|
-
while (1) switch (
|
|
2184
|
+
return _regeneratorRuntime().wrap(function _callee31$(_context31) {
|
|
2185
|
+
while (1) switch (_context31.prev = _context31.next) {
|
|
2137
2186
|
case 0:
|
|
2138
|
-
|
|
2187
|
+
_context31.next = 2;
|
|
2139
2188
|
return _get(_getPrototypeOf(BookingTicketImpl.prototype), "restoreOrder", this).call(this);
|
|
2140
2189
|
case 2:
|
|
2141
|
-
tempOrder =
|
|
2190
|
+
tempOrder = _context31.sent;
|
|
2142
2191
|
this.clearOrderCustomer();
|
|
2143
2192
|
(_this$store$customer = this.store.customer) === null || _this$store$customer === void 0 || _this$store$customer.setSelectedCustomer(null);
|
|
2144
|
-
return
|
|
2193
|
+
return _context31.abrupt("return", tempOrder);
|
|
2145
2194
|
case 6:
|
|
2146
2195
|
case "end":
|
|
2147
|
-
return
|
|
2196
|
+
return _context31.stop();
|
|
2148
2197
|
}
|
|
2149
|
-
},
|
|
2198
|
+
}, _callee31, this);
|
|
2150
2199
|
}));
|
|
2151
2200
|
function restoreOrder() {
|
|
2152
2201
|
return _restoreOrder.apply(this, arguments);
|
|
@@ -2181,27 +2230,27 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2181
2230
|
return this.orderCustomerDiscountRefreshInFlight;
|
|
2182
2231
|
}
|
|
2183
2232
|
var previousRefresh = this.orderCustomerDiscountRefreshInFlight;
|
|
2184
|
-
var refreshTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2233
|
+
var refreshTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32() {
|
|
2185
2234
|
var _this6$store$order$ge, _this6$store$order, _this6$getOrderIdenti;
|
|
2186
2235
|
var currentCustomer, currentTempOrder, currentOrderIdentity, currentOrderId, currentAction, currentOrderTarget;
|
|
2187
|
-
return _regeneratorRuntime().wrap(function
|
|
2188
|
-
while (1) switch (
|
|
2236
|
+
return _regeneratorRuntime().wrap(function _callee32$(_context32) {
|
|
2237
|
+
while (1) switch (_context32.prev = _context32.next) {
|
|
2189
2238
|
case 0:
|
|
2190
2239
|
if (!previousRefresh) {
|
|
2191
|
-
|
|
2240
|
+
_context32.next = 3;
|
|
2192
2241
|
break;
|
|
2193
2242
|
}
|
|
2194
|
-
|
|
2243
|
+
_context32.next = 3;
|
|
2195
2244
|
return previousRefresh.catch(function () {
|
|
2196
2245
|
return undefined;
|
|
2197
2246
|
});
|
|
2198
2247
|
case 3:
|
|
2199
2248
|
currentCustomer = _this6.store.order.getOrderCustomer();
|
|
2200
2249
|
if (!(!currentCustomer || Number(currentCustomer.customer_id) !== customerId)) {
|
|
2201
|
-
|
|
2250
|
+
_context32.next = 6;
|
|
2202
2251
|
break;
|
|
2203
2252
|
}
|
|
2204
|
-
return
|
|
2253
|
+
return _context32.abrupt("return");
|
|
2205
2254
|
case 6:
|
|
2206
2255
|
currentTempOrder = (_this6$store$order$ge = (_this6$store$order = _this6.store.order).getTempOrder) === null || _this6$store$order$ge === void 0 ? void 0 : _this6$store$order$ge.call(_this6$store$order);
|
|
2207
2256
|
currentOrderIdentity = (_this6$getOrderIdenti = _this6.getOrderIdentity) === null || _this6$getOrderIdenti === void 0 ? void 0 : _this6$getOrderIdenti.call(_this6);
|
|
@@ -2209,12 +2258,12 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2209
2258
|
currentAction = !currentOrderId || String(currentOrderId).startsWith('local_order') ? 'create' : 'edit';
|
|
2210
2259
|
currentOrderTarget = currentOrderId ? "order:".concat(String(currentOrderId)) : "external:".concat(String((currentTempOrder === null || currentTempOrder === void 0 ? void 0 : currentTempOrder.external_sale_number) || (currentOrderIdentity === null || currentOrderIdentity === void 0 ? void 0 : currentOrderIdentity.externalSaleNumber) || (currentOrderIdentity === null || currentOrderIdentity === void 0 ? void 0 : currentOrderIdentity.localId) || 'new'));
|
|
2211
2260
|
if (!("".concat(customerId, ":").concat(currentAction, ":").concat(currentOrderTarget) !== refreshTarget)) {
|
|
2212
|
-
|
|
2261
|
+
_context32.next = 13;
|
|
2213
2262
|
break;
|
|
2214
2263
|
}
|
|
2215
|
-
return
|
|
2264
|
+
return _context32.abrupt("return");
|
|
2216
2265
|
case 13:
|
|
2217
|
-
|
|
2266
|
+
_context32.next = 15;
|
|
2218
2267
|
return _this6.loadDiscountConfig({
|
|
2219
2268
|
customerId: customerId,
|
|
2220
2269
|
action: action,
|
|
@@ -2222,9 +2271,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2222
2271
|
});
|
|
2223
2272
|
case 15:
|
|
2224
2273
|
case "end":
|
|
2225
|
-
return
|
|
2274
|
+
return _context32.stop();
|
|
2226
2275
|
}
|
|
2227
|
-
},
|
|
2276
|
+
}, _callee32);
|
|
2228
2277
|
}))();
|
|
2229
2278
|
this.orderCustomerDiscountRefreshInFlight = refreshTask;
|
|
2230
2279
|
this.orderCustomerDiscountRefreshCustomerId = customerId;
|
|
@@ -2247,28 +2296,28 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2247
2296
|
}, {
|
|
2248
2297
|
key: "prepareProductPriceQueryContext",
|
|
2249
2298
|
value: function () {
|
|
2250
|
-
var _prepareProductPriceQueryContext = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2299
|
+
var _prepareProductPriceQueryContext = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(customerId) {
|
|
2251
2300
|
var normalizedCustomerId, refreshTask, shouldWait;
|
|
2252
|
-
return _regeneratorRuntime().wrap(function
|
|
2253
|
-
while (1) switch (
|
|
2301
|
+
return _regeneratorRuntime().wrap(function _callee33$(_context33) {
|
|
2302
|
+
while (1) switch (_context33.prev = _context33.next) {
|
|
2254
2303
|
case 0:
|
|
2255
|
-
|
|
2304
|
+
_context33.next = 2;
|
|
2256
2305
|
return Promise.resolve();
|
|
2257
2306
|
case 2:
|
|
2258
2307
|
normalizedCustomerId = Number(customerId || 0);
|
|
2259
2308
|
refreshTask = this.orderCustomerDiscountRefreshInFlight;
|
|
2260
2309
|
shouldWait = normalizedCustomerId > 1 && this.orderCustomerDiscountRefreshCustomerId === normalizedCustomerId && Boolean(refreshTask);
|
|
2261
2310
|
if (!(shouldWait && refreshTask)) {
|
|
2262
|
-
|
|
2311
|
+
_context33.next = 8;
|
|
2263
2312
|
break;
|
|
2264
2313
|
}
|
|
2265
|
-
|
|
2314
|
+
_context33.next = 8;
|
|
2266
2315
|
return refreshTask;
|
|
2267
2316
|
case 8:
|
|
2268
2317
|
case "end":
|
|
2269
|
-
return
|
|
2318
|
+
return _context33.stop();
|
|
2270
2319
|
}
|
|
2271
|
-
},
|
|
2320
|
+
}, _callee33, this);
|
|
2272
2321
|
}));
|
|
2273
2322
|
function prepareProductPriceQueryContext(_x19) {
|
|
2274
2323
|
return _prepareProductPriceQueryContext.apply(this, arguments);
|
|
@@ -2323,27 +2372,27 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2323
2372
|
}, {
|
|
2324
2373
|
key: "changeCustomerPage",
|
|
2325
2374
|
value: (function () {
|
|
2326
|
-
var _changeCustomerPage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2375
|
+
var _changeCustomerPage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(page, pageSize) {
|
|
2327
2376
|
var _result5;
|
|
2328
|
-
return _regeneratorRuntime().wrap(function
|
|
2329
|
-
while (1) switch (
|
|
2377
|
+
return _regeneratorRuntime().wrap(function _callee34$(_context34) {
|
|
2378
|
+
while (1) switch (_context34.prev = _context34.next) {
|
|
2330
2379
|
case 0:
|
|
2331
|
-
|
|
2332
|
-
|
|
2380
|
+
_context34.prev = 0;
|
|
2381
|
+
_context34.next = 3;
|
|
2333
2382
|
return this.store.customer.changeCustomerPage(page, pageSize);
|
|
2334
2383
|
case 3:
|
|
2335
|
-
_result5 =
|
|
2336
|
-
return
|
|
2384
|
+
_result5 = _context34.sent;
|
|
2385
|
+
return _context34.abrupt("return", _result5);
|
|
2337
2386
|
case 7:
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
console.error('Failed to change customer page:',
|
|
2341
|
-
throw
|
|
2387
|
+
_context34.prev = 7;
|
|
2388
|
+
_context34.t0 = _context34["catch"](0);
|
|
2389
|
+
console.error('Failed to change customer page:', _context34.t0);
|
|
2390
|
+
throw _context34.t0;
|
|
2342
2391
|
case 11:
|
|
2343
2392
|
case "end":
|
|
2344
|
-
return
|
|
2393
|
+
return _context34.stop();
|
|
2345
2394
|
}
|
|
2346
|
-
},
|
|
2395
|
+
}, _callee34, this, [[0, 7]]);
|
|
2347
2396
|
}));
|
|
2348
2397
|
function changeCustomerPage(_x20, _x21) {
|
|
2349
2398
|
return _changeCustomerPage.apply(this, arguments);
|
|
@@ -2358,28 +2407,28 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2358
2407
|
}, {
|
|
2359
2408
|
key: "loadMoreCustomers",
|
|
2360
2409
|
value: (function () {
|
|
2361
|
-
var _loadMoreCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2410
|
+
var _loadMoreCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35() {
|
|
2362
2411
|
var _result6;
|
|
2363
|
-
return _regeneratorRuntime().wrap(function
|
|
2364
|
-
while (1) switch (
|
|
2412
|
+
return _regeneratorRuntime().wrap(function _callee35$(_context35) {
|
|
2413
|
+
while (1) switch (_context35.prev = _context35.next) {
|
|
2365
2414
|
case 0:
|
|
2366
|
-
|
|
2367
|
-
|
|
2415
|
+
_context35.prev = 0;
|
|
2416
|
+
_context35.next = 3;
|
|
2368
2417
|
return this.store.customer.loadMoreCustomers();
|
|
2369
2418
|
case 3:
|
|
2370
|
-
_result6 =
|
|
2419
|
+
_result6 = _context35.sent;
|
|
2371
2420
|
this.core.effects.emit("".concat(this.name, ":onCustomerListUpdate"), _result6);
|
|
2372
|
-
return
|
|
2421
|
+
return _context35.abrupt("return", _result6);
|
|
2373
2422
|
case 8:
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
console.error('Failed to load more customers:',
|
|
2377
|
-
throw
|
|
2423
|
+
_context35.prev = 8;
|
|
2424
|
+
_context35.t0 = _context35["catch"](0);
|
|
2425
|
+
console.error('Failed to load more customers:', _context35.t0);
|
|
2426
|
+
throw _context35.t0;
|
|
2378
2427
|
case 12:
|
|
2379
2428
|
case "end":
|
|
2380
|
-
return
|
|
2429
|
+
return _context35.stop();
|
|
2381
2430
|
}
|
|
2382
|
-
},
|
|
2431
|
+
}, _callee35, this, [[0, 8]]);
|
|
2383
2432
|
}));
|
|
2384
2433
|
function loadMoreCustomers() {
|
|
2385
2434
|
return _loadMoreCustomers.apply(this, arguments);
|
|
@@ -2395,31 +2444,31 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2395
2444
|
}, {
|
|
2396
2445
|
key: "resetAndLoadCustomers",
|
|
2397
2446
|
value: (function () {
|
|
2398
|
-
var _resetAndLoadCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2447
|
+
var _resetAndLoadCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36() {
|
|
2399
2448
|
var params,
|
|
2400
2449
|
_result7,
|
|
2401
|
-
|
|
2402
|
-
return _regeneratorRuntime().wrap(function
|
|
2403
|
-
while (1) switch (
|
|
2450
|
+
_args36 = arguments;
|
|
2451
|
+
return _regeneratorRuntime().wrap(function _callee36$(_context36) {
|
|
2452
|
+
while (1) switch (_context36.prev = _context36.next) {
|
|
2404
2453
|
case 0:
|
|
2405
|
-
params =
|
|
2406
|
-
|
|
2407
|
-
|
|
2454
|
+
params = _args36.length > 0 && _args36[0] !== undefined ? _args36[0] : {};
|
|
2455
|
+
_context36.prev = 1;
|
|
2456
|
+
_context36.next = 4;
|
|
2408
2457
|
return this.store.customer.resetAndLoadCustomers(params);
|
|
2409
2458
|
case 4:
|
|
2410
|
-
_result7 =
|
|
2459
|
+
_result7 = _context36.sent;
|
|
2411
2460
|
this.core.effects.emit("".concat(this.name, ":onCustomerListReset"), _result7);
|
|
2412
|
-
return
|
|
2461
|
+
return _context36.abrupt("return", _result7);
|
|
2413
2462
|
case 9:
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
console.error('Failed to reset and load customers:',
|
|
2417
|
-
throw
|
|
2463
|
+
_context36.prev = 9;
|
|
2464
|
+
_context36.t0 = _context36["catch"](1);
|
|
2465
|
+
console.error('Failed to reset and load customers:', _context36.t0);
|
|
2466
|
+
throw _context36.t0;
|
|
2418
2467
|
case 13:
|
|
2419
2468
|
case "end":
|
|
2420
|
-
return
|
|
2469
|
+
return _context36.stop();
|
|
2421
2470
|
}
|
|
2422
|
-
},
|
|
2471
|
+
}, _callee36, this, [[1, 9]]);
|
|
2423
2472
|
}));
|
|
2424
2473
|
function resetAndLoadCustomers() {
|
|
2425
2474
|
return _resetAndLoadCustomers.apply(this, arguments);
|
|
@@ -2580,16 +2629,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2580
2629
|
}, {
|
|
2581
2630
|
key: "getOtherParams",
|
|
2582
2631
|
value: (function () {
|
|
2583
|
-
var _getOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2584
|
-
return _regeneratorRuntime().wrap(function
|
|
2585
|
-
while (1) switch (
|
|
2632
|
+
var _getOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37() {
|
|
2633
|
+
return _regeneratorRuntime().wrap(function _callee37$(_context37) {
|
|
2634
|
+
while (1) switch (_context37.prev = _context37.next) {
|
|
2586
2635
|
case 0:
|
|
2587
|
-
return
|
|
2636
|
+
return _context37.abrupt("return", this.otherParams);
|
|
2588
2637
|
case 1:
|
|
2589
2638
|
case "end":
|
|
2590
|
-
return
|
|
2639
|
+
return _context37.stop();
|
|
2591
2640
|
}
|
|
2592
|
-
},
|
|
2641
|
+
}, _callee37, this);
|
|
2593
2642
|
}));
|
|
2594
2643
|
function getOtherParams() {
|
|
2595
2644
|
return _getOtherParams.apply(this, arguments);
|
|
@@ -2696,16 +2745,26 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2696
2745
|
}, {
|
|
2697
2746
|
key: "buildBookingCalcContext",
|
|
2698
2747
|
value: function buildBookingCalcContext(extra) {
|
|
2699
|
-
var _extra$date,
|
|
2748
|
+
var _extra$date,
|
|
2749
|
+
_extra$presetStartTim,
|
|
2750
|
+
_this$getOrderSession,
|
|
2751
|
+
_this8 = this,
|
|
2752
|
+
_this$otherParams10;
|
|
2700
2753
|
var state = this.store.bookingContext.getState();
|
|
2701
2754
|
var date = (_extra$date = extra === null || extra === void 0 ? void 0 : extra.date) !== null && _extra$date !== void 0 ? _extra$date : state.date;
|
|
2702
|
-
return _objectSpread({
|
|
2755
|
+
return _objectSpread(_objectSpread({
|
|
2703
2756
|
bookingConfig: state.bookingConfig,
|
|
2704
2757
|
resourcesOrigin: state.resourcesOrigin,
|
|
2705
2758
|
resourcesOriginMap: state.resourcesOriginMap,
|
|
2706
2759
|
date: date,
|
|
2707
2760
|
presetStartTime: (_extra$presetStartTim = extra === null || extra === void 0 ? void 0 : extra.presetStartTime) !== null && _extra$presetStartTim !== void 0 ? _extra$presetStartTim : derivePresetStartTimeFromDate(date)
|
|
2708
|
-
}, extra || {})
|
|
2761
|
+
}, extra || {}), {}, {
|
|
2762
|
+
orderSessionId: (_this$getOrderSession = this.getOrderSessionId()) !== null && _this$getOrderSession !== void 0 ? _this$getOrderSession : undefined,
|
|
2763
|
+
isOrderSessionCurrent: function isOrderSessionCurrent(sessionId) {
|
|
2764
|
+
return _this8.isOrderSessionCurrent(sessionId);
|
|
2765
|
+
},
|
|
2766
|
+
platform: String(((_this$otherParams10 = this.otherParams) === null || _this$otherParams10 === void 0 ? void 0 : _this$otherParams10.platform) || '').trim().toLowerCase()
|
|
2767
|
+
});
|
|
2709
2768
|
}
|
|
2710
2769
|
|
|
2711
2770
|
/**
|
|
@@ -2799,7 +2858,15 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2799
2858
|
}, {
|
|
2800
2859
|
key: "buildAddProductCtx",
|
|
2801
2860
|
value: function buildAddProductCtx(extra) {
|
|
2802
|
-
var _extra$date2,
|
|
2861
|
+
var _extra$date2,
|
|
2862
|
+
_ref14,
|
|
2863
|
+
_this$getOrderCustome4,
|
|
2864
|
+
_this$getOrderCustome5,
|
|
2865
|
+
_this$store$order$get5,
|
|
2866
|
+
_extra$presetStartTim2,
|
|
2867
|
+
_this$getOrderSession2,
|
|
2868
|
+
_this9 = this,
|
|
2869
|
+
_this$otherParams11;
|
|
2803
2870
|
var bookingContextState = this.store.bookingContext.getState();
|
|
2804
2871
|
var date = (_extra$date2 = extra === null || extra === void 0 ? void 0 : extra.date) !== null && _extra$date2 !== void 0 ? _extra$date2 : bookingContextState.date;
|
|
2805
2872
|
var orderCustomerId = (_ref14 = (_this$getOrderCustome4 = (_this$getOrderCustome5 = this.getOrderCustomerSnapshot()) === null || _this$getOrderCustome5 === void 0 ? void 0 : _this$getOrderCustome5.id) !== null && _this$getOrderCustome4 !== void 0 ? _this$getOrderCustome4 : (_this$store$order$get5 = this.store.order.getTempOrder()) === null || _this$store$order$get5 === void 0 ? void 0 : _this$store$order$get5.customer_id) !== null && _ref14 !== void 0 ? _ref14 : undefined;
|
|
@@ -2811,7 +2878,12 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2811
2878
|
presetStartTime: (_extra$presetStartTim2 = extra === null || extra === void 0 ? void 0 : extra.presetStartTime) !== null && _extra$presetStartTim2 !== void 0 ? _extra$presetStartTim2 : derivePresetStartTimeFromDate(date),
|
|
2812
2879
|
customerId: orderCustomerId
|
|
2813
2880
|
}, extra || {}), {}, {
|
|
2814
|
-
channel: this.getSubmitOrderSalesChannel()
|
|
2881
|
+
channel: this.getSubmitOrderSalesChannel(),
|
|
2882
|
+
orderSessionId: (_this$getOrderSession2 = this.getOrderSessionId()) !== null && _this$getOrderSession2 !== void 0 ? _this$getOrderSession2 : undefined,
|
|
2883
|
+
isOrderSessionCurrent: function isOrderSessionCurrent(sessionId) {
|
|
2884
|
+
return _this9.isOrderSessionCurrent(sessionId);
|
|
2885
|
+
},
|
|
2886
|
+
platform: String(((_this$otherParams11 = this.otherParams) === null || _this$otherParams11 === void 0 ? void 0 : _this$otherParams11.platform) || '').trim().toLowerCase()
|
|
2815
2887
|
});
|
|
2816
2888
|
}
|
|
2817
2889
|
|
|
@@ -2913,16 +2985,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2913
2985
|
}, {
|
|
2914
2986
|
key: "updateProductInOrder",
|
|
2915
2987
|
value: (function () {
|
|
2916
|
-
var _updateProductInOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2917
|
-
return _regeneratorRuntime().wrap(function
|
|
2918
|
-
while (1) switch (
|
|
2988
|
+
var _updateProductInOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38(params) {
|
|
2989
|
+
return _regeneratorRuntime().wrap(function _callee38$(_context38) {
|
|
2990
|
+
while (1) switch (_context38.prev = _context38.next) {
|
|
2919
2991
|
case 0:
|
|
2920
|
-
return
|
|
2992
|
+
return _context38.abrupt("return", this.updateOrderProduct(params));
|
|
2921
2993
|
case 1:
|
|
2922
2994
|
case "end":
|
|
2923
|
-
return
|
|
2995
|
+
return _context38.stop();
|
|
2924
2996
|
}
|
|
2925
|
-
},
|
|
2997
|
+
}, _callee38, this);
|
|
2926
2998
|
}));
|
|
2927
2999
|
function updateProductInOrder(_x22) {
|
|
2928
3000
|
return _updateProductInOrder.apply(this, arguments);
|
|
@@ -2946,24 +3018,24 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2946
3018
|
}, {
|
|
2947
3019
|
key: "handleGlobalScanCode",
|
|
2948
3020
|
value: (function () {
|
|
2949
|
-
var _handleGlobalScanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2950
|
-
var
|
|
3021
|
+
var _handleGlobalScanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40(code, bridge) {
|
|
3022
|
+
var _this10 = this;
|
|
2951
3023
|
var trimmed, _bridge$onNotify, _bridge$refresh, beforeScanCommit, beforeScanDialog, guardCallback, guardedBridge, _promotion$isAccepted, promotion, localSearch, scanCallback, raw, formatted, _bridge$onNotify2, host, _result8, _bridge$onNotify3, _bridge$isCurrent;
|
|
2952
|
-
return _regeneratorRuntime().wrap(function
|
|
2953
|
-
while (1) switch (
|
|
3024
|
+
return _regeneratorRuntime().wrap(function _callee40$(_context40) {
|
|
3025
|
+
while (1) switch (_context40.prev = _context40.next) {
|
|
2954
3026
|
case 0:
|
|
2955
3027
|
trimmed = typeof code === 'string' ? code.trim() : '';
|
|
2956
3028
|
if (trimmed) {
|
|
2957
|
-
|
|
3029
|
+
_context40.next = 4;
|
|
2958
3030
|
break;
|
|
2959
3031
|
}
|
|
2960
3032
|
bridge === null || bridge === void 0 || (_bridge$onNotify = bridge.onNotify) === null || _bridge$onNotify === void 0 || _bridge$onNotify.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
|
|
2961
|
-
return
|
|
3033
|
+
return _context40.abrupt("return", {
|
|
2962
3034
|
status: 'failed',
|
|
2963
3035
|
reason: 'empty_code'
|
|
2964
3036
|
});
|
|
2965
3037
|
case 4:
|
|
2966
|
-
|
|
3038
|
+
_context40.prev = 4;
|
|
2967
3039
|
// Capture before lookup/UI awaits, so a result cannot land in a new cart.
|
|
2968
3040
|
// Unscoped POS Order modules return a no-op guard.
|
|
2969
3041
|
beforeScanCommit = this.store.order.createCartIntentCommitGuard('add_product');
|
|
@@ -2990,23 +3062,23 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2990
3062
|
} : undefined
|
|
2991
3063
|
}) : undefined;
|
|
2992
3064
|
if (!((guardedBridge === null || guardedBridge === void 0 ? void 0 : guardedBridge.scanScope) === 'product-voucher')) {
|
|
2993
|
-
|
|
3065
|
+
_context40.next = 16;
|
|
2994
3066
|
break;
|
|
2995
3067
|
}
|
|
2996
3068
|
if (guardedBridge.applyPromotionCode) {
|
|
2997
|
-
|
|
3069
|
+
_context40.next = 12;
|
|
2998
3070
|
break;
|
|
2999
3071
|
}
|
|
3000
|
-
return
|
|
3072
|
+
return _context40.abrupt("return", {
|
|
3001
3073
|
status: 'failed',
|
|
3002
3074
|
reason: 'no_bridge'
|
|
3003
3075
|
});
|
|
3004
3076
|
case 12:
|
|
3005
|
-
|
|
3077
|
+
_context40.next = 14;
|
|
3006
3078
|
return guardedBridge.applyPromotionCode(trimmed);
|
|
3007
3079
|
case 14:
|
|
3008
|
-
promotion =
|
|
3009
|
-
return
|
|
3080
|
+
promotion = _context40.sent;
|
|
3081
|
+
return _context40.abrupt("return", ((_promotion$isAccepted = promotion.isAccepted) !== null && _promotion$isAccepted !== void 0 ? _promotion$isAccepted : promotion.isAvailable) ? {
|
|
3010
3082
|
status: 'success',
|
|
3011
3083
|
kind: 'promotion'
|
|
3012
3084
|
} : {
|
|
@@ -3015,23 +3087,23 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3015
3087
|
});
|
|
3016
3088
|
case 16:
|
|
3017
3089
|
localSearch = function localSearch(v) {
|
|
3018
|
-
return
|
|
3090
|
+
return _this10.store.products.findProductsByCodeOrBarcode(v);
|
|
3019
3091
|
};
|
|
3020
3092
|
scanCallback = handleGlobalScan(this.request, localSearch, this.getSubmitOrderSalesChannel());
|
|
3021
|
-
|
|
3093
|
+
_context40.next = 20;
|
|
3022
3094
|
return scanCallback({
|
|
3023
3095
|
type: 'nativeScanner',
|
|
3024
3096
|
value: trimmed
|
|
3025
3097
|
});
|
|
3026
3098
|
case 20:
|
|
3027
|
-
raw =
|
|
3099
|
+
raw = _context40.sent;
|
|
3028
3100
|
formatted = formatGlobalScanResult(raw, trimmed);
|
|
3029
3101
|
if (formatted) {
|
|
3030
|
-
|
|
3102
|
+
_context40.next = 25;
|
|
3031
3103
|
break;
|
|
3032
3104
|
}
|
|
3033
3105
|
bridge === null || bridge === void 0 || (_bridge$onNotify2 = bridge.onNotify) === null || _bridge$onNotify2 === void 0 || _bridge$onNotify2.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
|
|
3034
|
-
return
|
|
3106
|
+
return _context40.abrupt("return", {
|
|
3035
3107
|
status: 'failed',
|
|
3036
3108
|
reason: 'not_found'
|
|
3037
3109
|
});
|
|
@@ -3039,74 +3111,73 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3039
3111
|
host = {
|
|
3040
3112
|
setOrderCustomer: function setOrderCustomer(customer) {
|
|
3041
3113
|
beforeScanCommit();
|
|
3042
|
-
|
|
3114
|
+
_this10.setOrderCustomer(customer);
|
|
3043
3115
|
},
|
|
3044
3116
|
getOrderCustomerSnapshot: function getOrderCustomerSnapshot() {
|
|
3045
|
-
return
|
|
3117
|
+
return _this10.getOrderCustomerSnapshot();
|
|
3046
3118
|
},
|
|
3047
3119
|
resolveCustomerById: function resolveCustomerById(customerId) {
|
|
3048
|
-
return
|
|
3120
|
+
return _this10.resolveCustomerById(customerId);
|
|
3049
3121
|
},
|
|
3050
3122
|
getBusinessCode: function getBusinessCode() {
|
|
3051
|
-
var
|
|
3052
|
-
return (
|
|
3123
|
+
var _this10$otherParams;
|
|
3124
|
+
return (_this10$otherParams = _this10.otherParams) === null || _this10$otherParams === void 0 ? void 0 : _this10$otherParams.businessCode;
|
|
3053
3125
|
},
|
|
3054
3126
|
buildAddProductCtx: function buildAddProductCtx(extra) {
|
|
3055
|
-
return
|
|
3127
|
+
return _this10.buildAddProductCtx(extra);
|
|
3056
3128
|
},
|
|
3057
3129
|
decideAddProduct: function decideAddProduct(item, options) {
|
|
3058
|
-
return
|
|
3130
|
+
return _this10.decideAddProduct(item, options);
|
|
3059
3131
|
},
|
|
3060
3132
|
decideAfterDetail: function decideAfterDetail(cacheItem, options) {
|
|
3061
|
-
return
|
|
3133
|
+
return _this10.decideAfterDetail(cacheItem, options);
|
|
3062
3134
|
},
|
|
3063
3135
|
transformDetailToProductAndBooking: function transformDetailToProductAndBooking(input) {
|
|
3064
|
-
return
|
|
3136
|
+
return _this10.transformDetailToProductAndBooking(input);
|
|
3065
3137
|
},
|
|
3066
3138
|
addProductToOrder: function addProductToOrder(product, booking) {
|
|
3067
3139
|
beforeScanCommit();
|
|
3068
|
-
return
|
|
3140
|
+
return _this10.addProductToOrder(product, booking);
|
|
3069
3141
|
},
|
|
3070
3142
|
refreshWalletAssets: function refreshWalletAssets(params) {
|
|
3071
|
-
return
|
|
3143
|
+
return _this10.refreshWalletAssets(params);
|
|
3072
3144
|
},
|
|
3073
3145
|
scanWalletAsset: function scanWalletAsset(scanCode) {
|
|
3074
3146
|
beforeScanCommit();
|
|
3075
|
-
return
|
|
3147
|
+
return _this10.scanWalletAsset(scanCode);
|
|
3076
3148
|
}
|
|
3077
3149
|
};
|
|
3078
3150
|
if (!((guardedBridge === null || guardedBridge === void 0 ? void 0 : guardedBridge.scanScope) === 'product-voucher-collection')) {
|
|
3079
|
-
|
|
3151
|
+
_context40.next = 32;
|
|
3080
3152
|
break;
|
|
3081
3153
|
}
|
|
3082
|
-
|
|
3154
|
+
_context40.next = 29;
|
|
3083
3155
|
return applyProductVoucherCollectionScan(_objectSpread(_objectSpread({}, host), {}, {
|
|
3084
|
-
waitForCustomerDiscounts: function waitForCustomerDiscounts() {
|
|
3085
|
-
return _this8.orderCustomerDiscountRefreshInFlight || Promise.resolve();
|
|
3086
|
-
},
|
|
3087
3156
|
loadCustomerDiscounts: function () {
|
|
3088
|
-
var _loadCustomerDiscounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3089
|
-
var
|
|
3157
|
+
var _loadCustomerDiscounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39() {
|
|
3158
|
+
var _this10$getOrderCusto;
|
|
3090
3159
|
var customerId;
|
|
3091
|
-
return _regeneratorRuntime().wrap(function
|
|
3092
|
-
while (1) switch (
|
|
3160
|
+
return _regeneratorRuntime().wrap(function _callee39$(_context39) {
|
|
3161
|
+
while (1) switch (_context39.prev = _context39.next) {
|
|
3093
3162
|
case 0:
|
|
3094
|
-
|
|
3163
|
+
beforeScanCommit();
|
|
3164
|
+
customerId = Number(((_this10$getOrderCusto = _this10.getOrderCustomer()) === null || _this10$getOrderCusto === void 0 ? void 0 : _this10$getOrderCusto.customer_id) || 0);
|
|
3095
3165
|
if (!(customerId <= 1)) {
|
|
3096
|
-
|
|
3166
|
+
_context39.next = 4;
|
|
3097
3167
|
break;
|
|
3098
3168
|
}
|
|
3099
|
-
return
|
|
3100
|
-
case
|
|
3101
|
-
|
|
3102
|
-
return
|
|
3103
|
-
case 5:
|
|
3104
|
-
return _context38.abrupt("return", _this8.getDiscountList());
|
|
3169
|
+
return _context39.abrupt("return", []);
|
|
3170
|
+
case 4:
|
|
3171
|
+
_context39.next = 6;
|
|
3172
|
+
return _this10.refreshDiscountConfigAfterOrderCustomerChange(customerId);
|
|
3105
3173
|
case 6:
|
|
3174
|
+
beforeScanCommit();
|
|
3175
|
+
return _context39.abrupt("return", _this10.getDiscountList());
|
|
3176
|
+
case 8:
|
|
3106
3177
|
case "end":
|
|
3107
|
-
return
|
|
3178
|
+
return _context39.stop();
|
|
3108
3179
|
}
|
|
3109
|
-
},
|
|
3180
|
+
}, _callee39);
|
|
3110
3181
|
}));
|
|
3111
3182
|
function loadCustomerDiscounts() {
|
|
3112
3183
|
return _loadCustomerDiscounts.apply(this, arguments);
|
|
@@ -3115,49 +3186,49 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3115
3186
|
}()
|
|
3116
3187
|
}), formatted, guardedBridge);
|
|
3117
3188
|
case 29:
|
|
3118
|
-
|
|
3119
|
-
|
|
3189
|
+
_context40.t0 = _context40.sent;
|
|
3190
|
+
_context40.next = 35;
|
|
3120
3191
|
break;
|
|
3121
3192
|
case 32:
|
|
3122
|
-
|
|
3193
|
+
_context40.next = 34;
|
|
3123
3194
|
return applyGlobalScan(host, formatted, guardedBridge);
|
|
3124
3195
|
case 34:
|
|
3125
|
-
|
|
3196
|
+
_context40.t0 = _context40.sent;
|
|
3126
3197
|
case 35:
|
|
3127
|
-
_result8 =
|
|
3198
|
+
_result8 = _context40.t0;
|
|
3128
3199
|
bridge === null || bridge === void 0 || (_bridge$refresh = bridge.refresh) === null || _bridge$refresh === void 0 || _bridge$refresh.call(bridge);
|
|
3129
|
-
return
|
|
3200
|
+
return _context40.abrupt("return", _result8);
|
|
3130
3201
|
case 40:
|
|
3131
|
-
|
|
3132
|
-
|
|
3202
|
+
_context40.prev = 40;
|
|
3203
|
+
_context40.t1 = _context40["catch"](4);
|
|
3133
3204
|
if (!((bridge === null || bridge === void 0 ? void 0 : bridge.scanScope) === 'product-voucher-collection')) {
|
|
3134
|
-
|
|
3205
|
+
_context40.next = 46;
|
|
3135
3206
|
break;
|
|
3136
3207
|
}
|
|
3137
3208
|
if (!(((_bridge$isCurrent = bridge.isCurrent) === null || _bridge$isCurrent === void 0 ? void 0 : _bridge$isCurrent.call(bridge)) === false)) {
|
|
3138
|
-
|
|
3209
|
+
_context40.next = 45;
|
|
3139
3210
|
break;
|
|
3140
3211
|
}
|
|
3141
|
-
return
|
|
3212
|
+
return _context40.abrupt("return", {
|
|
3142
3213
|
status: 'cancelled'
|
|
3143
3214
|
});
|
|
3144
3215
|
case 45:
|
|
3145
|
-
return
|
|
3216
|
+
return _context40.abrupt("return", {
|
|
3146
3217
|
status: 'failed',
|
|
3147
3218
|
reason: 'entry_resolution_failed'
|
|
3148
3219
|
});
|
|
3149
3220
|
case 46:
|
|
3150
|
-
console.error('[BookingTicket] handleGlobalScanCode failed',
|
|
3221
|
+
console.error('[BookingTicket] handleGlobalScanCode failed', _context40.t1);
|
|
3151
3222
|
bridge === null || bridge === void 0 || (_bridge$onNotify3 = bridge.onNotify) === null || _bridge$onNotify3 === void 0 || _bridge$onNotify3.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
|
|
3152
|
-
return
|
|
3223
|
+
return _context40.abrupt("return", {
|
|
3153
3224
|
status: 'failed',
|
|
3154
3225
|
reason: 'not_found'
|
|
3155
3226
|
});
|
|
3156
3227
|
case 49:
|
|
3157
3228
|
case "end":
|
|
3158
|
-
return
|
|
3229
|
+
return _context40.stop();
|
|
3159
3230
|
}
|
|
3160
|
-
},
|
|
3231
|
+
}, _callee40, this, [[4, 40]]);
|
|
3161
3232
|
}));
|
|
3162
3233
|
function handleGlobalScanCode(_x23, _x24) {
|
|
3163
3234
|
return _handleGlobalScanCode.apply(this, arguments);
|
|
@@ -3167,37 +3238,37 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3167
3238
|
}, {
|
|
3168
3239
|
key: "getGlobalScanCodeType",
|
|
3169
3240
|
value: (function () {
|
|
3170
|
-
var _getGlobalScanCodeType = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3171
|
-
var
|
|
3241
|
+
var _getGlobalScanCodeType = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41(code) {
|
|
3242
|
+
var _this11 = this,
|
|
3172
3243
|
_formatGlobalScanResu,
|
|
3173
3244
|
_formatGlobalScanResu2;
|
|
3174
3245
|
var trimmed, scan, raw;
|
|
3175
|
-
return _regeneratorRuntime().wrap(function
|
|
3176
|
-
while (1) switch (
|
|
3246
|
+
return _regeneratorRuntime().wrap(function _callee41$(_context41) {
|
|
3247
|
+
while (1) switch (_context41.prev = _context41.next) {
|
|
3177
3248
|
case 0:
|
|
3178
3249
|
trimmed = typeof code === 'string' ? code.trim() : '';
|
|
3179
3250
|
if (trimmed) {
|
|
3180
|
-
|
|
3251
|
+
_context41.next = 3;
|
|
3181
3252
|
break;
|
|
3182
3253
|
}
|
|
3183
|
-
return
|
|
3254
|
+
return _context41.abrupt("return", null);
|
|
3184
3255
|
case 3:
|
|
3185
3256
|
scan = handleGlobalScan(this.request, function (value) {
|
|
3186
|
-
return
|
|
3257
|
+
return _this11.store.products.findProductsByCodeOrBarcode(value);
|
|
3187
3258
|
}, this.getSubmitOrderSalesChannel());
|
|
3188
|
-
|
|
3259
|
+
_context41.next = 6;
|
|
3189
3260
|
return scan({
|
|
3190
3261
|
type: 'nativeScanner',
|
|
3191
3262
|
value: trimmed
|
|
3192
3263
|
});
|
|
3193
3264
|
case 6:
|
|
3194
|
-
raw =
|
|
3195
|
-
return
|
|
3265
|
+
raw = _context41.sent;
|
|
3266
|
+
return _context41.abrupt("return", (_formatGlobalScanResu = (_formatGlobalScanResu2 = formatGlobalScanResult(raw, trimmed)) === null || _formatGlobalScanResu2 === void 0 ? void 0 : _formatGlobalScanResu2.searchType) !== null && _formatGlobalScanResu !== void 0 ? _formatGlobalScanResu : null);
|
|
3196
3267
|
case 8:
|
|
3197
3268
|
case "end":
|
|
3198
|
-
return
|
|
3269
|
+
return _context41.stop();
|
|
3199
3270
|
}
|
|
3200
|
-
},
|
|
3271
|
+
}, _callee41, this);
|
|
3201
3272
|
}));
|
|
3202
3273
|
function getGlobalScanCodeType(_x25) {
|
|
3203
3274
|
return _getGlobalScanCodeType.apply(this, arguments);
|
|
@@ -3281,11 +3352,11 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3281
3352
|
}, {
|
|
3282
3353
|
key: "addAddTimeProductToBooking",
|
|
3283
3354
|
value: (function () {
|
|
3284
|
-
var _addAddTimeProductToBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3285
|
-
return _regeneratorRuntime().wrap(function
|
|
3286
|
-
while (1) switch (
|
|
3355
|
+
var _addAddTimeProductToBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42(input) {
|
|
3356
|
+
return _regeneratorRuntime().wrap(function _callee42$(_context42) {
|
|
3357
|
+
while (1) switch (_context42.prev = _context42.next) {
|
|
3287
3358
|
case 0:
|
|
3288
|
-
return
|
|
3359
|
+
return _context42.abrupt("return", this.addAddTimeProductsToBooking({
|
|
3289
3360
|
booking: input.booking,
|
|
3290
3361
|
products: [input],
|
|
3291
3362
|
coveredMinutes: input.coveredMinutes,
|
|
@@ -3293,9 +3364,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3293
3364
|
}));
|
|
3294
3365
|
case 1:
|
|
3295
3366
|
case "end":
|
|
3296
|
-
return
|
|
3367
|
+
return _context42.stop();
|
|
3297
3368
|
}
|
|
3298
|
-
},
|
|
3369
|
+
}, _callee42, this);
|
|
3299
3370
|
}));
|
|
3300
3371
|
function addAddTimeProductToBooking(_x26) {
|
|
3301
3372
|
return _addAddTimeProductToBooking.apply(this, arguments);
|
|
@@ -3315,27 +3386,27 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3315
3386
|
}, {
|
|
3316
3387
|
key: "addAddTimeProductsToBooking",
|
|
3317
3388
|
value: (function () {
|
|
3318
|
-
var _addAddTimeProductsToBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3319
|
-
var
|
|
3389
|
+
var _addAddTimeProductsToBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(input) {
|
|
3390
|
+
var _this12 = this,
|
|
3320
3391
|
_input$bookingPatch;
|
|
3321
3392
|
var bookingUid, orderLines, coveredMinutes, bookingTimePatch, result, _iterator2, _step2, line;
|
|
3322
|
-
return _regeneratorRuntime().wrap(function
|
|
3323
|
-
while (1) switch (
|
|
3393
|
+
return _regeneratorRuntime().wrap(function _callee43$(_context43) {
|
|
3394
|
+
while (1) switch (_context43.prev = _context43.next) {
|
|
3324
3395
|
case 0:
|
|
3325
3396
|
bookingUid = resolveBookingUidForAddTime(input === null || input === void 0 ? void 0 : input.booking);
|
|
3326
3397
|
if (bookingUid) {
|
|
3327
|
-
|
|
3398
|
+
_context43.next = 3;
|
|
3328
3399
|
break;
|
|
3329
3400
|
}
|
|
3330
3401
|
throw new Error('[BookingTicket] addAddTimeProductToBooking: booking.metadata.unique_identification_number 缺失');
|
|
3331
3402
|
case 3:
|
|
3332
3403
|
orderLines = (input.products || []).map(function (line) {
|
|
3333
3404
|
return {
|
|
3334
|
-
product:
|
|
3405
|
+
product: _this12.buildAddTimeOrderLine(line, bookingUid)
|
|
3335
3406
|
};
|
|
3336
3407
|
});
|
|
3337
3408
|
if (this.store.order) {
|
|
3338
|
-
|
|
3409
|
+
_context43.next = 6;
|
|
3339
3410
|
break;
|
|
3340
3411
|
}
|
|
3341
3412
|
throw new Error('order 模块未初始化');
|
|
@@ -3349,53 +3420,53 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3349
3420
|
});
|
|
3350
3421
|
}
|
|
3351
3422
|
if (!(typeof this.store.order.addProductsToOrder === 'function')) {
|
|
3352
|
-
|
|
3423
|
+
_context43.next = 11;
|
|
3353
3424
|
break;
|
|
3354
3425
|
}
|
|
3355
|
-
return
|
|
3426
|
+
return _context43.abrupt("return", this.store.order.addProductsToOrder(orderLines));
|
|
3356
3427
|
case 11:
|
|
3357
3428
|
result = [];
|
|
3358
3429
|
_iterator2 = _createForOfIteratorHelper(orderLines);
|
|
3359
|
-
|
|
3430
|
+
_context43.prev = 13;
|
|
3360
3431
|
_iterator2.s();
|
|
3361
3432
|
case 15:
|
|
3362
3433
|
if ((_step2 = _iterator2.n()).done) {
|
|
3363
|
-
|
|
3434
|
+
_context43.next = 29;
|
|
3364
3435
|
break;
|
|
3365
3436
|
}
|
|
3366
3437
|
line = _step2.value;
|
|
3367
|
-
|
|
3368
|
-
|
|
3369
|
-
|
|
3370
|
-
|
|
3371
|
-
|
|
3438
|
+
_context43.t0 = result.splice;
|
|
3439
|
+
_context43.t1 = result;
|
|
3440
|
+
_context43.t2 = [0, result.length];
|
|
3441
|
+
_context43.t3 = _toConsumableArray;
|
|
3442
|
+
_context43.next = 23;
|
|
3372
3443
|
return this.addProductToOrder(line.product);
|
|
3373
3444
|
case 23:
|
|
3374
|
-
|
|
3375
|
-
|
|
3376
|
-
|
|
3377
|
-
|
|
3445
|
+
_context43.t4 = _context43.sent;
|
|
3446
|
+
_context43.t5 = (0, _context43.t3)(_context43.t4);
|
|
3447
|
+
_context43.t6 = _context43.t2.concat.call(_context43.t2, _context43.t5);
|
|
3448
|
+
_context43.t0.apply.call(_context43.t0, _context43.t1, _context43.t6);
|
|
3378
3449
|
case 27:
|
|
3379
|
-
|
|
3450
|
+
_context43.next = 15;
|
|
3380
3451
|
break;
|
|
3381
3452
|
case 29:
|
|
3382
|
-
|
|
3453
|
+
_context43.next = 34;
|
|
3383
3454
|
break;
|
|
3384
3455
|
case 31:
|
|
3385
|
-
|
|
3386
|
-
|
|
3387
|
-
_iterator2.e(
|
|
3456
|
+
_context43.prev = 31;
|
|
3457
|
+
_context43.t7 = _context43["catch"](13);
|
|
3458
|
+
_iterator2.e(_context43.t7);
|
|
3388
3459
|
case 34:
|
|
3389
|
-
|
|
3460
|
+
_context43.prev = 34;
|
|
3390
3461
|
_iterator2.f();
|
|
3391
|
-
return
|
|
3462
|
+
return _context43.finish(34);
|
|
3392
3463
|
case 37:
|
|
3393
|
-
return
|
|
3464
|
+
return _context43.abrupt("return", result);
|
|
3394
3465
|
case 38:
|
|
3395
3466
|
case "end":
|
|
3396
|
-
return
|
|
3467
|
+
return _context43.stop();
|
|
3397
3468
|
}
|
|
3398
|
-
},
|
|
3469
|
+
}, _callee43, this, [[13, 31, 34, 37]]);
|
|
3399
3470
|
}));
|
|
3400
3471
|
function addAddTimeProductsToBooking(_x27) {
|
|
3401
3472
|
return _addAddTimeProductsToBooking.apply(this, arguments);
|
|
@@ -3405,47 +3476,47 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3405
3476
|
}, {
|
|
3406
3477
|
key: "setOtherParams",
|
|
3407
3478
|
value: function () {
|
|
3408
|
-
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3409
|
-
var
|
|
3479
|
+
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(params) {
|
|
3480
|
+
var _this13 = this;
|
|
3410
3481
|
var _ref21,
|
|
3411
3482
|
_ref21$cover,
|
|
3412
3483
|
cover,
|
|
3413
3484
|
nextParams,
|
|
3414
3485
|
invoiceContextChanged,
|
|
3415
|
-
|
|
3416
|
-
return _regeneratorRuntime().wrap(function
|
|
3417
|
-
while (1) switch (
|
|
3486
|
+
_args44 = arguments;
|
|
3487
|
+
return _regeneratorRuntime().wrap(function _callee44$(_context44) {
|
|
3488
|
+
while (1) switch (_context44.prev = _context44.next) {
|
|
3418
3489
|
case 0:
|
|
3419
|
-
_ref21 =
|
|
3490
|
+
_ref21 = _args44.length > 1 && _args44[1] !== undefined ? _args44[1] : {}, _ref21$cover = _ref21.cover, cover = _ref21$cover === void 0 ? false : _ref21$cover;
|
|
3420
3491
|
nextParams = cover ? params : _objectSpread(_objectSpread({}, this.otherParams), params);
|
|
3421
3492
|
if (['businessCode', 'business_code', 'channel', 'platform', 'shop_id', 'tenantId', 'cacheId'].some(function (key) {
|
|
3422
|
-
var
|
|
3423
|
-
return (nextParams === null || nextParams === void 0 ? void 0 : nextParams[key]) !== ((
|
|
3493
|
+
var _this13$otherParams;
|
|
3494
|
+
return (nextParams === null || nextParams === void 0 ? void 0 : nextParams[key]) !== ((_this13$otherParams = _this13.otherParams) === null || _this13$otherParams === void 0 ? void 0 : _this13$otherParams[key]);
|
|
3424
3495
|
})) this.orderCustomerContactRequest = null;
|
|
3425
|
-
|
|
3496
|
+
_context44.next = 5;
|
|
3426
3497
|
return _get(_getPrototypeOf(BookingTicketImpl.prototype), "setOtherParams", this).call(this, params, {
|
|
3427
3498
|
cover: cover
|
|
3428
3499
|
});
|
|
3429
3500
|
case 5:
|
|
3430
3501
|
invoiceContextChanged = (params === null || params === void 0 ? void 0 : params.businessCode) !== undefined || (params === null || params === void 0 ? void 0 : params.business_code) !== undefined || (params === null || params === void 0 ? void 0 : params.channel) !== undefined || (params === null || params === void 0 ? void 0 : params.platform) !== undefined || Object.prototype.hasOwnProperty.call(params, 'openData');
|
|
3431
3502
|
if (!invoiceContextChanged) {
|
|
3432
|
-
|
|
3503
|
+
_context44.next = 9;
|
|
3433
3504
|
break;
|
|
3434
3505
|
}
|
|
3435
|
-
|
|
3506
|
+
_context44.next = 9;
|
|
3436
3507
|
return this.prepareInvoiceTemplateAtSolutionReady(Object.prototype.hasOwnProperty.call(params, 'openData') ? this.getInjectedOpenDataConfig() : undefined);
|
|
3437
3508
|
case 9:
|
|
3438
3509
|
if (!((params === null || params === void 0 ? void 0 : params.businessCode) !== undefined || (params === null || params === void 0 ? void 0 : params.business_code) !== undefined)) {
|
|
3439
|
-
|
|
3510
|
+
_context44.next = 12;
|
|
3440
3511
|
break;
|
|
3441
3512
|
}
|
|
3442
|
-
|
|
3513
|
+
_context44.next = 12;
|
|
3443
3514
|
return this.configureIdGeneratorFromOpenData();
|
|
3444
3515
|
case 12:
|
|
3445
3516
|
case "end":
|
|
3446
|
-
return
|
|
3517
|
+
return _context44.stop();
|
|
3447
3518
|
}
|
|
3448
|
-
},
|
|
3519
|
+
}, _callee44, this);
|
|
3449
3520
|
}));
|
|
3450
3521
|
function setOtherParams(_x28) {
|
|
3451
3522
|
return _setOtherParams.apply(this, arguments);
|
|
@@ -3464,15 +3535,15 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3464
3535
|
}, {
|
|
3465
3536
|
key: "handlePrintWristband",
|
|
3466
3537
|
value: function () {
|
|
3467
|
-
var _handlePrintWristband = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3538
|
+
var _handlePrintWristband = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45(params) {
|
|
3468
3539
|
var _this$getOrderIdentit2;
|
|
3469
3540
|
var deviceTask, deviceId, idempotencyKey;
|
|
3470
|
-
return _regeneratorRuntime().wrap(function
|
|
3471
|
-
while (1) switch (
|
|
3541
|
+
return _regeneratorRuntime().wrap(function _callee45$(_context45) {
|
|
3542
|
+
while (1) switch (_context45.prev = _context45.next) {
|
|
3472
3543
|
case 0:
|
|
3473
3544
|
deviceTask = this.getDeviceTaskPlugin();
|
|
3474
3545
|
if (deviceTask !== null && deviceTask !== void 0 && deviceTask.dispatch) {
|
|
3475
|
-
|
|
3546
|
+
_context45.next = 4;
|
|
3476
3547
|
break;
|
|
3477
3548
|
}
|
|
3478
3549
|
this.logger.addLog({
|
|
@@ -3482,7 +3553,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3482
3553
|
voucher_ids: Array.isArray(params.voucher_ids) ? params.voucher_ids : [params.voucher_ids]
|
|
3483
3554
|
}
|
|
3484
3555
|
});
|
|
3485
|
-
return
|
|
3556
|
+
return _context45.abrupt("return");
|
|
3486
3557
|
case 4:
|
|
3487
3558
|
this.logger.addLog({
|
|
3488
3559
|
type: 'info',
|
|
@@ -3491,10 +3562,10 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3491
3562
|
voucher_ids: Array.isArray(params.voucher_ids) ? params.voucher_ids : [params.voucher_ids]
|
|
3492
3563
|
}
|
|
3493
3564
|
});
|
|
3494
|
-
|
|
3565
|
+
_context45.next = 7;
|
|
3495
3566
|
return this.getShortNumberOrDeviceId();
|
|
3496
3567
|
case 7:
|
|
3497
|
-
deviceId =
|
|
3568
|
+
deviceId = _context45.sent;
|
|
3498
3569
|
idempotencyKey = createUuidV4();
|
|
3499
3570
|
deviceTask.dispatch({
|
|
3500
3571
|
action: 'print_all',
|
|
@@ -3514,9 +3585,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3514
3585
|
});
|
|
3515
3586
|
case 10:
|
|
3516
3587
|
case "end":
|
|
3517
|
-
return
|
|
3588
|
+
return _context45.stop();
|
|
3518
3589
|
}
|
|
3519
|
-
},
|
|
3590
|
+
}, _callee45, this);
|
|
3520
3591
|
}));
|
|
3521
3592
|
function handlePrintWristband(_x29) {
|
|
3522
3593
|
return _handlePrintWristband.apply(this, arguments);
|
|
@@ -3539,11 +3610,11 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3539
3610
|
}, {
|
|
3540
3611
|
key: "handleRedeem",
|
|
3541
3612
|
value: function () {
|
|
3542
|
-
var _handleRedeem = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3613
|
+
var _handleRedeem = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46(params) {
|
|
3543
3614
|
var _this$store$order8, _this$store$order8$ge, _this$store$order9, _ref22, _tempOrder$order_id2;
|
|
3544
3615
|
var voucherIds, status, voucherIdSet, tempOrder, vouchers, hasUpdatedVoucher, nextVouchers, write, identity, externalSaleNumber, orderId, orderLookup;
|
|
3545
|
-
return _regeneratorRuntime().wrap(function
|
|
3546
|
-
while (1) switch (
|
|
3616
|
+
return _regeneratorRuntime().wrap(function _callee46$(_context46) {
|
|
3617
|
+
while (1) switch (_context46.prev = _context46.next) {
|
|
3547
3618
|
case 0:
|
|
3548
3619
|
voucherIds = Array.isArray(params.voucher_ids) ? params.voucher_ids : [];
|
|
3549
3620
|
status = params.is_checkin ? 'used' : 'unused';
|
|
@@ -3567,27 +3638,29 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3567
3638
|
});
|
|
3568
3639
|
});
|
|
3569
3640
|
if (!(tempOrder && hasUpdatedVoucher)) {
|
|
3570
|
-
|
|
3641
|
+
_context46.next = 17;
|
|
3571
3642
|
break;
|
|
3572
3643
|
}
|
|
3573
3644
|
write = this.replaceTempOrder(_objectSpread(_objectSpread({}, tempOrder), {}, {
|
|
3574
3645
|
vouchers: nextVouchers
|
|
3575
|
-
})
|
|
3646
|
+
}), {
|
|
3647
|
+
preserveOrderSessionId: this.getOrderSessionId() || undefined
|
|
3648
|
+
});
|
|
3576
3649
|
this.redeemStatusWrite = write;
|
|
3577
|
-
|
|
3578
|
-
|
|
3650
|
+
_context46.prev = 11;
|
|
3651
|
+
_context46.next = 14;
|
|
3579
3652
|
return write;
|
|
3580
3653
|
case 14:
|
|
3581
|
-
|
|
3654
|
+
_context46.prev = 14;
|
|
3582
3655
|
if (this.redeemStatusWrite === write) this.redeemStatusWrite = undefined;
|
|
3583
|
-
return
|
|
3656
|
+
return _context46.finish(14);
|
|
3584
3657
|
case 17:
|
|
3585
3658
|
this.core.effects.emit("".concat(this.name, ":onVouchersChange"), {});
|
|
3586
3659
|
if (!(voucherIds.length === 0)) {
|
|
3587
|
-
|
|
3660
|
+
_context46.next = 20;
|
|
3588
3661
|
break;
|
|
3589
3662
|
}
|
|
3590
|
-
return
|
|
3663
|
+
return _context46.abrupt("return", {
|
|
3591
3664
|
code: 200,
|
|
3592
3665
|
status: true,
|
|
3593
3666
|
message: '',
|
|
@@ -3598,7 +3671,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3598
3671
|
externalSaleNumber = (tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.external_sale_number) || (identity === null || identity === void 0 ? void 0 : identity.externalSaleNumber) || undefined;
|
|
3599
3672
|
orderId = (_ref22 = (_tempOrder$order_id2 = tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.order_id) !== null && _tempOrder$order_id2 !== void 0 ? _tempOrder$order_id2 : identity === null || identity === void 0 ? void 0 : identity.orderId) !== null && _ref22 !== void 0 ? _ref22 : undefined;
|
|
3600
3673
|
orderLookup = externalSaleNumber || orderId || (identity === null || identity === void 0 ? void 0 : identity.orderNumber) || (identity === null || identity === void 0 ? void 0 : identity.shopOrderNumber) || (identity === null || identity === void 0 ? void 0 : identity.shopFullOrderNumber) || undefined;
|
|
3601
|
-
return
|
|
3674
|
+
return _context46.abrupt("return", this.request.post('/machinecode/batch', {
|
|
3602
3675
|
ids: voucherIds,
|
|
3603
3676
|
status: status,
|
|
3604
3677
|
order_lookup: orderLookup,
|
|
@@ -3609,9 +3682,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3609
3682
|
}));
|
|
3610
3683
|
case 25:
|
|
3611
3684
|
case "end":
|
|
3612
|
-
return
|
|
3685
|
+
return _context46.stop();
|
|
3613
3686
|
}
|
|
3614
|
-
},
|
|
3687
|
+
}, _callee46, this, [[11,, 14, 17]]);
|
|
3615
3688
|
}));
|
|
3616
3689
|
function handleRedeem(_x30) {
|
|
3617
3690
|
return _handleRedeem.apply(this, arguments);
|
|
@@ -3621,25 +3694,25 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3621
3694
|
}, {
|
|
3622
3695
|
key: "updateTicketArrival",
|
|
3623
3696
|
value: function () {
|
|
3624
|
-
var _updateTicketArrival = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3697
|
+
var _updateTicketArrival = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee48(voucherIds) {
|
|
3625
3698
|
var _this$store$order10,
|
|
3626
3699
|
_this$store$order10$g,
|
|
3627
|
-
|
|
3700
|
+
_this14 = this;
|
|
3628
3701
|
var window, tempOrder, log, operation, arrivalTime, updateArrival, completion;
|
|
3629
|
-
return _regeneratorRuntime().wrap(function
|
|
3630
|
-
while (1) switch (
|
|
3702
|
+
return _regeneratorRuntime().wrap(function _callee48$(_context48) {
|
|
3703
|
+
while (1) switch (_context48.prev = _context48.next) {
|
|
3631
3704
|
case 0:
|
|
3632
3705
|
window = this.getRedeemArrivalWindow();
|
|
3633
3706
|
tempOrder = (_this$store$order10 = this.store.order) === null || _this$store$order10 === void 0 || (_this$store$order10$g = _this$store$order10.getTempOrder) === null || _this$store$order10$g === void 0 ? void 0 : _this$store$order10$g.call(_this$store$order10);
|
|
3634
3707
|
log = createArrivalLogger(this.logger, tempOrder, voucherIds);
|
|
3635
3708
|
if (!(!window || !tempOrder)) {
|
|
3636
|
-
|
|
3709
|
+
_context48.next = 6;
|
|
3637
3710
|
break;
|
|
3638
3711
|
}
|
|
3639
3712
|
log('skipped', {
|
|
3640
3713
|
reason: !window ? 'no_effective_window' : 'missing_order'
|
|
3641
3714
|
});
|
|
3642
|
-
return
|
|
3715
|
+
return _context48.abrupt("return");
|
|
3643
3716
|
case 6:
|
|
3644
3717
|
log('started', {
|
|
3645
3718
|
early_minutes: window.earlyMinutes,
|
|
@@ -3648,23 +3721,23 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3648
3721
|
operation = 'prepare';
|
|
3649
3722
|
arrivalTime = new Date();
|
|
3650
3723
|
updateArrival = /*#__PURE__*/function () {
|
|
3651
|
-
var _ref23 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3652
|
-
var
|
|
3724
|
+
var _ref23 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee47() {
|
|
3725
|
+
var _this14$store$order, _this14$store$order$g, _next$summary;
|
|
3653
3726
|
var current, sameOrder, order, arrival, next, query, checkout, latest, patch;
|
|
3654
|
-
return _regeneratorRuntime().wrap(function
|
|
3655
|
-
while (1) switch (
|
|
3727
|
+
return _regeneratorRuntime().wrap(function _callee47$(_context47) {
|
|
3728
|
+
while (1) switch (_context47.prev = _context47.next) {
|
|
3656
3729
|
case 0:
|
|
3657
|
-
if (!
|
|
3658
|
-
|
|
3730
|
+
if (!_this14.redeemStatusWrite) {
|
|
3731
|
+
_context47.next = 3;
|
|
3659
3732
|
break;
|
|
3660
3733
|
}
|
|
3661
|
-
|
|
3662
|
-
return
|
|
3734
|
+
_context47.next = 3;
|
|
3735
|
+
return _this14.redeemStatusWrite.catch(function () {});
|
|
3663
3736
|
case 3:
|
|
3664
|
-
current = (
|
|
3737
|
+
current = (_this14$store$order = _this14.store.order) === null || _this14$store$order === void 0 || (_this14$store$order$g = _this14$store$order.getTempOrder) === null || _this14$store$order$g === void 0 ? void 0 : _this14$store$order$g.call(_this14$store$order);
|
|
3665
3738
|
sameOrder = function sameOrder() {
|
|
3666
|
-
var
|
|
3667
|
-
var active = (
|
|
3739
|
+
var _this14$store$order2, _this14$store$order2$;
|
|
3740
|
+
var active = (_this14$store$order2 = _this14.store.order) === null || _this14$store$order2 === void 0 || (_this14$store$order2$ = _this14$store$order2.getTempOrder) === null || _this14$store$order2$ === void 0 ? void 0 : _this14$store$order2$.call(_this14$store$order2);
|
|
3668
3741
|
return active && active.order_id === tempOrder.order_id && active.external_sale_number === tempOrder.external_sale_number;
|
|
3669
3742
|
};
|
|
3670
3743
|
order = current && sameOrder() ? current : tempOrder;
|
|
@@ -3674,51 +3747,51 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3674
3747
|
});
|
|
3675
3748
|
});
|
|
3676
3749
|
if (arrival) {
|
|
3677
|
-
|
|
3750
|
+
_context47.next = 9;
|
|
3678
3751
|
break;
|
|
3679
3752
|
}
|
|
3680
|
-
return
|
|
3753
|
+
return _context47.abrupt("return");
|
|
3681
3754
|
case 9:
|
|
3682
3755
|
next = _objectSpread(_objectSpread({}, order), arrival);
|
|
3683
|
-
|
|
3684
|
-
|
|
3756
|
+
_context47.t0 = buildArrivalCheckoutQuery;
|
|
3757
|
+
_context47.t1 = next;
|
|
3685
3758
|
if (!((_next$summary = next.summary) !== null && _next$summary !== void 0)) {
|
|
3686
|
-
|
|
3759
|
+
_context47.next = 16;
|
|
3687
3760
|
break;
|
|
3688
3761
|
}
|
|
3689
|
-
|
|
3690
|
-
|
|
3762
|
+
_context47.t2 = _next$summary;
|
|
3763
|
+
_context47.next = 24;
|
|
3691
3764
|
break;
|
|
3692
3765
|
case 16:
|
|
3693
3766
|
if (!sameOrder()) {
|
|
3694
|
-
|
|
3767
|
+
_context47.next = 22;
|
|
3695
3768
|
break;
|
|
3696
3769
|
}
|
|
3697
|
-
|
|
3698
|
-
return
|
|
3770
|
+
_context47.next = 19;
|
|
3771
|
+
return _this14.getSummary();
|
|
3699
3772
|
case 19:
|
|
3700
|
-
|
|
3701
|
-
|
|
3773
|
+
_context47.t3 = _context47.sent;
|
|
3774
|
+
_context47.next = 23;
|
|
3702
3775
|
break;
|
|
3703
3776
|
case 22:
|
|
3704
|
-
|
|
3777
|
+
_context47.t3 = undefined;
|
|
3705
3778
|
case 23:
|
|
3706
|
-
|
|
3779
|
+
_context47.t2 = _context47.t3;
|
|
3707
3780
|
case 24:
|
|
3708
|
-
|
|
3709
|
-
query = (0,
|
|
3781
|
+
_context47.t4 = _context47.t2;
|
|
3782
|
+
query = (0, _context47.t0)(_context47.t1, _context47.t4);
|
|
3710
3783
|
operation = 'checkout';
|
|
3711
3784
|
log('checkout_requested', {
|
|
3712
3785
|
bookings: describeChangedBookings(order.bookings, arrival.bookings)
|
|
3713
3786
|
});
|
|
3714
|
-
|
|
3715
|
-
return
|
|
3787
|
+
_context47.next = 30;
|
|
3788
|
+
return _this14.store.order.submitSalesOrder({
|
|
3716
3789
|
query: query
|
|
3717
3790
|
});
|
|
3718
3791
|
case 30:
|
|
3719
|
-
checkout =
|
|
3792
|
+
checkout = _context47.sent;
|
|
3720
3793
|
if (!((checkout === null || checkout === void 0 ? void 0 : checkout.status) === false || (checkout === null || checkout === void 0 ? void 0 : checkout.code) != null && checkout.code !== 200)) {
|
|
3721
|
-
|
|
3794
|
+
_context47.next = 34;
|
|
3722
3795
|
break;
|
|
3723
3796
|
}
|
|
3724
3797
|
log('checkout_rejected', {
|
|
@@ -3726,54 +3799,54 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3726
3799
|
status: checkout.status,
|
|
3727
3800
|
message: checkout.message
|
|
3728
3801
|
}, true);
|
|
3729
|
-
return
|
|
3802
|
+
return _context47.abrupt("return", checkout);
|
|
3730
3803
|
case 34:
|
|
3731
3804
|
log('checkout_accepted', {
|
|
3732
3805
|
code: checkout === null || checkout === void 0 ? void 0 : checkout.code
|
|
3733
3806
|
});
|
|
3734
3807
|
operation = 'local_update';
|
|
3735
|
-
if (!
|
|
3736
|
-
|
|
3808
|
+
if (!_this14.redeemStatusWrite) {
|
|
3809
|
+
_context47.next = 39;
|
|
3737
3810
|
break;
|
|
3738
3811
|
}
|
|
3739
|
-
|
|
3740
|
-
return
|
|
3812
|
+
_context47.next = 39;
|
|
3813
|
+
return _this14.redeemStatusWrite.catch(function () {});
|
|
3741
3814
|
case 39:
|
|
3742
3815
|
if (!sameOrder()) {
|
|
3743
|
-
|
|
3816
|
+
_context47.next = 52;
|
|
3744
3817
|
break;
|
|
3745
3818
|
}
|
|
3746
|
-
latest =
|
|
3819
|
+
latest = _this14.store.order.getTempOrder();
|
|
3747
3820
|
patch = applyRedeemArrival(latest, new Set(voucherIds.map(String)), arrivalTime, window);
|
|
3748
3821
|
if (!patch) {
|
|
3749
|
-
|
|
3822
|
+
_context47.next = 49;
|
|
3750
3823
|
break;
|
|
3751
3824
|
}
|
|
3752
|
-
|
|
3753
|
-
return
|
|
3825
|
+
_context47.next = 45;
|
|
3826
|
+
return _this14.replaceTempOrder(_objectSpread(_objectSpread({}, latest), patch));
|
|
3754
3827
|
case 45:
|
|
3755
3828
|
log('local_updated');
|
|
3756
|
-
|
|
3757
|
-
|
|
3829
|
+
_this14.core.effects.emit("".concat(_this14.name, ":onVouchersChange"), {});
|
|
3830
|
+
_context47.next = 50;
|
|
3758
3831
|
break;
|
|
3759
3832
|
case 49:
|
|
3760
3833
|
log('local_skipped', {
|
|
3761
3834
|
reason: 'no_pending_change'
|
|
3762
3835
|
});
|
|
3763
3836
|
case 50:
|
|
3764
|
-
|
|
3837
|
+
_context47.next = 53;
|
|
3765
3838
|
break;
|
|
3766
3839
|
case 52:
|
|
3767
3840
|
log('local_skipped', {
|
|
3768
3841
|
reason: 'order_changed'
|
|
3769
3842
|
});
|
|
3770
3843
|
case 53:
|
|
3771
|
-
return
|
|
3844
|
+
return _context47.abrupt("return", checkout);
|
|
3772
3845
|
case 54:
|
|
3773
3846
|
case "end":
|
|
3774
|
-
return
|
|
3847
|
+
return _context47.stop();
|
|
3775
3848
|
}
|
|
3776
|
-
},
|
|
3849
|
+
}, _callee47);
|
|
3777
3850
|
}));
|
|
3778
3851
|
return function updateArrival() {
|
|
3779
3852
|
return _ref23.apply(this, arguments);
|
|
@@ -3787,12 +3860,12 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3787
3860
|
throw error;
|
|
3788
3861
|
});
|
|
3789
3862
|
this.arrivalQueue = completion.then(function () {}, function () {});
|
|
3790
|
-
return
|
|
3863
|
+
return _context48.abrupt("return", completion);
|
|
3791
3864
|
case 13:
|
|
3792
3865
|
case "end":
|
|
3793
|
-
return
|
|
3866
|
+
return _context48.stop();
|
|
3794
3867
|
}
|
|
3795
|
-
},
|
|
3868
|
+
}, _callee48, this);
|
|
3796
3869
|
}));
|
|
3797
3870
|
function updateTicketArrival(_x31) {
|
|
3798
3871
|
return _updateTicketArrival.apply(this, arguments);
|
|
@@ -3806,13 +3879,13 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3806
3879
|
}, {
|
|
3807
3880
|
key: "destroy",
|
|
3808
3881
|
value: (function () {
|
|
3809
|
-
var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3882
|
+
var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee49() {
|
|
3810
3883
|
var _this$scan;
|
|
3811
|
-
return _regeneratorRuntime().wrap(function
|
|
3812
|
-
while (1) switch (
|
|
3884
|
+
return _regeneratorRuntime().wrap(function _callee49$(_context49) {
|
|
3885
|
+
while (1) switch (_context49.prev = _context49.next) {
|
|
3813
3886
|
case 0:
|
|
3814
3887
|
this.orderCustomerContactRequest = null;
|
|
3815
|
-
|
|
3888
|
+
_context49.next = 3;
|
|
3816
3889
|
return _get(_getPrototypeOf(BookingTicketImpl.prototype), "destroy", this).call(this);
|
|
3817
3890
|
case 3:
|
|
3818
3891
|
try {
|
|
@@ -3823,9 +3896,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3823
3896
|
scanCache.clear();
|
|
3824
3897
|
case 5:
|
|
3825
3898
|
case "end":
|
|
3826
|
-
return
|
|
3899
|
+
return _context49.stop();
|
|
3827
3900
|
}
|
|
3828
|
-
},
|
|
3901
|
+
}, _callee49, this);
|
|
3829
3902
|
}));
|
|
3830
3903
|
function destroy() {
|
|
3831
3904
|
return _destroy.apply(this, arguments);
|