@pisell/pisellos 2.3.43 → 2.3.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/modules/Discount/index.d.ts +0 -1
- package/dist/modules/Discount/index.js +11 -40
- package/dist/modules/Discount/types.d.ts +0 -1
- package/dist/modules/OpenData/index.js +2 -2
- package/dist/modules/Order/index.d.ts +2 -3
- package/dist/modules/Order/index.js +98 -82
- package/dist/modules/Order/types.d.ts +2 -9
- package/dist/modules/Order/utils.d.ts +0 -10
- package/dist/modules/Order/utils.js +3 -35
- package/dist/modules/Payment/walletpass.d.ts +10 -3
- package/dist/modules/Payment/walletpass.js +425 -282
- package/dist/modules/Product/types.d.ts +0 -1
- package/dist/modules/ProductList/index.js +14 -33
- package/dist/modules/Quotation/index.d.ts +1 -1
- package/dist/modules/Quotation/index.js +2 -2
- package/dist/modules/Rules/index.d.ts +2 -0
- package/dist/modules/Rules/index.js +72 -102
- package/dist/modules/SalesSummary/index.js +13 -12
- package/dist/modules/ScanOrderLogger/index.d.ts +0 -2
- package/dist/modules/ScanOrderLogger/index.js +2 -15
- package/dist/modules/ScanOrderLogger/providers/feishu.js +27 -45
- package/dist/modules/ScanOrderLogger/types.d.ts +0 -1
- package/dist/modules/Schedule/index.d.ts +1 -3
- package/dist/modules/Schedule/index.js +16 -21
- package/dist/modules/Summary/utils.js +13 -38
- package/dist/modules/index.d.ts +0 -2
- package/dist/modules/index.js +1 -3
- package/dist/plugins/window.d.ts +0 -1
- package/dist/server/index.d.ts +0 -14
- package/dist/server/index.js +657 -772
- package/dist/solution/BaseSales/index.d.ts +0 -7
- package/dist/solution/BaseSales/index.js +48 -67
- package/dist/solution/BaseSales/types.d.ts +3 -1
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +6 -3
- package/dist/solution/BookingByStep/index.d.ts +1 -16
- package/dist/solution/BookingByStep/index.js +215 -294
- package/dist/solution/BookingByStep/types.d.ts +1 -2
- package/dist/solution/BookingByStep/types.js +1 -3
- package/dist/solution/BookingByStep/utils/capacity.js +1 -17
- package/dist/solution/BookingByStep/utils/timeslots.d.ts +1 -3
- package/dist/solution/BookingByStep/utils/timeslots.js +12 -19
- package/dist/solution/BookingTicket/index.d.ts +1 -13
- package/dist/solution/BookingTicket/index.js +8 -5
- package/dist/solution/BookingTicket/types.d.ts +1 -0
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +3 -3
- package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts +1 -3
- package/dist/solution/BookingTicket/utils/scan/handleScan.js +2 -10
- package/dist/solution/ScanOrder/index.d.ts +14 -26
- package/dist/solution/ScanOrder/index.js +739 -1142
- package/dist/solution/ScanOrder/types.d.ts +1 -21
- package/dist/solution/ScanOrder/utils.d.ts +0 -8
- package/dist/solution/ScanOrder/utils.js +25 -66
- package/dist/solution/ShopDiscount/index.d.ts +0 -1
- package/dist/solution/ShopDiscount/index.js +87 -125
- package/dist/solution/VenueBooking/index.d.ts +12 -39
- package/dist/solution/VenueBooking/index.js +841 -1167
- package/dist/solution/VenueBooking/types.d.ts +0 -3
- package/dist/solution/VenueBooking/utils/resource.js +0 -1
- package/dist/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
- package/dist/solution/VenueBooking/utils/slotMerge.js +5 -10
- package/dist/solution/index.d.ts +0 -1
- package/dist/solution/index.js +1 -2
- package/dist/types/index.d.ts +0 -1
- package/lib/model/strategy/adapter/promotion/index.js +51 -0
- package/lib/modules/Discount/index.d.ts +0 -1
- package/lib/modules/Discount/index.js +0 -9
- package/lib/modules/Discount/types.d.ts +0 -1
- package/lib/modules/OpenData/index.js +1 -1
- package/lib/modules/Order/index.d.ts +2 -3
- package/lib/modules/Order/index.js +56 -33
- package/lib/modules/Order/types.d.ts +2 -9
- package/lib/modules/Order/utils.d.ts +0 -10
- package/lib/modules/Order/utils.js +5 -36
- package/lib/modules/Payment/walletpass.d.ts +10 -3
- package/lib/modules/Payment/walletpass.js +218 -56
- package/lib/modules/Product/types.d.ts +0 -1
- package/lib/modules/ProductList/index.js +31 -40
- package/lib/modules/Quotation/index.d.ts +1 -1
- package/lib/modules/Quotation/index.js +2 -2
- package/lib/modules/Rules/index.d.ts +2 -0
- package/lib/modules/Rules/index.js +24 -36
- package/lib/modules/SalesSummary/index.js +7 -6
- package/lib/modules/ScanOrderLogger/index.d.ts +0 -2
- package/lib/modules/ScanOrderLogger/index.js +1 -13
- package/lib/modules/ScanOrderLogger/providers/feishu.js +6 -15
- package/lib/modules/ScanOrderLogger/types.d.ts +0 -1
- package/lib/modules/Schedule/index.d.ts +1 -3
- package/lib/modules/Schedule/index.js +8 -10
- package/lib/modules/Summary/utils.js +1 -21
- package/lib/modules/index.d.ts +0 -2
- package/lib/modules/index.js +1 -5
- package/lib/plugins/window.d.ts +0 -1
- package/lib/server/index.d.ts +0 -14
- package/lib/server/index.js +5 -65
- package/lib/solution/BaseSales/index.d.ts +0 -7
- package/lib/solution/BaseSales/index.js +9 -24
- package/lib/solution/BaseSales/types.d.ts +3 -1
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +3 -2
- package/lib/solution/BookingByStep/index.d.ts +1 -16
- package/lib/solution/BookingByStep/index.js +18 -60
- package/lib/solution/BookingByStep/types.d.ts +1 -2
- package/lib/solution/BookingByStep/types.js +0 -5
- package/lib/solution/BookingByStep/utils/capacity.js +1 -20
- package/lib/solution/BookingByStep/utils/timeslots.d.ts +1 -3
- package/lib/solution/BookingByStep/utils/timeslots.js +11 -19
- package/lib/solution/BookingTicket/index.d.ts +1 -13
- package/lib/solution/BookingTicket/index.js +3 -10
- package/lib/solution/BookingTicket/types.d.ts +1 -0
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +2 -2
- package/lib/solution/BookingTicket/utils/scan/handleScan.d.ts +1 -3
- package/lib/solution/BookingTicket/utils/scan/handleScan.js +2 -2
- package/lib/solution/ScanOrder/index.d.ts +14 -26
- package/lib/solution/ScanOrder/index.js +182 -449
- package/lib/solution/ScanOrder/types.d.ts +1 -21
- package/lib/solution/ScanOrder/utils.d.ts +0 -8
- package/lib/solution/ScanOrder/utils.js +0 -31
- package/lib/solution/ShopDiscount/index.d.ts +0 -1
- package/lib/solution/ShopDiscount/index.js +0 -14
- package/lib/solution/VenueBooking/index.d.ts +12 -39
- package/lib/solution/VenueBooking/index.js +110 -322
- package/lib/solution/VenueBooking/types.d.ts +0 -3
- package/lib/solution/VenueBooking/utils/resource.js +0 -1
- package/lib/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
- package/lib/solution/VenueBooking/utils/slotMerge.js +4 -6
- package/lib/solution/index.d.ts +0 -1
- package/lib/solution/index.js +1 -3
- package/lib/types/index.d.ts +0 -1
- package/package.json +1 -1
- package/dist/modules/Holder/index.d.ts +0 -48
- package/dist/modules/Holder/index.js +0 -640
- package/dist/modules/Holder/types.d.ts +0 -123
- package/dist/modules/Holder/types.js +0 -1
- package/dist/modules/Holder/utils.d.ts +0 -13
- package/dist/modules/Holder/utils.js +0 -34
- package/dist/modules/ResourcePlanner/index.d.ts +0 -24
- package/dist/modules/ResourcePlanner/index.js +0 -181
- package/dist/modules/ResourcePlanner/planner.d.ts +0 -14
- package/dist/modules/ResourcePlanner/planner.js +0 -1069
- package/dist/modules/ResourcePlanner/types.d.ts +0 -227
- package/dist/modules/ResourcePlanner/types.js +0 -1
- package/dist/solution/UnifiedBookingSales/index.d.ts +0 -183
- package/dist/solution/UnifiedBookingSales/index.js +0 -1891
- package/dist/solution/UnifiedBookingSales/types.d.ts +0 -143
- package/dist/solution/UnifiedBookingSales/types.js +0 -11
- package/lib/modules/Holder/index.d.ts +0 -48
- package/lib/modules/Holder/index.js +0 -402
- package/lib/modules/Holder/types.d.ts +0 -123
- package/lib/modules/Holder/types.js +0 -17
- package/lib/modules/Holder/utils.d.ts +0 -13
- package/lib/modules/Holder/utils.js +0 -71
- package/lib/modules/ResourcePlanner/index.d.ts +0 -24
- package/lib/modules/ResourcePlanner/index.js +0 -148
- package/lib/modules/ResourcePlanner/planner.d.ts +0 -14
- package/lib/modules/ResourcePlanner/planner.js +0 -933
- package/lib/modules/ResourcePlanner/types.d.ts +0 -227
- package/lib/modules/ResourcePlanner/types.js +0 -17
- package/lib/solution/UnifiedBookingSales/index.d.ts +0 -183
- package/lib/solution/UnifiedBookingSales/index.js +0 -1084
- package/lib/solution/UnifiedBookingSales/types.d.ts +0 -143
- package/lib/solution/UnifiedBookingSales/types.js +0 -33
|
@@ -32,7 +32,6 @@ export declare class DiscountModule extends BaseModule implements Module, Discou
|
|
|
32
32
|
customerId?: number;
|
|
33
33
|
orderId?: number;
|
|
34
34
|
}): Promise<DiscountWithReason>;
|
|
35
|
-
batchSearchByProductIds(productIds: number[]): Promise<any>;
|
|
36
35
|
filterEnabledDiscountList(discountList: Discount[]): Discount[];
|
|
37
36
|
private checkUsageCreditsLimit;
|
|
38
37
|
filterEnabledDiscountListWithReason(discountList: Discount[]): DiscountWithReason;
|
|
@@ -244,35 +244,6 @@ export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
244
244
|
}
|
|
245
245
|
return batchSearch;
|
|
246
246
|
}()
|
|
247
|
-
}, {
|
|
248
|
-
key: "batchSearchByProductIds",
|
|
249
|
-
value: function () {
|
|
250
|
-
var _batchSearchByProductIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(productIds) {
|
|
251
|
-
var result;
|
|
252
|
-
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
253
|
-
while (1) switch (_context6.prev = _context6.next) {
|
|
254
|
-
case 0:
|
|
255
|
-
_context6.next = 2;
|
|
256
|
-
return this.request.get("/machinecode/batch-search", {
|
|
257
|
-
ids: productIds,
|
|
258
|
-
translate_flag: 1,
|
|
259
|
-
tags: ['good_pass', 'product_discount_card'],
|
|
260
|
-
relation_product: 1
|
|
261
|
-
});
|
|
262
|
-
case 2:
|
|
263
|
-
result = _context6.sent;
|
|
264
|
-
return _context6.abrupt("return", (result === null || result === void 0 ? void 0 : result.data) || []);
|
|
265
|
-
case 4:
|
|
266
|
-
case "end":
|
|
267
|
-
return _context6.stop();
|
|
268
|
-
}
|
|
269
|
-
}, _callee6, this);
|
|
270
|
-
}));
|
|
271
|
-
function batchSearchByProductIds(_x8) {
|
|
272
|
-
return _batchSearchByProductIds.apply(this, arguments);
|
|
273
|
-
}
|
|
274
|
-
return batchSearchByProductIds;
|
|
275
|
-
}()
|
|
276
247
|
}, {
|
|
277
248
|
key: "filterEnabledDiscountList",
|
|
278
249
|
value: function filterEnabledDiscountList(discountList) {
|
|
@@ -459,22 +430,22 @@ export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
459
430
|
}, {
|
|
460
431
|
key: "destroy",
|
|
461
432
|
value: function () {
|
|
462
|
-
var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
463
|
-
return _regeneratorRuntime().wrap(function
|
|
464
|
-
while (1) switch (
|
|
433
|
+
var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
434
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
435
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
465
436
|
case 0:
|
|
466
437
|
this.store.discountList = [];
|
|
467
438
|
this.core.effects.offByModuleDestroy(this.name);
|
|
468
|
-
|
|
439
|
+
_context6.next = 4;
|
|
469
440
|
return this.core.effects.emit("".concat(this.name, ":onDestroy"), {});
|
|
470
441
|
case 4:
|
|
471
442
|
console.log('[Discount] 已销毁');
|
|
472
443
|
_get(_getPrototypeOf(DiscountModule.prototype), "destroy", this).call(this);
|
|
473
444
|
case 6:
|
|
474
445
|
case "end":
|
|
475
|
-
return
|
|
446
|
+
return _context6.stop();
|
|
476
447
|
}
|
|
477
|
-
},
|
|
448
|
+
}, _callee6, this);
|
|
478
449
|
}));
|
|
479
450
|
function destroy() {
|
|
480
451
|
return _destroy.apply(this, arguments);
|
|
@@ -484,18 +455,18 @@ export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
484
455
|
}, {
|
|
485
456
|
key: "clear",
|
|
486
457
|
value: function () {
|
|
487
|
-
var _clear = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
488
|
-
return _regeneratorRuntime().wrap(function
|
|
489
|
-
while (1) switch (
|
|
458
|
+
var _clear = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
|
459
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
460
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
490
461
|
case 0:
|
|
491
462
|
this.store.discountList = [];
|
|
492
463
|
this.store.originalDiscountList = [];
|
|
493
464
|
console.log('[Discount] clear');
|
|
494
465
|
case 3:
|
|
495
466
|
case "end":
|
|
496
|
-
return
|
|
467
|
+
return _context7.stop();
|
|
497
468
|
}
|
|
498
|
-
},
|
|
469
|
+
}, _callee7, this);
|
|
499
470
|
}));
|
|
500
471
|
function clear() {
|
|
501
472
|
return _clear.apply(this, arguments);
|
|
@@ -105,12 +105,12 @@ export var OpenDataModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
105
105
|
key: "fetchOpenData",
|
|
106
106
|
value: function () {
|
|
107
107
|
var _fetchOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(params) {
|
|
108
|
-
var _this$appPlugin, _this$appPlugin
|
|
108
|
+
var _this$appPlugin$getDa, _this$appPlugin;
|
|
109
109
|
var getData, shopId, tenantId, headers, response, data;
|
|
110
110
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
111
111
|
while (1) switch (_context2.prev = _context2.next) {
|
|
112
112
|
case 0:
|
|
113
|
-
getData = (_this$appPlugin =
|
|
113
|
+
getData = (_this$appPlugin$getDa = (_this$appPlugin = this.appPlugin).getData) === null || _this$appPlugin$getDa === void 0 ? void 0 : _this$appPlugin$getDa.call(_this$appPlugin);
|
|
114
114
|
shopId = getData === null || getData === void 0 ? void 0 : getData('shop_id');
|
|
115
115
|
if (shopId) {
|
|
116
116
|
_context2.next = 4;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Module, PisellCore, ModuleOptions } from '../../types';
|
|
2
2
|
import { BaseModule } from '../BaseModule';
|
|
3
|
-
import { OrderModuleAPI, CommitOrderParams, UpdateOrderBookingParams, UpdateOrderProductParams, UpdateOrderProductQuantityParams, CancelOrderParams, ChangeBookingStatusParams
|
|
3
|
+
import { OrderModuleAPI, CommitOrderParams, UpdateOrderBookingParams, UpdateOrderProductParams, UpdateOrderProductQuantityParams, CheckoutOrderParams, CancelOrderParams, ChangeBookingStatusParams } from './types';
|
|
4
4
|
import { CartItem } from '../Cart/types';
|
|
5
5
|
import { type SubmitPayloadEnhancer } from './utils';
|
|
6
6
|
import type { OrderAmountSnapshot, AddProductBookingInput, OrderIdentitySnapshot, OrderPaymentSource, OrderSnapshot, OrderSyncState, SyncPaymentsToOrderParams, SyncPaymentsToOrderResult, SubmitSalesOrderParams, OrderProduct, OrderProductIdentity, OrderSummary, OrderTempOrder, OrderPaymentData, OrderPaymentUpdateOptions, OrderPaymentUpdateResult, SendCustomerPayLinkParams, UpdateTempOrderCustomerInput, OrderCustomerPatch, OrderCustomerView, ReplaceTempOrderOptions, OrderPromotionEvaluator, OrderGiftSelectResolver, OrderUnfulfilledPromotion, OrderLastGiftActions } from './types';
|
|
@@ -81,6 +81,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
81
81
|
private ensureEditDiscountConfigForProductChange;
|
|
82
82
|
scanCode(code: string, customerId?: number): Promise<{
|
|
83
83
|
isAvailable: boolean;
|
|
84
|
+
isAccepted?: boolean;
|
|
84
85
|
discountList: Discount[];
|
|
85
86
|
type: 'server' | 'clientCalc';
|
|
86
87
|
unavailableReason?: UnavailableReason;
|
|
@@ -146,7 +147,6 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
146
147
|
isTempOrderPersistEnabled(): boolean;
|
|
147
148
|
/** @deprecated OrderModule 不再负责 tempOrder localStorage 持久化;草稿保存请使用 IndexedDB saveDraft。 */
|
|
148
149
|
persistTempOrder(): void;
|
|
149
|
-
notifyTempOrderChanged(): void;
|
|
150
150
|
private createDefaultTempOrderInstance;
|
|
151
151
|
private createExternalSaleNumber;
|
|
152
152
|
private ensureExternalSaleNumber;
|
|
@@ -496,7 +496,6 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
496
496
|
is_deposit: number;
|
|
497
497
|
relation_products: any[];
|
|
498
498
|
relation_forms: any[];
|
|
499
|
-
business_code: string | undefined;
|
|
500
499
|
};
|
|
501
500
|
checkBeforeSubmitOrder(params: {
|
|
502
501
|
cartItems: CartItem[];
|
|
@@ -10,8 +10,6 @@ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableTo
|
|
|
10
10
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
11
11
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
12
12
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
13
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
14
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
15
13
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
16
14
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
17
15
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
@@ -27,12 +25,14 @@ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) ===
|
|
|
27
25
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
28
26
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
29
27
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
28
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
29
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
30
30
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
31
31
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
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,
|
|
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";
|
|
36
36
|
import { isNormalProduct } from "../Product/utils";
|
|
37
37
|
import dayjs from 'dayjs';
|
|
38
38
|
import { ensureOrderPaymentNumber, mergeOrderPaymentRecord, resolveOrderPaymentIdentity } from "./payment-utils";
|
|
@@ -70,6 +70,22 @@ function isManualProductDiscountProduct(product) {
|
|
|
70
70
|
}
|
|
71
71
|
var ORDER_PAYMENT_STATUS_PAID = 'paid';
|
|
72
72
|
var ORDER_PAYMENT_STATUS_PENDING = 'payment_pending';
|
|
73
|
+
var CUSTOMER_PROMOTION_DISCOUNT_TAGS = new Set(['good_pass', 'product_discount_card', 'discount_card']);
|
|
74
|
+
function isCustomerPromotionDiscount(discount) {
|
|
75
|
+
return CUSTOMER_PROMOTION_DISCOUNT_TAGS.has(String((discount === null || discount === void 0 ? void 0 : discount.tag) || (discount === null || discount === void 0 ? void 0 : discount.type) || '').toLowerCase());
|
|
76
|
+
}
|
|
77
|
+
function markScannedDiscounts(discountList, scannedDiscountList) {
|
|
78
|
+
var scannedIds = new Set(scannedDiscountList.map(function (discount) {
|
|
79
|
+
return discount === null || discount === void 0 ? void 0 : discount.id;
|
|
80
|
+
}).filter(function (id) {
|
|
81
|
+
return id !== undefined && id !== null;
|
|
82
|
+
}).map(String));
|
|
83
|
+
return discountList.map(function (discount) {
|
|
84
|
+
return scannedIds.has(String(discount === null || discount === void 0 ? void 0 : discount.id)) ? _objectSpread(_objectSpread({}, discount), {}, {
|
|
85
|
+
isScan: true
|
|
86
|
+
}) : discount;
|
|
87
|
+
});
|
|
88
|
+
}
|
|
73
89
|
function isVoucherPaymentRecord(payment) {
|
|
74
90
|
return (payment === null || payment === void 0 ? void 0 : payment.voucher_id) !== undefined && Number(payment.voucher_id) !== 0;
|
|
75
91
|
}
|
|
@@ -147,6 +163,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
147
163
|
var item = _step2.value;
|
|
148
164
|
var type = (_item$type2 = item === null || item === void 0 ? void 0 : item.type) !== null && _item$type2 !== void 0 ? _item$type2 : item === null || item === void 0 ? void 0 : item.tag;
|
|
149
165
|
if (!type || type === 'product') continue;
|
|
166
|
+
var isDiscountCard = type === 'discount_card' || type === 'product_discount_card';
|
|
150
167
|
var resourceId = (_ref = (_ref2 = (_item$discount$resour = item === null || item === void 0 || (_item$discount = item.discount) === null || _item$discount === void 0 ? void 0 : _item$discount.resource_id) !== null && _item$discount$resour !== void 0 ? _item$discount$resour : item === null || item === void 0 ? void 0 : item.resource_id) !== null && _ref2 !== void 0 ? _ref2 : item === null || item === void 0 ? void 0 : item.discount_id) !== null && _ref !== void 0 ? _ref : item === null || item === void 0 ? void 0 : item.order_discount_id;
|
|
151
168
|
if (resourceId === undefined || resourceId === null || resourceId === '') continue;
|
|
152
169
|
var id = Number(resourceId);
|
|
@@ -169,7 +186,9 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
169
186
|
var _existed$limited_rela;
|
|
170
187
|
existed.amount = Number(existed.amount || 0) + amount;
|
|
171
188
|
existed.used_par_value = String(Number(existed.used_par_value || 0) + amount);
|
|
172
|
-
|
|
189
|
+
if (!isDiscountCard) {
|
|
190
|
+
existed.balance = String(Number(existed.balance || 0) + amount);
|
|
191
|
+
}
|
|
173
192
|
var productIds = Array.isArray((_existed$limited_rela = existed.limited_relation_product_data) === null || _existed$limited_rela === void 0 ? void 0 : _existed$limited_rela.product_ids) ? existed.limited_relation_product_data.product_ids : [];
|
|
174
193
|
if ((product === null || product === void 0 ? void 0 : product.product_id) !== undefined && (product === null || product === void 0 ? void 0 : product.product_id) !== null && !productIds.includes(product.product_id)) {
|
|
175
194
|
existed.limited_relation_product_data = _objectSpread(_objectSpread({}, existed.limited_relation_product_data || {}), {}, {
|
|
@@ -201,7 +220,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
201
220
|
filter: 0,
|
|
202
221
|
exclude_product_ids: []
|
|
203
222
|
},
|
|
204
|
-
balance: String((_item$amount3 = item === null || item === void 0 ? void 0 : item.amount) !== null && _item$amount3 !== void 0 ? _item$amount3 : '0'),
|
|
223
|
+
balance: isDiscountCard ? undefined : String((_item$amount3 = item === null || item === void 0 ? void 0 : item.amount) !== null && _item$amount3 !== void 0 ? _item$amount3 : '0'),
|
|
205
224
|
format_title: title,
|
|
206
225
|
product: {
|
|
207
226
|
id: (_product$product_id = product === null || product === void 0 ? void 0 : product.product_id) !== null && _product$product_id !== void 0 ? _product$product_id : 0,
|
|
@@ -290,8 +309,8 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
290
309
|
key: "initialize",
|
|
291
310
|
value: function () {
|
|
292
311
|
var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(core, options) {
|
|
293
|
-
var
|
|
294
|
-
var
|
|
312
|
+
var _otherParams$rules, _otherParams$order, _otherParams$hooks;
|
|
313
|
+
var app, otherParams;
|
|
295
314
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
296
315
|
while (1) switch (_context.prev = _context.next) {
|
|
297
316
|
case 0:
|
|
@@ -307,12 +326,15 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
307
326
|
this.store.availableWalletIds = [];
|
|
308
327
|
}
|
|
309
328
|
this.request = this.core.getPlugin('request');
|
|
310
|
-
appPlugin = this.core.getPlugin('app');
|
|
311
|
-
if (
|
|
312
|
-
|
|
329
|
+
this.appPlugin = this.core.getPlugin('app');
|
|
330
|
+
if (this.appPlugin) {
|
|
331
|
+
_context.next = 9;
|
|
332
|
+
break;
|
|
313
333
|
}
|
|
314
|
-
|
|
315
|
-
|
|
334
|
+
throw new Error('Order 模块需要 app 插件支持');
|
|
335
|
+
case 9:
|
|
336
|
+
app = this.appPlugin.getApp();
|
|
337
|
+
this.logger = app.logger;
|
|
316
338
|
this.window = this.core.getPlugin('window');
|
|
317
339
|
otherParams = options.otherParams || {};
|
|
318
340
|
this.cacheId = otherParams.cacheId;
|
|
@@ -323,7 +345,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
323
345
|
this.otherParams = otherParams;
|
|
324
346
|
this.registerDiscountModules(options);
|
|
325
347
|
this.logInfo('OrderModule initialized successfully');
|
|
326
|
-
case
|
|
348
|
+
case 21:
|
|
327
349
|
case "end":
|
|
328
350
|
return _context.stop();
|
|
329
351
|
}
|
|
@@ -664,7 +686,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
664
686
|
value: function () {
|
|
665
687
|
var _scanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(code, customerId) {
|
|
666
688
|
var _this$store$discount11, _tempOrder$holder, _this$store$summary;
|
|
667
|
-
var resultDiscountWithReason, resultDiscountList, unavailableReasonKey, rulesModule, withScanList, currentSelected, tempOrder, holders, _ref13, isAvailable, newDiscountList, unavailableReason, _this$store$discount12;
|
|
689
|
+
var resultDiscountWithReason, resultDiscountList, unavailableReasonKey, rulesModule, withScanList, currentSelected, tempOrder, holders, _ref13, isAvailable, newDiscountList, evaluatedDiscountList, unavailableReason, shouldRetainForLater, normalizedNewDiscountList, retainedDiscountList, resolvedDiscountList, _this$store$discount12, _this$store$discount13;
|
|
668
690
|
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
669
691
|
while (1) switch (_context6.prev = _context6.next) {
|
|
670
692
|
case 0:
|
|
@@ -693,6 +715,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
693
715
|
return _context6.abrupt("return", {
|
|
694
716
|
type: 'clientCalc',
|
|
695
717
|
isAvailable: false,
|
|
718
|
+
isAccepted: false,
|
|
696
719
|
discountList: this.getDiscountList(),
|
|
697
720
|
scannedDiscountList: resultDiscountList,
|
|
698
721
|
unavailableReason: UnavailableReason.Unknown
|
|
@@ -705,6 +728,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
705
728
|
return _context6.abrupt("return", {
|
|
706
729
|
type: 'server',
|
|
707
730
|
isAvailable: false,
|
|
731
|
+
isAccepted: false,
|
|
708
732
|
discountList: this.getDiscountList(),
|
|
709
733
|
scannedDiscountList: resultDiscountList,
|
|
710
734
|
unavailableReasonKey: unavailableReasonKey
|
|
@@ -732,6 +756,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
732
756
|
return _context6.abrupt("return", {
|
|
733
757
|
type: 'clientCalc',
|
|
734
758
|
isAvailable: true,
|
|
759
|
+
isAccepted: true,
|
|
735
760
|
discountList: this.getDiscountList(),
|
|
736
761
|
scannedDiscountList: resultDiscountList
|
|
737
762
|
});
|
|
@@ -750,24 +775,47 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
750
775
|
}) || {
|
|
751
776
|
isAvailable: false,
|
|
752
777
|
discountList: this.getDiscountList()
|
|
753
|
-
}, isAvailable = _ref13.isAvailable, newDiscountList = _ref13.discountList, unavailableReason = _ref13.unavailableReason;
|
|
754
|
-
|
|
755
|
-
|
|
778
|
+
}, isAvailable = _ref13.isAvailable, newDiscountList = _ref13.discountList, evaluatedDiscountList = _ref13.evaluatedDiscountList, unavailableReason = _ref13.unavailableReason;
|
|
779
|
+
shouldRetainForLater = !isAvailable && unavailableReason === UnavailableReason.ProductNotApplicable && withScanList.some(isCustomerPromotionDiscount);
|
|
780
|
+
normalizedNewDiscountList = newDiscountList ? markScannedDiscounts(newDiscountList, withScanList) : undefined;
|
|
781
|
+
retainedDiscountList = evaluatedDiscountList ? markScannedDiscounts(evaluatedDiscountList, withScanList) : normalizedNewDiscountList;
|
|
782
|
+
resolvedDiscountList = normalizedNewDiscountList || this.getDiscountList();
|
|
783
|
+
if (!(isAvailable && normalizedNewDiscountList)) {
|
|
784
|
+
_context6.next = 34;
|
|
756
785
|
break;
|
|
757
786
|
}
|
|
758
|
-
|
|
787
|
+
_context6.next = 28;
|
|
788
|
+
return (_this$store$discount12 = this.store.discount) === null || _this$store$discount12 === void 0 ? void 0 : _this$store$discount12.setDiscountList(normalizedNewDiscountList);
|
|
789
|
+
case 28:
|
|
759
790
|
this.applyDiscount();
|
|
760
|
-
_context6.next =
|
|
791
|
+
_context6.next = 31;
|
|
761
792
|
return this.syncScannedDiscountsToOriginalDiscountList(this.getDiscountList());
|
|
762
|
-
case
|
|
793
|
+
case 31:
|
|
794
|
+
resolvedDiscountList = this.getDiscountList();
|
|
795
|
+
_context6.next = 40;
|
|
796
|
+
break;
|
|
797
|
+
case 34:
|
|
798
|
+
if (!(shouldRetainForLater && retainedDiscountList)) {
|
|
799
|
+
_context6.next = 40;
|
|
800
|
+
break;
|
|
801
|
+
}
|
|
802
|
+
_context6.next = 37;
|
|
803
|
+
return (_this$store$discount13 = this.store.discount) === null || _this$store$discount13 === void 0 ? void 0 : _this$store$discount13.setDiscountList(retainedDiscountList);
|
|
804
|
+
case 37:
|
|
805
|
+
_context6.next = 39;
|
|
806
|
+
return this.syncScannedDiscountsToOriginalDiscountList(this.getDiscountList());
|
|
807
|
+
case 39:
|
|
808
|
+
resolvedDiscountList = this.getDiscountList();
|
|
809
|
+
case 40:
|
|
763
810
|
return _context6.abrupt("return", {
|
|
764
811
|
type: 'clientCalc',
|
|
765
812
|
isAvailable: isAvailable || false,
|
|
766
|
-
|
|
813
|
+
isAccepted: Boolean(isAvailable || shouldRetainForLater),
|
|
814
|
+
discountList: resolvedDiscountList,
|
|
767
815
|
scannedDiscountList: resultDiscountList,
|
|
768
816
|
unavailableReason: unavailableReason
|
|
769
817
|
});
|
|
770
|
-
case
|
|
818
|
+
case 41:
|
|
771
819
|
case "end":
|
|
772
820
|
return _context6.stop();
|
|
773
821
|
}
|
|
@@ -781,7 +829,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
781
829
|
}, {
|
|
782
830
|
key: "applyDiscount",
|
|
783
831
|
value: function applyDiscount(options) {
|
|
784
|
-
var _this$store$
|
|
832
|
+
var _this$store$discount14,
|
|
785
833
|
_this$store$summary2,
|
|
786
834
|
_this2 = this;
|
|
787
835
|
var tempOrder = this.store.tempOrder;
|
|
@@ -791,7 +839,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
791
839
|
if (!tempOrder) return;
|
|
792
840
|
this.syncLinkedBookingHoldersToProducts(tempOrder);
|
|
793
841
|
delete tempOrder.discount_list;
|
|
794
|
-
var discountList = ((_this$store$
|
|
842
|
+
var discountList = ((_this$store$discount14 = this.store.discount) === null || _this$store$discount14 === void 0 ? void 0 : _this$store$discount14.getDiscountList()) || [];
|
|
795
843
|
var shouldSkipDiscountCalculation = this.shouldSkipDiscountCalculation(tempOrder);
|
|
796
844
|
if (shouldSkipDiscountCalculation) return;
|
|
797
845
|
var rulesModule = this.store.rules;
|
|
@@ -823,9 +871,9 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
823
871
|
}));
|
|
824
872
|
}
|
|
825
873
|
if (result !== null && result !== void 0 && result.discountList) {
|
|
826
|
-
var _this$store$
|
|
874
|
+
var _this$store$discount15;
|
|
827
875
|
OrderModule.populateSavedAmounts(result.productList || tempOrder.products, result.discountList);
|
|
828
|
-
(_this$store$
|
|
876
|
+
(_this$store$discount15 = this.store.discount) === null || _this$store$discount15 === void 0 || _this$store$discount15.setDiscountList(result.discountList);
|
|
829
877
|
}
|
|
830
878
|
this.hasActiveCustomerBoundDiscount = (tempOrder.products || []).some(function (product) {
|
|
831
879
|
return _this2.productHasCustomerBoundDiscount(product);
|
|
@@ -1228,16 +1276,6 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1228
1276
|
value: function persistTempOrder() {
|
|
1229
1277
|
// no-op: OrderModule 的刷新恢复不再依赖 localStorage。
|
|
1230
1278
|
}
|
|
1231
|
-
}, {
|
|
1232
|
-
key: "notifyTempOrderChanged",
|
|
1233
|
-
value: function notifyTempOrderChanged() {
|
|
1234
|
-
if (!this.store.tempOrder) return;
|
|
1235
|
-
this.store.tempOrder = _objectSpread(_objectSpread({}, this.store.tempOrder), {}, {
|
|
1236
|
-
products: _toConsumableArray(this.store.tempOrder.products),
|
|
1237
|
-
bookings: this.store.tempOrder.bookings ? _toConsumableArray(this.store.tempOrder.bookings) : []
|
|
1238
|
-
});
|
|
1239
|
-
this.persistTempOrder();
|
|
1240
|
-
}
|
|
1241
1279
|
|
|
1242
1280
|
// ─── TempOrder: 创建 & 获取 ───
|
|
1243
1281
|
}, {
|
|
@@ -2289,7 +2327,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2289
2327
|
}, {
|
|
2290
2328
|
key: "restoreOrder",
|
|
2291
2329
|
value: function restoreOrder() {
|
|
2292
|
-
var _this$store$
|
|
2330
|
+
var _this$store$discount16, _this$store$discount17;
|
|
2293
2331
|
this.logInfo('restoreOrder start', {});
|
|
2294
2332
|
var freshTempOrder = this.createDefaultTempOrderInstance();
|
|
2295
2333
|
this.ensureExternalSaleNumber(freshTempOrder);
|
|
@@ -2297,8 +2335,8 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2297
2335
|
this.store.summary = createEmptySummary();
|
|
2298
2336
|
this.store.lastOrderInfo = undefined;
|
|
2299
2337
|
this.store.syncState = undefined;
|
|
2300
|
-
void ((_this$store$
|
|
2301
|
-
void ((_this$store$
|
|
2338
|
+
void ((_this$store$discount16 = this.store.discount) === null || _this$store$discount16 === void 0 ? void 0 : _this$store$discount16.setOriginalDiscountList([]));
|
|
2339
|
+
void ((_this$store$discount17 = this.store.discount) === null || _this$store$discount17 === void 0 ? void 0 : _this$store$discount17.setDiscountList([]));
|
|
2302
2340
|
this.persistTempOrder();
|
|
2303
2341
|
return freshTempOrder;
|
|
2304
2342
|
}
|
|
@@ -3121,11 +3159,11 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3121
3159
|
}, {
|
|
3122
3160
|
key: "shouldSkipDiscountCalculation",
|
|
3123
3161
|
value: function shouldSkipDiscountCalculation(tempOrder) {
|
|
3124
|
-
var _this$store$
|
|
3125
|
-
_this$store$
|
|
3162
|
+
var _this$store$discount18,
|
|
3163
|
+
_this$store$discount19,
|
|
3126
3164
|
_this20 = this;
|
|
3127
3165
|
if (this.hasActiveCustomerBoundDiscount) return false;
|
|
3128
|
-
var discountList = ((_this$store$
|
|
3166
|
+
var discountList = ((_this$store$discount18 = this.store.discount) === null || _this$store$discount18 === void 0 || (_this$store$discount19 = _this$store$discount18.getDiscountList) === null || _this$store$discount19 === void 0 ? void 0 : _this$store$discount19.call(_this$store$discount18)) || [];
|
|
3129
3167
|
if (discountList.length > 0) return false;
|
|
3130
3168
|
return !(tempOrder.products || []).some(function (product) {
|
|
3131
3169
|
return _this20.productHasCustomerBoundDiscount(product);
|
|
@@ -5242,7 +5280,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5242
5280
|
var _syncPaymentsToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(params) {
|
|
5243
5281
|
var _this31 = this,
|
|
5244
5282
|
_params$confirmPendin;
|
|
5245
|
-
var tempOrder, needsPaymentNumber, devicePrefix, mappedPayments, shouldConfirmPendingVoucherPayments, effectivePayments, completion, orderPaidPaymentTotal, paymentStatus, paymentSyncIdempotencyToken,
|
|
5283
|
+
var tempOrder, needsPaymentNumber, devicePrefix, mappedPayments, shouldConfirmPendingVoucherPayments, effectivePayments, completion, orderPaidPaymentTotal, paymentStatus, paymentSyncIdempotencyToken, submitResult;
|
|
5246
5284
|
return _regeneratorRuntime().wrap(function _callee36$(_context39) {
|
|
5247
5285
|
while (1) switch (_context39.prev = _context39.next) {
|
|
5248
5286
|
case 0:
|
|
@@ -5295,7 +5333,8 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5295
5333
|
case 25:
|
|
5296
5334
|
this.store.syncState = 'submitting';
|
|
5297
5335
|
paymentSyncIdempotencyToken = this.buildPaymentSyncIdempotencyToken(tempOrder, effectivePayments);
|
|
5298
|
-
|
|
5336
|
+
_context39.next = 29;
|
|
5337
|
+
return this.submitTempOrder({
|
|
5299
5338
|
payments: effectivePayments,
|
|
5300
5339
|
paymentStatus: paymentStatus,
|
|
5301
5340
|
smallTicketDataFlag: params.smallTicketDataFlag,
|
|
@@ -5308,28 +5347,13 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5308
5347
|
});
|
|
5309
5348
|
return nextPayload;
|
|
5310
5349
|
}
|
|
5311
|
-
};
|
|
5312
|
-
|
|
5313
|
-
|
|
5314
|
-
break;
|
|
5315
|
-
}
|
|
5316
|
-
_context39.next = 31;
|
|
5317
|
-
return this.submitTempOrderAsync(submitParams);
|
|
5318
|
-
case 31:
|
|
5319
|
-
_context39.t1 = _context39.sent;
|
|
5320
|
-
_context39.next = 37;
|
|
5321
|
-
break;
|
|
5322
|
-
case 34:
|
|
5323
|
-
_context39.next = 36;
|
|
5324
|
-
return this.submitTempOrder(submitParams);
|
|
5325
|
-
case 36:
|
|
5326
|
-
_context39.t1 = _context39.sent;
|
|
5327
|
-
case 37:
|
|
5328
|
-
submitResult = _context39.t1;
|
|
5350
|
+
});
|
|
5351
|
+
case 29:
|
|
5352
|
+
submitResult = _context39.sent;
|
|
5329
5353
|
return _context39.abrupt("return", _objectSpread(_objectSpread({}, completion), {}, {
|
|
5330
5354
|
submitResult: submitResult
|
|
5331
5355
|
}));
|
|
5332
|
-
case
|
|
5356
|
+
case 31:
|
|
5333
5357
|
case "end":
|
|
5334
5358
|
return _context39.stop();
|
|
5335
5359
|
}
|
|
@@ -5343,7 +5367,6 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5343
5367
|
}, {
|
|
5344
5368
|
key: "createOrder",
|
|
5345
5369
|
value: function createOrder(params) {
|
|
5346
|
-
var _this32 = this;
|
|
5347
5370
|
var order = _objectSpread({
|
|
5348
5371
|
type: (params === null || params === void 0 ? void 0 : params.type) || 'appointment_booking',
|
|
5349
5372
|
// 要从外面拿,virtual
|
|
@@ -5355,13 +5378,11 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5355
5378
|
schedule_date: '',
|
|
5356
5379
|
is_deposit: 0,
|
|
5357
5380
|
relation_products: [],
|
|
5358
|
-
relation_forms: []
|
|
5359
|
-
business_code: params === null || params === void 0 ? void 0 : params.business_code
|
|
5381
|
+
relation_forms: []
|
|
5360
5382
|
}, (params === null || params === void 0 ? void 0 : params.extraData) || {});
|
|
5361
5383
|
var is_deposit = 0; // 是否存在定金,0 不存在,1 存在
|
|
5362
5384
|
if (params.cartItems.length > 0) {
|
|
5363
5385
|
params.cartItems.forEach(function (item) {
|
|
5364
|
-
var _params$extraData;
|
|
5365
5386
|
if (!item._origin.duration) {
|
|
5366
5387
|
var _generateDuration = generateDuration(item),
|
|
5367
5388
|
duration = _generateDuration.duration,
|
|
@@ -5373,11 +5394,6 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5373
5394
|
var discountList = getAllDiscountList(item);
|
|
5374
5395
|
item._origin.product.discount_list = discountList;
|
|
5375
5396
|
|
|
5376
|
-
// 为预约补齐 holder 信息
|
|
5377
|
-
if (params !== null && params !== void 0 && (_params$extraData = params.extraData) !== null && _params$extraData !== void 0 && _params$extraData.is_add_holder_info) {
|
|
5378
|
-
ensureCartItemOriginHolder(item, _this32.window);
|
|
5379
|
-
}
|
|
5380
|
-
|
|
5381
5397
|
// 购物车是否为普通商品
|
|
5382
5398
|
if (isNormalProduct(item._origin)) {
|
|
5383
5399
|
var _order$relation_forms;
|
|
@@ -5821,8 +5837,8 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5821
5837
|
key: "hydrateTempOrderFromRecord",
|
|
5822
5838
|
value: (function () {
|
|
5823
5839
|
var _hydrateTempOrderFromRecord = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(record, options) {
|
|
5824
|
-
var _this$store$
|
|
5825
|
-
var sourceRaw, identityReadySource, normalizedCollections, raw, hasIdentityChanges, identityLogMetadata, hasIdentityWarnings, nextTempOrder, sourceLastOrderInfo, isDraftOrder, syntheticIdentityOptions, rawSummary, summarySurcharges, hadSyntheticDraftOrderId, hydratedEditDiscounts, currentDiscounts, currentScanDiscounts, hydratedDiscountIds, retainedScanDiscounts, nextDiscounts, shouldSkipEmptyDiscountSync, _this$store$
|
|
5840
|
+
var _this$store$discount20;
|
|
5841
|
+
var sourceRaw, identityReadySource, normalizedCollections, raw, hasIdentityChanges, identityLogMetadata, hasIdentityWarnings, nextTempOrder, sourceLastOrderInfo, isDraftOrder, syntheticIdentityOptions, rawSummary, summarySurcharges, hadSyntheticDraftOrderId, hydratedEditDiscounts, currentDiscounts, currentScanDiscounts, hydratedDiscountIds, retainedScanDiscounts, nextDiscounts, shouldSkipEmptyDiscountSync, _this$store$discount21, _this$store$discount22;
|
|
5826
5842
|
return _regeneratorRuntime().wrap(function _callee44$(_context47) {
|
|
5827
5843
|
while (1) switch (_context47.prev = _context47.next) {
|
|
5828
5844
|
case 0:
|
|
@@ -5881,7 +5897,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5881
5897
|
this.store.syncState = 'local';
|
|
5882
5898
|
}
|
|
5883
5899
|
hydratedEditDiscounts = this.collectHydratedEditDiscounts(nextTempOrder.products);
|
|
5884
|
-
currentDiscounts = typeof ((_this$store$
|
|
5900
|
+
currentDiscounts = typeof ((_this$store$discount20 = this.store.discount) === null || _this$store$discount20 === void 0 ? void 0 : _this$store$discount20.getDiscountList) === 'function' ? this.store.discount.getDiscountList() || [] : [];
|
|
5885
5901
|
currentScanDiscounts = currentDiscounts.filter(function (discount) {
|
|
5886
5902
|
return discount === null || discount === void 0 ? void 0 : discount.isScan;
|
|
5887
5903
|
});
|
|
@@ -5899,10 +5915,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5899
5915
|
}
|
|
5900
5916
|
OrderModule.populateSavedAmounts(nextTempOrder.products, nextDiscounts);
|
|
5901
5917
|
_context47.next = 29;
|
|
5902
|
-
return (_this$store$
|
|
5918
|
+
return (_this$store$discount21 = this.store.discount) === null || _this$store$discount21 === void 0 ? void 0 : _this$store$discount21.setOriginalDiscountList(nextDiscounts);
|
|
5903
5919
|
case 29:
|
|
5904
5920
|
_context47.next = 31;
|
|
5905
|
-
return (_this$store$
|
|
5921
|
+
return (_this$store$discount22 = this.store.discount) === null || _this$store$discount22 === void 0 ? void 0 : _this$store$discount22.setDiscountList(nextDiscounts);
|
|
5906
5922
|
case 31:
|
|
5907
5923
|
if (!(options !== null && options !== void 0 && options.recalcOnHydrate)) {
|
|
5908
5924
|
_context47.next = 34;
|
|
@@ -6035,7 +6051,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
6035
6051
|
}, {
|
|
6036
6052
|
key: "normalizeTempOrderForRuntime",
|
|
6037
6053
|
value: function normalizeTempOrderForRuntime(raw, options) {
|
|
6038
|
-
var
|
|
6054
|
+
var _this32 = this;
|
|
6039
6055
|
var runtimeRaw = this.withoutSyntheticDraftOrderIdForRuntime(raw);
|
|
6040
6056
|
var nextTempOrder = _objectSpread(_objectSpread({}, this.createDefaultTempOrderInstance()), runtimeRaw || {});
|
|
6041
6057
|
// ES 列表详情使用 id 表示订单主键;OS 详情态统一依赖 order_id 驱动操作按钮。
|
|
@@ -6059,12 +6075,12 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
6059
6075
|
nextTempOrder.holder = raw.holder && _typeof(raw.holder) === 'object' ? _objectSpread({}, raw.holder) : null;
|
|
6060
6076
|
var rawProducts = Array.isArray(raw.products) ? raw.products : [];
|
|
6061
6077
|
nextTempOrder.products = rawProducts.length > 0 ? rawProducts.map(function (p) {
|
|
6062
|
-
return
|
|
6078
|
+
return _this32.normalizeHydratedOrderProduct(p, {
|
|
6063
6079
|
makeEditMark: options === null || options === void 0 ? void 0 : options.makeEditMark
|
|
6064
6080
|
});
|
|
6065
6081
|
}) : [];
|
|
6066
6082
|
nextTempOrder.bookings = Array.isArray(raw.bookings) ? raw.bookings.map(function (b) {
|
|
6067
|
-
var booking =
|
|
6083
|
+
var booking = _this32.normalizeHydratedBookingHolder(b || {});
|
|
6068
6084
|
return _objectSpread(_objectSpread({}, booking), {}, {
|
|
6069
6085
|
is_all: normalizeBookingIsAll(booking),
|
|
6070
6086
|
sub_type: normalizeBookingSubType(booking)
|
|
@@ -6251,7 +6267,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
6251
6267
|
}, {
|
|
6252
6268
|
key: "normalizeHydratedOrderProduct",
|
|
6253
6269
|
value: function normalizeHydratedOrderProduct(product, options) {
|
|
6254
|
-
var
|
|
6270
|
+
var _this33 = this;
|
|
6255
6271
|
var row = _objectSpread({}, product || {});
|
|
6256
6272
|
if (row.num === undefined && row.product_quantity !== undefined) {
|
|
6257
6273
|
row.num = row.product_quantity;
|
|
@@ -6259,7 +6275,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
6259
6275
|
var productSku = ensureProductSku(row);
|
|
6260
6276
|
row.product_sku = _objectSpread(_objectSpread({}, productSku), {}, {
|
|
6261
6277
|
option: normalizeProductSkuOptions(productSku.option.map(function (optionItem) {
|
|
6262
|
-
return
|
|
6278
|
+
return _this33.normalizeHydratedProductOptionItem(optionItem || {});
|
|
6263
6279
|
}))
|
|
6264
6280
|
});
|
|
6265
6281
|
delete row["product_".concat('option', "_item")];
|