@pisell/pisellos 2.2.260 → 2.2.262
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/model/strategy/adapter/dataVariant/adapter.d.ts +1 -0
- package/dist/model/strategy/adapter/dataVariant/adapter.js +15 -0
- package/dist/model/strategy/adapter/dataVariant/evaluator.d.ts +2 -0
- package/dist/model/strategy/adapter/dataVariant/evaluator.js +25 -0
- package/dist/model/strategy/adapter/dataVariant/examples.js +1 -6
- package/dist/model/strategy/adapter/dataVariant/type.d.ts +2 -0
- package/dist/model/strategy/adapter/promotion/index.js +0 -9
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +23 -13
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +2 -1
- package/dist/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +1 -1
- package/dist/modules/BookingContext/utils/cacheItemToBookingInput.js +32 -1
- package/dist/modules/Discount/index.d.ts +5 -2
- package/dist/modules/Discount/index.js +30 -7
- package/dist/modules/Discount/types.d.ts +4 -0
- package/dist/modules/Order/index.d.ts +45 -2
- package/dist/modules/Order/index.js +1552 -926
- package/dist/modules/Order/types.d.ts +36 -2
- package/dist/modules/Order/utils/bundleDiscountHydration.d.ts +5 -0
- package/dist/modules/Order/utils/bundleDiscountHydration.js +144 -0
- package/dist/modules/Order/utils/orderCollectionIdentity.d.ts +53 -0
- package/dist/modules/Order/utils/orderCollectionIdentity.js +405 -0
- package/dist/modules/Order/utils.d.ts +8 -3
- package/dist/modules/Order/utils.js +136 -56
- package/dist/modules/Rules/index.d.ts +4 -10
- package/dist/modules/Rules/index.js +63 -12
- package/dist/modules/Rules/types.d.ts +12 -2
- package/dist/modules/SalesSummary/index.d.ts +7 -3
- package/dist/modules/SalesSummary/index.js +67 -39
- package/dist/modules/SalesSummary/types.d.ts +1 -0
- package/dist/modules/SalesSummary/utils.js +2 -1
- package/dist/modules/SurchargeList/index.d.ts +6 -4
- package/dist/modules/SurchargeList/index.js +62 -39
- package/dist/modules/SurchargeList/types.d.ts +6 -2
- package/dist/server/index.d.ts +8 -0
- package/dist/server/index.js +1365 -911
- package/dist/server/modules/order/index.d.ts +32 -7
- package/dist/server/modules/order/index.js +551 -464
- package/dist/server/modules/order/types.d.ts +4 -0
- package/dist/server/modules/products/index.d.ts +5 -1
- package/dist/server/modules/products/index.js +384 -315
- package/dist/server/modules/products/types.d.ts +4 -0
- package/dist/solution/BaseSales/index.d.ts +42 -2
- package/dist/solution/BaseSales/index.js +1416 -775
- package/dist/solution/BaseSales/types.d.ts +7 -1
- package/dist/solution/BaseSales/types.js +3 -2
- package/dist/solution/BaseSales/utils/cartPromotion.js +19 -7
- package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +3 -3
- package/dist/solution/BaseSales/utils/parseSalesResponse.js +6 -8
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +20 -4
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +8 -0
- package/dist/solution/BookingTicket/index.js +212 -31
- package/dist/solution/ShopDiscount/index.js +15 -14
- package/lib/model/strategy/adapter/dataVariant/adapter.d.ts +1 -0
- package/lib/model/strategy/adapter/dataVariant/adapter.js +10 -0
- package/lib/model/strategy/adapter/dataVariant/evaluator.d.ts +2 -0
- package/lib/model/strategy/adapter/dataVariant/evaluator.js +20 -1
- package/lib/model/strategy/adapter/dataVariant/examples.js +0 -2
- package/lib/model/strategy/adapter/dataVariant/type.d.ts +2 -0
- package/lib/model/strategy/adapter/promotion/index.js +0 -49
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +16 -1
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +1 -0
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +1 -1
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +23 -2
- package/lib/modules/Discount/index.d.ts +5 -2
- package/lib/modules/Discount/index.js +23 -3
- package/lib/modules/Discount/types.d.ts +4 -0
- package/lib/modules/Order/index.d.ts +45 -2
- package/lib/modules/Order/index.js +720 -116
- package/lib/modules/Order/types.d.ts +36 -2
- package/lib/modules/Order/utils/bundleDiscountHydration.d.ts +5 -0
- package/lib/modules/Order/utils/bundleDiscountHydration.js +139 -0
- package/lib/modules/Order/utils/orderCollectionIdentity.d.ts +53 -0
- package/lib/modules/Order/utils/orderCollectionIdentity.js +415 -0
- package/lib/modules/Order/utils.d.ts +8 -3
- package/lib/modules/Order/utils.js +104 -18
- package/lib/modules/Rules/index.d.ts +4 -10
- package/lib/modules/Rules/index.js +61 -9
- package/lib/modules/Rules/types.d.ts +12 -2
- package/lib/modules/SalesSummary/index.d.ts +7 -3
- package/lib/modules/SalesSummary/index.js +28 -11
- package/lib/modules/SalesSummary/types.d.ts +1 -0
- package/lib/modules/SalesSummary/utils.js +2 -0
- package/lib/modules/SurchargeList/index.d.ts +6 -4
- package/lib/modules/SurchargeList/index.js +41 -21
- package/lib/modules/SurchargeList/types.d.ts +6 -2
- package/lib/server/index.d.ts +8 -0
- package/lib/server/index.js +336 -11
- package/lib/server/modules/order/index.d.ts +32 -7
- package/lib/server/modules/order/index.js +298 -189
- package/lib/server/modules/order/types.d.ts +4 -0
- package/lib/server/modules/products/index.d.ts +5 -1
- package/lib/server/modules/products/index.js +21 -0
- package/lib/server/modules/products/types.d.ts +4 -0
- package/lib/solution/BaseSales/index.d.ts +42 -2
- package/lib/solution/BaseSales/index.js +535 -108
- package/lib/solution/BaseSales/types.d.ts +7 -1
- package/lib/solution/BaseSales/types.js +2 -1
- package/lib/solution/BaseSales/utils/cartPromotion.js +13 -1
- package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +3 -3
- package/lib/solution/BaseSales/utils/parseSalesResponse.js +4 -5
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +14 -6
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +8 -0
- package/lib/solution/BookingTicket/index.js +134 -8
- package/lib/solution/ShopDiscount/index.js +2 -1
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var _excluded = ["id"],
|
|
2
2
|
_excluded2 = ["product_id"],
|
|
3
3
|
_excluded3 = ["product_id"];
|
|
4
|
-
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; } } }; }
|
|
5
4
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
5
|
+
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; } } }; }
|
|
6
6
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
7
7
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
8
8
|
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
@@ -49,6 +49,7 @@ import { buildNormalProductCacheItemFromOrderLine as buildNormalProductCacheItem
|
|
|
49
49
|
import { buildProductOptionStringFromOrderLine } from "../../modules/BookingContext/utils/orderLineDisplay";
|
|
50
50
|
import { applyBookingsStatus, applyChildBookingStatus, resolveScheduleId, resolveStatusAfterTransition, restoreBookingsStatus, restoreChildBookingStatus } from "./utils/bookingStatus";
|
|
51
51
|
import { resolveBestAddTimePlan as _resolveBestAddTimePlan } from "./utils/resolveBestAddTimePlan";
|
|
52
|
+
import { createUuidV4 } from "../../modules/Order/utils";
|
|
52
53
|
var OPEN_DATA_SECTION_CODES = ['sale', 'reservation', 'fulfillment', 'menu', 'workflow'];
|
|
53
54
|
var OPEN_DATA_CACHE_TTL = 5 * 60 * 1000;
|
|
54
55
|
|
|
@@ -548,7 +549,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
548
549
|
key: "scanPromotionCode",
|
|
549
550
|
value: function () {
|
|
550
551
|
var _scanPromotionCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(code, customerId) {
|
|
551
|
-
var raw;
|
|
552
|
+
var raw, scannedList, extractedCustomerId, hasOrderCustomer, tempOrder;
|
|
552
553
|
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
553
554
|
while (1) switch (_context7.prev = _context7.next) {
|
|
554
555
|
case 0:
|
|
@@ -562,26 +563,42 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
562
563
|
return this.store.order.scanCode(code, customerId);
|
|
563
564
|
case 4:
|
|
564
565
|
raw = _context7.sent;
|
|
565
|
-
|
|
566
|
+
scannedList = raw.scannedDiscountList || [];
|
|
567
|
+
extractedCustomerId = this.getDiscountCustomerId(scannedList);
|
|
568
|
+
hasOrderCustomer = Boolean(this.store.order.getOrderCustomer()); // 缺 Holder 等场景 isAvailable=false,但仍需把 Pass 归属客户带入订单,供 Holder 弹窗使用。
|
|
569
|
+
if (!(!hasOrderCustomer && extractedCustomerId)) {
|
|
566
570
|
_context7.next = 11;
|
|
567
571
|
break;
|
|
568
572
|
}
|
|
569
|
-
_context7.next =
|
|
570
|
-
return this.hydrateOrderCustomerFromScanDiscounts(
|
|
571
|
-
case
|
|
572
|
-
|
|
573
|
+
_context7.next = 11;
|
|
574
|
+
return this.hydrateOrderCustomerFromScanDiscounts(scannedList);
|
|
575
|
+
case 11:
|
|
576
|
+
if (!raw.isAvailable) {
|
|
577
|
+
_context7.next = 18;
|
|
578
|
+
break;
|
|
579
|
+
}
|
|
580
|
+
_context7.next = 14;
|
|
573
581
|
return this.store.order.recalculateSummary({
|
|
574
582
|
createIfMissing: true
|
|
575
583
|
});
|
|
576
|
-
case
|
|
584
|
+
case 14:
|
|
577
585
|
this.store.order.persistTempOrder();
|
|
578
|
-
|
|
586
|
+
tempOrder = this.store.order.ensureTempOrder();
|
|
587
|
+
_context7.next = 18;
|
|
588
|
+
return this.effectsEmit('onDiscountApplied', {
|
|
589
|
+
productList: tempOrder.products || [],
|
|
590
|
+
discountList: this.store.order.getDiscountList(),
|
|
591
|
+
selectedDiscountList: tempOrder.discount_list || [],
|
|
592
|
+
tempOrder: tempOrder
|
|
593
|
+
});
|
|
594
|
+
case 18:
|
|
579
595
|
return _context7.abrupt("return", {
|
|
580
596
|
isAvailable: raw.isAvailable,
|
|
581
597
|
type: raw.type,
|
|
582
|
-
unavailableReason: raw.unavailableReason
|
|
598
|
+
unavailableReason: raw.unavailableReason,
|
|
599
|
+
scannedDiscountList: raw.scannedDiscountList
|
|
583
600
|
});
|
|
584
|
-
case
|
|
601
|
+
case 19:
|
|
585
602
|
case "end":
|
|
586
603
|
return _context7.stop();
|
|
587
604
|
}
|
|
@@ -640,12 +657,22 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
640
657
|
}, {
|
|
641
658
|
key: "getDiscountCustomerId",
|
|
642
659
|
value: function getDiscountCustomerId(discounts) {
|
|
643
|
-
var
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
660
|
+
var _iterator = _createForOfIteratorHelper(discounts),
|
|
661
|
+
_step;
|
|
662
|
+
try {
|
|
663
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
664
|
+
var item = _step.value;
|
|
665
|
+
var topLevelId = Number(item.customer_id);
|
|
666
|
+
if (Number.isFinite(topLevelId) && topLevelId > 0) {
|
|
667
|
+
return topLevelId;
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
} catch (err) {
|
|
671
|
+
_iterator.e(err);
|
|
672
|
+
} finally {
|
|
673
|
+
_iterator.f();
|
|
674
|
+
}
|
|
675
|
+
return null;
|
|
649
676
|
}
|
|
650
677
|
}, {
|
|
651
678
|
key: "resolveCustomerByDiscountCustomerId",
|
|
@@ -1500,7 +1527,15 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1500
1527
|
void this.store.order.recalculateSummary({
|
|
1501
1528
|
createIfMissing: true
|
|
1502
1529
|
}).then(function () {
|
|
1503
|
-
|
|
1530
|
+
var _discountModule$getDi;
|
|
1531
|
+
var tempOrder = _this3.store.order.ensureTempOrder();
|
|
1532
|
+
_this3.store.order.persistTempOrder();
|
|
1533
|
+
return _this3.effectsEmit('onDiscountApplied', {
|
|
1534
|
+
productList: tempOrder.products || [],
|
|
1535
|
+
discountList: (discountModule === null || discountModule === void 0 || (_discountModule$getDi = discountModule.getDiscountList) === null || _discountModule$getDi === void 0 ? void 0 : _discountModule$getDi.call(discountModule)) || [],
|
|
1536
|
+
selectedDiscountList: tempOrder.discount_list || [],
|
|
1537
|
+
tempOrder: tempOrder
|
|
1538
|
+
});
|
|
1504
1539
|
}).catch(function (error) {
|
|
1505
1540
|
console.error('Failed to recalculate summary after clearing customer:', error);
|
|
1506
1541
|
});
|
|
@@ -2467,7 +2502,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2467
2502
|
var _addAddTimeProductsToBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(input) {
|
|
2468
2503
|
var _this7 = this,
|
|
2469
2504
|
_input$bookingPatch;
|
|
2470
|
-
var bookingUid, orderLines, coveredMinutes, bookingTimePatch, result,
|
|
2505
|
+
var bookingUid, orderLines, coveredMinutes, bookingTimePatch, result, _iterator2, _step2, line;
|
|
2471
2506
|
return _regeneratorRuntime().wrap(function _callee30$(_context30) {
|
|
2472
2507
|
while (1) switch (_context30.prev = _context30.next) {
|
|
2473
2508
|
case 0:
|
|
@@ -2507,15 +2542,15 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2507
2542
|
}));
|
|
2508
2543
|
case 11:
|
|
2509
2544
|
result = [];
|
|
2510
|
-
|
|
2545
|
+
_iterator2 = _createForOfIteratorHelper(orderLines);
|
|
2511
2546
|
_context30.prev = 13;
|
|
2512
|
-
|
|
2547
|
+
_iterator2.s();
|
|
2513
2548
|
case 15:
|
|
2514
|
-
if ((
|
|
2549
|
+
if ((_step2 = _iterator2.n()).done) {
|
|
2515
2550
|
_context30.next = 29;
|
|
2516
2551
|
break;
|
|
2517
2552
|
}
|
|
2518
|
-
line =
|
|
2553
|
+
line = _step2.value;
|
|
2519
2554
|
_context30.t0 = result.splice;
|
|
2520
2555
|
_context30.t1 = result;
|
|
2521
2556
|
_context30.t2 = [0, result.length];
|
|
@@ -2536,10 +2571,10 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2536
2571
|
case 31:
|
|
2537
2572
|
_context30.prev = 31;
|
|
2538
2573
|
_context30.t7 = _context30["catch"](13);
|
|
2539
|
-
|
|
2574
|
+
_iterator2.e(_context30.t7);
|
|
2540
2575
|
case 34:
|
|
2541
2576
|
_context30.prev = 34;
|
|
2542
|
-
|
|
2577
|
+
_iterator2.f();
|
|
2543
2578
|
return _context30.finish(34);
|
|
2544
2579
|
case 37:
|
|
2545
2580
|
return _context30.abrupt("return", result);
|
|
@@ -2586,6 +2621,152 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2586
2621
|
}
|
|
2587
2622
|
return setOtherParams;
|
|
2588
2623
|
}()
|
|
2624
|
+
}, {
|
|
2625
|
+
key: "getDeviceTaskPlugin",
|
|
2626
|
+
value: function getDeviceTaskPlugin() {
|
|
2627
|
+
var _app$getApp;
|
|
2628
|
+
var app = this.core.getPlugin('app');
|
|
2629
|
+
return (app === null || app === void 0 || (_app$getApp = app.getApp()) === null || _app$getApp === void 0 ? void 0 : _app$getApp.getPlugin('deviceTask')) || null;
|
|
2630
|
+
}
|
|
2631
|
+
|
|
2632
|
+
// 打印手环,单个或批量都可以
|
|
2633
|
+
}, {
|
|
2634
|
+
key: "handlePrintWristband",
|
|
2635
|
+
value: function () {
|
|
2636
|
+
var _handlePrintWristband = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(params) {
|
|
2637
|
+
var _this$getOrderIdentit;
|
|
2638
|
+
var deviceTask, deviceId, idempotencyKey;
|
|
2639
|
+
return _regeneratorRuntime().wrap(function _callee32$(_context32) {
|
|
2640
|
+
while (1) switch (_context32.prev = _context32.next) {
|
|
2641
|
+
case 0:
|
|
2642
|
+
deviceTask = this.getDeviceTaskPlugin();
|
|
2643
|
+
if (deviceTask !== null && deviceTask !== void 0 && deviceTask.dispatch) {
|
|
2644
|
+
_context32.next = 4;
|
|
2645
|
+
break;
|
|
2646
|
+
}
|
|
2647
|
+
this.logger.addLog({
|
|
2648
|
+
type: 'info',
|
|
2649
|
+
title: '[BookingTicket] handlePrintWristband: deviceTask.dispatch 不可用',
|
|
2650
|
+
metadata: {
|
|
2651
|
+
voucher_ids: Array.isArray(params.voucher_ids) ? params.voucher_ids : [params.voucher_ids]
|
|
2652
|
+
}
|
|
2653
|
+
});
|
|
2654
|
+
return _context32.abrupt("return");
|
|
2655
|
+
case 4:
|
|
2656
|
+
this.logger.addLog({
|
|
2657
|
+
type: 'info',
|
|
2658
|
+
title: '[BookingTicket] handlePrintWristband',
|
|
2659
|
+
metadata: {
|
|
2660
|
+
voucher_ids: Array.isArray(params.voucher_ids) ? params.voucher_ids : [params.voucher_ids]
|
|
2661
|
+
}
|
|
2662
|
+
});
|
|
2663
|
+
_context32.next = 7;
|
|
2664
|
+
return this.getShortNumberOrDeviceId();
|
|
2665
|
+
case 7:
|
|
2666
|
+
deviceId = _context32.sent;
|
|
2667
|
+
idempotencyKey = createUuidV4();
|
|
2668
|
+
deviceTask.dispatch({
|
|
2669
|
+
action: 'print_all',
|
|
2670
|
+
device_id: deviceId,
|
|
2671
|
+
payload: {
|
|
2672
|
+
type: 'WRISTBAND',
|
|
2673
|
+
data: {
|
|
2674
|
+
order_id: (_this$getOrderIdentit = this.getOrderIdentity()) === null || _this$getOrderIdentit === void 0 ? void 0 : _this$getOrderIdentit.orderId,
|
|
2675
|
+
voucher_ids: Array.isArray(params.voucher_ids) ? params.voucher_ids : [params.voucher_ids]
|
|
2676
|
+
}
|
|
2677
|
+
},
|
|
2678
|
+
idempotency_key: idempotencyKey,
|
|
2679
|
+
name: 'PRINT_WRISTBAND',
|
|
2680
|
+
source: 'bookingTicket',
|
|
2681
|
+
source_type: 'handlePrintWristband',
|
|
2682
|
+
source_id: idempotencyKey
|
|
2683
|
+
});
|
|
2684
|
+
case 10:
|
|
2685
|
+
case "end":
|
|
2686
|
+
return _context32.stop();
|
|
2687
|
+
}
|
|
2688
|
+
}, _callee32, this);
|
|
2689
|
+
}));
|
|
2690
|
+
function handlePrintWristband(_x23) {
|
|
2691
|
+
return _handlePrintWristband.apply(this, arguments);
|
|
2692
|
+
}
|
|
2693
|
+
return handlePrintWristband;
|
|
2694
|
+
}() // 触发核销
|
|
2695
|
+
}, {
|
|
2696
|
+
key: "handleRedeem",
|
|
2697
|
+
value: function () {
|
|
2698
|
+
var _handleRedeem = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(params) {
|
|
2699
|
+
var _this$store$order5, _this$store$order5$ge, _this$store$order6, _ref20, _tempOrder$order_id2;
|
|
2700
|
+
var voucherIds, status, voucherIdSet, tempOrder, vouchers, hasUpdatedVoucher, nextVouchers, identity, externalSaleNumber, orderId, orderLookup;
|
|
2701
|
+
return _regeneratorRuntime().wrap(function _callee33$(_context33) {
|
|
2702
|
+
while (1) switch (_context33.prev = _context33.next) {
|
|
2703
|
+
case 0:
|
|
2704
|
+
voucherIds = Array.isArray(params.voucher_ids) ? params.voucher_ids : [];
|
|
2705
|
+
status = params.is_checkin ? 'used' : 'unused';
|
|
2706
|
+
this.logger.addLog({
|
|
2707
|
+
type: 'info',
|
|
2708
|
+
title: '[BookingTicket] handleRedeem',
|
|
2709
|
+
metadata: {
|
|
2710
|
+
voucher_ids: voucherIds,
|
|
2711
|
+
status: status
|
|
2712
|
+
}
|
|
2713
|
+
});
|
|
2714
|
+
voucherIdSet = new Set(voucherIds);
|
|
2715
|
+
tempOrder = (_this$store$order5 = this.store.order) === null || _this$store$order5 === void 0 || (_this$store$order5$ge = _this$store$order5.getTempOrder) === null || _this$store$order5$ge === void 0 ? void 0 : _this$store$order5$ge.call(_this$store$order5);
|
|
2716
|
+
vouchers = (tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.vouchers) || ((_this$store$order6 = this.store.order) === null || _this$store$order6 === void 0 ? void 0 : _this$store$order6.getVouchers()) || [];
|
|
2717
|
+
hasUpdatedVoucher = false;
|
|
2718
|
+
nextVouchers = vouchers.map(function (voucher) {
|
|
2719
|
+
if (!voucherIdSet.has(voucher.voucher_id)) return voucher;
|
|
2720
|
+
hasUpdatedVoucher = true;
|
|
2721
|
+
return _objectSpread(_objectSpread({}, voucher), {}, {
|
|
2722
|
+
status: status
|
|
2723
|
+
});
|
|
2724
|
+
});
|
|
2725
|
+
if (!(tempOrder && hasUpdatedVoucher)) {
|
|
2726
|
+
_context33.next = 11;
|
|
2727
|
+
break;
|
|
2728
|
+
}
|
|
2729
|
+
_context33.next = 11;
|
|
2730
|
+
return this.replaceTempOrder(_objectSpread(_objectSpread({}, tempOrder), {}, {
|
|
2731
|
+
vouchers: nextVouchers
|
|
2732
|
+
}));
|
|
2733
|
+
case 11:
|
|
2734
|
+
this.core.effects.emit("".concat(this.name, ":onVouchersChange"), {});
|
|
2735
|
+
if (!(voucherIds.length === 0)) {
|
|
2736
|
+
_context33.next = 14;
|
|
2737
|
+
break;
|
|
2738
|
+
}
|
|
2739
|
+
return _context33.abrupt("return", {
|
|
2740
|
+
code: 200,
|
|
2741
|
+
status: true,
|
|
2742
|
+
message: '',
|
|
2743
|
+
data: []
|
|
2744
|
+
});
|
|
2745
|
+
case 14:
|
|
2746
|
+
identity = this.getOrderIdentity();
|
|
2747
|
+
externalSaleNumber = (tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.external_sale_number) || (identity === null || identity === void 0 ? void 0 : identity.externalSaleNumber) || undefined;
|
|
2748
|
+
orderId = (_ref20 = (_tempOrder$order_id2 = tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.order_id) !== null && _tempOrder$order_id2 !== void 0 ? _tempOrder$order_id2 : identity === null || identity === void 0 ? void 0 : identity.orderId) !== null && _ref20 !== void 0 ? _ref20 : undefined;
|
|
2749
|
+
orderLookup = externalSaleNumber || orderId || (identity === null || identity === void 0 ? void 0 : identity.orderNumber) || (identity === null || identity === void 0 ? void 0 : identity.shopOrderNumber) || (identity === null || identity === void 0 ? void 0 : identity.shopFullOrderNumber) || undefined;
|
|
2750
|
+
return _context33.abrupt("return", this.request.post('/machinecode/batch', {
|
|
2751
|
+
ids: voucherIds,
|
|
2752
|
+
status: status,
|
|
2753
|
+
order_lookup: orderLookup,
|
|
2754
|
+
order_id: orderId,
|
|
2755
|
+
external_sale_number: externalSaleNumber
|
|
2756
|
+
}, {
|
|
2757
|
+
osServer: true
|
|
2758
|
+
}));
|
|
2759
|
+
case 19:
|
|
2760
|
+
case "end":
|
|
2761
|
+
return _context33.stop();
|
|
2762
|
+
}
|
|
2763
|
+
}, _callee33, this);
|
|
2764
|
+
}));
|
|
2765
|
+
function handleRedeem(_x24) {
|
|
2766
|
+
return _handleRedeem.apply(this, arguments);
|
|
2767
|
+
}
|
|
2768
|
+
return handleRedeem;
|
|
2769
|
+
}()
|
|
2589
2770
|
/**
|
|
2590
2771
|
* 销毁模块:先调用父类(销毁所有 store 内子模块 + emit destroy + super.destroy()),
|
|
2591
2772
|
* 再清理 BookingTicket 自有资源(scan 监听 + scan 内存缓存)。
|
|
@@ -2593,12 +2774,12 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2593
2774
|
}, {
|
|
2594
2775
|
key: "destroy",
|
|
2595
2776
|
value: (function () {
|
|
2596
|
-
var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2777
|
+
var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34() {
|
|
2597
2778
|
var _this$scan;
|
|
2598
|
-
return _regeneratorRuntime().wrap(function
|
|
2599
|
-
while (1) switch (
|
|
2779
|
+
return _regeneratorRuntime().wrap(function _callee34$(_context34) {
|
|
2780
|
+
while (1) switch (_context34.prev = _context34.next) {
|
|
2600
2781
|
case 0:
|
|
2601
|
-
|
|
2782
|
+
_context34.next = 2;
|
|
2602
2783
|
return _get(_getPrototypeOf(BookingTicketImpl.prototype), "destroy", this).call(this);
|
|
2603
2784
|
case 2:
|
|
2604
2785
|
try {
|
|
@@ -2609,9 +2790,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2609
2790
|
scanCache.clear();
|
|
2610
2791
|
case 4:
|
|
2611
2792
|
case "end":
|
|
2612
|
-
return
|
|
2793
|
+
return _context34.stop();
|
|
2613
2794
|
}
|
|
2614
|
-
},
|
|
2795
|
+
}, _callee34, this);
|
|
2615
2796
|
}));
|
|
2616
2797
|
function destroy() {
|
|
2617
2798
|
return _destroy.apply(this, arguments);
|
|
@@ -756,7 +756,7 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
756
756
|
key: "loadPrepareConfig",
|
|
757
757
|
value: function () {
|
|
758
758
|
var _loadPrepareConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(params) {
|
|
759
|
-
var _this$getCustomer2, _this$store$discount7, _this$getDiscountList, _this$store$discount8, _this$store$productLi2, orderId, customerId, goodPassList, scanDiscount, scanDiscountIds, newGoodPassList, newDiscountList, filteredDiscountList, _result3;
|
|
759
|
+
var _this$getCustomer2, _this$store$discount7, _this$getDiscountList, _this$store$discount8, _this$store$productLi2, orderId, customerId, prepareConfigResult, goodPassList, scanDiscount, scanDiscountIds, newGoodPassList, newDiscountList, filteredDiscountList, _result3;
|
|
760
760
|
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
761
761
|
while (1) switch (_context9.prev = _context9.next) {
|
|
762
762
|
case 0:
|
|
@@ -777,7 +777,8 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
777
777
|
order_id: orderId
|
|
778
778
|
} : {}));
|
|
779
779
|
case 5:
|
|
780
|
-
|
|
780
|
+
prepareConfigResult = _context9.sent;
|
|
781
|
+
goodPassList = (prepareConfigResult === null || prepareConfigResult === void 0 ? void 0 : prepareConfigResult.discountList) || [];
|
|
781
782
|
scanDiscount = (_this$getDiscountList = this.getDiscountList()) === null || _this$getDiscountList === void 0 ? void 0 : _this$getDiscountList.filter(function (item) {
|
|
782
783
|
return item.isScan;
|
|
783
784
|
}); // goodPassList 里可能有 scanDiscount 重合的部分,goodPassList 需要剔除
|
|
@@ -789,35 +790,35 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
789
790
|
});
|
|
790
791
|
newDiscountList = [].concat(_toConsumableArray(scanDiscount), _toConsumableArray(newGoodPassList || [])); // 存储原始优惠券列表
|
|
791
792
|
this.store.originalDiscountList = newDiscountList;
|
|
792
|
-
_context9.next =
|
|
793
|
+
_context9.next = 14;
|
|
793
794
|
return (_this$store$discount8 = this.store.discount) === null || _this$store$discount8 === void 0 ? void 0 : _this$store$discount8.setOriginalDiscountList(newDiscountList);
|
|
794
|
-
case
|
|
795
|
+
case 14:
|
|
795
796
|
// 根据当前预约时间过滤优惠券列表
|
|
796
797
|
filteredDiscountList = this.filterDiscountListByBookingTime(newDiscountList, this.store.currentBookingTime);
|
|
797
798
|
this.store.filteredDiscountList = filteredDiscountList;
|
|
798
799
|
this.setDiscountList(filteredDiscountList || []);
|
|
799
800
|
if (!((_this$store$productLi2 = this.store.productList) !== null && _this$store$productLi2 !== void 0 && _this$store$productLi2.length)) {
|
|
800
|
-
_context9.next =
|
|
801
|
+
_context9.next = 21;
|
|
801
802
|
break;
|
|
802
803
|
}
|
|
803
804
|
_result3 = this.calcDiscount(this.store.productList);
|
|
804
|
-
_context9.next =
|
|
805
|
+
_context9.next = 21;
|
|
805
806
|
return this.core.effects.emit("".concat(this.name, ":onLoadPrepareCalcResult"), _result3);
|
|
806
|
-
case
|
|
807
|
-
_context9.next =
|
|
807
|
+
case 21:
|
|
808
|
+
_context9.next = 23;
|
|
808
809
|
return this.core.effects.emit("".concat(this.name, ":onLoadDiscountList"), filteredDiscountList);
|
|
809
|
-
case
|
|
810
|
-
_context9.next =
|
|
810
|
+
case 23:
|
|
811
|
+
_context9.next = 28;
|
|
811
812
|
break;
|
|
812
|
-
case
|
|
813
|
-
_context9.prev =
|
|
813
|
+
case 25:
|
|
814
|
+
_context9.prev = 25;
|
|
814
815
|
_context9.t0 = _context9["catch"](0);
|
|
815
816
|
console.error('[ShopDiscount] 加载准备配置出错:', _context9.t0);
|
|
816
|
-
case
|
|
817
|
+
case 28:
|
|
817
818
|
case "end":
|
|
818
819
|
return _context9.stop();
|
|
819
820
|
}
|
|
820
|
-
}, _callee9, this, [[0,
|
|
821
|
+
}, _callee9, this, [[0, 25]]);
|
|
821
822
|
}));
|
|
822
823
|
function loadPrepareConfig(_x9) {
|
|
823
824
|
return _loadPrepareConfig.apply(this, arguments);
|
|
@@ -47,9 +47,11 @@ var DataVariantAdapter = class {
|
|
|
47
47
|
orderType,
|
|
48
48
|
businessCode,
|
|
49
49
|
customerId,
|
|
50
|
+
availableWalletIds,
|
|
50
51
|
custom
|
|
51
52
|
} = businessData;
|
|
52
53
|
const normalizedCustomerId = this.normalizeCustomerId(customerId);
|
|
54
|
+
const normalizedAvailableWalletIds = this.normalizeNumberArray(availableWalletIds ?? (custom == null ? void 0 : custom.available_wallet_ids));
|
|
53
55
|
const resolvedBusinessCode = businessCode || (custom == null ? void 0 : custom.business_code) || (custom == null ? void 0 : custom.businessCode) || "";
|
|
54
56
|
return {
|
|
55
57
|
entities: {
|
|
@@ -63,6 +65,8 @@ var DataVariantAdapter = class {
|
|
|
63
65
|
// snake_case 与策略配置 field 对齐;customerId 保留兼容旧配置
|
|
64
66
|
customer_id: normalizedCustomerId,
|
|
65
67
|
customerId: normalizedCustomerId,
|
|
68
|
+
available_wallet_ids: normalizedAvailableWalletIds,
|
|
69
|
+
availableWalletIds: normalizedAvailableWalletIds,
|
|
66
70
|
business_code: resolvedBusinessCode
|
|
67
71
|
},
|
|
68
72
|
metadata: {
|
|
@@ -131,6 +135,12 @@ var DataVariantAdapter = class {
|
|
|
131
135
|
const parsed = Number(value);
|
|
132
136
|
return Number.isFinite(parsed) && parsed > 0 ? parsed : void 0;
|
|
133
137
|
}
|
|
138
|
+
normalizeNumberArray(value) {
|
|
139
|
+
if (!Array.isArray(value))
|
|
140
|
+
return [];
|
|
141
|
+
const ids = value.map((item) => Number(item)).filter((item) => Number.isFinite(item) && item > 0);
|
|
142
|
+
return Array.from(new Set(ids));
|
|
143
|
+
}
|
|
134
144
|
};
|
|
135
145
|
var adapter_default = DataVariantAdapter;
|
|
136
146
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -64,6 +64,7 @@ export declare class DataVariantEvaluator {
|
|
|
64
64
|
private createEngine;
|
|
65
65
|
private evaluateScheduleMatch;
|
|
66
66
|
private evaluateMenuMatch;
|
|
67
|
+
private evaluateArrayIntersects;
|
|
67
68
|
private collectScheduleIdsFromStrategies;
|
|
68
69
|
private extractTimePointsFromSchedules;
|
|
69
70
|
private addDateTimePoint;
|
|
@@ -81,6 +82,7 @@ export declare class DataVariantEvaluator {
|
|
|
81
82
|
private flattenConditionRules;
|
|
82
83
|
private isConditionGroup;
|
|
83
84
|
private normalizeNumberArray;
|
|
85
|
+
private normalizeComparableArray;
|
|
84
86
|
private buildProductKey;
|
|
85
87
|
private toNumber;
|
|
86
88
|
}
|
|
@@ -346,7 +346,8 @@ var DataVariantEvaluator = class {
|
|
|
346
346
|
compareValue,
|
|
347
347
|
businessData.scheduleList || []
|
|
348
348
|
),
|
|
349
|
-
menu_match: (fieldValue, compareValue) => this.evaluateMenuMatch(fieldValue, compareValue, menuScopeMap)
|
|
349
|
+
menu_match: (fieldValue, compareValue) => this.evaluateMenuMatch(fieldValue, compareValue, menuScopeMap),
|
|
350
|
+
array_intersects: (fieldValue, compareValue) => this.evaluateArrayIntersects(fieldValue, compareValue)
|
|
350
351
|
};
|
|
351
352
|
return new import_engine.StrategyEngine({
|
|
352
353
|
debug: false,
|
|
@@ -379,6 +380,14 @@ var DataVariantEvaluator = class {
|
|
|
379
380
|
}
|
|
380
381
|
return false;
|
|
381
382
|
}
|
|
383
|
+
evaluateArrayIntersects(fieldValue, compareValue) {
|
|
384
|
+
const fieldValues = this.normalizeComparableArray(fieldValue);
|
|
385
|
+
const compareValues = this.normalizeComparableArray(compareValue);
|
|
386
|
+
if (!fieldValues.length || !compareValues.length)
|
|
387
|
+
return false;
|
|
388
|
+
const compareSet = new Set(compareValues);
|
|
389
|
+
return fieldValues.some((item) => compareSet.has(item));
|
|
390
|
+
}
|
|
382
391
|
collectScheduleIdsFromStrategies(strategyConfigs) {
|
|
383
392
|
const scheduleIds = /* @__PURE__ */ new Set();
|
|
384
393
|
for (const config of strategyConfigs) {
|
|
@@ -549,6 +558,16 @@ var DataVariantEvaluator = class {
|
|
|
549
558
|
return [];
|
|
550
559
|
return value.map((item) => this.toNumber(item)).filter((item) => item > 0);
|
|
551
560
|
}
|
|
561
|
+
normalizeComparableArray(value) {
|
|
562
|
+
const list = Array.isArray(value) ? value : value == null || value === "" ? [] : [value];
|
|
563
|
+
const normalized = list.map((item) => {
|
|
564
|
+
if (item == null || item === "")
|
|
565
|
+
return "";
|
|
566
|
+
const parsed = Number(item);
|
|
567
|
+
return Number.isFinite(parsed) ? String(parsed) : String(item).trim();
|
|
568
|
+
}).filter(Boolean);
|
|
569
|
+
return Array.from(new Set(normalized));
|
|
570
|
+
}
|
|
552
571
|
buildProductKey(productId, variantId) {
|
|
553
572
|
return `${productId}:${variantId}`;
|
|
554
573
|
}
|
|
@@ -279,8 +279,6 @@ function runCustomerScopeDataVariantDemo() {
|
|
|
279
279
|
};
|
|
280
280
|
return evaluator.resolveProducts(businessData);
|
|
281
281
|
}
|
|
282
|
-
window.runDataVariantDemo = runDataVariantDemo;
|
|
283
|
-
window.runCustomerScopeDataVariantDemo = runCustomerScopeDataVariantDemo;
|
|
284
282
|
// Annotate the CommonJS export names for ESM import in node:
|
|
285
283
|
0 && (module.exports = {
|
|
286
284
|
CUSTOMER_SCOPE_PRICE_STRATEGY,
|
|
@@ -102,6 +102,8 @@ export interface DataVariantBusinessData {
|
|
|
102
102
|
/** 当前业务编码,对应策略条件 field: business_code */
|
|
103
103
|
businessCode?: string;
|
|
104
104
|
customerId?: number | string;
|
|
105
|
+
/** 当前客户可用 wallet/pass id 合并列表,对应策略条件 field: available_wallet_ids */
|
|
106
|
+
availableWalletIds?: Array<number | string>;
|
|
105
107
|
custom?: Record<string, any>;
|
|
106
108
|
}
|
|
107
109
|
/**
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
-
mod
|
|
26
|
-
));
|
|
27
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
-
|
|
29
|
-
// src/model/strategy/adapter/promotion/index.ts
|
|
30
|
-
var promotion_exports = {};
|
|
31
|
-
__export(promotion_exports, {
|
|
32
|
-
BUY_X_GET_Y_FREE_STRATEGY: () => import_examples.BUY_X_GET_Y_FREE_STRATEGY,
|
|
33
|
-
PromotionAdapter: () => import_adapter.PromotionAdapter,
|
|
34
|
-
PromotionEvaluator: () => import_evaluator.PromotionEvaluator,
|
|
35
|
-
X_ITEMS_FOR_Y_PRICE_STRATEGY: () => import_examples.X_ITEMS_FOR_Y_PRICE_STRATEGY,
|
|
36
|
-
default: () => import_adapter2.default
|
|
37
|
-
});
|
|
38
|
-
module.exports = __toCommonJS(promotion_exports);
|
|
39
|
-
var import_evaluator = require("./evaluator");
|
|
40
|
-
var import_adapter = require("./adapter");
|
|
41
|
-
var import_adapter2 = __toESM(require("./adapter"));
|
|
42
|
-
var import_examples = require("./examples");
|
|
43
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
44
|
-
0 && (module.exports = {
|
|
45
|
-
BUY_X_GET_Y_FREE_STRATEGY,
|
|
46
|
-
PromotionAdapter,
|
|
47
|
-
PromotionEvaluator,
|
|
48
|
-
X_ITEMS_FOR_Y_PRICE_STRATEGY
|
|
49
|
-
});
|