@pisell/pisellos 2.2.313 → 2.2.315
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/index.d.ts +2 -0
- package/dist/index.js +3 -1
- 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/modules/BookingContext/utils/productExtend.d.ts +7 -0
- package/dist/modules/BookingContext/utils/productExtend.js +62 -18
- package/dist/modules/BookingContext/utils/resources.js +1 -1
- package/dist/modules/BusinessAvailability/index.d.ts +30 -0
- package/dist/modules/BusinessAvailability/index.js +204 -0
- 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/FulfillmentTiming/index.d.ts +11 -0
- package/dist/modules/FulfillmentTiming/index.js +407 -0
- package/dist/modules/FulfillmentTiming/types.d.ts +67 -0
- package/dist/modules/FulfillmentTiming/types.js +1 -0
- package/dist/modules/OpenData/types.d.ts +14 -0
- package/dist/modules/Order/index.d.ts +14 -2
- package/dist/modules/Order/index.js +856 -486
- package/dist/modules/Order/localEftposState.d.ts +13 -0
- package/dist/modules/Order/localEftposState.js +39 -0
- package/dist/modules/Order/pickupTiming.d.ts +46 -0
- package/dist/modules/Order/pickupTiming.js +53 -0
- package/dist/modules/Order/types.d.ts +30 -2
- package/dist/modules/Order/utils.js +25 -7
- package/dist/modules/Payment/index.js +9 -10
- package/dist/modules/Product/types.d.ts +11 -0
- package/dist/modules/ProductList/index.js +1 -1
- package/dist/modules/ResourcePlanner/planner.d.ts +2 -0
- package/dist/modules/ResourcePlanner/planner.js +332 -23
- package/dist/modules/ResourcePlanner/types.d.ts +29 -0
- package/dist/modules/Schedule/index.d.ts +8 -0
- package/dist/modules/Schedule/index.js +141 -39
- package/dist/modules/index.d.ts +1 -0
- package/dist/modules/index.js +1 -0
- package/dist/plugins/request.d.ts +7 -0
- package/dist/server/index.d.ts +1 -0
- package/dist/server/index.js +1536 -1309
- 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 +15 -0
- package/dist/server/modules/order/index.js +920 -688
- package/dist/server/modules/order/types.d.ts +1 -0
- package/dist/server/test.json +1 -1
- package/dist/server/utils/small-ticket.d.ts +1 -85
- package/dist/server/utils/small-ticket.js +2 -2542
- package/dist/shared/payment/loadPaymentMethods.d.ts +9 -0
- package/dist/shared/payment/loadPaymentMethods.js +66 -0
- package/dist/shared/receipt/customerInvoiceLanguages.d.ts +8 -0
- package/dist/shared/receipt/customerInvoiceLanguages.js +60 -0
- package/dist/shared/receipt/loadCustomerInvoiceLayout.d.ts +27 -0
- package/dist/shared/receipt/loadCustomerInvoiceLayout.js +184 -0
- package/dist/shared/receipt/small-ticket.d.ts +96 -0
- package/dist/shared/receipt/small-ticket.js +2751 -0
- package/dist/shared/receipt/templateVisibility.d.ts +23 -0
- package/dist/shared/receipt/templateVisibility.js +64 -0
- package/dist/shared/sales/loadSalesOrderSnapshot.d.ts +9 -0
- package/dist/shared/sales/loadSalesOrderSnapshot.js +21 -0
- package/dist/solution/BaseSales/fulfillmentItemRules.d.ts +27 -0
- package/dist/solution/BaseSales/fulfillmentItemRules.js +750 -0
- package/dist/solution/BaseSales/index.d.ts +39 -16
- package/dist/solution/BaseSales/index.js +1754 -1154
- package/dist/solution/BaseSales/pickupTiming.d.ts +47 -0
- package/dist/solution/BaseSales/pickupTiming.js +616 -0
- package/dist/solution/BaseSales/types.d.ts +11 -0
- package/dist/solution/BaseSales/utils/parseSalesResponse.js +3 -0
- package/dist/solution/BookingByStep/index.d.ts +4 -2
- package/dist/solution/BookingByStep/index.js +8 -3
- package/dist/solution/BookingTicket/index.d.ts +8 -2
- package/dist/solution/BookingTicket/index.js +513 -436
- package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +0 -1
- package/dist/solution/BookingTicket/utils/addProductDecision.js +1 -1
- package/dist/solution/BookingTicket/utils/cartView.js +3 -1
- package/dist/solution/OrderInvoicePreview/index.d.ts +66 -0
- package/dist/solution/OrderInvoicePreview/index.js +340 -0
- package/dist/solution/RegisterAndLogin/config.js +54 -11
- package/dist/solution/RegisterAndLogin/index.d.ts +2 -0
- package/dist/solution/RegisterAndLogin/index.js +1 -1
- package/dist/solution/RegisterAndLogin/utils.d.ts +12 -4
- package/dist/solution/RegisterAndLogin/utils.js +36 -16
- package/dist/solution/Sales/index.js +1 -1
- package/dist/solution/UnifiedBookingSales/businessAvailability.d.ts +27 -0
- package/dist/solution/UnifiedBookingSales/businessAvailability.js +292 -0
- package/dist/solution/UnifiedBookingSales/index.d.ts +36 -4
- package/dist/solution/UnifiedBookingSales/index.js +1714 -905
- package/dist/solution/UnifiedBookingSales/types.d.ts +16 -2
- package/dist/solution/VenueBooking/index.d.ts +15 -2
- package/dist/solution/VenueBooking/index.js +1062 -785
- package/dist/solution/VenueBooking/types.d.ts +2 -1
- package/dist/solution/VenueBooking/types.js +1 -0
- package/dist/solution/VenueBooking/utils/dateSummary.d.ts +1 -0
- package/dist/solution/VenueBooking/utils/dateSummary.js +7 -4
- package/dist/solution/VenueBooking/utils/smartPricing.d.ts +71 -0
- package/dist/solution/VenueBooking/utils/smartPricing.js +273 -0
- package/dist/solution/VenueBooking/utils/timeSlot.d.ts +1 -0
- package/dist/solution/VenueBooking/utils/timeSlot.js +6 -3
- package/dist/solution/index.d.ts +1 -0
- package/dist/solution/index.js +2 -1
- package/lib/index.d.ts +2 -0
- package/lib/index.js +21 -1
- 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/modules/BookingContext/utils/productExtend.d.ts +7 -0
- package/lib/modules/BookingContext/utils/productExtend.js +45 -2
- package/lib/modules/BookingContext/utils/resources.js +1 -1
- package/lib/modules/BusinessAvailability/index.d.ts +30 -0
- package/lib/modules/BusinessAvailability/index.js +146 -0
- 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/FulfillmentTiming/index.d.ts +11 -0
- package/lib/modules/FulfillmentTiming/index.js +359 -0
- package/lib/modules/FulfillmentTiming/types.d.ts +67 -0
- package/lib/modules/FulfillmentTiming/types.js +5 -0
- package/lib/modules/OpenData/types.d.ts +14 -0
- package/lib/modules/Order/index.d.ts +14 -2
- package/lib/modules/Order/index.js +240 -38
- package/lib/modules/Order/localEftposState.d.ts +13 -0
- package/lib/modules/Order/localEftposState.js +44 -0
- package/lib/modules/Order/pickupTiming.d.ts +46 -0
- package/lib/modules/Order/pickupTiming.js +61 -0
- package/lib/modules/Order/types.d.ts +30 -2
- package/lib/modules/Order/utils.js +21 -5
- package/lib/modules/Payment/index.js +3 -4
- package/lib/modules/Product/types.d.ts +11 -0
- package/lib/modules/ProductList/index.js +1 -1
- package/lib/modules/ResourcePlanner/planner.d.ts +2 -0
- package/lib/modules/ResourcePlanner/planner.js +252 -8
- package/lib/modules/ResourcePlanner/types.d.ts +29 -0
- package/lib/modules/Schedule/index.d.ts +8 -0
- package/lib/modules/Schedule/index.js +68 -12
- package/lib/modules/index.d.ts +1 -0
- package/lib/modules/index.js +11 -0
- package/lib/plugins/request.d.ts +7 -0
- package/lib/server/index.d.ts +1 -0
- package/lib/server/index.js +158 -37
- 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 +15 -0
- package/lib/server/modules/order/index.js +114 -3
- package/lib/server/modules/order/types.d.ts +1 -0
- package/lib/server/test.json +1 -1
- package/lib/server/utils/small-ticket.d.ts +1 -85
- package/lib/server/utils/small-ticket.js +9 -2305
- package/lib/shared/payment/loadPaymentMethods.d.ts +9 -0
- package/lib/shared/payment/loadPaymentMethods.js +40 -0
- package/lib/shared/receipt/customerInvoiceLanguages.d.ts +8 -0
- package/lib/shared/receipt/customerInvoiceLanguages.js +58 -0
- package/lib/shared/receipt/loadCustomerInvoiceLayout.d.ts +27 -0
- package/lib/shared/receipt/loadCustomerInvoiceLayout.js +124 -0
- package/lib/shared/receipt/small-ticket.d.ts +96 -0
- package/lib/shared/receipt/small-ticket.js +2546 -0
- package/lib/shared/receipt/templateVisibility.d.ts +23 -0
- package/lib/shared/receipt/templateVisibility.js +63 -0
- package/lib/shared/sales/loadSalesOrderSnapshot.d.ts +9 -0
- package/lib/shared/sales/loadSalesOrderSnapshot.js +22 -0
- package/lib/solution/BaseSales/fulfillmentItemRules.d.ts +27 -0
- package/lib/solution/BaseSales/fulfillmentItemRules.js +259 -0
- package/lib/solution/BaseSales/index.d.ts +39 -16
- package/lib/solution/BaseSales/index.js +333 -31
- package/lib/solution/BaseSales/pickupTiming.d.ts +47 -0
- package/lib/solution/BaseSales/pickupTiming.js +290 -0
- package/lib/solution/BaseSales/types.d.ts +11 -0
- package/lib/solution/BaseSales/utils/parseSalesResponse.js +3 -0
- package/lib/solution/BookingByStep/index.d.ts +4 -2
- package/lib/solution/BookingByStep/index.js +7 -3
- package/lib/solution/BookingTicket/index.d.ts +8 -2
- package/lib/solution/BookingTicket/index.js +65 -6
- package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +0 -1
- package/lib/solution/BookingTicket/utils/addProductDecision.js +1 -1
- package/lib/solution/BookingTicket/utils/cartView.js +3 -1
- package/lib/solution/OrderInvoicePreview/index.d.ts +66 -0
- package/lib/solution/OrderInvoicePreview/index.js +246 -0
- package/lib/solution/RegisterAndLogin/config.js +57 -11
- package/lib/solution/RegisterAndLogin/index.d.ts +2 -0
- package/lib/solution/RegisterAndLogin/index.js +9 -1
- package/lib/solution/RegisterAndLogin/utils.d.ts +12 -4
- package/lib/solution/RegisterAndLogin/utils.js +24 -17
- package/lib/solution/Sales/index.js +1 -1
- package/lib/solution/UnifiedBookingSales/businessAvailability.d.ts +27 -0
- package/lib/solution/UnifiedBookingSales/businessAvailability.js +138 -0
- package/lib/solution/UnifiedBookingSales/index.d.ts +36 -4
- package/lib/solution/UnifiedBookingSales/index.js +561 -74
- package/lib/solution/UnifiedBookingSales/types.d.ts +16 -2
- package/lib/solution/VenueBooking/index.d.ts +15 -2
- package/lib/solution/VenueBooking/index.js +243 -96
- package/lib/solution/VenueBooking/types.d.ts +2 -1
- package/lib/solution/VenueBooking/types.js +1 -0
- package/lib/solution/VenueBooking/utils/dateSummary.d.ts +1 -0
- package/lib/solution/VenueBooking/utils/dateSummary.js +7 -4
- package/lib/solution/VenueBooking/utils/smartPricing.d.ts +71 -0
- package/lib/solution/VenueBooking/utils/smartPricing.js +224 -0
- package/lib/solution/VenueBooking/utils/timeSlot.d.ts +1 -0
- package/lib/solution/VenueBooking/utils/timeSlot.js +5 -2
- package/lib/solution/index.d.ts +1 -0
- package/lib/solution/index.js +11 -0
- package/package.json +1 -1
|
@@ -51,6 +51,7 @@ import { buildProductOptionStringFromOrderLine } from "../../modules/BookingCont
|
|
|
51
51
|
import { applyBookingsStatus, applyChildBookingStatus, resolveScheduleId, resolveStatusAfterTransition, restoreBookingsStatus, restoreChildBookingStatus } from "./utils/bookingStatus";
|
|
52
52
|
import { resolveBestAddTimePlan as _resolveBestAddTimePlan } from "./utils/resolveBestAddTimePlan";
|
|
53
53
|
import { createUuidV4 } from "../../modules/Order/utils";
|
|
54
|
+
import { FormHooks } from "../../server/modules/form/types";
|
|
54
55
|
var OPEN_DATA_SECTION_CODES = ['sale', 'reservation', 'fulfillment', 'menu', 'workflow', 'documents'];
|
|
55
56
|
var OPEN_DATA_CACHE_TTL = 5 * 60 * 1000;
|
|
56
57
|
var USER_PLATFORM = ['pc', 'h5'];
|
|
@@ -206,6 +207,21 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
206
207
|
return !channel || channel === 'system' ? 'pos' : channel;
|
|
207
208
|
}
|
|
208
209
|
|
|
210
|
+
/** 供销售展示层按 booking.resources[].form_id 读取当前多语言表单标题。 */
|
|
211
|
+
}, {
|
|
212
|
+
key: "getFormTitleMap",
|
|
213
|
+
value: function getFormTitleMap() {
|
|
214
|
+
var _this$core2, _this$core2$getTitleM;
|
|
215
|
+
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)) || {};
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/** 表单定义由 Ably 更新后通知展示层刷新,不改动订单里的历史 metadata。 */
|
|
219
|
+
}, {
|
|
220
|
+
key: "onFormTitlesChanged",
|
|
221
|
+
value: function onFormTitlesChanged(callback) {
|
|
222
|
+
return this.core.effects.on(FormHooks.onChanged, callback);
|
|
223
|
+
}
|
|
224
|
+
|
|
209
225
|
/**
|
|
210
226
|
* 业务侧子模块工厂:BookingTicket 自带的 createBookingTicketModule 优先匹配;
|
|
211
227
|
* 未识别的模块名(如 BookingByStep 公共类型)回退到父类工厂。
|
|
@@ -452,29 +468,48 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
452
468
|
return getOpenData;
|
|
453
469
|
}()
|
|
454
470
|
}, {
|
|
455
|
-
key: "
|
|
471
|
+
key: "loadFulfillmentItemRuleOpenData",
|
|
456
472
|
value: function () {
|
|
457
|
-
var
|
|
458
|
-
var openData;
|
|
473
|
+
var _loadFulfillmentItemRuleOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
459
474
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
460
475
|
while (1) switch (_context5.prev = _context5.next) {
|
|
461
476
|
case 0:
|
|
462
|
-
_context5.
|
|
477
|
+
return _context5.abrupt("return", this.store.openData ? this.getOpenData() : _get(_getPrototypeOf(BookingTicketImpl.prototype), "loadFulfillmentItemRuleOpenData", this).call(this));
|
|
478
|
+
case 1:
|
|
479
|
+
case "end":
|
|
480
|
+
return _context5.stop();
|
|
481
|
+
}
|
|
482
|
+
}, _callee5, this);
|
|
483
|
+
}));
|
|
484
|
+
function loadFulfillmentItemRuleOpenData() {
|
|
485
|
+
return _loadFulfillmentItemRuleOpenData.apply(this, arguments);
|
|
486
|
+
}
|
|
487
|
+
return loadFulfillmentItemRuleOpenData;
|
|
488
|
+
}()
|
|
489
|
+
}, {
|
|
490
|
+
key: "getInvoiceLayoutConfig",
|
|
491
|
+
value: function () {
|
|
492
|
+
var _getInvoiceLayoutConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
493
|
+
var openData;
|
|
494
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
495
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
496
|
+
case 0:
|
|
497
|
+
_context6.next = 2;
|
|
463
498
|
return this.loadOpenDataConfig();
|
|
464
499
|
case 2:
|
|
465
|
-
openData =
|
|
500
|
+
openData = _context6.sent;
|
|
466
501
|
if (openData) {
|
|
467
|
-
|
|
502
|
+
_context6.next = 5;
|
|
468
503
|
break;
|
|
469
504
|
}
|
|
470
|
-
return
|
|
505
|
+
return _context6.abrupt("return", getDefaultInvoiceLayoutConfig());
|
|
471
506
|
case 5:
|
|
472
|
-
return
|
|
507
|
+
return _context6.abrupt("return", this.store.openData.getInvoiceLayoutConfig());
|
|
473
508
|
case 6:
|
|
474
509
|
case "end":
|
|
475
|
-
return
|
|
510
|
+
return _context6.stop();
|
|
476
511
|
}
|
|
477
|
-
},
|
|
512
|
+
}, _callee6, this);
|
|
478
513
|
}));
|
|
479
514
|
function getInvoiceLayoutConfig() {
|
|
480
515
|
return _getInvoiceLayoutConfig.apply(this, arguments);
|
|
@@ -484,27 +519,27 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
484
519
|
}, {
|
|
485
520
|
key: "getInvoiceTemplateSettings",
|
|
486
521
|
value: function () {
|
|
487
|
-
var _getInvoiceTemplateSettings = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
522
|
+
var _getInvoiceTemplateSettings = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
|
488
523
|
var openData;
|
|
489
|
-
return _regeneratorRuntime().wrap(function
|
|
490
|
-
while (1) switch (
|
|
524
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
525
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
491
526
|
case 0:
|
|
492
|
-
|
|
527
|
+
_context7.next = 2;
|
|
493
528
|
return this.loadOpenDataConfig();
|
|
494
529
|
case 2:
|
|
495
|
-
openData =
|
|
530
|
+
openData = _context7.sent;
|
|
496
531
|
if (openData) {
|
|
497
|
-
|
|
532
|
+
_context7.next = 5;
|
|
498
533
|
break;
|
|
499
534
|
}
|
|
500
|
-
return
|
|
535
|
+
return _context7.abrupt("return", getDefaultInvoiceTemplateSettings());
|
|
501
536
|
case 5:
|
|
502
|
-
return
|
|
537
|
+
return _context7.abrupt("return", this.store.openData.getInvoiceTemplateSettings());
|
|
503
538
|
case 6:
|
|
504
539
|
case "end":
|
|
505
|
-
return
|
|
540
|
+
return _context7.stop();
|
|
506
541
|
}
|
|
507
|
-
},
|
|
542
|
+
}, _callee7, this);
|
|
508
543
|
}));
|
|
509
544
|
function getInvoiceTemplateSettings() {
|
|
510
545
|
return _getInvoiceTemplateSettings.apply(this, arguments);
|
|
@@ -534,32 +569,32 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
534
569
|
}, {
|
|
535
570
|
key: "getShortNumberOrDeviceId",
|
|
536
571
|
value: function () {
|
|
537
|
-
var _getShortNumberOrDeviceId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
572
|
+
var _getShortNumberOrDeviceId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
|
|
538
573
|
var getAsyncIotDeviceInfo, res;
|
|
539
|
-
return _regeneratorRuntime().wrap(function
|
|
540
|
-
while (1) switch (
|
|
574
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
575
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
541
576
|
case 0:
|
|
542
577
|
getAsyncIotDeviceInfo = this.getAppData('async_iot_device_info');
|
|
543
578
|
if (!getAsyncIotDeviceInfo) {
|
|
544
|
-
|
|
579
|
+
_context8.next = 7;
|
|
545
580
|
break;
|
|
546
581
|
}
|
|
547
|
-
|
|
582
|
+
_context8.next = 4;
|
|
548
583
|
return getAsyncIotDeviceInfo === null || getAsyncIotDeviceInfo === void 0 ? void 0 : getAsyncIotDeviceInfo();
|
|
549
584
|
case 4:
|
|
550
|
-
res =
|
|
585
|
+
res = _context8.sent;
|
|
551
586
|
if (!(res !== null && res !== void 0 && res.short_number)) {
|
|
552
|
-
|
|
587
|
+
_context8.next = 7;
|
|
553
588
|
break;
|
|
554
589
|
}
|
|
555
|
-
return
|
|
590
|
+
return _context8.abrupt("return", res === null || res === void 0 ? void 0 : res.short_number);
|
|
556
591
|
case 7:
|
|
557
|
-
return
|
|
592
|
+
return _context8.abrupt("return", String(this.getAppData('device_id') || 0).slice(-2));
|
|
558
593
|
case 8:
|
|
559
594
|
case "end":
|
|
560
|
-
return
|
|
595
|
+
return _context8.stop();
|
|
561
596
|
}
|
|
562
|
-
},
|
|
597
|
+
}, _callee8, this);
|
|
563
598
|
}));
|
|
564
599
|
function getShortNumberOrDeviceId() {
|
|
565
600
|
return _getShortNumberOrDeviceId.apply(this, arguments);
|
|
@@ -569,35 +604,35 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
569
604
|
}, {
|
|
570
605
|
key: "configureIdGeneratorFromOpenData",
|
|
571
606
|
value: function () {
|
|
572
|
-
var _configureIdGeneratorFromOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
607
|
+
var _configureIdGeneratorFromOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
|
|
573
608
|
var _openDataConfig, _openDataConfig2, _openDataConfig3, _openDataConfig4, _openDataConfig5, _openDataConfig6;
|
|
574
|
-
var idGenerator, openDataConfig, receiptSequenceLength, receiptSequenceStart, prefix, shopOrderPrefix, resetReceiptSequenceDaily, operatingDayBoundary, deviceId, businessCode;
|
|
575
|
-
return _regeneratorRuntime().wrap(function
|
|
576
|
-
while (1) switch (
|
|
609
|
+
var idGenerator, openDataConfig, receiptSequenceLength, receiptSequenceStart, prefix, shopOrderPrefix, resetReceiptSequenceDaily, operatingDayBoundary, deviceId, businessCode, _openDataConfig7, _openDataConfig8, _openDataConfig9;
|
|
610
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
611
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
577
612
|
case 0:
|
|
578
613
|
// 业务码切换或配置失败时不能复用上一次初始化的短号。
|
|
579
614
|
this.setPaymentNumberDevicePrefix(null);
|
|
580
615
|
idGenerator = this.getIdGeneratorPlugin();
|
|
581
616
|
if (idGenerator !== null && idGenerator !== void 0 && idGenerator.configure) {
|
|
582
|
-
|
|
617
|
+
_context9.next = 5;
|
|
583
618
|
break;
|
|
584
619
|
}
|
|
585
620
|
console.warn('[BookingTicket] idGenerator 插件不可用,跳过配置');
|
|
586
|
-
return
|
|
621
|
+
return _context9.abrupt("return");
|
|
587
622
|
case 5:
|
|
588
623
|
openDataConfig = null;
|
|
589
|
-
|
|
590
|
-
|
|
624
|
+
_context9.prev = 6;
|
|
625
|
+
_context9.next = 9;
|
|
591
626
|
return this.loadOpenDataConfig();
|
|
592
627
|
case 9:
|
|
593
|
-
openDataConfig =
|
|
594
|
-
|
|
628
|
+
openDataConfig = _context9.sent;
|
|
629
|
+
_context9.next = 16;
|
|
595
630
|
break;
|
|
596
631
|
case 12:
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
console.warn('[BookingTicket] OpenData 配置加载失败,跳过 idGenerator 配置',
|
|
600
|
-
return
|
|
632
|
+
_context9.prev = 12;
|
|
633
|
+
_context9.t0 = _context9["catch"](6);
|
|
634
|
+
console.warn('[BookingTicket] OpenData 配置加载失败,跳过 idGenerator 配置', _context9.t0);
|
|
635
|
+
return _context9.abrupt("return");
|
|
601
636
|
case 16:
|
|
602
637
|
// if (!openDataConfig) return;
|
|
603
638
|
receiptSequenceLength = this.normalizePositiveInteger((_openDataConfig = openDataConfig) === null || _openDataConfig === void 0 ? void 0 : _openDataConfig['sale.short_number_digits'], 5);
|
|
@@ -609,29 +644,30 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
609
644
|
"type": "start_time",
|
|
610
645
|
"time": "00:00"
|
|
611
646
|
};
|
|
612
|
-
|
|
647
|
+
_context9.next = 24;
|
|
613
648
|
return this.getShortNumberOrDeviceId();
|
|
614
649
|
case 24:
|
|
615
|
-
deviceId =
|
|
650
|
+
deviceId = _context9.sent;
|
|
616
651
|
this.setPaymentNumberDevicePrefix(deviceId);
|
|
617
652
|
businessCode = this.getBookingTicketBusinessCode();
|
|
618
653
|
if (businessCode) {
|
|
619
|
-
|
|
654
|
+
_context9.next = 30;
|
|
620
655
|
break;
|
|
621
656
|
}
|
|
622
657
|
console.warn('[BookingTicket] businessCode 缺失,跳过 idGenerator 配置');
|
|
623
|
-
return
|
|
658
|
+
return _context9.abrupt("return");
|
|
624
659
|
case 30:
|
|
625
|
-
|
|
626
|
-
|
|
660
|
+
_context9.prev = 30;
|
|
661
|
+
_context9.next = 33;
|
|
627
662
|
return idGenerator.configure({
|
|
628
663
|
biz: businessCode,
|
|
629
664
|
config: {
|
|
630
665
|
prefix: prefix,
|
|
631
666
|
deviceCode: deviceId,
|
|
632
|
-
|
|
633
|
-
padReceiptSequence: false,
|
|
667
|
+
padReceiptSequence: ((_openDataConfig7 = openDataConfig) === null || _openDataConfig7 === void 0 ? void 0 : _openDataConfig7['sale.pad_with_leading_zeros']) === true,
|
|
634
668
|
receiptSequenceLength: receiptSequenceLength,
|
|
669
|
+
receiptSequenceMax: this.normalizeShortNumberMaximum((_openDataConfig8 = openDataConfig) === null || _openDataConfig8 === void 0 ? void 0 : _openDataConfig8['sale.maximum_number']),
|
|
670
|
+
randomReceiptSequence: ((_openDataConfig9 = openDataConfig) === null || _openDataConfig9 === void 0 ? void 0 : _openDataConfig9['sale.short_number_random']) === true,
|
|
635
671
|
resetReceiptSequenceDaily: resetReceiptSequenceDaily,
|
|
636
672
|
receiptSequenceResetTime: operatingDayBoundary === null || operatingDayBoundary === void 0 ? void 0 : operatingDayBoundary.time,
|
|
637
673
|
receiptSequenceStart: receiptSequenceStart,
|
|
@@ -639,17 +675,17 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
639
675
|
}
|
|
640
676
|
});
|
|
641
677
|
case 33:
|
|
642
|
-
|
|
678
|
+
_context9.next = 38;
|
|
643
679
|
break;
|
|
644
680
|
case 35:
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
console.warn('[BookingTicket] idGenerator 配置失败',
|
|
681
|
+
_context9.prev = 35;
|
|
682
|
+
_context9.t1 = _context9["catch"](30);
|
|
683
|
+
console.warn('[BookingTicket] idGenerator 配置失败', _context9.t1);
|
|
648
684
|
case 38:
|
|
649
685
|
case "end":
|
|
650
|
-
return
|
|
686
|
+
return _context9.stop();
|
|
651
687
|
}
|
|
652
|
-
},
|
|
688
|
+
}, _callee9, this, [[6, 12], [30, 35]]);
|
|
653
689
|
}));
|
|
654
690
|
function configureIdGeneratorFromOpenData() {
|
|
655
691
|
return _configureIdGeneratorFromOpenData.apply(this, arguments);
|
|
@@ -663,6 +699,19 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
663
699
|
if (!Number.isInteger(numeric) || numeric <= 0) return fallback;
|
|
664
700
|
return numeric;
|
|
665
701
|
}
|
|
702
|
+
}, {
|
|
703
|
+
key: "normalizeShortNumberMaximum",
|
|
704
|
+
value: function normalizeShortNumberMaximum(value) {
|
|
705
|
+
if (value === undefined || value === null || typeof value === 'string' && !value.trim()) return null;
|
|
706
|
+
if (typeof value !== 'number' && typeof value !== 'string') {
|
|
707
|
+
throw new Error('sale.maximum_number 必须是安全正整数或空值');
|
|
708
|
+
}
|
|
709
|
+
var numeric = Number(value);
|
|
710
|
+
if (!Number.isSafeInteger(numeric) || numeric <= 0) {
|
|
711
|
+
throw new Error('sale.maximum_number 必须是安全正整数或空值');
|
|
712
|
+
}
|
|
713
|
+
return numeric;
|
|
714
|
+
}
|
|
666
715
|
}, {
|
|
667
716
|
key: "normalizeIdPrefix",
|
|
668
717
|
value: function normalizeIdPrefix(value, fallback) {
|
|
@@ -681,16 +730,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
681
730
|
}, {
|
|
682
731
|
key: "loadSalesDetail",
|
|
683
732
|
value: (function () {
|
|
684
|
-
var _loadSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
733
|
+
var _loadSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(orderIdOrParams) {
|
|
685
734
|
var _ref3;
|
|
686
735
|
var sales, customerModule, detailCustomer, orderCustomerSnapshot, protocolCustomerId, protocolCustomer, selectedCustomer, _selectedCustomer$nam, _ref4, detailCustomerId, detailCustomerRest, rawId, customer;
|
|
687
|
-
return _regeneratorRuntime().wrap(function
|
|
688
|
-
while (1) switch (
|
|
736
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
737
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
689
738
|
case 0:
|
|
690
|
-
|
|
739
|
+
_context10.next = 2;
|
|
691
740
|
return _get(_getPrototypeOf(BookingTicketImpl.prototype), "loadSalesDetail", this).call(this, orderIdOrParams);
|
|
692
741
|
case 2:
|
|
693
|
-
sales =
|
|
742
|
+
sales = _context10.sent;
|
|
694
743
|
customerModule = this.store.customer;
|
|
695
744
|
detailCustomer = sales === null || sales === void 0 ? void 0 : sales.customer;
|
|
696
745
|
orderCustomerSnapshot = this.store.order.getOrderCustomerSnapshot();
|
|
@@ -722,12 +771,12 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
722
771
|
});
|
|
723
772
|
// await this.store.order.saveDraft();
|
|
724
773
|
}
|
|
725
|
-
return
|
|
774
|
+
return _context10.abrupt("return", sales);
|
|
726
775
|
case 11:
|
|
727
776
|
case "end":
|
|
728
|
-
return
|
|
777
|
+
return _context10.stop();
|
|
729
778
|
}
|
|
730
|
-
},
|
|
779
|
+
}, _callee10, this);
|
|
731
780
|
}));
|
|
732
781
|
function loadSalesDetail(_x3) {
|
|
733
782
|
return _loadSalesDetail.apply(this, arguments);
|
|
@@ -737,56 +786,56 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
737
786
|
}, {
|
|
738
787
|
key: "scanPromotionCode",
|
|
739
788
|
value: function () {
|
|
740
|
-
var _scanPromotionCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
789
|
+
var _scanPromotionCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(code, customerId) {
|
|
741
790
|
var raw, scannedList, extractedCustomerId, hasOrderCustomer, isUserPlatform, tempOrder;
|
|
742
|
-
return _regeneratorRuntime().wrap(function
|
|
743
|
-
while (1) switch (
|
|
791
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
792
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
744
793
|
case 0:
|
|
745
794
|
if (this.store.order) {
|
|
746
|
-
|
|
795
|
+
_context11.next = 2;
|
|
747
796
|
break;
|
|
748
797
|
}
|
|
749
798
|
throw new Error('order 模块未初始化');
|
|
750
799
|
case 2:
|
|
751
|
-
|
|
800
|
+
_context11.next = 4;
|
|
752
801
|
return this.store.order.scanCode(code, customerId);
|
|
753
802
|
case 4:
|
|
754
|
-
raw =
|
|
803
|
+
raw = _context11.sent;
|
|
755
804
|
scannedList = raw.scannedDiscountList || [];
|
|
756
805
|
extractedCustomerId = this.getDiscountCustomerId(scannedList);
|
|
757
806
|
hasOrderCustomer = Boolean(this.store.order.getOrderCustomer());
|
|
758
807
|
isUserPlatform = USER_PLATFORM.includes(this.otherParams.platform); // 缺 Holder 等场景 isAvailable=false,但仍需把 Pass 归属客户带入订单,供 Holder 弹窗使用。
|
|
759
808
|
if (!(!hasOrderCustomer && extractedCustomerId && !isUserPlatform)) {
|
|
760
|
-
|
|
809
|
+
_context11.next = 18;
|
|
761
810
|
break;
|
|
762
811
|
}
|
|
763
|
-
|
|
764
|
-
|
|
812
|
+
_context11.prev = 10;
|
|
813
|
+
_context11.next = 13;
|
|
765
814
|
return this.hydrateOrderCustomerFromScanDiscounts(scannedList);
|
|
766
815
|
case 13:
|
|
767
|
-
|
|
816
|
+
_context11.next = 18;
|
|
768
817
|
break;
|
|
769
818
|
case 15:
|
|
770
|
-
|
|
771
|
-
|
|
819
|
+
_context11.prev = 15;
|
|
820
|
+
_context11.t0 = _context11["catch"](10);
|
|
772
821
|
// 客户映射失败不能阻断原有 Pass 的可用性、展示或优惠处理。
|
|
773
822
|
console.warn('[BookingTicket] scan discount customer resolve failed', {
|
|
774
823
|
customerId: extractedCustomerId,
|
|
775
|
-
error:
|
|
824
|
+
error: _context11.t0
|
|
776
825
|
});
|
|
777
826
|
case 18:
|
|
778
827
|
if (!raw.isAvailable) {
|
|
779
|
-
|
|
828
|
+
_context11.next = 25;
|
|
780
829
|
break;
|
|
781
830
|
}
|
|
782
|
-
|
|
831
|
+
_context11.next = 21;
|
|
783
832
|
return this.store.order.recalculateSummary({
|
|
784
833
|
createIfMissing: true
|
|
785
834
|
});
|
|
786
835
|
case 21:
|
|
787
836
|
this.store.order.persistTempOrder();
|
|
788
837
|
tempOrder = this.store.order.ensureTempOrder();
|
|
789
|
-
|
|
838
|
+
_context11.next = 25;
|
|
790
839
|
return this.effectsEmit('onDiscountApplied', {
|
|
791
840
|
productList: tempOrder.products || [],
|
|
792
841
|
discountList: this.store.order.getDiscountList(),
|
|
@@ -794,7 +843,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
794
843
|
tempOrder: tempOrder
|
|
795
844
|
});
|
|
796
845
|
case 25:
|
|
797
|
-
return
|
|
846
|
+
return _context11.abrupt("return", _objectSpread(_objectSpread({
|
|
798
847
|
isAvailable: raw.isAvailable
|
|
799
848
|
}, raw.isAccepted !== undefined ? {
|
|
800
849
|
isAccepted: raw.isAccepted
|
|
@@ -805,9 +854,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
805
854
|
}));
|
|
806
855
|
case 26:
|
|
807
856
|
case "end":
|
|
808
|
-
return
|
|
857
|
+
return _context11.stop();
|
|
809
858
|
}
|
|
810
|
-
},
|
|
859
|
+
}, _callee11, this, [[10, 15]]);
|
|
811
860
|
}));
|
|
812
861
|
function scanPromotionCode(_x4, _x5) {
|
|
813
862
|
return _scanPromotionCode.apply(this, arguments);
|
|
@@ -817,42 +866,42 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
817
866
|
}, {
|
|
818
867
|
key: "hydrateOrderCustomerFromScanDiscounts",
|
|
819
868
|
value: function () {
|
|
820
|
-
var _hydrateOrderCustomerFromScanDiscounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
869
|
+
var _hydrateOrderCustomerFromScanDiscounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(discounts) {
|
|
821
870
|
var currentOrderCustomer, customerId, customer;
|
|
822
|
-
return _regeneratorRuntime().wrap(function
|
|
823
|
-
while (1) switch (
|
|
871
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
872
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
824
873
|
case 0:
|
|
825
874
|
currentOrderCustomer = this.store.order.getOrderCustomer();
|
|
826
875
|
if (!currentOrderCustomer) {
|
|
827
|
-
|
|
876
|
+
_context12.next = 3;
|
|
828
877
|
break;
|
|
829
878
|
}
|
|
830
|
-
return
|
|
879
|
+
return _context12.abrupt("return");
|
|
831
880
|
case 3:
|
|
832
881
|
customerId = this.getDiscountCustomerId(discounts);
|
|
833
882
|
if (customerId) {
|
|
834
|
-
|
|
883
|
+
_context12.next = 6;
|
|
835
884
|
break;
|
|
836
885
|
}
|
|
837
|
-
return
|
|
886
|
+
return _context12.abrupt("return");
|
|
838
887
|
case 6:
|
|
839
|
-
|
|
888
|
+
_context12.next = 8;
|
|
840
889
|
return this.resolveCustomerByDiscountCustomerId(customerId);
|
|
841
890
|
case 8:
|
|
842
|
-
customer =
|
|
891
|
+
customer = _context12.sent;
|
|
843
892
|
if (customer) {
|
|
844
|
-
|
|
893
|
+
_context12.next = 11;
|
|
845
894
|
break;
|
|
846
895
|
}
|
|
847
|
-
return
|
|
896
|
+
return _context12.abrupt("return");
|
|
848
897
|
case 11:
|
|
849
898
|
this.store.customer.setSelectedCustomer(customer);
|
|
850
899
|
this.setOrderCustomer(customer);
|
|
851
900
|
case 13:
|
|
852
901
|
case "end":
|
|
853
|
-
return
|
|
902
|
+
return _context12.stop();
|
|
854
903
|
}
|
|
855
|
-
},
|
|
904
|
+
}, _callee12, this);
|
|
856
905
|
}));
|
|
857
906
|
function hydrateOrderCustomerFromScanDiscounts(_x6) {
|
|
858
907
|
return _hydrateOrderCustomerFromScanDiscounts.apply(this, arguments);
|
|
@@ -888,27 +937,27 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
888
937
|
}, {
|
|
889
938
|
key: "resolveCustomerById",
|
|
890
939
|
value: function () {
|
|
891
|
-
var _resolveCustomerById = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
940
|
+
var _resolveCustomerById = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(customerId) {
|
|
892
941
|
var _this2 = this;
|
|
893
942
|
var rawCustomerId, numericCustomerId, normalizedCustomerId, existingRequest, request;
|
|
894
|
-
return _regeneratorRuntime().wrap(function
|
|
895
|
-
while (1) switch (
|
|
943
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
944
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
896
945
|
case 0:
|
|
897
946
|
rawCustomerId = String(customerId !== null && customerId !== void 0 ? customerId : '').trim();
|
|
898
947
|
numericCustomerId = Number(rawCustomerId);
|
|
899
948
|
if (!(!rawCustomerId || !Number.isInteger(numericCustomerId) || numericCustomerId <= 1)) {
|
|
900
|
-
|
|
949
|
+
_context13.next = 4;
|
|
901
950
|
break;
|
|
902
951
|
}
|
|
903
|
-
return
|
|
952
|
+
return _context13.abrupt("return", null);
|
|
904
953
|
case 4:
|
|
905
954
|
normalizedCustomerId = String(numericCustomerId);
|
|
906
955
|
existingRequest = this.customerResolveRequests.get(normalizedCustomerId);
|
|
907
956
|
if (!existingRequest) {
|
|
908
|
-
|
|
957
|
+
_context13.next = 8;
|
|
909
958
|
break;
|
|
910
959
|
}
|
|
911
|
-
return
|
|
960
|
+
return _context13.abrupt("return", existingRequest);
|
|
912
961
|
case 8:
|
|
913
962
|
request = this.request.post("/customer/resolve/".concat(encodeURIComponent(normalizedCustomerId)), {
|
|
914
963
|
with_franchisor_data: 1,
|
|
@@ -928,12 +977,12 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
928
977
|
}
|
|
929
978
|
});
|
|
930
979
|
this.customerResolveRequests.set(normalizedCustomerId, request);
|
|
931
|
-
return
|
|
980
|
+
return _context13.abrupt("return", request);
|
|
932
981
|
case 11:
|
|
933
982
|
case "end":
|
|
934
|
-
return
|
|
983
|
+
return _context13.stop();
|
|
935
984
|
}
|
|
936
|
-
},
|
|
985
|
+
}, _callee13, this);
|
|
937
986
|
}));
|
|
938
987
|
function resolveCustomerById(_x7) {
|
|
939
988
|
return _resolveCustomerById.apply(this, arguments);
|
|
@@ -985,60 +1034,60 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
985
1034
|
}, {
|
|
986
1035
|
key: "setBookingStatus",
|
|
987
1036
|
value: (function () {
|
|
988
|
-
var _setBookingStatus = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1037
|
+
var _setBookingStatus = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(status) {
|
|
989
1038
|
var _this$store$order2, _this$store$order2$ge;
|
|
990
1039
|
var tempOrder, orderId, scheduleId, bookings, previous, _data, res;
|
|
991
|
-
return _regeneratorRuntime().wrap(function
|
|
992
|
-
while (1) switch (
|
|
1040
|
+
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
1041
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
993
1042
|
case 0:
|
|
994
1043
|
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);
|
|
995
1044
|
if (tempOrder) {
|
|
996
|
-
|
|
1045
|
+
_context14.next = 3;
|
|
997
1046
|
break;
|
|
998
1047
|
}
|
|
999
1048
|
throw new Error('setBookingStatus: tempOrder 未加载');
|
|
1000
1049
|
case 3:
|
|
1001
1050
|
orderId = tempOrder.order_id;
|
|
1002
1051
|
if (!(orderId === undefined || orderId === null)) {
|
|
1003
|
-
|
|
1052
|
+
_context14.next = 6;
|
|
1004
1053
|
break;
|
|
1005
1054
|
}
|
|
1006
1055
|
throw new Error('setBookingStatus: tempOrder.order_id 缺失');
|
|
1007
1056
|
case 6:
|
|
1008
1057
|
scheduleId = resolveScheduleId(tempOrder);
|
|
1009
1058
|
if (!(scheduleId === null)) {
|
|
1010
|
-
|
|
1059
|
+
_context14.next = 9;
|
|
1011
1060
|
break;
|
|
1012
1061
|
}
|
|
1013
1062
|
throw new Error('setBookingStatus: 无法解析 schedule id(metadata 与 root booking 均缺失)');
|
|
1014
1063
|
case 9:
|
|
1015
1064
|
bookings = Array.isArray(tempOrder.bookings) ? tempOrder.bookings : [];
|
|
1016
1065
|
previous = applyBookingsStatus(bookings, status);
|
|
1017
|
-
|
|
1018
|
-
|
|
1066
|
+
_context14.prev = 11;
|
|
1067
|
+
_context14.next = 14;
|
|
1019
1068
|
return this.request.put("/schedule/booking/appointment-status/".concat(scheduleId), {
|
|
1020
1069
|
appointment_status: status
|
|
1021
1070
|
});
|
|
1022
1071
|
case 14:
|
|
1023
|
-
res =
|
|
1024
|
-
|
|
1072
|
+
res = _context14.sent;
|
|
1073
|
+
_context14.next = 17;
|
|
1025
1074
|
return this.refreshSalesDetail();
|
|
1026
1075
|
case 17:
|
|
1027
1076
|
this.core.effects.emit("".concat(this.name, ":onBookingStatusChange"), {
|
|
1028
1077
|
orderId: orderId,
|
|
1029
1078
|
status: status
|
|
1030
1079
|
});
|
|
1031
|
-
return
|
|
1080
|
+
return _context14.abrupt("return", (_data = res === null || res === void 0 ? void 0 : res.data) !== null && _data !== void 0 ? _data : res);
|
|
1032
1081
|
case 21:
|
|
1033
|
-
|
|
1034
|
-
|
|
1082
|
+
_context14.prev = 21;
|
|
1083
|
+
_context14.t0 = _context14["catch"](11);
|
|
1035
1084
|
restoreBookingsStatus(bookings, previous);
|
|
1036
|
-
throw
|
|
1085
|
+
throw _context14.t0;
|
|
1037
1086
|
case 25:
|
|
1038
1087
|
case "end":
|
|
1039
|
-
return
|
|
1088
|
+
return _context14.stop();
|
|
1040
1089
|
}
|
|
1041
|
-
},
|
|
1090
|
+
}, _callee14, this, [[11, 21]]);
|
|
1042
1091
|
}));
|
|
1043
1092
|
function setBookingStatus(_x8) {
|
|
1044
1093
|
return _setBookingStatus.apply(this, arguments);
|
|
@@ -1069,35 +1118,35 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1069
1118
|
}, {
|
|
1070
1119
|
key: "transitionChildBooking",
|
|
1071
1120
|
value: (function () {
|
|
1072
|
-
var _transitionChildBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1121
|
+
var _transitionChildBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(params) {
|
|
1073
1122
|
var _this$store$order3, _this$store$order3$ge;
|
|
1074
1123
|
var schedule_event_id, action, tempOrder, orderId, bookings, targetStatus, previous, _data2, res;
|
|
1075
|
-
return _regeneratorRuntime().wrap(function
|
|
1076
|
-
while (1) switch (
|
|
1124
|
+
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
1125
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
1077
1126
|
case 0:
|
|
1078
1127
|
schedule_event_id = params.schedule_event_id, action = params.action;
|
|
1079
1128
|
if (!(schedule_event_id === undefined || schedule_event_id === null || schedule_event_id === '')) {
|
|
1080
|
-
|
|
1129
|
+
_context15.next = 3;
|
|
1081
1130
|
break;
|
|
1082
1131
|
}
|
|
1083
1132
|
throw new Error('transitionChildBooking: schedule_event_id 不能为空');
|
|
1084
1133
|
case 3:
|
|
1085
1134
|
if (action) {
|
|
1086
|
-
|
|
1135
|
+
_context15.next = 5;
|
|
1087
1136
|
break;
|
|
1088
1137
|
}
|
|
1089
1138
|
throw new Error('transitionChildBooking: action 不能为空');
|
|
1090
1139
|
case 5:
|
|
1091
1140
|
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);
|
|
1092
1141
|
if (tempOrder) {
|
|
1093
|
-
|
|
1142
|
+
_context15.next = 8;
|
|
1094
1143
|
break;
|
|
1095
1144
|
}
|
|
1096
1145
|
throw new Error('transitionChildBooking: tempOrder 未加载');
|
|
1097
1146
|
case 8:
|
|
1098
1147
|
orderId = tempOrder.order_id;
|
|
1099
1148
|
if (!(orderId === undefined || orderId === null)) {
|
|
1100
|
-
|
|
1149
|
+
_context15.next = 11;
|
|
1101
1150
|
break;
|
|
1102
1151
|
}
|
|
1103
1152
|
throw new Error('transitionChildBooking: tempOrder.order_id 缺失');
|
|
@@ -1105,14 +1154,14 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1105
1154
|
bookings = Array.isArray(tempOrder.bookings) ? tempOrder.bookings : [];
|
|
1106
1155
|
targetStatus = resolveStatusAfterTransition(action);
|
|
1107
1156
|
previous = targetStatus !== null ? applyChildBookingStatus(bookings, schedule_event_id, targetStatus) : undefined;
|
|
1108
|
-
|
|
1109
|
-
|
|
1157
|
+
_context15.prev = 14;
|
|
1158
|
+
_context15.next = 17;
|
|
1110
1159
|
return this.request.post("/schedule/booking-transition/".concat(schedule_event_id), {
|
|
1111
1160
|
action: action
|
|
1112
1161
|
});
|
|
1113
1162
|
case 17:
|
|
1114
|
-
res =
|
|
1115
|
-
|
|
1163
|
+
res = _context15.sent;
|
|
1164
|
+
_context15.next = 20;
|
|
1116
1165
|
return this.refreshSalesDetail();
|
|
1117
1166
|
case 20:
|
|
1118
1167
|
this.core.effects.emit("".concat(this.name, ":onChildBookingStatusChange"), {
|
|
@@ -1121,19 +1170,19 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1121
1170
|
action: action,
|
|
1122
1171
|
status: targetStatus
|
|
1123
1172
|
});
|
|
1124
|
-
return
|
|
1173
|
+
return _context15.abrupt("return", (_data2 = res === null || res === void 0 ? void 0 : res.data) !== null && _data2 !== void 0 ? _data2 : res);
|
|
1125
1174
|
case 24:
|
|
1126
|
-
|
|
1127
|
-
|
|
1175
|
+
_context15.prev = 24;
|
|
1176
|
+
_context15.t0 = _context15["catch"](14);
|
|
1128
1177
|
if (previous !== undefined) {
|
|
1129
1178
|
restoreChildBookingStatus(bookings, schedule_event_id, previous);
|
|
1130
1179
|
}
|
|
1131
|
-
throw
|
|
1180
|
+
throw _context15.t0;
|
|
1132
1181
|
case 28:
|
|
1133
1182
|
case "end":
|
|
1134
|
-
return
|
|
1183
|
+
return _context15.stop();
|
|
1135
1184
|
}
|
|
1136
|
-
},
|
|
1185
|
+
}, _callee15, this, [[14, 24]]);
|
|
1137
1186
|
}));
|
|
1138
1187
|
function transitionChildBooking(_x9) {
|
|
1139
1188
|
return _transitionChildBooking.apply(this, arguments);
|
|
@@ -1154,19 +1203,19 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1154
1203
|
}, {
|
|
1155
1204
|
key: "refreshSalesDetail",
|
|
1156
1205
|
value: (function () {
|
|
1157
|
-
var _refreshSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1206
|
+
var _refreshSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
|
|
1158
1207
|
var _this$store$order4, _this$store$order4$ge;
|
|
1159
1208
|
var params,
|
|
1160
1209
|
tempOrder,
|
|
1161
1210
|
orderId,
|
|
1162
|
-
|
|
1163
|
-
return _regeneratorRuntime().wrap(function
|
|
1164
|
-
while (1) switch (
|
|
1211
|
+
_args16 = arguments;
|
|
1212
|
+
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
1213
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
1165
1214
|
case 0:
|
|
1166
|
-
params =
|
|
1215
|
+
params = _args16.length > 0 && _args16[0] !== undefined ? _args16[0] : {};
|
|
1167
1216
|
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);
|
|
1168
1217
|
if (tempOrder) {
|
|
1169
|
-
|
|
1218
|
+
_context16.next = 4;
|
|
1170
1219
|
break;
|
|
1171
1220
|
}
|
|
1172
1221
|
throw new Error('refreshSalesDetail: tempOrder 未加载');
|
|
@@ -1174,21 +1223,21 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1174
1223
|
debugger;
|
|
1175
1224
|
orderId = tempOrder.order_id || tempOrder.external_sale_number;
|
|
1176
1225
|
if (!(orderId === undefined || orderId === null)) {
|
|
1177
|
-
|
|
1226
|
+
_context16.next = 8;
|
|
1178
1227
|
break;
|
|
1179
1228
|
}
|
|
1180
|
-
return
|
|
1229
|
+
return _context16.abrupt("return", {});
|
|
1181
1230
|
case 8:
|
|
1182
|
-
return
|
|
1231
|
+
return _context16.abrupt("return", this.loadSalesDetail({
|
|
1183
1232
|
orderId: orderId,
|
|
1184
1233
|
// merge: true
|
|
1185
1234
|
forceRemote: params.forceRemote
|
|
1186
1235
|
}));
|
|
1187
1236
|
case 9:
|
|
1188
1237
|
case "end":
|
|
1189
|
-
return
|
|
1238
|
+
return _context16.stop();
|
|
1190
1239
|
}
|
|
1191
|
-
},
|
|
1240
|
+
}, _callee16, this);
|
|
1192
1241
|
}));
|
|
1193
1242
|
function refreshSalesDetail() {
|
|
1194
1243
|
return _refreshSalesDetail.apply(this, arguments);
|
|
@@ -1204,7 +1253,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1204
1253
|
}, {
|
|
1205
1254
|
key: "loadProducts",
|
|
1206
1255
|
value: (function () {
|
|
1207
|
-
var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1256
|
+
var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
|
|
1208
1257
|
var params,
|
|
1209
1258
|
options,
|
|
1210
1259
|
schedule_date,
|
|
@@ -1213,20 +1262,20 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1213
1262
|
schedule_datetime,
|
|
1214
1263
|
bookingDate,
|
|
1215
1264
|
_result,
|
|
1216
|
-
|
|
1217
|
-
return _regeneratorRuntime().wrap(function
|
|
1218
|
-
while (1) switch (
|
|
1265
|
+
_args17 = arguments;
|
|
1266
|
+
return _regeneratorRuntime().wrap(function _callee17$(_context17) {
|
|
1267
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
1219
1268
|
case 0:
|
|
1220
|
-
params =
|
|
1221
|
-
options =
|
|
1269
|
+
params = _args17.length > 0 && _args17[0] !== undefined ? _args17[0] : {};
|
|
1270
|
+
options = _args17.length > 1 ? _args17[1] : undefined;
|
|
1222
1271
|
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 对齐;
|
|
1223
1272
|
// requiresDetail 弹窗仍通过 formatBookingDateForUI 只取日历日 YYYY-MM-DD。
|
|
1224
1273
|
bookingDate = schedule_datetime || schedule_date || '';
|
|
1225
1274
|
if (bookingDate) {
|
|
1226
1275
|
this.setBookingDate(bookingDate);
|
|
1227
1276
|
}
|
|
1228
|
-
|
|
1229
|
-
|
|
1277
|
+
_context17.prev = 5;
|
|
1278
|
+
_context17.next = 8;
|
|
1230
1279
|
return this.store.products.loadProducts(_objectSpread(_objectSpread({
|
|
1231
1280
|
with_count: ['bundleGroup', 'optionGroup'],
|
|
1232
1281
|
with_schedule: 1
|
|
@@ -1234,20 +1283,20 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1234
1283
|
cacheId: this.cacheId
|
|
1235
1284
|
}), options);
|
|
1236
1285
|
case 8:
|
|
1237
|
-
_result =
|
|
1286
|
+
_result = _context17.sent;
|
|
1238
1287
|
this.productCatalog = Array.isArray(_result) ? _toConsumableArray(_result) : [];
|
|
1239
1288
|
this.core.effects.emit("".concat(this.name, ":onProductsLoaded"), _result);
|
|
1240
|
-
return
|
|
1289
|
+
return _context17.abrupt("return", _result);
|
|
1241
1290
|
case 14:
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
console.error('Failed to load products:',
|
|
1245
|
-
throw
|
|
1291
|
+
_context17.prev = 14;
|
|
1292
|
+
_context17.t0 = _context17["catch"](5);
|
|
1293
|
+
console.error('Failed to load products:', _context17.t0);
|
|
1294
|
+
throw _context17.t0;
|
|
1246
1295
|
case 18:
|
|
1247
1296
|
case "end":
|
|
1248
|
-
return
|
|
1297
|
+
return _context17.stop();
|
|
1249
1298
|
}
|
|
1250
|
-
},
|
|
1299
|
+
}, _callee17, this, [[5, 14]]);
|
|
1251
1300
|
}));
|
|
1252
1301
|
function loadProducts() {
|
|
1253
1302
|
return _loadProducts.apply(this, arguments);
|
|
@@ -1264,27 +1313,27 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1264
1313
|
}, {
|
|
1265
1314
|
key: "getAddTimeProducts",
|
|
1266
1315
|
value: (function () {
|
|
1267
|
-
var _getAddTimeProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1316
|
+
var _getAddTimeProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18() {
|
|
1268
1317
|
var params,
|
|
1269
1318
|
result,
|
|
1270
|
-
|
|
1271
|
-
return _regeneratorRuntime().wrap(function
|
|
1272
|
-
while (1) switch (
|
|
1319
|
+
_args18 = arguments;
|
|
1320
|
+
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
1321
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
1273
1322
|
case 0:
|
|
1274
|
-
params =
|
|
1275
|
-
|
|
1323
|
+
params = _args18.length > 0 && _args18[0] !== undefined ? _args18[0] : {};
|
|
1324
|
+
_context18.next = 3;
|
|
1276
1325
|
return this.store.products.getAddTimeProducts(_objectSpread(_objectSpread({}, params), {}, {
|
|
1277
1326
|
cacheId: this.cacheId
|
|
1278
1327
|
}));
|
|
1279
1328
|
case 3:
|
|
1280
|
-
result =
|
|
1329
|
+
result = _context18.sent;
|
|
1281
1330
|
this.addTimeProductsCatalog = Array.isArray(result) ? _toConsumableArray(result) : [];
|
|
1282
|
-
return
|
|
1331
|
+
return _context18.abrupt("return", result);
|
|
1283
1332
|
case 6:
|
|
1284
1333
|
case "end":
|
|
1285
|
-
return
|
|
1334
|
+
return _context18.stop();
|
|
1286
1335
|
}
|
|
1287
|
-
},
|
|
1336
|
+
}, _callee18, this);
|
|
1288
1337
|
}));
|
|
1289
1338
|
function getAddTimeProducts() {
|
|
1290
1339
|
return _getAddTimeProducts.apply(this, arguments);
|
|
@@ -1309,14 +1358,14 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1309
1358
|
}, {
|
|
1310
1359
|
key: "queryProductDetail",
|
|
1311
1360
|
value: (function () {
|
|
1312
|
-
var _queryProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1361
|
+
var _queryProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(params, options) {
|
|
1313
1362
|
var product_id, queryParams, _result2, list;
|
|
1314
|
-
return _regeneratorRuntime().wrap(function
|
|
1315
|
-
while (1) switch (
|
|
1363
|
+
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
|
1364
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
1316
1365
|
case 0:
|
|
1317
1366
|
product_id = params.product_id, queryParams = _objectWithoutProperties(params, _excluded2);
|
|
1318
|
-
|
|
1319
|
-
|
|
1367
|
+
_context19.prev = 1;
|
|
1368
|
+
_context19.next = 4;
|
|
1320
1369
|
return this.store.products.loadProducts(_objectSpread(_objectSpread({
|
|
1321
1370
|
with_count: ['bundleGroup', 'optionGroup'],
|
|
1322
1371
|
with_schedule: 1
|
|
@@ -1325,21 +1374,21 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1325
1374
|
cacheId: this.cacheId
|
|
1326
1375
|
}), options);
|
|
1327
1376
|
case 4:
|
|
1328
|
-
_result2 =
|
|
1377
|
+
_result2 = _context19.sent;
|
|
1329
1378
|
list = Array.isArray(_result2) ? _result2 : [];
|
|
1330
|
-
return
|
|
1379
|
+
return _context19.abrupt("return", list.find(function (product) {
|
|
1331
1380
|
return Number(product.id) === Number(product_id);
|
|
1332
1381
|
}));
|
|
1333
1382
|
case 9:
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
console.error('Failed to query product detail:',
|
|
1337
|
-
throw
|
|
1383
|
+
_context19.prev = 9;
|
|
1384
|
+
_context19.t0 = _context19["catch"](1);
|
|
1385
|
+
console.error('Failed to query product detail:', _context19.t0);
|
|
1386
|
+
throw _context19.t0;
|
|
1338
1387
|
case 13:
|
|
1339
1388
|
case "end":
|
|
1340
|
-
return
|
|
1389
|
+
return _context19.stop();
|
|
1341
1390
|
}
|
|
1342
|
-
},
|
|
1391
|
+
}, _callee19, this, [[1, 9]]);
|
|
1343
1392
|
}));
|
|
1344
1393
|
function queryProductDetail(_x10, _x11) {
|
|
1345
1394
|
return _queryProductDetail.apply(this, arguments);
|
|
@@ -1354,26 +1403,26 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1354
1403
|
}, {
|
|
1355
1404
|
key: "loadProductDetail",
|
|
1356
1405
|
value: (function () {
|
|
1357
|
-
var _loadProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1406
|
+
var _loadProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(params, options) {
|
|
1358
1407
|
var product_id, queryParams, products;
|
|
1359
|
-
return _regeneratorRuntime().wrap(function
|
|
1360
|
-
while (1) switch (
|
|
1408
|
+
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
|
1409
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
1361
1410
|
case 0:
|
|
1362
1411
|
product_id = params.product_id, queryParams = _objectWithoutProperties(params, _excluded3);
|
|
1363
|
-
|
|
1412
|
+
_context20.next = 3;
|
|
1364
1413
|
return this.loadProducts(_objectSpread(_objectSpread({}, queryParams), {}, {
|
|
1365
1414
|
product_ids: [product_id]
|
|
1366
1415
|
}), options);
|
|
1367
1416
|
case 3:
|
|
1368
|
-
products =
|
|
1369
|
-
return
|
|
1417
|
+
products = _context20.sent;
|
|
1418
|
+
return _context20.abrupt("return", products.find(function (product) {
|
|
1370
1419
|
return Number(product.id) === Number(product_id);
|
|
1371
1420
|
}));
|
|
1372
1421
|
case 5:
|
|
1373
1422
|
case "end":
|
|
1374
|
-
return
|
|
1423
|
+
return _context20.stop();
|
|
1375
1424
|
}
|
|
1376
|
-
},
|
|
1425
|
+
}, _callee20, this);
|
|
1377
1426
|
}));
|
|
1378
1427
|
function loadProductDetail(_x12, _x13) {
|
|
1379
1428
|
return _loadProductDetail.apply(this, arguments);
|
|
@@ -1408,16 +1457,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1408
1457
|
}, {
|
|
1409
1458
|
key: "getProducts",
|
|
1410
1459
|
value: (function () {
|
|
1411
|
-
var _getProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1412
|
-
return _regeneratorRuntime().wrap(function
|
|
1413
|
-
while (1) switch (
|
|
1460
|
+
var _getProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21() {
|
|
1461
|
+
return _regeneratorRuntime().wrap(function _callee21$(_context21) {
|
|
1462
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
1414
1463
|
case 0:
|
|
1415
|
-
return
|
|
1464
|
+
return _context21.abrupt("return", this.store.products.getProducts());
|
|
1416
1465
|
case 1:
|
|
1417
1466
|
case "end":
|
|
1418
|
-
return
|
|
1467
|
+
return _context21.stop();
|
|
1419
1468
|
}
|
|
1420
|
-
},
|
|
1469
|
+
}, _callee21, this);
|
|
1421
1470
|
}));
|
|
1422
1471
|
function getProducts() {
|
|
1423
1472
|
return _getProducts.apply(this, arguments);
|
|
@@ -1482,33 +1531,33 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1482
1531
|
}, {
|
|
1483
1532
|
key: "getProductByIds",
|
|
1484
1533
|
value: (function () {
|
|
1485
|
-
var _getProductByIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1534
|
+
var _getProductByIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(ids, options) {
|
|
1486
1535
|
var _this$getOrderCustome, _this$getOrderCustome2, _this$getOrderCustome3;
|
|
1487
1536
|
var normalizedIds, localProducts, localProductIds, missingIds, rawBookingDate, bookingDate, customerId, loadedProducts, productById;
|
|
1488
|
-
return _regeneratorRuntime().wrap(function
|
|
1489
|
-
while (1) switch (
|
|
1537
|
+
return _regeneratorRuntime().wrap(function _callee22$(_context22) {
|
|
1538
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
1490
1539
|
case 0:
|
|
1491
1540
|
normalizedIds = Array.from(new Set((ids || []).map(function (id) {
|
|
1492
1541
|
return Number(id);
|
|
1493
1542
|
}).filter(function (id) {
|
|
1494
1543
|
return Number.isFinite(id);
|
|
1495
1544
|
})));
|
|
1496
|
-
|
|
1545
|
+
_context22.next = 3;
|
|
1497
1546
|
return this.store.products.getProductByIds(normalizedIds);
|
|
1498
1547
|
case 3:
|
|
1499
|
-
|
|
1500
|
-
if (
|
|
1501
|
-
|
|
1548
|
+
_context22.t0 = _context22.sent;
|
|
1549
|
+
if (_context22.t0) {
|
|
1550
|
+
_context22.next = 6;
|
|
1502
1551
|
break;
|
|
1503
1552
|
}
|
|
1504
|
-
|
|
1553
|
+
_context22.t0 = [];
|
|
1505
1554
|
case 6:
|
|
1506
|
-
localProducts =
|
|
1555
|
+
localProducts = _context22.t0;
|
|
1507
1556
|
if (options !== null && options !== void 0 && options.loadMissing) {
|
|
1508
|
-
|
|
1557
|
+
_context22.next = 9;
|
|
1509
1558
|
break;
|
|
1510
1559
|
}
|
|
1511
|
-
return
|
|
1560
|
+
return _context22.abrupt("return", localProducts);
|
|
1512
1561
|
case 9:
|
|
1513
1562
|
localProductIds = new Set(localProducts.map(function (product) {
|
|
1514
1563
|
return Number(product.id);
|
|
@@ -1517,15 +1566,15 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1517
1566
|
return !localProductIds.has(id);
|
|
1518
1567
|
});
|
|
1519
1568
|
if (missingIds.length) {
|
|
1520
|
-
|
|
1569
|
+
_context22.next = 13;
|
|
1521
1570
|
break;
|
|
1522
1571
|
}
|
|
1523
|
-
return
|
|
1572
|
+
return _context22.abrupt("return", localProducts);
|
|
1524
1573
|
case 13:
|
|
1525
1574
|
rawBookingDate = this.getBookingDate();
|
|
1526
1575
|
bookingDate = rawBookingDate && dayjs(rawBookingDate).isValid() ? dayjs(rawBookingDate) : null;
|
|
1527
1576
|
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);
|
|
1528
|
-
|
|
1577
|
+
_context22.next = 18;
|
|
1529
1578
|
return this.store.products.loadProducts(_objectSpread(_objectSpread({
|
|
1530
1579
|
product_ids: missingIds,
|
|
1531
1580
|
with_count: ['bundleGroup', 'optionGroup'],
|
|
@@ -1538,7 +1587,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1538
1587
|
customer_id: customerId
|
|
1539
1588
|
} : {}));
|
|
1540
1589
|
case 18:
|
|
1541
|
-
loadedProducts =
|
|
1590
|
+
loadedProducts = _context22.sent;
|
|
1542
1591
|
productById = new Map();
|
|
1543
1592
|
[].concat(_toConsumableArray(localProducts), _toConsumableArray(loadedProducts || [])).forEach(function (product) {
|
|
1544
1593
|
var productId = Number(product.id);
|
|
@@ -1546,16 +1595,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1546
1595
|
productById.set(productId, product);
|
|
1547
1596
|
}
|
|
1548
1597
|
});
|
|
1549
|
-
return
|
|
1598
|
+
return _context22.abrupt("return", normalizedIds.map(function (id) {
|
|
1550
1599
|
return productById.get(id);
|
|
1551
1600
|
}).filter(function (product) {
|
|
1552
1601
|
return Boolean(product);
|
|
1553
1602
|
}));
|
|
1554
1603
|
case 22:
|
|
1555
1604
|
case "end":
|
|
1556
|
-
return
|
|
1605
|
+
return _context22.stop();
|
|
1557
1606
|
}
|
|
1558
|
-
},
|
|
1607
|
+
}, _callee22, this);
|
|
1559
1608
|
}));
|
|
1560
1609
|
function getProductByIds(_x14, _x15) {
|
|
1561
1610
|
return _getProductByIds.apply(this, arguments);
|
|
@@ -1571,25 +1620,25 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1571
1620
|
}, {
|
|
1572
1621
|
key: "getScheduleTimePoints",
|
|
1573
1622
|
value: (function () {
|
|
1574
|
-
var _getScheduleTimePoints = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1623
|
+
var _getScheduleTimePoints = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(params) {
|
|
1575
1624
|
var result;
|
|
1576
|
-
return _regeneratorRuntime().wrap(function
|
|
1577
|
-
while (1) switch (
|
|
1625
|
+
return _regeneratorRuntime().wrap(function _callee23$(_context23) {
|
|
1626
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
1578
1627
|
case 0:
|
|
1579
|
-
|
|
1628
|
+
_context23.next = 2;
|
|
1580
1629
|
return this.request.post('/menu/schedule-time-points', {
|
|
1581
1630
|
menu_list_ids: params.menu_list_ids
|
|
1582
1631
|
}, {
|
|
1583
1632
|
osServer: true
|
|
1584
1633
|
});
|
|
1585
1634
|
case 2:
|
|
1586
|
-
result =
|
|
1587
|
-
return
|
|
1635
|
+
result = _context23.sent;
|
|
1636
|
+
return _context23.abrupt("return", result.data || []);
|
|
1588
1637
|
case 4:
|
|
1589
1638
|
case "end":
|
|
1590
|
-
return
|
|
1639
|
+
return _context23.stop();
|
|
1591
1640
|
}
|
|
1592
|
-
},
|
|
1641
|
+
}, _callee23, this);
|
|
1593
1642
|
}));
|
|
1594
1643
|
function getScheduleTimePoints(_x16) {
|
|
1595
1644
|
return _getScheduleTimePoints.apply(this, arguments);
|
|
@@ -1605,30 +1654,30 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1605
1654
|
}, {
|
|
1606
1655
|
key: "getCustomerList",
|
|
1607
1656
|
value: (function () {
|
|
1608
|
-
var _getCustomerList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1657
|
+
var _getCustomerList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
|
|
1609
1658
|
var params,
|
|
1610
1659
|
_result3,
|
|
1611
|
-
|
|
1612
|
-
return _regeneratorRuntime().wrap(function
|
|
1613
|
-
while (1) switch (
|
|
1660
|
+
_args24 = arguments;
|
|
1661
|
+
return _regeneratorRuntime().wrap(function _callee24$(_context24) {
|
|
1662
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
1614
1663
|
case 0:
|
|
1615
|
-
params =
|
|
1616
|
-
|
|
1617
|
-
|
|
1664
|
+
params = _args24.length > 0 && _args24[0] !== undefined ? _args24[0] : {};
|
|
1665
|
+
_context24.prev = 1;
|
|
1666
|
+
_context24.next = 4;
|
|
1618
1667
|
return this.store.customer.getCustomerList(params);
|
|
1619
1668
|
case 4:
|
|
1620
|
-
_result3 =
|
|
1621
|
-
return
|
|
1669
|
+
_result3 = _context24.sent;
|
|
1670
|
+
return _context24.abrupt("return", _result3);
|
|
1622
1671
|
case 8:
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
console.error('Failed to get customer list:',
|
|
1626
|
-
throw
|
|
1672
|
+
_context24.prev = 8;
|
|
1673
|
+
_context24.t0 = _context24["catch"](1);
|
|
1674
|
+
console.error('Failed to get customer list:', _context24.t0);
|
|
1675
|
+
throw _context24.t0;
|
|
1627
1676
|
case 12:
|
|
1628
1677
|
case "end":
|
|
1629
|
-
return
|
|
1678
|
+
return _context24.stop();
|
|
1630
1679
|
}
|
|
1631
|
-
},
|
|
1680
|
+
}, _callee24, this, [[1, 8]]);
|
|
1632
1681
|
}));
|
|
1633
1682
|
function getCustomerList() {
|
|
1634
1683
|
return _getCustomerList.apply(this, arguments);
|
|
@@ -1848,24 +1897,24 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1848
1897
|
}, {
|
|
1849
1898
|
key: "restoreOrder",
|
|
1850
1899
|
value: (function () {
|
|
1851
|
-
var _restoreOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1900
|
+
var _restoreOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
|
|
1852
1901
|
var _this$store$customer;
|
|
1853
1902
|
var tempOrder;
|
|
1854
|
-
return _regeneratorRuntime().wrap(function
|
|
1855
|
-
while (1) switch (
|
|
1903
|
+
return _regeneratorRuntime().wrap(function _callee25$(_context25) {
|
|
1904
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
1856
1905
|
case 0:
|
|
1857
|
-
|
|
1906
|
+
_context25.next = 2;
|
|
1858
1907
|
return _get(_getPrototypeOf(BookingTicketImpl.prototype), "restoreOrder", this).call(this);
|
|
1859
1908
|
case 2:
|
|
1860
|
-
tempOrder =
|
|
1909
|
+
tempOrder = _context25.sent;
|
|
1861
1910
|
this.clearOrderCustomer();
|
|
1862
1911
|
(_this$store$customer = this.store.customer) === null || _this$store$customer === void 0 || _this$store$customer.setSelectedCustomer(null);
|
|
1863
|
-
return
|
|
1912
|
+
return _context25.abrupt("return", tempOrder);
|
|
1864
1913
|
case 6:
|
|
1865
1914
|
case "end":
|
|
1866
|
-
return
|
|
1915
|
+
return _context25.stop();
|
|
1867
1916
|
}
|
|
1868
|
-
},
|
|
1917
|
+
}, _callee25, this);
|
|
1869
1918
|
}));
|
|
1870
1919
|
function restoreOrder() {
|
|
1871
1920
|
return _restoreOrder.apply(this, arguments);
|
|
@@ -1900,27 +1949,27 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1900
1949
|
return this.orderCustomerDiscountRefreshInFlight;
|
|
1901
1950
|
}
|
|
1902
1951
|
var previousRefresh = this.orderCustomerDiscountRefreshInFlight;
|
|
1903
|
-
var refreshTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1952
|
+
var refreshTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26() {
|
|
1904
1953
|
var _this5$store$order$ge, _this5$store$order, _this5$getOrderIdenti;
|
|
1905
1954
|
var currentCustomer, currentTempOrder, currentOrderIdentity, currentOrderId, currentAction, currentOrderTarget;
|
|
1906
|
-
return _regeneratorRuntime().wrap(function
|
|
1907
|
-
while (1) switch (
|
|
1955
|
+
return _regeneratorRuntime().wrap(function _callee26$(_context26) {
|
|
1956
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
1908
1957
|
case 0:
|
|
1909
1958
|
if (!previousRefresh) {
|
|
1910
|
-
|
|
1959
|
+
_context26.next = 3;
|
|
1911
1960
|
break;
|
|
1912
1961
|
}
|
|
1913
|
-
|
|
1962
|
+
_context26.next = 3;
|
|
1914
1963
|
return previousRefresh.catch(function () {
|
|
1915
1964
|
return undefined;
|
|
1916
1965
|
});
|
|
1917
1966
|
case 3:
|
|
1918
1967
|
currentCustomer = _this5.store.order.getOrderCustomer();
|
|
1919
1968
|
if (!(!currentCustomer || Number(currentCustomer.customer_id) !== customerId)) {
|
|
1920
|
-
|
|
1969
|
+
_context26.next = 6;
|
|
1921
1970
|
break;
|
|
1922
1971
|
}
|
|
1923
|
-
return
|
|
1972
|
+
return _context26.abrupt("return");
|
|
1924
1973
|
case 6:
|
|
1925
1974
|
currentTempOrder = (_this5$store$order$ge = (_this5$store$order = _this5.store.order).getTempOrder) === null || _this5$store$order$ge === void 0 ? void 0 : _this5$store$order$ge.call(_this5$store$order);
|
|
1926
1975
|
currentOrderIdentity = (_this5$getOrderIdenti = _this5.getOrderIdentity) === null || _this5$getOrderIdenti === void 0 ? void 0 : _this5$getOrderIdenti.call(_this5);
|
|
@@ -1928,12 +1977,12 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1928
1977
|
currentAction = !currentOrderId || String(currentOrderId).startsWith('local_order') ? 'create' : 'edit';
|
|
1929
1978
|
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'));
|
|
1930
1979
|
if (!("".concat(customerId, ":").concat(currentAction, ":").concat(currentOrderTarget) !== refreshTarget)) {
|
|
1931
|
-
|
|
1980
|
+
_context26.next = 13;
|
|
1932
1981
|
break;
|
|
1933
1982
|
}
|
|
1934
|
-
return
|
|
1983
|
+
return _context26.abrupt("return");
|
|
1935
1984
|
case 13:
|
|
1936
|
-
|
|
1985
|
+
_context26.next = 15;
|
|
1937
1986
|
return _this5.loadDiscountConfig({
|
|
1938
1987
|
customerId: customerId,
|
|
1939
1988
|
action: action,
|
|
@@ -1941,9 +1990,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1941
1990
|
});
|
|
1942
1991
|
case 15:
|
|
1943
1992
|
case "end":
|
|
1944
|
-
return
|
|
1993
|
+
return _context26.stop();
|
|
1945
1994
|
}
|
|
1946
|
-
},
|
|
1995
|
+
}, _callee26);
|
|
1947
1996
|
}))();
|
|
1948
1997
|
this.orderCustomerDiscountRefreshInFlight = refreshTask;
|
|
1949
1998
|
this.orderCustomerDiscountRefreshCustomerId = customerId;
|
|
@@ -1966,28 +2015,28 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1966
2015
|
}, {
|
|
1967
2016
|
key: "prepareProductPriceQueryContext",
|
|
1968
2017
|
value: function () {
|
|
1969
|
-
var _prepareProductPriceQueryContext = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2018
|
+
var _prepareProductPriceQueryContext = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(customerId) {
|
|
1970
2019
|
var normalizedCustomerId, refreshTask, shouldWait;
|
|
1971
|
-
return _regeneratorRuntime().wrap(function
|
|
1972
|
-
while (1) switch (
|
|
2020
|
+
return _regeneratorRuntime().wrap(function _callee27$(_context27) {
|
|
2021
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
1973
2022
|
case 0:
|
|
1974
|
-
|
|
2023
|
+
_context27.next = 2;
|
|
1975
2024
|
return Promise.resolve();
|
|
1976
2025
|
case 2:
|
|
1977
2026
|
normalizedCustomerId = Number(customerId || 0);
|
|
1978
2027
|
refreshTask = this.orderCustomerDiscountRefreshInFlight;
|
|
1979
2028
|
shouldWait = normalizedCustomerId > 1 && this.orderCustomerDiscountRefreshCustomerId === normalizedCustomerId && Boolean(refreshTask);
|
|
1980
2029
|
if (!(shouldWait && refreshTask)) {
|
|
1981
|
-
|
|
2030
|
+
_context27.next = 8;
|
|
1982
2031
|
break;
|
|
1983
2032
|
}
|
|
1984
|
-
|
|
2033
|
+
_context27.next = 8;
|
|
1985
2034
|
return refreshTask;
|
|
1986
2035
|
case 8:
|
|
1987
2036
|
case "end":
|
|
1988
|
-
return
|
|
2037
|
+
return _context27.stop();
|
|
1989
2038
|
}
|
|
1990
|
-
},
|
|
2039
|
+
}, _callee27, this);
|
|
1991
2040
|
}));
|
|
1992
2041
|
function prepareProductPriceQueryContext(_x17) {
|
|
1993
2042
|
return _prepareProductPriceQueryContext.apply(this, arguments);
|
|
@@ -2042,27 +2091,27 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2042
2091
|
}, {
|
|
2043
2092
|
key: "changeCustomerPage",
|
|
2044
2093
|
value: (function () {
|
|
2045
|
-
var _changeCustomerPage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2094
|
+
var _changeCustomerPage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(page, pageSize) {
|
|
2046
2095
|
var _result4;
|
|
2047
|
-
return _regeneratorRuntime().wrap(function
|
|
2048
|
-
while (1) switch (
|
|
2096
|
+
return _regeneratorRuntime().wrap(function _callee28$(_context28) {
|
|
2097
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
2049
2098
|
case 0:
|
|
2050
|
-
|
|
2051
|
-
|
|
2099
|
+
_context28.prev = 0;
|
|
2100
|
+
_context28.next = 3;
|
|
2052
2101
|
return this.store.customer.changeCustomerPage(page, pageSize);
|
|
2053
2102
|
case 3:
|
|
2054
|
-
_result4 =
|
|
2055
|
-
return
|
|
2103
|
+
_result4 = _context28.sent;
|
|
2104
|
+
return _context28.abrupt("return", _result4);
|
|
2056
2105
|
case 7:
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
console.error('Failed to change customer page:',
|
|
2060
|
-
throw
|
|
2106
|
+
_context28.prev = 7;
|
|
2107
|
+
_context28.t0 = _context28["catch"](0);
|
|
2108
|
+
console.error('Failed to change customer page:', _context28.t0);
|
|
2109
|
+
throw _context28.t0;
|
|
2061
2110
|
case 11:
|
|
2062
2111
|
case "end":
|
|
2063
|
-
return
|
|
2112
|
+
return _context28.stop();
|
|
2064
2113
|
}
|
|
2065
|
-
},
|
|
2114
|
+
}, _callee28, this, [[0, 7]]);
|
|
2066
2115
|
}));
|
|
2067
2116
|
function changeCustomerPage(_x18, _x19) {
|
|
2068
2117
|
return _changeCustomerPage.apply(this, arguments);
|
|
@@ -2077,28 +2126,28 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2077
2126
|
}, {
|
|
2078
2127
|
key: "loadMoreCustomers",
|
|
2079
2128
|
value: (function () {
|
|
2080
|
-
var _loadMoreCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2129
|
+
var _loadMoreCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29() {
|
|
2081
2130
|
var _result5;
|
|
2082
|
-
return _regeneratorRuntime().wrap(function
|
|
2083
|
-
while (1) switch (
|
|
2131
|
+
return _regeneratorRuntime().wrap(function _callee29$(_context29) {
|
|
2132
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
2084
2133
|
case 0:
|
|
2085
|
-
|
|
2086
|
-
|
|
2134
|
+
_context29.prev = 0;
|
|
2135
|
+
_context29.next = 3;
|
|
2087
2136
|
return this.store.customer.loadMoreCustomers();
|
|
2088
2137
|
case 3:
|
|
2089
|
-
_result5 =
|
|
2138
|
+
_result5 = _context29.sent;
|
|
2090
2139
|
this.core.effects.emit("".concat(this.name, ":onCustomerListUpdate"), _result5);
|
|
2091
|
-
return
|
|
2140
|
+
return _context29.abrupt("return", _result5);
|
|
2092
2141
|
case 8:
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
console.error('Failed to load more customers:',
|
|
2096
|
-
throw
|
|
2142
|
+
_context29.prev = 8;
|
|
2143
|
+
_context29.t0 = _context29["catch"](0);
|
|
2144
|
+
console.error('Failed to load more customers:', _context29.t0);
|
|
2145
|
+
throw _context29.t0;
|
|
2097
2146
|
case 12:
|
|
2098
2147
|
case "end":
|
|
2099
|
-
return
|
|
2148
|
+
return _context29.stop();
|
|
2100
2149
|
}
|
|
2101
|
-
},
|
|
2150
|
+
}, _callee29, this, [[0, 8]]);
|
|
2102
2151
|
}));
|
|
2103
2152
|
function loadMoreCustomers() {
|
|
2104
2153
|
return _loadMoreCustomers.apply(this, arguments);
|
|
@@ -2114,31 +2163,31 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2114
2163
|
}, {
|
|
2115
2164
|
key: "resetAndLoadCustomers",
|
|
2116
2165
|
value: (function () {
|
|
2117
|
-
var _resetAndLoadCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2166
|
+
var _resetAndLoadCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30() {
|
|
2118
2167
|
var params,
|
|
2119
2168
|
_result6,
|
|
2120
|
-
|
|
2121
|
-
return _regeneratorRuntime().wrap(function
|
|
2122
|
-
while (1) switch (
|
|
2169
|
+
_args30 = arguments;
|
|
2170
|
+
return _regeneratorRuntime().wrap(function _callee30$(_context30) {
|
|
2171
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
2123
2172
|
case 0:
|
|
2124
|
-
params =
|
|
2125
|
-
|
|
2126
|
-
|
|
2173
|
+
params = _args30.length > 0 && _args30[0] !== undefined ? _args30[0] : {};
|
|
2174
|
+
_context30.prev = 1;
|
|
2175
|
+
_context30.next = 4;
|
|
2127
2176
|
return this.store.customer.resetAndLoadCustomers(params);
|
|
2128
2177
|
case 4:
|
|
2129
|
-
_result6 =
|
|
2178
|
+
_result6 = _context30.sent;
|
|
2130
2179
|
this.core.effects.emit("".concat(this.name, ":onCustomerListReset"), _result6);
|
|
2131
|
-
return
|
|
2180
|
+
return _context30.abrupt("return", _result6);
|
|
2132
2181
|
case 9:
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
console.error('Failed to reset and load customers:',
|
|
2136
|
-
throw
|
|
2182
|
+
_context30.prev = 9;
|
|
2183
|
+
_context30.t0 = _context30["catch"](1);
|
|
2184
|
+
console.error('Failed to reset and load customers:', _context30.t0);
|
|
2185
|
+
throw _context30.t0;
|
|
2137
2186
|
case 13:
|
|
2138
2187
|
case "end":
|
|
2139
|
-
return
|
|
2188
|
+
return _context30.stop();
|
|
2140
2189
|
}
|
|
2141
|
-
},
|
|
2190
|
+
}, _callee30, this, [[1, 9]]);
|
|
2142
2191
|
}));
|
|
2143
2192
|
function resetAndLoadCustomers() {
|
|
2144
2193
|
return _resetAndLoadCustomers.apply(this, arguments);
|
|
@@ -2299,16 +2348,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2299
2348
|
}, {
|
|
2300
2349
|
key: "getOtherParams",
|
|
2301
2350
|
value: (function () {
|
|
2302
|
-
var _getOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2303
|
-
return _regeneratorRuntime().wrap(function
|
|
2304
|
-
while (1) switch (
|
|
2351
|
+
var _getOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31() {
|
|
2352
|
+
return _regeneratorRuntime().wrap(function _callee31$(_context31) {
|
|
2353
|
+
while (1) switch (_context31.prev = _context31.next) {
|
|
2305
2354
|
case 0:
|
|
2306
|
-
return
|
|
2355
|
+
return _context31.abrupt("return", this.otherParams);
|
|
2307
2356
|
case 1:
|
|
2308
2357
|
case "end":
|
|
2309
|
-
return
|
|
2358
|
+
return _context31.stop();
|
|
2310
2359
|
}
|
|
2311
|
-
},
|
|
2360
|
+
}, _callee31, this);
|
|
2312
2361
|
}));
|
|
2313
2362
|
function getOtherParams() {
|
|
2314
2363
|
return _getOtherParams.apply(this, arguments);
|
|
@@ -2629,16 +2678,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2629
2678
|
}, {
|
|
2630
2679
|
key: "updateProductInOrder",
|
|
2631
2680
|
value: (function () {
|
|
2632
|
-
var _updateProductInOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2633
|
-
return _regeneratorRuntime().wrap(function
|
|
2634
|
-
while (1) switch (
|
|
2681
|
+
var _updateProductInOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(params) {
|
|
2682
|
+
return _regeneratorRuntime().wrap(function _callee32$(_context32) {
|
|
2683
|
+
while (1) switch (_context32.prev = _context32.next) {
|
|
2635
2684
|
case 0:
|
|
2636
|
-
return
|
|
2685
|
+
return _context32.abrupt("return", this.updateOrderProduct(params));
|
|
2637
2686
|
case 1:
|
|
2638
2687
|
case "end":
|
|
2639
|
-
return
|
|
2688
|
+
return _context32.stop();
|
|
2640
2689
|
}
|
|
2641
|
-
},
|
|
2690
|
+
}, _callee32, this);
|
|
2642
2691
|
}));
|
|
2643
2692
|
function updateProductInOrder(_x20) {
|
|
2644
2693
|
return _updateProductInOrder.apply(this, arguments);
|
|
@@ -2662,50 +2711,76 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2662
2711
|
}, {
|
|
2663
2712
|
key: "handleGlobalScanCode",
|
|
2664
2713
|
value: (function () {
|
|
2665
|
-
var _handleGlobalScanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2714
|
+
var _handleGlobalScanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(code, bridge) {
|
|
2666
2715
|
var _this7 = this;
|
|
2667
|
-
var trimmed, _bridge$onNotify, _bridge$refresh, localSearch, scanCallback, raw, formatted, _bridge$onNotify2, _result7, _bridge$onNotify3;
|
|
2668
|
-
return _regeneratorRuntime().wrap(function
|
|
2669
|
-
while (1) switch (
|
|
2716
|
+
var trimmed, _bridge$onNotify, _bridge$refresh, beforeScanCommit, beforeScanDialog, guardCallback, guardedBridge, localSearch, scanCallback, raw, formatted, _bridge$onNotify2, _result7, _bridge$onNotify3;
|
|
2717
|
+
return _regeneratorRuntime().wrap(function _callee33$(_context33) {
|
|
2718
|
+
while (1) switch (_context33.prev = _context33.next) {
|
|
2670
2719
|
case 0:
|
|
2671
2720
|
trimmed = typeof code === 'string' ? code.trim() : '';
|
|
2672
2721
|
if (trimmed) {
|
|
2673
|
-
|
|
2722
|
+
_context33.next = 4;
|
|
2674
2723
|
break;
|
|
2675
2724
|
}
|
|
2676
2725
|
bridge === null || bridge === void 0 || (_bridge$onNotify = bridge.onNotify) === null || _bridge$onNotify === void 0 || _bridge$onNotify.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
|
|
2677
|
-
return
|
|
2726
|
+
return _context33.abrupt("return", {
|
|
2678
2727
|
status: 'failed',
|
|
2679
2728
|
reason: 'empty_code'
|
|
2680
2729
|
});
|
|
2681
2730
|
case 4:
|
|
2682
|
-
|
|
2731
|
+
_context33.prev = 4;
|
|
2732
|
+
// Capture before lookup/UI awaits, so a result cannot land in a new cart.
|
|
2733
|
+
// Unscoped POS Order modules return a no-op guard.
|
|
2734
|
+
beforeScanCommit = this.store.order.createCartIntentCommitGuard('add_product');
|
|
2735
|
+
beforeScanDialog = this.store.order.createCartIntentCommitGuard('add_product');
|
|
2736
|
+
guardCallback = function guardCallback(callback) {
|
|
2737
|
+
return callback ? function () {
|
|
2738
|
+
beforeScanCommit();
|
|
2739
|
+
return callback.apply(void 0, arguments);
|
|
2740
|
+
} : undefined;
|
|
2741
|
+
};
|
|
2742
|
+
guardedBridge = bridge ? _objectSpread(_objectSpread({}, bridge), {}, {
|
|
2743
|
+
confirmDetail: guardCallback(bridge.confirmDetail),
|
|
2744
|
+
confirmBookingEdit: guardCallback(bridge.confirmBookingEdit),
|
|
2745
|
+
applyPromotionCode: guardCallback(bridge.applyPromotionCode),
|
|
2746
|
+
openOrder: guardCallback(bridge.openOrder),
|
|
2747
|
+
requestCustomerSwitch: guardCallback(bridge.requestCustomerSwitch),
|
|
2748
|
+
openProductDetail: bridge.openProductDetail ? function (payload) {
|
|
2749
|
+
beforeScanDialog();
|
|
2750
|
+
return bridge.openProductDetail(payload);
|
|
2751
|
+
} : undefined,
|
|
2752
|
+
openBookingEdit: bridge.openBookingEdit ? function (payload) {
|
|
2753
|
+
beforeScanDialog();
|
|
2754
|
+
return bridge.openBookingEdit(payload);
|
|
2755
|
+
} : undefined
|
|
2756
|
+
}) : undefined;
|
|
2683
2757
|
localSearch = function localSearch(v) {
|
|
2684
2758
|
return _this7.store.products.findProductsByCodeOrBarcode(v);
|
|
2685
2759
|
};
|
|
2686
2760
|
scanCallback = handleGlobalScan(this.request, localSearch, this.getSubmitOrderSalesChannel());
|
|
2687
|
-
|
|
2761
|
+
_context33.next = 13;
|
|
2688
2762
|
return scanCallback({
|
|
2689
2763
|
type: 'nativeScanner',
|
|
2690
2764
|
value: trimmed
|
|
2691
2765
|
});
|
|
2692
|
-
case
|
|
2693
|
-
raw =
|
|
2766
|
+
case 13:
|
|
2767
|
+
raw = _context33.sent;
|
|
2694
2768
|
formatted = formatGlobalScanResult(raw, trimmed);
|
|
2695
2769
|
if (formatted) {
|
|
2696
|
-
|
|
2770
|
+
_context33.next = 18;
|
|
2697
2771
|
break;
|
|
2698
2772
|
}
|
|
2699
2773
|
bridge === null || bridge === void 0 || (_bridge$onNotify2 = bridge.onNotify) === null || _bridge$onNotify2 === void 0 || _bridge$onNotify2.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
|
|
2700
|
-
return
|
|
2774
|
+
return _context33.abrupt("return", {
|
|
2701
2775
|
status: 'failed',
|
|
2702
2776
|
reason: 'not_found'
|
|
2703
2777
|
});
|
|
2704
|
-
case
|
|
2705
|
-
|
|
2778
|
+
case 18:
|
|
2779
|
+
_context33.next = 20;
|
|
2706
2780
|
return applyGlobalScan({
|
|
2707
2781
|
setOrderCustomer: function setOrderCustomer(customer) {
|
|
2708
|
-
|
|
2782
|
+
beforeScanCommit();
|
|
2783
|
+
_this7.setOrderCustomer(customer);
|
|
2709
2784
|
},
|
|
2710
2785
|
getOrderCustomerSnapshot: function getOrderCustomerSnapshot() {
|
|
2711
2786
|
return _this7.getOrderCustomerSnapshot();
|
|
@@ -2730,33 +2805,35 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2730
2805
|
return _this7.transformDetailToProductAndBooking(input);
|
|
2731
2806
|
},
|
|
2732
2807
|
addProductToOrder: function addProductToOrder(product, booking) {
|
|
2808
|
+
beforeScanCommit();
|
|
2733
2809
|
return _this7.addProductToOrder(product, booking);
|
|
2734
2810
|
},
|
|
2735
2811
|
refreshWalletAssets: function refreshWalletAssets(params) {
|
|
2736
2812
|
return _this7.refreshWalletAssets(params);
|
|
2737
2813
|
},
|
|
2738
2814
|
scanWalletAsset: function scanWalletAsset(scanCode) {
|
|
2815
|
+
beforeScanCommit();
|
|
2739
2816
|
return _this7.scanWalletAsset(scanCode);
|
|
2740
2817
|
}
|
|
2741
|
-
}, formatted,
|
|
2742
|
-
case
|
|
2743
|
-
_result7 =
|
|
2818
|
+
}, formatted, guardedBridge);
|
|
2819
|
+
case 20:
|
|
2820
|
+
_result7 = _context33.sent;
|
|
2744
2821
|
bridge === null || bridge === void 0 || (_bridge$refresh = bridge.refresh) === null || _bridge$refresh === void 0 || _bridge$refresh.call(bridge);
|
|
2745
|
-
return
|
|
2746
|
-
case
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
console.error('[BookingTicket] handleGlobalScanCode failed',
|
|
2822
|
+
return _context33.abrupt("return", _result7);
|
|
2823
|
+
case 25:
|
|
2824
|
+
_context33.prev = 25;
|
|
2825
|
+
_context33.t0 = _context33["catch"](4);
|
|
2826
|
+
console.error('[BookingTicket] handleGlobalScanCode failed', _context33.t0);
|
|
2750
2827
|
bridge === null || bridge === void 0 || (_bridge$onNotify3 = bridge.onNotify) === null || _bridge$onNotify3 === void 0 || _bridge$onNotify3.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
|
|
2751
|
-
return
|
|
2828
|
+
return _context33.abrupt("return", {
|
|
2752
2829
|
status: 'failed',
|
|
2753
2830
|
reason: 'not_found'
|
|
2754
2831
|
});
|
|
2755
|
-
case
|
|
2832
|
+
case 30:
|
|
2756
2833
|
case "end":
|
|
2757
|
-
return
|
|
2834
|
+
return _context33.stop();
|
|
2758
2835
|
}
|
|
2759
|
-
},
|
|
2836
|
+
}, _callee33, this, [[4, 25]]);
|
|
2760
2837
|
}));
|
|
2761
2838
|
function handleGlobalScanCode(_x21, _x22) {
|
|
2762
2839
|
return _handleGlobalScanCode.apply(this, arguments);
|
|
@@ -2766,37 +2843,37 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2766
2843
|
}, {
|
|
2767
2844
|
key: "getGlobalScanCodeType",
|
|
2768
2845
|
value: (function () {
|
|
2769
|
-
var _getGlobalScanCodeType = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2846
|
+
var _getGlobalScanCodeType = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(code) {
|
|
2770
2847
|
var _this8 = this,
|
|
2771
2848
|
_formatGlobalScanResu,
|
|
2772
2849
|
_formatGlobalScanResu2;
|
|
2773
2850
|
var trimmed, scan, raw;
|
|
2774
|
-
return _regeneratorRuntime().wrap(function
|
|
2775
|
-
while (1) switch (
|
|
2851
|
+
return _regeneratorRuntime().wrap(function _callee34$(_context34) {
|
|
2852
|
+
while (1) switch (_context34.prev = _context34.next) {
|
|
2776
2853
|
case 0:
|
|
2777
2854
|
trimmed = typeof code === 'string' ? code.trim() : '';
|
|
2778
2855
|
if (trimmed) {
|
|
2779
|
-
|
|
2856
|
+
_context34.next = 3;
|
|
2780
2857
|
break;
|
|
2781
2858
|
}
|
|
2782
|
-
return
|
|
2859
|
+
return _context34.abrupt("return", null);
|
|
2783
2860
|
case 3:
|
|
2784
2861
|
scan = handleGlobalScan(this.request, function (value) {
|
|
2785
2862
|
return _this8.store.products.findProductsByCodeOrBarcode(value);
|
|
2786
2863
|
}, this.getSubmitOrderSalesChannel());
|
|
2787
|
-
|
|
2864
|
+
_context34.next = 6;
|
|
2788
2865
|
return scan({
|
|
2789
2866
|
type: 'nativeScanner',
|
|
2790
2867
|
value: trimmed
|
|
2791
2868
|
});
|
|
2792
2869
|
case 6:
|
|
2793
|
-
raw =
|
|
2794
|
-
return
|
|
2870
|
+
raw = _context34.sent;
|
|
2871
|
+
return _context34.abrupt("return", (_formatGlobalScanResu = (_formatGlobalScanResu2 = formatGlobalScanResult(raw, trimmed)) === null || _formatGlobalScanResu2 === void 0 ? void 0 : _formatGlobalScanResu2.searchType) !== null && _formatGlobalScanResu !== void 0 ? _formatGlobalScanResu : null);
|
|
2795
2872
|
case 8:
|
|
2796
2873
|
case "end":
|
|
2797
|
-
return
|
|
2874
|
+
return _context34.stop();
|
|
2798
2875
|
}
|
|
2799
|
-
},
|
|
2876
|
+
}, _callee34, this);
|
|
2800
2877
|
}));
|
|
2801
2878
|
function getGlobalScanCodeType(_x23) {
|
|
2802
2879
|
return _getGlobalScanCodeType.apply(this, arguments);
|
|
@@ -2880,11 +2957,11 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2880
2957
|
}, {
|
|
2881
2958
|
key: "addAddTimeProductToBooking",
|
|
2882
2959
|
value: (function () {
|
|
2883
|
-
var _addAddTimeProductToBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2884
|
-
return _regeneratorRuntime().wrap(function
|
|
2885
|
-
while (1) switch (
|
|
2960
|
+
var _addAddTimeProductToBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35(input) {
|
|
2961
|
+
return _regeneratorRuntime().wrap(function _callee35$(_context35) {
|
|
2962
|
+
while (1) switch (_context35.prev = _context35.next) {
|
|
2886
2963
|
case 0:
|
|
2887
|
-
return
|
|
2964
|
+
return _context35.abrupt("return", this.addAddTimeProductsToBooking({
|
|
2888
2965
|
booking: input.booking,
|
|
2889
2966
|
products: [input],
|
|
2890
2967
|
coveredMinutes: input.coveredMinutes,
|
|
@@ -2892,9 +2969,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2892
2969
|
}));
|
|
2893
2970
|
case 1:
|
|
2894
2971
|
case "end":
|
|
2895
|
-
return
|
|
2972
|
+
return _context35.stop();
|
|
2896
2973
|
}
|
|
2897
|
-
},
|
|
2974
|
+
}, _callee35, this);
|
|
2898
2975
|
}));
|
|
2899
2976
|
function addAddTimeProductToBooking(_x24) {
|
|
2900
2977
|
return _addAddTimeProductToBooking.apply(this, arguments);
|
|
@@ -2914,16 +2991,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2914
2991
|
}, {
|
|
2915
2992
|
key: "addAddTimeProductsToBooking",
|
|
2916
2993
|
value: (function () {
|
|
2917
|
-
var _addAddTimeProductsToBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2994
|
+
var _addAddTimeProductsToBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(input) {
|
|
2918
2995
|
var _this9 = this,
|
|
2919
2996
|
_input$bookingPatch;
|
|
2920
2997
|
var bookingUid, orderLines, coveredMinutes, bookingTimePatch, result, _iterator2, _step2, line;
|
|
2921
|
-
return _regeneratorRuntime().wrap(function
|
|
2922
|
-
while (1) switch (
|
|
2998
|
+
return _regeneratorRuntime().wrap(function _callee36$(_context36) {
|
|
2999
|
+
while (1) switch (_context36.prev = _context36.next) {
|
|
2923
3000
|
case 0:
|
|
2924
3001
|
bookingUid = resolveBookingUidForAddTime(input === null || input === void 0 ? void 0 : input.booking);
|
|
2925
3002
|
if (bookingUid) {
|
|
2926
|
-
|
|
3003
|
+
_context36.next = 3;
|
|
2927
3004
|
break;
|
|
2928
3005
|
}
|
|
2929
3006
|
throw new Error('[BookingTicket] addAddTimeProductToBooking: booking.metadata.unique_identification_number 缺失');
|
|
@@ -2934,7 +3011,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2934
3011
|
};
|
|
2935
3012
|
});
|
|
2936
3013
|
if (this.store.order) {
|
|
2937
|
-
|
|
3014
|
+
_context36.next = 6;
|
|
2938
3015
|
break;
|
|
2939
3016
|
}
|
|
2940
3017
|
throw new Error('order 模块未初始化');
|
|
@@ -2948,53 +3025,53 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2948
3025
|
});
|
|
2949
3026
|
}
|
|
2950
3027
|
if (!(typeof this.store.order.addProductsToOrder === 'function')) {
|
|
2951
|
-
|
|
3028
|
+
_context36.next = 11;
|
|
2952
3029
|
break;
|
|
2953
3030
|
}
|
|
2954
|
-
return
|
|
3031
|
+
return _context36.abrupt("return", this.store.order.addProductsToOrder(orderLines));
|
|
2955
3032
|
case 11:
|
|
2956
3033
|
result = [];
|
|
2957
3034
|
_iterator2 = _createForOfIteratorHelper(orderLines);
|
|
2958
|
-
|
|
3035
|
+
_context36.prev = 13;
|
|
2959
3036
|
_iterator2.s();
|
|
2960
3037
|
case 15:
|
|
2961
3038
|
if ((_step2 = _iterator2.n()).done) {
|
|
2962
|
-
|
|
3039
|
+
_context36.next = 29;
|
|
2963
3040
|
break;
|
|
2964
3041
|
}
|
|
2965
3042
|
line = _step2.value;
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
3043
|
+
_context36.t0 = result.splice;
|
|
3044
|
+
_context36.t1 = result;
|
|
3045
|
+
_context36.t2 = [0, result.length];
|
|
3046
|
+
_context36.t3 = _toConsumableArray;
|
|
3047
|
+
_context36.next = 23;
|
|
2971
3048
|
return this.addProductToOrder(line.product);
|
|
2972
3049
|
case 23:
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
3050
|
+
_context36.t4 = _context36.sent;
|
|
3051
|
+
_context36.t5 = (0, _context36.t3)(_context36.t4);
|
|
3052
|
+
_context36.t6 = _context36.t2.concat.call(_context36.t2, _context36.t5);
|
|
3053
|
+
_context36.t0.apply.call(_context36.t0, _context36.t1, _context36.t6);
|
|
2977
3054
|
case 27:
|
|
2978
|
-
|
|
3055
|
+
_context36.next = 15;
|
|
2979
3056
|
break;
|
|
2980
3057
|
case 29:
|
|
2981
|
-
|
|
3058
|
+
_context36.next = 34;
|
|
2982
3059
|
break;
|
|
2983
3060
|
case 31:
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
_iterator2.e(
|
|
3061
|
+
_context36.prev = 31;
|
|
3062
|
+
_context36.t7 = _context36["catch"](13);
|
|
3063
|
+
_iterator2.e(_context36.t7);
|
|
2987
3064
|
case 34:
|
|
2988
|
-
|
|
3065
|
+
_context36.prev = 34;
|
|
2989
3066
|
_iterator2.f();
|
|
2990
|
-
return
|
|
3067
|
+
return _context36.finish(34);
|
|
2991
3068
|
case 37:
|
|
2992
|
-
return
|
|
3069
|
+
return _context36.abrupt("return", result);
|
|
2993
3070
|
case 38:
|
|
2994
3071
|
case "end":
|
|
2995
|
-
return
|
|
3072
|
+
return _context36.stop();
|
|
2996
3073
|
}
|
|
2997
|
-
},
|
|
3074
|
+
}, _callee36, this, [[13, 31, 34, 37]]);
|
|
2998
3075
|
}));
|
|
2999
3076
|
function addAddTimeProductsToBooking(_x25) {
|
|
3000
3077
|
return _addAddTimeProductsToBooking.apply(this, arguments);
|
|
@@ -3004,40 +3081,40 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3004
3081
|
}, {
|
|
3005
3082
|
key: "setOtherParams",
|
|
3006
3083
|
value: function () {
|
|
3007
|
-
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3084
|
+
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(params) {
|
|
3008
3085
|
var _ref19,
|
|
3009
3086
|
_ref19$cover,
|
|
3010
3087
|
cover,
|
|
3011
3088
|
invoiceContextChanged,
|
|
3012
|
-
|
|
3013
|
-
return _regeneratorRuntime().wrap(function
|
|
3014
|
-
while (1) switch (
|
|
3089
|
+
_args37 = arguments;
|
|
3090
|
+
return _regeneratorRuntime().wrap(function _callee37$(_context37) {
|
|
3091
|
+
while (1) switch (_context37.prev = _context37.next) {
|
|
3015
3092
|
case 0:
|
|
3016
|
-
_ref19 =
|
|
3017
|
-
|
|
3093
|
+
_ref19 = _args37.length > 1 && _args37[1] !== undefined ? _args37[1] : {}, _ref19$cover = _ref19.cover, cover = _ref19$cover === void 0 ? false : _ref19$cover;
|
|
3094
|
+
_context37.next = 3;
|
|
3018
3095
|
return _get(_getPrototypeOf(BookingTicketImpl.prototype), "setOtherParams", this).call(this, params, {
|
|
3019
3096
|
cover: cover
|
|
3020
3097
|
});
|
|
3021
3098
|
case 3:
|
|
3022
3099
|
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');
|
|
3023
3100
|
if (!invoiceContextChanged) {
|
|
3024
|
-
|
|
3101
|
+
_context37.next = 7;
|
|
3025
3102
|
break;
|
|
3026
3103
|
}
|
|
3027
|
-
|
|
3104
|
+
_context37.next = 7;
|
|
3028
3105
|
return this.prepareInvoiceTemplateAtSolutionReady(Object.prototype.hasOwnProperty.call(params, 'openData') ? this.getInjectedOpenDataConfig() : undefined);
|
|
3029
3106
|
case 7:
|
|
3030
3107
|
if (!((params === null || params === void 0 ? void 0 : params.businessCode) !== undefined || (params === null || params === void 0 ? void 0 : params.business_code) !== undefined)) {
|
|
3031
|
-
|
|
3108
|
+
_context37.next = 10;
|
|
3032
3109
|
break;
|
|
3033
3110
|
}
|
|
3034
|
-
|
|
3111
|
+
_context37.next = 10;
|
|
3035
3112
|
return this.configureIdGeneratorFromOpenData();
|
|
3036
3113
|
case 10:
|
|
3037
3114
|
case "end":
|
|
3038
|
-
return
|
|
3115
|
+
return _context37.stop();
|
|
3039
3116
|
}
|
|
3040
|
-
},
|
|
3117
|
+
}, _callee37, this);
|
|
3041
3118
|
}));
|
|
3042
3119
|
function setOtherParams(_x26) {
|
|
3043
3120
|
return _setOtherParams.apply(this, arguments);
|
|
@@ -3056,15 +3133,15 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3056
3133
|
}, {
|
|
3057
3134
|
key: "handlePrintWristband",
|
|
3058
3135
|
value: function () {
|
|
3059
|
-
var _handlePrintWristband = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3136
|
+
var _handlePrintWristband = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38(params) {
|
|
3060
3137
|
var _this$getOrderIdentit2;
|
|
3061
3138
|
var deviceTask, deviceId, idempotencyKey;
|
|
3062
|
-
return _regeneratorRuntime().wrap(function
|
|
3063
|
-
while (1) switch (
|
|
3139
|
+
return _regeneratorRuntime().wrap(function _callee38$(_context38) {
|
|
3140
|
+
while (1) switch (_context38.prev = _context38.next) {
|
|
3064
3141
|
case 0:
|
|
3065
3142
|
deviceTask = this.getDeviceTaskPlugin();
|
|
3066
3143
|
if (deviceTask !== null && deviceTask !== void 0 && deviceTask.dispatch) {
|
|
3067
|
-
|
|
3144
|
+
_context38.next = 4;
|
|
3068
3145
|
break;
|
|
3069
3146
|
}
|
|
3070
3147
|
this.logger.addLog({
|
|
@@ -3074,7 +3151,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3074
3151
|
voucher_ids: Array.isArray(params.voucher_ids) ? params.voucher_ids : [params.voucher_ids]
|
|
3075
3152
|
}
|
|
3076
3153
|
});
|
|
3077
|
-
return
|
|
3154
|
+
return _context38.abrupt("return");
|
|
3078
3155
|
case 4:
|
|
3079
3156
|
this.logger.addLog({
|
|
3080
3157
|
type: 'info',
|
|
@@ -3083,10 +3160,10 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3083
3160
|
voucher_ids: Array.isArray(params.voucher_ids) ? params.voucher_ids : [params.voucher_ids]
|
|
3084
3161
|
}
|
|
3085
3162
|
});
|
|
3086
|
-
|
|
3163
|
+
_context38.next = 7;
|
|
3087
3164
|
return this.getShortNumberOrDeviceId();
|
|
3088
3165
|
case 7:
|
|
3089
|
-
deviceId =
|
|
3166
|
+
deviceId = _context38.sent;
|
|
3090
3167
|
idempotencyKey = createUuidV4();
|
|
3091
3168
|
deviceTask.dispatch({
|
|
3092
3169
|
action: 'print_all',
|
|
@@ -3106,9 +3183,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3106
3183
|
});
|
|
3107
3184
|
case 10:
|
|
3108
3185
|
case "end":
|
|
3109
|
-
return
|
|
3186
|
+
return _context38.stop();
|
|
3110
3187
|
}
|
|
3111
|
-
},
|
|
3188
|
+
}, _callee38, this);
|
|
3112
3189
|
}));
|
|
3113
3190
|
function handlePrintWristband(_x27) {
|
|
3114
3191
|
return _handlePrintWristband.apply(this, arguments);
|
|
@@ -3118,11 +3195,11 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3118
3195
|
}, {
|
|
3119
3196
|
key: "handleRedeem",
|
|
3120
3197
|
value: function () {
|
|
3121
|
-
var _handleRedeem = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3198
|
+
var _handleRedeem = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39(params) {
|
|
3122
3199
|
var _this$store$order7, _this$store$order7$ge, _this$store$order8, _ref20, _tempOrder$order_id2;
|
|
3123
3200
|
var voucherIds, status, voucherIdSet, tempOrder, vouchers, hasUpdatedVoucher, nextVouchers, identity, externalSaleNumber, orderId, orderLookup;
|
|
3124
|
-
return _regeneratorRuntime().wrap(function
|
|
3125
|
-
while (1) switch (
|
|
3201
|
+
return _regeneratorRuntime().wrap(function _callee39$(_context39) {
|
|
3202
|
+
while (1) switch (_context39.prev = _context39.next) {
|
|
3126
3203
|
case 0:
|
|
3127
3204
|
voucherIds = Array.isArray(params.voucher_ids) ? params.voucher_ids : [];
|
|
3128
3205
|
status = params.is_checkin ? 'used' : 'unused';
|
|
@@ -3146,20 +3223,20 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3146
3223
|
});
|
|
3147
3224
|
});
|
|
3148
3225
|
if (!(tempOrder && hasUpdatedVoucher)) {
|
|
3149
|
-
|
|
3226
|
+
_context39.next = 11;
|
|
3150
3227
|
break;
|
|
3151
3228
|
}
|
|
3152
|
-
|
|
3229
|
+
_context39.next = 11;
|
|
3153
3230
|
return this.replaceTempOrder(_objectSpread(_objectSpread({}, tempOrder), {}, {
|
|
3154
3231
|
vouchers: nextVouchers
|
|
3155
3232
|
}));
|
|
3156
3233
|
case 11:
|
|
3157
3234
|
this.core.effects.emit("".concat(this.name, ":onVouchersChange"), {});
|
|
3158
3235
|
if (!(voucherIds.length === 0)) {
|
|
3159
|
-
|
|
3236
|
+
_context39.next = 14;
|
|
3160
3237
|
break;
|
|
3161
3238
|
}
|
|
3162
|
-
return
|
|
3239
|
+
return _context39.abrupt("return", {
|
|
3163
3240
|
code: 200,
|
|
3164
3241
|
status: true,
|
|
3165
3242
|
message: '',
|
|
@@ -3170,7 +3247,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3170
3247
|
externalSaleNumber = (tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.external_sale_number) || (identity === null || identity === void 0 ? void 0 : identity.externalSaleNumber) || undefined;
|
|
3171
3248
|
orderId = (_ref20 = (_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 && _ref20 !== void 0 ? _ref20 : undefined;
|
|
3172
3249
|
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;
|
|
3173
|
-
return
|
|
3250
|
+
return _context39.abrupt("return", this.request.post('/machinecode/batch', {
|
|
3174
3251
|
ids: voucherIds,
|
|
3175
3252
|
status: status,
|
|
3176
3253
|
order_lookup: orderLookup,
|
|
@@ -3181,9 +3258,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3181
3258
|
}));
|
|
3182
3259
|
case 19:
|
|
3183
3260
|
case "end":
|
|
3184
|
-
return
|
|
3261
|
+
return _context39.stop();
|
|
3185
3262
|
}
|
|
3186
|
-
},
|
|
3263
|
+
}, _callee39, this);
|
|
3187
3264
|
}));
|
|
3188
3265
|
function handleRedeem(_x28) {
|
|
3189
3266
|
return _handleRedeem.apply(this, arguments);
|
|
@@ -3197,12 +3274,12 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3197
3274
|
}, {
|
|
3198
3275
|
key: "destroy",
|
|
3199
3276
|
value: (function () {
|
|
3200
|
-
var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3277
|
+
var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40() {
|
|
3201
3278
|
var _this$scan;
|
|
3202
|
-
return _regeneratorRuntime().wrap(function
|
|
3203
|
-
while (1) switch (
|
|
3279
|
+
return _regeneratorRuntime().wrap(function _callee40$(_context40) {
|
|
3280
|
+
while (1) switch (_context40.prev = _context40.next) {
|
|
3204
3281
|
case 0:
|
|
3205
|
-
|
|
3282
|
+
_context40.next = 2;
|
|
3206
3283
|
return _get(_getPrototypeOf(BookingTicketImpl.prototype), "destroy", this).call(this);
|
|
3207
3284
|
case 2:
|
|
3208
3285
|
try {
|
|
@@ -3213,9 +3290,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3213
3290
|
scanCache.clear();
|
|
3214
3291
|
case 4:
|
|
3215
3292
|
case "end":
|
|
3216
|
-
return
|
|
3293
|
+
return _context40.stop();
|
|
3217
3294
|
}
|
|
3218
|
-
},
|
|
3295
|
+
}, _callee40, this);
|
|
3219
3296
|
}));
|
|
3220
3297
|
function destroy() {
|
|
3221
3298
|
return _destroy.apply(this, arguments);
|