@pisell/pisellos 2.3.42 → 2.3.44
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 +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.js +2 -2
- package/dist/modules/Order/index.d.ts +5 -2
- package/dist/modules/Order/index.js +127 -53
- package/dist/modules/Order/types.d.ts +11 -0
- package/dist/modules/Order/utils.d.ts +10 -0
- package/dist/modules/Order/utils.js +35 -3
- package/dist/modules/Payment/walletpass.d.ts +10 -3
- package/dist/modules/Payment/walletpass.js +425 -282
- 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 +2 -0
- package/dist/modules/Rules/index.js +106 -68
- 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 -0
- package/dist/server/index.js +772 -657
- package/dist/solution/BaseSales/index.d.ts +7 -0
- package/dist/solution/BaseSales/index.js +70 -45
- 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 +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.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 +3 -1
- package/dist/solution/BookingTicket/utils/scan/handleScan.js +10 -2
- package/dist/solution/ScanOrder/index.d.ts +26 -14
- package/dist/solution/ScanOrder/index.js +1142 -739
- 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 +1891 -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 +40 -11
- package/dist/solution/VenueBooking/index.js +1167 -841
- 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 -0
- 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.js +1 -1
- package/lib/modules/Order/index.d.ts +5 -2
- package/lib/modules/Order/index.js +72 -17
- package/lib/modules/Order/types.d.ts +11 -0
- package/lib/modules/Order/utils.d.ts +10 -0
- package/lib/modules/Order/utils.js +36 -5
- package/lib/modules/Payment/walletpass.d.ts +10 -3
- package/lib/modules/Payment/walletpass.js +218 -56
- 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 +2 -0
- package/lib/modules/Rules/index.js +41 -19
- 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 -0
- package/lib/server/index.js +65 -5
- package/lib/solution/BaseSales/index.d.ts +7 -0
- package/lib/solution/BaseSales/index.js +25 -8
- 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 +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.js +11 -2
- 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 +3 -1
- package/lib/solution/BookingTicket/utils/scan/handleScan.js +2 -2
- package/lib/solution/ScanOrder/index.d.ts +26 -14
- package/lib/solution/ScanOrder/index.js +449 -182
- 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 +1084 -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 +40 -11
- package/lib/solution/VenueBooking/index.js +322 -110
- 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 -0
- package/package.json +1 -1
|
@@ -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, 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
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 _otherParams$rules, _otherParams$order, _otherParams$hooks;
|
|
294
|
-
var app, otherParams;
|
|
312
|
+
var _appPlugin$getApp, _otherParams$rules, _otherParams$order, _otherParams$hooks;
|
|
313
|
+
var appPlugin, app, otherParams;
|
|
295
314
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
296
315
|
while (1) switch (_context.prev = _context.next) {
|
|
297
316
|
case 0:
|
|
@@ -307,15 +326,12 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
307
326
|
this.store.availableWalletIds = [];
|
|
308
327
|
}
|
|
309
328
|
this.request = this.core.getPlugin('request');
|
|
310
|
-
|
|
311
|
-
if (
|
|
312
|
-
|
|
313
|
-
break;
|
|
329
|
+
appPlugin = this.core.getPlugin('app');
|
|
330
|
+
if (!appPlugin) {
|
|
331
|
+
console.error('Order 模块需要 app 插件支持');
|
|
314
332
|
}
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
app = this.appPlugin.getApp();
|
|
318
|
-
this.logger = app.logger;
|
|
333
|
+
app = appPlugin === null || appPlugin === void 0 || (_appPlugin$getApp = appPlugin.getApp) === null || _appPlugin$getApp === void 0 ? void 0 : _appPlugin$getApp.call(appPlugin);
|
|
334
|
+
this.logger = app === null || app === void 0 ? void 0 : app.logger;
|
|
319
335
|
this.window = this.core.getPlugin('window');
|
|
320
336
|
otherParams = options.otherParams || {};
|
|
321
337
|
this.cacheId = otherParams.cacheId;
|
|
@@ -326,7 +342,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
326
342
|
this.otherParams = otherParams;
|
|
327
343
|
this.registerDiscountModules(options);
|
|
328
344
|
this.logInfo('OrderModule initialized successfully');
|
|
329
|
-
case
|
|
345
|
+
case 20:
|
|
330
346
|
case "end":
|
|
331
347
|
return _context.stop();
|
|
332
348
|
}
|
|
@@ -667,7 +683,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
667
683
|
value: function () {
|
|
668
684
|
var _scanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(code, customerId) {
|
|
669
685
|
var _this$store$discount11, _tempOrder$holder, _this$store$summary;
|
|
670
|
-
var resultDiscountWithReason, resultDiscountList, unavailableReasonKey, rulesModule, withScanList, currentSelected, tempOrder, holders, _ref13, isAvailable, newDiscountList, unavailableReason, _this$store$discount12;
|
|
686
|
+
var resultDiscountWithReason, resultDiscountList, unavailableReasonKey, rulesModule, withScanList, currentSelected, tempOrder, holders, _ref13, isAvailable, newDiscountList, evaluatedDiscountList, unavailableReason, shouldRetainForLater, normalizedNewDiscountList, retainedDiscountList, resolvedDiscountList, _this$store$discount12, _this$store$discount13;
|
|
671
687
|
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
672
688
|
while (1) switch (_context6.prev = _context6.next) {
|
|
673
689
|
case 0:
|
|
@@ -696,6 +712,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
696
712
|
return _context6.abrupt("return", {
|
|
697
713
|
type: 'clientCalc',
|
|
698
714
|
isAvailable: false,
|
|
715
|
+
isAccepted: false,
|
|
699
716
|
discountList: this.getDiscountList(),
|
|
700
717
|
scannedDiscountList: resultDiscountList,
|
|
701
718
|
unavailableReason: UnavailableReason.Unknown
|
|
@@ -708,6 +725,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
708
725
|
return _context6.abrupt("return", {
|
|
709
726
|
type: 'server',
|
|
710
727
|
isAvailable: false,
|
|
728
|
+
isAccepted: false,
|
|
711
729
|
discountList: this.getDiscountList(),
|
|
712
730
|
scannedDiscountList: resultDiscountList,
|
|
713
731
|
unavailableReasonKey: unavailableReasonKey
|
|
@@ -735,6 +753,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
735
753
|
return _context6.abrupt("return", {
|
|
736
754
|
type: 'clientCalc',
|
|
737
755
|
isAvailable: true,
|
|
756
|
+
isAccepted: true,
|
|
738
757
|
discountList: this.getDiscountList(),
|
|
739
758
|
scannedDiscountList: resultDiscountList
|
|
740
759
|
});
|
|
@@ -753,24 +772,47 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
753
772
|
}) || {
|
|
754
773
|
isAvailable: false,
|
|
755
774
|
discountList: this.getDiscountList()
|
|
756
|
-
}, isAvailable = _ref13.isAvailable, newDiscountList = _ref13.discountList, unavailableReason = _ref13.unavailableReason;
|
|
757
|
-
|
|
758
|
-
|
|
775
|
+
}, isAvailable = _ref13.isAvailable, newDiscountList = _ref13.discountList, evaluatedDiscountList = _ref13.evaluatedDiscountList, unavailableReason = _ref13.unavailableReason;
|
|
776
|
+
shouldRetainForLater = !isAvailable && unavailableReason === UnavailableReason.ProductNotApplicable && withScanList.some(isCustomerPromotionDiscount);
|
|
777
|
+
normalizedNewDiscountList = newDiscountList ? markScannedDiscounts(newDiscountList, withScanList) : undefined;
|
|
778
|
+
retainedDiscountList = evaluatedDiscountList ? markScannedDiscounts(evaluatedDiscountList, withScanList) : normalizedNewDiscountList;
|
|
779
|
+
resolvedDiscountList = normalizedNewDiscountList || this.getDiscountList();
|
|
780
|
+
if (!(isAvailable && normalizedNewDiscountList)) {
|
|
781
|
+
_context6.next = 34;
|
|
759
782
|
break;
|
|
760
783
|
}
|
|
761
|
-
|
|
784
|
+
_context6.next = 28;
|
|
785
|
+
return (_this$store$discount12 = this.store.discount) === null || _this$store$discount12 === void 0 ? void 0 : _this$store$discount12.setDiscountList(normalizedNewDiscountList);
|
|
786
|
+
case 28:
|
|
762
787
|
this.applyDiscount();
|
|
763
|
-
_context6.next =
|
|
788
|
+
_context6.next = 31;
|
|
764
789
|
return this.syncScannedDiscountsToOriginalDiscountList(this.getDiscountList());
|
|
765
|
-
case
|
|
790
|
+
case 31:
|
|
791
|
+
resolvedDiscountList = this.getDiscountList();
|
|
792
|
+
_context6.next = 40;
|
|
793
|
+
break;
|
|
794
|
+
case 34:
|
|
795
|
+
if (!(shouldRetainForLater && retainedDiscountList)) {
|
|
796
|
+
_context6.next = 40;
|
|
797
|
+
break;
|
|
798
|
+
}
|
|
799
|
+
_context6.next = 37;
|
|
800
|
+
return (_this$store$discount13 = this.store.discount) === null || _this$store$discount13 === void 0 ? void 0 : _this$store$discount13.setDiscountList(retainedDiscountList);
|
|
801
|
+
case 37:
|
|
802
|
+
_context6.next = 39;
|
|
803
|
+
return this.syncScannedDiscountsToOriginalDiscountList(this.getDiscountList());
|
|
804
|
+
case 39:
|
|
805
|
+
resolvedDiscountList = this.getDiscountList();
|
|
806
|
+
case 40:
|
|
766
807
|
return _context6.abrupt("return", {
|
|
767
808
|
type: 'clientCalc',
|
|
768
809
|
isAvailable: isAvailable || false,
|
|
769
|
-
|
|
810
|
+
isAccepted: Boolean(isAvailable || shouldRetainForLater),
|
|
811
|
+
discountList: resolvedDiscountList,
|
|
770
812
|
scannedDiscountList: resultDiscountList,
|
|
771
813
|
unavailableReason: unavailableReason
|
|
772
814
|
});
|
|
773
|
-
case
|
|
815
|
+
case 41:
|
|
774
816
|
case "end":
|
|
775
817
|
return _context6.stop();
|
|
776
818
|
}
|
|
@@ -784,7 +826,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
784
826
|
}, {
|
|
785
827
|
key: "applyDiscount",
|
|
786
828
|
value: function applyDiscount(options) {
|
|
787
|
-
var _this$store$
|
|
829
|
+
var _this$store$discount14,
|
|
788
830
|
_this$store$summary2,
|
|
789
831
|
_this2 = this;
|
|
790
832
|
var tempOrder = this.store.tempOrder;
|
|
@@ -794,7 +836,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
794
836
|
if (!tempOrder) return;
|
|
795
837
|
this.syncLinkedBookingHoldersToProducts(tempOrder);
|
|
796
838
|
delete tempOrder.discount_list;
|
|
797
|
-
var discountList = ((_this$store$
|
|
839
|
+
var discountList = ((_this$store$discount14 = this.store.discount) === null || _this$store$discount14 === void 0 ? void 0 : _this$store$discount14.getDiscountList()) || [];
|
|
798
840
|
var shouldSkipDiscountCalculation = this.shouldSkipDiscountCalculation(tempOrder);
|
|
799
841
|
if (shouldSkipDiscountCalculation) return;
|
|
800
842
|
var rulesModule = this.store.rules;
|
|
@@ -826,9 +868,9 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
826
868
|
}));
|
|
827
869
|
}
|
|
828
870
|
if (result !== null && result !== void 0 && result.discountList) {
|
|
829
|
-
var _this$store$
|
|
871
|
+
var _this$store$discount15;
|
|
830
872
|
OrderModule.populateSavedAmounts(result.productList || tempOrder.products, result.discountList);
|
|
831
|
-
(_this$store$
|
|
873
|
+
(_this$store$discount15 = this.store.discount) === null || _this$store$discount15 === void 0 || _this$store$discount15.setDiscountList(result.discountList);
|
|
832
874
|
}
|
|
833
875
|
this.hasActiveCustomerBoundDiscount = (tempOrder.products || []).some(function (product) {
|
|
834
876
|
return _this2.productHasCustomerBoundDiscount(product);
|
|
@@ -1231,6 +1273,16 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1231
1273
|
value: function persistTempOrder() {
|
|
1232
1274
|
// no-op: OrderModule 的刷新恢复不再依赖 localStorage。
|
|
1233
1275
|
}
|
|
1276
|
+
}, {
|
|
1277
|
+
key: "notifyTempOrderChanged",
|
|
1278
|
+
value: function notifyTempOrderChanged() {
|
|
1279
|
+
if (!this.store.tempOrder) return;
|
|
1280
|
+
this.store.tempOrder = _objectSpread(_objectSpread({}, this.store.tempOrder), {}, {
|
|
1281
|
+
products: _toConsumableArray(this.store.tempOrder.products),
|
|
1282
|
+
bookings: this.store.tempOrder.bookings ? _toConsumableArray(this.store.tempOrder.bookings) : []
|
|
1283
|
+
});
|
|
1284
|
+
this.persistTempOrder();
|
|
1285
|
+
}
|
|
1234
1286
|
|
|
1235
1287
|
// ─── TempOrder: 创建 & 获取 ───
|
|
1236
1288
|
}, {
|
|
@@ -2282,7 +2334,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2282
2334
|
}, {
|
|
2283
2335
|
key: "restoreOrder",
|
|
2284
2336
|
value: function restoreOrder() {
|
|
2285
|
-
var _this$store$
|
|
2337
|
+
var _this$store$discount16, _this$store$discount17;
|
|
2286
2338
|
this.logInfo('restoreOrder start', {});
|
|
2287
2339
|
var freshTempOrder = this.createDefaultTempOrderInstance();
|
|
2288
2340
|
this.ensureExternalSaleNumber(freshTempOrder);
|
|
@@ -2290,8 +2342,8 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2290
2342
|
this.store.summary = createEmptySummary();
|
|
2291
2343
|
this.store.lastOrderInfo = undefined;
|
|
2292
2344
|
this.store.syncState = undefined;
|
|
2293
|
-
void ((_this$store$
|
|
2294
|
-
void ((_this$store$
|
|
2345
|
+
void ((_this$store$discount16 = this.store.discount) === null || _this$store$discount16 === void 0 ? void 0 : _this$store$discount16.setOriginalDiscountList([]));
|
|
2346
|
+
void ((_this$store$discount17 = this.store.discount) === null || _this$store$discount17 === void 0 ? void 0 : _this$store$discount17.setDiscountList([]));
|
|
2295
2347
|
this.persistTempOrder();
|
|
2296
2348
|
return freshTempOrder;
|
|
2297
2349
|
}
|
|
@@ -3114,11 +3166,11 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3114
3166
|
}, {
|
|
3115
3167
|
key: "shouldSkipDiscountCalculation",
|
|
3116
3168
|
value: function shouldSkipDiscountCalculation(tempOrder) {
|
|
3117
|
-
var _this$store$
|
|
3118
|
-
_this$store$
|
|
3169
|
+
var _this$store$discount18,
|
|
3170
|
+
_this$store$discount19,
|
|
3119
3171
|
_this20 = this;
|
|
3120
3172
|
if (this.hasActiveCustomerBoundDiscount) return false;
|
|
3121
|
-
var discountList = ((_this$store$
|
|
3173
|
+
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)) || [];
|
|
3122
3174
|
if (discountList.length > 0) return false;
|
|
3123
3175
|
return !(tempOrder.products || []).some(function (product) {
|
|
3124
3176
|
return _this20.productHasCustomerBoundDiscount(product);
|
|
@@ -5235,7 +5287,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5235
5287
|
var _syncPaymentsToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(params) {
|
|
5236
5288
|
var _this31 = this,
|
|
5237
5289
|
_params$confirmPendin;
|
|
5238
|
-
var tempOrder, needsPaymentNumber, devicePrefix, mappedPayments, shouldConfirmPendingVoucherPayments, effectivePayments, completion, orderPaidPaymentTotal, paymentStatus, paymentSyncIdempotencyToken, submitResult;
|
|
5290
|
+
var tempOrder, needsPaymentNumber, devicePrefix, mappedPayments, shouldConfirmPendingVoucherPayments, effectivePayments, completion, orderPaidPaymentTotal, paymentStatus, paymentSyncIdempotencyToken, submitParams, submitResult;
|
|
5239
5291
|
return _regeneratorRuntime().wrap(function _callee36$(_context39) {
|
|
5240
5292
|
while (1) switch (_context39.prev = _context39.next) {
|
|
5241
5293
|
case 0:
|
|
@@ -5288,8 +5340,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5288
5340
|
case 25:
|
|
5289
5341
|
this.store.syncState = 'submitting';
|
|
5290
5342
|
paymentSyncIdempotencyToken = this.buildPaymentSyncIdempotencyToken(tempOrder, effectivePayments);
|
|
5291
|
-
|
|
5292
|
-
return this.submitTempOrder({
|
|
5343
|
+
submitParams = {
|
|
5293
5344
|
payments: effectivePayments,
|
|
5294
5345
|
paymentStatus: paymentStatus,
|
|
5295
5346
|
smallTicketDataFlag: params.smallTicketDataFlag,
|
|
@@ -5302,13 +5353,28 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5302
5353
|
});
|
|
5303
5354
|
return nextPayload;
|
|
5304
5355
|
}
|
|
5305
|
-
}
|
|
5306
|
-
|
|
5307
|
-
|
|
5356
|
+
};
|
|
5357
|
+
if (!(params.checkoutSyncTaskEnabled === false)) {
|
|
5358
|
+
_context39.next = 34;
|
|
5359
|
+
break;
|
|
5360
|
+
}
|
|
5361
|
+
_context39.next = 31;
|
|
5362
|
+
return this.submitTempOrderAsync(submitParams);
|
|
5363
|
+
case 31:
|
|
5364
|
+
_context39.t1 = _context39.sent;
|
|
5365
|
+
_context39.next = 37;
|
|
5366
|
+
break;
|
|
5367
|
+
case 34:
|
|
5368
|
+
_context39.next = 36;
|
|
5369
|
+
return this.submitTempOrder(submitParams);
|
|
5370
|
+
case 36:
|
|
5371
|
+
_context39.t1 = _context39.sent;
|
|
5372
|
+
case 37:
|
|
5373
|
+
submitResult = _context39.t1;
|
|
5308
5374
|
return _context39.abrupt("return", _objectSpread(_objectSpread({}, completion), {}, {
|
|
5309
5375
|
submitResult: submitResult
|
|
5310
5376
|
}));
|
|
5311
|
-
case
|
|
5377
|
+
case 39:
|
|
5312
5378
|
case "end":
|
|
5313
5379
|
return _context39.stop();
|
|
5314
5380
|
}
|
|
@@ -5322,6 +5388,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5322
5388
|
}, {
|
|
5323
5389
|
key: "createOrder",
|
|
5324
5390
|
value: function createOrder(params) {
|
|
5391
|
+
var _this32 = this;
|
|
5325
5392
|
var order = _objectSpread({
|
|
5326
5393
|
type: (params === null || params === void 0 ? void 0 : params.type) || 'appointment_booking',
|
|
5327
5394
|
// 要从外面拿,virtual
|
|
@@ -5333,11 +5400,13 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5333
5400
|
schedule_date: '',
|
|
5334
5401
|
is_deposit: 0,
|
|
5335
5402
|
relation_products: [],
|
|
5336
|
-
relation_forms: []
|
|
5403
|
+
relation_forms: [],
|
|
5404
|
+
business_code: params === null || params === void 0 ? void 0 : params.business_code
|
|
5337
5405
|
}, (params === null || params === void 0 ? void 0 : params.extraData) || {});
|
|
5338
5406
|
var is_deposit = 0; // 是否存在定金,0 不存在,1 存在
|
|
5339
5407
|
if (params.cartItems.length > 0) {
|
|
5340
5408
|
params.cartItems.forEach(function (item) {
|
|
5409
|
+
var _params$extraData;
|
|
5341
5410
|
if (!item._origin.duration) {
|
|
5342
5411
|
var _generateDuration = generateDuration(item),
|
|
5343
5412
|
duration = _generateDuration.duration,
|
|
@@ -5349,6 +5418,11 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5349
5418
|
var discountList = getAllDiscountList(item);
|
|
5350
5419
|
item._origin.product.discount_list = discountList;
|
|
5351
5420
|
|
|
5421
|
+
// 为预约补齐 holder 信息
|
|
5422
|
+
if (params !== null && params !== void 0 && (_params$extraData = params.extraData) !== null && _params$extraData !== void 0 && _params$extraData.is_add_holder_info) {
|
|
5423
|
+
ensureCartItemOriginHolder(item, _this32.window);
|
|
5424
|
+
}
|
|
5425
|
+
|
|
5352
5426
|
// 购物车是否为普通商品
|
|
5353
5427
|
if (isNormalProduct(item._origin)) {
|
|
5354
5428
|
var _order$relation_forms;
|
|
@@ -5792,8 +5866,8 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5792
5866
|
key: "hydrateTempOrderFromRecord",
|
|
5793
5867
|
value: (function () {
|
|
5794
5868
|
var _hydrateTempOrderFromRecord = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(record, options) {
|
|
5795
|
-
var _this$store$
|
|
5796
|
-
var sourceRaw, identityReadySource, normalizedCollections, raw, hasIdentityChanges, identityLogMetadata, hasIdentityWarnings, nextTempOrder, sourceLastOrderInfo, isDraftOrder, syntheticIdentityOptions, rawSummary, summarySurcharges, hadSyntheticDraftOrderId, hydratedEditDiscounts, currentDiscounts, currentScanDiscounts, hydratedDiscountIds, retainedScanDiscounts, nextDiscounts, shouldSkipEmptyDiscountSync, _this$store$
|
|
5869
|
+
var _this$store$discount20;
|
|
5870
|
+
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;
|
|
5797
5871
|
return _regeneratorRuntime().wrap(function _callee44$(_context47) {
|
|
5798
5872
|
while (1) switch (_context47.prev = _context47.next) {
|
|
5799
5873
|
case 0:
|
|
@@ -5852,7 +5926,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5852
5926
|
this.store.syncState = 'local';
|
|
5853
5927
|
}
|
|
5854
5928
|
hydratedEditDiscounts = this.collectHydratedEditDiscounts(nextTempOrder.products);
|
|
5855
|
-
currentDiscounts = typeof ((_this$store$
|
|
5929
|
+
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() || [] : [];
|
|
5856
5930
|
currentScanDiscounts = currentDiscounts.filter(function (discount) {
|
|
5857
5931
|
return discount === null || discount === void 0 ? void 0 : discount.isScan;
|
|
5858
5932
|
});
|
|
@@ -5870,10 +5944,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5870
5944
|
}
|
|
5871
5945
|
OrderModule.populateSavedAmounts(nextTempOrder.products, nextDiscounts);
|
|
5872
5946
|
_context47.next = 29;
|
|
5873
|
-
return (_this$store$
|
|
5947
|
+
return (_this$store$discount21 = this.store.discount) === null || _this$store$discount21 === void 0 ? void 0 : _this$store$discount21.setOriginalDiscountList(nextDiscounts);
|
|
5874
5948
|
case 29:
|
|
5875
5949
|
_context47.next = 31;
|
|
5876
|
-
return (_this$store$
|
|
5950
|
+
return (_this$store$discount22 = this.store.discount) === null || _this$store$discount22 === void 0 ? void 0 : _this$store$discount22.setDiscountList(nextDiscounts);
|
|
5877
5951
|
case 31:
|
|
5878
5952
|
if (!(options !== null && options !== void 0 && options.recalcOnHydrate)) {
|
|
5879
5953
|
_context47.next = 34;
|
|
@@ -6006,7 +6080,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
6006
6080
|
}, {
|
|
6007
6081
|
key: "normalizeTempOrderForRuntime",
|
|
6008
6082
|
value: function normalizeTempOrderForRuntime(raw, options) {
|
|
6009
|
-
var
|
|
6083
|
+
var _this33 = this;
|
|
6010
6084
|
var runtimeRaw = this.withoutSyntheticDraftOrderIdForRuntime(raw);
|
|
6011
6085
|
var nextTempOrder = _objectSpread(_objectSpread({}, this.createDefaultTempOrderInstance()), runtimeRaw || {});
|
|
6012
6086
|
// ES 列表详情使用 id 表示订单主键;OS 详情态统一依赖 order_id 驱动操作按钮。
|
|
@@ -6030,12 +6104,12 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
6030
6104
|
nextTempOrder.holder = raw.holder && _typeof(raw.holder) === 'object' ? _objectSpread({}, raw.holder) : null;
|
|
6031
6105
|
var rawProducts = Array.isArray(raw.products) ? raw.products : [];
|
|
6032
6106
|
nextTempOrder.products = rawProducts.length > 0 ? rawProducts.map(function (p) {
|
|
6033
|
-
return
|
|
6107
|
+
return _this33.normalizeHydratedOrderProduct(p, {
|
|
6034
6108
|
makeEditMark: options === null || options === void 0 ? void 0 : options.makeEditMark
|
|
6035
6109
|
});
|
|
6036
6110
|
}) : [];
|
|
6037
6111
|
nextTempOrder.bookings = Array.isArray(raw.bookings) ? raw.bookings.map(function (b) {
|
|
6038
|
-
var booking =
|
|
6112
|
+
var booking = _this33.normalizeHydratedBookingHolder(b || {});
|
|
6039
6113
|
return _objectSpread(_objectSpread({}, booking), {}, {
|
|
6040
6114
|
is_all: normalizeBookingIsAll(booking),
|
|
6041
6115
|
sub_type: normalizeBookingSubType(booking)
|
|
@@ -6222,7 +6296,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
6222
6296
|
}, {
|
|
6223
6297
|
key: "normalizeHydratedOrderProduct",
|
|
6224
6298
|
value: function normalizeHydratedOrderProduct(product, options) {
|
|
6225
|
-
var
|
|
6299
|
+
var _this34 = this;
|
|
6226
6300
|
var row = _objectSpread({}, product || {});
|
|
6227
6301
|
if (row.num === undefined && row.product_quantity !== undefined) {
|
|
6228
6302
|
row.num = row.product_quantity;
|
|
@@ -6230,7 +6304,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
6230
6304
|
var productSku = ensureProductSku(row);
|
|
6231
6305
|
row.product_sku = _objectSpread(_objectSpread({}, productSku), {}, {
|
|
6232
6306
|
option: normalizeProductSkuOptions(productSku.option.map(function (optionItem) {
|
|
6233
|
-
return
|
|
6307
|
+
return _this34.normalizeHydratedProductOptionItem(optionItem || {});
|
|
6234
6308
|
}))
|
|
6235
6309
|
});
|
|
6236
6310
|
delete row["product_".concat('option', "_item")];
|
|
@@ -165,6 +165,8 @@ export interface OrderCustomerChangePayload {
|
|
|
165
165
|
}
|
|
166
166
|
export interface OrderScanCodeResult {
|
|
167
167
|
isAvailable: boolean;
|
|
168
|
+
/** 卡券已加入当前订单折扣列表,但不一定能立即应用。 */
|
|
169
|
+
isAccepted?: boolean;
|
|
168
170
|
discountList: Discount[];
|
|
169
171
|
scannedDiscountList: Discount[];
|
|
170
172
|
type: 'server' | 'clientCalc';
|
|
@@ -394,6 +396,7 @@ export interface CommitOrderParams {
|
|
|
394
396
|
type: 'virtual' | 'appointment_booking';
|
|
395
397
|
platform?: string;
|
|
396
398
|
extraData?: Record<string, any>;
|
|
399
|
+
business_code?: string;
|
|
397
400
|
};
|
|
398
401
|
}
|
|
399
402
|
export interface OrderSubmitBooking {
|
|
@@ -569,6 +572,12 @@ export interface SyncPaymentsToOrderParams {
|
|
|
569
572
|
payments: OrderPaymentSource[];
|
|
570
573
|
paymentStatus?: SubmitSalesOrderParams['query']['payment_status'];
|
|
571
574
|
submitWhenPaid?: boolean;
|
|
575
|
+
/**
|
|
576
|
+
* Whether the checkout should be queued as the local `sync_sales` task.
|
|
577
|
+
* Defaults to true to preserve the WebPOS retry path. Set to false when
|
|
578
|
+
* the caller must wait for the cloud checkout response before proceeding.
|
|
579
|
+
*/
|
|
580
|
+
checkoutSyncTaskEnabled?: boolean;
|
|
572
581
|
smallTicketDataFlag?: number;
|
|
573
582
|
businessCode?: string;
|
|
574
583
|
channel?: string;
|
|
@@ -731,6 +740,8 @@ export interface OrderModuleAPI {
|
|
|
731
740
|
setEnableTempOrderPersist: (enabled: boolean) => void;
|
|
732
741
|
/** 是否允许 saveDraft 写入 IndexedDB 草稿。 */
|
|
733
742
|
isTempOrderPersistEnabled: () => boolean;
|
|
743
|
+
/** 提交 tempOrder 变更并触发 `{moduleName}:changed` 事件 */
|
|
744
|
+
notifyTempOrderChanged: () => void;
|
|
734
745
|
submitTempOrder: <T = any>(params?: {
|
|
735
746
|
cacheId?: string;
|
|
736
747
|
platform?: string;
|
|
@@ -15,6 +15,7 @@ export interface OrderProductsDepositSummary {
|
|
|
15
15
|
deposit_policy_ids: number[];
|
|
16
16
|
hasDeposit: boolean;
|
|
17
17
|
}
|
|
18
|
+
import type { WindowPlugin } from '../../plugins';
|
|
18
19
|
/**
|
|
19
20
|
* 把"含 option 的主商品单价"与 bundle 合成"单行 composite 单价"。
|
|
20
21
|
*
|
|
@@ -177,6 +178,15 @@ export declare const mergeRelationForms: (relationForms: {
|
|
|
177
178
|
form_id: number;
|
|
178
179
|
form_record_ids: number[];
|
|
179
180
|
}[];
|
|
181
|
+
export interface CartOrderHolder {
|
|
182
|
+
customer_id?: number;
|
|
183
|
+
form_id: number | string;
|
|
184
|
+
form_record: (number | string)[] | null;
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* 为购物车行补齐订单所需的 holder 信息(与 cartAccount 结构保持一致)
|
|
188
|
+
*/
|
|
189
|
+
export declare function ensureCartItemOriginHolder(cartItem: CartItem, window?: WindowPlugin): void;
|
|
180
190
|
export declare const getAllDiscountList: (cartItem: CartItem) => any;
|
|
181
191
|
export { createUuidV4 };
|
|
182
192
|
export declare function isTempOrder(data: any): data is OrderTempOrder;
|
|
@@ -20,6 +20,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
20
20
|
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; }
|
|
21
21
|
import dayjs from "dayjs";
|
|
22
22
|
import Decimal from 'decimal.js';
|
|
23
|
+
import { getProductHolderConfig } from "../Holder/utils";
|
|
23
24
|
import { buildProductLineFingerprint, createEmptySummary } from "../../solution/ScanOrder/utils";
|
|
24
25
|
import { createUuidV4 } from "./utils/orderCollectionIdentity";
|
|
25
26
|
/**
|
|
@@ -744,10 +745,41 @@ export var mergeRelationForms = function mergeRelationForms(relationForms) {
|
|
|
744
745
|
return item.form_record_ids.length > 0;
|
|
745
746
|
}); // 过滤掉没有有效记录的表单
|
|
746
747
|
};
|
|
748
|
+
function getCustomerIdFromStorage(window) {
|
|
749
|
+
try {
|
|
750
|
+
var _window$getLocalStora;
|
|
751
|
+
var customer = JSON.parse((window === null || window === void 0 || (_window$getLocalStora = window.getLocalStorage) === null || _window$getLocalStora === void 0 ? void 0 : _window$getLocalStora.call(window, 'customer')) || '{}');
|
|
752
|
+
var customerId = Number(customer === null || customer === void 0 ? void 0 : customer.id);
|
|
753
|
+
return Number.isFinite(customerId) && customerId > 0 ? customerId : undefined;
|
|
754
|
+
} catch (_unused) {
|
|
755
|
+
return undefined;
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
/**
|
|
760
|
+
* 为购物车行补齐订单所需的 holder 信息(与 cartAccount 结构保持一致)
|
|
761
|
+
*/
|
|
762
|
+
export function ensureCartItemOriginHolder(cartItem, window) {
|
|
763
|
+
var _cartItem$_origin, _cartItem$_productIni;
|
|
764
|
+
if (cartItem !== null && cartItem !== void 0 && (_cartItem$_origin = cartItem._origin) !== null && _cartItem$_origin !== void 0 && _cartItem$_origin.holder) {
|
|
765
|
+
return;
|
|
766
|
+
}
|
|
767
|
+
var holderConfig = getProductHolderConfig((_cartItem$_productIni = cartItem === null || cartItem === void 0 ? void 0 : cartItem._productInit) !== null && _cartItem$_productIni !== void 0 ? _cartItem$_productIni : cartItem === null || cartItem === void 0 ? void 0 : cartItem._productOrigin);
|
|
768
|
+
var formRecordId = cartItem === null || cartItem === void 0 ? void 0 : cartItem.holder_id;
|
|
769
|
+
if (!(holderConfig !== null && holderConfig !== void 0 && holderConfig.resource_id) || formRecordId == null) {
|
|
770
|
+
return;
|
|
771
|
+
}
|
|
772
|
+
cartItem._origin.holder = {
|
|
773
|
+
customer_id: getCustomerIdFromStorage(window),
|
|
774
|
+
form_id: holderConfig.resource_id,
|
|
775
|
+
form_record: [formRecordId]
|
|
776
|
+
};
|
|
777
|
+
}
|
|
778
|
+
;
|
|
747
779
|
export var getAllDiscountList = function getAllDiscountList(cartItem) {
|
|
748
|
-
var _cartItem$
|
|
749
|
-
var discountList = (cartItem === null || cartItem === void 0 || (_cartItem$
|
|
750
|
-
((cartItem === null || cartItem === void 0 || (_cartItem$
|
|
780
|
+
var _cartItem$_origin2, _cartItem$_origin3;
|
|
781
|
+
var discountList = (cartItem === null || cartItem === void 0 || (_cartItem$_origin2 = cartItem._origin) === null || _cartItem$_origin2 === void 0 || (_cartItem$_origin2 = _cartItem$_origin2.product) === null || _cartItem$_origin2 === void 0 ? void 0 : _cartItem$_origin2.discount_list) || [];
|
|
782
|
+
((cartItem === null || cartItem === void 0 || (_cartItem$_origin3 = cartItem._origin) === null || _cartItem$_origin3 === void 0 || (_cartItem$_origin3 = _cartItem$_origin3.product) === null || _cartItem$_origin3 === void 0 ? void 0 : _cartItem$_origin3.product_bundle) || []).forEach(function (item) {
|
|
751
783
|
discountList = [].concat(_toConsumableArray(discountList), _toConsumableArray((item === null || item === void 0 ? void 0 : item.discount_list) || []));
|
|
752
784
|
item.discount_list = undefined;
|
|
753
785
|
});
|
|
@@ -21,11 +21,13 @@ export declare class WalletPassPaymentImpl implements WalletPassPayment {
|
|
|
21
21
|
private emitEvent;
|
|
22
22
|
private publishWalletAssetsState;
|
|
23
23
|
private recalculateWalletAssets;
|
|
24
|
+
/** 获取当前缓存中所有支付类 Wallet 资产的扫码 code。 */
|
|
25
|
+
private getSearchedWalletAssetCodes;
|
|
24
26
|
/**
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
+
* 用订单重算接口返回的数据更新扫码 Wallet 缓存。
|
|
28
|
+
* 接口暂时缺失某个扫码 code 时继续保留旧值,避免列表闪空。
|
|
27
29
|
*/
|
|
28
|
-
private
|
|
30
|
+
private syncSearchedWalletAssets;
|
|
29
31
|
/**
|
|
30
32
|
* 生成钱包API默认参数
|
|
31
33
|
* 根据业务数据生成标准的钱包API参数,并存储在模块中
|
|
@@ -67,6 +69,11 @@ export declare class WalletPassPaymentImpl implements WalletPassPayment {
|
|
|
67
69
|
noApplicableVoucher: any[];
|
|
68
70
|
products: any[];
|
|
69
71
|
}>;
|
|
72
|
+
/**
|
|
73
|
+
* 商品或订单金额变化后,使用聚合接口一次重算已选与剩余 WalletPass。
|
|
74
|
+
* Walk-In 不发送 customer_id;会员才携带真实 customer_id。
|
|
75
|
+
*/
|
|
76
|
+
private aggregateRecalculateWalletAssetsAsync;
|
|
70
77
|
getWalletPassRecommendListAsync(params: WalletDeductionRecommendParams): Promise<WalletRecommendItem[]>;
|
|
71
78
|
formatWalletPassList2PreparePayments(list: WalletRecommendItem[]): {
|
|
72
79
|
voucher_id: number;
|