@pisell/pisellos 2.3.38 → 2.3.40
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/core/index.d.ts +0 -2
- package/dist/core/index.js +0 -7
- package/dist/model/strategy/adapter/promotion/adapter.d.ts +0 -4
- package/dist/model/strategy/adapter/promotion/adapter.js +0 -23
- package/dist/model/strategy/adapter/promotion/evaluator.d.ts +0 -17
- package/dist/model/strategy/adapter/promotion/evaluator.js +6 -279
- package/dist/model/strategy/adapter/promotion/examples.d.ts +0 -86
- package/dist/model/strategy/adapter/promotion/examples.js +0 -99
- package/dist/model/strategy/adapter/promotion/index.d.ts +1 -1
- package/dist/model/strategy/adapter/promotion/type.d.ts +2 -90
- package/dist/model/strategy/adapter/promotion/type.js +0 -45
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +3 -5
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +3 -6
- package/dist/modules/Discount/index.d.ts +1 -0
- package/dist/modules/Discount/index.js +40 -11
- package/dist/modules/Discount/types.d.ts +1 -0
- package/dist/modules/Holder/index.d.ts +48 -0
- package/dist/modules/Holder/index.js +640 -0
- package/dist/modules/Holder/types.d.ts +123 -0
- package/dist/modules/Holder/types.js +1 -0
- package/dist/modules/Holder/utils.d.ts +13 -0
- package/dist/modules/Holder/utils.js +34 -0
- package/dist/modules/OpenData/index.d.ts +0 -2
- package/dist/modules/OpenData/index.js +2 -10
- package/dist/modules/Order/index.d.ts +11 -28
- package/dist/modules/Order/index.js +509 -750
- package/dist/modules/Order/types.d.ts +10 -33
- package/dist/modules/Order/utils/orderCollectionIdentity.js +2 -7
- package/dist/modules/Order/utils.d.ts +10 -0
- package/dist/modules/Order/utils.js +41 -13
- package/dist/modules/Payment/index.d.ts +0 -2
- package/dist/modules/Payment/index.js +50 -79
- package/dist/modules/Payment/types.d.ts +28 -99
- package/dist/modules/Payment/types.js +3 -20
- package/dist/modules/Payment/walletpass.d.ts +1 -25
- package/dist/modules/Payment/walletpass.js +157 -707
- package/dist/modules/Product/types.d.ts +1 -0
- package/dist/modules/ProductList/index.js +33 -14
- package/dist/modules/Quotation/index.d.ts +1 -1
- package/dist/modules/Quotation/index.js +2 -2
- package/dist/modules/ResourcePlanner/index.d.ts +24 -0
- package/dist/modules/ResourcePlanner/index.js +181 -0
- package/dist/modules/ResourcePlanner/planner.d.ts +14 -0
- package/dist/modules/ResourcePlanner/planner.js +1069 -0
- package/dist/modules/ResourcePlanner/types.d.ts +227 -0
- package/dist/modules/ResourcePlanner/types.js +1 -0
- package/dist/modules/Rules/index.d.ts +0 -1
- package/dist/modules/Rules/index.js +96 -89
- package/dist/modules/SalesSummary/index.js +12 -13
- package/dist/modules/ScanOrderLogger/index.d.ts +2 -0
- package/dist/modules/ScanOrderLogger/index.js +15 -2
- package/dist/modules/ScanOrderLogger/providers/feishu.js +45 -27
- package/dist/modules/ScanOrderLogger/types.d.ts +1 -0
- package/dist/modules/Schedule/index.d.ts +3 -1
- package/dist/modules/Schedule/index.js +21 -16
- package/dist/modules/Summary/utils.js +38 -13
- package/dist/modules/index.d.ts +2 -0
- package/dist/modules/index.js +3 -1
- package/dist/plugins/window.d.ts +1 -0
- package/dist/server/index.d.ts +14 -16
- package/dist/server/index.js +1148 -1930
- package/dist/server/modules/order/index.d.ts +4 -54
- package/dist/server/modules/order/index.js +695 -1595
- package/dist/server/modules/order/types.d.ts +3 -11
- package/dist/server/modules/order/types.js +1 -1
- package/dist/solution/BaseSales/index.d.ts +20 -109
- package/dist/solution/BaseSales/index.js +481 -1797
- package/dist/solution/BaseSales/types.d.ts +0 -52
- package/dist/solution/BaseSales/types.js +1 -2
- package/dist/solution/BaseSales/utils/cartPromotion.d.ts +1 -3
- package/dist/solution/BaseSales/utils/cartPromotion.js +31 -90
- package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +1 -6
- package/dist/solution/BookingByStep/index.d.ts +17 -2
- package/dist/solution/BookingByStep/index.js +294 -215
- package/dist/solution/BookingByStep/types.d.ts +2 -1
- package/dist/solution/BookingByStep/types.js +3 -1
- package/dist/solution/BookingByStep/utils/capacity.js +17 -1
- package/dist/solution/BookingByStep/utils/timeslots.d.ts +3 -1
- package/dist/solution/BookingByStep/utils/timeslots.js +19 -12
- package/dist/solution/BookingTicket/index.d.ts +4 -8
- package/dist/solution/BookingTicket/index.js +51 -134
- package/dist/solution/BookingTicket/utils/addProductDecision.js +0 -6
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +0 -8
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +82 -172
- package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts +3 -1
- package/dist/solution/BookingTicket/utils/scan/handleScan.js +10 -2
- package/dist/solution/Sales/index.d.ts +0 -1
- package/dist/solution/Sales/index.js +2 -10
- package/dist/solution/ScanOrder/index.d.ts +26 -14
- package/dist/solution/ScanOrder/index.js +1148 -756
- package/dist/solution/ScanOrder/types.d.ts +21 -1
- package/dist/solution/ScanOrder/utils.d.ts +8 -0
- package/dist/solution/ScanOrder/utils.js +66 -25
- package/dist/solution/ShopDiscount/index.d.ts +1 -0
- package/dist/solution/ShopDiscount/index.js +125 -87
- package/dist/solution/UnifiedBookingSales/index.d.ts +183 -0
- package/dist/solution/UnifiedBookingSales/index.js +1871 -0
- package/dist/solution/UnifiedBookingSales/types.d.ts +143 -0
- package/dist/solution/UnifiedBookingSales/types.js +11 -0
- package/dist/solution/VenueBooking/index.d.ts +39 -11
- package/dist/solution/VenueBooking/index.js +1176 -860
- package/dist/solution/VenueBooking/types.d.ts +3 -0
- package/dist/solution/VenueBooking/utils/resource.js +1 -0
- package/dist/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
- package/dist/solution/VenueBooking/utils/slotMerge.js +10 -5
- package/dist/solution/index.d.ts +1 -0
- package/dist/solution/index.js +2 -1
- package/dist/types/index.d.ts +1 -1
- package/lib/core/index.d.ts +0 -2
- package/lib/core/index.js +0 -4
- package/lib/model/strategy/adapter/promotion/adapter.d.ts +0 -4
- package/lib/model/strategy/adapter/promotion/adapter.js +0 -20
- package/lib/model/strategy/adapter/promotion/evaluator.d.ts +0 -17
- package/lib/model/strategy/adapter/promotion/evaluator.js +0 -235
- package/lib/model/strategy/adapter/promotion/examples.d.ts +0 -86
- package/lib/model/strategy/adapter/promotion/examples.js +0 -91
- package/lib/model/strategy/adapter/promotion/index.d.ts +1 -1
- package/lib/model/strategy/adapter/promotion/index.js +0 -2
- package/lib/model/strategy/adapter/promotion/type.d.ts +2 -90
- package/lib/model/strategy/adapter/promotion/type.js +0 -2
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +1 -2
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +1 -2
- package/lib/modules/Discount/index.d.ts +1 -0
- package/lib/modules/Discount/index.js +9 -0
- package/lib/modules/Discount/types.d.ts +1 -0
- package/lib/modules/Holder/index.d.ts +48 -0
- package/lib/modules/Holder/index.js +402 -0
- package/lib/modules/Holder/types.d.ts +123 -0
- package/lib/modules/Holder/types.js +17 -0
- package/lib/modules/Holder/utils.d.ts +13 -0
- package/lib/modules/Holder/utils.js +71 -0
- package/lib/modules/OpenData/index.d.ts +0 -2
- package/lib/modules/OpenData/index.js +1 -6
- package/lib/modules/Order/index.d.ts +11 -28
- package/lib/modules/Order/index.js +86 -196
- package/lib/modules/Order/types.d.ts +10 -33
- package/lib/modules/Order/utils/orderCollectionIdentity.js +0 -3
- package/lib/modules/Order/utils.d.ts +10 -0
- package/lib/modules/Order/utils.js +40 -16
- package/lib/modules/Payment/index.d.ts +0 -2
- package/lib/modules/Payment/index.js +13 -34
- package/lib/modules/Payment/types.d.ts +28 -99
- package/lib/modules/Payment/types.js +3 -4
- package/lib/modules/Payment/walletpass.d.ts +1 -25
- package/lib/modules/Payment/walletpass.js +21 -470
- package/lib/modules/Product/types.d.ts +1 -0
- package/lib/modules/ProductList/index.js +40 -31
- package/lib/modules/Quotation/index.d.ts +1 -1
- package/lib/modules/Quotation/index.js +2 -2
- package/lib/modules/ResourcePlanner/index.d.ts +24 -0
- package/lib/modules/ResourcePlanner/index.js +148 -0
- package/lib/modules/ResourcePlanner/planner.d.ts +14 -0
- package/lib/modules/ResourcePlanner/planner.js +933 -0
- package/lib/modules/ResourcePlanner/types.d.ts +227 -0
- package/lib/modules/ResourcePlanner/types.js +17 -0
- package/lib/modules/Rules/index.d.ts +0 -1
- package/lib/modules/Rules/index.js +40 -47
- package/lib/modules/SalesSummary/index.js +6 -7
- package/lib/modules/ScanOrderLogger/index.d.ts +2 -0
- package/lib/modules/ScanOrderLogger/index.js +13 -1
- package/lib/modules/ScanOrderLogger/providers/feishu.js +15 -6
- package/lib/modules/ScanOrderLogger/types.d.ts +1 -0
- package/lib/modules/Schedule/index.d.ts +3 -1
- package/lib/modules/Schedule/index.js +10 -8
- package/lib/modules/Summary/utils.js +21 -1
- package/lib/modules/index.d.ts +2 -0
- package/lib/modules/index.js +5 -1
- package/lib/plugins/window.d.ts +1 -0
- package/lib/server/index.d.ts +14 -16
- package/lib/server/index.js +83 -675
- package/lib/server/modules/order/index.d.ts +4 -54
- package/lib/server/modules/order/index.js +66 -679
- package/lib/server/modules/order/types.d.ts +3 -11
- package/lib/solution/BaseSales/index.d.ts +20 -109
- package/lib/solution/BaseSales/index.js +70 -881
- package/lib/solution/BaseSales/types.d.ts +0 -52
- package/lib/solution/BaseSales/types.js +1 -2
- package/lib/solution/BaseSales/utils/cartPromotion.d.ts +1 -3
- package/lib/solution/BaseSales/utils/cartPromotion.js +12 -63
- package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +1 -6
- package/lib/solution/BookingByStep/index.d.ts +17 -2
- package/lib/solution/BookingByStep/index.js +60 -18
- package/lib/solution/BookingByStep/types.d.ts +2 -1
- package/lib/solution/BookingByStep/types.js +5 -0
- package/lib/solution/BookingByStep/utils/capacity.js +20 -1
- package/lib/solution/BookingByStep/utils/timeslots.d.ts +3 -1
- package/lib/solution/BookingByStep/utils/timeslots.js +19 -11
- package/lib/solution/BookingTicket/index.d.ts +4 -8
- package/lib/solution/BookingTicket/index.js +19 -64
- package/lib/solution/BookingTicket/utils/addProductDecision.js +0 -4
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +0 -8
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +4 -36
- package/lib/solution/BookingTicket/utils/scan/handleScan.d.ts +3 -1
- package/lib/solution/BookingTicket/utils/scan/handleScan.js +2 -2
- package/lib/solution/Sales/index.d.ts +0 -1
- package/lib/solution/Sales/index.js +3 -5
- package/lib/solution/ScanOrder/index.d.ts +26 -14
- package/lib/solution/ScanOrder/index.js +449 -190
- package/lib/solution/ScanOrder/types.d.ts +21 -1
- package/lib/solution/ScanOrder/utils.d.ts +8 -0
- package/lib/solution/ScanOrder/utils.js +31 -0
- package/lib/solution/ShopDiscount/index.d.ts +1 -0
- package/lib/solution/ShopDiscount/index.js +14 -0
- package/lib/solution/UnifiedBookingSales/index.d.ts +183 -0
- package/lib/solution/UnifiedBookingSales/index.js +1076 -0
- package/lib/solution/UnifiedBookingSales/types.d.ts +143 -0
- package/lib/solution/UnifiedBookingSales/types.js +33 -0
- package/lib/solution/VenueBooking/index.d.ts +39 -11
- package/lib/solution/VenueBooking/index.js +328 -123
- package/lib/solution/VenueBooking/types.d.ts +3 -0
- package/lib/solution/VenueBooking/utils/resource.js +1 -0
- package/lib/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
- package/lib/solution/VenueBooking/utils/slotMerge.js +6 -4
- package/lib/solution/index.d.ts +1 -0
- package/lib/solution/index.js +3 -1
- package/lib/types/index.d.ts +1 -1
- package/package.json +1 -1
- package/dist/modules/Order/payment-utils.d.ts +0 -26
- package/dist/modules/Order/payment-utils.js +0 -225
- package/dist/solution/BookingTicket/utils/weighingProductSku.d.ts +0 -5
- package/dist/solution/BookingTicket/utils/weighingProductSku.js +0 -45
- package/dist/utils/payment-number.d.ts +0 -9
- package/dist/utils/payment-number.js +0 -69
- package/lib/modules/Order/payment-utils.d.ts +0 -26
- package/lib/modules/Order/payment-utils.js +0 -224
- package/lib/solution/BookingTicket/utils/weighingProductSku.d.ts +0 -5
- package/lib/solution/BookingTicket/utils/weighingProductSku.js +0 -63
- package/lib/utils/payment-number.d.ts +0 -9
- package/lib/utils/payment-number.js +0 -64
|
@@ -32,11 +32,9 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
|
32
32
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
33
33
|
import { BaseModule } from "../BaseModule";
|
|
34
34
|
import { OrderHooks } from "./types";
|
|
35
|
-
import { composeLinePrice, generateDuration, getAllDiscountList, mergeRelationForms, buildSubmitPayload, createDefaultTempOrder, createDefaultOrderRulesHooks, createEmptySummary, createUuidV4, formatDateTime, isTempOrder, normalizeBookingIsAll, normalizeBookingSubType, mapPaymentItemsToOrderPayments, normalizeOrderProductDiscountList, resolveEffectivePerUnitDiscount, ensureProductSku, getProductSkuOptions, normalizeProductSkuOptions, sumOptionUnitPrice, clearTempOrderHolderAssignments, getOrderProductLineUid, indexOrderProductsByUid, calculateOrderProductsDeposit, mergeOrderProductDisplayFields, resolveIsFormSubject } from "./utils";
|
|
35
|
+
import { composeLinePrice, generateDuration, getAllDiscountList, mergeRelationForms, ensureCartItemOriginHolder, buildSubmitPayload, createDefaultTempOrder, createDefaultOrderRulesHooks, createEmptySummary, createUuidV4, formatDateTime, isTempOrder, normalizeBookingIsAll, normalizeBookingSubType, mapPaymentItemsToOrderPayments, normalizeOrderProductDiscountList, resolveEffectivePerUnitDiscount, ensureProductSku, getProductSkuOptions, normalizeProductSkuOptions, sumOptionUnitPrice, clearTempOrderHolderAssignments, getOrderProductLineUid, indexOrderProductsByUid, calculateOrderProductsDeposit, mergeOrderProductDisplayFields, resolveIsFormSubject } from "./utils";
|
|
36
36
|
import { isNormalProduct } from "../Product/utils";
|
|
37
37
|
import dayjs from 'dayjs';
|
|
38
|
-
import { ensureOrderPaymentNumber, mergeOrderPaymentRecord, resolveOrderPaymentIdentity } from "./payment-utils";
|
|
39
|
-
import { resolvePaymentNumberDevicePrefix, resolvePaymentNumberDevicePrefixFromDeviceId } from "../../utils/payment-number";
|
|
40
38
|
import { processCartPromotion, appendPromotionTags as _appendPromotionTags, getOrderProductUid as getPromotionUid } from "../../solution/BaseSales/utils/cartPromotion";
|
|
41
39
|
import { buildProductLineFingerprint, getProductIdentityIndex, getSafeProductNum, isIdentityMatch, normalizeOrderProduct } from "../../solution/ScanOrder/utils";
|
|
42
40
|
import { syncManualProductDiscountProductNum } from "./utils/manualProductDiscount";
|
|
@@ -85,10 +83,6 @@ function isPaidPaymentRecord(payment) {
|
|
|
85
83
|
function isCommittedVoucherPaymentRecord(payment) {
|
|
86
84
|
return isVoucherPaymentRecord(payment) && (payment === null || payment === void 0 ? void 0 : payment.status) !== 'voided' && (hasSyncedOrderPaymentRecord(payment) || isPaidPaymentRecord(payment));
|
|
87
85
|
}
|
|
88
|
-
function getVoucherPaymentLifecycleKey(payment) {
|
|
89
|
-
if (!isVoucherPaymentRecord(payment)) return null;
|
|
90
|
-
return "".concat(String(payment.voucher_id), "::").concat(String(payment.status || ''));
|
|
91
|
-
}
|
|
92
86
|
export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
93
87
|
_inherits(OrderModule, _BaseModule);
|
|
94
88
|
var _super = _createSuper(OrderModule);
|
|
@@ -103,7 +97,6 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
103
97
|
_defineProperty(_assertThisInitialized(_this), "logger", void 0);
|
|
104
98
|
// LoggerManager 实例
|
|
105
99
|
_defineProperty(_assertThisInitialized(_this), "window", void 0);
|
|
106
|
-
_defineProperty(_assertThisInitialized(_this), "appPlugin", void 0);
|
|
107
100
|
_defineProperty(_assertThisInitialized(_this), "cacheId", void 0);
|
|
108
101
|
_defineProperty(_assertThisInitialized(_this), "salesSummaryModuleName", void 0);
|
|
109
102
|
_defineProperty(_assertThisInitialized(_this), "rulesHooksOverride", void 0);
|
|
@@ -290,8 +283,8 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
290
283
|
key: "initialize",
|
|
291
284
|
value: function () {
|
|
292
285
|
var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(core, options) {
|
|
293
|
-
var _otherParams$rules, _otherParams$order, _otherParams$hooks;
|
|
294
|
-
var app, otherParams;
|
|
286
|
+
var _appPlugin$getApp, _otherParams$rules, _otherParams$order, _otherParams$hooks;
|
|
287
|
+
var appPlugin, app, otherParams;
|
|
295
288
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
296
289
|
while (1) switch (_context.prev = _context.next) {
|
|
297
290
|
case 0:
|
|
@@ -307,15 +300,12 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
307
300
|
this.store.availableWalletIds = [];
|
|
308
301
|
}
|
|
309
302
|
this.request = this.core.getPlugin('request');
|
|
310
|
-
|
|
311
|
-
if (
|
|
312
|
-
|
|
313
|
-
break;
|
|
303
|
+
appPlugin = this.core.getPlugin('app');
|
|
304
|
+
if (!appPlugin) {
|
|
305
|
+
console.error('Order 模块需要 app 插件支持');
|
|
314
306
|
}
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
app = this.appPlugin.getApp();
|
|
318
|
-
this.logger = app.logger;
|
|
307
|
+
app = appPlugin === null || appPlugin === void 0 || (_appPlugin$getApp = appPlugin.getApp) === null || _appPlugin$getApp === void 0 ? void 0 : _appPlugin$getApp.call(appPlugin);
|
|
308
|
+
this.logger = app === null || app === void 0 ? void 0 : app.logger;
|
|
319
309
|
this.window = this.core.getPlugin('window');
|
|
320
310
|
otherParams = options.otherParams || {};
|
|
321
311
|
this.cacheId = otherParams.cacheId;
|
|
@@ -326,7 +316,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
326
316
|
this.otherParams = otherParams;
|
|
327
317
|
this.registerDiscountModules(options);
|
|
328
318
|
this.logInfo('OrderModule initialized successfully');
|
|
329
|
-
case
|
|
319
|
+
case 20:
|
|
330
320
|
case "end":
|
|
331
321
|
return _context.stop();
|
|
332
322
|
}
|
|
@@ -1231,6 +1221,16 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1231
1221
|
value: function persistTempOrder() {
|
|
1232
1222
|
// no-op: OrderModule 的刷新恢复不再依赖 localStorage。
|
|
1233
1223
|
}
|
|
1224
|
+
}, {
|
|
1225
|
+
key: "notifyTempOrderChanged",
|
|
1226
|
+
value: function notifyTempOrderChanged() {
|
|
1227
|
+
if (!this.store.tempOrder) return;
|
|
1228
|
+
this.store.tempOrder = _objectSpread(_objectSpread({}, this.store.tempOrder), {}, {
|
|
1229
|
+
products: _toConsumableArray(this.store.tempOrder.products),
|
|
1230
|
+
bookings: this.store.tempOrder.bookings ? _toConsumableArray(this.store.tempOrder.bookings) : []
|
|
1231
|
+
});
|
|
1232
|
+
this.persistTempOrder();
|
|
1233
|
+
}
|
|
1234
1234
|
|
|
1235
1235
|
// ─── TempOrder: 创建 & 获取 ───
|
|
1236
1236
|
}, {
|
|
@@ -1517,44 +1517,19 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1517
1517
|
var depositPaidAmount = this.calculateDepositPaidAmount(tempOrder.payments || []);
|
|
1518
1518
|
return depositPaidAmount.lt(depositAmount) ? 'deposit' : 'normal';
|
|
1519
1519
|
}
|
|
1520
|
-
}, {
|
|
1521
|
-
key: "getPaymentNumberAppData",
|
|
1522
|
-
value: function getPaymentNumberAppData(key) {
|
|
1523
|
-
var _appPlugin$getData, _app$models, _app$models$getStore, _app$models$getStore$, _app$models$getStore$2;
|
|
1524
|
-
var appPlugin = this.appPlugin;
|
|
1525
|
-
if (!appPlugin) return undefined;
|
|
1526
|
-
var getData = (_appPlugin$getData = appPlugin.getData) === null || _appPlugin$getData === void 0 ? void 0 : _appPlugin$getData.call(appPlugin);
|
|
1527
|
-
if (typeof getData === 'function') return getData(key);
|
|
1528
|
-
var app = appPlugin.getApp();
|
|
1529
|
-
var coreData = app === null || app === void 0 || (_app$models = app.models) === null || _app$models === void 0 || (_app$models$getStore = _app$models.getStore) === null || _app$models$getStore === void 0 || (_app$models$getStore$ = (_app$models$getStore$2 = _app$models$getStore.call(_app$models)).getDataByModel) === null || _app$models$getStore$ === void 0 ? void 0 : _app$models$getStore$.call(_app$models$getStore$2, 'core', 'core');
|
|
1530
|
-
return coreData === null || coreData === void 0 ? void 0 : coreData[key];
|
|
1531
|
-
}
|
|
1532
|
-
}, {
|
|
1533
|
-
key: "getPaymentNumberDevicePrefixSync",
|
|
1534
|
-
value: function getPaymentNumberDevicePrefixSync() {
|
|
1535
|
-
var _this7 = this;
|
|
1536
|
-
return resolvePaymentNumberDevicePrefixFromDeviceId(function (key) {
|
|
1537
|
-
return _this7.getPaymentNumberAppData(key);
|
|
1538
|
-
});
|
|
1539
|
-
}
|
|
1540
|
-
}, {
|
|
1541
|
-
key: "getPaymentNumberDevicePrefixAsync",
|
|
1542
|
-
value: function getPaymentNumberDevicePrefixAsync() {
|
|
1543
|
-
var _this8 = this;
|
|
1544
|
-
return resolvePaymentNumberDevicePrefix(function (key) {
|
|
1545
|
-
return _this8.getPaymentNumberAppData(key);
|
|
1546
|
-
});
|
|
1547
|
-
}
|
|
1548
1520
|
}, {
|
|
1549
1521
|
key: "normalizePaymentSource",
|
|
1550
1522
|
value: function normalizePaymentSource(payment, options) {
|
|
1551
1523
|
var _ref19, _paymentRecord$origin;
|
|
1552
1524
|
var paymentRecord = payment;
|
|
1553
1525
|
var metadata = paymentRecord.metadata && _typeof(paymentRecord.metadata) === 'object' ? _objectSpread({}, paymentRecord.metadata) : {};
|
|
1554
|
-
|
|
1526
|
+
if (!metadata.unique_payment_number) {
|
|
1527
|
+
metadata.unique_payment_number = createUuidV4();
|
|
1528
|
+
}
|
|
1529
|
+
var normalized = _objectSpread(_objectSpread({}, paymentRecord), {}, {
|
|
1555
1530
|
metadata: metadata,
|
|
1556
1531
|
origin_amount: (_ref19 = (_paymentRecord$origin = paymentRecord.origin_amount) !== null && _paymentRecord$origin !== void 0 ? _paymentRecord$origin : paymentRecord.amount) !== null && _ref19 !== void 0 ? _ref19 : '0.00'
|
|
1557
|
-
})
|
|
1532
|
+
});
|
|
1558
1533
|
if (paymentRecord.status !== undefined) {
|
|
1559
1534
|
normalized.status = paymentRecord.status;
|
|
1560
1535
|
} else if ((options === null || options === void 0 ? void 0 : options.defaultPaid) !== false) {
|
|
@@ -1672,16 +1647,16 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1672
1647
|
}, {
|
|
1673
1648
|
key: "calculatePaidPaymentSummary",
|
|
1674
1649
|
value: function calculatePaidPaymentSummary(payments) {
|
|
1675
|
-
var
|
|
1650
|
+
var _this7 = this;
|
|
1676
1651
|
return (payments || []).reduce(function (summary, payment) {
|
|
1677
1652
|
var paymentRecord = payment;
|
|
1678
1653
|
if (!isPaidPaymentRecord(paymentRecord)) return summary;
|
|
1679
1654
|
return {
|
|
1680
1655
|
customerPaidAmount: summary.customerPaidAmount.plus(paymentRecord.amount || 0),
|
|
1681
|
-
orderPaidAmount: summary.orderPaidAmount.plus(
|
|
1682
|
-
gapPaidAmount: summary.gapPaidAmount.plus(
|
|
1683
|
-
payServiceChargeAmount: summary.payServiceChargeAmount.plus(
|
|
1684
|
-
roundingAmount: summary.roundingAmount.plus(
|
|
1656
|
+
orderPaidAmount: summary.orderPaidAmount.plus(_this7.calculatePaymentOrderAmount(paymentRecord)),
|
|
1657
|
+
gapPaidAmount: summary.gapPaidAmount.plus(_this7.calculatePaymentGapAmount(paymentRecord)),
|
|
1658
|
+
payServiceChargeAmount: summary.payServiceChargeAmount.plus(_this7.calculatePaymentServiceFee(paymentRecord)),
|
|
1659
|
+
roundingAmount: summary.roundingAmount.plus(_this7.calculatePaymentRoundingAmount(paymentRecord))
|
|
1685
1660
|
};
|
|
1686
1661
|
}, {
|
|
1687
1662
|
customerPaidAmount: new Decimal(0),
|
|
@@ -1883,15 +1858,15 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1883
1858
|
}, {
|
|
1884
1859
|
key: "normalizeFingerprintValue",
|
|
1885
1860
|
value: function normalizeFingerprintValue(value) {
|
|
1886
|
-
var
|
|
1861
|
+
var _this8 = this;
|
|
1887
1862
|
if (Array.isArray(value)) {
|
|
1888
1863
|
return value.map(function (item) {
|
|
1889
|
-
return
|
|
1864
|
+
return _this8.normalizeFingerprintValue(item);
|
|
1890
1865
|
});
|
|
1891
1866
|
}
|
|
1892
1867
|
if (!value || _typeof(value) !== 'object') return value !== null && value !== void 0 ? value : '';
|
|
1893
1868
|
return Object.keys(value).sort().reduce(function (result, key) {
|
|
1894
|
-
result[key] =
|
|
1869
|
+
result[key] = _this8.normalizeFingerprintValue(value[key]);
|
|
1895
1870
|
return result;
|
|
1896
1871
|
}, {});
|
|
1897
1872
|
}
|
|
@@ -1906,7 +1881,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1906
1881
|
_sku$barcode,
|
|
1907
1882
|
_ref20,
|
|
1908
1883
|
_sku$variant_id,
|
|
1909
|
-
|
|
1884
|
+
_this9 = this;
|
|
1910
1885
|
var sku = (product === null || product === void 0 ? void 0 : product.product_sku) || {};
|
|
1911
1886
|
var metadata = (product === null || product === void 0 ? void 0 : product.metadata) || {};
|
|
1912
1887
|
var discountTypes = ((product === null || product === void 0 ? void 0 : product.discount_list) || []).map(function (discount) {
|
|
@@ -1940,7 +1915,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1940
1915
|
option_group_id: (_option$option_group_ = option === null || option === void 0 ? void 0 : option.option_group_id) !== null && _option$option_group_ !== void 0 ? _option$option_group_ : null,
|
|
1941
1916
|
option_group_item_id: (_ref22 = (_option$option_group_2 = option === null || option === void 0 ? void 0 : option.option_group_item_id) !== null && _option$option_group_2 !== void 0 ? _option$option_group_2 : option === null || option === void 0 ? void 0 : option.id) !== null && _ref22 !== void 0 ? _ref22 : null,
|
|
1942
1917
|
num: Number((_option$num = option === null || option === void 0 ? void 0 : option.num) !== null && _option$num !== void 0 ? _option$num : 1) || 1,
|
|
1943
|
-
add_price:
|
|
1918
|
+
add_price: _this9.normalizeFingerprintMoney((_option$add_price = option === null || option === void 0 ? void 0 : option.add_price) !== null && _option$add_price !== void 0 ? _option$add_price : option === null || option === void 0 ? void 0 : option.price)
|
|
1944
1919
|
};
|
|
1945
1920
|
})
|
|
1946
1921
|
}),
|
|
@@ -1950,8 +1925,8 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1950
1925
|
bundle_product_id: (_ref23 = (_ref24 = (_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 && _ref24 !== void 0 ? _ref24 : bundle === null || bundle === void 0 ? void 0 : bundle.product_id) !== null && _ref23 !== void 0 ? _ref23 : null,
|
|
1951
1926
|
bundle_variant_id: (_ref25 = (_bundle$bundle_varian = bundle === null || bundle === void 0 ? void 0 : bundle.bundle_variant_id) !== null && _bundle$bundle_varian !== void 0 ? _bundle$bundle_varian : bundle === null || bundle === void 0 ? void 0 : bundle.product_variant_id) !== null && _ref25 !== void 0 ? _ref25 : 0,
|
|
1952
1927
|
num: getSafeProductNum((_bundle$num = bundle === null || bundle === void 0 ? void 0 : bundle.num) !== null && _bundle$num !== void 0 ? _bundle$num : bundle === null || bundle === void 0 ? void 0 : bundle.quantity),
|
|
1953
|
-
price:
|
|
1954
|
-
bundle_selling_price:
|
|
1928
|
+
price: _this9.normalizeFingerprintMoney(bundle === null || bundle === void 0 ? void 0 : bundle.price),
|
|
1929
|
+
bundle_selling_price: _this9.normalizeFingerprintMoney(bundle === null || bundle === void 0 ? void 0 : bundle.bundle_selling_price),
|
|
1955
1930
|
price_type: (_bundle$price_type = bundle === null || bundle === void 0 ? void 0 : bundle.price_type) !== null && _bundle$price_type !== void 0 ? _bundle$price_type : '',
|
|
1956
1931
|
price_type_ext: (_bundle$price_type_ex = bundle === null || bundle === void 0 ? void 0 : bundle.price_type_ext) !== null && _bundle$price_type_ex !== void 0 ? _bundle$price_type_ex : ''
|
|
1957
1932
|
};
|
|
@@ -1961,7 +1936,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1961
1936
|
return {
|
|
1962
1937
|
type: (_ref26 = (_discount$type2 = discount === null || discount === void 0 ? void 0 : discount.type) !== null && _discount$type2 !== void 0 ? _discount$type2 : discount === null || discount === void 0 ? void 0 : discount.tag) !== null && _ref26 !== void 0 ? _ref26 : '',
|
|
1963
1938
|
discount_id: (_ref27 = (_ref28 = (_discount$discount_id = discount === null || discount === void 0 ? void 0 : discount.discount_id) !== null && _discount$discount_id !== void 0 ? _discount$discount_id : discount === null || discount === void 0 ? void 0 : discount.order_discount_id) !== null && _ref28 !== void 0 ? _ref28 : discount === null || discount === void 0 || (_discount$discount = discount.discount) === null || _discount$discount === void 0 ? void 0 : _discount$discount.resource_id) !== null && _ref27 !== void 0 ? _ref27 : null,
|
|
1964
|
-
amount:
|
|
1939
|
+
amount: _this9.normalizeFingerprintMoney(discount === null || discount === void 0 ? void 0 : discount.amount)
|
|
1965
1940
|
};
|
|
1966
1941
|
}))
|
|
1967
1942
|
};
|
|
@@ -1969,9 +1944,9 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1969
1944
|
}, {
|
|
1970
1945
|
key: "buildOrderProductsFingerprint",
|
|
1971
1946
|
value: function buildOrderProductsFingerprint(products) {
|
|
1972
|
-
var
|
|
1947
|
+
var _this10 = this;
|
|
1973
1948
|
var items = (products || []).map(function (product) {
|
|
1974
|
-
return
|
|
1949
|
+
return _this10.buildProductFingerprintItem(product);
|
|
1975
1950
|
});
|
|
1976
1951
|
items.sort(function (left, right) {
|
|
1977
1952
|
return JSON.stringify(left).localeCompare(JSON.stringify(right));
|
|
@@ -1993,7 +1968,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1993
1968
|
_sku$barcode2,
|
|
1994
1969
|
_ref30,
|
|
1995
1970
|
_sku$variant_id2,
|
|
1996
|
-
|
|
1971
|
+
_this11 = this;
|
|
1997
1972
|
var sku = (product === null || product === void 0 ? void 0 : product.product_sku) || {};
|
|
1998
1973
|
var metadata = (product === null || product === void 0 ? void 0 : product.metadata) || {};
|
|
1999
1974
|
var discountTypes = ((product === null || product === void 0 ? void 0 : product.discount_list) || []).map(function (discount) {
|
|
@@ -2024,7 +1999,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2024
1999
|
option_group_id: (_option$option_group_3 = option === null || option === void 0 ? void 0 : option.option_group_id) !== null && _option$option_group_3 !== void 0 ? _option$option_group_3 : null,
|
|
2025
2000
|
option_group_item_id: (_ref32 = (_option$option_group_4 = option === null || option === void 0 ? void 0 : option.option_group_item_id) !== null && _option$option_group_4 !== void 0 ? _option$option_group_4 : option === null || option === void 0 ? void 0 : option.id) !== null && _ref32 !== void 0 ? _ref32 : null,
|
|
2026
2001
|
num: Number((_option$num2 = option === null || option === void 0 ? void 0 : option.num) !== null && _option$num2 !== void 0 ? _option$num2 : 1) || 1,
|
|
2027
|
-
add_price:
|
|
2002
|
+
add_price: _this11.normalizeFingerprintMoney((_option$add_price2 = option === null || option === void 0 ? void 0 : option.add_price) !== null && _option$add_price2 !== void 0 ? _option$add_price2 : option === null || option === void 0 ? void 0 : option.price)
|
|
2028
2003
|
};
|
|
2029
2004
|
})
|
|
2030
2005
|
}),
|
|
@@ -2038,14 +2013,14 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2038
2013
|
num: getSafeProductNum((_bundle$num2 = bundle === null || bundle === void 0 ? void 0 : bundle.num) !== null && _bundle$num2 !== void 0 ? _bundle$num2 : bundle === null || bundle === void 0 ? void 0 : bundle.quantity),
|
|
2039
2014
|
price_type: (_bundle$price_type2 = bundle === null || bundle === void 0 ? void 0 : bundle.price_type) !== null && _bundle$price_type2 !== void 0 ? _bundle$price_type2 : '',
|
|
2040
2015
|
price_type_ext: (_bundle$price_type_ex2 = bundle === null || bundle === void 0 ? void 0 : bundle.price_type_ext) !== null && _bundle$price_type_ex2 !== void 0 ? _bundle$price_type_ex2 : '',
|
|
2041
|
-
option:
|
|
2016
|
+
option: _this11.normalizeFingerprintValue(((bundle === null || bundle === void 0 ? void 0 : bundle.option) || []).map(function (option) {
|
|
2042
2017
|
var _ref38, _option$id3, _option$option_group_5, _ref39, _option$option_group_6, _option$num3, _option$add_price3;
|
|
2043
2018
|
return {
|
|
2044
2019
|
id: (_ref38 = (_option$id3 = option === null || option === void 0 ? void 0 : option.id) !== null && _option$id3 !== void 0 ? _option$id3 : option === null || option === void 0 ? void 0 : option.option_group_item_id) !== null && _ref38 !== void 0 ? _ref38 : null,
|
|
2045
2020
|
option_group_id: (_option$option_group_5 = option === null || option === void 0 ? void 0 : option.option_group_id) !== null && _option$option_group_5 !== void 0 ? _option$option_group_5 : null,
|
|
2046
2021
|
option_group_item_id: (_ref39 = (_option$option_group_6 = option === null || option === void 0 ? void 0 : option.option_group_item_id) !== null && _option$option_group_6 !== void 0 ? _option$option_group_6 : option === null || option === void 0 ? void 0 : option.id) !== null && _ref39 !== void 0 ? _ref39 : null,
|
|
2047
2022
|
num: Number((_option$num3 = option === null || option === void 0 ? void 0 : option.num) !== null && _option$num3 !== void 0 ? _option$num3 : 1) || 1,
|
|
2048
|
-
add_price:
|
|
2023
|
+
add_price: _this11.normalizeFingerprintMoney((_option$add_price3 = option === null || option === void 0 ? void 0 : option.add_price) !== null && _option$add_price3 !== void 0 ? _option$add_price3 : option === null || option === void 0 ? void 0 : option.price)
|
|
2049
2024
|
};
|
|
2050
2025
|
}))
|
|
2051
2026
|
};
|
|
@@ -2055,7 +2030,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2055
2030
|
return {
|
|
2056
2031
|
type: (_ref40 = (_discount$type4 = discount === null || discount === void 0 ? void 0 : discount.type) !== null && _discount$type4 !== void 0 ? _discount$type4 : discount === null || discount === void 0 ? void 0 : discount.tag) !== null && _ref40 !== void 0 ? _ref40 : '',
|
|
2057
2032
|
discount_id: (_ref41 = (_ref42 = (_discount$discount_id2 = discount === null || discount === void 0 ? void 0 : discount.discount_id) !== null && _discount$discount_id2 !== void 0 ? _discount$discount_id2 : discount === null || discount === void 0 ? void 0 : discount.order_discount_id) !== null && _ref42 !== void 0 ? _ref42 : discount === null || discount === void 0 || (_discount$discount2 = discount.discount) === null || _discount$discount2 === void 0 ? void 0 : _discount$discount2.resource_id) !== null && _ref41 !== void 0 ? _ref41 : null,
|
|
2058
|
-
amount:
|
|
2033
|
+
amount: _this11.normalizeFingerprintMoney(discount === null || discount === void 0 ? void 0 : discount.amount)
|
|
2059
2034
|
};
|
|
2060
2035
|
}))
|
|
2061
2036
|
};
|
|
@@ -2063,9 +2038,9 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2063
2038
|
}, {
|
|
2064
2039
|
key: "buildOrderProductsStructuralFingerprint",
|
|
2065
2040
|
value: function buildOrderProductsStructuralFingerprint(products) {
|
|
2066
|
-
var
|
|
2041
|
+
var _this12 = this;
|
|
2067
2042
|
var items = (products || []).map(function (product) {
|
|
2068
|
-
return
|
|
2043
|
+
return _this12.buildProductStructuralFingerprintItem(product);
|
|
2069
2044
|
});
|
|
2070
2045
|
items.sort(function (left, right) {
|
|
2071
2046
|
return JSON.stringify(left).localeCompare(JSON.stringify(right));
|
|
@@ -2493,9 +2468,9 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2493
2468
|
}, {
|
|
2494
2469
|
key: "sanitizeTempOrderProducts",
|
|
2495
2470
|
value: function sanitizeTempOrderProducts(tempOrder) {
|
|
2496
|
-
var
|
|
2471
|
+
var _this13 = this;
|
|
2497
2472
|
tempOrder.products = (tempOrder.products || []).map(function (product) {
|
|
2498
|
-
return
|
|
2473
|
+
return _this13.sanitizeOrderProductForTempOrder(product);
|
|
2499
2474
|
});
|
|
2500
2475
|
}
|
|
2501
2476
|
}, {
|
|
@@ -2598,7 +2573,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2598
2573
|
}, {
|
|
2599
2574
|
key: "syncLinkedBookingHoldersToProducts",
|
|
2600
2575
|
value: function syncLinkedBookingHoldersToProducts(tempOrder) {
|
|
2601
|
-
var
|
|
2576
|
+
var _this14 = this;
|
|
2602
2577
|
var bookings = tempOrder.bookings || [];
|
|
2603
2578
|
var products = tempOrder.products || [];
|
|
2604
2579
|
if (!bookings.length || !products.length) return;
|
|
@@ -2623,7 +2598,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2623
2598
|
var bookingUid = product.booking_uid || ((_product$metadata6 = product.metadata) === null || _product$metadata6 === void 0 ? void 0 : _product$metadata6.booking_uid);
|
|
2624
2599
|
var linkedBooking = (productUid !== undefined && productUid !== null && String(productUid) !== '' ? bookingByProductUid.get(String(productUid)) : undefined) || (bookingUid !== undefined && bookingUid !== null && String(bookingUid) !== '' ? bookingByBookingUid.get(String(bookingUid)) : undefined);
|
|
2625
2600
|
if (linkedBooking) {
|
|
2626
|
-
|
|
2601
|
+
_this14.setProductHolderFromBooking(product, linkedBooking);
|
|
2627
2602
|
}
|
|
2628
2603
|
});
|
|
2629
2604
|
}
|
|
@@ -2751,9 +2726,9 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2751
2726
|
}, {
|
|
2752
2727
|
key: "findBookingIndexByUniqueIdentificationNumber",
|
|
2753
2728
|
value: function findBookingIndexByUniqueIdentificationNumber(tempOrder, uniqueIdentificationNumber) {
|
|
2754
|
-
var
|
|
2729
|
+
var _this15 = this;
|
|
2755
2730
|
return (tempOrder.bookings || []).findIndex(function (booking) {
|
|
2756
|
-
return
|
|
2731
|
+
return _this15.getBookingUniqueIdentificationNumber(booking) === uniqueIdentificationNumber;
|
|
2757
2732
|
});
|
|
2758
2733
|
}
|
|
2759
2734
|
}, {
|
|
@@ -2761,12 +2736,12 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2761
2736
|
value: function removeLinkedBookingsForProduct(tempOrder, product) {
|
|
2762
2737
|
var _product$metadata7,
|
|
2763
2738
|
_product$metadata8,
|
|
2764
|
-
|
|
2739
|
+
_this16 = this;
|
|
2765
2740
|
var productUid = (product === null || product === void 0 || (_product$metadata7 = product.metadata) === null || _product$metadata7 === void 0 ? void 0 : _product$metadata7.unique_identification_number) || (product === null || product === void 0 ? void 0 : product.unique_identification_number);
|
|
2766
2741
|
var bookingUid = (product === null || product === void 0 ? void 0 : product.booking_uid) || (product === null || product === void 0 || (_product$metadata8 = product.metadata) === null || _product$metadata8 === void 0 ? void 0 : _product$metadata8.booking_uid);
|
|
2767
2742
|
if (!productUid && !bookingUid) return;
|
|
2768
2743
|
tempOrder.bookings = (tempOrder.bookings || []).filter(function (booking) {
|
|
2769
|
-
var currentBookingUid =
|
|
2744
|
+
var currentBookingUid = _this16.getBookingUniqueIdentificationNumber(booking);
|
|
2770
2745
|
if (bookingUid && currentBookingUid === String(bookingUid)) return false;
|
|
2771
2746
|
if (productUid && String((booking === null || booking === void 0 ? void 0 : booking.product_uid) || '') === String(productUid)) return false;
|
|
2772
2747
|
return true;
|
|
@@ -3099,15 +3074,15 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3099
3074
|
}, {
|
|
3100
3075
|
key: "productHasCustomerBoundDiscount",
|
|
3101
3076
|
value: function productHasCustomerBoundDiscount(product) {
|
|
3102
|
-
var
|
|
3077
|
+
var _this17 = this;
|
|
3103
3078
|
if (((product === null || product === void 0 ? void 0 : product.discount_list) || []).some(function (discount) {
|
|
3104
|
-
return
|
|
3079
|
+
return _this17.isCustomerBoundDiscount(discount);
|
|
3105
3080
|
})) {
|
|
3106
3081
|
return true;
|
|
3107
3082
|
}
|
|
3108
3083
|
return ((product === null || product === void 0 ? void 0 : product.product_bundle) || []).some(function (bundle) {
|
|
3109
3084
|
return ((bundle === null || bundle === void 0 ? void 0 : bundle.discount_list) || []).some(function (discount) {
|
|
3110
|
-
return
|
|
3085
|
+
return _this17.isCustomerBoundDiscount(discount);
|
|
3111
3086
|
});
|
|
3112
3087
|
});
|
|
3113
3088
|
}
|
|
@@ -3116,18 +3091,18 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3116
3091
|
value: function shouldSkipDiscountCalculation(tempOrder) {
|
|
3117
3092
|
var _this$store$discount17,
|
|
3118
3093
|
_this$store$discount18,
|
|
3119
|
-
|
|
3094
|
+
_this18 = this;
|
|
3120
3095
|
if (this.hasActiveCustomerBoundDiscount) return false;
|
|
3121
3096
|
var discountList = ((_this$store$discount17 = this.store.discount) === null || _this$store$discount17 === void 0 || (_this$store$discount18 = _this$store$discount17.getDiscountList) === null || _this$store$discount18 === void 0 ? void 0 : _this$store$discount18.call(_this$store$discount17)) || [];
|
|
3122
3097
|
if (discountList.length > 0) return false;
|
|
3123
3098
|
return !(tempOrder.products || []).some(function (product) {
|
|
3124
|
-
return
|
|
3099
|
+
return _this18.productHasCustomerBoundDiscount(product);
|
|
3125
3100
|
});
|
|
3126
3101
|
}
|
|
3127
3102
|
}, {
|
|
3128
3103
|
key: "clearCustomerBoundDiscounts",
|
|
3129
3104
|
value: function clearCustomerBoundDiscounts(tempOrder) {
|
|
3130
|
-
var
|
|
3105
|
+
var _this19 = this,
|
|
3131
3106
|
_discountModule$getDi,
|
|
3132
3107
|
_discountModule$getOr,
|
|
3133
3108
|
_discountModule$setDi,
|
|
@@ -3136,7 +3111,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3136
3111
|
var filterDiscountList = function filterDiscountList(discountList) {
|
|
3137
3112
|
if (!Array.isArray(discountList)) return [];
|
|
3138
3113
|
return discountList.filter(function (discount) {
|
|
3139
|
-
var shouldRemove =
|
|
3114
|
+
var shouldRemove = _this19.isCustomerBoundDiscount(discount);
|
|
3140
3115
|
if (shouldRemove) didRemoveCustomerBoundDiscount = true;
|
|
3141
3116
|
return !shouldRemove;
|
|
3142
3117
|
});
|
|
@@ -3163,12 +3138,12 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3163
3138
|
var currentDiscounts = ((_discountModule$getDi = discountModule.getDiscountList) === null || _discountModule$getDi === void 0 ? void 0 : _discountModule$getDi.call(discountModule)) || [];
|
|
3164
3139
|
var currentOriginalDiscounts = ((_discountModule$getOr = discountModule.getOriginalDiscountList) === null || _discountModule$getOr === void 0 ? void 0 : _discountModule$getOr.call(discountModule)) || [];
|
|
3165
3140
|
var nextDiscounts = currentDiscounts.filter(function (discount) {
|
|
3166
|
-
if (
|
|
3167
|
-
return !
|
|
3141
|
+
if (_this19.shouldKeepCustomerBoundDiscountAfterCustomerChange(discount)) return true;
|
|
3142
|
+
return !_this19.isCustomerBoundDiscount(discount);
|
|
3168
3143
|
});
|
|
3169
3144
|
var nextOriginalDiscounts = currentOriginalDiscounts.filter(function (discount) {
|
|
3170
|
-
if (
|
|
3171
|
-
return !
|
|
3145
|
+
if (_this19.shouldKeepCustomerBoundDiscountAfterCustomerChange(discount)) return true;
|
|
3146
|
+
return !_this19.isCustomerBoundDiscount(discount);
|
|
3172
3147
|
});
|
|
3173
3148
|
void ((_discountModule$setDi = discountModule.setDiscountList) === null || _discountModule$setDi === void 0 ? void 0 : _discountModule$setDi.call(discountModule, nextDiscounts));
|
|
3174
3149
|
void ((_discountModule$setOr = discountModule.setOriginalDiscountList) === null || _discountModule$setOr === void 0 ? void 0 : _discountModule$setOr.call(discountModule, nextOriginalDiscounts));
|
|
@@ -3322,71 +3297,23 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3322
3297
|
* 用一组支付来源覆盖当前订单支付项。
|
|
3323
3298
|
*
|
|
3324
3299
|
* 入参允许来自 PaymentModule 的 PaymentItem,内部统一映射为 Sales 协议:
|
|
3325
|
-
*
|
|
3300
|
+
* uuid -> metadata.unique_payment_number,id -> custom_payment_id,
|
|
3326
3301
|
* isSynced 等运行态字段不会进入 tempOrder.payments。
|
|
3327
3302
|
*/
|
|
3328
3303
|
}, {
|
|
3329
3304
|
key: "setOrderPayments",
|
|
3330
3305
|
value: function setOrderPayments(payments) {
|
|
3331
|
-
var _this22 = this;
|
|
3332
3306
|
var tempOrder = this.ensureTempOrder();
|
|
3333
|
-
tempOrder.payments = mapPaymentItemsToOrderPayments(
|
|
3334
|
-
return _this22.normalizePaymentSource(payment, {
|
|
3335
|
-
defaultPaid: false
|
|
3336
|
-
});
|
|
3337
|
-
}));
|
|
3307
|
+
tempOrder.payments = mapPaymentItemsToOrderPayments(payments);
|
|
3338
3308
|
this.persistTempOrder();
|
|
3339
3309
|
return tempOrder.payments;
|
|
3340
3310
|
}
|
|
3341
3311
|
|
|
3342
|
-
/**
|
|
3312
|
+
/** 追加单个支付项,并立即持久化当前 tempOrder。 */
|
|
3343
3313
|
}, {
|
|
3344
3314
|
key: "addOrderPayment",
|
|
3345
3315
|
value: function addOrderPayment(payment) {
|
|
3346
|
-
var
|
|
3347
|
-
return this.addOrderPaymentWithDevicePrefix(payment, hasPaymentNumber ? 'LOCAL' : this.getPaymentNumberDevicePrefixSync());
|
|
3348
|
-
}
|
|
3349
|
-
|
|
3350
|
-
/** 异步入口:创建支付项时读取最新 IoT 设备短号。 */
|
|
3351
|
-
}, {
|
|
3352
|
-
key: "addOrderPaymentAsync",
|
|
3353
|
-
value: (function () {
|
|
3354
|
-
var _addOrderPaymentAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(payment) {
|
|
3355
|
-
var hasPaymentNumber, devicePrefix;
|
|
3356
|
-
return _regeneratorRuntime().wrap(function _callee15$(_context17) {
|
|
3357
|
-
while (1) switch (_context17.prev = _context17.next) {
|
|
3358
|
-
case 0:
|
|
3359
|
-
hasPaymentNumber = String(payment.payment_number || '').trim() !== '';
|
|
3360
|
-
if (!hasPaymentNumber) {
|
|
3361
|
-
_context17.next = 5;
|
|
3362
|
-
break;
|
|
3363
|
-
}
|
|
3364
|
-
_context17.t0 = 'LOCAL';
|
|
3365
|
-
_context17.next = 8;
|
|
3366
|
-
break;
|
|
3367
|
-
case 5:
|
|
3368
|
-
_context17.next = 7;
|
|
3369
|
-
return this.getPaymentNumberDevicePrefixAsync();
|
|
3370
|
-
case 7:
|
|
3371
|
-
_context17.t0 = _context17.sent;
|
|
3372
|
-
case 8:
|
|
3373
|
-
devicePrefix = _context17.t0;
|
|
3374
|
-
return _context17.abrupt("return", this.addOrderPaymentWithDevicePrefix(payment, devicePrefix));
|
|
3375
|
-
case 10:
|
|
3376
|
-
case "end":
|
|
3377
|
-
return _context17.stop();
|
|
3378
|
-
}
|
|
3379
|
-
}, _callee15, this);
|
|
3380
|
-
}));
|
|
3381
|
-
function addOrderPaymentAsync(_x14) {
|
|
3382
|
-
return _addOrderPaymentAsync.apply(this, arguments);
|
|
3383
|
-
}
|
|
3384
|
-
return addOrderPaymentAsync;
|
|
3385
|
-
}())
|
|
3386
|
-
}, {
|
|
3387
|
-
key: "addOrderPaymentWithDevicePrefix",
|
|
3388
|
-
value: function addOrderPaymentWithDevicePrefix(payment, devicePrefix) {
|
|
3389
|
-
var _this23 = this;
|
|
3316
|
+
var _this20 = this;
|
|
3390
3317
|
this.logInfo('addOrderPayment', {
|
|
3391
3318
|
payment: payment
|
|
3392
3319
|
});
|
|
@@ -3396,15 +3323,14 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3396
3323
|
type: orderPaymentType,
|
|
3397
3324
|
order_payment_type: orderPaymentType
|
|
3398
3325
|
}), {
|
|
3399
|
-
defaultPaid: true
|
|
3400
|
-
devicePrefix: devicePrefix
|
|
3326
|
+
defaultPaid: true
|
|
3401
3327
|
})]);
|
|
3402
3328
|
tempOrder.payments = [].concat(_toConsumableArray(tempOrder.payments || []), _toConsumableArray(mapped));
|
|
3403
3329
|
this.persistTempOrder();
|
|
3404
3330
|
void this.recalculateSummary({
|
|
3405
3331
|
createIfMissing: true
|
|
3406
3332
|
}).catch(function (error) {
|
|
3407
|
-
|
|
3333
|
+
_this20.logError('recalculate summary after addOrderPayment failed', {
|
|
3408
3334
|
error: error instanceof Error ? error.message : String(error)
|
|
3409
3335
|
});
|
|
3410
3336
|
});
|
|
@@ -3412,80 +3338,49 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3412
3338
|
}
|
|
3413
3339
|
|
|
3414
3340
|
/**
|
|
3415
|
-
*
|
|
3416
|
-
*
|
|
3341
|
+
* 按支付唯一号、后端支付 ID、自定义支付方式 ID 或旧 uuid 更新支付项。
|
|
3342
|
+
*
|
|
3343
|
+
* 该方法服务 PaymentModal 的 void / 编辑场景;更新 metadata 时会做浅合并,
|
|
3344
|
+
* 避免覆盖 unique_payment_number、现金实付/找零等已有元数据。
|
|
3417
3345
|
*/
|
|
3418
3346
|
}, {
|
|
3419
3347
|
key: "updateOrderPayment",
|
|
3420
|
-
value:
|
|
3421
|
-
var
|
|
3422
|
-
|
|
3423
|
-
|
|
3424
|
-
|
|
3425
|
-
|
|
3426
|
-
|
|
3427
|
-
|
|
3428
|
-
|
|
3429
|
-
|
|
3430
|
-
|
|
3431
|
-
|
|
3432
|
-
|
|
3433
|
-
|
|
3434
|
-
|
|
3435
|
-
|
|
3436
|
-
|
|
3437
|
-
|
|
3438
|
-
|
|
3439
|
-
|
|
3440
|
-
|
|
3441
|
-
|
|
3442
|
-
}
|
|
3443
|
-
throw new Error("\u672A\u627E\u5230\u652F\u4ED8\u9879: ".concat(identity));
|
|
3444
|
-
case 7:
|
|
3445
|
-
updatedPayment = null;
|
|
3446
|
-
tempOrder.payments = (tempOrder.payments || []).map(function (payment, index) {
|
|
3447
|
-
if (index !== matchedPayment.index) return payment;
|
|
3448
|
-
var nextPayment = mergeOrderPaymentRecord(payment, _objectSpread(_objectSpread({}, updates), {}, {
|
|
3449
|
-
updated_at: updates.updated_at || dayjs().format('YYYY-MM-DD HH:mm:ss')
|
|
3450
|
-
}));
|
|
3451
|
-
updatedPayment = nextPayment;
|
|
3452
|
-
return nextPayment;
|
|
3453
|
-
});
|
|
3454
|
-
this.persistTempOrder();
|
|
3455
|
-
_context18.next = 12;
|
|
3456
|
-
return this.recalculateSummary({
|
|
3457
|
-
createIfMissing: true
|
|
3458
|
-
});
|
|
3459
|
-
case 12:
|
|
3460
|
-
summary = _context18.sent;
|
|
3461
|
-
this.persistTempOrder();
|
|
3462
|
-
payments = tempOrder.payments;
|
|
3463
|
-
return _context18.abrupt("return", {
|
|
3464
|
-
updated: true,
|
|
3465
|
-
payment: payments[matchedPayment.index] || updatedPayment,
|
|
3466
|
-
payments: payments,
|
|
3467
|
-
summary: summary
|
|
3468
|
-
});
|
|
3469
|
-
case 16:
|
|
3470
|
-
case "end":
|
|
3471
|
-
return _context18.stop();
|
|
3472
|
-
}
|
|
3473
|
-
}, _callee16, this);
|
|
3474
|
-
}));
|
|
3475
|
-
function updateOrderPayment(_x15, _x16) {
|
|
3476
|
-
return _updateOrderPayment.apply(this, arguments);
|
|
3477
|
-
}
|
|
3478
|
-
return updateOrderPayment;
|
|
3479
|
-
}() /** 从当前订单支付项中移除指定支付项。 */)
|
|
3348
|
+
value: function updateOrderPayment(paymentIdentity, updates) {
|
|
3349
|
+
var tempOrder = this.ensureTempOrder();
|
|
3350
|
+
var identity = String(paymentIdentity);
|
|
3351
|
+
tempOrder.payments = (tempOrder.payments || []).map(function (payment) {
|
|
3352
|
+
var _payment$metadata;
|
|
3353
|
+
var uniquePaymentNumber = payment === null || payment === void 0 || (_payment$metadata = payment.metadata) === null || _payment$metadata === void 0 ? void 0 : _payment$metadata.unique_payment_number;
|
|
3354
|
+
var orderPaymentId = payment === null || payment === void 0 ? void 0 : payment.order_payment_id;
|
|
3355
|
+
var customPaymentId = payment === null || payment === void 0 ? void 0 : payment.custom_payment_id;
|
|
3356
|
+
var uuid = payment === null || payment === void 0 ? void 0 : payment.uuid;
|
|
3357
|
+
var matched = [uniquePaymentNumber, orderPaymentId, customPaymentId, uuid].some(function (value) {
|
|
3358
|
+
return value !== undefined && String(value) === identity;
|
|
3359
|
+
});
|
|
3360
|
+
if (!matched) return payment;
|
|
3361
|
+
return _objectSpread(_objectSpread(_objectSpread({}, payment), updates), {}, {
|
|
3362
|
+
metadata: _objectSpread(_objectSpread({}, payment.metadata || {}), updates.metadata || {})
|
|
3363
|
+
});
|
|
3364
|
+
});
|
|
3365
|
+
this.persistTempOrder();
|
|
3366
|
+
return tempOrder.payments;
|
|
3367
|
+
}
|
|
3368
|
+
|
|
3369
|
+
/** 从当前订单支付项中移除指定支付项。 */
|
|
3480
3370
|
}, {
|
|
3481
3371
|
key: "deleteOrderPayment",
|
|
3482
3372
|
value: function deleteOrderPayment(paymentIdentity) {
|
|
3483
3373
|
var tempOrder = this.ensureTempOrder();
|
|
3484
3374
|
var identity = String(paymentIdentity);
|
|
3485
|
-
|
|
3486
|
-
|
|
3487
|
-
|
|
3488
|
-
|
|
3375
|
+
tempOrder.payments = (tempOrder.payments || []).filter(function (payment) {
|
|
3376
|
+
var _payment$metadata2;
|
|
3377
|
+
var uniquePaymentNumber = payment === null || payment === void 0 || (_payment$metadata2 = payment.metadata) === null || _payment$metadata2 === void 0 ? void 0 : _payment$metadata2.unique_payment_number;
|
|
3378
|
+
var orderPaymentId = payment === null || payment === void 0 ? void 0 : payment.order_payment_id;
|
|
3379
|
+
var customPaymentId = payment === null || payment === void 0 ? void 0 : payment.custom_payment_id;
|
|
3380
|
+
var uuid = payment === null || payment === void 0 ? void 0 : payment.uuid;
|
|
3381
|
+
return ![uniquePaymentNumber, orderPaymentId, customPaymentId, uuid].some(function (value) {
|
|
3382
|
+
return value !== undefined && String(value) === identity;
|
|
3383
|
+
});
|
|
3489
3384
|
});
|
|
3490
3385
|
this.persistTempOrder();
|
|
3491
3386
|
return tempOrder.payments;
|
|
@@ -3517,7 +3412,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3517
3412
|
}, {
|
|
3518
3413
|
key: "applyPaymentLifecycleChange",
|
|
3519
3414
|
value: function applyPaymentLifecycleChange(tempOrder, options) {
|
|
3520
|
-
var
|
|
3415
|
+
var _this21 = this;
|
|
3521
3416
|
this.updateTempOrderPaymentStatus(tempOrder);
|
|
3522
3417
|
if ((options === null || options === void 0 ? void 0 : options.persist) !== false) {
|
|
3523
3418
|
this.persistTempOrder();
|
|
@@ -3527,7 +3422,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3527
3422
|
void this.recalculateSummary({
|
|
3528
3423
|
createIfMissing: true
|
|
3529
3424
|
}).catch(function (error) {
|
|
3530
|
-
|
|
3425
|
+
_this21.logError("recalculate summary after ".concat(logContext, " failed"), {
|
|
3531
3426
|
error: error instanceof Error ? error.message : String(error)
|
|
3532
3427
|
});
|
|
3533
3428
|
});
|
|
@@ -3571,7 +3466,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3571
3466
|
}, {
|
|
3572
3467
|
key: "updateVoucherOrderPayments",
|
|
3573
3468
|
value: function updateVoucherOrderPayments(payments, options) {
|
|
3574
|
-
var
|
|
3469
|
+
var _this22 = this;
|
|
3575
3470
|
var tempOrder = this.ensureTempOrder();
|
|
3576
3471
|
var isOrderPaymentType = function isOrderPaymentType(value) {
|
|
3577
3472
|
return value === 'normal' || value === 'deposit';
|
|
@@ -3606,9 +3501,8 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3606
3501
|
});
|
|
3607
3502
|
};
|
|
3608
3503
|
var mappedVouchers = mapPaymentItemsToOrderPayments(payments.map(function (payment) {
|
|
3609
|
-
return
|
|
3610
|
-
defaultPaid: false
|
|
3611
|
-
devicePrefix: options === null || options === void 0 ? void 0 : options.devicePrefix
|
|
3504
|
+
return _this22.normalizePaymentSource(normalizeVoucherPaymentStatus(withVoucherPaymentType(payment)), {
|
|
3505
|
+
defaultPaid: false
|
|
3612
3506
|
});
|
|
3613
3507
|
})).filter(function (payment) {
|
|
3614
3508
|
return isVoucherPaymentRecord(payment);
|
|
@@ -3634,17 +3528,14 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3634
3528
|
}).map(function (payment) {
|
|
3635
3529
|
return String(payment.order_payment_id);
|
|
3636
3530
|
}));
|
|
3637
|
-
var
|
|
3638
|
-
return
|
|
3639
|
-
}).filter(function (key) {
|
|
3640
|
-
return key !== null;
|
|
3531
|
+
var committedVoucherIds = new Set(committedVoucherPayments.map(function (payment) {
|
|
3532
|
+
return String(payment.voucher_id);
|
|
3641
3533
|
}));
|
|
3642
3534
|
var replaceableVouchers = mappedVouchers.filter(function (payment) {
|
|
3643
3535
|
if (hasSyncedOrderPaymentRecord(payment) && committedVoucherPaymentIds.has(String(payment.order_payment_id))) {
|
|
3644
3536
|
return false;
|
|
3645
3537
|
}
|
|
3646
|
-
|
|
3647
|
-
if (lifecycleKey && committedVoucherLifecycleKeys.has(lifecycleKey)) {
|
|
3538
|
+
if (payment.voucher_id !== undefined && committedVoucherIds.has(String(payment.voucher_id))) {
|
|
3648
3539
|
return false;
|
|
3649
3540
|
}
|
|
3650
3541
|
return true;
|
|
@@ -3659,93 +3550,54 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3659
3550
|
void this.recalculateSummary({
|
|
3660
3551
|
createIfMissing: true
|
|
3661
3552
|
}).catch(function (error) {
|
|
3662
|
-
|
|
3553
|
+
_this22.logError('recalculate summary after updateVoucherOrderPayments failed', {
|
|
3663
3554
|
error: error instanceof Error ? error.message : String(error)
|
|
3664
3555
|
});
|
|
3665
3556
|
});
|
|
3666
3557
|
return tempOrder.payments;
|
|
3667
3558
|
}
|
|
3668
|
-
}, {
|
|
3669
|
-
key: "updateVoucherOrderPaymentsAsync",
|
|
3670
|
-
value: function () {
|
|
3671
|
-
var _updateVoucherOrderPaymentsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(payments, options) {
|
|
3672
|
-
var needsPaymentNumber, devicePrefix;
|
|
3673
|
-
return _regeneratorRuntime().wrap(function _callee17$(_context19) {
|
|
3674
|
-
while (1) switch (_context19.prev = _context19.next) {
|
|
3675
|
-
case 0:
|
|
3676
|
-
needsPaymentNumber = (payments || []).some(function (payment) {
|
|
3677
|
-
return String(payment.payment_number || '').trim() === '';
|
|
3678
|
-
});
|
|
3679
|
-
if (!needsPaymentNumber) {
|
|
3680
|
-
_context19.next = 7;
|
|
3681
|
-
break;
|
|
3682
|
-
}
|
|
3683
|
-
_context19.next = 4;
|
|
3684
|
-
return this.getPaymentNumberDevicePrefixAsync();
|
|
3685
|
-
case 4:
|
|
3686
|
-
_context19.t0 = _context19.sent;
|
|
3687
|
-
_context19.next = 8;
|
|
3688
|
-
break;
|
|
3689
|
-
case 7:
|
|
3690
|
-
_context19.t0 = 'LOCAL';
|
|
3691
|
-
case 8:
|
|
3692
|
-
devicePrefix = _context19.t0;
|
|
3693
|
-
return _context19.abrupt("return", this.updateVoucherOrderPayments(payments, _objectSpread(_objectSpread({}, options), {}, {
|
|
3694
|
-
devicePrefix: devicePrefix
|
|
3695
|
-
})));
|
|
3696
|
-
case 10:
|
|
3697
|
-
case "end":
|
|
3698
|
-
return _context19.stop();
|
|
3699
|
-
}
|
|
3700
|
-
}, _callee17, this);
|
|
3701
|
-
}));
|
|
3702
|
-
function updateVoucherOrderPaymentsAsync(_x17, _x18) {
|
|
3703
|
-
return _updateVoucherOrderPaymentsAsync.apply(this, arguments);
|
|
3704
|
-
}
|
|
3705
|
-
return updateVoucherOrderPaymentsAsync;
|
|
3706
|
-
}()
|
|
3707
3559
|
}, {
|
|
3708
3560
|
key: "shouldMergeProductToOrder",
|
|
3709
3561
|
value: function () {
|
|
3710
|
-
var _shouldMergeProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3562
|
+
var _shouldMergeProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(params) {
|
|
3711
3563
|
var _this$orderHooks;
|
|
3712
3564
|
var onBeforeMergeProductToOrder, result;
|
|
3713
|
-
return _regeneratorRuntime().wrap(function
|
|
3714
|
-
while (1) switch (
|
|
3565
|
+
return _regeneratorRuntime().wrap(function _callee15$(_context17) {
|
|
3566
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
3715
3567
|
case 0:
|
|
3716
3568
|
onBeforeMergeProductToOrder = (_this$orderHooks = this.orderHooks) === null || _this$orderHooks === void 0 ? void 0 : _this$orderHooks.onBeforeMergeProductToOrder;
|
|
3717
3569
|
if (onBeforeMergeProductToOrder) {
|
|
3718
|
-
|
|
3570
|
+
_context17.next = 3;
|
|
3719
3571
|
break;
|
|
3720
3572
|
}
|
|
3721
|
-
return
|
|
3573
|
+
return _context17.abrupt("return", true);
|
|
3722
3574
|
case 3:
|
|
3723
|
-
|
|
3575
|
+
_context17.next = 5;
|
|
3724
3576
|
return onBeforeMergeProductToOrder(_objectSpread(_objectSpread({}, params), {}, {
|
|
3725
3577
|
defaultShouldMerge: true
|
|
3726
3578
|
}));
|
|
3727
3579
|
case 5:
|
|
3728
|
-
result =
|
|
3580
|
+
result = _context17.sent;
|
|
3729
3581
|
if (!(typeof result === 'boolean')) {
|
|
3730
|
-
|
|
3582
|
+
_context17.next = 8;
|
|
3731
3583
|
break;
|
|
3732
3584
|
}
|
|
3733
|
-
return
|
|
3585
|
+
return _context17.abrupt("return", result);
|
|
3734
3586
|
case 8:
|
|
3735
3587
|
if (!(result && _typeof(result) === 'object' && typeof result.shouldMerge === 'boolean')) {
|
|
3736
|
-
|
|
3588
|
+
_context17.next = 10;
|
|
3737
3589
|
break;
|
|
3738
3590
|
}
|
|
3739
|
-
return
|
|
3591
|
+
return _context17.abrupt("return", result.shouldMerge);
|
|
3740
3592
|
case 10:
|
|
3741
|
-
return
|
|
3593
|
+
return _context17.abrupt("return", true);
|
|
3742
3594
|
case 11:
|
|
3743
3595
|
case "end":
|
|
3744
|
-
return
|
|
3596
|
+
return _context17.stop();
|
|
3745
3597
|
}
|
|
3746
|
-
},
|
|
3598
|
+
}, _callee15, this);
|
|
3747
3599
|
}));
|
|
3748
|
-
function shouldMergeProductToOrder(
|
|
3600
|
+
function shouldMergeProductToOrder(_x14) {
|
|
3749
3601
|
return _shouldMergeProductToOrder.apply(this, arguments);
|
|
3750
3602
|
}
|
|
3751
3603
|
return shouldMergeProductToOrder;
|
|
@@ -3781,30 +3633,30 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3781
3633
|
}, {
|
|
3782
3634
|
key: "finalizeProductOrderMutation",
|
|
3783
3635
|
value: function () {
|
|
3784
|
-
var _finalizeProductOrderMutation = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3785
|
-
return _regeneratorRuntime().wrap(function
|
|
3786
|
-
while (1) switch (
|
|
3636
|
+
var _finalizeProductOrderMutation = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(tempOrder, options) {
|
|
3637
|
+
return _regeneratorRuntime().wrap(function _callee16$(_context18) {
|
|
3638
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
3787
3639
|
case 0:
|
|
3788
3640
|
this.syncTempOrderHolderFromBookings(tempOrder);
|
|
3789
3641
|
if (options !== null && options !== void 0 && options.skipEditDiscountConfigRefresh) {
|
|
3790
|
-
|
|
3642
|
+
_context18.next = 4;
|
|
3791
3643
|
break;
|
|
3792
3644
|
}
|
|
3793
|
-
|
|
3645
|
+
_context18.next = 4;
|
|
3794
3646
|
return this.ensureEditDiscountConfigForProductChange(tempOrder);
|
|
3795
3647
|
case 4:
|
|
3796
3648
|
if (options !== null && options !== void 0 && options.skipDiscountRecalculation) {
|
|
3797
|
-
|
|
3649
|
+
_context18.next = 7;
|
|
3798
3650
|
break;
|
|
3799
3651
|
}
|
|
3800
|
-
|
|
3652
|
+
_context18.next = 7;
|
|
3801
3653
|
return this.applyPromotion();
|
|
3802
3654
|
case 7:
|
|
3803
3655
|
if (!(options !== null && options !== void 0 && options.skipDiscountRecalculation)) {
|
|
3804
3656
|
this.applyDiscount();
|
|
3805
3657
|
}
|
|
3806
3658
|
this.sanitizeTempOrderProducts(tempOrder);
|
|
3807
|
-
|
|
3659
|
+
_context18.next = 11;
|
|
3808
3660
|
return this.recalculateSummary({
|
|
3809
3661
|
createIfMissing: true
|
|
3810
3662
|
});
|
|
@@ -3812,11 +3664,11 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3812
3664
|
this.persistTempOrder();
|
|
3813
3665
|
case 12:
|
|
3814
3666
|
case "end":
|
|
3815
|
-
return
|
|
3667
|
+
return _context18.stop();
|
|
3816
3668
|
}
|
|
3817
|
-
},
|
|
3669
|
+
}, _callee16, this);
|
|
3818
3670
|
}));
|
|
3819
|
-
function finalizeProductOrderMutation(
|
|
3671
|
+
function finalizeProductOrderMutation(_x15, _x16) {
|
|
3820
3672
|
return _finalizeProductOrderMutation.apply(this, arguments);
|
|
3821
3673
|
}
|
|
3822
3674
|
return finalizeProductOrderMutation;
|
|
@@ -3831,13 +3683,13 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3831
3683
|
}, {
|
|
3832
3684
|
key: "appendProductLineToTempOrder",
|
|
3833
3685
|
value: (function () {
|
|
3834
|
-
var _appendProductLineToTempOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3686
|
+
var _appendProductLineToTempOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(tempOrder, product, booking) {
|
|
3835
3687
|
var _booking_uid,
|
|
3836
3688
|
_metadata,
|
|
3837
|
-
|
|
3689
|
+
_this23 = this;
|
|
3838
3690
|
var linked, productToAdd, incomingFingerprint, normalizedIncoming, incomingBookingUid, hasIncomingGoodPass, hasIncomingProductNote, hasIncomingBookingUid, shouldForceNewLine, matchedIndex, matchedProduct, existedFingerprint, shouldMerge, _targetProduct$metada, targetProduct, targetUid, normalizedProduct, nextNum, targetIsManualProductDiscount, nextDiscountList;
|
|
3839
|
-
return _regeneratorRuntime().wrap(function
|
|
3840
|
-
while (1) switch (
|
|
3691
|
+
return _regeneratorRuntime().wrap(function _callee17$(_context19) {
|
|
3692
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
3841
3693
|
case 0:
|
|
3842
3694
|
linked = booking ? this.createLinkedProductAndBooking({
|
|
3843
3695
|
product: product,
|
|
@@ -3860,8 +3712,8 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3860
3712
|
shouldForceNewLine = !!booking || hasIncomingProductNote || hasIncomingBookingUid;
|
|
3861
3713
|
matchedIndex = hasIncomingGoodPass || shouldForceNewLine ? -1 : tempOrder.products.findIndex(function (item) {
|
|
3862
3714
|
var _item$metadata3;
|
|
3863
|
-
if (
|
|
3864
|
-
if (
|
|
3715
|
+
if (_this23.hasGoodPassDiscount(item)) return false;
|
|
3716
|
+
if (_this23.hasOrderProductLineNote(item)) return false;
|
|
3865
3717
|
if (item.order_detail_id !== undefined && item.order_detail_id !== null) return false;
|
|
3866
3718
|
if ((_item$metadata3 = item.metadata) !== null && _item$metadata3 !== void 0 && _item$metadata3.is_edit_for_runtime) return false;
|
|
3867
3719
|
if (item.product_id !== productToAdd.product_id) return false;
|
|
@@ -3872,10 +3724,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3872
3724
|
matchedProduct = matchedIndex === -1 ? null : tempOrder.products[matchedIndex];
|
|
3873
3725
|
existedFingerprint = matchedProduct ? buildProductLineFingerprint(getProductSkuOptions(matchedProduct), matchedProduct.product_bundle) : '';
|
|
3874
3726
|
if (!matchedProduct) {
|
|
3875
|
-
|
|
3727
|
+
_context19.next = 20;
|
|
3876
3728
|
break;
|
|
3877
3729
|
}
|
|
3878
|
-
|
|
3730
|
+
_context19.next = 17;
|
|
3879
3731
|
return this.shouldMergeProductToOrder({
|
|
3880
3732
|
incomingProduct: productToAdd,
|
|
3881
3733
|
normalizedIncoming: normalizedIncoming,
|
|
@@ -3887,13 +3739,13 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3887
3739
|
booking: booking
|
|
3888
3740
|
});
|
|
3889
3741
|
case 17:
|
|
3890
|
-
|
|
3891
|
-
|
|
3742
|
+
_context19.t0 = _context19.sent;
|
|
3743
|
+
_context19.next = 21;
|
|
3892
3744
|
break;
|
|
3893
3745
|
case 20:
|
|
3894
|
-
|
|
3746
|
+
_context19.t0 = false;
|
|
3895
3747
|
case 21:
|
|
3896
|
-
shouldMerge =
|
|
3748
|
+
shouldMerge = _context19.t0;
|
|
3897
3749
|
if (matchedIndex === -1 || !matchedProduct || !shouldMerge) {
|
|
3898
3750
|
this.captureProductRuntime(tempOrder, productToAdd, normalizedIncoming);
|
|
3899
3751
|
if (linked) {
|
|
@@ -3947,11 +3799,11 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3947
3799
|
}
|
|
3948
3800
|
case 24:
|
|
3949
3801
|
case "end":
|
|
3950
|
-
return
|
|
3802
|
+
return _context19.stop();
|
|
3951
3803
|
}
|
|
3952
|
-
},
|
|
3804
|
+
}, _callee17, this);
|
|
3953
3805
|
}));
|
|
3954
|
-
function appendProductLineToTempOrder(
|
|
3806
|
+
function appendProductLineToTempOrder(_x17, _x18, _x19) {
|
|
3955
3807
|
return _appendProductLineToTempOrder.apply(this, arguments);
|
|
3956
3808
|
}
|
|
3957
3809
|
return appendProductLineToTempOrder;
|
|
@@ -3967,61 +3819,61 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3967
3819
|
}, {
|
|
3968
3820
|
key: "addProductToOrder",
|
|
3969
3821
|
value: (function () {
|
|
3970
|
-
var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3822
|
+
var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(product, booking) {
|
|
3971
3823
|
var tempOrder, _ref61, _productRecord$num, productRecord, splitCount, i, singleLine;
|
|
3972
|
-
return _regeneratorRuntime().wrap(function
|
|
3973
|
-
while (1) switch (
|
|
3824
|
+
return _regeneratorRuntime().wrap(function _callee18$(_context20) {
|
|
3825
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
3974
3826
|
case 0:
|
|
3975
3827
|
tempOrder = this.ensureTempOrder();
|
|
3976
3828
|
if (!booking) {
|
|
3977
|
-
|
|
3829
|
+
_context20.next = 18;
|
|
3978
3830
|
break;
|
|
3979
3831
|
}
|
|
3980
3832
|
productRecord = product;
|
|
3981
3833
|
splitCount = getSafeProductNum((_ref61 = (_productRecord$num = productRecord.num) !== null && _productRecord$num !== void 0 ? _productRecord$num : productRecord.product_quantity) !== null && _ref61 !== void 0 ? _ref61 : 1);
|
|
3982
3834
|
if (!(splitCount > 1)) {
|
|
3983
|
-
|
|
3835
|
+
_context20.next = 18;
|
|
3984
3836
|
break;
|
|
3985
3837
|
}
|
|
3986
3838
|
i = 0;
|
|
3987
3839
|
case 6:
|
|
3988
3840
|
if (!(i < splitCount)) {
|
|
3989
|
-
|
|
3841
|
+
_context20.next = 15;
|
|
3990
3842
|
break;
|
|
3991
3843
|
}
|
|
3992
3844
|
singleLine = cloneDeep(productRecord);
|
|
3993
3845
|
singleLine.num = 1;
|
|
3994
3846
|
delete singleLine.product_quantity;
|
|
3995
|
-
|
|
3847
|
+
_context20.next = 12;
|
|
3996
3848
|
return this.appendProductLineToTempOrder(tempOrder, singleLine, cloneDeep(booking));
|
|
3997
3849
|
case 12:
|
|
3998
3850
|
i += 1;
|
|
3999
|
-
|
|
3851
|
+
_context20.next = 6;
|
|
4000
3852
|
break;
|
|
4001
3853
|
case 15:
|
|
4002
|
-
|
|
3854
|
+
_context20.next = 17;
|
|
4003
3855
|
return this.finalizeProductOrderMutation(tempOrder);
|
|
4004
3856
|
case 17:
|
|
4005
|
-
return
|
|
3857
|
+
return _context20.abrupt("return", tempOrder.products);
|
|
4006
3858
|
case 18:
|
|
4007
|
-
|
|
3859
|
+
_context20.next = 20;
|
|
4008
3860
|
return this.appendProductLineToTempOrder(tempOrder, product, booking);
|
|
4009
3861
|
case 20:
|
|
4010
|
-
|
|
3862
|
+
_context20.next = 22;
|
|
4011
3863
|
return this.finalizeProductOrderMutation(tempOrder);
|
|
4012
3864
|
case 22:
|
|
4013
3865
|
this.logInfo('addProductToOrder success', {
|
|
4014
3866
|
product_id: product.product_id,
|
|
4015
3867
|
with_booking: !!booking
|
|
4016
3868
|
});
|
|
4017
|
-
return
|
|
3869
|
+
return _context20.abrupt("return", tempOrder.products);
|
|
4018
3870
|
case 24:
|
|
4019
3871
|
case "end":
|
|
4020
|
-
return
|
|
3872
|
+
return _context20.stop();
|
|
4021
3873
|
}
|
|
4022
|
-
},
|
|
3874
|
+
}, _callee18, this);
|
|
4023
3875
|
}));
|
|
4024
|
-
function addProductToOrder(
|
|
3876
|
+
function addProductToOrder(_x20, _x21) {
|
|
4025
3877
|
return _addProductToOrder.apply(this, arguments);
|
|
4026
3878
|
}
|
|
4027
3879
|
return addProductToOrder;
|
|
@@ -4039,93 +3891,93 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4039
3891
|
}, {
|
|
4040
3892
|
key: "addProductsToOrder",
|
|
4041
3893
|
value: (function () {
|
|
4042
|
-
var _addProductsToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3894
|
+
var _addProductsToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(items, options) {
|
|
4043
3895
|
var tempOrder, _iterator20, _step20, item, product, booking, _ref62, _productRecord$num2, productRecord, splitCount, i, singleLine;
|
|
4044
|
-
return _regeneratorRuntime().wrap(function
|
|
4045
|
-
while (1) switch (
|
|
3896
|
+
return _regeneratorRuntime().wrap(function _callee19$(_context21) {
|
|
3897
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
4046
3898
|
case 0:
|
|
4047
3899
|
tempOrder = this.ensureTempOrder();
|
|
4048
3900
|
if (!(!Array.isArray(items) || items.length === 0)) {
|
|
4049
|
-
|
|
3901
|
+
_context21.next = 3;
|
|
4050
3902
|
break;
|
|
4051
3903
|
}
|
|
4052
|
-
return
|
|
3904
|
+
return _context21.abrupt("return", tempOrder.products);
|
|
4053
3905
|
case 3:
|
|
4054
3906
|
_iterator20 = _createForOfIteratorHelper(items || []);
|
|
4055
|
-
|
|
3907
|
+
_context21.prev = 4;
|
|
4056
3908
|
_iterator20.s();
|
|
4057
3909
|
case 6:
|
|
4058
3910
|
if ((_step20 = _iterator20.n()).done) {
|
|
4059
|
-
|
|
3911
|
+
_context21.next = 30;
|
|
4060
3912
|
break;
|
|
4061
3913
|
}
|
|
4062
3914
|
item = _step20.value;
|
|
4063
3915
|
product = item.product, booking = item.booking;
|
|
4064
3916
|
if (product) {
|
|
4065
|
-
|
|
3917
|
+
_context21.next = 11;
|
|
4066
3918
|
break;
|
|
4067
3919
|
}
|
|
4068
|
-
return
|
|
3920
|
+
return _context21.abrupt("continue", 28);
|
|
4069
3921
|
case 11:
|
|
4070
3922
|
if (!booking) {
|
|
4071
|
-
|
|
3923
|
+
_context21.next = 26;
|
|
4072
3924
|
break;
|
|
4073
3925
|
}
|
|
4074
3926
|
productRecord = product;
|
|
4075
3927
|
splitCount = getSafeProductNum((_ref62 = (_productRecord$num2 = productRecord.num) !== null && _productRecord$num2 !== void 0 ? _productRecord$num2 : productRecord.product_quantity) !== null && _ref62 !== void 0 ? _ref62 : 1);
|
|
4076
3928
|
if (!(splitCount > 1)) {
|
|
4077
|
-
|
|
3929
|
+
_context21.next = 26;
|
|
4078
3930
|
break;
|
|
4079
3931
|
}
|
|
4080
3932
|
i = 0;
|
|
4081
3933
|
case 16:
|
|
4082
3934
|
if (!(i < splitCount)) {
|
|
4083
|
-
|
|
3935
|
+
_context21.next = 25;
|
|
4084
3936
|
break;
|
|
4085
3937
|
}
|
|
4086
3938
|
singleLine = cloneDeep(productRecord);
|
|
4087
3939
|
singleLine.num = 1;
|
|
4088
3940
|
delete singleLine.product_quantity;
|
|
4089
|
-
|
|
3941
|
+
_context21.next = 22;
|
|
4090
3942
|
return this.appendProductLineToTempOrder(tempOrder, singleLine, cloneDeep(booking));
|
|
4091
3943
|
case 22:
|
|
4092
3944
|
i += 1;
|
|
4093
|
-
|
|
3945
|
+
_context21.next = 16;
|
|
4094
3946
|
break;
|
|
4095
3947
|
case 25:
|
|
4096
|
-
return
|
|
3948
|
+
return _context21.abrupt("continue", 28);
|
|
4097
3949
|
case 26:
|
|
4098
|
-
|
|
3950
|
+
_context21.next = 28;
|
|
4099
3951
|
return this.appendProductLineToTempOrder(tempOrder, product, booking);
|
|
4100
3952
|
case 28:
|
|
4101
|
-
|
|
3953
|
+
_context21.next = 6;
|
|
4102
3954
|
break;
|
|
4103
3955
|
case 30:
|
|
4104
|
-
|
|
3956
|
+
_context21.next = 35;
|
|
4105
3957
|
break;
|
|
4106
3958
|
case 32:
|
|
4107
|
-
|
|
4108
|
-
|
|
4109
|
-
_iterator20.e(
|
|
3959
|
+
_context21.prev = 32;
|
|
3960
|
+
_context21.t0 = _context21["catch"](4);
|
|
3961
|
+
_iterator20.e(_context21.t0);
|
|
4110
3962
|
case 35:
|
|
4111
|
-
|
|
3963
|
+
_context21.prev = 35;
|
|
4112
3964
|
_iterator20.f();
|
|
4113
|
-
return
|
|
3965
|
+
return _context21.finish(35);
|
|
4114
3966
|
case 38:
|
|
4115
|
-
|
|
3967
|
+
_context21.next = 40;
|
|
4116
3968
|
return this.finalizeProductOrderMutation(tempOrder, options);
|
|
4117
3969
|
case 40:
|
|
4118
3970
|
this.logInfo('addProductsToOrder success', {
|
|
4119
3971
|
itemsCount: items.length
|
|
4120
3972
|
});
|
|
4121
|
-
return
|
|
3973
|
+
return _context21.abrupt("return", tempOrder.products);
|
|
4122
3974
|
case 42:
|
|
4123
3975
|
case "end":
|
|
4124
|
-
return
|
|
3976
|
+
return _context21.stop();
|
|
4125
3977
|
}
|
|
4126
|
-
},
|
|
3978
|
+
}, _callee19, this, [[4, 32, 35, 38]]);
|
|
4127
3979
|
}));
|
|
4128
|
-
function addProductsToOrder(
|
|
3980
|
+
function addProductsToOrder(_x22, _x23) {
|
|
4129
3981
|
return _addProductsToOrder.apply(this, arguments);
|
|
4130
3982
|
}
|
|
4131
3983
|
return addProductsToOrder;
|
|
@@ -4159,17 +4011,17 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4159
4011
|
}, {
|
|
4160
4012
|
key: "preservePersistedBundlePriceFields",
|
|
4161
4013
|
value: function preservePersistedBundlePriceFields(previousBundles, nextBundles) {
|
|
4162
|
-
var
|
|
4014
|
+
var _this24 = this;
|
|
4163
4015
|
if (!Array.isArray(nextBundles)) return nextBundles;
|
|
4164
4016
|
if (!Array.isArray(previousBundles) || previousBundles.length === 0) return nextBundles;
|
|
4165
4017
|
var previousByIdentity = new Map();
|
|
4166
4018
|
previousBundles.forEach(function (bundle) {
|
|
4167
|
-
var identity =
|
|
4019
|
+
var identity = _this24.getBundleRuntimeIdentity(bundle);
|
|
4168
4020
|
if (identity) previousByIdentity.set(identity, bundle);
|
|
4169
4021
|
});
|
|
4170
4022
|
return nextBundles.map(function (bundle, index) {
|
|
4171
4023
|
if (!bundle || _typeof(bundle) !== 'object') return bundle;
|
|
4172
|
-
var previous = previousByIdentity.get(
|
|
4024
|
+
var previous = previousByIdentity.get(_this24.getBundleRuntimeIdentity(bundle)) || previousBundles[index];
|
|
4173
4025
|
if (!previous || _typeof(previous) !== 'object') return bundle;
|
|
4174
4026
|
return _objectSpread(_objectSpread(_objectSpread({}, bundle), (bundle.cover === undefined || bundle.cover === null || bundle.cover === '') && previous.cover !== undefined && previous.cover !== null && previous.cover !== '' ? {
|
|
4175
4027
|
cover: previous.cover
|
|
@@ -4370,21 +4222,21 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4370
4222
|
}, {
|
|
4371
4223
|
key: "updateOrderProduct",
|
|
4372
4224
|
value: function () {
|
|
4373
|
-
var _updateOrderProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4225
|
+
var _updateOrderProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(params) {
|
|
4374
4226
|
var tempOrder, updatedProductUid;
|
|
4375
|
-
return _regeneratorRuntime().wrap(function
|
|
4376
|
-
while (1) switch (
|
|
4227
|
+
return _regeneratorRuntime().wrap(function _callee20$(_context22) {
|
|
4228
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
4377
4229
|
case 0:
|
|
4378
4230
|
tempOrder = this.ensureTempOrder();
|
|
4379
4231
|
updatedProductUid = this.applyOrderProductUpdateToTempOrder(tempOrder, params);
|
|
4380
|
-
|
|
4232
|
+
_context22.next = 4;
|
|
4381
4233
|
return this.applyPromotion();
|
|
4382
4234
|
case 4:
|
|
4383
4235
|
this.applyDiscount({
|
|
4384
4236
|
reapplyBookingDiscountProductUids: params.allow_booking_discount_reapply && updatedProductUid ? [String(updatedProductUid)] : undefined
|
|
4385
4237
|
});
|
|
4386
4238
|
this.sanitizeTempOrderProducts(tempOrder);
|
|
4387
|
-
|
|
4239
|
+
_context22.next = 8;
|
|
4388
4240
|
return this.recalculateSummary({
|
|
4389
4241
|
createIfMissing: true
|
|
4390
4242
|
});
|
|
@@ -4393,14 +4245,14 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4393
4245
|
this.logInfo('updateOrderProduct success', {
|
|
4394
4246
|
params: params
|
|
4395
4247
|
});
|
|
4396
|
-
return
|
|
4248
|
+
return _context22.abrupt("return", tempOrder.products);
|
|
4397
4249
|
case 11:
|
|
4398
4250
|
case "end":
|
|
4399
|
-
return
|
|
4251
|
+
return _context22.stop();
|
|
4400
4252
|
}
|
|
4401
|
-
},
|
|
4253
|
+
}, _callee20, this);
|
|
4402
4254
|
}));
|
|
4403
|
-
function updateOrderProduct(
|
|
4255
|
+
function updateOrderProduct(_x24) {
|
|
4404
4256
|
return _updateOrderProduct.apply(this, arguments);
|
|
4405
4257
|
}
|
|
4406
4258
|
return updateOrderProduct;
|
|
@@ -4408,28 +4260,28 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4408
4260
|
}, {
|
|
4409
4261
|
key: "updateOrderProducts",
|
|
4410
4262
|
value: function () {
|
|
4411
|
-
var _updateOrderProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4412
|
-
var
|
|
4263
|
+
var _updateOrderProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(paramsList) {
|
|
4264
|
+
var _this25 = this;
|
|
4413
4265
|
var tempOrder, reapplyBookingDiscountProductUids;
|
|
4414
|
-
return _regeneratorRuntime().wrap(function
|
|
4415
|
-
while (1) switch (
|
|
4266
|
+
return _regeneratorRuntime().wrap(function _callee21$(_context23) {
|
|
4267
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
4416
4268
|
case 0:
|
|
4417
4269
|
tempOrder = this.ensureTempOrder();
|
|
4418
4270
|
if (paramsList.length) {
|
|
4419
|
-
|
|
4271
|
+
_context23.next = 3;
|
|
4420
4272
|
break;
|
|
4421
4273
|
}
|
|
4422
|
-
return
|
|
4274
|
+
return _context23.abrupt("return", tempOrder.products);
|
|
4423
4275
|
case 3:
|
|
4424
4276
|
reapplyBookingDiscountProductUids = paramsList.reduce(function (acc, params) {
|
|
4425
|
-
var updatedProductUid =
|
|
4277
|
+
var updatedProductUid = _this25.applyOrderProductUpdateToTempOrder(tempOrder, params);
|
|
4426
4278
|
// 批量改预约时间时,延迟到最后一次折扣计算里统一恢复已选预约折扣卡。
|
|
4427
4279
|
if (params.allow_booking_discount_reapply && updatedProductUid) {
|
|
4428
4280
|
acc.push(String(updatedProductUid));
|
|
4429
4281
|
}
|
|
4430
4282
|
return acc;
|
|
4431
4283
|
}, []);
|
|
4432
|
-
|
|
4284
|
+
_context23.next = 6;
|
|
4433
4285
|
return this.finalizeAfterProductsMutation(tempOrder, {
|
|
4434
4286
|
reapplyBookingDiscountProductUids: reapplyBookingDiscountProductUids.length ? reapplyBookingDiscountProductUids : undefined
|
|
4435
4287
|
});
|
|
@@ -4437,14 +4289,14 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4437
4289
|
this.logInfo('updateOrderProduct success', {
|
|
4438
4290
|
paramsList: paramsList
|
|
4439
4291
|
});
|
|
4440
|
-
return
|
|
4292
|
+
return _context23.abrupt("return", tempOrder.products);
|
|
4441
4293
|
case 8:
|
|
4442
4294
|
case "end":
|
|
4443
|
-
return
|
|
4295
|
+
return _context23.stop();
|
|
4444
4296
|
}
|
|
4445
|
-
},
|
|
4297
|
+
}, _callee21, this);
|
|
4446
4298
|
}));
|
|
4447
|
-
function updateOrderProducts(
|
|
4299
|
+
function updateOrderProducts(_x25) {
|
|
4448
4300
|
return _updateOrderProducts.apply(this, arguments);
|
|
4449
4301
|
}
|
|
4450
4302
|
return updateOrderProducts;
|
|
@@ -4452,11 +4304,11 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4452
4304
|
}, {
|
|
4453
4305
|
key: "updateOrderProductQuantity",
|
|
4454
4306
|
value: function () {
|
|
4455
|
-
var _updateOrderProductQuantity = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4307
|
+
var _updateOrderProductQuantity = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(params) {
|
|
4456
4308
|
var _targetProduct$metada17;
|
|
4457
4309
|
var product_id, product_variant_id, num, unique_identification_number, identity_key, product_sku, product_bundle, tempOrder, identityLookup, productIndex, targetUid, targetProduct, normalizedProduct;
|
|
4458
|
-
return _regeneratorRuntime().wrap(function
|
|
4459
|
-
while (1) switch (
|
|
4310
|
+
return _regeneratorRuntime().wrap(function _callee22$(_context24) {
|
|
4311
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
4460
4312
|
case 0:
|
|
4461
4313
|
product_id = params.product_id, product_variant_id = params.product_variant_id, num = params.num, unique_identification_number = params.unique_identification_number, identity_key = params.identity_key, product_sku = params.product_sku, product_bundle = params.product_bundle;
|
|
4462
4314
|
tempOrder = this.ensureTempOrder();
|
|
@@ -4485,7 +4337,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4485
4337
|
productIndex = getProductIdentityIndex(tempOrder.products, identityLookup);
|
|
4486
4338
|
}
|
|
4487
4339
|
if (!(productIndex === -1)) {
|
|
4488
|
-
|
|
4340
|
+
_context24.next = 12;
|
|
4489
4341
|
break;
|
|
4490
4342
|
}
|
|
4491
4343
|
throw new Error('[Order] 目标商品不存在,无法更新数量');
|
|
@@ -4499,12 +4351,12 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4499
4351
|
}));
|
|
4500
4352
|
normalizedProduct.discount_list = normalizeOrderProductDiscountList(normalizedProduct.discount_list);
|
|
4501
4353
|
tempOrder.products[productIndex] = normalizedProduct;
|
|
4502
|
-
|
|
4354
|
+
_context24.next = 18;
|
|
4503
4355
|
return this.applyPromotion();
|
|
4504
4356
|
case 18:
|
|
4505
4357
|
this.applyDiscount();
|
|
4506
4358
|
this.sanitizeTempOrderProducts(tempOrder);
|
|
4507
|
-
|
|
4359
|
+
_context24.next = 22;
|
|
4508
4360
|
return this.recalculateSummary({
|
|
4509
4361
|
createIfMissing: true
|
|
4510
4362
|
});
|
|
@@ -4513,14 +4365,14 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4513
4365
|
this.logInfo('updateOrderProductQuantity success', {
|
|
4514
4366
|
params: params
|
|
4515
4367
|
});
|
|
4516
|
-
return
|
|
4368
|
+
return _context24.abrupt("return", tempOrder.products);
|
|
4517
4369
|
case 25:
|
|
4518
4370
|
case "end":
|
|
4519
|
-
return
|
|
4371
|
+
return _context24.stop();
|
|
4520
4372
|
}
|
|
4521
|
-
},
|
|
4373
|
+
}, _callee22, this);
|
|
4522
4374
|
}));
|
|
4523
|
-
function updateOrderProductQuantity(
|
|
4375
|
+
function updateOrderProductQuantity(_x26) {
|
|
4524
4376
|
return _updateOrderProductQuantity.apply(this, arguments);
|
|
4525
4377
|
}
|
|
4526
4378
|
return updateOrderProductQuantity;
|
|
@@ -4561,19 +4413,19 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4561
4413
|
}, {
|
|
4562
4414
|
key: "finalizeAfterProductsMutation",
|
|
4563
4415
|
value: (function () {
|
|
4564
|
-
var _finalizeAfterProductsMutation = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4565
|
-
return _regeneratorRuntime().wrap(function
|
|
4566
|
-
while (1) switch (
|
|
4416
|
+
var _finalizeAfterProductsMutation = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(tempOrder, options) {
|
|
4417
|
+
return _regeneratorRuntime().wrap(function _callee23$(_context25) {
|
|
4418
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
4567
4419
|
case 0:
|
|
4568
4420
|
this.syncTempOrderHolderFromBookings(tempOrder);
|
|
4569
|
-
|
|
4421
|
+
_context25.next = 3;
|
|
4570
4422
|
return this.applyPromotion();
|
|
4571
4423
|
case 3:
|
|
4572
4424
|
this.applyDiscount({
|
|
4573
4425
|
reapplyBookingDiscountProductUids: options === null || options === void 0 ? void 0 : options.reapplyBookingDiscountProductUids
|
|
4574
4426
|
});
|
|
4575
4427
|
this.sanitizeTempOrderProducts(tempOrder);
|
|
4576
|
-
|
|
4428
|
+
_context25.next = 7;
|
|
4577
4429
|
return this.recalculateSummary({
|
|
4578
4430
|
createIfMissing: true
|
|
4579
4431
|
});
|
|
@@ -4581,11 +4433,11 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4581
4433
|
this.persistTempOrder();
|
|
4582
4434
|
case 8:
|
|
4583
4435
|
case "end":
|
|
4584
|
-
return
|
|
4436
|
+
return _context25.stop();
|
|
4585
4437
|
}
|
|
4586
|
-
},
|
|
4438
|
+
}, _callee23, this);
|
|
4587
4439
|
}));
|
|
4588
|
-
function finalizeAfterProductsMutation(
|
|
4440
|
+
function finalizeAfterProductsMutation(_x27, _x28) {
|
|
4589
4441
|
return _finalizeAfterProductsMutation.apply(this, arguments);
|
|
4590
4442
|
}
|
|
4591
4443
|
return finalizeAfterProductsMutation;
|
|
@@ -4600,18 +4452,18 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4600
4452
|
}, {
|
|
4601
4453
|
key: "removeProductsFromOrder",
|
|
4602
4454
|
value: (function () {
|
|
4603
|
-
var _removeProductsFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4604
|
-
var
|
|
4455
|
+
var _removeProductsFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(identities) {
|
|
4456
|
+
var _this26 = this;
|
|
4605
4457
|
var tempOrder, productsBeforeRemove, bookingsBeforeRemove, matchedProducts, removedProducts, _i2, _removedProducts, product, linkedBookingUidsToRemove, _iterator21, _step21, _loop3;
|
|
4606
|
-
return _regeneratorRuntime().wrap(function
|
|
4607
|
-
while (1) switch (
|
|
4458
|
+
return _regeneratorRuntime().wrap(function _callee24$(_context27) {
|
|
4459
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
4608
4460
|
case 0:
|
|
4609
4461
|
tempOrder = this.ensureTempOrder();
|
|
4610
4462
|
if (identities.length) {
|
|
4611
|
-
|
|
4463
|
+
_context27.next = 3;
|
|
4612
4464
|
break;
|
|
4613
4465
|
}
|
|
4614
|
-
return
|
|
4466
|
+
return _context27.abrupt("return", tempOrder.products);
|
|
4615
4467
|
case 3:
|
|
4616
4468
|
productsBeforeRemove = tempOrder.products || [];
|
|
4617
4469
|
bookingsBeforeRemove = tempOrder.bookings || [];
|
|
@@ -4634,29 +4486,29 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4634
4486
|
}
|
|
4635
4487
|
linkedBookingUidsToRemove = new Set();
|
|
4636
4488
|
_iterator21 = _createForOfIteratorHelper(matchedProducts);
|
|
4637
|
-
|
|
4489
|
+
_context27.prev = 11;
|
|
4638
4490
|
_loop3 = /*#__PURE__*/_regeneratorRuntime().mark(function _loop3() {
|
|
4639
4491
|
var _metadata11, _metadata12, _metadata13, _metadata14;
|
|
4640
4492
|
var product, productUid, productBookingUid, isAddTimeProduct;
|
|
4641
|
-
return _regeneratorRuntime().wrap(function _loop3$(
|
|
4642
|
-
while (1) switch (
|
|
4493
|
+
return _regeneratorRuntime().wrap(function _loop3$(_context26) {
|
|
4494
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
4643
4495
|
case 0:
|
|
4644
4496
|
product = _step21.value;
|
|
4645
4497
|
productUid = (product === null || product === void 0 || (_metadata11 = product.metadata) === null || _metadata11 === void 0 ? void 0 : _metadata11.unique_identification_number) || (product === null || product === void 0 ? void 0 : product.unique_identification_number);
|
|
4646
4498
|
productBookingUid = (product === null || product === void 0 ? void 0 : product.booking_uid) || (product === null || product === void 0 || (_metadata12 = product.metadata) === null || _metadata12 === void 0 ? void 0 : _metadata12.booking_uid);
|
|
4647
4499
|
isAddTimeProduct = (product === null || product === void 0 || (_metadata13 = product.metadata) === null || _metadata13 === void 0 ? void 0 : _metadata13.product_add_schedule_time) !== undefined && (product === null || product === void 0 || (_metadata14 = product.metadata) === null || _metadata14 === void 0 ? void 0 : _metadata14.product_add_schedule_time) !== null;
|
|
4648
4500
|
if (!isAddTimeProduct) {
|
|
4649
|
-
|
|
4501
|
+
_context26.next = 6;
|
|
4650
4502
|
break;
|
|
4651
4503
|
}
|
|
4652
|
-
return
|
|
4504
|
+
return _context26.abrupt("return", 1);
|
|
4653
4505
|
case 6:
|
|
4654
4506
|
if (productBookingUid !== undefined && productBookingUid !== null && productBookingUid !== '') {
|
|
4655
4507
|
linkedBookingUidsToRemove.add(String(productBookingUid));
|
|
4656
4508
|
}
|
|
4657
4509
|
if (productUid !== undefined && productUid !== null && productUid !== '') {
|
|
4658
4510
|
bookingsBeforeRemove.forEach(function (booking) {
|
|
4659
|
-
var bookingUid =
|
|
4511
|
+
var bookingUid = _this26.getBookingUniqueIdentificationNumber(booking);
|
|
4660
4512
|
if (bookingUid && String((booking === null || booking === void 0 ? void 0 : booking.product_uid) || '') === String(productUid)) {
|
|
4661
4513
|
linkedBookingUidsToRemove.add(bookingUid);
|
|
4662
4514
|
}
|
|
@@ -4664,37 +4516,37 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4664
4516
|
}
|
|
4665
4517
|
case 8:
|
|
4666
4518
|
case "end":
|
|
4667
|
-
return
|
|
4519
|
+
return _context26.stop();
|
|
4668
4520
|
}
|
|
4669
4521
|
}, _loop3);
|
|
4670
4522
|
});
|
|
4671
4523
|
_iterator21.s();
|
|
4672
4524
|
case 14:
|
|
4673
4525
|
if ((_step21 = _iterator21.n()).done) {
|
|
4674
|
-
|
|
4526
|
+
_context27.next = 20;
|
|
4675
4527
|
break;
|
|
4676
4528
|
}
|
|
4677
|
-
return
|
|
4529
|
+
return _context27.delegateYield(_loop3(), "t0", 16);
|
|
4678
4530
|
case 16:
|
|
4679
|
-
if (!
|
|
4680
|
-
|
|
4531
|
+
if (!_context27.t0) {
|
|
4532
|
+
_context27.next = 18;
|
|
4681
4533
|
break;
|
|
4682
4534
|
}
|
|
4683
|
-
return
|
|
4535
|
+
return _context27.abrupt("continue", 18);
|
|
4684
4536
|
case 18:
|
|
4685
|
-
|
|
4537
|
+
_context27.next = 14;
|
|
4686
4538
|
break;
|
|
4687
4539
|
case 20:
|
|
4688
|
-
|
|
4540
|
+
_context27.next = 25;
|
|
4689
4541
|
break;
|
|
4690
4542
|
case 22:
|
|
4691
|
-
|
|
4692
|
-
|
|
4693
|
-
_iterator21.e(
|
|
4543
|
+
_context27.prev = 22;
|
|
4544
|
+
_context27.t1 = _context27["catch"](11);
|
|
4545
|
+
_iterator21.e(_context27.t1);
|
|
4694
4546
|
case 25:
|
|
4695
|
-
|
|
4547
|
+
_context27.prev = 25;
|
|
4696
4548
|
_iterator21.f();
|
|
4697
|
-
return
|
|
4549
|
+
return _context27.finish(25);
|
|
4698
4550
|
case 28:
|
|
4699
4551
|
if (linkedBookingUidsToRemove.size > 0) {
|
|
4700
4552
|
// 删除主预约商品时,同步移除挂在同一 booking_uid 下的加时商品,避免残留孤儿行。
|
|
@@ -4705,20 +4557,20 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4705
4557
|
return !(isAddTimeProduct && lineBookingUid !== undefined && lineBookingUid !== null && linkedBookingUidsToRemove.has(String(lineBookingUid)));
|
|
4706
4558
|
});
|
|
4707
4559
|
}
|
|
4708
|
-
|
|
4560
|
+
_context27.next = 31;
|
|
4709
4561
|
return this.finalizeAfterProductsMutation(tempOrder);
|
|
4710
4562
|
case 31:
|
|
4711
4563
|
this.logInfo('removeProductsFromOrder success', {
|
|
4712
4564
|
identities: identities
|
|
4713
4565
|
});
|
|
4714
|
-
return
|
|
4566
|
+
return _context27.abrupt("return", tempOrder.products);
|
|
4715
4567
|
case 33:
|
|
4716
4568
|
case "end":
|
|
4717
|
-
return
|
|
4569
|
+
return _context27.stop();
|
|
4718
4570
|
}
|
|
4719
|
-
},
|
|
4571
|
+
}, _callee24, this, [[11, 22, 25, 28]]);
|
|
4720
4572
|
}));
|
|
4721
|
-
function removeProductsFromOrder(
|
|
4573
|
+
function removeProductsFromOrder(_x29) {
|
|
4722
4574
|
return _removeProductsFromOrder.apply(this, arguments);
|
|
4723
4575
|
}
|
|
4724
4576
|
return removeProductsFromOrder;
|
|
@@ -4726,18 +4578,18 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4726
4578
|
}, {
|
|
4727
4579
|
key: "removeProductFromOrder",
|
|
4728
4580
|
value: function () {
|
|
4729
|
-
var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4730
|
-
return _regeneratorRuntime().wrap(function
|
|
4731
|
-
while (1) switch (
|
|
4581
|
+
var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(identity) {
|
|
4582
|
+
return _regeneratorRuntime().wrap(function _callee25$(_context28) {
|
|
4583
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
4732
4584
|
case 0:
|
|
4733
|
-
return
|
|
4585
|
+
return _context28.abrupt("return", this.removeProductsFromOrder([identity]));
|
|
4734
4586
|
case 1:
|
|
4735
4587
|
case "end":
|
|
4736
|
-
return
|
|
4588
|
+
return _context28.stop();
|
|
4737
4589
|
}
|
|
4738
|
-
},
|
|
4590
|
+
}, _callee25, this);
|
|
4739
4591
|
}));
|
|
4740
|
-
function removeProductFromOrder(
|
|
4592
|
+
function removeProductFromOrder(_x30) {
|
|
4741
4593
|
return _removeProductFromOrder.apply(this, arguments);
|
|
4742
4594
|
}
|
|
4743
4595
|
return removeProductFromOrder;
|
|
@@ -4749,10 +4601,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4749
4601
|
}, {
|
|
4750
4602
|
key: "clearOrderCartLines",
|
|
4751
4603
|
value: (function () {
|
|
4752
|
-
var _clearOrderCartLines = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4604
|
+
var _clearOrderCartLines = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26() {
|
|
4753
4605
|
var tempOrder;
|
|
4754
|
-
return _regeneratorRuntime().wrap(function
|
|
4755
|
-
while (1) switch (
|
|
4606
|
+
return _regeneratorRuntime().wrap(function _callee26$(_context29) {
|
|
4607
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
4756
4608
|
case 0:
|
|
4757
4609
|
tempOrder = this.ensureTempOrder();
|
|
4758
4610
|
tempOrder.products = [];
|
|
@@ -4763,24 +4615,24 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4763
4615
|
productsByUid: {}
|
|
4764
4616
|
});
|
|
4765
4617
|
}
|
|
4766
|
-
|
|
4618
|
+
_context29.next = 7;
|
|
4767
4619
|
return this.applyPromotion();
|
|
4768
4620
|
case 7:
|
|
4769
4621
|
this.applyDiscount();
|
|
4770
4622
|
this.sanitizeTempOrderProducts(tempOrder);
|
|
4771
|
-
|
|
4623
|
+
_context29.next = 11;
|
|
4772
4624
|
return this.recalculateSummary({
|
|
4773
4625
|
createIfMissing: true
|
|
4774
4626
|
});
|
|
4775
4627
|
case 11:
|
|
4776
4628
|
this.persistTempOrder();
|
|
4777
4629
|
this.logInfo('clearOrderCartLines success', {});
|
|
4778
|
-
return
|
|
4630
|
+
return _context29.abrupt("return", tempOrder);
|
|
4779
4631
|
case 14:
|
|
4780
4632
|
case "end":
|
|
4781
|
-
return
|
|
4633
|
+
return _context29.stop();
|
|
4782
4634
|
}
|
|
4783
|
-
},
|
|
4635
|
+
}, _callee26, this);
|
|
4784
4636
|
}));
|
|
4785
4637
|
function clearOrderCartLines() {
|
|
4786
4638
|
return _clearOrderCartLines.apply(this, arguments);
|
|
@@ -4818,17 +4670,17 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4818
4670
|
}, {
|
|
4819
4671
|
key: "applyLocalPrintOrderNumbers",
|
|
4820
4672
|
value: function () {
|
|
4821
|
-
var _applyLocalPrintOrderNumbers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4673
|
+
var _applyLocalPrintOrderNumbers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(order) {
|
|
4822
4674
|
var tempOrder, shopOrderNumber, shopFullOrderNumber;
|
|
4823
|
-
return _regeneratorRuntime().wrap(function
|
|
4824
|
-
while (1) switch (
|
|
4675
|
+
return _regeneratorRuntime().wrap(function _callee27$(_context30) {
|
|
4676
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
4825
4677
|
case 0:
|
|
4826
4678
|
tempOrder = this.ensureTempOrder();
|
|
4827
4679
|
if (!(!order || _typeof(order) !== 'object')) {
|
|
4828
|
-
|
|
4680
|
+
_context30.next = 3;
|
|
4829
4681
|
break;
|
|
4830
4682
|
}
|
|
4831
|
-
return
|
|
4683
|
+
return _context30.abrupt("return", tempOrder);
|
|
4832
4684
|
case 3:
|
|
4833
4685
|
shopOrderNumber = order.shop_order_number;
|
|
4834
4686
|
shopFullOrderNumber = order.shop_full_order_number;
|
|
@@ -4839,88 +4691,21 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4839
4691
|
tempOrder.shop_full_order_number = String(shopFullOrderNumber);
|
|
4840
4692
|
}
|
|
4841
4693
|
this.persistTempOrder();
|
|
4842
|
-
|
|
4694
|
+
_context30.next = 10;
|
|
4843
4695
|
return this.saveDraft();
|
|
4844
4696
|
case 10:
|
|
4845
|
-
return
|
|
4697
|
+
return _context30.abrupt("return", tempOrder);
|
|
4846
4698
|
case 11:
|
|
4847
4699
|
case "end":
|
|
4848
|
-
return
|
|
4700
|
+
return _context30.stop();
|
|
4849
4701
|
}
|
|
4850
|
-
},
|
|
4702
|
+
}, _callee27, this);
|
|
4851
4703
|
}));
|
|
4852
|
-
function applyLocalPrintOrderNumbers(
|
|
4704
|
+
function applyLocalPrintOrderNumbers(_x31) {
|
|
4853
4705
|
return _applyLocalPrintOrderNumbers.apply(this, arguments);
|
|
4854
4706
|
}
|
|
4855
4707
|
return applyLocalPrintOrderNumbers;
|
|
4856
4708
|
}()
|
|
4857
|
-
}, {
|
|
4858
|
-
key: "saveTempOrderAsDraft",
|
|
4859
|
-
value: function () {
|
|
4860
|
-
var _saveTempOrderAsDraft = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(params) {
|
|
4861
|
-
var _params$cacheId2, _this$otherParams6, _this$otherParams7, _this$otherParams8, _params$type, _this$otherParams9, _payload$products;
|
|
4862
|
-
var tempOrder, latestSummary, payload;
|
|
4863
|
-
return _regeneratorRuntime().wrap(function _callee31$(_context34) {
|
|
4864
|
-
while (1) switch (_context34.prev = _context34.next) {
|
|
4865
|
-
case 0:
|
|
4866
|
-
tempOrder = this.ensureTempOrder();
|
|
4867
|
-
this.ensureExternalSaleNumber(tempOrder);
|
|
4868
|
-
this.persistTempOrder();
|
|
4869
|
-
_context34.next = 5;
|
|
4870
|
-
return this.recalculateSummary({
|
|
4871
|
-
createIfMissing: true
|
|
4872
|
-
});
|
|
4873
|
-
case 5:
|
|
4874
|
-
_context34.t1 = _context34.sent;
|
|
4875
|
-
if (_context34.t1) {
|
|
4876
|
-
_context34.next = 8;
|
|
4877
|
-
break;
|
|
4878
|
-
}
|
|
4879
|
-
_context34.t1 = this.store.summary;
|
|
4880
|
-
case 8:
|
|
4881
|
-
_context34.t0 = _context34.t1;
|
|
4882
|
-
if (_context34.t0) {
|
|
4883
|
-
_context34.next = 11;
|
|
4884
|
-
break;
|
|
4885
|
-
}
|
|
4886
|
-
_context34.t0 = createEmptySummary();
|
|
4887
|
-
case 11:
|
|
4888
|
-
latestSummary = _context34.t0;
|
|
4889
|
-
payload = buildSubmitPayload({
|
|
4890
|
-
tempOrder: tempOrder,
|
|
4891
|
-
cacheId: (_params$cacheId2 = params === null || params === void 0 ? void 0 : params.cacheId) !== null && _params$cacheId2 !== void 0 ? _params$cacheId2 : this.cacheId,
|
|
4892
|
-
platform: (params === null || params === void 0 ? void 0 : params.platform) || ((_this$otherParams6 = this.otherParams) === null || _this$otherParams6 === void 0 ? void 0 : _this$otherParams6.platform),
|
|
4893
|
-
businessCode: (params === null || params === void 0 ? void 0 : params.businessCode) || ((_this$otherParams7 = this.otherParams) === null || _this$otherParams7 === void 0 ? void 0 : _this$otherParams7.businessCode) || ((_this$otherParams8 = this.otherParams) === null || _this$otherParams8 === void 0 ? void 0 : _this$otherParams8.business_code) || tempOrder.business_code,
|
|
4894
|
-
channel: params === null || params === void 0 ? void 0 : params.channel,
|
|
4895
|
-
type: (_params$type = params === null || params === void 0 ? void 0 : params.type) !== null && _params$type !== void 0 ? _params$type : (_this$otherParams9 = this.otherParams) === null || _this$otherParams9 === void 0 ? void 0 : _this$otherParams9.type,
|
|
4896
|
-
summary: latestSummary,
|
|
4897
|
-
enhance: params === null || params === void 0 ? void 0 : params.enhancePayload
|
|
4898
|
-
});
|
|
4899
|
-
if (!payload.created_at) {
|
|
4900
|
-
payload.created_at = dayjs().format('YYYY-MM-DD HH:mm:ss');
|
|
4901
|
-
}
|
|
4902
|
-
payload.need_sync = 0;
|
|
4903
|
-
payload.is_draft_order = 1;
|
|
4904
|
-
this.logInfo('saveTempOrderAsDraft calling sales draft', {
|
|
4905
|
-
orderId: payload.order_id,
|
|
4906
|
-
externalSaleNumber: payload.external_sale_number,
|
|
4907
|
-
productsCount: ((_payload$products = payload.products) === null || _payload$products === void 0 ? void 0 : _payload$products.length) || 0
|
|
4908
|
-
});
|
|
4909
|
-
return _context34.abrupt("return", this.request.post('/order/sales/draft', payload, {
|
|
4910
|
-
osServer: true,
|
|
4911
|
-
customToast: function customToast() {}
|
|
4912
|
-
}));
|
|
4913
|
-
case 18:
|
|
4914
|
-
case "end":
|
|
4915
|
-
return _context34.stop();
|
|
4916
|
-
}
|
|
4917
|
-
}, _callee31, this);
|
|
4918
|
-
}));
|
|
4919
|
-
function saveTempOrderAsDraft(_x37) {
|
|
4920
|
-
return _saveTempOrderAsDraft.apply(this, arguments);
|
|
4921
|
-
}
|
|
4922
|
-
return saveTempOrderAsDraft;
|
|
4923
|
-
}()
|
|
4924
4709
|
/**
|
|
4925
4710
|
* 提交当前 Sales tempOrder。
|
|
4926
4711
|
*
|
|
@@ -4930,18 +4715,18 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4930
4715
|
}, {
|
|
4931
4716
|
key: "submitTempOrder",
|
|
4932
4717
|
value: (function () {
|
|
4933
|
-
var _submitTempOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4934
|
-
return _regeneratorRuntime().wrap(function
|
|
4935
|
-
while (1) switch (
|
|
4718
|
+
var _submitTempOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(params) {
|
|
4719
|
+
return _regeneratorRuntime().wrap(function _callee28$(_context31) {
|
|
4720
|
+
while (1) switch (_context31.prev = _context31.next) {
|
|
4936
4721
|
case 0:
|
|
4937
|
-
return
|
|
4722
|
+
return _context31.abrupt("return", this.runSubmitTempOrder(params));
|
|
4938
4723
|
case 1:
|
|
4939
4724
|
case "end":
|
|
4940
|
-
return
|
|
4725
|
+
return _context31.stop();
|
|
4941
4726
|
}
|
|
4942
|
-
},
|
|
4727
|
+
}, _callee28, this);
|
|
4943
4728
|
}));
|
|
4944
|
-
function submitTempOrder(
|
|
4729
|
+
function submitTempOrder(_x32) {
|
|
4945
4730
|
return _submitTempOrder.apply(this, arguments);
|
|
4946
4731
|
}
|
|
4947
4732
|
return submitTempOrder;
|
|
@@ -4949,20 +4734,20 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4949
4734
|
}, {
|
|
4950
4735
|
key: "submitTempOrderAsync",
|
|
4951
4736
|
value: function () {
|
|
4952
|
-
var _submitTempOrderAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4953
|
-
return _regeneratorRuntime().wrap(function
|
|
4954
|
-
while (1) switch (
|
|
4737
|
+
var _submitTempOrderAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(params) {
|
|
4738
|
+
return _regeneratorRuntime().wrap(function _callee29$(_context32) {
|
|
4739
|
+
while (1) switch (_context32.prev = _context32.next) {
|
|
4955
4740
|
case 0:
|
|
4956
|
-
return
|
|
4741
|
+
return _context32.abrupt("return", this.runSubmitTempOrder(_objectSpread(_objectSpread({}, params), {}, {
|
|
4957
4742
|
syncMode: true
|
|
4958
4743
|
})));
|
|
4959
4744
|
case 1:
|
|
4960
4745
|
case "end":
|
|
4961
|
-
return
|
|
4746
|
+
return _context32.stop();
|
|
4962
4747
|
}
|
|
4963
|
-
},
|
|
4748
|
+
}, _callee29, this);
|
|
4964
4749
|
}));
|
|
4965
|
-
function submitTempOrderAsync(
|
|
4750
|
+
function submitTempOrderAsync(_x33) {
|
|
4966
4751
|
return _submitTempOrderAsync.apply(this, arguments);
|
|
4967
4752
|
}
|
|
4968
4753
|
return submitTempOrderAsync;
|
|
@@ -4970,11 +4755,11 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4970
4755
|
}, {
|
|
4971
4756
|
key: "runSubmitTempOrder",
|
|
4972
4757
|
value: function () {
|
|
4973
|
-
var _runSubmitTempOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4974
|
-
var _params$
|
|
4758
|
+
var _runSubmitTempOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(params) {
|
|
4759
|
+
var _params$cacheId2, _this$otherParams6, _ref74, _ref75, _submitSnapshot$busin, _this$otherParams7, _this$otherParams8, _submitSnapshot$type;
|
|
4975
4760
|
var tempOrder, shouldConfirmPendingVoucherPayments, hasPaymentOverride, preparedPaymentOverride, latestSummary, effectiveCacheId, hasPaymentStatusOverride, hasSmallTicketDataFlagOverride, enhancePayload, submitSnapshot, payload, result, _payload$payments, _payload$payments2, backendErrorResponse, submittedOrderId, resultRecord;
|
|
4976
|
-
return _regeneratorRuntime().wrap(function
|
|
4977
|
-
while (1) switch (
|
|
4761
|
+
return _regeneratorRuntime().wrap(function _callee30$(_context33) {
|
|
4762
|
+
while (1) switch (_context33.prev = _context33.next) {
|
|
4978
4763
|
case 0:
|
|
4979
4764
|
tempOrder = this.ensureTempOrder();
|
|
4980
4765
|
shouldConfirmPendingVoucherPayments = (params === null || params === void 0 ? void 0 : params.confirmPendingVoucherPayments) !== false;
|
|
@@ -4994,27 +4779,27 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4994
4779
|
}
|
|
4995
4780
|
}
|
|
4996
4781
|
this.persistTempOrder();
|
|
4997
|
-
|
|
4782
|
+
_context33.next = 8;
|
|
4998
4783
|
return this.recalculateSummary({
|
|
4999
4784
|
createIfMissing: true
|
|
5000
4785
|
});
|
|
5001
4786
|
case 8:
|
|
5002
|
-
|
|
5003
|
-
if (
|
|
5004
|
-
|
|
4787
|
+
_context33.t1 = _context33.sent;
|
|
4788
|
+
if (_context33.t1) {
|
|
4789
|
+
_context33.next = 11;
|
|
5005
4790
|
break;
|
|
5006
4791
|
}
|
|
5007
|
-
|
|
4792
|
+
_context33.t1 = this.store.summary;
|
|
5008
4793
|
case 11:
|
|
5009
|
-
|
|
5010
|
-
if (
|
|
5011
|
-
|
|
4794
|
+
_context33.t0 = _context33.t1;
|
|
4795
|
+
if (_context33.t0) {
|
|
4796
|
+
_context33.next = 14;
|
|
5012
4797
|
break;
|
|
5013
4798
|
}
|
|
5014
|
-
|
|
4799
|
+
_context33.t0 = createEmptySummary();
|
|
5015
4800
|
case 14:
|
|
5016
|
-
latestSummary =
|
|
5017
|
-
effectiveCacheId = (_params$
|
|
4801
|
+
latestSummary = _context33.t0;
|
|
4802
|
+
effectiveCacheId = (_params$cacheId2 = params === null || params === void 0 ? void 0 : params.cacheId) !== null && _params$cacheId2 !== void 0 ? _params$cacheId2 : this.cacheId;
|
|
5018
4803
|
hasPaymentStatusOverride = (params === null || params === void 0 ? void 0 : params.paymentStatus) !== undefined;
|
|
5019
4804
|
hasSmallTicketDataFlagOverride = (params === null || params === void 0 ? void 0 : params.smallTicketDataFlag) !== undefined;
|
|
5020
4805
|
enhancePayload = hasPaymentOverride || hasPaymentStatusOverride || hasSmallTicketDataFlagOverride || params !== null && params !== void 0 && params.enhancePayload ? function (payload, ctx) {
|
|
@@ -5032,8 +4817,8 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5032
4817
|
payload = buildSubmitPayload({
|
|
5033
4818
|
tempOrder: tempOrder,
|
|
5034
4819
|
cacheId: effectiveCacheId,
|
|
5035
|
-
platform: (params === null || params === void 0 ? void 0 : params.platform) || ((_this$
|
|
5036
|
-
businessCode: (_ref74 = (_ref75 = (_submitSnapshot$busin = submitSnapshot.businessCode) !== null && _submitSnapshot$busin !== void 0 ? _submitSnapshot$busin : params === null || params === void 0 ? void 0 : params.businessCode) !== null && _ref75 !== void 0 ? _ref75 : (_this$
|
|
4820
|
+
platform: (params === null || params === void 0 ? void 0 : params.platform) || ((_this$otherParams6 = this.otherParams) === null || _this$otherParams6 === void 0 ? void 0 : _this$otherParams6.platform),
|
|
4821
|
+
businessCode: (_ref74 = (_ref75 = (_submitSnapshot$busin = submitSnapshot.businessCode) !== null && _submitSnapshot$busin !== void 0 ? _submitSnapshot$busin : params === null || params === void 0 ? void 0 : params.businessCode) !== null && _ref75 !== void 0 ? _ref75 : (_this$otherParams7 = this.otherParams) === null || _this$otherParams7 === void 0 ? void 0 : _this$otherParams7.businessCode) !== null && _ref74 !== void 0 ? _ref74 : (_this$otherParams8 = this.otherParams) === null || _this$otherParams8 === void 0 ? void 0 : _this$otherParams8.business_code,
|
|
5037
4822
|
channel: params === null || params === void 0 ? void 0 : params.channel,
|
|
5038
4823
|
type: (_submitSnapshot$type = submitSnapshot.type) !== null && _submitSnapshot$type !== void 0 ? _submitSnapshot$type : params === null || params === void 0 ? void 0 : params.type,
|
|
5039
4824
|
summary: latestSummary,
|
|
@@ -5048,10 +4833,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5048
4833
|
if (!payload.created_at) {
|
|
5049
4834
|
payload.created_at = dayjs().format('YYYY-MM-DD HH:mm:ss');
|
|
5050
4835
|
}
|
|
5051
|
-
|
|
4836
|
+
_context33.next = 26;
|
|
5052
4837
|
return this.saveDraft();
|
|
5053
4838
|
case 26:
|
|
5054
|
-
|
|
4839
|
+
_context33.prev = 26;
|
|
5055
4840
|
this.logInfo('submitTempOrder calling sales checkout', {
|
|
5056
4841
|
orderId: payload.order_id,
|
|
5057
4842
|
externalSaleNumber: payload.external_sale_number,
|
|
@@ -5061,43 +4846,43 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5061
4846
|
smallTicketDataFlag: payload.small_ticket_data_flag,
|
|
5062
4847
|
syncMode: payload.sync_mode
|
|
5063
4848
|
});
|
|
5064
|
-
|
|
4849
|
+
_context33.next = 30;
|
|
5065
4850
|
return this.submitSalesOrder({
|
|
5066
4851
|
query: payload
|
|
5067
4852
|
});
|
|
5068
4853
|
case 30:
|
|
5069
|
-
result =
|
|
5070
|
-
|
|
4854
|
+
result = _context33.sent;
|
|
4855
|
+
_context33.next = 43;
|
|
5071
4856
|
break;
|
|
5072
4857
|
case 33:
|
|
5073
|
-
|
|
5074
|
-
|
|
5075
|
-
backendErrorResponse = this.extractSubmitErrorResponse(
|
|
4858
|
+
_context33.prev = 33;
|
|
4859
|
+
_context33.t2 = _context33["catch"](26);
|
|
4860
|
+
backendErrorResponse = this.extractSubmitErrorResponse(_context33.t2);
|
|
5076
4861
|
if (!backendErrorResponse) {
|
|
5077
|
-
|
|
4862
|
+
_context33.next = 40;
|
|
5078
4863
|
break;
|
|
5079
4864
|
}
|
|
5080
4865
|
this.store.syncState = 'failed';
|
|
5081
4866
|
this.logSubmitBackendRejected(backendErrorResponse, payload);
|
|
5082
|
-
return
|
|
4867
|
+
return _context33.abrupt("return", backendErrorResponse);
|
|
5083
4868
|
case 40:
|
|
5084
4869
|
this.store.syncState = 'failed';
|
|
5085
4870
|
this.logError('submitTempOrder failed', {
|
|
5086
|
-
error:
|
|
4871
|
+
error: _context33.t2 instanceof Error ? _context33.t2.message : String(_context33.t2),
|
|
5087
4872
|
orderId: payload.order_id,
|
|
5088
4873
|
externalSaleNumber: payload.external_sale_number,
|
|
5089
4874
|
paymentStatus: payload.payment_status,
|
|
5090
4875
|
paymentsCount: ((_payload$payments2 = payload.payments) === null || _payload$payments2 === void 0 ? void 0 : _payload$payments2.length) || 0
|
|
5091
4876
|
});
|
|
5092
|
-
throw
|
|
4877
|
+
throw _context33.t2;
|
|
5093
4878
|
case 43:
|
|
5094
4879
|
if (!this.isSubmitResponseRejected(result)) {
|
|
5095
|
-
|
|
4880
|
+
_context33.next = 47;
|
|
5096
4881
|
break;
|
|
5097
4882
|
}
|
|
5098
4883
|
this.store.syncState = 'failed';
|
|
5099
4884
|
this.logSubmitBackendRejected(result, payload);
|
|
5100
|
-
return
|
|
4885
|
+
return _context33.abrupt("return", result);
|
|
5101
4886
|
case 47:
|
|
5102
4887
|
submittedOrderId = this.extractOrderIdFromSubmitResult(result);
|
|
5103
4888
|
this.logInfo('runSubmitTempOrder: 提交成功', {
|
|
@@ -5108,15 +4893,15 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5108
4893
|
})
|
|
5109
4894
|
});
|
|
5110
4895
|
if (!(submittedOrderId !== null && submittedOrderId !== undefined)) {
|
|
5111
|
-
|
|
4896
|
+
_context33.next = 56;
|
|
5112
4897
|
break;
|
|
5113
4898
|
}
|
|
5114
4899
|
tempOrder.order_id = submittedOrderId;
|
|
5115
4900
|
resultRecord = result;
|
|
5116
|
-
|
|
4901
|
+
_context33.next = 54;
|
|
5117
4902
|
return this.markLocalOrderSynced(submittedOrderId, (resultRecord === null || resultRecord === void 0 ? void 0 : resultRecord.data) || resultRecord || {});
|
|
5118
4903
|
case 54:
|
|
5119
|
-
|
|
4904
|
+
_context33.next = 57;
|
|
5120
4905
|
break;
|
|
5121
4906
|
case 56:
|
|
5122
4907
|
if (this.isLocalPendingSubmitResult(result)) {
|
|
@@ -5125,14 +4910,14 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5125
4910
|
this.store.syncState = 'submitted';
|
|
5126
4911
|
}
|
|
5127
4912
|
case 57:
|
|
5128
|
-
return
|
|
4913
|
+
return _context33.abrupt("return", result);
|
|
5129
4914
|
case 58:
|
|
5130
4915
|
case "end":
|
|
5131
|
-
return
|
|
4916
|
+
return _context33.stop();
|
|
5132
4917
|
}
|
|
5133
|
-
},
|
|
4918
|
+
}, _callee30, this, [[26, 33]]);
|
|
5134
4919
|
}));
|
|
5135
|
-
function runSubmitTempOrder(
|
|
4920
|
+
function runSubmitTempOrder(_x34) {
|
|
5136
4921
|
return _runSubmitTempOrder.apply(this, arguments);
|
|
5137
4922
|
}
|
|
5138
4923
|
return runSubmitTempOrder;
|
|
@@ -5140,10 +4925,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5140
4925
|
}, {
|
|
5141
4926
|
key: "markLocalOrderSynced",
|
|
5142
4927
|
value: function () {
|
|
5143
|
-
var _markLocalOrderSynced = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4928
|
+
var _markLocalOrderSynced = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(orderId, remoteOrder) {
|
|
5144
4929
|
var tempOrder;
|
|
5145
|
-
return _regeneratorRuntime().wrap(function
|
|
5146
|
-
while (1) switch (
|
|
4930
|
+
return _regeneratorRuntime().wrap(function _callee31$(_context34) {
|
|
4931
|
+
while (1) switch (_context34.prev = _context34.next) {
|
|
5147
4932
|
case 0:
|
|
5148
4933
|
tempOrder = this.ensureTempOrder();
|
|
5149
4934
|
tempOrder.order_id = orderId;
|
|
@@ -5151,15 +4936,15 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5151
4936
|
this.store.lastOrderInfo = remoteOrder;
|
|
5152
4937
|
this.store.syncState = 'submitted';
|
|
5153
4938
|
this.persistTempOrder();
|
|
5154
|
-
|
|
4939
|
+
_context34.next = 8;
|
|
5155
4940
|
return this.saveDraft();
|
|
5156
4941
|
case 8:
|
|
5157
4942
|
case "end":
|
|
5158
|
-
return
|
|
4943
|
+
return _context34.stop();
|
|
5159
4944
|
}
|
|
5160
|
-
},
|
|
4945
|
+
}, _callee31, this);
|
|
5161
4946
|
}));
|
|
5162
|
-
function markLocalOrderSynced(
|
|
4947
|
+
function markLocalOrderSynced(_x35, _x36) {
|
|
5163
4948
|
return _markLocalOrderSynced.apply(this, arguments);
|
|
5164
4949
|
}
|
|
5165
4950
|
return markLocalOrderSynced;
|
|
@@ -5202,10 +4987,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5202
4987
|
value: function extractSubmitErrorResponse(error) {
|
|
5203
4988
|
var _error$response,
|
|
5204
4989
|
_error$response2,
|
|
5205
|
-
|
|
4990
|
+
_this27 = this;
|
|
5206
4991
|
var candidates = [error === null || error === void 0 || (_error$response = error.response) === null || _error$response === void 0 ? void 0 : _error$response.data, error === null || error === void 0 ? void 0 : error.data, error === null || error === void 0 || (_error$response2 = error.response) === null || _error$response2 === void 0 ? void 0 : _error$response2.body, error === null || error === void 0 ? void 0 : error.body];
|
|
5207
4992
|
return candidates.find(function (candidate) {
|
|
5208
|
-
return
|
|
4993
|
+
return _this27.isSubmitErrorResponse(candidate);
|
|
5209
4994
|
}) || null;
|
|
5210
4995
|
}
|
|
5211
4996
|
}, {
|
|
@@ -5232,37 +5017,14 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5232
5017
|
}, {
|
|
5233
5018
|
key: "syncPaymentsToOrder",
|
|
5234
5019
|
value: function () {
|
|
5235
|
-
var _syncPaymentsToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5236
|
-
var
|
|
5237
|
-
|
|
5238
|
-
|
|
5239
|
-
|
|
5240
|
-
while (1) switch (_context39.prev = _context39.next) {
|
|
5020
|
+
var _syncPaymentsToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(params) {
|
|
5021
|
+
var _params$confirmPendin;
|
|
5022
|
+
var tempOrder, mappedPayments, shouldConfirmPendingVoucherPayments, effectivePayments, completion, orderPaidPaymentTotal, paymentStatus, paymentSyncIdempotencyToken, submitParams, submitResult;
|
|
5023
|
+
return _regeneratorRuntime().wrap(function _callee32$(_context35) {
|
|
5024
|
+
while (1) switch (_context35.prev = _context35.next) {
|
|
5241
5025
|
case 0:
|
|
5242
5026
|
tempOrder = this.ensureTempOrder();
|
|
5243
|
-
|
|
5244
|
-
return String(payment.payment_number || '').trim() === '';
|
|
5245
|
-
});
|
|
5246
|
-
if (!needsPaymentNumber) {
|
|
5247
|
-
_context39.next = 8;
|
|
5248
|
-
break;
|
|
5249
|
-
}
|
|
5250
|
-
_context39.next = 5;
|
|
5251
|
-
return this.getPaymentNumberDevicePrefixAsync();
|
|
5252
|
-
case 5:
|
|
5253
|
-
_context39.t0 = _context39.sent;
|
|
5254
|
-
_context39.next = 9;
|
|
5255
|
-
break;
|
|
5256
|
-
case 8:
|
|
5257
|
-
_context39.t0 = 'LOCAL';
|
|
5258
|
-
case 9:
|
|
5259
|
-
devicePrefix = _context39.t0;
|
|
5260
|
-
mappedPayments = mapPaymentItemsToOrderPayments((params.payments || []).map(function (payment) {
|
|
5261
|
-
return _this31.normalizePaymentSource(payment, {
|
|
5262
|
-
defaultPaid: false,
|
|
5263
|
-
devicePrefix: devicePrefix
|
|
5264
|
-
});
|
|
5265
|
-
}));
|
|
5027
|
+
mappedPayments = mapPaymentItemsToOrderPayments(params.payments || []);
|
|
5266
5028
|
shouldConfirmPendingVoucherPayments = (_params$confirmPendin = params.confirmPendingVoucherPayments) !== null && _params$confirmPendin !== void 0 ? _params$confirmPendin : params.submitWhenPaid === true;
|
|
5267
5029
|
effectivePayments = shouldConfirmPendingVoucherPayments ? this.confirmPendingVoucherPaymentsInList(mappedPayments) : params.confirmPendingVoucherPayments === false ? this.discardPendingVoucherPaymentsFromList(mappedPayments) : mappedPayments;
|
|
5268
5030
|
completion = this.getPaymentCompletion(effectivePayments);
|
|
@@ -5271,25 +5033,24 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5271
5033
|
tempOrder.payments = effectivePayments;
|
|
5272
5034
|
tempOrder.payment_status = paymentStatus;
|
|
5273
5035
|
this.persistTempOrder();
|
|
5274
|
-
|
|
5036
|
+
_context35.next = 12;
|
|
5275
5037
|
return this.saveDraft();
|
|
5276
|
-
case
|
|
5038
|
+
case 12:
|
|
5277
5039
|
if (params.submitWhenPaid) {
|
|
5278
|
-
|
|
5040
|
+
_context35.next = 14;
|
|
5279
5041
|
break;
|
|
5280
5042
|
}
|
|
5281
|
-
return
|
|
5282
|
-
case
|
|
5043
|
+
return _context35.abrupt("return", completion);
|
|
5044
|
+
case 14:
|
|
5283
5045
|
if (!(this.store.syncState === 'submitting')) {
|
|
5284
|
-
|
|
5046
|
+
_context35.next = 16;
|
|
5285
5047
|
break;
|
|
5286
5048
|
}
|
|
5287
|
-
return
|
|
5288
|
-
case
|
|
5049
|
+
return _context35.abrupt("return", completion);
|
|
5050
|
+
case 16:
|
|
5289
5051
|
this.store.syncState = 'submitting';
|
|
5290
5052
|
paymentSyncIdempotencyToken = this.buildPaymentSyncIdempotencyToken(tempOrder, effectivePayments);
|
|
5291
|
-
|
|
5292
|
-
return this.submitTempOrder({
|
|
5053
|
+
submitParams = {
|
|
5293
5054
|
payments: effectivePayments,
|
|
5294
5055
|
paymentStatus: paymentStatus,
|
|
5295
5056
|
smallTicketDataFlag: params.smallTicketDataFlag,
|
|
@@ -5302,19 +5063,34 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5302
5063
|
});
|
|
5303
5064
|
return nextPayload;
|
|
5304
5065
|
}
|
|
5305
|
-
}
|
|
5306
|
-
|
|
5307
|
-
|
|
5308
|
-
|
|
5066
|
+
};
|
|
5067
|
+
if (!(params.checkoutSyncTaskEnabled === false)) {
|
|
5068
|
+
_context35.next = 25;
|
|
5069
|
+
break;
|
|
5070
|
+
}
|
|
5071
|
+
_context35.next = 22;
|
|
5072
|
+
return this.submitTempOrderAsync(submitParams);
|
|
5073
|
+
case 22:
|
|
5074
|
+
_context35.t0 = _context35.sent;
|
|
5075
|
+
_context35.next = 28;
|
|
5076
|
+
break;
|
|
5077
|
+
case 25:
|
|
5078
|
+
_context35.next = 27;
|
|
5079
|
+
return this.submitTempOrder(submitParams);
|
|
5080
|
+
case 27:
|
|
5081
|
+
_context35.t0 = _context35.sent;
|
|
5082
|
+
case 28:
|
|
5083
|
+
submitResult = _context35.t0;
|
|
5084
|
+
return _context35.abrupt("return", _objectSpread(_objectSpread({}, completion), {}, {
|
|
5309
5085
|
submitResult: submitResult
|
|
5310
5086
|
}));
|
|
5311
|
-
case
|
|
5087
|
+
case 30:
|
|
5312
5088
|
case "end":
|
|
5313
|
-
return
|
|
5089
|
+
return _context35.stop();
|
|
5314
5090
|
}
|
|
5315
|
-
},
|
|
5091
|
+
}, _callee32, this);
|
|
5316
5092
|
}));
|
|
5317
|
-
function syncPaymentsToOrder(
|
|
5093
|
+
function syncPaymentsToOrder(_x37) {
|
|
5318
5094
|
return _syncPaymentsToOrder.apply(this, arguments);
|
|
5319
5095
|
}
|
|
5320
5096
|
return syncPaymentsToOrder;
|
|
@@ -5322,6 +5098,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5322
5098
|
}, {
|
|
5323
5099
|
key: "createOrder",
|
|
5324
5100
|
value: function createOrder(params) {
|
|
5101
|
+
var _this28 = this;
|
|
5325
5102
|
var order = _objectSpread({
|
|
5326
5103
|
type: (params === null || params === void 0 ? void 0 : params.type) || 'appointment_booking',
|
|
5327
5104
|
// 要从外面拿,virtual
|
|
@@ -5333,11 +5110,13 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5333
5110
|
schedule_date: '',
|
|
5334
5111
|
is_deposit: 0,
|
|
5335
5112
|
relation_products: [],
|
|
5336
|
-
relation_forms: []
|
|
5113
|
+
relation_forms: [],
|
|
5114
|
+
business_code: params === null || params === void 0 ? void 0 : params.business_code
|
|
5337
5115
|
}, (params === null || params === void 0 ? void 0 : params.extraData) || {});
|
|
5338
5116
|
var is_deposit = 0; // 是否存在定金,0 不存在,1 存在
|
|
5339
5117
|
if (params.cartItems.length > 0) {
|
|
5340
5118
|
params.cartItems.forEach(function (item) {
|
|
5119
|
+
var _params$extraData;
|
|
5341
5120
|
if (!item._origin.duration) {
|
|
5342
5121
|
var _generateDuration = generateDuration(item),
|
|
5343
5122
|
duration = _generateDuration.duration,
|
|
@@ -5349,6 +5128,11 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5349
5128
|
var discountList = getAllDiscountList(item);
|
|
5350
5129
|
item._origin.product.discount_list = discountList;
|
|
5351
5130
|
|
|
5131
|
+
// 为预约补齐 holder 信息
|
|
5132
|
+
if (params !== null && params !== void 0 && (_params$extraData = params.extraData) !== null && _params$extraData !== void 0 && _params$extraData.is_add_holder_info) {
|
|
5133
|
+
ensureCartItemOriginHolder(item, _this28.window);
|
|
5134
|
+
}
|
|
5135
|
+
|
|
5352
5136
|
// 购物车是否为普通商品
|
|
5353
5137
|
if (isNormalProduct(item._origin)) {
|
|
5354
5138
|
var _order$relation_forms;
|
|
@@ -5403,11 +5187,11 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5403
5187
|
}, {
|
|
5404
5188
|
key: "submitOrder",
|
|
5405
5189
|
value: function () {
|
|
5406
|
-
var _submitOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5190
|
+
var _submitOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(order) {
|
|
5407
5191
|
var _order$query$cartItem, _params$bookings, _params$relation_prod;
|
|
5408
5192
|
var url, query, fetchUrl, params;
|
|
5409
|
-
return _regeneratorRuntime().wrap(function
|
|
5410
|
-
while (1) switch (
|
|
5193
|
+
return _regeneratorRuntime().wrap(function _callee33$(_context36) {
|
|
5194
|
+
while (1) switch (_context36.prev = _context36.next) {
|
|
5411
5195
|
case 0:
|
|
5412
5196
|
this.logInfo('submitOrder called', {
|
|
5413
5197
|
url: order.url,
|
|
@@ -5427,14 +5211,14 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5427
5211
|
relationProductsCount: ((_params$relation_prod = params.relation_products) === null || _params$relation_prod === void 0 ? void 0 : _params$relation_prod.length) || 0,
|
|
5428
5212
|
scheduleDate: params.schedule_date
|
|
5429
5213
|
});
|
|
5430
|
-
return
|
|
5214
|
+
return _context36.abrupt("return", this.request.post(fetchUrl, params));
|
|
5431
5215
|
case 6:
|
|
5432
5216
|
case "end":
|
|
5433
|
-
return
|
|
5217
|
+
return _context36.stop();
|
|
5434
5218
|
}
|
|
5435
|
-
},
|
|
5219
|
+
}, _callee33, this);
|
|
5436
5220
|
}));
|
|
5437
|
-
function submitOrder(
|
|
5221
|
+
function submitOrder(_x38) {
|
|
5438
5222
|
return _submitOrder.apply(this, arguments);
|
|
5439
5223
|
}
|
|
5440
5224
|
return submitOrder;
|
|
@@ -5442,13 +5226,13 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5442
5226
|
}, {
|
|
5443
5227
|
key: "cancelOrder",
|
|
5444
5228
|
value: function () {
|
|
5445
|
-
var _cancelOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5229
|
+
var _cancelOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(params) {
|
|
5446
5230
|
var payload;
|
|
5447
|
-
return _regeneratorRuntime().wrap(function
|
|
5448
|
-
while (1) switch (
|
|
5231
|
+
return _regeneratorRuntime().wrap(function _callee34$(_context37) {
|
|
5232
|
+
while (1) switch (_context37.prev = _context37.next) {
|
|
5449
5233
|
case 0:
|
|
5450
5234
|
if (!(!Array.isArray(params.order_ids) || params.order_ids.length === 0)) {
|
|
5451
|
-
|
|
5235
|
+
_context37.next = 2;
|
|
5452
5236
|
break;
|
|
5453
5237
|
}
|
|
5454
5238
|
throw new Error('取消订单失败:order_ids 不能为空');
|
|
@@ -5464,16 +5248,16 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5464
5248
|
method: 'PUT',
|
|
5465
5249
|
orderIdsCount: params.order_ids.length
|
|
5466
5250
|
});
|
|
5467
|
-
return
|
|
5251
|
+
return _context37.abrupt("return", this.request.put('/order/update-status', payload, {
|
|
5468
5252
|
isShopApi: true
|
|
5469
5253
|
}));
|
|
5470
5254
|
case 5:
|
|
5471
5255
|
case "end":
|
|
5472
|
-
return
|
|
5256
|
+
return _context37.stop();
|
|
5473
5257
|
}
|
|
5474
|
-
},
|
|
5258
|
+
}, _callee34, this);
|
|
5475
5259
|
}));
|
|
5476
|
-
function cancelOrder(
|
|
5260
|
+
function cancelOrder(_x39) {
|
|
5477
5261
|
return _cancelOrder.apply(this, arguments);
|
|
5478
5262
|
}
|
|
5479
5263
|
return cancelOrder;
|
|
@@ -5481,19 +5265,19 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5481
5265
|
}, {
|
|
5482
5266
|
key: "changeBookingStatus",
|
|
5483
5267
|
value: function () {
|
|
5484
|
-
var _changeBookingStatus = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5268
|
+
var _changeBookingStatus = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35(params) {
|
|
5485
5269
|
var url, payload;
|
|
5486
|
-
return _regeneratorRuntime().wrap(function
|
|
5487
|
-
while (1) switch (
|
|
5270
|
+
return _regeneratorRuntime().wrap(function _callee35$(_context38) {
|
|
5271
|
+
while (1) switch (_context38.prev = _context38.next) {
|
|
5488
5272
|
case 0:
|
|
5489
5273
|
if (params.booking_id) {
|
|
5490
|
-
|
|
5274
|
+
_context38.next = 2;
|
|
5491
5275
|
break;
|
|
5492
5276
|
}
|
|
5493
5277
|
throw new Error('变更预约状态失败:booking_id 不能为空');
|
|
5494
5278
|
case 2:
|
|
5495
5279
|
if (params.appointment_status) {
|
|
5496
|
-
|
|
5280
|
+
_context38.next = 4;
|
|
5497
5281
|
break;
|
|
5498
5282
|
}
|
|
5499
5283
|
throw new Error('变更预约状态失败:appointment_status 不能为空');
|
|
@@ -5508,16 +5292,16 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5508
5292
|
bookingId: params.booking_id,
|
|
5509
5293
|
appointmentStatus: params.appointment_status
|
|
5510
5294
|
});
|
|
5511
|
-
return
|
|
5295
|
+
return _context38.abrupt("return", this.request.put(url, payload, {
|
|
5512
5296
|
isShopApi: true
|
|
5513
5297
|
}));
|
|
5514
5298
|
case 8:
|
|
5515
5299
|
case "end":
|
|
5516
|
-
return
|
|
5300
|
+
return _context38.stop();
|
|
5517
5301
|
}
|
|
5518
|
-
},
|
|
5302
|
+
}, _callee35, this);
|
|
5519
5303
|
}));
|
|
5520
|
-
function changeBookingStatus(
|
|
5304
|
+
function changeBookingStatus(_x40) {
|
|
5521
5305
|
return _changeBookingStatus.apply(this, arguments);
|
|
5522
5306
|
}
|
|
5523
5307
|
return changeBookingStatus;
|
|
@@ -5535,11 +5319,11 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5535
5319
|
}, {
|
|
5536
5320
|
key: "createOrderByCheckout",
|
|
5537
5321
|
value: (function () {
|
|
5538
|
-
var _createOrderByCheckout = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5322
|
+
var _createOrderByCheckout = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(params) {
|
|
5539
5323
|
var _params$payments, _params$bookings2, _params$relation_prod2, _params$payments2, _params$payments3, _params$bookings3, _params$relation_prod3, _params$payments4;
|
|
5540
5324
|
var onlineStorePaymentCodeList, _orderData$payments, _orderData$bookings, _orderData$relation_p, _orderData$payments2, _orderData$payments3, _orderData$bookings2, _orderData$relation_p2, _orderData$payments4, _orderData$payments5, _response$data, orderData, response;
|
|
5541
|
-
return _regeneratorRuntime().wrap(function
|
|
5542
|
-
while (1) switch (
|
|
5325
|
+
return _regeneratorRuntime().wrap(function _callee36$(_context39) {
|
|
5326
|
+
while (1) switch (_context39.prev = _context39.next) {
|
|
5543
5327
|
case 0:
|
|
5544
5328
|
// 过滤掉由在线店铺下单的 payment 支付数据
|
|
5545
5329
|
onlineStorePaymentCodeList = ['WXPAY', 'WECHAT', 'ALIPAY', 'APPLE_PAY', 'CREDIT_CARD_3DS', 'CREDIT_CARD_TOKEN', 'GOOGLE_PAY', 'GOOGLE_PAY_3DS', 'CREDIT_CARD'];
|
|
@@ -5573,7 +5357,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5573
5357
|
relationProductsCount: ((_params$relation_prod3 = params.relation_products) === null || _params$relation_prod3 === void 0 ? void 0 : _params$relation_prod3.length) || 0,
|
|
5574
5358
|
paymentsCount: ((_params$payments4 = params.payments) === null || _params$payments4 === void 0 ? void 0 : _params$payments4.length) || 0
|
|
5575
5359
|
});
|
|
5576
|
-
|
|
5360
|
+
_context39.prev = 4;
|
|
5577
5361
|
// 构建订单数据,设置默认值并允许 params 覆盖
|
|
5578
5362
|
orderData = _objectSpread({
|
|
5579
5363
|
sales_channel: 'my_pisel',
|
|
@@ -5635,13 +5419,13 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5635
5419
|
hasOrderId: !!orderData.order_id,
|
|
5636
5420
|
smallTicketDataFlag: orderData.small_ticket_data_flag
|
|
5637
5421
|
});
|
|
5638
|
-
|
|
5422
|
+
_context39.next = 12;
|
|
5639
5423
|
return this.request.post('/order/checkout', orderData, {
|
|
5640
5424
|
osServer: true,
|
|
5641
5425
|
customToast: function customToast() {}
|
|
5642
5426
|
});
|
|
5643
5427
|
case 12:
|
|
5644
|
-
response =
|
|
5428
|
+
response = _context39.sent;
|
|
5645
5429
|
this.logInfo('Order API called successfully', {
|
|
5646
5430
|
response: response
|
|
5647
5431
|
});
|
|
@@ -5649,22 +5433,22 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5649
5433
|
success: !!response,
|
|
5650
5434
|
hasOrderId: !!(response !== null && response !== void 0 && (_response$data = response.data) !== null && _response$data !== void 0 && _response$data.order_id || response !== null && response !== void 0 && response.order_id)
|
|
5651
5435
|
});
|
|
5652
|
-
return
|
|
5436
|
+
return _context39.abrupt("return", response);
|
|
5653
5437
|
case 18:
|
|
5654
|
-
|
|
5655
|
-
|
|
5656
|
-
console.error('[Order] createOrderByCheckout 创建订单失败:',
|
|
5438
|
+
_context39.prev = 18;
|
|
5439
|
+
_context39.t0 = _context39["catch"](4);
|
|
5440
|
+
console.error('[Order] createOrderByCheckout 创建订单失败:', _context39.t0);
|
|
5657
5441
|
this.logInfo('Order API called failed', {
|
|
5658
|
-
error:
|
|
5442
|
+
error: _context39.t0 instanceof Error ? _context39.t0.message : String(_context39.t0)
|
|
5659
5443
|
});
|
|
5660
|
-
throw
|
|
5444
|
+
throw _context39.t0;
|
|
5661
5445
|
case 23:
|
|
5662
5446
|
case "end":
|
|
5663
|
-
return
|
|
5447
|
+
return _context39.stop();
|
|
5664
5448
|
}
|
|
5665
|
-
},
|
|
5449
|
+
}, _callee36, this, [[4, 18]]);
|
|
5666
5450
|
}));
|
|
5667
|
-
function createOrderByCheckout(
|
|
5451
|
+
function createOrderByCheckout(_x41) {
|
|
5668
5452
|
return _createOrderByCheckout.apply(this, arguments);
|
|
5669
5453
|
}
|
|
5670
5454
|
return createOrderByCheckout;
|
|
@@ -5672,24 +5456,24 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5672
5456
|
}, {
|
|
5673
5457
|
key: "submitSalesOrder",
|
|
5674
5458
|
value: function () {
|
|
5675
|
-
var _submitSalesOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5459
|
+
var _submitSalesOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(params) {
|
|
5676
5460
|
var url, query, fetchUrl;
|
|
5677
|
-
return _regeneratorRuntime().wrap(function
|
|
5678
|
-
while (1) switch (
|
|
5461
|
+
return _regeneratorRuntime().wrap(function _callee37$(_context40) {
|
|
5462
|
+
while (1) switch (_context40.prev = _context40.next) {
|
|
5679
5463
|
case 0:
|
|
5680
5464
|
url = params.url, query = params.query;
|
|
5681
5465
|
fetchUrl = url || '/order/sales/checkout';
|
|
5682
|
-
return
|
|
5466
|
+
return _context40.abrupt("return", this.request.post(fetchUrl, query, {
|
|
5683
5467
|
osServer: true,
|
|
5684
5468
|
customToast: function customToast() {}
|
|
5685
5469
|
}));
|
|
5686
5470
|
case 3:
|
|
5687
5471
|
case "end":
|
|
5688
|
-
return
|
|
5472
|
+
return _context40.stop();
|
|
5689
5473
|
}
|
|
5690
|
-
},
|
|
5474
|
+
}, _callee37, this);
|
|
5691
5475
|
}));
|
|
5692
|
-
function submitSalesOrder(
|
|
5476
|
+
function submitSalesOrder(_x42) {
|
|
5693
5477
|
return _submitSalesOrder.apply(this, arguments);
|
|
5694
5478
|
}
|
|
5695
5479
|
return submitSalesOrder;
|
|
@@ -5703,37 +5487,37 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5703
5487
|
}, {
|
|
5704
5488
|
key: "sendCustomerPayLink",
|
|
5705
5489
|
value: (function () {
|
|
5706
|
-
var _sendCustomerPayLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5490
|
+
var _sendCustomerPayLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38(params) {
|
|
5707
5491
|
var _params$emails;
|
|
5708
5492
|
var orderIds;
|
|
5709
|
-
return _regeneratorRuntime().wrap(function
|
|
5710
|
-
while (1) switch (
|
|
5493
|
+
return _regeneratorRuntime().wrap(function _callee38$(_context41) {
|
|
5494
|
+
while (1) switch (_context41.prev = _context41.next) {
|
|
5711
5495
|
case 0:
|
|
5712
5496
|
orderIds = params.order_ids || params.orderIds || [];
|
|
5713
5497
|
if (orderIds.length) {
|
|
5714
|
-
|
|
5498
|
+
_context41.next = 3;
|
|
5715
5499
|
break;
|
|
5716
5500
|
}
|
|
5717
5501
|
throw new Error('发送支付链接前必须先提交本地订单并取得订单 ID');
|
|
5718
5502
|
case 3:
|
|
5719
5503
|
if ((_params$emails = params.emails) !== null && _params$emails !== void 0 && _params$emails.length) {
|
|
5720
|
-
|
|
5504
|
+
_context41.next = 5;
|
|
5721
5505
|
break;
|
|
5722
5506
|
}
|
|
5723
5507
|
throw new Error('发送支付链接需要至少一个邮箱');
|
|
5724
5508
|
case 5:
|
|
5725
|
-
return
|
|
5509
|
+
return _context41.abrupt("return", this.request.post('/order/batch-email', {
|
|
5726
5510
|
order_ids: orderIds,
|
|
5727
5511
|
notify_action: params.notify_action || 'order_payment_reminder',
|
|
5728
5512
|
emails: params.emails
|
|
5729
5513
|
}));
|
|
5730
5514
|
case 6:
|
|
5731
5515
|
case "end":
|
|
5732
|
-
return
|
|
5516
|
+
return _context41.stop();
|
|
5733
5517
|
}
|
|
5734
|
-
},
|
|
5518
|
+
}, _callee38, this);
|
|
5735
5519
|
}));
|
|
5736
|
-
function sendCustomerPayLink(
|
|
5520
|
+
function sendCustomerPayLink(_x43) {
|
|
5737
5521
|
return _sendCustomerPayLink.apply(this, arguments);
|
|
5738
5522
|
}
|
|
5739
5523
|
return sendCustomerPayLink;
|
|
@@ -5741,14 +5525,14 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5741
5525
|
}, {
|
|
5742
5526
|
key: "getSalesOrderByLookup",
|
|
5743
5527
|
value: function () {
|
|
5744
|
-
var _getSalesOrderByLookup = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5528
|
+
var _getSalesOrderByLookup = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39(params) {
|
|
5745
5529
|
var lookup, res;
|
|
5746
|
-
return _regeneratorRuntime().wrap(function
|
|
5747
|
-
while (1) switch (
|
|
5530
|
+
return _regeneratorRuntime().wrap(function _callee39$(_context42) {
|
|
5531
|
+
while (1) switch (_context42.prev = _context42.next) {
|
|
5748
5532
|
case 0:
|
|
5749
5533
|
lookup = params.lookup === undefined || params.lookup === null ? '' : String(params.lookup).trim();
|
|
5750
5534
|
if (lookup) {
|
|
5751
|
-
|
|
5535
|
+
_context42.next = 3;
|
|
5752
5536
|
break;
|
|
5753
5537
|
}
|
|
5754
5538
|
throw new Error('加载销售详情需要 lookup');
|
|
@@ -5757,7 +5541,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5757
5541
|
if (lookup.startsWith('LOCAL_')) {
|
|
5758
5542
|
params.forceRemote = false;
|
|
5759
5543
|
}
|
|
5760
|
-
|
|
5544
|
+
_context42.next = 6;
|
|
5761
5545
|
return this.request.get("/order/sales/".concat(encodeURIComponent(lookup)), _objectSpread({
|
|
5762
5546
|
with: ['products', 'bookings', 'payments', 'customer', 'summary', 'contacts_info']
|
|
5763
5547
|
}, params.forceRemote ? {
|
|
@@ -5766,18 +5550,18 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5766
5550
|
osServer: true
|
|
5767
5551
|
});
|
|
5768
5552
|
case 6:
|
|
5769
|
-
res =
|
|
5553
|
+
res = _context42.sent;
|
|
5770
5554
|
if (res.code === 200) {
|
|
5771
5555
|
this.store.lastOrderInfo = res.data;
|
|
5772
5556
|
}
|
|
5773
|
-
return
|
|
5557
|
+
return _context42.abrupt("return", res);
|
|
5774
5558
|
case 9:
|
|
5775
5559
|
case "end":
|
|
5776
|
-
return
|
|
5560
|
+
return _context42.stop();
|
|
5777
5561
|
}
|
|
5778
|
-
},
|
|
5562
|
+
}, _callee39, this);
|
|
5779
5563
|
}));
|
|
5780
|
-
function getSalesOrderByLookup(
|
|
5564
|
+
function getSalesOrderByLookup(_x44) {
|
|
5781
5565
|
return _getSalesOrderByLookup.apply(this, arguments);
|
|
5782
5566
|
}
|
|
5783
5567
|
return getSalesOrderByLookup;
|
|
@@ -5791,11 +5575,11 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5791
5575
|
}, {
|
|
5792
5576
|
key: "hydrateTempOrderFromRecord",
|
|
5793
5577
|
value: (function () {
|
|
5794
|
-
var _hydrateTempOrderFromRecord = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5578
|
+
var _hydrateTempOrderFromRecord = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40(record, options) {
|
|
5795
5579
|
var _this$store$discount19;
|
|
5796
|
-
var sourceRaw, identityReadySource, normalizedCollections, raw, hasIdentityChanges, identityLogMetadata, hasIdentityWarnings, nextTempOrder,
|
|
5797
|
-
return _regeneratorRuntime().wrap(function
|
|
5798
|
-
while (1) switch (
|
|
5580
|
+
var sourceRaw, identityReadySource, normalizedCollections, raw, hasIdentityChanges, identityLogMetadata, hasIdentityWarnings, nextTempOrder, rawSummary, summarySurcharges, hydratedEditDiscounts, currentDiscounts, currentScanDiscounts, hydratedDiscountIds, retainedScanDiscounts, nextDiscounts, shouldSkipEmptyDiscountSync, _this$store$discount20, _this$store$discount21;
|
|
5581
|
+
return _regeneratorRuntime().wrap(function _callee40$(_context43) {
|
|
5582
|
+
while (1) switch (_context43.prev = _context43.next) {
|
|
5799
5583
|
case 0:
|
|
5800
5584
|
sourceRaw = record && _typeof(record) === 'object' && record.data && record.order_id == null ? record.data : record || {};
|
|
5801
5585
|
identityReadySource = this.seedAnonymousBookingUidsFromProducts(sourceRaw);
|
|
@@ -5820,13 +5604,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5820
5604
|
}
|
|
5821
5605
|
nextTempOrder = this.normalizeTempOrderForRuntime(raw, {
|
|
5822
5606
|
makeEditMark: true
|
|
5823
|
-
});
|
|
5824
|
-
sourceLastOrderInfo = raw.lastOrderInfo || raw;
|
|
5825
|
-
isDraftOrder = Number(nextTempOrder.is_draft_order || 0) === 1;
|
|
5826
|
-
syntheticIdentityOptions = {
|
|
5827
|
-
isDraftOrder: isDraftOrder,
|
|
5828
|
-
externalSaleNumber: nextTempOrder.external_sale_number
|
|
5829
|
-
};
|
|
5607
|
+
});
|
|
5830
5608
|
rawSummary = raw.summary && _typeof(raw.summary) === 'object' ? raw.summary : {};
|
|
5831
5609
|
summarySurcharges = Array.isArray(rawSummary.surcharges) ? rawSummary.surcharges.map(function (s) {
|
|
5832
5610
|
return _objectSpread({}, s || {});
|
|
@@ -5846,11 +5624,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5846
5624
|
productFingerprint: this.buildOrderProductsFingerprint(nextTempOrder.products || [])
|
|
5847
5625
|
}
|
|
5848
5626
|
});
|
|
5849
|
-
|
|
5850
|
-
|
|
5851
|
-
|
|
5852
|
-
|
|
5853
|
-
}
|
|
5627
|
+
// lastOrderInfo carries the exact backend snapshot used by deposit/type recovery.
|
|
5628
|
+
// Runtime collection repair lives in tempOrder/originalSalesSnapshot and must not
|
|
5629
|
+
// rewrite this protocol snapshot as a side effect of hydration.
|
|
5630
|
+
this.store.lastOrderInfo = sourceRaw.lastOrderInfo || sourceRaw;
|
|
5854
5631
|
hydratedEditDiscounts = this.collectHydratedEditDiscounts(nextTempOrder.products);
|
|
5855
5632
|
currentDiscounts = typeof ((_this$store$discount19 = this.store.discount) === null || _this$store$discount19 === void 0 ? void 0 : _this$store$discount19.getDiscountList) === 'function' ? this.store.discount.getDiscountList() || [] : [];
|
|
5856
5633
|
currentScanDiscounts = currentDiscounts.filter(function (discount) {
|
|
@@ -5865,34 +5642,34 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5865
5642
|
nextDiscounts = [].concat(_toConsumableArray(hydratedEditDiscounts), _toConsumableArray(retainedScanDiscounts));
|
|
5866
5643
|
shouldSkipEmptyDiscountSync = nextDiscounts.length === 0 && currentDiscounts.length === 0;
|
|
5867
5644
|
if (shouldSkipEmptyDiscountSync) {
|
|
5868
|
-
|
|
5645
|
+
_context43.next = 26;
|
|
5869
5646
|
break;
|
|
5870
5647
|
}
|
|
5871
5648
|
OrderModule.populateSavedAmounts(nextTempOrder.products, nextDiscounts);
|
|
5872
|
-
|
|
5649
|
+
_context43.next = 24;
|
|
5873
5650
|
return (_this$store$discount20 = this.store.discount) === null || _this$store$discount20 === void 0 ? void 0 : _this$store$discount20.setOriginalDiscountList(nextDiscounts);
|
|
5874
|
-
case
|
|
5875
|
-
|
|
5651
|
+
case 24:
|
|
5652
|
+
_context43.next = 26;
|
|
5876
5653
|
return (_this$store$discount21 = this.store.discount) === null || _this$store$discount21 === void 0 ? void 0 : _this$store$discount21.setDiscountList(nextDiscounts);
|
|
5877
|
-
case
|
|
5654
|
+
case 26:
|
|
5878
5655
|
if (!(options !== null && options !== void 0 && options.recalcOnHydrate)) {
|
|
5879
|
-
|
|
5656
|
+
_context43.next = 29;
|
|
5880
5657
|
break;
|
|
5881
5658
|
}
|
|
5882
|
-
|
|
5659
|
+
_context43.next = 29;
|
|
5883
5660
|
return this.recalculateSummary({
|
|
5884
5661
|
createIfMissing: false
|
|
5885
5662
|
});
|
|
5886
|
-
case
|
|
5663
|
+
case 29:
|
|
5887
5664
|
this.persistTempOrder();
|
|
5888
|
-
return
|
|
5889
|
-
case
|
|
5665
|
+
return _context43.abrupt("return", nextTempOrder);
|
|
5666
|
+
case 31:
|
|
5890
5667
|
case "end":
|
|
5891
|
-
return
|
|
5668
|
+
return _context43.stop();
|
|
5892
5669
|
}
|
|
5893
|
-
},
|
|
5670
|
+
}, _callee40, this);
|
|
5894
5671
|
}));
|
|
5895
|
-
function hydrateTempOrderFromRecord(
|
|
5672
|
+
function hydrateTempOrderFromRecord(_x45, _x46) {
|
|
5896
5673
|
return _hydrateTempOrderFromRecord.apply(this, arguments);
|
|
5897
5674
|
}
|
|
5898
5675
|
return hydrateTempOrderFromRecord;
|
|
@@ -6006,12 +5783,11 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
6006
5783
|
}, {
|
|
6007
5784
|
key: "normalizeTempOrderForRuntime",
|
|
6008
5785
|
value: function normalizeTempOrderForRuntime(raw, options) {
|
|
6009
|
-
var
|
|
6010
|
-
var
|
|
6011
|
-
var nextTempOrder = _objectSpread(_objectSpread({}, this.createDefaultTempOrderInstance()), runtimeRaw || {});
|
|
5786
|
+
var _this29 = this;
|
|
5787
|
+
var nextTempOrder = _objectSpread(_objectSpread({}, this.createDefaultTempOrderInstance()), raw || {});
|
|
6012
5788
|
// ES 列表详情使用 id 表示订单主键;OS 详情态统一依赖 order_id 驱动操作按钮。
|
|
6013
|
-
if ((nextTempOrder.order_id === undefined || nextTempOrder.order_id === null) && (
|
|
6014
|
-
nextTempOrder.order_id =
|
|
5789
|
+
if ((nextTempOrder.order_id === undefined || nextTempOrder.order_id === null) && (raw === null || raw === void 0 ? void 0 : raw.id) !== undefined && (raw === null || raw === void 0 ? void 0 : raw.id) !== null) {
|
|
5790
|
+
nextTempOrder.order_id = raw.id;
|
|
6015
5791
|
}
|
|
6016
5792
|
delete nextTempOrder.summary;
|
|
6017
5793
|
delete nextTempOrder.lastOrderInfo;
|
|
@@ -6030,12 +5806,12 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
6030
5806
|
nextTempOrder.holder = raw.holder && _typeof(raw.holder) === 'object' ? _objectSpread({}, raw.holder) : null;
|
|
6031
5807
|
var rawProducts = Array.isArray(raw.products) ? raw.products : [];
|
|
6032
5808
|
nextTempOrder.products = rawProducts.length > 0 ? rawProducts.map(function (p) {
|
|
6033
|
-
return
|
|
5809
|
+
return _this29.normalizeHydratedOrderProduct(p, {
|
|
6034
5810
|
makeEditMark: options === null || options === void 0 ? void 0 : options.makeEditMark
|
|
6035
5811
|
});
|
|
6036
5812
|
}) : [];
|
|
6037
5813
|
nextTempOrder.bookings = Array.isArray(raw.bookings) ? raw.bookings.map(function (b) {
|
|
6038
|
-
var booking =
|
|
5814
|
+
var booking = _this29.normalizeHydratedBookingHolder(b || {});
|
|
6039
5815
|
return _objectSpread(_objectSpread({}, booking), {}, {
|
|
6040
5816
|
is_all: normalizeBookingIsAll(booking),
|
|
6041
5817
|
sub_type: normalizeBookingSubType(booking)
|
|
@@ -6101,23 +5877,6 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
6101
5877
|
nextTempOrder.vouchers = raw.vouchers || [];
|
|
6102
5878
|
return nextTempOrder;
|
|
6103
5879
|
}
|
|
6104
|
-
}, {
|
|
6105
|
-
key: "isSyntheticDraftOrderIdForRuntime",
|
|
6106
|
-
value: function isSyntheticDraftOrderIdForRuntime(record, options) {
|
|
6107
|
-
var _options$isDraftOrder, _record$external_sale;
|
|
6108
|
-
var isDraftOrder = (_options$isDraftOrder = options === null || options === void 0 ? void 0 : options.isDraftOrder) !== null && _options$isDraftOrder !== void 0 ? _options$isDraftOrder : Number((record === null || record === void 0 ? void 0 : record.is_draft_order) || 0) === 1;
|
|
6109
|
-
var externalSaleNumber = (_record$external_sale = record === null || record === void 0 ? void 0 : record.external_sale_number) !== null && _record$external_sale !== void 0 ? _record$external_sale : options === null || options === void 0 ? void 0 : options.externalSaleNumber;
|
|
6110
|
-
var orderId = record === null || record === void 0 ? void 0 : record.order_id;
|
|
6111
|
-
return Boolean(isDraftOrder && orderId !== undefined && orderId !== null && orderId !== '' && externalSaleNumber !== undefined && externalSaleNumber !== null && externalSaleNumber !== '' && String(orderId) === String(externalSaleNumber));
|
|
6112
|
-
}
|
|
6113
|
-
}, {
|
|
6114
|
-
key: "withoutSyntheticDraftOrderIdForRuntime",
|
|
6115
|
-
value: function withoutSyntheticDraftOrderIdForRuntime(record, options) {
|
|
6116
|
-
if (!this.isSyntheticDraftOrderIdForRuntime(record, options)) return record;
|
|
6117
|
-
return _objectSpread(_objectSpread({}, record), {}, {
|
|
6118
|
-
order_id: null
|
|
6119
|
-
});
|
|
6120
|
-
}
|
|
6121
5880
|
}, {
|
|
6122
5881
|
key: "hydrateLinkedBookingIdentity",
|
|
6123
5882
|
value: function hydrateLinkedBookingIdentity(tempOrder) {
|
|
@@ -6222,7 +5981,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
6222
5981
|
}, {
|
|
6223
5982
|
key: "normalizeHydratedOrderProduct",
|
|
6224
5983
|
value: function normalizeHydratedOrderProduct(product, options) {
|
|
6225
|
-
var
|
|
5984
|
+
var _this30 = this;
|
|
6226
5985
|
var row = _objectSpread({}, product || {});
|
|
6227
5986
|
if (row.num === undefined && row.product_quantity !== undefined) {
|
|
6228
5987
|
row.num = row.product_quantity;
|
|
@@ -6230,7 +5989,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
6230
5989
|
var productSku = ensureProductSku(row);
|
|
6231
5990
|
row.product_sku = _objectSpread(_objectSpread({}, productSku), {}, {
|
|
6232
5991
|
option: normalizeProductSkuOptions(productSku.option.map(function (optionItem) {
|
|
6233
|
-
return
|
|
5992
|
+
return _this30.normalizeHydratedProductOptionItem(optionItem || {});
|
|
6234
5993
|
}))
|
|
6235
5994
|
});
|
|
6236
5995
|
delete row["product_".concat('option', "_item")];
|
|
@@ -6267,27 +6026,27 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
6267
6026
|
}, {
|
|
6268
6027
|
key: "getOrderInfo",
|
|
6269
6028
|
value: function () {
|
|
6270
|
-
var _getOrderInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
6029
|
+
var _getOrderInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41(order_id) {
|
|
6271
6030
|
var res;
|
|
6272
|
-
return _regeneratorRuntime().wrap(function
|
|
6273
|
-
while (1) switch (
|
|
6031
|
+
return _regeneratorRuntime().wrap(function _callee41$(_context44) {
|
|
6032
|
+
while (1) switch (_context44.prev = _context44.next) {
|
|
6274
6033
|
case 0:
|
|
6275
|
-
|
|
6034
|
+
_context44.next = 2;
|
|
6276
6035
|
return this.request.get("/order/sales/".concat(order_id), {
|
|
6277
6036
|
with: ['products', 'bookings']
|
|
6278
6037
|
}, {
|
|
6279
6038
|
osServer: true
|
|
6280
6039
|
});
|
|
6281
6040
|
case 2:
|
|
6282
|
-
res =
|
|
6283
|
-
return
|
|
6041
|
+
res = _context44.sent;
|
|
6042
|
+
return _context44.abrupt("return", res);
|
|
6284
6043
|
case 4:
|
|
6285
6044
|
case "end":
|
|
6286
|
-
return
|
|
6045
|
+
return _context44.stop();
|
|
6287
6046
|
}
|
|
6288
|
-
},
|
|
6047
|
+
}, _callee41, this);
|
|
6289
6048
|
}));
|
|
6290
|
-
function getOrderInfo(
|
|
6049
|
+
function getOrderInfo(_x47) {
|
|
6291
6050
|
return _getOrderInfo.apply(this, arguments);
|
|
6292
6051
|
}
|
|
6293
6052
|
return getOrderInfo;
|