@pisell/pisellos 2.2.325 → 2.2.327
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/model/strategy/adapter/promotion/index.js +0 -9
- package/dist/model/strategy/adapter/walletPass/locales.js +9 -0
- package/dist/modules/OpenData/index.d.ts +8 -1
- package/dist/modules/OpenData/index.js +276 -95
- package/dist/modules/Payment/utils.d.ts +2 -0
- package/dist/modules/Payment/utils.js +6 -6
- package/dist/modules/Payment/walletpass.d.ts +2 -0
- package/dist/modules/Payment/walletpass.js +75 -34
- package/dist/server/index.d.ts +3 -0
- package/dist/server/index.js +883 -611
- package/dist/server/modules/order/index.d.ts +1 -0
- package/dist/server/modules/order/index.js +51 -51
- package/dist/server/modules/products/index.d.ts +6 -2
- package/dist/server/modules/products/index.js +476 -400
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.js +6 -5
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +1 -1
- package/dist/solution/Sales/index.d.ts +2 -5
- package/dist/solution/Sales/index.js +117 -143
- package/dist/solution/Sales/types.d.ts +6 -0
- package/dist/solution/Sales/types.js +2 -0
- package/dist/solution/UnifiedBookingSales/index.js +34 -23
- package/lib/model/strategy/adapter/walletPass/locales.js +9 -0
- package/lib/modules/OpenData/index.d.ts +8 -1
- package/lib/modules/OpenData/index.js +123 -21
- package/lib/modules/Payment/utils.d.ts +2 -0
- package/lib/modules/Payment/utils.js +7 -7
- package/lib/modules/Payment/walletpass.d.ts +2 -0
- package/lib/modules/Payment/walletpass.js +42 -11
- package/lib/server/index.d.ts +3 -0
- package/lib/server/index.js +164 -22
- package/lib/server/modules/order/index.d.ts +1 -0
- package/lib/server/modules/order/index.js +4 -3
- package/lib/server/modules/products/index.d.ts +6 -2
- package/lib/server/modules/products/index.js +40 -7
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.js +2 -1
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +1 -1
- package/lib/solution/Sales/index.d.ts +2 -5
- package/lib/solution/Sales/index.js +32 -66
- package/lib/solution/Sales/types.d.ts +6 -0
- package/lib/solution/Sales/types.js +1 -0
- package/lib/solution/UnifiedBookingSales/index.js +3 -2
- package/package.json +1 -1
package/dist/server/index.js
CHANGED
|
@@ -783,7 +783,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
783
783
|
_defineProperty(this, "handleUpdateLocalOrder", /*#__PURE__*/function () {
|
|
784
784
|
var _ref33 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(_ref32) {
|
|
785
785
|
var _data$order_id, _ref34, _this$app;
|
|
786
|
-
var url, data, batchIds, rawOrderId, orderId, backendPath, _response$data, response,
|
|
786
|
+
var url, data, batchIds, rawOrderId, orderId, backendPath, _response$data, response, _fresh, exists, _yield$_this$order$ov, overwritten, errorMessage;
|
|
787
787
|
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
788
788
|
while (1) switch (_context13.prev = _context13.next) {
|
|
789
789
|
case 0:
|
|
@@ -857,8 +857,8 @@ var Server = /*#__PURE__*/function () {
|
|
|
857
857
|
});
|
|
858
858
|
case 22:
|
|
859
859
|
response = _context13.sent;
|
|
860
|
-
|
|
861
|
-
if (!(!
|
|
860
|
+
_fresh = (_response$data = response === null || response === void 0 ? void 0 : response.data) !== null && _response$data !== void 0 ? _response$data : response;
|
|
861
|
+
if (!(!_fresh || _typeof(_fresh) !== 'object' || _fresh.order_id == null)) {
|
|
862
862
|
_context13.next = 27;
|
|
863
863
|
break;
|
|
864
864
|
}
|
|
@@ -879,7 +879,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
879
879
|
break;
|
|
880
880
|
}
|
|
881
881
|
_context13.next = 31;
|
|
882
|
-
return _this.order.overwriteExistingOrder(
|
|
882
|
+
return _this.order.overwriteExistingOrder(_fresh);
|
|
883
883
|
case 31:
|
|
884
884
|
_yield$_this$order$ov = _context13.sent;
|
|
885
885
|
overwritten = _yield$_this$order$ov.overwritten;
|
|
@@ -899,7 +899,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
899
899
|
});
|
|
900
900
|
case 35:
|
|
901
901
|
_context13.next = 37;
|
|
902
|
-
return _this.order.upsertOrdersFromRemote([
|
|
902
|
+
return _this.order.upsertOrdersFromRemote([_fresh]);
|
|
903
903
|
case 37:
|
|
904
904
|
_this.logInfo('handleUpdateLocalOrder: 本地合并新订单完成', {
|
|
905
905
|
orderId: orderId
|
|
@@ -1405,7 +1405,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
1405
1405
|
_defineProperty(this, "handleLocalOrderReceiptSnapshot", /*#__PURE__*/function () {
|
|
1406
1406
|
var _ref52 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(_ref51) {
|
|
1407
1407
|
var _this$order2;
|
|
1408
|
-
var data, input, lookup, _payment_info, sourceOrder, remoteResult,
|
|
1408
|
+
var data, input, lookup, _payment_info, sourceOrder, remoteResult, rebuiltOrder, smallTicketData, message;
|
|
1409
1409
|
return _regeneratorRuntime().wrap(function _callee22$(_context22) {
|
|
1410
1410
|
while (1) switch (_context22.prev = _context22.next) {
|
|
1411
1411
|
case 0:
|
|
@@ -1468,24 +1468,13 @@ var Server = /*#__PURE__*/function () {
|
|
|
1468
1468
|
case 17:
|
|
1469
1469
|
sourceOrder = remoteResult.order;
|
|
1470
1470
|
case 18:
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
return _this.withLocalSmallTicketData(_objectSpread(_objectSpread({}, sourceOrder), {}, {
|
|
1475
|
-
small_ticket_data_flag: 1,
|
|
1476
|
-
payment_info: paymentInfo
|
|
1477
|
-
}), {
|
|
1478
|
-
locales: _this.normalizeRequestedReceiptLocales(input.locales),
|
|
1479
|
-
invoiceTemplateSettings: input.template_settings === undefined ? undefined : _this.normalizePrintInvoiceTemplateSettings(input.template_settings),
|
|
1480
|
-
applyTemplateVisibility: true,
|
|
1481
|
-
includeReceiptKeys: input.template_settings !== undefined,
|
|
1482
|
-
refreshResourceReference: true
|
|
1483
|
-
});
|
|
1484
|
-
case 22:
|
|
1471
|
+
_context22.next = 20;
|
|
1472
|
+
return _this.rebuildOrderReceipt(sourceOrder, input.template_settings === undefined ? undefined : _this.normalizePrintInvoiceTemplateSettings(input.template_settings), _this.normalizeRequestedReceiptLocales(input.locales));
|
|
1473
|
+
case 20:
|
|
1485
1474
|
rebuiltOrder = _context22.sent;
|
|
1486
1475
|
smallTicketData = (_payment_info = rebuiltOrder.payment_info) === null || _payment_info === void 0 ? void 0 : _payment_info.small_ticket_data;
|
|
1487
1476
|
if (hasSmallTicketData(smallTicketData)) {
|
|
1488
|
-
_context22.next =
|
|
1477
|
+
_context22.next = 24;
|
|
1489
1478
|
break;
|
|
1490
1479
|
}
|
|
1491
1480
|
return _context22.abrupt("return", {
|
|
@@ -1496,7 +1485,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
1496
1485
|
small_ticket_data: null
|
|
1497
1486
|
}
|
|
1498
1487
|
});
|
|
1499
|
-
case
|
|
1488
|
+
case 24:
|
|
1500
1489
|
return _context22.abrupt("return", {
|
|
1501
1490
|
code: 200,
|
|
1502
1491
|
status: true,
|
|
@@ -1513,8 +1502,8 @@ var Server = /*#__PURE__*/function () {
|
|
|
1513
1502
|
})
|
|
1514
1503
|
}
|
|
1515
1504
|
});
|
|
1516
|
-
case
|
|
1517
|
-
_context22.prev =
|
|
1505
|
+
case 27:
|
|
1506
|
+
_context22.prev = 27;
|
|
1518
1507
|
_context22.t0 = _context22["catch"](7);
|
|
1519
1508
|
message = _context22.t0 instanceof Error ? _context22.t0.message : String(_context22.t0);
|
|
1520
1509
|
_this.logError('handleLocalOrderReceiptSnapshot: 生成失败', {
|
|
@@ -1529,11 +1518,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
1529
1518
|
small_ticket_data: null
|
|
1530
1519
|
}
|
|
1531
1520
|
});
|
|
1532
|
-
case
|
|
1521
|
+
case 32:
|
|
1533
1522
|
case "end":
|
|
1534
1523
|
return _context22.stop();
|
|
1535
1524
|
}
|
|
1536
|
-
}, _callee22, null, [[7,
|
|
1525
|
+
}, _callee22, null, [[7, 27]]);
|
|
1537
1526
|
}));
|
|
1538
1527
|
return function (_x21) {
|
|
1539
1528
|
return _ref52.apply(this, arguments);
|
|
@@ -3754,6 +3743,20 @@ var Server = /*#__PURE__*/function () {
|
|
|
3754
3743
|
method: 'post',
|
|
3755
3744
|
path: '/shop/local/print-order',
|
|
3756
3745
|
handler: this.handleLocalPrintOrder.bind(this)
|
|
3746
|
+
}, {
|
|
3747
|
+
method: 'post',
|
|
3748
|
+
path: '/shop/local/cloud-order-invoice/lookup',
|
|
3749
|
+
handler: function handler(_ref65) {
|
|
3750
|
+
var data = _ref65.data;
|
|
3751
|
+
return _this9.handleCloudOrderInvoice(data, false);
|
|
3752
|
+
}
|
|
3753
|
+
}, {
|
|
3754
|
+
method: 'post',
|
|
3755
|
+
path: '/shop/local/cloud-order-invoice/submit',
|
|
3756
|
+
handler: function handler(_ref66) {
|
|
3757
|
+
var data = _ref66.data;
|
|
3758
|
+
return _this9.handleCloudOrderInvoice(data, true);
|
|
3759
|
+
}
|
|
3757
3760
|
}, {
|
|
3758
3761
|
method: 'post',
|
|
3759
3762
|
path: '/shop/local/order-receipt-snapshot',
|
|
@@ -3774,13 +3777,13 @@ var Server = /*#__PURE__*/function () {
|
|
|
3774
3777
|
method: 'post',
|
|
3775
3778
|
path: '/shop/local/orderPaymentReadiness',
|
|
3776
3779
|
handler: function () {
|
|
3777
|
-
var _handler = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(
|
|
3780
|
+
var _handler = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(_ref67) {
|
|
3778
3781
|
var _this9$order;
|
|
3779
3782
|
var data;
|
|
3780
3783
|
return _regeneratorRuntime().wrap(function _callee44$(_context44) {
|
|
3781
3784
|
while (1) switch (_context44.prev = _context44.next) {
|
|
3782
3785
|
case 0:
|
|
3783
|
-
data =
|
|
3786
|
+
data = _ref67.data;
|
|
3784
3787
|
_context44.next = 3;
|
|
3785
3788
|
return (_this9$order = _this9.order) === null || _this9$order === void 0 ? void 0 : _this9$order.getLocalOrderForPaymentReadiness(data === null || data === void 0 ? void 0 : data.sale_id);
|
|
3786
3789
|
case 3:
|
|
@@ -4186,11 +4189,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
4186
4189
|
*/
|
|
4187
4190
|
}, {
|
|
4188
4191
|
key: "syncProductQueryScheduleTimers",
|
|
4189
|
-
value: function syncProductQueryScheduleTimers(
|
|
4192
|
+
value: function syncProductQueryScheduleTimers(_ref69) {
|
|
4190
4193
|
var _this$products$getLas3, _this$products2, _this$products2$getLa;
|
|
4191
|
-
var subscriberId =
|
|
4192
|
-
menu_list_ids =
|
|
4193
|
-
strategy_context =
|
|
4194
|
+
var subscriberId = _ref69.subscriberId,
|
|
4195
|
+
menu_list_ids = _ref69.menu_list_ids,
|
|
4196
|
+
strategy_context = _ref69.strategy_context;
|
|
4194
4197
|
this.clearSubscriberScheduleTimers(subscriberId);
|
|
4195
4198
|
if (!this.shouldScheduleProductQueryReload(strategy_context)) {
|
|
4196
4199
|
return;
|
|
@@ -4289,7 +4292,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
4289
4292
|
*/
|
|
4290
4293
|
function () {
|
|
4291
4294
|
var _handleSalesSearchRequest = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee51(kind, backendPath, data, config) {
|
|
4292
|
-
var queryPayload, result,
|
|
4295
|
+
var queryPayload, result, _ref70, callback, subscriberId, resetVisibleOrderIds, contextSignature, existing, shouldReset, visibleOrderIds, _iterator5, _step5, orderId;
|
|
4293
4296
|
return _regeneratorRuntime().wrap(function _callee51$(_context51) {
|
|
4294
4297
|
while (1) switch (_context51.prev = _context51.next) {
|
|
4295
4298
|
case 0:
|
|
@@ -4298,7 +4301,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
4298
4301
|
return this.fetchSalesSearchFromAPI(backendPath, queryPayload);
|
|
4299
4302
|
case 3:
|
|
4300
4303
|
result = _context51.sent;
|
|
4301
|
-
|
|
4304
|
+
_ref70 = config || {}, callback = _ref70.callback, subscriberId = _ref70.subscriberId, resetVisibleOrderIds = _ref70.resetVisibleOrderIds;
|
|
4302
4305
|
if (subscriberId && typeof callback === 'function') {
|
|
4303
4306
|
contextSignature = this.buildSalesSearchSignature(kind, queryPayload);
|
|
4304
4307
|
existing = this.salesSearchSubscribers.get(subscriberId);
|
|
@@ -6200,7 +6203,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
6200
6203
|
key: "ensureCheckoutOrderNumbers",
|
|
6201
6204
|
value: function () {
|
|
6202
6205
|
var _ensureCheckoutOrderNumbers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee63(data, title) {
|
|
6203
|
-
var next, needsShopOrderNumber, needsShopFullOrderNumber, idGenerator;
|
|
6206
|
+
var next, needsShopOrderNumber, needsShopFullOrderNumber, idGenerator, _idGenerator$getConfi, _biz;
|
|
6204
6207
|
return _regeneratorRuntime().wrap(function _callee63$(_context63) {
|
|
6205
6208
|
while (1) switch (_context63.prev = _context63.next) {
|
|
6206
6209
|
case 0:
|
|
@@ -6242,36 +6245,49 @@ var Server = /*#__PURE__*/function () {
|
|
|
6242
6245
|
case 15:
|
|
6243
6246
|
next.shop_order_number = _context63.sent;
|
|
6244
6247
|
case 16:
|
|
6245
|
-
if (!
|
|
6246
|
-
_context63.next =
|
|
6248
|
+
if (!needsShopFullOrderNumber) {
|
|
6249
|
+
_context63.next = 26;
|
|
6250
|
+
break;
|
|
6251
|
+
}
|
|
6252
|
+
_biz = next.business_code || 'ticket';
|
|
6253
|
+
if (!(((_idGenerator$getConfi = idGenerator.getConfig) === null || _idGenerator$getConfi === void 0 || (_idGenerator$getConfi = _idGenerator$getConfi.call(idGenerator, _biz)) === null || _idGenerator$getConfi === void 0 ? void 0 : _idGenerator$getConfi.enableShortNumber) === false)) {
|
|
6254
|
+
_context63.next = 22;
|
|
6255
|
+
break;
|
|
6256
|
+
}
|
|
6257
|
+
next.shop_full_order_number = next.shop_order_number;
|
|
6258
|
+
_context63.next = 26;
|
|
6259
|
+
break;
|
|
6260
|
+
case 22:
|
|
6261
|
+
if (!idGenerator.generateReceiptId) {
|
|
6262
|
+
_context63.next = 26;
|
|
6247
6263
|
break;
|
|
6248
6264
|
}
|
|
6249
|
-
_context63.next =
|
|
6265
|
+
_context63.next = 25;
|
|
6250
6266
|
return idGenerator.generateReceiptId({
|
|
6251
|
-
biz:
|
|
6267
|
+
biz: _biz
|
|
6252
6268
|
});
|
|
6253
|
-
case
|
|
6269
|
+
case 25:
|
|
6254
6270
|
next.shop_full_order_number = _context63.sent;
|
|
6255
|
-
case
|
|
6271
|
+
case 26:
|
|
6256
6272
|
this.logInfo("".concat(title, ": checkout \u8BA2\u5355\u53F7\u5DF2\u51C6\u5907"), {
|
|
6257
6273
|
shop_order_number: next.shop_order_number,
|
|
6258
6274
|
shop_full_order_number: next.shop_full_order_number
|
|
6259
6275
|
});
|
|
6260
|
-
_context63.next =
|
|
6276
|
+
_context63.next = 32;
|
|
6261
6277
|
break;
|
|
6262
|
-
case
|
|
6263
|
-
_context63.prev =
|
|
6278
|
+
case 29:
|
|
6279
|
+
_context63.prev = 29;
|
|
6264
6280
|
_context63.t0 = _context63["catch"](11);
|
|
6265
6281
|
this.logError("".concat(title, ": \u751F\u6210 checkout \u8BA2\u5355\u53F7\u5931\u8D25"), {
|
|
6266
6282
|
error: _context63.t0 instanceof Error ? _context63.t0.message : String(_context63.t0)
|
|
6267
6283
|
});
|
|
6268
|
-
case
|
|
6284
|
+
case 32:
|
|
6269
6285
|
return _context63.abrupt("return", this.finalizeCheckoutSalesNotes(next, title));
|
|
6270
|
-
case
|
|
6286
|
+
case 33:
|
|
6271
6287
|
case "end":
|
|
6272
6288
|
return _context63.stop();
|
|
6273
6289
|
}
|
|
6274
|
-
}, _callee63, this, [[11,
|
|
6290
|
+
}, _callee63, this, [[11, 29]]);
|
|
6275
6291
|
}));
|
|
6276
6292
|
function ensureCheckoutOrderNumbers(_x66, _x67) {
|
|
6277
6293
|
return _ensureCheckoutOrderNumbers.apply(this, arguments);
|
|
@@ -6556,17 +6572,231 @@ var Server = /*#__PURE__*/function () {
|
|
|
6556
6572
|
}, {
|
|
6557
6573
|
key: "mergeLocalPrintOrderInput",
|
|
6558
6574
|
value: function mergeLocalPrintOrderInput(localOrder, inputOrder) {
|
|
6559
|
-
var
|
|
6560
|
-
var definedInput = Object.fromEntries(Object.entries(inputOrder || {}).filter(function (
|
|
6561
|
-
var
|
|
6562
|
-
value =
|
|
6575
|
+
var _ref75, _localOrder$order_id, _ref76, _external_sale_number4;
|
|
6576
|
+
var definedInput = Object.fromEntries(Object.entries(inputOrder || {}).filter(function (_ref73) {
|
|
6577
|
+
var _ref74 = _slicedToArray(_ref73, 2),
|
|
6578
|
+
value = _ref74[1];
|
|
6563
6579
|
return value !== undefined;
|
|
6564
6580
|
}));
|
|
6565
6581
|
return _objectSpread(_objectSpread(_objectSpread({}, localOrder), definedInput), {}, {
|
|
6566
|
-
order_id: (
|
|
6567
|
-
external_sale_number: (
|
|
6582
|
+
order_id: (_ref75 = (_localOrder$order_id = localOrder.order_id) !== null && _localOrder$order_id !== void 0 ? _localOrder$order_id : definedInput.order_id) !== null && _ref75 !== void 0 ? _ref75 : definedInput.orderId,
|
|
6583
|
+
external_sale_number: (_ref76 = (_external_sale_number4 = localOrder.external_sale_number) !== null && _external_sale_number4 !== void 0 ? _external_sale_number4 : definedInput.external_sale_number) !== null && _ref76 !== void 0 ? _ref76 : definedInput.externalSaleNumber
|
|
6568
6584
|
});
|
|
6569
6585
|
}
|
|
6586
|
+
}, {
|
|
6587
|
+
key: "loadCloudInvoiceOrder",
|
|
6588
|
+
value: function () {
|
|
6589
|
+
var _loadCloudInvoiceOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee67(orderId, shopId, assertCurrentShop) {
|
|
6590
|
+
var hasReceiptDetail, local, result, saved;
|
|
6591
|
+
return _regeneratorRuntime().wrap(function _callee67$(_context67) {
|
|
6592
|
+
while (1) switch (_context67.prev = _context67.next) {
|
|
6593
|
+
case 0:
|
|
6594
|
+
if (this.order) {
|
|
6595
|
+
_context67.next = 2;
|
|
6596
|
+
break;
|
|
6597
|
+
}
|
|
6598
|
+
throw new Error('Cloud invoice order service is unavailable');
|
|
6599
|
+
case 2:
|
|
6600
|
+
hasReceiptDetail = function hasReceiptDetail(order) {
|
|
6601
|
+
var _order$summary, _order$summary2;
|
|
6602
|
+
// Use the same amount fields as the receipt builder, including historical
|
|
6603
|
+
// top-level amounts. Zero is a valid total; a missing total in a list row is not.
|
|
6604
|
+
var total = [(_order$summary = order.summary) === null || _order$summary === void 0 ? void 0 : _order$summary.expect_amount, order.expect_amount, (_order$summary2 = order.summary) === null || _order$summary2 === void 0 ? void 0 : _order$summary2.total_amount, order.total_amount].find(function (value) {
|
|
6605
|
+
return value != null && value !== '';
|
|
6606
|
+
});
|
|
6607
|
+
return typeof order.business_code === 'string' && !!order.business_code.trim() && (typeof total === 'number' || typeof total === 'string' && !!total.trim()) && Number.isFinite(Number(total)) && (Array.isArray(order.products) || Array.isArray(order.bookings));
|
|
6608
|
+
};
|
|
6609
|
+
_context67.next = 5;
|
|
6610
|
+
return this.order.getLocalOrderByLookup(orderId, {
|
|
6611
|
+
exactOrderId: true
|
|
6612
|
+
});
|
|
6613
|
+
case 5:
|
|
6614
|
+
local = _context67.sent;
|
|
6615
|
+
assertCurrentShop();
|
|
6616
|
+
if (!(local && String(local.order_id) === orderId)) {
|
|
6617
|
+
_context67.next = 12;
|
|
6618
|
+
break;
|
|
6619
|
+
}
|
|
6620
|
+
if (!(local.shop_id != null && String(local.shop_id) !== shopId)) {
|
|
6621
|
+
_context67.next = 10;
|
|
6622
|
+
break;
|
|
6623
|
+
}
|
|
6624
|
+
throw new Error('Cloud invoice order belongs to another shop');
|
|
6625
|
+
case 10:
|
|
6626
|
+
if (!(String(local.shop_id) === shopId && hasReceiptDetail(local))) {
|
|
6627
|
+
_context67.next = 12;
|
|
6628
|
+
break;
|
|
6629
|
+
}
|
|
6630
|
+
return _context67.abrupt("return", local);
|
|
6631
|
+
case 12:
|
|
6632
|
+
_context67.next = 14;
|
|
6633
|
+
return this.fetchAndPersistSalesOrderByLookup(orderId, {
|
|
6634
|
+
with: ['all']
|
|
6635
|
+
}, 'cloudOrderInvoice', undefined, function (fresh) {
|
|
6636
|
+
assertCurrentShop();
|
|
6637
|
+
if (String(fresh.order_id) !== orderId || fresh.shop_id != null && String(fresh.shop_id) !== shopId || !hasReceiptDetail(fresh)) {
|
|
6638
|
+
throw new Error('Cloud invoice order identity or detail is invalid');
|
|
6639
|
+
}
|
|
6640
|
+
// Some older shop-authenticated detail responses omit shop_id.
|
|
6641
|
+
return fresh.shop_id == null ? _objectSpread(_objectSpread({}, fresh), {}, {
|
|
6642
|
+
shop_id: Number(shopId)
|
|
6643
|
+
}) : fresh;
|
|
6644
|
+
});
|
|
6645
|
+
case 14:
|
|
6646
|
+
result = _context67.sent;
|
|
6647
|
+
assertCurrentShop();
|
|
6648
|
+
saved = result.order;
|
|
6649
|
+
if (!(!saved || String(saved.order_id) !== orderId || String(saved.shop_id) !== shopId || !hasReceiptDetail(saved))) {
|
|
6650
|
+
_context67.next = 19;
|
|
6651
|
+
break;
|
|
6652
|
+
}
|
|
6653
|
+
throw new Error(result.message || 'Cloud invoice order detail is unavailable');
|
|
6654
|
+
case 19:
|
|
6655
|
+
return _context67.abrupt("return", saved);
|
|
6656
|
+
case 20:
|
|
6657
|
+
case "end":
|
|
6658
|
+
return _context67.stop();
|
|
6659
|
+
}
|
|
6660
|
+
}, _callee67, this);
|
|
6661
|
+
}));
|
|
6662
|
+
function loadCloudInvoiceOrder(_x71, _x72, _x73) {
|
|
6663
|
+
return _loadCloudInvoiceOrder.apply(this, arguments);
|
|
6664
|
+
}
|
|
6665
|
+
return loadCloudInvoiceOrder;
|
|
6666
|
+
}()
|
|
6667
|
+
}, {
|
|
6668
|
+
key: "handleCloudOrderInvoice",
|
|
6669
|
+
value: function () {
|
|
6670
|
+
var _handleCloudOrderInvoice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee68(input, submit) {
|
|
6671
|
+
var _this19 = this;
|
|
6672
|
+
var orderId, _this$getAppData2, _this$getAppData3, _input$template_setti, _receipt$payment_info, shopId, tenantId, assertCurrentShop, order, businessCode, settings, receipt, smallTicketData, deviceTask, deviceId, message;
|
|
6673
|
+
return _regeneratorRuntime().wrap(function _callee68$(_context68) {
|
|
6674
|
+
while (1) switch (_context68.prev = _context68.next) {
|
|
6675
|
+
case 0:
|
|
6676
|
+
orderId = typeof (input === null || input === void 0 ? void 0 : input.order_id) === 'string' ? input.order_id.trim() : Number.isSafeInteger(input === null || input === void 0 ? void 0 : input.order_id) ? String(input.order_id) : '';
|
|
6677
|
+
if (/^[1-9]\d*$/.test(orderId)) {
|
|
6678
|
+
_context68.next = 3;
|
|
6679
|
+
break;
|
|
6680
|
+
}
|
|
6681
|
+
return _context68.abrupt("return", {
|
|
6682
|
+
code: 400,
|
|
6683
|
+
status: false,
|
|
6684
|
+
message: 'Invalid cloud invoice order ID',
|
|
6685
|
+
data: null
|
|
6686
|
+
});
|
|
6687
|
+
case 3:
|
|
6688
|
+
_context68.prev = 3;
|
|
6689
|
+
shopId = String((_this$getAppData2 = this.getAppData('shop_id')) !== null && _this$getAppData2 !== void 0 ? _this$getAppData2 : '');
|
|
6690
|
+
tenantId = String((_this$getAppData3 = this.getAppData('tenant_id')) !== null && _this$getAppData3 !== void 0 ? _this$getAppData3 : '');
|
|
6691
|
+
if (!(!/^[1-9]\d*$/.test(shopId) || !Number.isSafeInteger(Number(shopId)))) {
|
|
6692
|
+
_context68.next = 8;
|
|
6693
|
+
break;
|
|
6694
|
+
}
|
|
6695
|
+
throw new Error('Cloud invoice shop is unavailable');
|
|
6696
|
+
case 8:
|
|
6697
|
+
assertCurrentShop = function assertCurrentShop() {
|
|
6698
|
+
var _this19$getAppData, _this19$getAppData2;
|
|
6699
|
+
if (String((_this19$getAppData = _this19.getAppData('shop_id')) !== null && _this19$getAppData !== void 0 ? _this19$getAppData : '') !== shopId || String((_this19$getAppData2 = _this19.getAppData('tenant_id')) !== null && _this19$getAppData2 !== void 0 ? _this19$getAppData2 : '') !== tenantId) {
|
|
6700
|
+
throw new Error('Cloud invoice shop context changed');
|
|
6701
|
+
}
|
|
6702
|
+
};
|
|
6703
|
+
_context68.next = 11;
|
|
6704
|
+
return this.loadCloudInvoiceOrder(orderId, shopId, assertCurrentShop);
|
|
6705
|
+
case 11:
|
|
6706
|
+
order = _context68.sent;
|
|
6707
|
+
businessCode = order.business_code.trim();
|
|
6708
|
+
if (submit) {
|
|
6709
|
+
_context68.next = 15;
|
|
6710
|
+
break;
|
|
6711
|
+
}
|
|
6712
|
+
return _context68.abrupt("return", {
|
|
6713
|
+
code: 200,
|
|
6714
|
+
status: true,
|
|
6715
|
+
message: '',
|
|
6716
|
+
data: {
|
|
6717
|
+
business_code: businessCode
|
|
6718
|
+
}
|
|
6719
|
+
});
|
|
6720
|
+
case 15:
|
|
6721
|
+
if (!(input.business_code !== businessCode || typeof ((_input$template_setti = input.template_settings) === null || _input$template_setti === void 0 ? void 0 : _input$template_setti.template) !== 'string' || !input.template_settings.template.trim() || !Array.isArray(input.template_settings.modules))) {
|
|
6722
|
+
_context68.next = 17;
|
|
6723
|
+
break;
|
|
6724
|
+
}
|
|
6725
|
+
throw new Error('Cloud invoice template is missing or belongs to another business');
|
|
6726
|
+
case 17:
|
|
6727
|
+
settings = this.normalizePrintInvoiceTemplateSettings(input.template_settings);
|
|
6728
|
+
_context68.next = 20;
|
|
6729
|
+
return this.rebuildOrderReceipt(order, settings);
|
|
6730
|
+
case 20:
|
|
6731
|
+
receipt = _context68.sent;
|
|
6732
|
+
smallTicketData = (_receipt$payment_info = receipt.payment_info) === null || _receipt$payment_info === void 0 ? void 0 : _receipt$payment_info.small_ticket_data;
|
|
6733
|
+
if (hasSmallTicketData(smallTicketData)) {
|
|
6734
|
+
_context68.next = 24;
|
|
6735
|
+
break;
|
|
6736
|
+
}
|
|
6737
|
+
throw new Error('Cloud invoice snapshot is unavailable');
|
|
6738
|
+
case 24:
|
|
6739
|
+
deviceTask = this.getDeviceTaskPlugin();
|
|
6740
|
+
if (deviceTask !== null && deviceTask !== void 0 && deviceTask.dispatch) {
|
|
6741
|
+
_context68.next = 27;
|
|
6742
|
+
break;
|
|
6743
|
+
}
|
|
6744
|
+
throw new Error('Print task service is unavailable');
|
|
6745
|
+
case 27:
|
|
6746
|
+
_context68.next = 29;
|
|
6747
|
+
return this.getShortNumberOrDeviceId();
|
|
6748
|
+
case 29:
|
|
6749
|
+
deviceId = _context68.sent;
|
|
6750
|
+
assertCurrentShop();
|
|
6751
|
+
_context68.next = 33;
|
|
6752
|
+
return deviceTask.dispatch({
|
|
6753
|
+
action: 'print_all',
|
|
6754
|
+
device_id: deviceId,
|
|
6755
|
+
name: 'PRINT_V1',
|
|
6756
|
+
source: 'server',
|
|
6757
|
+
source_type: 'order',
|
|
6758
|
+
source_id: order.order_id,
|
|
6759
|
+
payload: {
|
|
6760
|
+
type: '0',
|
|
6761
|
+
template_settings: settings,
|
|
6762
|
+
data: {
|
|
6763
|
+
order_id: order.order_id,
|
|
6764
|
+
small_ticket_data: smallTicketData
|
|
6765
|
+
}
|
|
6766
|
+
}
|
|
6767
|
+
});
|
|
6768
|
+
case 33:
|
|
6769
|
+
return _context68.abrupt("return", {
|
|
6770
|
+
code: 200,
|
|
6771
|
+
status: true,
|
|
6772
|
+
message: '',
|
|
6773
|
+
data: null
|
|
6774
|
+
});
|
|
6775
|
+
case 36:
|
|
6776
|
+
_context68.prev = 36;
|
|
6777
|
+
_context68.t0 = _context68["catch"](3);
|
|
6778
|
+
message = this.getUnknownErrorMessage(_context68.t0);
|
|
6779
|
+
this.logWarning('Cloud invoice request failed', {
|
|
6780
|
+
orderId: orderId,
|
|
6781
|
+
message: message
|
|
6782
|
+
});
|
|
6783
|
+
return _context68.abrupt("return", {
|
|
6784
|
+
code: 500,
|
|
6785
|
+
status: false,
|
|
6786
|
+
message: message,
|
|
6787
|
+
data: null
|
|
6788
|
+
});
|
|
6789
|
+
case 41:
|
|
6790
|
+
case "end":
|
|
6791
|
+
return _context68.stop();
|
|
6792
|
+
}
|
|
6793
|
+
}, _callee68, this, [[3, 36]]);
|
|
6794
|
+
}));
|
|
6795
|
+
function handleCloudOrderInvoice(_x74, _x75) {
|
|
6796
|
+
return _handleCloudOrderInvoice.apply(this, arguments);
|
|
6797
|
+
}
|
|
6798
|
+
return handleCloudOrderInvoice;
|
|
6799
|
+
}()
|
|
6570
6800
|
}, {
|
|
6571
6801
|
key: "normalizeRequestedReceiptLocales",
|
|
6572
6802
|
value: function normalizeRequestedReceiptLocales(value) {
|
|
@@ -6577,6 +6807,22 @@ var Server = /*#__PURE__*/function () {
|
|
|
6577
6807
|
return locale.trim();
|
|
6578
6808
|
}).filter(Boolean)));
|
|
6579
6809
|
}
|
|
6810
|
+
}, {
|
|
6811
|
+
key: "rebuildOrderReceipt",
|
|
6812
|
+
value: function rebuildOrderReceipt(order, templateSettings, locales) {
|
|
6813
|
+
var paymentInfo = _objectSpread({}, order.payment_info);
|
|
6814
|
+
delete paymentInfo.small_ticket_data;
|
|
6815
|
+
return this.withLocalSmallTicketData(_objectSpread(_objectSpread({}, order), {}, {
|
|
6816
|
+
small_ticket_data_flag: 1,
|
|
6817
|
+
payment_info: paymentInfo
|
|
6818
|
+
}), {
|
|
6819
|
+
locales: locales,
|
|
6820
|
+
invoiceTemplateSettings: templateSettings,
|
|
6821
|
+
applyTemplateVisibility: true,
|
|
6822
|
+
includeReceiptKeys: templateSettings !== undefined,
|
|
6823
|
+
refreshResourceReference: true
|
|
6824
|
+
});
|
|
6825
|
+
}
|
|
6580
6826
|
}, {
|
|
6581
6827
|
key: "resolveMachinecodeBatchMetadataLookup",
|
|
6582
6828
|
value: function resolveMachinecodeBatchMetadataLookup(data) {
|
|
@@ -6588,57 +6834,57 @@ var Server = /*#__PURE__*/function () {
|
|
|
6588
6834
|
}, {
|
|
6589
6835
|
key: "syncMachinecodeRedeemStatusToLocalOrder",
|
|
6590
6836
|
value: function () {
|
|
6591
|
-
var _syncMachinecodeRedeemStatusToLocalOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
6837
|
+
var _syncMachinecodeRedeemStatusToLocalOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee69(data, ids, status) {
|
|
6592
6838
|
var _this$order5, _data$order_id2;
|
|
6593
6839
|
var title, lookup, localOrder, orderId, voucherIdSet, vouchers, hasUpdatedVoucher, nextVouchers;
|
|
6594
|
-
return _regeneratorRuntime().wrap(function
|
|
6595
|
-
while (1) switch (
|
|
6840
|
+
return _regeneratorRuntime().wrap(function _callee69$(_context69) {
|
|
6841
|
+
while (1) switch (_context69.prev = _context69.next) {
|
|
6596
6842
|
case 0:
|
|
6597
6843
|
title = 'handleMachinecodeBatchMetadata';
|
|
6598
6844
|
lookup = this.resolveMachinecodeBatchMetadataLookup(data);
|
|
6599
6845
|
if (!(lookup === undefined)) {
|
|
6600
|
-
|
|
6846
|
+
_context69.next = 5;
|
|
6601
6847
|
break;
|
|
6602
6848
|
}
|
|
6603
6849
|
this.logWarning("".concat(title, ": order lookup \u7F3A\u5931\uFF0C\u8DF3\u8FC7\u672C\u5730\u8BA2\u5355\u6838\u9500\u72B6\u6001\u66F4\u65B0"), {
|
|
6604
6850
|
batchSize: ids.length,
|
|
6605
6851
|
status: status
|
|
6606
6852
|
});
|
|
6607
|
-
return
|
|
6853
|
+
return _context69.abrupt("return");
|
|
6608
6854
|
case 5:
|
|
6609
6855
|
if ((_this$order5 = this.order) !== null && _this$order5 !== void 0 && _this$order5.getLocalOrderByLookup) {
|
|
6610
|
-
|
|
6856
|
+
_context69.next = 8;
|
|
6611
6857
|
break;
|
|
6612
6858
|
}
|
|
6613
6859
|
this.logWarning("".concat(title, ": Order \u6A21\u5757\u672A\u6CE8\u518C\uFF0C\u8DF3\u8FC7\u672C\u5730\u8BA2\u5355\u6838\u9500\u72B6\u6001\u66F4\u65B0"), {
|
|
6614
6860
|
lookup: lookup,
|
|
6615
6861
|
status: status
|
|
6616
6862
|
});
|
|
6617
|
-
return
|
|
6863
|
+
return _context69.abrupt("return");
|
|
6618
6864
|
case 8:
|
|
6619
|
-
|
|
6865
|
+
_context69.next = 10;
|
|
6620
6866
|
return this.order.getLocalOrderByLookup(lookup);
|
|
6621
6867
|
case 10:
|
|
6622
|
-
localOrder =
|
|
6868
|
+
localOrder = _context69.sent;
|
|
6623
6869
|
orderId = (_data$order_id2 = data === null || data === void 0 ? void 0 : data.order_id) !== null && _data$order_id2 !== void 0 ? _data$order_id2 : data === null || data === void 0 ? void 0 : data.orderId;
|
|
6624
6870
|
if (!(!localOrder && orderId !== undefined && orderId !== null && orderId !== '' && String(orderId) !== String(lookup))) {
|
|
6625
|
-
|
|
6871
|
+
_context69.next = 16;
|
|
6626
6872
|
break;
|
|
6627
6873
|
}
|
|
6628
|
-
|
|
6874
|
+
_context69.next = 15;
|
|
6629
6875
|
return this.order.getLocalOrderByLookup(orderId);
|
|
6630
6876
|
case 15:
|
|
6631
|
-
localOrder =
|
|
6877
|
+
localOrder = _context69.sent;
|
|
6632
6878
|
case 16:
|
|
6633
6879
|
if (localOrder) {
|
|
6634
|
-
|
|
6880
|
+
_context69.next = 19;
|
|
6635
6881
|
break;
|
|
6636
6882
|
}
|
|
6637
6883
|
this.logWarning("".concat(title, ": \u672C\u5730\u8BA2\u5355\u4E0D\u5B58\u5728\uFF0C\u8DF3\u8FC7\u6838\u9500\u72B6\u6001\u66F4\u65B0"), {
|
|
6638
6884
|
lookup: lookup,
|
|
6639
6885
|
status: status
|
|
6640
6886
|
});
|
|
6641
|
-
return
|
|
6887
|
+
return _context69.abrupt("return");
|
|
6642
6888
|
case 19:
|
|
6643
6889
|
voucherIdSet = new Set(ids.filter(function (id) {
|
|
6644
6890
|
return id !== undefined && id !== null && id !== '';
|
|
@@ -6646,14 +6892,14 @@ var Server = /*#__PURE__*/function () {
|
|
|
6646
6892
|
return String(id);
|
|
6647
6893
|
}));
|
|
6648
6894
|
if (!(voucherIdSet.size === 0)) {
|
|
6649
|
-
|
|
6895
|
+
_context69.next = 23;
|
|
6650
6896
|
break;
|
|
6651
6897
|
}
|
|
6652
6898
|
this.logWarning("".concat(title, ": voucher ids \u7F3A\u5931\uFF0C\u8DF3\u8FC7\u672C\u5730\u8BA2\u5355\u6838\u9500\u72B6\u6001\u66F4\u65B0"), {
|
|
6653
6899
|
lookup: lookup,
|
|
6654
6900
|
status: status
|
|
6655
6901
|
});
|
|
6656
|
-
return
|
|
6902
|
+
return _context69.abrupt("return");
|
|
6657
6903
|
case 23:
|
|
6658
6904
|
vouchers = Array.isArray(localOrder.vouchers) ? localOrder.vouchers : [];
|
|
6659
6905
|
hasUpdatedVoucher = false;
|
|
@@ -6667,7 +6913,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
6667
6913
|
});
|
|
6668
6914
|
});
|
|
6669
6915
|
if (hasUpdatedVoucher) {
|
|
6670
|
-
|
|
6916
|
+
_context69.next = 29;
|
|
6671
6917
|
break;
|
|
6672
6918
|
}
|
|
6673
6919
|
this.logWarning("".concat(title, ": \u672C\u5730\u8BA2\u5355\u672A\u547D\u4E2D\u4EFB\u4F55 voucher\uFF0C\u8DF3\u8FC7\u6838\u9500\u72B6\u6001\u66F4\u65B0"), {
|
|
@@ -6675,13 +6921,13 @@ var Server = /*#__PURE__*/function () {
|
|
|
6675
6921
|
voucher_ids: Array.from(voucherIdSet),
|
|
6676
6922
|
status: status
|
|
6677
6923
|
});
|
|
6678
|
-
return
|
|
6924
|
+
return _context69.abrupt("return");
|
|
6679
6925
|
case 29:
|
|
6680
6926
|
if (!(typeof this.order.overwriteExistingOrder === 'function')) {
|
|
6681
|
-
|
|
6927
|
+
_context69.next = 34;
|
|
6682
6928
|
break;
|
|
6683
6929
|
}
|
|
6684
|
-
|
|
6930
|
+
_context69.next = 32;
|
|
6685
6931
|
return this.order.overwriteExistingOrder(_objectSpread(_objectSpread({}, localOrder), {}, {
|
|
6686
6932
|
vouchers: nextVouchers
|
|
6687
6933
|
}));
|
|
@@ -6691,13 +6937,13 @@ var Server = /*#__PURE__*/function () {
|
|
|
6691
6937
|
updatedCount: voucherIdSet.size,
|
|
6692
6938
|
status: status
|
|
6693
6939
|
});
|
|
6694
|
-
return
|
|
6940
|
+
return _context69.abrupt("return");
|
|
6695
6941
|
case 34:
|
|
6696
6942
|
if (!(data !== null && data !== void 0 && data.external_sale_number && typeof this.order.markOrderSyncedByExternalSaleNumber === 'function')) {
|
|
6697
|
-
|
|
6943
|
+
_context69.next = 39;
|
|
6698
6944
|
break;
|
|
6699
6945
|
}
|
|
6700
|
-
|
|
6946
|
+
_context69.next = 37;
|
|
6701
6947
|
return this.order.markOrderSyncedByExternalSaleNumber({
|
|
6702
6948
|
externalSaleNumber: data.external_sale_number,
|
|
6703
6949
|
patch: {
|
|
@@ -6710,7 +6956,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
6710
6956
|
updatedCount: voucherIdSet.size,
|
|
6711
6957
|
status: status
|
|
6712
6958
|
});
|
|
6713
|
-
return
|
|
6959
|
+
return _context69.abrupt("return");
|
|
6714
6960
|
case 39:
|
|
6715
6961
|
this.logWarning("".concat(title, ": Order \u6A21\u5757\u4E0D\u652F\u6301\u672C\u5730\u8BA2\u5355\u8986\u76D6\uFF0C\u8DF3\u8FC7\u6838\u9500\u72B6\u6001\u66F4\u65B0"), {
|
|
6716
6962
|
lookup: lookup,
|
|
@@ -6718,11 +6964,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
6718
6964
|
});
|
|
6719
6965
|
case 40:
|
|
6720
6966
|
case "end":
|
|
6721
|
-
return
|
|
6967
|
+
return _context69.stop();
|
|
6722
6968
|
}
|
|
6723
|
-
},
|
|
6969
|
+
}, _callee69, this);
|
|
6724
6970
|
}));
|
|
6725
|
-
function syncMachinecodeRedeemStatusToLocalOrder(
|
|
6971
|
+
function syncMachinecodeRedeemStatusToLocalOrder(_x76, _x77, _x78) {
|
|
6726
6972
|
return _syncMachinecodeRedeemStatusToLocalOrder.apply(this, arguments);
|
|
6727
6973
|
}
|
|
6728
6974
|
return syncMachinecodeRedeemStatusToLocalOrder;
|
|
@@ -6730,30 +6976,30 @@ var Server = /*#__PURE__*/function () {
|
|
|
6730
6976
|
}, {
|
|
6731
6977
|
key: "handleOrderCheckoutSubmit",
|
|
6732
6978
|
value: function () {
|
|
6733
|
-
var _handleOrderCheckoutSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
6979
|
+
var _handleOrderCheckoutSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee70(params) {
|
|
6734
6980
|
var _params$data5, _params$data6, _this$order6, _this$order6$getLocal;
|
|
6735
6981
|
var backendPath, title, lookup, localOrder, extractedInvoice, extractedTemplateSettings, data, invoiceLayoutConfig, invoiceTemplateSettings, receiptAutoPrintPaymentStatuses, normalizedData, numberedData, checkoutData, pendingResult, pendingOrder;
|
|
6736
|
-
return _regeneratorRuntime().wrap(function
|
|
6737
|
-
while (1) switch (
|
|
6982
|
+
return _regeneratorRuntime().wrap(function _callee70$(_context70) {
|
|
6983
|
+
while (1) switch (_context70.prev = _context70.next) {
|
|
6738
6984
|
case 0:
|
|
6739
6985
|
backendPath = params.backendPath, title = params.title;
|
|
6740
6986
|
lookup = ((_params$data5 = params.data) === null || _params$data5 === void 0 ? void 0 : _params$data5.order_id) || ((_params$data6 = params.data) === null || _params$data6 === void 0 ? void 0 : _params$data6.external_sale_number);
|
|
6741
|
-
|
|
6742
|
-
if (!
|
|
6743
|
-
|
|
6987
|
+
_context70.t0 = lookup;
|
|
6988
|
+
if (!_context70.t0) {
|
|
6989
|
+
_context70.next = 7;
|
|
6744
6990
|
break;
|
|
6745
6991
|
}
|
|
6746
|
-
|
|
6992
|
+
_context70.next = 6;
|
|
6747
6993
|
return (_this$order6 = this.order) === null || _this$order6 === void 0 || (_this$order6$getLocal = _this$order6.getLocalOrderByLookup) === null || _this$order6$getLocal === void 0 ? void 0 : _this$order6$getLocal.call(_this$order6, lookup);
|
|
6748
6994
|
case 6:
|
|
6749
|
-
|
|
6995
|
+
_context70.t0 = _context70.sent;
|
|
6750
6996
|
case 7:
|
|
6751
|
-
localOrder =
|
|
6997
|
+
localOrder = _context70.t0;
|
|
6752
6998
|
if (!(requiresLocalPaymentRefresh(params.data) || requiresLocalPaymentRefresh(localOrder))) {
|
|
6753
|
-
|
|
6999
|
+
_context70.next = 10;
|
|
6754
7000
|
break;
|
|
6755
7001
|
}
|
|
6756
|
-
return
|
|
7002
|
+
return _context70.abrupt("return", {
|
|
6757
7003
|
code: 409,
|
|
6758
7004
|
status: false,
|
|
6759
7005
|
message: PAYMENT_REFRESH_MESSAGE,
|
|
@@ -6777,10 +7023,10 @@ var Server = /*#__PURE__*/function () {
|
|
|
6777
7023
|
order_number: data === null || data === void 0 ? void 0 : data.order_number
|
|
6778
7024
|
});
|
|
6779
7025
|
if (!(data !== null && data !== void 0 && data.sync_mode || data !== null && data !== void 0 && data.syncMode)) {
|
|
6780
|
-
|
|
7026
|
+
_context70.next = 19;
|
|
6781
7027
|
break;
|
|
6782
7028
|
}
|
|
6783
|
-
return
|
|
7029
|
+
return _context70.abrupt("return", this.handleSyncCheckoutSubmit({
|
|
6784
7030
|
backendPath: backendPath,
|
|
6785
7031
|
data: data,
|
|
6786
7032
|
title: title,
|
|
@@ -6789,16 +7035,16 @@ var Server = /*#__PURE__*/function () {
|
|
|
6789
7035
|
receiptAutoPrintPaymentStatuses: receiptAutoPrintPaymentStatuses
|
|
6790
7036
|
}));
|
|
6791
7037
|
case 19:
|
|
6792
|
-
|
|
7038
|
+
_context70.next = 21;
|
|
6793
7039
|
return this.normalizeCheckoutSubmitData(data, title);
|
|
6794
7040
|
case 21:
|
|
6795
|
-
normalizedData =
|
|
6796
|
-
|
|
7041
|
+
normalizedData = _context70.sent;
|
|
7042
|
+
_context70.next = 24;
|
|
6797
7043
|
return this.ensureCheckoutOrderNumbers(normalizedData, title);
|
|
6798
7044
|
case 24:
|
|
6799
|
-
numberedData =
|
|
7045
|
+
numberedData = _context70.sent;
|
|
6800
7046
|
checkoutData = this.normalizeCheckoutCollections(stripOsPrivatePayloadFields(this.applyCheckoutFulfillmentBuzzer(numberedData, title)));
|
|
6801
|
-
|
|
7047
|
+
_context70.next = 28;
|
|
6802
7048
|
return this.handlePendingSyncCheckoutOrder({
|
|
6803
7049
|
backendPath: backendPath,
|
|
6804
7050
|
data: checkoutData,
|
|
@@ -6807,18 +7053,18 @@ var Server = /*#__PURE__*/function () {
|
|
|
6807
7053
|
invoiceTemplateSettings: invoiceTemplateSettings
|
|
6808
7054
|
});
|
|
6809
7055
|
case 28:
|
|
6810
|
-
pendingResult =
|
|
7056
|
+
pendingResult = _context70.sent;
|
|
6811
7057
|
if (!((pendingResult === null || pendingResult === void 0 ? void 0 : pendingResult.status) === true)) {
|
|
6812
|
-
|
|
7058
|
+
_context70.next = 43;
|
|
6813
7059
|
break;
|
|
6814
7060
|
}
|
|
6815
7061
|
pendingOrder = pendingResult.data;
|
|
6816
7062
|
if (!(pendingOrder && this.shouldBuildSmallTicketData(checkoutData, invoiceTemplateSettings) && this.shouldAutoPrintReceiptForPaymentStatus(pendingOrder, receiptAutoPrintPaymentStatuses) && this.shouldAutoPrintCheckoutReceipt())) {
|
|
6817
|
-
|
|
7063
|
+
_context70.next = 41;
|
|
6818
7064
|
break;
|
|
6819
7065
|
}
|
|
6820
|
-
|
|
6821
|
-
|
|
7066
|
+
_context70.prev = 32;
|
|
7067
|
+
_context70.next = 35;
|
|
6822
7068
|
return this.dispatchLocalReceiptPrint({
|
|
6823
7069
|
checkoutData: checkoutData,
|
|
6824
7070
|
order: pendingOrder,
|
|
@@ -6828,19 +7074,19 @@ var Server = /*#__PURE__*/function () {
|
|
|
6828
7074
|
invoiceTemplateSettings: invoiceTemplateSettings
|
|
6829
7075
|
});
|
|
6830
7076
|
case 35:
|
|
6831
|
-
|
|
7077
|
+
_context70.next = 41;
|
|
6832
7078
|
break;
|
|
6833
7079
|
case 37:
|
|
6834
|
-
|
|
6835
|
-
|
|
7080
|
+
_context70.prev = 37;
|
|
7081
|
+
_context70.t1 = _context70["catch"](32);
|
|
6836
7082
|
// The sale is already persisted. A failed receipt must not cancel its
|
|
6837
7083
|
// sync task or send an unfiltered fallback to the printer.
|
|
6838
|
-
pendingResult.receipt_print_error = this.getUnknownErrorMessage(
|
|
7084
|
+
pendingResult.receipt_print_error = this.getUnknownErrorMessage(_context70.t1);
|
|
6839
7085
|
this.logError("".concat(title, ": \u5C0F\u7968\u751F\u6210\u5931\u8D25\uFF0C\u8BA2\u5355\u4ECD\u7EE7\u7EED\u540C\u6B65"), {
|
|
6840
7086
|
error: pendingResult.receipt_print_error
|
|
6841
7087
|
});
|
|
6842
7088
|
case 41:
|
|
6843
|
-
|
|
7089
|
+
_context70.next = 43;
|
|
6844
7090
|
return this.dispatchCheckoutSyncTask({
|
|
6845
7091
|
backendPath: backendPath,
|
|
6846
7092
|
data: checkoutData,
|
|
@@ -6850,23 +7096,23 @@ var Server = /*#__PURE__*/function () {
|
|
|
6850
7096
|
});
|
|
6851
7097
|
case 43:
|
|
6852
7098
|
if (pendingResult.data.order_id) {
|
|
6853
|
-
|
|
7099
|
+
_context70.next = 45;
|
|
6854
7100
|
break;
|
|
6855
7101
|
}
|
|
6856
|
-
return
|
|
7102
|
+
return _context70.abrupt("return", _objectSpread(_objectSpread({}, pendingResult), {}, {
|
|
6857
7103
|
data: _objectSpread(_objectSpread({}, pendingResult.data), {}, {
|
|
6858
7104
|
order_id: pendingResult.data.external_sale_number
|
|
6859
7105
|
})
|
|
6860
7106
|
}));
|
|
6861
7107
|
case 45:
|
|
6862
|
-
return
|
|
7108
|
+
return _context70.abrupt("return", pendingResult);
|
|
6863
7109
|
case 46:
|
|
6864
7110
|
case "end":
|
|
6865
|
-
return
|
|
7111
|
+
return _context70.stop();
|
|
6866
7112
|
}
|
|
6867
|
-
},
|
|
7113
|
+
}, _callee70, this, [[32, 37]]);
|
|
6868
7114
|
}));
|
|
6869
|
-
function handleOrderCheckoutSubmit(
|
|
7115
|
+
function handleOrderCheckoutSubmit(_x79) {
|
|
6870
7116
|
return _handleOrderCheckoutSubmit.apply(this, arguments);
|
|
6871
7117
|
}
|
|
6872
7118
|
return handleOrderCheckoutSubmit;
|
|
@@ -6874,27 +7120,27 @@ var Server = /*#__PURE__*/function () {
|
|
|
6874
7120
|
}, {
|
|
6875
7121
|
key: "handleSyncCheckoutSubmit",
|
|
6876
7122
|
value: function () {
|
|
6877
|
-
var _handleSyncCheckoutSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
7123
|
+
var _handleSyncCheckoutSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee71(params) {
|
|
6878
7124
|
var _this$app18;
|
|
6879
7125
|
var backendPath, data, title, invoiceLayoutConfig, invoiceTemplateSettings, receiptAutoPrintPaymentStatuses, syncResult, _normalized$data, normalized, response, syncedOrder, backendError, _normalized$data2, _normalized, message;
|
|
6880
|
-
return _regeneratorRuntime().wrap(function
|
|
6881
|
-
while (1) switch (
|
|
7126
|
+
return _regeneratorRuntime().wrap(function _callee71$(_context71) {
|
|
7127
|
+
while (1) switch (_context71.prev = _context71.next) {
|
|
6882
7128
|
case 0:
|
|
6883
7129
|
backendPath = params.backendPath, data = params.data, title = params.title, invoiceLayoutConfig = params.invoiceLayoutConfig, invoiceTemplateSettings = params.invoiceTemplateSettings, receiptAutoPrintPaymentStatuses = params.receiptAutoPrintPaymentStatuses;
|
|
6884
7130
|
if ((_this$app18 = this.app) !== null && _this$app18 !== void 0 && (_this$app18 = _this$app18.request) !== null && _this$app18 !== void 0 && _this$app18.post) {
|
|
6885
|
-
|
|
7131
|
+
_context71.next = 4;
|
|
6886
7132
|
break;
|
|
6887
7133
|
}
|
|
6888
7134
|
this.logError("".concat(title, ": sync checkout app.request \u4E0D\u53EF\u7528"));
|
|
6889
|
-
return
|
|
7135
|
+
return _context71.abrupt("return", {
|
|
6890
7136
|
code: 500,
|
|
6891
7137
|
status: false,
|
|
6892
7138
|
message: 'app.request 不可用',
|
|
6893
7139
|
data: null
|
|
6894
7140
|
});
|
|
6895
7141
|
case 4:
|
|
6896
|
-
|
|
6897
|
-
|
|
7142
|
+
_context71.prev = 4;
|
|
7143
|
+
_context71.next = 7;
|
|
6898
7144
|
return this.runCheckoutSync({
|
|
6899
7145
|
backendPath: backendPath,
|
|
6900
7146
|
data: data,
|
|
@@ -6904,13 +7150,13 @@ var Server = /*#__PURE__*/function () {
|
|
|
6904
7150
|
invoiceTemplateSettings: invoiceTemplateSettings
|
|
6905
7151
|
});
|
|
6906
7152
|
case 7:
|
|
6907
|
-
syncResult =
|
|
7153
|
+
syncResult = _context71.sent;
|
|
6908
7154
|
if (!syncResult.rejected) {
|
|
6909
|
-
|
|
7155
|
+
_context71.next = 11;
|
|
6910
7156
|
break;
|
|
6911
7157
|
}
|
|
6912
7158
|
normalized = this.normalizeCheckoutResponse(syncResult.errorResponse);
|
|
6913
|
-
return
|
|
7159
|
+
return _context71.abrupt("return", _objectSpread(_objectSpread({}, normalized), {}, {
|
|
6914
7160
|
status: false,
|
|
6915
7161
|
message: syncResult.message || (normalized === null || normalized === void 0 ? void 0 : normalized.message) || '后端明确拒绝 checkout',
|
|
6916
7162
|
data: (_normalized$data = normalized === null || normalized === void 0 ? void 0 : normalized.data) !== null && _normalized$data !== void 0 ? _normalized$data : null
|
|
@@ -6919,11 +7165,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
6919
7165
|
response = this.withSyncedOrderIdInCheckoutResponse(syncResult.normalizedResponse, syncResult.syncedOrder);
|
|
6920
7166
|
syncedOrder = syncResult.syncedOrder;
|
|
6921
7167
|
if (!(syncedOrder && this.shouldBuildSmallTicketData(syncResult.checkoutData, invoiceTemplateSettings) && this.shouldAutoPrintReceiptForPaymentStatus(syncedOrder, receiptAutoPrintPaymentStatuses) && (receiptAutoPrintPaymentStatuses === undefined || this.shouldAutoPrintCheckoutReceipt()))) {
|
|
6922
|
-
|
|
7168
|
+
_context71.next = 23;
|
|
6923
7169
|
break;
|
|
6924
7170
|
}
|
|
6925
|
-
|
|
6926
|
-
|
|
7171
|
+
_context71.prev = 14;
|
|
7172
|
+
_context71.next = 17;
|
|
6927
7173
|
return this.dispatchLocalReceiptPrint({
|
|
6928
7174
|
checkoutData: syncResult.checkoutData,
|
|
6929
7175
|
order: syncedOrder,
|
|
@@ -6933,41 +7179,41 @@ var Server = /*#__PURE__*/function () {
|
|
|
6933
7179
|
invoiceTemplateSettings: invoiceTemplateSettings
|
|
6934
7180
|
});
|
|
6935
7181
|
case 17:
|
|
6936
|
-
|
|
7182
|
+
_context71.next = 23;
|
|
6937
7183
|
break;
|
|
6938
7184
|
case 19:
|
|
6939
|
-
|
|
6940
|
-
|
|
7185
|
+
_context71.prev = 19;
|
|
7186
|
+
_context71.t0 = _context71["catch"](14);
|
|
6941
7187
|
// Checkout already succeeded remotely; report the receipt failure
|
|
6942
7188
|
// separately instead of implying that payment/order creation failed.
|
|
6943
|
-
response.receipt_print_error = this.getUnknownErrorMessage(
|
|
7189
|
+
response.receipt_print_error = this.getUnknownErrorMessage(_context71.t0);
|
|
6944
7190
|
this.logError("".concat(title, ": \u5C0F\u7968\u751F\u6210\u5931\u8D25\uFF0C\u8BA2\u5355\u5DF2\u540C\u6B65"), {
|
|
6945
7191
|
error: response.receipt_print_error
|
|
6946
7192
|
});
|
|
6947
7193
|
case 23:
|
|
6948
|
-
return
|
|
7194
|
+
return _context71.abrupt("return", response);
|
|
6949
7195
|
case 26:
|
|
6950
|
-
|
|
6951
|
-
|
|
6952
|
-
backendError = this.extractBackendErrorResponse(
|
|
7196
|
+
_context71.prev = 26;
|
|
7197
|
+
_context71.t1 = _context71["catch"](4);
|
|
7198
|
+
backendError = this.extractBackendErrorResponse(_context71.t1);
|
|
6953
7199
|
if (!backendError) {
|
|
6954
|
-
|
|
7200
|
+
_context71.next = 32;
|
|
6955
7201
|
break;
|
|
6956
7202
|
}
|
|
6957
7203
|
_normalized = this.normalizeCheckoutResponse(backendError);
|
|
6958
|
-
return
|
|
7204
|
+
return _context71.abrupt("return", _objectSpread(_objectSpread({}, _normalized), {}, {
|
|
6959
7205
|
status: false,
|
|
6960
7206
|
message: (backendError === null || backendError === void 0 ? void 0 : backendError.message) || (_normalized === null || _normalized === void 0 ? void 0 : _normalized.message) || '后端明确拒绝 checkout',
|
|
6961
7207
|
data: (_normalized$data2 = _normalized === null || _normalized === void 0 ? void 0 : _normalized.data) !== null && _normalized$data2 !== void 0 ? _normalized$data2 : null
|
|
6962
7208
|
}));
|
|
6963
7209
|
case 32:
|
|
6964
|
-
message = this.getUnknownErrorMessage(
|
|
7210
|
+
message = this.getUnknownErrorMessage(_context71.t1);
|
|
6965
7211
|
this.logError("".concat(title, ": sync checkout \u8BF7\u6C42\u672A\u660E\u786E\u6210\u529F"), {
|
|
6966
7212
|
backendPath: backendPath,
|
|
6967
7213
|
error: message,
|
|
6968
|
-
error_detail: this.normalizeUnknownError(
|
|
7214
|
+
error_detail: this.normalizeUnknownError(_context71.t1)
|
|
6969
7215
|
});
|
|
6970
|
-
return
|
|
7216
|
+
return _context71.abrupt("return", {
|
|
6971
7217
|
code: 500,
|
|
6972
7218
|
status: false,
|
|
6973
7219
|
message: message,
|
|
@@ -6975,11 +7221,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
6975
7221
|
});
|
|
6976
7222
|
case 35:
|
|
6977
7223
|
case "end":
|
|
6978
|
-
return
|
|
7224
|
+
return _context71.stop();
|
|
6979
7225
|
}
|
|
6980
|
-
},
|
|
7226
|
+
}, _callee71, this, [[4, 26], [14, 19]]);
|
|
6981
7227
|
}));
|
|
6982
|
-
function handleSyncCheckoutSubmit(
|
|
7228
|
+
function handleSyncCheckoutSubmit(_x80) {
|
|
6983
7229
|
return _handleSyncCheckoutSubmit.apply(this, arguments);
|
|
6984
7230
|
}
|
|
6985
7231
|
return handleSyncCheckoutSubmit;
|
|
@@ -6987,10 +7233,10 @@ var Server = /*#__PURE__*/function () {
|
|
|
6987
7233
|
}, {
|
|
6988
7234
|
key: "handleOrderDraftSubmit",
|
|
6989
7235
|
value: function () {
|
|
6990
|
-
var _handleOrderDraftSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
7236
|
+
var _handleOrderDraftSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee72(params) {
|
|
6991
7237
|
var title, extractedInvoice, _this$extractInvoiceT, data, normalizedData, createdAt, draftOrder, _draftOrder$summary, _draftOrder$summary2, _draftOrder$summary3, errorMessage;
|
|
6992
|
-
return _regeneratorRuntime().wrap(function
|
|
6993
|
-
while (1) switch (
|
|
7238
|
+
return _regeneratorRuntime().wrap(function _callee72$(_context72) {
|
|
7239
|
+
while (1) switch (_context72.prev = _context72.next) {
|
|
6994
7240
|
case 0:
|
|
6995
7241
|
title = params.title;
|
|
6996
7242
|
extractedInvoice = this.extractInvoiceLayoutConfig(params.data, {
|
|
@@ -7004,10 +7250,10 @@ var Server = /*#__PURE__*/function () {
|
|
|
7004
7250
|
external_sale_number: data === null || data === void 0 ? void 0 : data.external_sale_number,
|
|
7005
7251
|
order_number: data === null || data === void 0 ? void 0 : data.order_number
|
|
7006
7252
|
});
|
|
7007
|
-
|
|
7253
|
+
_context72.next = 6;
|
|
7008
7254
|
return this.normalizeCheckoutSubmitData(data, title);
|
|
7009
7255
|
case 6:
|
|
7010
|
-
normalizedData =
|
|
7256
|
+
normalizedData = _context72.sent;
|
|
7011
7257
|
createdAt = normalizedData.created_at || normalizedData.create_date || dayjs().format('YYYY-MM-DD HH:mm:ss');
|
|
7012
7258
|
draftOrder = _objectSpread(_objectSpread({}, normalizedData), {}, {
|
|
7013
7259
|
external_sale_number: normalizedData.external_sale_number || "LOCAL_DRAFT_".concat(Date.now(), "_").concat(Math.random().toString(36).slice(2, 10)),
|
|
@@ -7017,26 +7263,26 @@ var Server = /*#__PURE__*/function () {
|
|
|
7017
7263
|
is_draft_order: 1
|
|
7018
7264
|
});
|
|
7019
7265
|
if (!(!this.order || typeof this.order.upsertLocalDraftOrders !== 'function')) {
|
|
7020
|
-
|
|
7266
|
+
_context72.next = 12;
|
|
7021
7267
|
break;
|
|
7022
7268
|
}
|
|
7023
7269
|
this.logError("".concat(title, ": Order \u6A21\u5757\u4E0D\u652F\u6301\u672C\u5730\u8349\u7A3F\u5199\u5165"));
|
|
7024
|
-
return
|
|
7270
|
+
return _context72.abrupt("return", {
|
|
7025
7271
|
code: 500,
|
|
7026
7272
|
status: false,
|
|
7027
7273
|
message: 'Order 模块不支持本地草稿写入',
|
|
7028
7274
|
data: null
|
|
7029
7275
|
});
|
|
7030
7276
|
case 12:
|
|
7031
|
-
|
|
7032
|
-
|
|
7277
|
+
_context72.prev = 12;
|
|
7278
|
+
_context72.next = 15;
|
|
7033
7279
|
return this.order.upsertLocalDraftOrders([draftOrder]);
|
|
7034
7280
|
case 15:
|
|
7035
7281
|
this.logInfo("".concat(title, ": \u8349\u7A3F\u8BA2\u5355\u5DF2\u5199\u5165\u672C\u5730"), {
|
|
7036
7282
|
order_id: draftOrder.order_id,
|
|
7037
7283
|
external_sale_number: draftOrder.external_sale_number
|
|
7038
7284
|
});
|
|
7039
|
-
return
|
|
7285
|
+
return _context72.abrupt("return", {
|
|
7040
7286
|
code: 200,
|
|
7041
7287
|
status: true,
|
|
7042
7288
|
message: '',
|
|
@@ -7048,13 +7294,13 @@ var Server = /*#__PURE__*/function () {
|
|
|
7048
7294
|
})
|
|
7049
7295
|
});
|
|
7050
7296
|
case 19:
|
|
7051
|
-
|
|
7052
|
-
|
|
7053
|
-
errorMessage =
|
|
7297
|
+
_context72.prev = 19;
|
|
7298
|
+
_context72.t0 = _context72["catch"](12);
|
|
7299
|
+
errorMessage = _context72.t0 instanceof Error ? _context72.t0.message : String(_context72.t0);
|
|
7054
7300
|
this.logError("".concat(title, ": \u5199\u5165\u672C\u5730\u8349\u7A3F\u8BA2\u5355\u5931\u8D25"), {
|
|
7055
7301
|
error: errorMessage
|
|
7056
7302
|
});
|
|
7057
|
-
return
|
|
7303
|
+
return _context72.abrupt("return", {
|
|
7058
7304
|
code: 500,
|
|
7059
7305
|
status: false,
|
|
7060
7306
|
message: errorMessage,
|
|
@@ -7062,11 +7308,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
7062
7308
|
});
|
|
7063
7309
|
case 24:
|
|
7064
7310
|
case "end":
|
|
7065
|
-
return
|
|
7311
|
+
return _context72.stop();
|
|
7066
7312
|
}
|
|
7067
|
-
},
|
|
7313
|
+
}, _callee72, this, [[12, 19]]);
|
|
7068
7314
|
}));
|
|
7069
|
-
function handleOrderDraftSubmit(
|
|
7315
|
+
function handleOrderDraftSubmit(_x81) {
|
|
7070
7316
|
return _handleOrderDraftSubmit.apply(this, arguments);
|
|
7071
7317
|
}
|
|
7072
7318
|
return handleOrderDraftSubmit;
|
|
@@ -7074,26 +7320,26 @@ var Server = /*#__PURE__*/function () {
|
|
|
7074
7320
|
}, {
|
|
7075
7321
|
key: "handlePendingSyncCheckoutOrder",
|
|
7076
7322
|
value: function () {
|
|
7077
|
-
var _handlePendingSyncCheckoutOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
7078
|
-
var
|
|
7323
|
+
var _handlePendingSyncCheckoutOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee73(params) {
|
|
7324
|
+
var _this20 = this;
|
|
7079
7325
|
var backendPath, data, title, reason, invoiceTemplateSettings, pendingOrder, _pendingOrder$payment, _pendingOrder$summary, _pendingOrder$summary2, _pendingOrder$summary3, changeGivenAmount, errorMessage;
|
|
7080
|
-
return _regeneratorRuntime().wrap(function
|
|
7081
|
-
while (1) switch (
|
|
7326
|
+
return _regeneratorRuntime().wrap(function _callee73$(_context73) {
|
|
7327
|
+
while (1) switch (_context73.prev = _context73.next) {
|
|
7082
7328
|
case 0:
|
|
7083
7329
|
backendPath = params.backendPath, data = params.data, title = params.title, reason = params.reason, invoiceTemplateSettings = params.invoiceTemplateSettings;
|
|
7084
|
-
|
|
7330
|
+
_context73.next = 3;
|
|
7085
7331
|
return this.buildPendingSyncCheckoutOrder(data, invoiceTemplateSettings);
|
|
7086
7332
|
case 3:
|
|
7087
|
-
pendingOrder =
|
|
7333
|
+
pendingOrder = _context73.sent;
|
|
7088
7334
|
if (pendingOrder) {
|
|
7089
|
-
|
|
7335
|
+
_context73.next = 7;
|
|
7090
7336
|
break;
|
|
7091
7337
|
}
|
|
7092
7338
|
this.logError("".concat(title, ": checkout \u5931\u8D25\u4E14\u8BA2\u5355\u7F3A\u5C11\u672C\u5730\u5B58\u50A8\u6807\u8BC6"), {
|
|
7093
7339
|
backendPath: backendPath,
|
|
7094
7340
|
reason: reason
|
|
7095
7341
|
});
|
|
7096
|
-
return
|
|
7342
|
+
return _context73.abrupt("return", {
|
|
7097
7343
|
code: 500,
|
|
7098
7344
|
status: false,
|
|
7099
7345
|
message: '订单缺少本地存储标识,无法写入待同步队列',
|
|
@@ -7101,22 +7347,22 @@ var Server = /*#__PURE__*/function () {
|
|
|
7101
7347
|
});
|
|
7102
7348
|
case 7:
|
|
7103
7349
|
if (!(!this.order || typeof this.order.upsertPendingSyncOrders !== 'function')) {
|
|
7104
|
-
|
|
7350
|
+
_context73.next = 10;
|
|
7105
7351
|
break;
|
|
7106
7352
|
}
|
|
7107
7353
|
this.logError("".concat(title, ": Order \u6A21\u5757\u4E0D\u652F\u6301\u672C\u5730\u5F85\u540C\u6B65\u5199\u5165"), {
|
|
7108
7354
|
backendPath: backendPath,
|
|
7109
7355
|
reason: reason
|
|
7110
7356
|
});
|
|
7111
|
-
return
|
|
7357
|
+
return _context73.abrupt("return", {
|
|
7112
7358
|
code: 500,
|
|
7113
7359
|
status: false,
|
|
7114
7360
|
message: 'Order 模块不支持本地待同步写入',
|
|
7115
7361
|
data: null
|
|
7116
7362
|
});
|
|
7117
7363
|
case 10:
|
|
7118
|
-
|
|
7119
|
-
|
|
7364
|
+
_context73.prev = 10;
|
|
7365
|
+
_context73.next = 13;
|
|
7120
7366
|
return this.order.upsertPendingSyncOrders([pendingOrder]);
|
|
7121
7367
|
case 13:
|
|
7122
7368
|
this.logInfo("".concat(title, ": \u8BA2\u5355\u5DF2\u5199\u5165\u672C\u5730\u5F85\u540C\u6B65"), {
|
|
@@ -7128,9 +7374,9 @@ var Server = /*#__PURE__*/function () {
|
|
|
7128
7374
|
});
|
|
7129
7375
|
changeGivenAmount = pendingOrder === null || pendingOrder === void 0 || (_pendingOrder$payment = pendingOrder.payments) === null || _pendingOrder$payment === void 0 ? void 0 : _pendingOrder$payment.reduce(function (sum, payment) {
|
|
7130
7376
|
var _payment$metadata;
|
|
7131
|
-
return sum +
|
|
7377
|
+
return sum + _this20.toAmountNumber(payment === null || payment === void 0 || (_payment$metadata = payment.metadata) === null || _payment$metadata === void 0 ? void 0 : _payment$metadata.change_given_amount);
|
|
7132
7378
|
}, 0);
|
|
7133
|
-
return
|
|
7379
|
+
return _context73.abrupt("return", {
|
|
7134
7380
|
code: 200,
|
|
7135
7381
|
status: true,
|
|
7136
7382
|
message: '',
|
|
@@ -7145,15 +7391,15 @@ var Server = /*#__PURE__*/function () {
|
|
|
7145
7391
|
})
|
|
7146
7392
|
});
|
|
7147
7393
|
case 18:
|
|
7148
|
-
|
|
7149
|
-
|
|
7150
|
-
errorMessage =
|
|
7394
|
+
_context73.prev = 18;
|
|
7395
|
+
_context73.t0 = _context73["catch"](10);
|
|
7396
|
+
errorMessage = _context73.t0 instanceof Error ? _context73.t0.message : String(_context73.t0);
|
|
7151
7397
|
this.logError("".concat(title, ": \u5199\u5165\u672C\u5730\u5F85\u540C\u6B65\u8BA2\u5355\u5931\u8D25"), {
|
|
7152
7398
|
backendPath: backendPath,
|
|
7153
7399
|
reason: reason,
|
|
7154
7400
|
error: errorMessage
|
|
7155
7401
|
});
|
|
7156
|
-
return
|
|
7402
|
+
return _context73.abrupt("return", {
|
|
7157
7403
|
code: 500,
|
|
7158
7404
|
status: false,
|
|
7159
7405
|
message: errorMessage,
|
|
@@ -7161,11 +7407,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
7161
7407
|
});
|
|
7162
7408
|
case 23:
|
|
7163
7409
|
case "end":
|
|
7164
|
-
return
|
|
7410
|
+
return _context73.stop();
|
|
7165
7411
|
}
|
|
7166
|
-
},
|
|
7412
|
+
}, _callee73, this, [[10, 18]]);
|
|
7167
7413
|
}));
|
|
7168
|
-
function handlePendingSyncCheckoutOrder(
|
|
7414
|
+
function handlePendingSyncCheckoutOrder(_x82) {
|
|
7169
7415
|
return _handlePendingSyncCheckoutOrder.apply(this, arguments);
|
|
7170
7416
|
}
|
|
7171
7417
|
return handlePendingSyncCheckoutOrder;
|
|
@@ -7173,45 +7419,45 @@ var Server = /*#__PURE__*/function () {
|
|
|
7173
7419
|
}, {
|
|
7174
7420
|
key: "buildPendingSyncCheckoutOrder",
|
|
7175
7421
|
value: function () {
|
|
7176
|
-
var _buildPendingSyncCheckoutOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
7422
|
+
var _buildPendingSyncCheckoutOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee74(data, invoiceTemplateSettings) {
|
|
7177
7423
|
var hasStorageKey, pendingOrder, productMap, orderWithProductTitles;
|
|
7178
|
-
return _regeneratorRuntime().wrap(function
|
|
7179
|
-
while (1) switch (
|
|
7424
|
+
return _regeneratorRuntime().wrap(function _callee74$(_context74) {
|
|
7425
|
+
while (1) switch (_context74.prev = _context74.next) {
|
|
7180
7426
|
case 0:
|
|
7181
7427
|
if (!(!data || _typeof(data) !== 'object')) {
|
|
7182
|
-
|
|
7428
|
+
_context74.next = 2;
|
|
7183
7429
|
break;
|
|
7184
7430
|
}
|
|
7185
|
-
return
|
|
7431
|
+
return _context74.abrupt("return", null);
|
|
7186
7432
|
case 2:
|
|
7187
7433
|
hasStorageKey = data.external_sale_number !== undefined && data.external_sale_number !== null && data.external_sale_number !== '' ? true : data.order_id !== undefined && data.order_id !== null && data.order_id !== '';
|
|
7188
7434
|
if (hasStorageKey) {
|
|
7189
|
-
|
|
7435
|
+
_context74.next = 5;
|
|
7190
7436
|
break;
|
|
7191
7437
|
}
|
|
7192
|
-
return
|
|
7438
|
+
return _context74.abrupt("return", null);
|
|
7193
7439
|
case 5:
|
|
7194
7440
|
pendingOrder = this.normalizeCheckoutCollections(_objectSpread(_objectSpread({}, data), {}, {
|
|
7195
7441
|
need_sync: 1,
|
|
7196
7442
|
is_draft_order: 0
|
|
7197
7443
|
}));
|
|
7198
|
-
|
|
7444
|
+
_context74.next = 8;
|
|
7199
7445
|
return this.buildSmallTicketProductMap(pendingOrder);
|
|
7200
7446
|
case 8:
|
|
7201
|
-
productMap =
|
|
7447
|
+
productMap = _context74.sent;
|
|
7202
7448
|
orderWithProductTitles = this.withPendingSyncProductTitles(pendingOrder, productMap);
|
|
7203
|
-
return
|
|
7449
|
+
return _context74.abrupt("return", this.withLocalSmallTicketData(orderWithProductTitles, {
|
|
7204
7450
|
requireFullyPaid: true,
|
|
7205
7451
|
productMap: productMap,
|
|
7206
7452
|
invoiceTemplateSettings: invoiceTemplateSettings
|
|
7207
7453
|
}));
|
|
7208
7454
|
case 11:
|
|
7209
7455
|
case "end":
|
|
7210
|
-
return
|
|
7456
|
+
return _context74.stop();
|
|
7211
7457
|
}
|
|
7212
|
-
},
|
|
7458
|
+
}, _callee74, this);
|
|
7213
7459
|
}));
|
|
7214
|
-
function buildPendingSyncCheckoutOrder(
|
|
7460
|
+
function buildPendingSyncCheckoutOrder(_x83, _x84) {
|
|
7215
7461
|
return _buildPendingSyncCheckoutOrder.apply(this, arguments);
|
|
7216
7462
|
}
|
|
7217
7463
|
return buildPendingSyncCheckoutOrder;
|
|
@@ -7248,11 +7494,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
7248
7494
|
}, {
|
|
7249
7495
|
key: "shouldAutoPrintReceiptForPaymentStatus",
|
|
7250
7496
|
value: function shouldAutoPrintReceiptForPaymentStatus(order, statuses) {
|
|
7251
|
-
var
|
|
7497
|
+
var _this21 = this;
|
|
7252
7498
|
if (statuses === undefined) return this.isSalesOrderFullyPaid(order);
|
|
7253
7499
|
var paymentStatus = String((order === null || order === void 0 ? void 0 : order.payment_status) || '').toLowerCase();
|
|
7254
7500
|
return statuses.some(function (status) {
|
|
7255
|
-
return status === 'paid' ?
|
|
7501
|
+
return status === 'paid' ? _this21.isSalesOrderFullyPaid(order) : paymentStatus === status;
|
|
7256
7502
|
});
|
|
7257
7503
|
}
|
|
7258
7504
|
}, {
|
|
@@ -7281,32 +7527,32 @@ var Server = /*#__PURE__*/function () {
|
|
|
7281
7527
|
}, {
|
|
7282
7528
|
key: "isSalesOrderFullyPaid",
|
|
7283
7529
|
value: function isSalesOrderFullyPaid(order) {
|
|
7284
|
-
var _order$summary$amount, _order$
|
|
7530
|
+
var _order$summary$amount, _order$summary3, _ref77, _ref78, _order$summary$expect, _order$summary4, _order$summary5;
|
|
7285
7531
|
if (!order || _typeof(order) !== 'object') return false;
|
|
7286
7532
|
var paymentStatus = String(order.payment_status || '').toLowerCase();
|
|
7287
7533
|
if (paymentStatus === 'paid' || paymentStatus === 'finished') return true;
|
|
7288
7534
|
if (paymentStatus === 'partially_paid' || paymentStatus === 'payment_processing' || paymentStatus === 'pending' || paymentStatus === 'unpaid') {
|
|
7289
7535
|
return false;
|
|
7290
7536
|
}
|
|
7291
|
-
var amountGap = (_order$summary$amount = (_order$
|
|
7537
|
+
var amountGap = (_order$summary$amount = (_order$summary3 = order.summary) === null || _order$summary3 === void 0 ? void 0 : _order$summary3.amount_gap) !== null && _order$summary$amount !== void 0 ? _order$summary$amount : order.amount_gap;
|
|
7292
7538
|
if (amountGap !== undefined && amountGap !== null && amountGap !== '') {
|
|
7293
7539
|
return this.toAmountNumber(amountGap) <= 0;
|
|
7294
7540
|
}
|
|
7295
7541
|
var paidAmount = this.sumPaidOrderPayments(order.payments);
|
|
7296
|
-
var targetAmount = this.toAmountNumber((
|
|
7542
|
+
var targetAmount = this.toAmountNumber((_ref77 = (_ref78 = (_order$summary$expect = (_order$summary4 = order.summary) === null || _order$summary4 === void 0 ? void 0 : _order$summary4.expect_amount) !== null && _order$summary$expect !== void 0 ? _order$summary$expect : (_order$summary5 = order.summary) === null || _order$summary5 === void 0 ? void 0 : _order$summary5.total_amount) !== null && _ref78 !== void 0 ? _ref78 : order.expect_amount) !== null && _ref77 !== void 0 ? _ref77 : order.total_amount);
|
|
7297
7543
|
if (targetAmount <= 0) return paidAmount > 0;
|
|
7298
7544
|
return paidAmount >= targetAmount;
|
|
7299
7545
|
}
|
|
7300
7546
|
}, {
|
|
7301
7547
|
key: "sumPaidOrderPayments",
|
|
7302
7548
|
value: function sumPaidOrderPayments(payments) {
|
|
7303
|
-
var
|
|
7549
|
+
var _this22 = this;
|
|
7304
7550
|
if (!Array.isArray(payments)) return 0;
|
|
7305
7551
|
return payments.reduce(function (sum, payment) {
|
|
7306
7552
|
var _payment$amount;
|
|
7307
7553
|
var status = String((payment === null || payment === void 0 ? void 0 : payment.status) || '').toLowerCase();
|
|
7308
7554
|
if (status !== 'paid') return sum;
|
|
7309
|
-
return sum +
|
|
7555
|
+
return sum + _this22.toAmountNumber((_payment$amount = payment === null || payment === void 0 ? void 0 : payment.amount) !== null && _payment$amount !== void 0 ? _payment$amount : payment === null || payment === void 0 ? void 0 : payment.origin_amount);
|
|
7310
7556
|
}, 0);
|
|
7311
7557
|
}
|
|
7312
7558
|
}, {
|
|
@@ -7320,12 +7566,12 @@ var Server = /*#__PURE__*/function () {
|
|
|
7320
7566
|
}, {
|
|
7321
7567
|
key: "buildSmallTicketProductMap",
|
|
7322
7568
|
value: function () {
|
|
7323
|
-
var _buildSmallTicketProductMap = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
7569
|
+
var _buildSmallTicketProductMap = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee76(order) {
|
|
7324
7570
|
var _this$products3,
|
|
7325
|
-
|
|
7571
|
+
_this23 = this;
|
|
7326
7572
|
var products, productIdSet, productIds, entries;
|
|
7327
|
-
return _regeneratorRuntime().wrap(function
|
|
7328
|
-
while (1) switch (
|
|
7573
|
+
return _regeneratorRuntime().wrap(function _callee76$(_context76) {
|
|
7574
|
+
while (1) switch (_context76.prev = _context76.next) {
|
|
7329
7575
|
case 0:
|
|
7330
7576
|
products = Array.isArray(order === null || order === void 0 ? void 0 : order.products) ? order.products : [];
|
|
7331
7577
|
productIdSet = new Set();
|
|
@@ -7337,8 +7583,8 @@ var Server = /*#__PURE__*/function () {
|
|
|
7337
7583
|
}
|
|
7338
7584
|
if (Array.isArray(product === null || product === void 0 ? void 0 : product.product_bundle)) {
|
|
7339
7585
|
product.product_bundle.forEach(function (bundle) {
|
|
7340
|
-
var
|
|
7341
|
-
var bundleProductId = (
|
|
7586
|
+
var _ref79, _bundle$bundle_produc;
|
|
7587
|
+
var bundleProductId = (_ref79 = (_bundle$bundle_produc = bundle === null || bundle === void 0 ? void 0 : bundle.bundle_product_id) !== null && _bundle$bundle_produc !== void 0 ? _bundle$bundle_produc : bundle === null || bundle === void 0 ? void 0 : bundle._bundle_product_id) !== null && _ref79 !== void 0 ? _ref79 : bundle === null || bundle === void 0 ? void 0 : bundle.product_id;
|
|
7342
7588
|
if (bundleProductId !== undefined && bundleProductId !== null && bundleProductId !== '') {
|
|
7343
7589
|
productIdSet.add(bundleProductId);
|
|
7344
7590
|
}
|
|
@@ -7347,45 +7593,45 @@ var Server = /*#__PURE__*/function () {
|
|
|
7347
7593
|
});
|
|
7348
7594
|
productIds = Array.from(productIdSet);
|
|
7349
7595
|
if (!(!productIds.length || typeof ((_this$products3 = this.products) === null || _this$products3 === void 0 ? void 0 : _this$products3.getProductById) !== 'function')) {
|
|
7350
|
-
|
|
7596
|
+
_context76.next = 6;
|
|
7351
7597
|
break;
|
|
7352
7598
|
}
|
|
7353
|
-
return
|
|
7599
|
+
return _context76.abrupt("return", {});
|
|
7354
7600
|
case 6:
|
|
7355
|
-
|
|
7601
|
+
_context76.next = 8;
|
|
7356
7602
|
return Promise.all(productIds.map( /*#__PURE__*/function () {
|
|
7357
|
-
var
|
|
7358
|
-
var
|
|
7359
|
-
return _regeneratorRuntime().wrap(function
|
|
7360
|
-
while (1) switch (
|
|
7603
|
+
var _ref80 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee75(id) {
|
|
7604
|
+
var _this23$products, _this23$products$getP, product;
|
|
7605
|
+
return _regeneratorRuntime().wrap(function _callee75$(_context75) {
|
|
7606
|
+
while (1) switch (_context75.prev = _context75.next) {
|
|
7361
7607
|
case 0:
|
|
7362
|
-
|
|
7363
|
-
|
|
7364
|
-
return (
|
|
7608
|
+
_context75.prev = 0;
|
|
7609
|
+
_context75.next = 3;
|
|
7610
|
+
return (_this23$products = _this23.products) === null || _this23$products === void 0 || (_this23$products$getP = _this23$products.getProductById) === null || _this23$products$getP === void 0 ? void 0 : _this23$products$getP.call(_this23$products, Number(id));
|
|
7365
7611
|
case 3:
|
|
7366
|
-
product =
|
|
7367
|
-
return
|
|
7612
|
+
product = _context75.sent;
|
|
7613
|
+
return _context75.abrupt("return", product ? [String(id), product] : null);
|
|
7368
7614
|
case 7:
|
|
7369
|
-
|
|
7370
|
-
|
|
7371
|
-
|
|
7615
|
+
_context75.prev = 7;
|
|
7616
|
+
_context75.t0 = _context75["catch"](0);
|
|
7617
|
+
_this23.logWarning('buildSmallTicketProductMap: 查询本地商品失败', {
|
|
7372
7618
|
product_id: id,
|
|
7373
|
-
error:
|
|
7619
|
+
error: _context75.t0 instanceof Error ? _context75.t0.message : String(_context75.t0)
|
|
7374
7620
|
});
|
|
7375
|
-
return
|
|
7621
|
+
return _context75.abrupt("return", null);
|
|
7376
7622
|
case 11:
|
|
7377
7623
|
case "end":
|
|
7378
|
-
return
|
|
7624
|
+
return _context75.stop();
|
|
7379
7625
|
}
|
|
7380
|
-
},
|
|
7626
|
+
}, _callee75, null, [[0, 7]]);
|
|
7381
7627
|
}));
|
|
7382
|
-
return function (
|
|
7383
|
-
return
|
|
7628
|
+
return function (_x86) {
|
|
7629
|
+
return _ref80.apply(this, arguments);
|
|
7384
7630
|
};
|
|
7385
7631
|
}()));
|
|
7386
7632
|
case 8:
|
|
7387
|
-
entries =
|
|
7388
|
-
return
|
|
7633
|
+
entries = _context76.sent;
|
|
7634
|
+
return _context76.abrupt("return", entries.reduce(function (map, entry) {
|
|
7389
7635
|
if (!entry) return map;
|
|
7390
7636
|
var _entry = _slicedToArray(entry, 2),
|
|
7391
7637
|
id = _entry[0],
|
|
@@ -7395,11 +7641,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
7395
7641
|
}, {}));
|
|
7396
7642
|
case 10:
|
|
7397
7643
|
case "end":
|
|
7398
|
-
return
|
|
7644
|
+
return _context76.stop();
|
|
7399
7645
|
}
|
|
7400
|
-
},
|
|
7646
|
+
}, _callee76, this);
|
|
7401
7647
|
}));
|
|
7402
|
-
function buildSmallTicketProductMap(
|
|
7648
|
+
function buildSmallTicketProductMap(_x85) {
|
|
7403
7649
|
return _buildSmallTicketProductMap.apply(this, arguments);
|
|
7404
7650
|
}
|
|
7405
7651
|
return buildSmallTicketProductMap;
|
|
@@ -7419,8 +7665,8 @@ var Server = /*#__PURE__*/function () {
|
|
|
7419
7665
|
addProductId((_product$product_id2 = product === null || product === void 0 ? void 0 : product.product_id) !== null && _product$product_id2 !== void 0 ? _product$product_id2 : product === null || product === void 0 ? void 0 : product.id);
|
|
7420
7666
|
if (Array.isArray(product === null || product === void 0 ? void 0 : product.product_bundle)) {
|
|
7421
7667
|
product.product_bundle.forEach(function (bundle) {
|
|
7422
|
-
var
|
|
7423
|
-
addProductId((
|
|
7668
|
+
var _ref81, _bundle$bundle_produc2;
|
|
7669
|
+
addProductId((_ref81 = (_bundle$bundle_produc2 = bundle === null || bundle === void 0 ? void 0 : bundle.bundle_product_id) !== null && _bundle$bundle_produc2 !== void 0 ? _bundle$bundle_produc2 : bundle === null || bundle === void 0 ? void 0 : bundle._bundle_product_id) !== null && _ref81 !== void 0 ? _ref81 : bundle === null || bundle === void 0 ? void 0 : bundle.product_id);
|
|
7424
7670
|
});
|
|
7425
7671
|
}
|
|
7426
7672
|
});
|
|
@@ -7429,40 +7675,40 @@ var Server = /*#__PURE__*/function () {
|
|
|
7429
7675
|
}, {
|
|
7430
7676
|
key: "buildSalesDetailProductSnapshotMap",
|
|
7431
7677
|
value: function () {
|
|
7432
|
-
var _buildSalesDetailProductSnapshotMap = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
7678
|
+
var _buildSalesDetailProductSnapshotMap = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee77(order) {
|
|
7433
7679
|
var _this$products4;
|
|
7434
7680
|
var productIds, getSnapshots;
|
|
7435
|
-
return _regeneratorRuntime().wrap(function
|
|
7436
|
-
while (1) switch (
|
|
7681
|
+
return _regeneratorRuntime().wrap(function _callee77$(_context77) {
|
|
7682
|
+
while (1) switch (_context77.prev = _context77.next) {
|
|
7437
7683
|
case 0:
|
|
7438
7684
|
productIds = this.collectSalesDetailProductIds(order);
|
|
7439
7685
|
getSnapshots = (_this$products4 = this.products) === null || _this$products4 === void 0 ? void 0 : _this$products4.getProductSnapshotsByIds;
|
|
7440
7686
|
if (!(!productIds.length || typeof getSnapshots !== 'function')) {
|
|
7441
|
-
|
|
7687
|
+
_context77.next = 4;
|
|
7442
7688
|
break;
|
|
7443
7689
|
}
|
|
7444
|
-
return
|
|
7690
|
+
return _context77.abrupt("return", {});
|
|
7445
7691
|
case 4:
|
|
7446
|
-
|
|
7447
|
-
|
|
7692
|
+
_context77.prev = 4;
|
|
7693
|
+
_context77.next = 7;
|
|
7448
7694
|
return getSnapshots.call(this.products, productIds);
|
|
7449
7695
|
case 7:
|
|
7450
|
-
return
|
|
7696
|
+
return _context77.abrupt("return", _context77.sent);
|
|
7451
7697
|
case 10:
|
|
7452
|
-
|
|
7453
|
-
|
|
7698
|
+
_context77.prev = 10;
|
|
7699
|
+
_context77.t0 = _context77["catch"](4);
|
|
7454
7700
|
this.logWarning('buildSalesDetailProductSnapshotMap: 查询本地商品快照失败', {
|
|
7455
7701
|
product_ids: productIds,
|
|
7456
|
-
error:
|
|
7702
|
+
error: _context77.t0 instanceof Error ? _context77.t0.message : String(_context77.t0)
|
|
7457
7703
|
});
|
|
7458
|
-
return
|
|
7704
|
+
return _context77.abrupt("return", {});
|
|
7459
7705
|
case 14:
|
|
7460
7706
|
case "end":
|
|
7461
|
-
return
|
|
7707
|
+
return _context77.stop();
|
|
7462
7708
|
}
|
|
7463
|
-
},
|
|
7709
|
+
}, _callee77, this, [[4, 10]]);
|
|
7464
7710
|
}));
|
|
7465
|
-
function buildSalesDetailProductSnapshotMap(
|
|
7711
|
+
function buildSalesDetailProductSnapshotMap(_x87) {
|
|
7466
7712
|
return _buildSalesDetailProductSnapshotMap.apply(this, arguments);
|
|
7467
7713
|
}
|
|
7468
7714
|
return buildSalesDetailProductSnapshotMap;
|
|
@@ -7496,9 +7742,9 @@ var Server = /*#__PURE__*/function () {
|
|
|
7496
7742
|
if (!Array.isArray(product === null || product === void 0 ? void 0 : product.product_bundle)) return product;
|
|
7497
7743
|
var hasChanged = false;
|
|
7498
7744
|
var productBundle = product.product_bundle.map(function (bundle) {
|
|
7499
|
-
var
|
|
7745
|
+
var _ref82, _bundle$bundle_produc3;
|
|
7500
7746
|
if (!bundle || _typeof(bundle) !== 'object') return bundle;
|
|
7501
|
-
var rawProductId = (
|
|
7747
|
+
var rawProductId = (_ref82 = (_bundle$bundle_produc3 = bundle === null || bundle === void 0 ? void 0 : bundle.bundle_product_id) !== null && _bundle$bundle_produc3 !== void 0 ? _bundle$bundle_produc3 : bundle === null || bundle === void 0 ? void 0 : bundle._bundle_product_id) !== null && _ref82 !== void 0 ? _ref82 : bundle === null || bundle === void 0 ? void 0 : bundle.product_id;
|
|
7502
7748
|
if (rawProductId === undefined || rawProductId === null || rawProductId === '') return bundle;
|
|
7503
7749
|
var productId = Number(rawProductId);
|
|
7504
7750
|
if (!Number.isFinite(productId)) return bundle;
|
|
@@ -7518,53 +7764,53 @@ var Server = /*#__PURE__*/function () {
|
|
|
7518
7764
|
}, {
|
|
7519
7765
|
key: "withSalesDetailProductSnapshots",
|
|
7520
7766
|
value: function () {
|
|
7521
|
-
var _withSalesDetailProductSnapshots = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
7522
|
-
var
|
|
7767
|
+
var _withSalesDetailProductSnapshots = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee78(order) {
|
|
7768
|
+
var _this24 = this;
|
|
7523
7769
|
var products, snapshotMap, hasChanged, enrichedProducts, enrichedOrder;
|
|
7524
|
-
return _regeneratorRuntime().wrap(function
|
|
7525
|
-
while (1) switch (
|
|
7770
|
+
return _regeneratorRuntime().wrap(function _callee78$(_context78) {
|
|
7771
|
+
while (1) switch (_context78.prev = _context78.next) {
|
|
7526
7772
|
case 0:
|
|
7527
7773
|
products = Array.isArray(order === null || order === void 0 ? void 0 : order.products) ? order.products : null;
|
|
7528
7774
|
if (products !== null && products !== void 0 && products.length) {
|
|
7529
|
-
|
|
7775
|
+
_context78.next = 3;
|
|
7530
7776
|
break;
|
|
7531
7777
|
}
|
|
7532
|
-
return
|
|
7778
|
+
return _context78.abrupt("return", order);
|
|
7533
7779
|
case 3:
|
|
7534
|
-
|
|
7780
|
+
_context78.next = 5;
|
|
7535
7781
|
return this.buildSalesDetailProductSnapshotMap(order);
|
|
7536
7782
|
case 5:
|
|
7537
|
-
snapshotMap =
|
|
7783
|
+
snapshotMap = _context78.sent;
|
|
7538
7784
|
if (Object.keys(snapshotMap).length) {
|
|
7539
|
-
|
|
7785
|
+
_context78.next = 8;
|
|
7540
7786
|
break;
|
|
7541
7787
|
}
|
|
7542
|
-
return
|
|
7788
|
+
return _context78.abrupt("return", order);
|
|
7543
7789
|
case 8:
|
|
7544
7790
|
hasChanged = false;
|
|
7545
7791
|
enrichedProducts = products.map(function (product) {
|
|
7546
|
-
var productWithBundleSnapshots =
|
|
7547
|
-
var nextProduct =
|
|
7792
|
+
var productWithBundleSnapshots = _this24.withBundleCatalogSnapshots(product, snapshotMap);
|
|
7793
|
+
var nextProduct = _this24.withProductCatalogSnapshots(productWithBundleSnapshots, snapshotMap);
|
|
7548
7794
|
if (nextProduct !== product) hasChanged = true;
|
|
7549
7795
|
return nextProduct;
|
|
7550
7796
|
});
|
|
7551
7797
|
if (hasChanged) {
|
|
7552
|
-
|
|
7798
|
+
_context78.next = 12;
|
|
7553
7799
|
break;
|
|
7554
7800
|
}
|
|
7555
|
-
return
|
|
7801
|
+
return _context78.abrupt("return", order);
|
|
7556
7802
|
case 12:
|
|
7557
7803
|
enrichedOrder = _objectSpread(_objectSpread({}, order), {}, {
|
|
7558
7804
|
products: enrichedProducts
|
|
7559
7805
|
});
|
|
7560
|
-
return
|
|
7806
|
+
return _context78.abrupt("return", enrichedOrder);
|
|
7561
7807
|
case 14:
|
|
7562
7808
|
case "end":
|
|
7563
|
-
return
|
|
7809
|
+
return _context78.stop();
|
|
7564
7810
|
}
|
|
7565
|
-
},
|
|
7811
|
+
}, _callee78, this);
|
|
7566
7812
|
}));
|
|
7567
|
-
function withSalesDetailProductSnapshots(
|
|
7813
|
+
function withSalesDetailProductSnapshots(_x88) {
|
|
7568
7814
|
return _withSalesDetailProductSnapshots.apply(this, arguments);
|
|
7569
7815
|
}
|
|
7570
7816
|
return withSalesDetailProductSnapshots;
|
|
@@ -7572,13 +7818,13 @@ var Server = /*#__PURE__*/function () {
|
|
|
7572
7818
|
}, {
|
|
7573
7819
|
key: "withPendingSyncProductTitles",
|
|
7574
7820
|
value: function withPendingSyncProductTitles(order, productMap) {
|
|
7575
|
-
var
|
|
7821
|
+
var _this25 = this;
|
|
7576
7822
|
var products = Array.isArray(order.products) ? order.products : null;
|
|
7577
7823
|
if (!(products !== null && products !== void 0 && products.length)) return order;
|
|
7578
7824
|
return _objectSpread(_objectSpread({}, order), {}, {
|
|
7579
7825
|
products: products.map(function (product) {
|
|
7580
7826
|
return _objectSpread(_objectSpread({}, product), {}, {
|
|
7581
|
-
product_title:
|
|
7827
|
+
product_title: _this25.buildProductTitleSnapshot(product, productMap)
|
|
7582
7828
|
});
|
|
7583
7829
|
})
|
|
7584
7830
|
});
|
|
@@ -7589,7 +7835,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
7589
7835
|
var _product$product_id4,
|
|
7590
7836
|
_product$product,
|
|
7591
7837
|
_fallbackProduct$prod,
|
|
7592
|
-
|
|
7838
|
+
_this26 = this;
|
|
7593
7839
|
var productId = (_product$product_id4 = product.product_id) !== null && _product$product_id4 !== void 0 ? _product$product_id4 : product.id;
|
|
7594
7840
|
var fallbackProduct = productId !== undefined && productId !== null ? productMap[productId] || productMap[String(productId)] : null;
|
|
7595
7841
|
var ownTitle = product.product_title || product.title || product.name || ((_product$product = product.product) === null || _product$product === void 0 ? void 0 : _product$product.title);
|
|
@@ -7597,7 +7843,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
7597
7843
|
var currentLocale = this.getProductTitleSnapshotCurrentLocale();
|
|
7598
7844
|
var autoTitle = this.resolveFirstProductTitleValue(ownTitle) || this.resolveFirstProductTitleValue(fallbackTitle);
|
|
7599
7845
|
return PRODUCT_TITLE_SNAPSHOT_KEYS.reduce(function (snapshot, key) {
|
|
7600
|
-
snapshot[key] =
|
|
7846
|
+
snapshot[key] = _this26.resolveProductTitleValue(ownTitle, key, currentLocale) || _this26.resolveProductTitleValue(fallbackTitle, key, currentLocale) || (key === 'auto' || key === 'original' ? autoTitle : null);
|
|
7601
7847
|
return snapshot;
|
|
7602
7848
|
}, {});
|
|
7603
7849
|
}
|
|
@@ -7622,7 +7868,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
7622
7868
|
}, {
|
|
7623
7869
|
key: "resolveProductTitleValue",
|
|
7624
7870
|
value: function resolveProductTitleValue(value, key, currentLocale) {
|
|
7625
|
-
var
|
|
7871
|
+
var _ref83, _ref84, _value$key;
|
|
7626
7872
|
if (value === undefined || value === null || value === '') return null;
|
|
7627
7873
|
if (_typeof(value) !== 'object') {
|
|
7628
7874
|
var title = String(value);
|
|
@@ -7632,7 +7878,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
7632
7878
|
}
|
|
7633
7879
|
var normalizedKey = key.replace('-', '_');
|
|
7634
7880
|
var dashedKey = key.replace('_', '-');
|
|
7635
|
-
var rawValue = (
|
|
7881
|
+
var rawValue = (_ref83 = (_ref84 = (_value$key = value[key]) !== null && _value$key !== void 0 ? _value$key : value[normalizedKey]) !== null && _ref84 !== void 0 ? _ref84 : value[dashedKey]) !== null && _ref83 !== void 0 ? _ref83 : key === 'auto' ? value.default : undefined;
|
|
7636
7882
|
if (rawValue === undefined || rawValue === null || rawValue === '') return null;
|
|
7637
7883
|
if (_typeof(rawValue) === 'object') return this.resolveFirstProductTitleValue(rawValue);
|
|
7638
7884
|
return String(rawValue);
|
|
@@ -7695,31 +7941,31 @@ var Server = /*#__PURE__*/function () {
|
|
|
7695
7941
|
}, {
|
|
7696
7942
|
key: "enrichPaymentNamesByCode",
|
|
7697
7943
|
value: function () {
|
|
7698
|
-
var _enrichPaymentNamesByCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
7699
|
-
var
|
|
7944
|
+
var _enrichPaymentNamesByCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee79(order) {
|
|
7945
|
+
var _this27 = this;
|
|
7700
7946
|
var payments, hasMissingName, paymentModule, payMethods, nameByCode, _iterator12, _step12, method, codeKey, name, hasResolvedName, enrichedPayments;
|
|
7701
|
-
return _regeneratorRuntime().wrap(function
|
|
7702
|
-
while (1) switch (
|
|
7947
|
+
return _regeneratorRuntime().wrap(function _callee79$(_context79) {
|
|
7948
|
+
while (1) switch (_context79.prev = _context79.next) {
|
|
7703
7949
|
case 0:
|
|
7704
7950
|
payments = Array.isArray(order === null || order === void 0 ? void 0 : order.payments) ? order.payments : [];
|
|
7705
7951
|
hasMissingName = payments.some(function (payment) {
|
|
7706
|
-
return
|
|
7952
|
+
return _this27.isBlankPaymentName(payment === null || payment === void 0 ? void 0 : payment.name) && _this27.shouldLookupPaymentMethodNameByCode(payment === null || payment === void 0 ? void 0 : payment.code);
|
|
7707
7953
|
});
|
|
7708
7954
|
if (hasMissingName) {
|
|
7709
|
-
|
|
7955
|
+
_context79.next = 4;
|
|
7710
7956
|
break;
|
|
7711
7957
|
}
|
|
7712
|
-
return
|
|
7958
|
+
return _context79.abrupt("return", order);
|
|
7713
7959
|
case 4:
|
|
7714
|
-
|
|
7715
|
-
|
|
7960
|
+
_context79.prev = 4;
|
|
7961
|
+
_context79.next = 7;
|
|
7716
7962
|
return this.getPaymentRouteModule();
|
|
7717
7963
|
case 7:
|
|
7718
|
-
paymentModule =
|
|
7719
|
-
|
|
7964
|
+
paymentModule = _context79.sent;
|
|
7965
|
+
_context79.next = 10;
|
|
7720
7966
|
return paymentModule.getPayMethodListAsync();
|
|
7721
7967
|
case 10:
|
|
7722
|
-
payMethods =
|
|
7968
|
+
payMethods = _context79.sent;
|
|
7723
7969
|
nameByCode = new Map();
|
|
7724
7970
|
_iterator12 = _createForOfIteratorHelper(payMethods || []);
|
|
7725
7971
|
try {
|
|
@@ -7736,9 +7982,9 @@ var Server = /*#__PURE__*/function () {
|
|
|
7736
7982
|
}
|
|
7737
7983
|
hasResolvedName = false;
|
|
7738
7984
|
enrichedPayments = payments.map(function (payment) {
|
|
7739
|
-
if (!
|
|
7740
|
-
if (!
|
|
7741
|
-
var name = nameByCode.get(
|
|
7985
|
+
if (!_this27.isBlankPaymentName(payment === null || payment === void 0 ? void 0 : payment.name)) return payment;
|
|
7986
|
+
if (!_this27.shouldLookupPaymentMethodNameByCode(payment === null || payment === void 0 ? void 0 : payment.code)) return payment;
|
|
7987
|
+
var name = nameByCode.get(_this27.getPaymentCodeKey(payment === null || payment === void 0 ? void 0 : payment.code));
|
|
7742
7988
|
if (!name) return payment;
|
|
7743
7989
|
hasResolvedName = true;
|
|
7744
7990
|
return _objectSpread(_objectSpread({}, payment), {}, {
|
|
@@ -7746,28 +7992,28 @@ var Server = /*#__PURE__*/function () {
|
|
|
7746
7992
|
});
|
|
7747
7993
|
});
|
|
7748
7994
|
if (hasResolvedName) {
|
|
7749
|
-
|
|
7995
|
+
_context79.next = 18;
|
|
7750
7996
|
break;
|
|
7751
7997
|
}
|
|
7752
|
-
return
|
|
7998
|
+
return _context79.abrupt("return", order);
|
|
7753
7999
|
case 18:
|
|
7754
|
-
return
|
|
8000
|
+
return _context79.abrupt("return", _objectSpread(_objectSpread({}, order), {}, {
|
|
7755
8001
|
payments: enrichedPayments
|
|
7756
8002
|
}));
|
|
7757
8003
|
case 21:
|
|
7758
|
-
|
|
7759
|
-
|
|
8004
|
+
_context79.prev = 21;
|
|
8005
|
+
_context79.t0 = _context79["catch"](4);
|
|
7760
8006
|
this.logWarning('enrichPaymentNamesByCode: 支付方式名称回填失败', {
|
|
7761
|
-
error:
|
|
8007
|
+
error: _context79.t0 instanceof Error ? _context79.t0.message : String(_context79.t0)
|
|
7762
8008
|
});
|
|
7763
|
-
return
|
|
8009
|
+
return _context79.abrupt("return", order);
|
|
7764
8010
|
case 25:
|
|
7765
8011
|
case "end":
|
|
7766
|
-
return
|
|
8012
|
+
return _context79.stop();
|
|
7767
8013
|
}
|
|
7768
|
-
},
|
|
8014
|
+
}, _callee79, this, [[4, 21]]);
|
|
7769
8015
|
}));
|
|
7770
|
-
function enrichPaymentNamesByCode(
|
|
8016
|
+
function enrichPaymentNamesByCode(_x89) {
|
|
7771
8017
|
return _enrichPaymentNamesByCode.apply(this, arguments);
|
|
7772
8018
|
}
|
|
7773
8019
|
return enrichPaymentNamesByCode;
|
|
@@ -7775,25 +8021,25 @@ var Server = /*#__PURE__*/function () {
|
|
|
7775
8021
|
}, {
|
|
7776
8022
|
key: "withLocalSmallTicketData",
|
|
7777
8023
|
value: function () {
|
|
7778
|
-
var _withLocalSmallTicketData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
7779
|
-
var mustApplyVisibility, _options$productMap, normalizedCollections, normalizedOrder, collapsedDuplicateCounts,
|
|
7780
|
-
return _regeneratorRuntime().wrap(function
|
|
7781
|
-
while (1) switch (
|
|
8024
|
+
var _withLocalSmallTicketData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee80(order, options) {
|
|
8025
|
+
var mustApplyVisibility, _options$productMap, normalizedCollections, normalizedOrder, collapsedDuplicateCounts, _ref85, _ref86, _order_id, receiptOrder, enrichedOrder, productMap, smallTicketData;
|
|
8026
|
+
return _regeneratorRuntime().wrap(function _callee80$(_context80) {
|
|
8027
|
+
while (1) switch (_context80.prev = _context80.next) {
|
|
7782
8028
|
case 0:
|
|
7783
8029
|
mustApplyVisibility = (options === null || options === void 0 ? void 0 : options.applyTemplateVisibility) === true && requiresInvoiceDataFiltering(options.invoiceTemplateSettings);
|
|
7784
8030
|
if (!(!this.shouldBuildSmallTicketData(order) && !mustApplyVisibility)) {
|
|
7785
|
-
|
|
8031
|
+
_context80.next = 3;
|
|
7786
8032
|
break;
|
|
7787
8033
|
}
|
|
7788
|
-
return
|
|
8034
|
+
return _context80.abrupt("return", order);
|
|
7789
8035
|
case 3:
|
|
7790
8036
|
if (!(options !== null && options !== void 0 && options.requireFullyPaid && !this.isSalesOrderFullyPaid(order))) {
|
|
7791
|
-
|
|
8037
|
+
_context80.next = 5;
|
|
7792
8038
|
break;
|
|
7793
8039
|
}
|
|
7794
|
-
return
|
|
8040
|
+
return _context80.abrupt("return", order);
|
|
7795
8041
|
case 5:
|
|
7796
|
-
|
|
8042
|
+
_context80.prev = 5;
|
|
7797
8043
|
normalizedCollections = normalizeOrderCollections(order, {
|
|
7798
8044
|
ensureUid: false
|
|
7799
8045
|
});
|
|
@@ -7807,42 +8053,42 @@ var Server = /*#__PURE__*/function () {
|
|
|
7807
8053
|
return count > 0;
|
|
7808
8054
|
})) {
|
|
7809
8055
|
this.logWarning('withLocalSmallTicketData: 折叠重复订单子项', {
|
|
7810
|
-
order_identifier: (
|
|
8056
|
+
order_identifier: (_ref85 = (_ref86 = (_order_id = normalizedOrder.order_id) !== null && _order_id !== void 0 ? _order_id : normalizedOrder.external_sale_number) !== null && _ref86 !== void 0 ? _ref86 : normalizedOrder.shop_order_number) !== null && _ref85 !== void 0 ? _ref85 : null,
|
|
7811
8057
|
collapsed_duplicate_counts: collapsedDuplicateCounts
|
|
7812
8058
|
});
|
|
7813
8059
|
}
|
|
7814
8060
|
if (!(options !== null && options !== void 0 && options.refreshResourceReference)) {
|
|
7815
|
-
|
|
8061
|
+
_context80.next = 16;
|
|
7816
8062
|
break;
|
|
7817
8063
|
}
|
|
7818
|
-
|
|
8064
|
+
_context80.next = 13;
|
|
7819
8065
|
return this.withCurrentReceiptResourceReference(normalizedOrder);
|
|
7820
8066
|
case 13:
|
|
7821
|
-
|
|
7822
|
-
|
|
8067
|
+
_context80.t0 = _context80.sent;
|
|
8068
|
+
_context80.next = 17;
|
|
7823
8069
|
break;
|
|
7824
8070
|
case 16:
|
|
7825
|
-
|
|
8071
|
+
_context80.t0 = normalizedOrder;
|
|
7826
8072
|
case 17:
|
|
7827
|
-
receiptOrder =
|
|
7828
|
-
|
|
8073
|
+
receiptOrder = _context80.t0;
|
|
8074
|
+
_context80.next = 20;
|
|
7829
8075
|
return this.enrichPaymentNamesByCode(receiptOrder);
|
|
7830
8076
|
case 20:
|
|
7831
|
-
enrichedOrder =
|
|
8077
|
+
enrichedOrder = _context80.sent;
|
|
7832
8078
|
if (!((_options$productMap = options === null || options === void 0 ? void 0 : options.productMap) !== null && _options$productMap !== void 0)) {
|
|
7833
|
-
|
|
8079
|
+
_context80.next = 25;
|
|
7834
8080
|
break;
|
|
7835
8081
|
}
|
|
7836
|
-
|
|
7837
|
-
|
|
8082
|
+
_context80.t1 = _options$productMap;
|
|
8083
|
+
_context80.next = 28;
|
|
7838
8084
|
break;
|
|
7839
8085
|
case 25:
|
|
7840
|
-
|
|
8086
|
+
_context80.next = 27;
|
|
7841
8087
|
return this.buildSmallTicketProductMap(enrichedOrder);
|
|
7842
8088
|
case 27:
|
|
7843
|
-
|
|
8089
|
+
_context80.t1 = _context80.sent;
|
|
7844
8090
|
case 28:
|
|
7845
|
-
productMap =
|
|
8091
|
+
productMap = _context80.t1;
|
|
7846
8092
|
smallTicketData = buildSmallTicketData({
|
|
7847
8093
|
order: enrichedOrder,
|
|
7848
8094
|
shopInfo: this.getSmallTicketShopInfo(),
|
|
@@ -7851,31 +8097,31 @@ var Server = /*#__PURE__*/function () {
|
|
|
7851
8097
|
includeReceiptKeys: options === null || options === void 0 ? void 0 : options.includeReceiptKeys,
|
|
7852
8098
|
templateSettings: options !== null && options !== void 0 && options.applyTemplateVisibility ? options.invoiceTemplateSettings : undefined
|
|
7853
8099
|
});
|
|
7854
|
-
return
|
|
8100
|
+
return _context80.abrupt("return", _objectSpread(_objectSpread({}, enrichedOrder), {}, {
|
|
7855
8101
|
payment_info: _objectSpread(_objectSpread({}, enrichedOrder.payment_info || {}), {}, {
|
|
7856
8102
|
small_ticket_data: smallTicketData
|
|
7857
8103
|
})
|
|
7858
8104
|
}));
|
|
7859
8105
|
case 33:
|
|
7860
|
-
|
|
7861
|
-
|
|
8106
|
+
_context80.prev = 33;
|
|
8107
|
+
_context80.t2 = _context80["catch"](5);
|
|
7862
8108
|
this.logError('withLocalSmallTicketData: 生成本地小票数据失败', {
|
|
7863
|
-
error:
|
|
8109
|
+
error: _context80.t2 instanceof Error ? _context80.t2.message : String(_context80.t2)
|
|
7864
8110
|
});
|
|
7865
8111
|
if (!mustApplyVisibility) {
|
|
7866
|
-
|
|
8112
|
+
_context80.next = 38;
|
|
7867
8113
|
break;
|
|
7868
8114
|
}
|
|
7869
|
-
throw
|
|
8115
|
+
throw _context80.t2;
|
|
7870
8116
|
case 38:
|
|
7871
|
-
return
|
|
8117
|
+
return _context80.abrupt("return", order);
|
|
7872
8118
|
case 39:
|
|
7873
8119
|
case "end":
|
|
7874
|
-
return
|
|
8120
|
+
return _context80.stop();
|
|
7875
8121
|
}
|
|
7876
|
-
},
|
|
8122
|
+
}, _callee80, this, [[5, 33]]);
|
|
7877
8123
|
}));
|
|
7878
|
-
function withLocalSmallTicketData(
|
|
8124
|
+
function withLocalSmallTicketData(_x90, _x91) {
|
|
7879
8125
|
return _withLocalSmallTicketData.apply(this, arguments);
|
|
7880
8126
|
}
|
|
7881
8127
|
return withLocalSmallTicketData;
|
|
@@ -7890,37 +8136,37 @@ var Server = /*#__PURE__*/function () {
|
|
|
7890
8136
|
}, {
|
|
7891
8137
|
key: "fetchAndPersistSalesOrderByLookup",
|
|
7892
8138
|
value: function () {
|
|
7893
|
-
var _fetchAndPersistSalesOrderByLookup = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
8139
|
+
var _fetchAndPersistSalesOrderByLookup = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee81(lookup, data, title, paymentIdentityOrder, prepareExactOrderForPersist) {
|
|
7894
8140
|
var _this$order7, _this$order8, _this$app20;
|
|
7895
|
-
var backendPath, _this$order$
|
|
7896
|
-
return _regeneratorRuntime().wrap(function
|
|
7897
|
-
while (1) switch (
|
|
8141
|
+
var backendPath, _this$order$getOrderB, _this$order9, _this$order$getLocalO, _this$order10, response, _response$code3, responseStatusCode, code, message, _fresh2, localBeforeRefresh, orderToPersist, remotePayments, paidPayments, paymentIdsComplete, savedOrder, _errorRecord$response, backendError, errorRecord, _responseStatusCode, _ref87, _backendError$code2, backendStatusCode, _code, _message2, _message3;
|
|
8142
|
+
return _regeneratorRuntime().wrap(function _callee81$(_context81) {
|
|
8143
|
+
while (1) switch (_context81.prev = _context81.next) {
|
|
7898
8144
|
case 0:
|
|
7899
8145
|
if (!(!((_this$order7 = this.order) !== null && _this$order7 !== void 0 && _this$order7.getLocalOrderByLookup) || !((_this$order8 = this.order) !== null && _this$order8 !== void 0 && _this$order8.upsertOrdersFromRemote))) {
|
|
7900
|
-
|
|
8146
|
+
_context81.next = 3;
|
|
7901
8147
|
break;
|
|
7902
8148
|
}
|
|
7903
8149
|
this.logError("".concat(title, ": Order \u6A21\u5757\u672A\u6CE8\u518C"));
|
|
7904
|
-
return
|
|
8150
|
+
return _context81.abrupt("return", {
|
|
7905
8151
|
code: 500,
|
|
7906
8152
|
message: 'Order 模块未注册',
|
|
7907
8153
|
order: null
|
|
7908
8154
|
});
|
|
7909
8155
|
case 3:
|
|
7910
8156
|
if ((_this$app20 = this.app) !== null && _this$app20 !== void 0 && (_this$app20 = _this$app20.request) !== null && _this$app20 !== void 0 && _this$app20.get) {
|
|
7911
|
-
|
|
8157
|
+
_context81.next = 6;
|
|
7912
8158
|
break;
|
|
7913
8159
|
}
|
|
7914
8160
|
this.logError("".concat(title, ": app.request \u4E0D\u53EF\u7528"));
|
|
7915
|
-
return
|
|
8161
|
+
return _context81.abrupt("return", {
|
|
7916
8162
|
code: 500,
|
|
7917
8163
|
message: 'app.request 不可用',
|
|
7918
8164
|
order: null
|
|
7919
8165
|
});
|
|
7920
8166
|
case 6:
|
|
7921
8167
|
backendPath = this.buildOrderSalesDetailBackendPath(String(lookup), data);
|
|
7922
|
-
|
|
7923
|
-
|
|
8168
|
+
_context81.prev = 7;
|
|
8169
|
+
_context81.next = 10;
|
|
7924
8170
|
return this.app.request.get(backendPath, {
|
|
7925
8171
|
lookup_mode: 'multi'
|
|
7926
8172
|
}, {
|
|
@@ -7928,9 +8174,9 @@ var Server = /*#__PURE__*/function () {
|
|
|
7928
8174
|
customToast: function customToast() {}
|
|
7929
8175
|
});
|
|
7930
8176
|
case 10:
|
|
7931
|
-
response =
|
|
8177
|
+
response = _context81.sent;
|
|
7932
8178
|
if (!this.isCheckoutResponseRejected(response)) {
|
|
7933
|
-
|
|
8179
|
+
_context81.next = 17;
|
|
7934
8180
|
break;
|
|
7935
8181
|
}
|
|
7936
8182
|
responseStatusCode = typeof (response === null || response === void 0 ? void 0 : response.status) === 'number' ? response.status : undefined;
|
|
@@ -7942,70 +8188,80 @@ var Server = /*#__PURE__*/function () {
|
|
|
7942
8188
|
code: code,
|
|
7943
8189
|
message: message
|
|
7944
8190
|
});
|
|
7945
|
-
return
|
|
8191
|
+
return _context81.abrupt("return", {
|
|
7946
8192
|
code: code,
|
|
7947
8193
|
message: message,
|
|
7948
8194
|
order: null
|
|
7949
8195
|
});
|
|
7950
8196
|
case 17:
|
|
7951
|
-
|
|
7952
|
-
if (!(!
|
|
7953
|
-
|
|
8197
|
+
_fresh2 = this.extractOrderDataFromCheckoutResponse(response);
|
|
8198
|
+
if (!(!_fresh2 || _fresh2.order_id === undefined || _fresh2.order_id === null || String(_fresh2.order_id).trim() === '')) {
|
|
8199
|
+
_context81.next = 21;
|
|
7954
8200
|
break;
|
|
7955
8201
|
}
|
|
7956
8202
|
this.logInfo("".concat(title, ": \u540E\u7AEF\u8FD4\u56DE\u8BA2\u5355\u4E3A\u7A7A"), {
|
|
7957
8203
|
lookup: lookup,
|
|
7958
8204
|
backendPath: backendPath
|
|
7959
8205
|
});
|
|
7960
|
-
return
|
|
8206
|
+
return _context81.abrupt("return", {
|
|
7961
8207
|
code: 500,
|
|
7962
8208
|
message: '后端返回订单为空',
|
|
7963
8209
|
order: null
|
|
7964
8210
|
});
|
|
7965
8211
|
case 21:
|
|
7966
|
-
|
|
7967
|
-
|
|
7968
|
-
|
|
8212
|
+
if (!prepareExactOrderForPersist) {
|
|
8213
|
+
_context81.next = 25;
|
|
8214
|
+
break;
|
|
8215
|
+
}
|
|
8216
|
+
_context81.t0 = (_this$order$getOrderB = (_this$order9 = this.order).getOrderByOrderId) === null || _this$order$getOrderB === void 0 ? void 0 : _this$order$getOrderB.call(_this$order9, lookup);
|
|
8217
|
+
_context81.next = 36;
|
|
8218
|
+
break;
|
|
8219
|
+
case 25:
|
|
8220
|
+
_context81.t1 = (_this$order$getLocalO = (_this$order10 = this.order).getLocalOrderFromMemoryByLookup) === null || _this$order$getLocalO === void 0 ? void 0 : _this$order$getLocalO.call(_this$order10, lookup);
|
|
8221
|
+
if (_context81.t1) {
|
|
8222
|
+
_context81.next = 35;
|
|
7969
8223
|
break;
|
|
7970
8224
|
}
|
|
7971
8225
|
if (!this.shouldForceRemoteSalesDetail(data)) {
|
|
7972
|
-
|
|
8226
|
+
_context81.next = 33;
|
|
7973
8227
|
break;
|
|
7974
8228
|
}
|
|
7975
|
-
|
|
8229
|
+
_context81.next = 30;
|
|
7976
8230
|
return this.order.getLocalOrderByLookup(lookup);
|
|
7977
|
-
case 26:
|
|
7978
|
-
_context79.t1 = _context79.sent;
|
|
7979
|
-
_context79.next = 30;
|
|
7980
|
-
break;
|
|
7981
|
-
case 29:
|
|
7982
|
-
_context79.t1 = null;
|
|
7983
8231
|
case 30:
|
|
7984
|
-
|
|
7985
|
-
|
|
7986
|
-
|
|
7987
|
-
|
|
8232
|
+
_context81.t2 = _context81.sent;
|
|
8233
|
+
_context81.next = 34;
|
|
8234
|
+
break;
|
|
8235
|
+
case 33:
|
|
8236
|
+
_context81.t2 = null;
|
|
8237
|
+
case 34:
|
|
8238
|
+
_context81.t1 = _context81.t2;
|
|
8239
|
+
case 35:
|
|
8240
|
+
_context81.t0 = _context81.t1;
|
|
8241
|
+
case 36:
|
|
8242
|
+
localBeforeRefresh = _context81.t0;
|
|
8243
|
+
orderToPersist = _fresh2;
|
|
7988
8244
|
if (!paymentIdentityOrder) {
|
|
7989
|
-
|
|
8245
|
+
_context81.next = 49;
|
|
7990
8246
|
break;
|
|
7991
8247
|
}
|
|
7992
|
-
if (!(String(
|
|
7993
|
-
|
|
8248
|
+
if (!(String(_fresh2.order_id) !== String(paymentIdentityOrder.order_id) || _fresh2.external_sale_number && paymentIdentityOrder.external_sale_number && _fresh2.external_sale_number !== paymentIdentityOrder.external_sale_number || !Array.isArray(_fresh2.payments))) {
|
|
8249
|
+
_context81.next = 41;
|
|
7994
8250
|
break;
|
|
7995
8251
|
}
|
|
7996
8252
|
throw new Error('远端订单身份不匹配或缺少付款明细,暂不补齐付款 ID');
|
|
7997
|
-
case
|
|
8253
|
+
case 41:
|
|
7998
8254
|
if (!(!localBeforeRefresh || Number(localBeforeRefresh.need_sync || 0) === 1 || Number(localBeforeRefresh.is_draft_order || 0) === 1)) {
|
|
7999
|
-
|
|
8255
|
+
_context81.next = 43;
|
|
8000
8256
|
break;
|
|
8001
8257
|
}
|
|
8002
|
-
return
|
|
8258
|
+
return _context81.abrupt("return", {
|
|
8003
8259
|
code: 200,
|
|
8004
8260
|
message: '',
|
|
8005
8261
|
order: localBeforeRefresh || paymentIdentityOrder
|
|
8006
8262
|
});
|
|
8007
|
-
case
|
|
8008
|
-
remotePayments =
|
|
8263
|
+
case 43:
|
|
8264
|
+
remotePayments = _fresh2.payments;
|
|
8009
8265
|
paidPayments = (localBeforeRefresh.payments || []).filter(function (payment) {
|
|
8010
8266
|
return payment.status === 'paid';
|
|
8011
8267
|
});
|
|
@@ -8021,115 +8277,131 @@ var Server = /*#__PURE__*/function () {
|
|
|
8021
8277
|
return matches.length === 1 && paymentId !== undefined && paymentId !== null && String(paymentId).trim() !== '';
|
|
8022
8278
|
});
|
|
8023
8279
|
if (paymentIdsComplete) {
|
|
8024
|
-
|
|
8280
|
+
_context81.next = 48;
|
|
8025
8281
|
break;
|
|
8026
8282
|
}
|
|
8027
8283
|
throw new Error('远端付款 ID 尚未齐全或付款身份匹配不唯一,保留本地付款等待重试');
|
|
8028
|
-
case
|
|
8029
|
-
orderToPersist = _objectSpread(_objectSpread({},
|
|
8284
|
+
case 48:
|
|
8285
|
+
orderToPersist = _objectSpread(_objectSpread({}, _fresh2), {}, {
|
|
8030
8286
|
payments: mergeOrderPaymentListsByIdentity(localBeforeRefresh.payments, remotePayments, {
|
|
8031
8287
|
preserveUnmatchedExisting: true
|
|
8032
8288
|
})
|
|
8033
8289
|
});
|
|
8034
|
-
case
|
|
8290
|
+
case 49:
|
|
8291
|
+
if (prepareExactOrderForPersist) orderToPersist = prepareExactOrderForPersist(orderToPersist);
|
|
8035
8292
|
if (!requiresLocalPaymentRefresh(localBeforeRefresh)) {
|
|
8036
|
-
|
|
8293
|
+
_context81.next = 57;
|
|
8037
8294
|
break;
|
|
8038
8295
|
}
|
|
8039
|
-
if (!(String(
|
|
8040
|
-
|
|
8296
|
+
if (!(String(_fresh2.order_id) !== String(localBeforeRefresh.order_id))) {
|
|
8297
|
+
_context81.next = 53;
|
|
8041
8298
|
break;
|
|
8042
8299
|
}
|
|
8043
8300
|
throw new Error('远端订单身份不匹配,请重新刷新');
|
|
8044
|
-
case
|
|
8045
|
-
|
|
8301
|
+
case 53:
|
|
8302
|
+
_context81.next = 55;
|
|
8046
8303
|
return this.order.completeLocalPaymentRefresh(orderToPersist);
|
|
8047
|
-
case
|
|
8048
|
-
|
|
8304
|
+
case 55:
|
|
8305
|
+
_context81.next = 59;
|
|
8049
8306
|
break;
|
|
8050
|
-
case
|
|
8051
|
-
|
|
8307
|
+
case 57:
|
|
8308
|
+
_context81.next = 59;
|
|
8052
8309
|
return this.order.upsertOrdersFromRemote([orderToPersist]);
|
|
8053
|
-
case
|
|
8054
|
-
|
|
8310
|
+
case 59:
|
|
8311
|
+
if (!prepareExactOrderForPersist) {
|
|
8312
|
+
_context81.next = 65;
|
|
8313
|
+
break;
|
|
8314
|
+
}
|
|
8315
|
+
_context81.next = 62;
|
|
8316
|
+
return this.order.getLocalOrderByLookup(lookup, {
|
|
8317
|
+
exactOrderId: true
|
|
8318
|
+
});
|
|
8319
|
+
case 62:
|
|
8320
|
+
_context81.t3 = _context81.sent;
|
|
8321
|
+
_context81.next = 68;
|
|
8322
|
+
break;
|
|
8323
|
+
case 65:
|
|
8324
|
+
_context81.next = 67;
|
|
8055
8325
|
return this.order.getLocalOrderByLookup(lookup);
|
|
8056
|
-
case
|
|
8057
|
-
|
|
8058
|
-
|
|
8059
|
-
|
|
8326
|
+
case 67:
|
|
8327
|
+
_context81.t3 = _context81.sent;
|
|
8328
|
+
case 68:
|
|
8329
|
+
savedOrder = _context81.t3;
|
|
8330
|
+
if (!(!savedOrder && _fresh2.order_id !== undefined && _fresh2.order_id !== null && String(_fresh2.order_id) !== String(lookup))) {
|
|
8331
|
+
_context81.next = 73;
|
|
8060
8332
|
break;
|
|
8061
8333
|
}
|
|
8062
|
-
|
|
8063
|
-
return this.order.getLocalOrderByLookup(
|
|
8064
|
-
case
|
|
8065
|
-
savedOrder =
|
|
8066
|
-
case
|
|
8334
|
+
_context81.next = 72;
|
|
8335
|
+
return this.order.getLocalOrderByLookup(_fresh2.order_id);
|
|
8336
|
+
case 72:
|
|
8337
|
+
savedOrder = _context81.sent;
|
|
8338
|
+
case 73:
|
|
8067
8339
|
if (savedOrder) {
|
|
8068
|
-
|
|
8340
|
+
_context81.next = 76;
|
|
8069
8341
|
break;
|
|
8070
8342
|
}
|
|
8071
8343
|
this.logError("".concat(title, ": \u8BA2\u5355\u5199\u5165\u540E\u56DE\u8BFB\u5931\u8D25"), {
|
|
8072
8344
|
lookup: lookup,
|
|
8073
|
-
remote_order_id:
|
|
8345
|
+
remote_order_id: _fresh2.order_id
|
|
8074
8346
|
});
|
|
8075
|
-
return
|
|
8347
|
+
return _context81.abrupt("return", {
|
|
8076
8348
|
code: 500,
|
|
8077
8349
|
message: '订单写入后回读失败',
|
|
8078
8350
|
order: null
|
|
8079
8351
|
});
|
|
8080
|
-
case
|
|
8352
|
+
case 76:
|
|
8081
8353
|
this.logInfo("".concat(title, ": \u8FDC\u7AEF\u8BA2\u5355\u5DF2\u540C\u6B65\u5230\u672C\u5730"), {
|
|
8082
8354
|
lookup: lookup,
|
|
8083
|
-
remote_order_id:
|
|
8355
|
+
remote_order_id: _fresh2.order_id
|
|
8084
8356
|
});
|
|
8085
|
-
return
|
|
8357
|
+
return _context81.abrupt("return", {
|
|
8086
8358
|
code: 200,
|
|
8087
8359
|
message: '',
|
|
8088
8360
|
order: savedOrder
|
|
8089
8361
|
});
|
|
8090
|
-
case
|
|
8091
|
-
|
|
8092
|
-
|
|
8093
|
-
backendError = this.extractBackendErrorResponse(
|
|
8094
|
-
errorRecord =
|
|
8362
|
+
case 80:
|
|
8363
|
+
_context81.prev = 80;
|
|
8364
|
+
_context81.t4 = _context81["catch"](7);
|
|
8365
|
+
backendError = this.extractBackendErrorResponse(_context81.t4);
|
|
8366
|
+
errorRecord = _context81.t4;
|
|
8095
8367
|
_responseStatusCode = typeof (errorRecord === null || errorRecord === void 0 || (_errorRecord$response = errorRecord.response) === null || _errorRecord$response === void 0 ? void 0 : _errorRecord$response.status) === 'number' ? errorRecord.response.status : undefined;
|
|
8096
8368
|
if (!(backendError || _responseStatusCode !== undefined)) {
|
|
8097
|
-
|
|
8369
|
+
_context81.next = 91;
|
|
8098
8370
|
break;
|
|
8099
8371
|
}
|
|
8100
8372
|
backendStatusCode = typeof (backendError === null || backendError === void 0 ? void 0 : backendError.status) === 'number' ? backendError.status : undefined;
|
|
8101
|
-
_code = this.normalizeRemoteSalesOrderErrorCode((
|
|
8102
|
-
_message2 = (backendError === null || backendError === void 0 ? void 0 : backendError.message) || this.getUnknownErrorMessage(
|
|
8373
|
+
_code = this.normalizeRemoteSalesOrderErrorCode((_ref87 = (_backendError$code2 = backendError === null || backendError === void 0 ? void 0 : backendError.code) !== null && _backendError$code2 !== void 0 ? _backendError$code2 : backendStatusCode) !== null && _ref87 !== void 0 ? _ref87 : _responseStatusCode);
|
|
8374
|
+
_message2 = (backendError === null || backendError === void 0 ? void 0 : backendError.message) || this.getUnknownErrorMessage(_context81.t4);
|
|
8103
8375
|
this.logInfo("".concat(title, ": \u540E\u7AEF\u8BA2\u5355\u67E5\u8BE2\u5931\u8D25"), {
|
|
8104
8376
|
lookup: lookup,
|
|
8105
8377
|
backendPath: backendPath,
|
|
8106
8378
|
code: _code,
|
|
8107
8379
|
message: _message2
|
|
8108
8380
|
});
|
|
8109
|
-
return
|
|
8381
|
+
return _context81.abrupt("return", {
|
|
8110
8382
|
code: _code,
|
|
8111
8383
|
message: _message2,
|
|
8112
8384
|
order: null
|
|
8113
8385
|
});
|
|
8114
|
-
case
|
|
8115
|
-
_message3 = this.getUnknownErrorMessage(
|
|
8386
|
+
case 91:
|
|
8387
|
+
_message3 = this.getUnknownErrorMessage(_context81.t4);
|
|
8116
8388
|
this.logInfo("".concat(title, ": \u8BF7\u6C42\u5931\u8D25"), {
|
|
8117
8389
|
lookup: lookup,
|
|
8118
8390
|
backendPath: backendPath,
|
|
8119
8391
|
error: _message3
|
|
8120
8392
|
});
|
|
8121
|
-
return
|
|
8393
|
+
return _context81.abrupt("return", {
|
|
8122
8394
|
code: 500,
|
|
8123
8395
|
message: _message3,
|
|
8124
8396
|
order: null
|
|
8125
8397
|
});
|
|
8126
|
-
case
|
|
8398
|
+
case 94:
|
|
8127
8399
|
case "end":
|
|
8128
|
-
return
|
|
8400
|
+
return _context81.stop();
|
|
8129
8401
|
}
|
|
8130
|
-
},
|
|
8402
|
+
}, _callee81, this, [[7, 80]]);
|
|
8131
8403
|
}));
|
|
8132
|
-
function fetchAndPersistSalesOrderByLookup(
|
|
8404
|
+
function fetchAndPersistSalesOrderByLookup(_x92, _x93, _x94, _x95, _x96) {
|
|
8133
8405
|
return _fetchAndPersistSalesOrderByLookup.apply(this, arguments);
|
|
8134
8406
|
}
|
|
8135
8407
|
return fetchAndPersistSalesOrderByLookup;
|
|
@@ -8191,22 +8463,22 @@ var Server = /*#__PURE__*/function () {
|
|
|
8191
8463
|
}, {
|
|
8192
8464
|
key: "handleUpdateLocalOrdersBatch",
|
|
8193
8465
|
value: (function () {
|
|
8194
|
-
var _handleUpdateLocalOrdersBatch = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
8466
|
+
var _handleUpdateLocalOrdersBatch = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee82(orderIds) {
|
|
8195
8467
|
var _this$app21;
|
|
8196
|
-
var existedBefore, _iterator13, _step13, id, fetched, message, fetchedMap, _iterator14, _step14, order, oid, freshOrders, succeedIds, failed, _iterator15, _step15, _id,
|
|
8197
|
-
return _regeneratorRuntime().wrap(function
|
|
8198
|
-
while (1) switch (
|
|
8468
|
+
var existedBefore, _iterator13, _step13, id, fetched, message, fetchedMap, _iterator14, _step14, order, oid, freshOrders, succeedIds, failed, _iterator15, _step15, _id, _fresh3, _message4, overwritten, inserted;
|
|
8469
|
+
return _regeneratorRuntime().wrap(function _callee82$(_context82) {
|
|
8470
|
+
while (1) switch (_context82.prev = _context82.next) {
|
|
8199
8471
|
case 0:
|
|
8200
8472
|
this.logInfo('handleUpdateLocalOrdersBatch: 开始处理', {
|
|
8201
8473
|
count: orderIds.length,
|
|
8202
8474
|
orderIds: orderIds
|
|
8203
8475
|
});
|
|
8204
8476
|
if (this.order) {
|
|
8205
|
-
|
|
8477
|
+
_context82.next = 4;
|
|
8206
8478
|
break;
|
|
8207
8479
|
}
|
|
8208
8480
|
this.logError('handleUpdateLocalOrdersBatch: Order 模块未注册');
|
|
8209
|
-
return
|
|
8481
|
+
return _context82.abrupt("return", {
|
|
8210
8482
|
code: 500,
|
|
8211
8483
|
status: false,
|
|
8212
8484
|
message: 'Order 模块未注册',
|
|
@@ -8214,11 +8486,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
8214
8486
|
});
|
|
8215
8487
|
case 4:
|
|
8216
8488
|
if ((_this$app21 = this.app) !== null && _this$app21 !== void 0 && _this$app21.request) {
|
|
8217
|
-
|
|
8489
|
+
_context82.next = 7;
|
|
8218
8490
|
break;
|
|
8219
8491
|
}
|
|
8220
8492
|
this.logError('handleUpdateLocalOrdersBatch: app.request 不可用');
|
|
8221
|
-
return
|
|
8493
|
+
return _context82.abrupt("return", {
|
|
8222
8494
|
code: 500,
|
|
8223
8495
|
status: false,
|
|
8224
8496
|
message: 'app.request 不可用',
|
|
@@ -8241,21 +8513,21 @@ var Server = /*#__PURE__*/function () {
|
|
|
8241
8513
|
_iterator13.f();
|
|
8242
8514
|
}
|
|
8243
8515
|
fetched = [];
|
|
8244
|
-
|
|
8245
|
-
|
|
8516
|
+
_context82.prev = 11;
|
|
8517
|
+
_context82.next = 14;
|
|
8246
8518
|
return this.order.fetchOrdersByHttp(orderIds);
|
|
8247
8519
|
case 14:
|
|
8248
|
-
fetched =
|
|
8249
|
-
|
|
8520
|
+
fetched = _context82.sent;
|
|
8521
|
+
_context82.next = 22;
|
|
8250
8522
|
break;
|
|
8251
8523
|
case 17:
|
|
8252
|
-
|
|
8253
|
-
|
|
8254
|
-
message =
|
|
8524
|
+
_context82.prev = 17;
|
|
8525
|
+
_context82.t0 = _context82["catch"](11);
|
|
8526
|
+
message = _context82.t0 instanceof Error ? _context82.t0.message : String(_context82.t0);
|
|
8255
8527
|
this.logError('handleUpdateLocalOrdersBatch: 批量拉取失败', {
|
|
8256
8528
|
message: message
|
|
8257
8529
|
});
|
|
8258
|
-
return
|
|
8530
|
+
return _context82.abrupt("return", {
|
|
8259
8531
|
code: 500,
|
|
8260
8532
|
status: false,
|
|
8261
8533
|
message: message,
|
|
@@ -8265,36 +8537,36 @@ var Server = /*#__PURE__*/function () {
|
|
|
8265
8537
|
// 按返回结果中的 order_id 建索引,未命中即视为单笔失败
|
|
8266
8538
|
fetchedMap = new Map();
|
|
8267
8539
|
_iterator14 = _createForOfIteratorHelper(fetched);
|
|
8268
|
-
|
|
8540
|
+
_context82.prev = 24;
|
|
8269
8541
|
_iterator14.s();
|
|
8270
8542
|
case 26:
|
|
8271
8543
|
if ((_step14 = _iterator14.n()).done) {
|
|
8272
|
-
|
|
8544
|
+
_context82.next = 34;
|
|
8273
8545
|
break;
|
|
8274
8546
|
}
|
|
8275
8547
|
order = _step14.value;
|
|
8276
8548
|
oid = order === null || order === void 0 ? void 0 : order.order_id;
|
|
8277
8549
|
if (!(oid === undefined || oid === null)) {
|
|
8278
|
-
|
|
8550
|
+
_context82.next = 31;
|
|
8279
8551
|
break;
|
|
8280
8552
|
}
|
|
8281
|
-
return
|
|
8553
|
+
return _context82.abrupt("continue", 32);
|
|
8282
8554
|
case 31:
|
|
8283
8555
|
fetchedMap.set(String(oid), order);
|
|
8284
8556
|
case 32:
|
|
8285
|
-
|
|
8557
|
+
_context82.next = 26;
|
|
8286
8558
|
break;
|
|
8287
8559
|
case 34:
|
|
8288
|
-
|
|
8560
|
+
_context82.next = 39;
|
|
8289
8561
|
break;
|
|
8290
8562
|
case 36:
|
|
8291
|
-
|
|
8292
|
-
|
|
8293
|
-
_iterator14.e(
|
|
8563
|
+
_context82.prev = 36;
|
|
8564
|
+
_context82.t1 = _context82["catch"](24);
|
|
8565
|
+
_iterator14.e(_context82.t1);
|
|
8294
8566
|
case 39:
|
|
8295
|
-
|
|
8567
|
+
_context82.prev = 39;
|
|
8296
8568
|
_iterator14.f();
|
|
8297
|
-
return
|
|
8569
|
+
return _context82.finish(39);
|
|
8298
8570
|
case 42:
|
|
8299
8571
|
freshOrders = [];
|
|
8300
8572
|
succeedIds = [];
|
|
@@ -8303,9 +8575,9 @@ var Server = /*#__PURE__*/function () {
|
|
|
8303
8575
|
try {
|
|
8304
8576
|
for (_iterator15.s(); !(_step15 = _iterator15.n()).done;) {
|
|
8305
8577
|
_id = _step15.value;
|
|
8306
|
-
|
|
8307
|
-
if (
|
|
8308
|
-
freshOrders.push(
|
|
8578
|
+
_fresh3 = fetchedMap.get(_id);
|
|
8579
|
+
if (_fresh3) {
|
|
8580
|
+
freshOrders.push(_fresh3);
|
|
8309
8581
|
succeedIds.push(_id);
|
|
8310
8582
|
} else {
|
|
8311
8583
|
failed.push({
|
|
@@ -8320,23 +8592,23 @@ var Server = /*#__PURE__*/function () {
|
|
|
8320
8592
|
_iterator15.f();
|
|
8321
8593
|
}
|
|
8322
8594
|
if (!(freshOrders.length > 0)) {
|
|
8323
|
-
|
|
8595
|
+
_context82.next = 58;
|
|
8324
8596
|
break;
|
|
8325
8597
|
}
|
|
8326
|
-
|
|
8327
|
-
|
|
8598
|
+
_context82.prev = 48;
|
|
8599
|
+
_context82.next = 51;
|
|
8328
8600
|
return this.order.upsertOrdersFromRemote(freshOrders);
|
|
8329
8601
|
case 51:
|
|
8330
|
-
|
|
8602
|
+
_context82.next = 58;
|
|
8331
8603
|
break;
|
|
8332
8604
|
case 53:
|
|
8333
|
-
|
|
8334
|
-
|
|
8335
|
-
_message4 =
|
|
8605
|
+
_context82.prev = 53;
|
|
8606
|
+
_context82.t2 = _context82["catch"](48);
|
|
8607
|
+
_message4 = _context82.t2 instanceof Error ? _context82.t2.message : String(_context82.t2);
|
|
8336
8608
|
this.logError('handleUpdateLocalOrdersBatch: 合并写入失败', {
|
|
8337
8609
|
message: _message4
|
|
8338
8610
|
});
|
|
8339
|
-
return
|
|
8611
|
+
return _context82.abrupt("return", {
|
|
8340
8612
|
code: 500,
|
|
8341
8613
|
status: false,
|
|
8342
8614
|
message: _message4,
|
|
@@ -8355,7 +8627,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
8355
8627
|
insertedCount: inserted.length,
|
|
8356
8628
|
failedCount: failed.length
|
|
8357
8629
|
});
|
|
8358
|
-
return
|
|
8630
|
+
return _context82.abrupt("return", {
|
|
8359
8631
|
code: 200,
|
|
8360
8632
|
status: true,
|
|
8361
8633
|
message: '',
|
|
@@ -8367,11 +8639,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
8367
8639
|
});
|
|
8368
8640
|
case 62:
|
|
8369
8641
|
case "end":
|
|
8370
|
-
return
|
|
8642
|
+
return _context82.stop();
|
|
8371
8643
|
}
|
|
8372
|
-
},
|
|
8644
|
+
}, _callee82, this, [[11, 17], [24, 36, 39, 42], [48, 53]]);
|
|
8373
8645
|
}));
|
|
8374
|
-
function handleUpdateLocalOrdersBatch(
|
|
8646
|
+
function handleUpdateLocalOrdersBatch(_x97) {
|
|
8375
8647
|
return _handleUpdateLocalOrdersBatch.apply(this, arguments);
|
|
8376
8648
|
}
|
|
8377
8649
|
return handleUpdateLocalOrdersBatch;
|
|
@@ -8618,10 +8890,10 @@ var Server = /*#__PURE__*/function () {
|
|
|
8618
8890
|
value: function extractBackendErrorResponse(error) {
|
|
8619
8891
|
var _error$response3,
|
|
8620
8892
|
_error$response4,
|
|
8621
|
-
|
|
8893
|
+
_this28 = this;
|
|
8622
8894
|
var candidates = [error === null || error === void 0 || (_error$response3 = error.response) === null || _error$response3 === void 0 ? void 0 : _error$response3.data, error === null || error === void 0 ? void 0 : error.data, error === null || error === void 0 || (_error$response4 = error.response) === null || _error$response4 === void 0 ? void 0 : _error$response4.body, error === null || error === void 0 ? void 0 : error.body];
|
|
8623
8895
|
return candidates.find(function (candidate) {
|
|
8624
|
-
return
|
|
8896
|
+
return _this28.isExplicitBackendErrorResponse(candidate);
|
|
8625
8897
|
}) || null;
|
|
8626
8898
|
}
|
|
8627
8899
|
}, {
|
|
@@ -8740,16 +9012,16 @@ var Server = /*#__PURE__*/function () {
|
|
|
8740
9012
|
}, {
|
|
8741
9013
|
key: "recomputeAndNotifyFloorPlanQuery",
|
|
8742
9014
|
value: (function () {
|
|
8743
|
-
var _recomputeAndNotifyFloorPlanQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
9015
|
+
var _recomputeAndNotifyFloorPlanQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee83() {
|
|
8744
9016
|
var _iterator17, _step17, _step17$value, subscriberId, sub, result, errorMessage;
|
|
8745
|
-
return _regeneratorRuntime().wrap(function
|
|
8746
|
-
while (1) switch (
|
|
9017
|
+
return _regeneratorRuntime().wrap(function _callee83$(_context83) {
|
|
9018
|
+
while (1) switch (_context83.prev = _context83.next) {
|
|
8747
9019
|
case 0:
|
|
8748
9020
|
if (!(this.floorPlanQuerySubscribers.size === 0)) {
|
|
8749
|
-
|
|
9021
|
+
_context83.next = 2;
|
|
8750
9022
|
break;
|
|
8751
9023
|
}
|
|
8752
|
-
return
|
|
9024
|
+
return _context83.abrupt("return");
|
|
8753
9025
|
case 2:
|
|
8754
9026
|
this.logInfo('recomputeAndNotifyFloorPlanQuery: 开始推送', {
|
|
8755
9027
|
subscriberCount: this.floorPlanQuerySubscribers.size
|
|
@@ -8779,9 +9051,9 @@ var Server = /*#__PURE__*/function () {
|
|
|
8779
9051
|
}
|
|
8780
9052
|
case 5:
|
|
8781
9053
|
case "end":
|
|
8782
|
-
return
|
|
9054
|
+
return _context83.stop();
|
|
8783
9055
|
}
|
|
8784
|
-
},
|
|
9056
|
+
}, _callee83, this);
|
|
8785
9057
|
}));
|
|
8786
9058
|
function recomputeAndNotifyFloorPlanQuery() {
|
|
8787
9059
|
return _recomputeAndNotifyFloorPlanQuery.apply(this, arguments);
|
|
@@ -8811,20 +9083,20 @@ var Server = /*#__PURE__*/function () {
|
|
|
8811
9083
|
* filter 逻辑暂为 mock,仅记录参数
|
|
8812
9084
|
*/
|
|
8813
9085
|
function () {
|
|
8814
|
-
var _computeOrderQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
9086
|
+
var _computeOrderQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee84(data) {
|
|
8815
9087
|
var rawList, result;
|
|
8816
|
-
return _regeneratorRuntime().wrap(function
|
|
8817
|
-
while (1) switch (
|
|
9088
|
+
return _regeneratorRuntime().wrap(function _callee84$(_context84) {
|
|
9089
|
+
while (1) switch (_context84.prev = _context84.next) {
|
|
8818
9090
|
case 0:
|
|
8819
9091
|
this.logInfo('computeOrderQueryResult: 开始过滤', {
|
|
8820
9092
|
data: data
|
|
8821
9093
|
});
|
|
8822
9094
|
if (this.order) {
|
|
8823
|
-
|
|
9095
|
+
_context84.next = 4;
|
|
8824
9096
|
break;
|
|
8825
9097
|
}
|
|
8826
9098
|
this.logError('computeOrderQueryResult: Order 模块未注册');
|
|
8827
|
-
return
|
|
9099
|
+
return _context84.abrupt("return", {
|
|
8828
9100
|
code: 500,
|
|
8829
9101
|
message: 'Order 模块未注册',
|
|
8830
9102
|
data: {
|
|
@@ -8856,7 +9128,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
8856
9128
|
skip: result.skip,
|
|
8857
9129
|
rejected: result.rejected
|
|
8858
9130
|
});
|
|
8859
|
-
return
|
|
9131
|
+
return _context84.abrupt("return", {
|
|
8860
9132
|
code: 200,
|
|
8861
9133
|
data: result,
|
|
8862
9134
|
message: '',
|
|
@@ -8864,11 +9136,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
8864
9136
|
});
|
|
8865
9137
|
case 10:
|
|
8866
9138
|
case "end":
|
|
8867
|
-
return
|
|
9139
|
+
return _context84.stop();
|
|
8868
9140
|
}
|
|
8869
|
-
},
|
|
9141
|
+
}, _callee84, this);
|
|
8870
9142
|
}));
|
|
8871
|
-
function computeOrderQueryResult(
|
|
9143
|
+
function computeOrderQueryResult(_x98) {
|
|
8872
9144
|
return _computeOrderQueryResult.apply(this, arguments);
|
|
8873
9145
|
}
|
|
8874
9146
|
return computeOrderQueryResult;
|
|
@@ -8881,17 +9153,17 @@ var Server = /*#__PURE__*/function () {
|
|
|
8881
9153
|
}, {
|
|
8882
9154
|
key: "computeBookingQueryResult",
|
|
8883
9155
|
value: (function () {
|
|
8884
|
-
var _computeBookingQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
9156
|
+
var _computeBookingQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee85(data) {
|
|
8885
9157
|
var rawOrders, result;
|
|
8886
|
-
return _regeneratorRuntime().wrap(function
|
|
8887
|
-
while (1) switch (
|
|
9158
|
+
return _regeneratorRuntime().wrap(function _callee85$(_context85) {
|
|
9159
|
+
while (1) switch (_context85.prev = _context85.next) {
|
|
8888
9160
|
case 0:
|
|
8889
9161
|
if (this.order) {
|
|
8890
|
-
|
|
9162
|
+
_context85.next = 3;
|
|
8891
9163
|
break;
|
|
8892
9164
|
}
|
|
8893
9165
|
this.logError('computeBookingQueryResult: Order 模块未注册');
|
|
8894
|
-
return
|
|
9166
|
+
return _context85.abrupt("return", {
|
|
8895
9167
|
code: 500,
|
|
8896
9168
|
message: 'Order 模块未注册',
|
|
8897
9169
|
data: {
|
|
@@ -8910,7 +9182,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
8910
9182
|
size: result.size,
|
|
8911
9183
|
skip: result.skip
|
|
8912
9184
|
});
|
|
8913
|
-
return
|
|
9185
|
+
return _context85.abrupt("return", {
|
|
8914
9186
|
code: 200,
|
|
8915
9187
|
data: result,
|
|
8916
9188
|
message: '',
|
|
@@ -8918,11 +9190,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
8918
9190
|
});
|
|
8919
9191
|
case 8:
|
|
8920
9192
|
case "end":
|
|
8921
|
-
return
|
|
9193
|
+
return _context85.stop();
|
|
8922
9194
|
}
|
|
8923
|
-
},
|
|
9195
|
+
}, _callee85, this);
|
|
8924
9196
|
}));
|
|
8925
|
-
function computeBookingQueryResult(
|
|
9197
|
+
function computeBookingQueryResult(_x99) {
|
|
8926
9198
|
return _computeBookingQueryResult.apply(this, arguments);
|
|
8927
9199
|
}
|
|
8928
9200
|
return computeBookingQueryResult;
|
|
@@ -8981,12 +9253,12 @@ var Server = /*#__PURE__*/function () {
|
|
|
8981
9253
|
}, {
|
|
8982
9254
|
key: "computeProductQueryResult",
|
|
8983
9255
|
value: (function () {
|
|
8984
|
-
var _computeProductQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
9256
|
+
var _computeProductQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee86(context, options) {
|
|
8985
9257
|
var _menu_list_ids$length3,
|
|
8986
|
-
|
|
9258
|
+
_this29 = this;
|
|
8987
9259
|
var tTotal, menu_list_ids, ids, schedule_date, schedule_datetime, customer_id, extension_type, product_id, application_code, strategy_context, isVisibleProduct, queryIds, startupPreloadTask, formatterContext, uniqueIds, _tPrice, productsWithPrice, _filteredProducts, extensionFilteredProducts, _published$find, pid, _tPrice2, allProductsWithPrice, published, item, _tPrice3, _filteredProducts2, _tStatus, _beforeStatusCount, _tExtensionType, _beforeExtensionTypeCount, _tSort, activeMenuList, tMenu, getActiveMenus, tFilter, productScope, scopedProductIds, tPrice, filteredProducts, tStatus, beforeStatusCount, tExtensionType, beforeExtensionTypeCount, tSort;
|
|
8988
|
-
return _regeneratorRuntime().wrap(function
|
|
8989
|
-
while (1) switch (
|
|
9260
|
+
return _regeneratorRuntime().wrap(function _callee86$(_context86) {
|
|
9261
|
+
while (1) switch (_context86.prev = _context86.next) {
|
|
8990
9262
|
case 0:
|
|
8991
9263
|
tTotal = performance.now();
|
|
8992
9264
|
menu_list_ids = context.menu_list_ids, ids = context.ids, schedule_date = context.schedule_date, schedule_datetime = context.schedule_datetime, customer_id = context.customer_id, extension_type = context.extension_type, product_id = context.product_id, application_code = context.application_code, strategy_context = context.strategy_context; // 仅 Kiosk 查询额外按商品销售渠道过滤。
|
|
@@ -9015,10 +9287,10 @@ var Server = /*#__PURE__*/function () {
|
|
|
9015
9287
|
// SQLite/IndexDB,造成 preload 读到空数据并重复请求。正常运行期该字段为 null,不增加等待。
|
|
9016
9288
|
startupPreloadTask = this.startupModulePreloadInFlight;
|
|
9017
9289
|
if (!startupPreloadTask) {
|
|
9018
|
-
|
|
9290
|
+
_context86.next = 9;
|
|
9019
9291
|
break;
|
|
9020
9292
|
}
|
|
9021
|
-
|
|
9293
|
+
_context86.next = 9;
|
|
9022
9294
|
return startupPreloadTask;
|
|
9023
9295
|
case 9:
|
|
9024
9296
|
// Menu/Schedule preload 会替换 store 中的数组;必须在等待完成后再读取,
|
|
@@ -9030,28 +9302,28 @@ var Server = /*#__PURE__*/function () {
|
|
|
9030
9302
|
strategy_context: strategy_context
|
|
9031
9303
|
});
|
|
9032
9304
|
if (this.products) {
|
|
9033
|
-
|
|
9305
|
+
_context86.next = 13;
|
|
9034
9306
|
break;
|
|
9035
9307
|
}
|
|
9036
9308
|
this.logError('computeProductQueryResult: Products 模块未注册');
|
|
9037
|
-
return
|
|
9309
|
+
return _context86.abrupt("return", {
|
|
9038
9310
|
message: 'Products 模块未注册',
|
|
9039
9311
|
data: this.buildProductQueryResultPayload([], 0)
|
|
9040
9312
|
});
|
|
9041
9313
|
case 13:
|
|
9042
9314
|
if (!(queryIds.length > 0)) {
|
|
9043
|
-
|
|
9315
|
+
_context86.next = 25;
|
|
9044
9316
|
break;
|
|
9045
9317
|
}
|
|
9046
9318
|
uniqueIds = Array.from(new Set(queryIds));
|
|
9047
9319
|
_tPrice = performance.now();
|
|
9048
|
-
|
|
9320
|
+
_context86.next = 18;
|
|
9049
9321
|
return this.products.getProductsWithPrice(schedule_date, formatterContext, {
|
|
9050
9322
|
changedIds: options === null || options === void 0 ? void 0 : options.changedIds,
|
|
9051
9323
|
productIds: uniqueIds
|
|
9052
9324
|
});
|
|
9053
9325
|
case 18:
|
|
9054
|
-
productsWithPrice =
|
|
9326
|
+
productsWithPrice = _context86.sent;
|
|
9055
9327
|
perfMark('computeQuery.getProductsWithPrice(ids)', performance.now() - _tPrice, {
|
|
9056
9328
|
count: productsWithPrice.length,
|
|
9057
9329
|
ids: uniqueIds
|
|
@@ -9069,7 +9341,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
9069
9341
|
ids: uniqueIds,
|
|
9070
9342
|
count: extensionFilteredProducts.length
|
|
9071
9343
|
});
|
|
9072
|
-
return
|
|
9344
|
+
return _context86.abrupt("return", {
|
|
9073
9345
|
code: 200,
|
|
9074
9346
|
data: this.buildProductQueryResultPayload(extensionFilteredProducts),
|
|
9075
9347
|
message: '',
|
|
@@ -9077,17 +9349,17 @@ var Server = /*#__PURE__*/function () {
|
|
|
9077
9349
|
});
|
|
9078
9350
|
case 25:
|
|
9079
9351
|
if (!(product_id != null && Number.isFinite(Number(product_id)))) {
|
|
9080
|
-
|
|
9352
|
+
_context86.next = 37;
|
|
9081
9353
|
break;
|
|
9082
9354
|
}
|
|
9083
9355
|
pid = Number(product_id);
|
|
9084
9356
|
_tPrice2 = performance.now();
|
|
9085
|
-
|
|
9357
|
+
_context86.next = 30;
|
|
9086
9358
|
return this.products.getProductsWithPrice(schedule_date, formatterContext, {
|
|
9087
9359
|
changedIds: options === null || options === void 0 ? void 0 : options.changedIds
|
|
9088
9360
|
});
|
|
9089
9361
|
case 30:
|
|
9090
|
-
allProductsWithPrice =
|
|
9362
|
+
allProductsWithPrice = _context86.sent;
|
|
9091
9363
|
perfMark('computeQuery.getProductsWithPrice(single)', performance.now() - _tPrice2, {
|
|
9092
9364
|
count: allProductsWithPrice.length,
|
|
9093
9365
|
productId: pid
|
|
@@ -9105,7 +9377,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
9105
9377
|
productId: pid,
|
|
9106
9378
|
found: !!item
|
|
9107
9379
|
});
|
|
9108
|
-
return
|
|
9380
|
+
return _context86.abrupt("return", {
|
|
9109
9381
|
code: 200,
|
|
9110
9382
|
data: item,
|
|
9111
9383
|
message: item ? '' : '商品不存在或未发布',
|
|
@@ -9113,16 +9385,16 @@ var Server = /*#__PURE__*/function () {
|
|
|
9113
9385
|
});
|
|
9114
9386
|
case 37:
|
|
9115
9387
|
if (!this.shouldQueryProductsByExtensionTypes(extension_type)) {
|
|
9116
|
-
|
|
9388
|
+
_context86.next = 57;
|
|
9117
9389
|
break;
|
|
9118
9390
|
}
|
|
9119
9391
|
_tPrice3 = performance.now();
|
|
9120
|
-
|
|
9392
|
+
_context86.next = 41;
|
|
9121
9393
|
return this.products.getProductsWithPrice(schedule_date, formatterContext, {
|
|
9122
9394
|
changedIds: options === null || options === void 0 ? void 0 : options.changedIds
|
|
9123
9395
|
});
|
|
9124
9396
|
case 41:
|
|
9125
|
-
_filteredProducts2 =
|
|
9397
|
+
_filteredProducts2 = _context86.sent;
|
|
9126
9398
|
perfMark('computeQuery.getProductsWithPrice(extensionType)', performance.now() - _tPrice3, {
|
|
9127
9399
|
count: _filteredProducts2.length,
|
|
9128
9400
|
extension_type: extension_type
|
|
@@ -9159,7 +9431,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
9159
9431
|
filteredCount: _filteredProducts2.length,
|
|
9160
9432
|
extension_type: extension_type
|
|
9161
9433
|
});
|
|
9162
|
-
return
|
|
9434
|
+
return _context86.abrupt("return", {
|
|
9163
9435
|
code: 200,
|
|
9164
9436
|
data: this.buildProductQueryResultPayload(_filteredProducts2),
|
|
9165
9437
|
message: '',
|
|
@@ -9167,50 +9439,50 @@ var Server = /*#__PURE__*/function () {
|
|
|
9167
9439
|
});
|
|
9168
9440
|
case 57:
|
|
9169
9441
|
if (this.menu) {
|
|
9170
|
-
|
|
9442
|
+
_context86.next = 60;
|
|
9171
9443
|
break;
|
|
9172
9444
|
}
|
|
9173
9445
|
this.logError('computeProductQueryResult: Menu 模块未注册');
|
|
9174
|
-
return
|
|
9446
|
+
return _context86.abrupt("return", {
|
|
9175
9447
|
message: 'Menu 模块未注册',
|
|
9176
9448
|
data: this.buildProductQueryResultPayload([], 0)
|
|
9177
9449
|
});
|
|
9178
9450
|
case 60:
|
|
9179
9451
|
if (this.schedule) {
|
|
9180
|
-
|
|
9452
|
+
_context86.next = 63;
|
|
9181
9453
|
break;
|
|
9182
9454
|
}
|
|
9183
9455
|
this.logError('computeProductQueryResult: Schedule 模块未注册');
|
|
9184
|
-
return
|
|
9456
|
+
return _context86.abrupt("return", {
|
|
9185
9457
|
message: 'Schedule 模块未注册',
|
|
9186
9458
|
data: this.buildProductQueryResultPayload([], 0)
|
|
9187
9459
|
});
|
|
9188
9460
|
case 63:
|
|
9189
9461
|
activeMenuList = [];
|
|
9190
9462
|
if (!(menu_list_ids && Array.isArray(menu_list_ids) && menu_list_ids.length > 0)) {
|
|
9191
|
-
|
|
9463
|
+
_context86.next = 76;
|
|
9192
9464
|
break;
|
|
9193
9465
|
}
|
|
9194
9466
|
tMenu = performance.now();
|
|
9195
9467
|
getActiveMenus = function getActiveMenus() {
|
|
9196
|
-
return
|
|
9197
|
-
var
|
|
9198
|
-
return ((
|
|
9468
|
+
return _this29.menu.getMenuByIds(menu_list_ids).filter(function (menu) {
|
|
9469
|
+
var _this29$schedule;
|
|
9470
|
+
return ((_this29$schedule = _this29.schedule) === null || _this29$schedule === void 0 ? void 0 : _this29$schedule.getDateIsInSchedule(schedule_datetime, menu.schedule)) || false;
|
|
9199
9471
|
});
|
|
9200
9472
|
};
|
|
9201
9473
|
activeMenuList = getActiveMenus();
|
|
9202
|
-
|
|
9203
|
-
if (!
|
|
9204
|
-
|
|
9474
|
+
_context86.t0 = !activeMenuList.length;
|
|
9475
|
+
if (!_context86.t0) {
|
|
9476
|
+
_context86.next = 73;
|
|
9205
9477
|
break;
|
|
9206
9478
|
}
|
|
9207
|
-
|
|
9479
|
+
_context86.next = 72;
|
|
9208
9480
|
return this.refreshMenuScheduleCacheAfterEmptyResult();
|
|
9209
9481
|
case 72:
|
|
9210
|
-
|
|
9482
|
+
_context86.t0 = _context86.sent;
|
|
9211
9483
|
case 73:
|
|
9212
|
-
if (!
|
|
9213
|
-
|
|
9484
|
+
if (!_context86.t0) {
|
|
9485
|
+
_context86.next = 75;
|
|
9214
9486
|
break;
|
|
9215
9487
|
}
|
|
9216
9488
|
activeMenuList = getActiveMenus();
|
|
@@ -9230,22 +9502,22 @@ var Server = /*#__PURE__*/function () {
|
|
|
9230
9502
|
});
|
|
9231
9503
|
tPrice = performance.now();
|
|
9232
9504
|
if (!(scopedProductIds.length > 0)) {
|
|
9233
|
-
|
|
9505
|
+
_context86.next = 87;
|
|
9234
9506
|
break;
|
|
9235
9507
|
}
|
|
9236
|
-
|
|
9508
|
+
_context86.next = 84;
|
|
9237
9509
|
return this.products.getProductsWithPrice(schedule_date, formatterContext, {
|
|
9238
9510
|
changedIds: options === null || options === void 0 ? void 0 : options.changedIds,
|
|
9239
9511
|
productIds: productScope.isAllProducts ? undefined : scopedProductIds
|
|
9240
9512
|
});
|
|
9241
9513
|
case 84:
|
|
9242
|
-
|
|
9243
|
-
|
|
9514
|
+
_context86.t1 = _context86.sent;
|
|
9515
|
+
_context86.next = 88;
|
|
9244
9516
|
break;
|
|
9245
9517
|
case 87:
|
|
9246
|
-
|
|
9518
|
+
_context86.t1 = [];
|
|
9247
9519
|
case 88:
|
|
9248
|
-
filteredProducts =
|
|
9520
|
+
filteredProducts = _context86.t1;
|
|
9249
9521
|
perfMark('computeQuery.getProductsWithPrice', performance.now() - tPrice, {
|
|
9250
9522
|
count: filteredProducts.length,
|
|
9251
9523
|
scopedProductCount: scopedProductIds.length
|
|
@@ -9284,7 +9556,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
9284
9556
|
filteredCount: filteredProducts.length,
|
|
9285
9557
|
activeMenuCount: activeMenuList.length
|
|
9286
9558
|
});
|
|
9287
|
-
return
|
|
9559
|
+
return _context86.abrupt("return", {
|
|
9288
9560
|
code: 200,
|
|
9289
9561
|
data: this.buildProductQueryResultPayload(filteredProducts),
|
|
9290
9562
|
message: '',
|
|
@@ -9292,11 +9564,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
9292
9564
|
});
|
|
9293
9565
|
case 104:
|
|
9294
9566
|
case "end":
|
|
9295
|
-
return
|
|
9567
|
+
return _context86.stop();
|
|
9296
9568
|
}
|
|
9297
|
-
},
|
|
9569
|
+
}, _callee86, this);
|
|
9298
9570
|
}));
|
|
9299
|
-
function computeProductQueryResult(
|
|
9571
|
+
function computeProductQueryResult(_x100, _x101) {
|
|
9300
9572
|
return _computeProductQueryResult.apply(this, arguments);
|
|
9301
9573
|
}
|
|
9302
9574
|
return computeProductQueryResult;
|
|
@@ -9334,74 +9606,74 @@ var Server = /*#__PURE__*/function () {
|
|
|
9334
9606
|
}, {
|
|
9335
9607
|
key: "recomputeAndNotifyProductQuery",
|
|
9336
9608
|
value: (function () {
|
|
9337
|
-
var _recomputeAndNotifyProductQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
9609
|
+
var _recomputeAndNotifyProductQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee87(options) {
|
|
9338
9610
|
var _iterator18, _step18, _step18$value, subscriberId, subscriber, result, errorMessage;
|
|
9339
|
-
return _regeneratorRuntime().wrap(function
|
|
9340
|
-
while (1) switch (
|
|
9611
|
+
return _regeneratorRuntime().wrap(function _callee87$(_context87) {
|
|
9612
|
+
while (1) switch (_context87.prev = _context87.next) {
|
|
9341
9613
|
case 0:
|
|
9342
9614
|
if (!(this.productQuerySubscribers.size === 0)) {
|
|
9343
|
-
|
|
9615
|
+
_context87.next = 2;
|
|
9344
9616
|
break;
|
|
9345
9617
|
}
|
|
9346
|
-
return
|
|
9618
|
+
return _context87.abrupt("return");
|
|
9347
9619
|
case 2:
|
|
9348
9620
|
this.logInfo('recomputeAndNotifyProductQuery: 开始推送', {
|
|
9349
9621
|
subscriberCount: this.productQuerySubscribers.size,
|
|
9350
9622
|
changedIds: options === null || options === void 0 ? void 0 : options.changedIds
|
|
9351
9623
|
});
|
|
9352
9624
|
_iterator18 = _createForOfIteratorHelper(this.productQuerySubscribers.entries());
|
|
9353
|
-
|
|
9625
|
+
_context87.prev = 4;
|
|
9354
9626
|
_iterator18.s();
|
|
9355
9627
|
case 6:
|
|
9356
9628
|
if ((_step18 = _iterator18.n()).done) {
|
|
9357
|
-
|
|
9629
|
+
_context87.next = 23;
|
|
9358
9630
|
break;
|
|
9359
9631
|
}
|
|
9360
9632
|
_step18$value = _slicedToArray(_step18.value, 2), subscriberId = _step18$value[0], subscriber = _step18$value[1];
|
|
9361
|
-
|
|
9362
|
-
|
|
9633
|
+
_context87.prev = 8;
|
|
9634
|
+
_context87.next = 11;
|
|
9363
9635
|
return this.computeProductQueryResult(subscriber.context, {
|
|
9364
9636
|
changedIds: options === null || options === void 0 ? void 0 : options.changedIds
|
|
9365
9637
|
});
|
|
9366
9638
|
case 11:
|
|
9367
|
-
result =
|
|
9368
|
-
|
|
9639
|
+
result = _context87.sent;
|
|
9640
|
+
_context87.next = 14;
|
|
9369
9641
|
return subscriber.callback(result);
|
|
9370
9642
|
case 14:
|
|
9371
9643
|
this.logInfo('recomputeAndNotifyProductQuery: 已推送', {
|
|
9372
9644
|
subscriberId: subscriberId
|
|
9373
9645
|
});
|
|
9374
|
-
|
|
9646
|
+
_context87.next = 21;
|
|
9375
9647
|
break;
|
|
9376
9648
|
case 17:
|
|
9377
|
-
|
|
9378
|
-
|
|
9379
|
-
errorMessage =
|
|
9649
|
+
_context87.prev = 17;
|
|
9650
|
+
_context87.t0 = _context87["catch"](8);
|
|
9651
|
+
errorMessage = _context87.t0 instanceof Error ? _context87.t0.message : String(_context87.t0);
|
|
9380
9652
|
this.logError('recomputeAndNotifyProductQuery: 推送失败', {
|
|
9381
9653
|
subscriberId: subscriberId,
|
|
9382
9654
|
error: errorMessage
|
|
9383
9655
|
});
|
|
9384
9656
|
case 21:
|
|
9385
|
-
|
|
9657
|
+
_context87.next = 6;
|
|
9386
9658
|
break;
|
|
9387
9659
|
case 23:
|
|
9388
|
-
|
|
9660
|
+
_context87.next = 28;
|
|
9389
9661
|
break;
|
|
9390
9662
|
case 25:
|
|
9391
|
-
|
|
9392
|
-
|
|
9393
|
-
_iterator18.e(
|
|
9663
|
+
_context87.prev = 25;
|
|
9664
|
+
_context87.t1 = _context87["catch"](4);
|
|
9665
|
+
_iterator18.e(_context87.t1);
|
|
9394
9666
|
case 28:
|
|
9395
|
-
|
|
9667
|
+
_context87.prev = 28;
|
|
9396
9668
|
_iterator18.f();
|
|
9397
|
-
return
|
|
9669
|
+
return _context87.finish(28);
|
|
9398
9670
|
case 31:
|
|
9399
9671
|
case "end":
|
|
9400
|
-
return
|
|
9672
|
+
return _context87.stop();
|
|
9401
9673
|
}
|
|
9402
|
-
},
|
|
9674
|
+
}, _callee87, this, [[4, 25, 28, 31], [8, 17]]);
|
|
9403
9675
|
}));
|
|
9404
|
-
function recomputeAndNotifyProductQuery(
|
|
9676
|
+
function recomputeAndNotifyProductQuery(_x102) {
|
|
9405
9677
|
return _recomputeAndNotifyProductQuery.apply(this, arguments);
|
|
9406
9678
|
}
|
|
9407
9679
|
return recomputeAndNotifyProductQuery;
|
|
@@ -9413,16 +9685,16 @@ var Server = /*#__PURE__*/function () {
|
|
|
9413
9685
|
}, {
|
|
9414
9686
|
key: "recomputeAndNotifyOrderQuery",
|
|
9415
9687
|
value: (function () {
|
|
9416
|
-
var _recomputeAndNotifyOrderQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
9688
|
+
var _recomputeAndNotifyOrderQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee88() {
|
|
9417
9689
|
var notifyStartAt, _iterator19, _step19, _step19$value, subscriberId, subscriber, computeStartAt, result, computeEndAt, callbackStartAt, callbackEndAt, errorMessage, notifyEndAt;
|
|
9418
|
-
return _regeneratorRuntime().wrap(function
|
|
9419
|
-
while (1) switch (
|
|
9690
|
+
return _regeneratorRuntime().wrap(function _callee88$(_context88) {
|
|
9691
|
+
while (1) switch (_context88.prev = _context88.next) {
|
|
9420
9692
|
case 0:
|
|
9421
9693
|
if (!(this.orderQuerySubscribers.size === 0)) {
|
|
9422
|
-
|
|
9694
|
+
_context88.next = 2;
|
|
9423
9695
|
break;
|
|
9424
9696
|
}
|
|
9425
|
-
return
|
|
9697
|
+
return _context88.abrupt("return");
|
|
9426
9698
|
case 2:
|
|
9427
9699
|
notifyStartAt = Date.now();
|
|
9428
9700
|
this.logInfo('recomputeAndNotifyOrderQuery: 开始推送', {
|
|
@@ -9430,20 +9702,20 @@ var Server = /*#__PURE__*/function () {
|
|
|
9430
9702
|
notifyStartAt: new Date(notifyStartAt).toISOString()
|
|
9431
9703
|
});
|
|
9432
9704
|
_iterator19 = _createForOfIteratorHelper(this.orderQuerySubscribers.entries());
|
|
9433
|
-
|
|
9705
|
+
_context88.prev = 5;
|
|
9434
9706
|
_iterator19.s();
|
|
9435
9707
|
case 7:
|
|
9436
9708
|
if ((_step19 = _iterator19.n()).done) {
|
|
9437
|
-
|
|
9709
|
+
_context88.next = 27;
|
|
9438
9710
|
break;
|
|
9439
9711
|
}
|
|
9440
9712
|
_step19$value = _slicedToArray(_step19.value, 2), subscriberId = _step19$value[0], subscriber = _step19$value[1];
|
|
9441
|
-
|
|
9713
|
+
_context88.prev = 9;
|
|
9442
9714
|
computeStartAt = Date.now();
|
|
9443
|
-
|
|
9715
|
+
_context88.next = 13;
|
|
9444
9716
|
return this.computeOrderQueryResult(subscriber.context);
|
|
9445
9717
|
case 13:
|
|
9446
|
-
result =
|
|
9718
|
+
result = _context88.sent;
|
|
9447
9719
|
computeEndAt = Date.now();
|
|
9448
9720
|
callbackStartAt = Date.now();
|
|
9449
9721
|
subscriber.callback(result);
|
|
@@ -9454,30 +9726,30 @@ var Server = /*#__PURE__*/function () {
|
|
|
9454
9726
|
callbackDurationMs: callbackEndAt - callbackStartAt,
|
|
9455
9727
|
totalDurationMs: callbackEndAt - computeStartAt
|
|
9456
9728
|
});
|
|
9457
|
-
|
|
9729
|
+
_context88.next = 25;
|
|
9458
9730
|
break;
|
|
9459
9731
|
case 21:
|
|
9460
|
-
|
|
9461
|
-
|
|
9462
|
-
errorMessage =
|
|
9732
|
+
_context88.prev = 21;
|
|
9733
|
+
_context88.t0 = _context88["catch"](9);
|
|
9734
|
+
errorMessage = _context88.t0 instanceof Error ? _context88.t0.message : String(_context88.t0);
|
|
9463
9735
|
this.logError('recomputeAndNotifyOrderQuery: 推送失败', {
|
|
9464
9736
|
subscriberId: subscriberId,
|
|
9465
9737
|
error: errorMessage
|
|
9466
9738
|
});
|
|
9467
9739
|
case 25:
|
|
9468
|
-
|
|
9740
|
+
_context88.next = 7;
|
|
9469
9741
|
break;
|
|
9470
9742
|
case 27:
|
|
9471
|
-
|
|
9743
|
+
_context88.next = 32;
|
|
9472
9744
|
break;
|
|
9473
9745
|
case 29:
|
|
9474
|
-
|
|
9475
|
-
|
|
9476
|
-
_iterator19.e(
|
|
9746
|
+
_context88.prev = 29;
|
|
9747
|
+
_context88.t1 = _context88["catch"](5);
|
|
9748
|
+
_iterator19.e(_context88.t1);
|
|
9477
9749
|
case 32:
|
|
9478
|
-
|
|
9750
|
+
_context88.prev = 32;
|
|
9479
9751
|
_iterator19.f();
|
|
9480
|
-
return
|
|
9752
|
+
return _context88.finish(32);
|
|
9481
9753
|
case 35:
|
|
9482
9754
|
notifyEndAt = Date.now();
|
|
9483
9755
|
this.logInfo('recomputeAndNotifyOrderQuery: 推送完成', {
|
|
@@ -9486,9 +9758,9 @@ var Server = /*#__PURE__*/function () {
|
|
|
9486
9758
|
});
|
|
9487
9759
|
case 37:
|
|
9488
9760
|
case "end":
|
|
9489
|
-
return
|
|
9761
|
+
return _context88.stop();
|
|
9490
9762
|
}
|
|
9491
|
-
},
|
|
9763
|
+
}, _callee88, this, [[5, 29, 32, 35], [9, 21]]);
|
|
9492
9764
|
}));
|
|
9493
9765
|
function recomputeAndNotifyOrderQuery() {
|
|
9494
9766
|
return _recomputeAndNotifyOrderQuery.apply(this, arguments);
|
|
@@ -9506,7 +9778,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
9506
9778
|
}, {
|
|
9507
9779
|
key: "notifySalesSearchSubscribers",
|
|
9508
9780
|
value: function notifySalesSearchSubscribers(payload) {
|
|
9509
|
-
var
|
|
9781
|
+
var _this30 = this;
|
|
9510
9782
|
if (this.salesSearchSubscribers.size === 0) return;
|
|
9511
9783
|
var changedOrders = this.extractChangedOrdersFromPayload(payload);
|
|
9512
9784
|
if (changedOrders.length === 0) {
|
|
@@ -9524,21 +9796,21 @@ var Server = /*#__PURE__*/function () {
|
|
|
9524
9796
|
subscriber = _step20$value[1];
|
|
9525
9797
|
try {
|
|
9526
9798
|
var changedVisibleOrders = changedOrders.filter(function (order) {
|
|
9527
|
-
var orderId =
|
|
9799
|
+
var orderId = _this30.getSalesSearchOrderId(order);
|
|
9528
9800
|
return !!orderId && subscriber.visibleOrderIds.has(orderId);
|
|
9529
9801
|
});
|
|
9530
9802
|
if (changedVisibleOrders.length === 0) {
|
|
9531
9803
|
return 1; // continue
|
|
9532
9804
|
}
|
|
9533
|
-
subscriber.callback(
|
|
9534
|
-
|
|
9805
|
+
subscriber.callback(_this30.buildSalesSearchDeltaResponse(subscriber, changedVisibleOrders));
|
|
9806
|
+
_this30.logInfo('notifySalesSearchSubscribers: 已推送 delta', {
|
|
9535
9807
|
subscriberId: subscriberId,
|
|
9536
9808
|
kind: subscriber.kind,
|
|
9537
9809
|
count: changedVisibleOrders.length
|
|
9538
9810
|
});
|
|
9539
9811
|
} catch (error) {
|
|
9540
9812
|
var errorMessage = error instanceof Error ? error.message : String(error);
|
|
9541
|
-
|
|
9813
|
+
_this30.logError('notifySalesSearchSubscribers: 推送失败', {
|
|
9542
9814
|
subscriberId: subscriberId,
|
|
9543
9815
|
error: errorMessage
|
|
9544
9816
|
});
|
|
@@ -9629,67 +9901,67 @@ var Server = /*#__PURE__*/function () {
|
|
|
9629
9901
|
}, {
|
|
9630
9902
|
key: "recomputeAndNotifyBookingQuery",
|
|
9631
9903
|
value: (function () {
|
|
9632
|
-
var _recomputeAndNotifyBookingQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
9904
|
+
var _recomputeAndNotifyBookingQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee89() {
|
|
9633
9905
|
var _iterator21, _step21, _step21$value, subscriberId, subscriber, result, errorMessage;
|
|
9634
|
-
return _regeneratorRuntime().wrap(function
|
|
9635
|
-
while (1) switch (
|
|
9906
|
+
return _regeneratorRuntime().wrap(function _callee89$(_context89) {
|
|
9907
|
+
while (1) switch (_context89.prev = _context89.next) {
|
|
9636
9908
|
case 0:
|
|
9637
9909
|
if (!(this.bookingQuerySubscribers.size === 0)) {
|
|
9638
|
-
|
|
9910
|
+
_context89.next = 2;
|
|
9639
9911
|
break;
|
|
9640
9912
|
}
|
|
9641
|
-
return
|
|
9913
|
+
return _context89.abrupt("return");
|
|
9642
9914
|
case 2:
|
|
9643
9915
|
this.logInfo('recomputeAndNotifyBookingQuery: 开始推送', {
|
|
9644
9916
|
subscriberCount: this.bookingQuerySubscribers.size
|
|
9645
9917
|
});
|
|
9646
9918
|
_iterator21 = _createForOfIteratorHelper(this.bookingQuerySubscribers.entries());
|
|
9647
|
-
|
|
9919
|
+
_context89.prev = 4;
|
|
9648
9920
|
_iterator21.s();
|
|
9649
9921
|
case 6:
|
|
9650
9922
|
if ((_step21 = _iterator21.n()).done) {
|
|
9651
|
-
|
|
9923
|
+
_context89.next = 22;
|
|
9652
9924
|
break;
|
|
9653
9925
|
}
|
|
9654
9926
|
_step21$value = _slicedToArray(_step21.value, 2), subscriberId = _step21$value[0], subscriber = _step21$value[1];
|
|
9655
|
-
|
|
9656
|
-
|
|
9927
|
+
_context89.prev = 8;
|
|
9928
|
+
_context89.next = 11;
|
|
9657
9929
|
return this.computeBookingQueryResult(subscriber.context);
|
|
9658
9930
|
case 11:
|
|
9659
|
-
result =
|
|
9931
|
+
result = _context89.sent;
|
|
9660
9932
|
subscriber.callback(result);
|
|
9661
9933
|
this.logInfo('recomputeAndNotifyBookingQuery: 已推送', {
|
|
9662
9934
|
subscriberId: subscriberId
|
|
9663
9935
|
});
|
|
9664
|
-
|
|
9936
|
+
_context89.next = 20;
|
|
9665
9937
|
break;
|
|
9666
9938
|
case 16:
|
|
9667
|
-
|
|
9668
|
-
|
|
9669
|
-
errorMessage =
|
|
9939
|
+
_context89.prev = 16;
|
|
9940
|
+
_context89.t0 = _context89["catch"](8);
|
|
9941
|
+
errorMessage = _context89.t0 instanceof Error ? _context89.t0.message : String(_context89.t0);
|
|
9670
9942
|
this.logError('recomputeAndNotifyBookingQuery: 推送失败', {
|
|
9671
9943
|
subscriberId: subscriberId,
|
|
9672
9944
|
error: errorMessage
|
|
9673
9945
|
});
|
|
9674
9946
|
case 20:
|
|
9675
|
-
|
|
9947
|
+
_context89.next = 6;
|
|
9676
9948
|
break;
|
|
9677
9949
|
case 22:
|
|
9678
|
-
|
|
9950
|
+
_context89.next = 27;
|
|
9679
9951
|
break;
|
|
9680
9952
|
case 24:
|
|
9681
|
-
|
|
9682
|
-
|
|
9683
|
-
_iterator21.e(
|
|
9953
|
+
_context89.prev = 24;
|
|
9954
|
+
_context89.t1 = _context89["catch"](4);
|
|
9955
|
+
_iterator21.e(_context89.t1);
|
|
9684
9956
|
case 27:
|
|
9685
|
-
|
|
9957
|
+
_context89.prev = 27;
|
|
9686
9958
|
_iterator21.f();
|
|
9687
|
-
return
|
|
9959
|
+
return _context89.finish(27);
|
|
9688
9960
|
case 30:
|
|
9689
9961
|
case "end":
|
|
9690
|
-
return
|
|
9962
|
+
return _context89.stop();
|
|
9691
9963
|
}
|
|
9692
|
-
},
|
|
9964
|
+
}, _callee89, this, [[4, 24, 27, 30], [8, 16]]);
|
|
9693
9965
|
}));
|
|
9694
9966
|
function recomputeAndNotifyBookingQuery() {
|
|
9695
9967
|
return _recomputeAndNotifyBookingQuery.apply(this, arguments);
|