@pisell/pisellos 2.3.38 → 2.3.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/index.d.ts +0 -2
- package/dist/core/index.js +0 -7
- package/dist/model/strategy/adapter/promotion/adapter.d.ts +0 -4
- package/dist/model/strategy/adapter/promotion/adapter.js +0 -23
- package/dist/model/strategy/adapter/promotion/evaluator.d.ts +0 -17
- package/dist/model/strategy/adapter/promotion/evaluator.js +6 -279
- package/dist/model/strategy/adapter/promotion/examples.d.ts +0 -86
- package/dist/model/strategy/adapter/promotion/examples.js +0 -99
- package/dist/model/strategy/adapter/promotion/index.d.ts +1 -1
- package/dist/model/strategy/adapter/promotion/type.d.ts +2 -90
- package/dist/model/strategy/adapter/promotion/type.js +0 -45
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +3 -5
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +3 -6
- package/dist/modules/Discount/index.d.ts +1 -0
- package/dist/modules/Discount/index.js +40 -11
- package/dist/modules/Discount/types.d.ts +1 -0
- package/dist/modules/Holder/index.d.ts +48 -0
- package/dist/modules/Holder/index.js +640 -0
- package/dist/modules/Holder/types.d.ts +123 -0
- package/dist/modules/Holder/types.js +1 -0
- package/dist/modules/Holder/utils.d.ts +13 -0
- package/dist/modules/Holder/utils.js +34 -0
- package/dist/modules/OpenData/index.d.ts +0 -2
- package/dist/modules/OpenData/index.js +2 -10
- package/dist/modules/Order/index.d.ts +11 -28
- package/dist/modules/Order/index.js +509 -750
- package/dist/modules/Order/types.d.ts +10 -33
- package/dist/modules/Order/utils/orderCollectionIdentity.js +2 -7
- package/dist/modules/Order/utils.d.ts +10 -0
- package/dist/modules/Order/utils.js +41 -13
- package/dist/modules/Payment/index.d.ts +0 -2
- package/dist/modules/Payment/index.js +50 -79
- package/dist/modules/Payment/types.d.ts +28 -99
- package/dist/modules/Payment/types.js +3 -20
- package/dist/modules/Payment/walletpass.d.ts +1 -25
- package/dist/modules/Payment/walletpass.js +157 -707
- package/dist/modules/Product/types.d.ts +1 -0
- package/dist/modules/ProductList/index.js +33 -14
- package/dist/modules/Quotation/index.d.ts +1 -1
- package/dist/modules/Quotation/index.js +2 -2
- package/dist/modules/ResourcePlanner/index.d.ts +24 -0
- package/dist/modules/ResourcePlanner/index.js +181 -0
- package/dist/modules/ResourcePlanner/planner.d.ts +14 -0
- package/dist/modules/ResourcePlanner/planner.js +1069 -0
- package/dist/modules/ResourcePlanner/types.d.ts +227 -0
- package/dist/modules/ResourcePlanner/types.js +1 -0
- package/dist/modules/Rules/index.d.ts +0 -1
- package/dist/modules/Rules/index.js +96 -89
- package/dist/modules/SalesSummary/index.js +12 -13
- package/dist/modules/ScanOrderLogger/index.d.ts +2 -0
- package/dist/modules/ScanOrderLogger/index.js +15 -2
- package/dist/modules/ScanOrderLogger/providers/feishu.js +45 -27
- package/dist/modules/ScanOrderLogger/types.d.ts +1 -0
- package/dist/modules/Schedule/index.d.ts +3 -1
- package/dist/modules/Schedule/index.js +21 -16
- package/dist/modules/Summary/utils.js +38 -13
- package/dist/modules/index.d.ts +2 -0
- package/dist/modules/index.js +3 -1
- package/dist/plugins/window.d.ts +1 -0
- package/dist/server/index.d.ts +14 -16
- package/dist/server/index.js +1148 -1930
- package/dist/server/modules/order/index.d.ts +4 -54
- package/dist/server/modules/order/index.js +695 -1595
- package/dist/server/modules/order/types.d.ts +3 -11
- package/dist/server/modules/order/types.js +1 -1
- package/dist/solution/BaseSales/index.d.ts +20 -109
- package/dist/solution/BaseSales/index.js +481 -1797
- package/dist/solution/BaseSales/types.d.ts +0 -52
- package/dist/solution/BaseSales/types.js +1 -2
- package/dist/solution/BaseSales/utils/cartPromotion.d.ts +1 -3
- package/dist/solution/BaseSales/utils/cartPromotion.js +31 -90
- package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +1 -6
- package/dist/solution/BookingByStep/index.d.ts +17 -2
- package/dist/solution/BookingByStep/index.js +294 -215
- package/dist/solution/BookingByStep/types.d.ts +2 -1
- package/dist/solution/BookingByStep/types.js +3 -1
- package/dist/solution/BookingByStep/utils/capacity.js +17 -1
- package/dist/solution/BookingByStep/utils/timeslots.d.ts +3 -1
- package/dist/solution/BookingByStep/utils/timeslots.js +19 -12
- package/dist/solution/BookingTicket/index.d.ts +4 -8
- package/dist/solution/BookingTicket/index.js +51 -134
- package/dist/solution/BookingTicket/utils/addProductDecision.js +0 -6
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +0 -8
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +82 -172
- package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts +3 -1
- package/dist/solution/BookingTicket/utils/scan/handleScan.js +10 -2
- package/dist/solution/Sales/index.d.ts +0 -1
- package/dist/solution/Sales/index.js +2 -10
- package/dist/solution/ScanOrder/index.d.ts +26 -14
- package/dist/solution/ScanOrder/index.js +1148 -756
- package/dist/solution/ScanOrder/types.d.ts +21 -1
- package/dist/solution/ScanOrder/utils.d.ts +8 -0
- package/dist/solution/ScanOrder/utils.js +66 -25
- package/dist/solution/ShopDiscount/index.d.ts +1 -0
- package/dist/solution/ShopDiscount/index.js +125 -87
- package/dist/solution/UnifiedBookingSales/index.d.ts +183 -0
- package/dist/solution/UnifiedBookingSales/index.js +1871 -0
- package/dist/solution/UnifiedBookingSales/types.d.ts +143 -0
- package/dist/solution/UnifiedBookingSales/types.js +11 -0
- package/dist/solution/VenueBooking/index.d.ts +39 -11
- package/dist/solution/VenueBooking/index.js +1176 -860
- package/dist/solution/VenueBooking/types.d.ts +3 -0
- package/dist/solution/VenueBooking/utils/resource.js +1 -0
- package/dist/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
- package/dist/solution/VenueBooking/utils/slotMerge.js +10 -5
- package/dist/solution/index.d.ts +1 -0
- package/dist/solution/index.js +2 -1
- package/dist/types/index.d.ts +1 -1
- package/lib/core/index.d.ts +0 -2
- package/lib/core/index.js +0 -4
- package/lib/model/strategy/adapter/promotion/adapter.d.ts +0 -4
- package/lib/model/strategy/adapter/promotion/adapter.js +0 -20
- package/lib/model/strategy/adapter/promotion/evaluator.d.ts +0 -17
- package/lib/model/strategy/adapter/promotion/evaluator.js +0 -235
- package/lib/model/strategy/adapter/promotion/examples.d.ts +0 -86
- package/lib/model/strategy/adapter/promotion/examples.js +0 -91
- package/lib/model/strategy/adapter/promotion/index.d.ts +1 -1
- package/lib/model/strategy/adapter/promotion/index.js +0 -2
- package/lib/model/strategy/adapter/promotion/type.d.ts +2 -90
- package/lib/model/strategy/adapter/promotion/type.js +0 -2
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +1 -2
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +1 -2
- package/lib/modules/Discount/index.d.ts +1 -0
- package/lib/modules/Discount/index.js +9 -0
- package/lib/modules/Discount/types.d.ts +1 -0
- package/lib/modules/Holder/index.d.ts +48 -0
- package/lib/modules/Holder/index.js +402 -0
- package/lib/modules/Holder/types.d.ts +123 -0
- package/lib/modules/Holder/types.js +17 -0
- package/lib/modules/Holder/utils.d.ts +13 -0
- package/lib/modules/Holder/utils.js +71 -0
- package/lib/modules/OpenData/index.d.ts +0 -2
- package/lib/modules/OpenData/index.js +1 -6
- package/lib/modules/Order/index.d.ts +11 -28
- package/lib/modules/Order/index.js +86 -196
- package/lib/modules/Order/types.d.ts +10 -33
- package/lib/modules/Order/utils/orderCollectionIdentity.js +0 -3
- package/lib/modules/Order/utils.d.ts +10 -0
- package/lib/modules/Order/utils.js +40 -16
- package/lib/modules/Payment/index.d.ts +0 -2
- package/lib/modules/Payment/index.js +13 -34
- package/lib/modules/Payment/types.d.ts +28 -99
- package/lib/modules/Payment/types.js +3 -4
- package/lib/modules/Payment/walletpass.d.ts +1 -25
- package/lib/modules/Payment/walletpass.js +21 -470
- package/lib/modules/Product/types.d.ts +1 -0
- package/lib/modules/ProductList/index.js +40 -31
- package/lib/modules/Quotation/index.d.ts +1 -1
- package/lib/modules/Quotation/index.js +2 -2
- package/lib/modules/ResourcePlanner/index.d.ts +24 -0
- package/lib/modules/ResourcePlanner/index.js +148 -0
- package/lib/modules/ResourcePlanner/planner.d.ts +14 -0
- package/lib/modules/ResourcePlanner/planner.js +933 -0
- package/lib/modules/ResourcePlanner/types.d.ts +227 -0
- package/lib/modules/ResourcePlanner/types.js +17 -0
- package/lib/modules/Rules/index.d.ts +0 -1
- package/lib/modules/Rules/index.js +40 -47
- package/lib/modules/SalesSummary/index.js +6 -7
- package/lib/modules/ScanOrderLogger/index.d.ts +2 -0
- package/lib/modules/ScanOrderLogger/index.js +13 -1
- package/lib/modules/ScanOrderLogger/providers/feishu.js +15 -6
- package/lib/modules/ScanOrderLogger/types.d.ts +1 -0
- package/lib/modules/Schedule/index.d.ts +3 -1
- package/lib/modules/Schedule/index.js +10 -8
- package/lib/modules/Summary/utils.js +21 -1
- package/lib/modules/index.d.ts +2 -0
- package/lib/modules/index.js +5 -1
- package/lib/plugins/window.d.ts +1 -0
- package/lib/server/index.d.ts +14 -16
- package/lib/server/index.js +83 -675
- package/lib/server/modules/order/index.d.ts +4 -54
- package/lib/server/modules/order/index.js +66 -679
- package/lib/server/modules/order/types.d.ts +3 -11
- package/lib/solution/BaseSales/index.d.ts +20 -109
- package/lib/solution/BaseSales/index.js +70 -881
- package/lib/solution/BaseSales/types.d.ts +0 -52
- package/lib/solution/BaseSales/types.js +1 -2
- package/lib/solution/BaseSales/utils/cartPromotion.d.ts +1 -3
- package/lib/solution/BaseSales/utils/cartPromotion.js +12 -63
- package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +1 -6
- package/lib/solution/BookingByStep/index.d.ts +17 -2
- package/lib/solution/BookingByStep/index.js +60 -18
- package/lib/solution/BookingByStep/types.d.ts +2 -1
- package/lib/solution/BookingByStep/types.js +5 -0
- package/lib/solution/BookingByStep/utils/capacity.js +20 -1
- package/lib/solution/BookingByStep/utils/timeslots.d.ts +3 -1
- package/lib/solution/BookingByStep/utils/timeslots.js +19 -11
- package/lib/solution/BookingTicket/index.d.ts +4 -8
- package/lib/solution/BookingTicket/index.js +19 -64
- package/lib/solution/BookingTicket/utils/addProductDecision.js +0 -4
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +0 -8
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +4 -36
- package/lib/solution/BookingTicket/utils/scan/handleScan.d.ts +3 -1
- package/lib/solution/BookingTicket/utils/scan/handleScan.js +2 -2
- package/lib/solution/Sales/index.d.ts +0 -1
- package/lib/solution/Sales/index.js +3 -5
- package/lib/solution/ScanOrder/index.d.ts +26 -14
- package/lib/solution/ScanOrder/index.js +449 -190
- package/lib/solution/ScanOrder/types.d.ts +21 -1
- package/lib/solution/ScanOrder/utils.d.ts +8 -0
- package/lib/solution/ScanOrder/utils.js +31 -0
- package/lib/solution/ShopDiscount/index.d.ts +1 -0
- package/lib/solution/ShopDiscount/index.js +14 -0
- package/lib/solution/UnifiedBookingSales/index.d.ts +183 -0
- package/lib/solution/UnifiedBookingSales/index.js +1076 -0
- package/lib/solution/UnifiedBookingSales/types.d.ts +143 -0
- package/lib/solution/UnifiedBookingSales/types.js +33 -0
- package/lib/solution/VenueBooking/index.d.ts +39 -11
- package/lib/solution/VenueBooking/index.js +328 -123
- package/lib/solution/VenueBooking/types.d.ts +3 -0
- package/lib/solution/VenueBooking/utils/resource.js +1 -0
- package/lib/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
- package/lib/solution/VenueBooking/utils/slotMerge.js +6 -4
- package/lib/solution/index.d.ts +1 -0
- package/lib/solution/index.js +3 -1
- package/lib/types/index.d.ts +1 -1
- package/package.json +1 -1
- package/dist/modules/Order/payment-utils.d.ts +0 -26
- package/dist/modules/Order/payment-utils.js +0 -225
- package/dist/solution/BookingTicket/utils/weighingProductSku.d.ts +0 -5
- package/dist/solution/BookingTicket/utils/weighingProductSku.js +0 -45
- package/dist/utils/payment-number.d.ts +0 -9
- package/dist/utils/payment-number.js +0 -69
- package/lib/modules/Order/payment-utils.d.ts +0 -26
- package/lib/modules/Order/payment-utils.js +0 -224
- package/lib/solution/BookingTicket/utils/weighingProductSku.d.ts +0 -5
- package/lib/solution/BookingTicket/utils/weighingProductSku.js +0 -63
- package/lib/utils/payment-number.d.ts +0 -9
- package/lib/utils/payment-number.js +0 -64
|
@@ -1,14 +1,16 @@
|
|
|
1
|
+
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; } } }; }
|
|
1
2
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
3
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
4
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
4
5
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
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 _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; }
|
|
7
7
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
8
8
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
9
9
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
10
10
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
11
11
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
12
|
+
function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }
|
|
13
|
+
function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
|
|
12
14
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
13
15
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
14
16
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
@@ -28,7 +30,7 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
|
28
30
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
29
31
|
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); }
|
|
30
32
|
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); }
|
|
31
|
-
import {
|
|
33
|
+
import { BaseSalesImpl } from "../BaseSales";
|
|
32
34
|
import { DEFAULT_SLOT_CONFIG, VenueBookingHooks } from "./types";
|
|
33
35
|
import { attachItemRuleLimitsToTopLevelProducts, buildProductKey, buildItemRuleBusinessData, createEmptySummary, getProductIdentityIndex, getSafeProductNum, normalizeOrderProduct, normalizeItemRuleStrategies, toNonNegativeInt, toPriceString } from "./utils";
|
|
34
36
|
import { createModule } from "../BookingByStep/types";
|
|
@@ -49,12 +51,10 @@ import { composeLinePrice, createUuidV4, getProductSkuOptions, sumOptionUnitPric
|
|
|
49
51
|
import { OrderModule } from "../../modules/Order";
|
|
50
52
|
import { RegisterAndLoginHooks } from "../RegisterAndLogin/types";
|
|
51
53
|
import Decimal from 'decimal.js';
|
|
54
|
+
import { HolderModule } from "../../modules/Holder";
|
|
55
|
+
import { getFormIdFromHolderConfig, getProductHolderConfig } from "../../modules/Holder/utils";
|
|
52
56
|
export * from "./types";
|
|
53
57
|
var OPEN_DATA_SECTION_CODES = ['basic', 'fulfillment', 'reservation', 'sale', 'menu', 'availability', 'workflow', 'checkout'];
|
|
54
|
-
function isItemRewardProductDiscount(discount) {
|
|
55
|
-
var _discount$metadata, _discount$metadata2;
|
|
56
|
-
return (discount === null || discount === void 0 ? void 0 : discount.type) === 'product' && (discount === null || discount === void 0 || (_discount$metadata = discount.metadata) === null || _discount$metadata === void 0 ? void 0 : _discount$metadata.source) === 'promotion' && (discount === null || discount === void 0 || (_discount$metadata2 = discount.metadata) === null || _discount$metadata2 === void 0 ? void 0 : _discount$metadata2.actionType) === 'ITEM_REWARD';
|
|
57
|
-
}
|
|
58
58
|
function cloneCustomDepositData(customDepositData) {
|
|
59
59
|
if (!customDepositData || _typeof(customDepositData) !== 'object') return undefined;
|
|
60
60
|
return _objectSpread(_objectSpread({}, customDepositData), {}, {
|
|
@@ -63,8 +63,8 @@ function cloneCustomDepositData(customDepositData) {
|
|
|
63
63
|
deposit_policy_data: Array.isArray(customDepositData.deposit_policy_data) ? _toConsumableArray(customDepositData.deposit_policy_data) : []
|
|
64
64
|
});
|
|
65
65
|
}
|
|
66
|
-
export var VenueBookingImpl = /*#__PURE__*/function (
|
|
67
|
-
_inherits(VenueBookingImpl,
|
|
66
|
+
export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
67
|
+
_inherits(VenueBookingImpl, _BaseSalesImpl);
|
|
68
68
|
var _super = _createSuper(VenueBookingImpl);
|
|
69
69
|
function VenueBookingImpl(name, version) {
|
|
70
70
|
var _this;
|
|
@@ -273,6 +273,76 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
273
273
|
}
|
|
274
274
|
return addLog;
|
|
275
275
|
}()
|
|
276
|
+
}, {
|
|
277
|
+
key: "getRegisteredModuleNames",
|
|
278
|
+
value: function getRegisteredModuleNames() {
|
|
279
|
+
return ['scanOrderLogger', 'products', 'order', 'salesSummary', 'venueProducts', 'addonProducts', 'date', 'schedule', 'quotation', 'openData'];
|
|
280
|
+
}
|
|
281
|
+
}, {
|
|
282
|
+
key: "createSubModule",
|
|
283
|
+
value: function createSubModule(moduleName) {
|
|
284
|
+
switch (moduleName) {
|
|
285
|
+
case 'scanOrderLogger':
|
|
286
|
+
return createModule('scanOrderLogger', this.name);
|
|
287
|
+
case 'venueProducts':
|
|
288
|
+
return new ProductList("".concat(this.name, "_venueProducts"));
|
|
289
|
+
case 'addonProducts':
|
|
290
|
+
return new ProductList("".concat(this.name, "_addonProducts"));
|
|
291
|
+
case 'date':
|
|
292
|
+
return new DateModule("".concat(this.name, "_date"));
|
|
293
|
+
case 'openData':
|
|
294
|
+
return new OpenDataModule("".concat(this.name, "_openData"));
|
|
295
|
+
default:
|
|
296
|
+
return _get(_getPrototypeOf(VenueBookingImpl.prototype), "createSubModule", this).call(this, moduleName);
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
}, {
|
|
300
|
+
key: "attachProductOriginToTempOrder",
|
|
301
|
+
value: function attachProductOriginToTempOrder(tempOrder, productUid, origin) {
|
|
302
|
+
var _tempOrder$_extend, _tempOrder$_extend2;
|
|
303
|
+
if (!productUid || !origin) return;
|
|
304
|
+
tempOrder._extend = _objectSpread(_objectSpread({}, tempOrder._extend || {}), {}, {
|
|
305
|
+
productsByUid: _objectSpread(_objectSpread({}, ((_tempOrder$_extend = tempOrder._extend) === null || _tempOrder$_extend === void 0 ? void 0 : _tempOrder$_extend.productsByUid) || {}), {}, _defineProperty({}, productUid, _objectSpread(_objectSpread({}, ((_tempOrder$_extend2 = tempOrder._extend) === null || _tempOrder$_extend2 === void 0 || (_tempOrder$_extend2 = _tempOrder$_extend2.productsByUid) === null || _tempOrder$_extend2 === void 0 ? void 0 : _tempOrder$_extend2[productUid]) || {}), {}, {
|
|
306
|
+
origin: origin
|
|
307
|
+
})))
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
}, {
|
|
311
|
+
key: "readProductOriginFromTempOrder",
|
|
312
|
+
value: function readProductOriginFromTempOrder(tempOrder, product) {
|
|
313
|
+
var _product$metadata, _tempOrder$_extend3;
|
|
314
|
+
var uid = ((_product$metadata = product.metadata) === null || _product$metadata === void 0 ? void 0 : _product$metadata.unique_identification_number) || product.identity_key;
|
|
315
|
+
if (uid && (_tempOrder$_extend3 = tempOrder._extend) !== null && _tempOrder$_extend3 !== void 0 && (_tempOrder$_extend3 = _tempOrder$_extend3.productsByUid) !== null && _tempOrder$_extend3 !== void 0 && (_tempOrder$_extend3 = _tempOrder$_extend3[uid]) !== null && _tempOrder$_extend3 !== void 0 && _tempOrder$_extend3.origin) {
|
|
316
|
+
return tempOrder._extend.productsByUid[uid].origin;
|
|
317
|
+
}
|
|
318
|
+
return product._origin;
|
|
319
|
+
}
|
|
320
|
+
}, {
|
|
321
|
+
key: "normalizeVenueProductTitle",
|
|
322
|
+
value: function normalizeVenueProductTitle(value) {
|
|
323
|
+
if (typeof value === 'string') {
|
|
324
|
+
var text = value.trim();
|
|
325
|
+
return text ? {
|
|
326
|
+
auto: text
|
|
327
|
+
} : undefined;
|
|
328
|
+
}
|
|
329
|
+
if (!value || _typeof(value) !== 'object' || Array.isArray(value)) return undefined;
|
|
330
|
+
var source = value;
|
|
331
|
+
var normalized = {};
|
|
332
|
+
Object.entries(source).forEach(function (_ref) {
|
|
333
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
|
334
|
+
key = _ref2[0],
|
|
335
|
+
text = _ref2[1];
|
|
336
|
+
if (typeof text === 'string') normalized[key] = text;
|
|
337
|
+
});
|
|
338
|
+
if (!normalized.auto) {
|
|
339
|
+
var fallback = normalized.original || normalized.en || normalized['zh-CN'] || normalized['zh-HK'];
|
|
340
|
+
if (fallback) normalized.auto = fallback;
|
|
341
|
+
}
|
|
342
|
+
return Object.values(normalized).some(function (text) {
|
|
343
|
+
return String(text || '').trim();
|
|
344
|
+
}) ? normalized : undefined;
|
|
345
|
+
}
|
|
276
346
|
}, {
|
|
277
347
|
key: "normalizeCustomerId",
|
|
278
348
|
value: function normalizeCustomerId(value) {
|
|
@@ -292,20 +362,115 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
292
362
|
}
|
|
293
363
|
return null;
|
|
294
364
|
}
|
|
365
|
+
}, {
|
|
366
|
+
key: "resolveHolderCustomerId",
|
|
367
|
+
value: function resolveHolderCustomerId() {
|
|
368
|
+
var _this$window, _this$window$getLocal;
|
|
369
|
+
var customer = JSON.parse(((_this$window = this.window) === null || _this$window === void 0 || (_this$window$getLocal = _this$window.getLocalStorage) === null || _this$window$getLocal === void 0 ? void 0 : _this$window$getLocal.call(_this$window, 'customer')) || '{}');
|
|
370
|
+
if (customer !== null && customer !== void 0 && customer.id) return Number(customer.id);
|
|
371
|
+
return undefined;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
/**
|
|
375
|
+
* 按商品 holder_config 预加载表单数据到 holderMap。
|
|
376
|
+
* appointment_booking 在加购时触发;venueBooking 在商品加载后预加载,避免 getHolderFormMap 为空。
|
|
377
|
+
*/
|
|
378
|
+
}, {
|
|
379
|
+
key: "preloadHolderForms",
|
|
380
|
+
value: (function () {
|
|
381
|
+
var _preloadHolderForms = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(products) {
|
|
382
|
+
var seenFormIds, _iterator, _step, _item$_origin, item, holderConfig, formId, _item$_origin2, _item$_origin3;
|
|
383
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
384
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
385
|
+
case 0:
|
|
386
|
+
if (!(!this.store.holder || !products.length)) {
|
|
387
|
+
_context3.next = 2;
|
|
388
|
+
break;
|
|
389
|
+
}
|
|
390
|
+
return _context3.abrupt("return");
|
|
391
|
+
case 2:
|
|
392
|
+
seenFormIds = new Set();
|
|
393
|
+
_iterator = _createForOfIteratorHelper(products);
|
|
394
|
+
_context3.prev = 4;
|
|
395
|
+
_iterator.s();
|
|
396
|
+
case 6:
|
|
397
|
+
if ((_step = _iterator.n()).done) {
|
|
398
|
+
_context3.next = 25;
|
|
399
|
+
break;
|
|
400
|
+
}
|
|
401
|
+
item = _step.value;
|
|
402
|
+
holderConfig = getProductHolderConfig(item === null || item === void 0 || (_item$_origin = item._origin) === null || _item$_origin === void 0 ? void 0 : _item$_origin.product);
|
|
403
|
+
if (holderConfig) {
|
|
404
|
+
_context3.next = 11;
|
|
405
|
+
break;
|
|
406
|
+
}
|
|
407
|
+
return _context3.abrupt("continue", 23);
|
|
408
|
+
case 11:
|
|
409
|
+
formId = getFormIdFromHolderConfig(holderConfig);
|
|
410
|
+
if (!seenFormIds.has(formId)) {
|
|
411
|
+
_context3.next = 14;
|
|
412
|
+
break;
|
|
413
|
+
}
|
|
414
|
+
return _context3.abrupt("continue", 23);
|
|
415
|
+
case 14:
|
|
416
|
+
seenFormIds.add(formId);
|
|
417
|
+
_context3.prev = 15;
|
|
418
|
+
_context3.next = 18;
|
|
419
|
+
return this.store.holder.ensureFormByProduct({
|
|
420
|
+
product: (item === null || item === void 0 || (_item$_origin2 = item._origin) === null || _item$_origin2 === void 0 ? void 0 : _item$_origin2.product) || {},
|
|
421
|
+
customer_id: this.resolveHolderCustomerId(),
|
|
422
|
+
shop_id: item === null || item === void 0 || (_item$_origin3 = item._origin) === null || _item$_origin3 === void 0 || (_item$_origin3 = _item$_origin3.product) === null || _item$_origin3 === void 0 ? void 0 : _item$_origin3.shop_id,
|
|
423
|
+
useCache: true
|
|
424
|
+
});
|
|
425
|
+
case 18:
|
|
426
|
+
_context3.next = 23;
|
|
427
|
+
break;
|
|
428
|
+
case 20:
|
|
429
|
+
_context3.prev = 20;
|
|
430
|
+
_context3.t0 = _context3["catch"](15);
|
|
431
|
+
console.error('[VenueBooking] 预加载 holder 表单失败', {
|
|
432
|
+
formId: formId,
|
|
433
|
+
error: _context3.t0
|
|
434
|
+
});
|
|
435
|
+
case 23:
|
|
436
|
+
_context3.next = 6;
|
|
437
|
+
break;
|
|
438
|
+
case 25:
|
|
439
|
+
_context3.next = 30;
|
|
440
|
+
break;
|
|
441
|
+
case 27:
|
|
442
|
+
_context3.prev = 27;
|
|
443
|
+
_context3.t1 = _context3["catch"](4);
|
|
444
|
+
_iterator.e(_context3.t1);
|
|
445
|
+
case 30:
|
|
446
|
+
_context3.prev = 30;
|
|
447
|
+
_iterator.f();
|
|
448
|
+
return _context3.finish(30);
|
|
449
|
+
case 33:
|
|
450
|
+
case "end":
|
|
451
|
+
return _context3.stop();
|
|
452
|
+
}
|
|
453
|
+
}, _callee3, this, [[4, 27, 30, 33], [15, 20]]);
|
|
454
|
+
}));
|
|
455
|
+
function preloadHolderForms(_x3) {
|
|
456
|
+
return _preloadHolderForms.apply(this, arguments);
|
|
457
|
+
}
|
|
458
|
+
return preloadHolderForms;
|
|
459
|
+
}())
|
|
295
460
|
}, {
|
|
296
461
|
key: "clearLoginEffectListeners",
|
|
297
462
|
value: function clearLoginEffectListeners() {
|
|
298
|
-
var
|
|
299
|
-
|
|
463
|
+
var _iterator2 = _createForOfIteratorHelper(this.loginEffectDisposers),
|
|
464
|
+
_step2;
|
|
300
465
|
try {
|
|
301
|
-
for (
|
|
302
|
-
var dispose =
|
|
466
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
467
|
+
var dispose = _step2.value;
|
|
303
468
|
dispose();
|
|
304
469
|
}
|
|
305
470
|
} catch (err) {
|
|
306
|
-
|
|
471
|
+
_iterator2.e(err);
|
|
307
472
|
} finally {
|
|
308
|
-
|
|
473
|
+
_iterator2.f();
|
|
309
474
|
}
|
|
310
475
|
this.loginEffectDisposers = [];
|
|
311
476
|
}
|
|
@@ -336,30 +501,30 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
336
501
|
var currentAccount = (accountModule === null || accountModule === void 0 || (_accountModule$getCur = accountModule.getCurrentAccount) === null || _accountModule$getCur === void 0 ? void 0 : _accountModule$getCur.call(accountModule)) || (accountModule === null || accountModule === void 0 || (_accountModule$getAcc = accountModule.getAccount) === null || _accountModule$getAcc === void 0 ? void 0 : _accountModule$getAcc.call(accountModule)) || null;
|
|
337
502
|
var createHandleLogin = function createHandleLogin(eventName) {
|
|
338
503
|
return /*#__PURE__*/function () {
|
|
339
|
-
var
|
|
504
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(payload) {
|
|
340
505
|
var customerId;
|
|
341
|
-
return _regeneratorRuntime().wrap(function
|
|
342
|
-
while (1) switch (
|
|
506
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
507
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
343
508
|
case 0:
|
|
344
509
|
customerId = _this2.resolveCustomerIdFromLoginPayload(payload);
|
|
345
510
|
if (customerId) {
|
|
346
|
-
|
|
511
|
+
_context4.next = 3;
|
|
347
512
|
break;
|
|
348
513
|
}
|
|
349
|
-
return
|
|
514
|
+
return _context4.abrupt("return");
|
|
350
515
|
case 3:
|
|
351
|
-
|
|
516
|
+
_context4.next = 5;
|
|
352
517
|
return _this2.refreshOrderMarketingAfterLogin({
|
|
353
518
|
customerId: customerId
|
|
354
519
|
});
|
|
355
520
|
case 5:
|
|
356
521
|
case "end":
|
|
357
|
-
return
|
|
522
|
+
return _context4.stop();
|
|
358
523
|
}
|
|
359
|
-
},
|
|
524
|
+
}, _callee4);
|
|
360
525
|
}));
|
|
361
|
-
return function (
|
|
362
|
-
return
|
|
526
|
+
return function (_x4) {
|
|
527
|
+
return _ref3.apply(this, arguments);
|
|
363
528
|
};
|
|
364
529
|
}();
|
|
365
530
|
};
|
|
@@ -369,97 +534,107 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
369
534
|
}, {
|
|
370
535
|
key: "refreshOrderMarketingAfterLogin",
|
|
371
536
|
value: function () {
|
|
372
|
-
var _refreshOrderMarketingAfterLogin = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
537
|
+
var _refreshOrderMarketingAfterLogin = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(params) {
|
|
373
538
|
var _this3 = this;
|
|
374
539
|
var refreshTask;
|
|
375
|
-
return _regeneratorRuntime().wrap(function
|
|
376
|
-
while (1) switch (
|
|
540
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
541
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
377
542
|
case 0:
|
|
378
543
|
if (this.store.order) {
|
|
379
|
-
|
|
544
|
+
_context6.next = 2;
|
|
380
545
|
break;
|
|
381
546
|
}
|
|
382
547
|
throw new Error('order 模块未初始化');
|
|
383
548
|
case 2:
|
|
384
549
|
if (!this.customerLoginRefreshInFlight) {
|
|
385
|
-
|
|
550
|
+
_context6.next = 9;
|
|
386
551
|
break;
|
|
387
552
|
}
|
|
388
553
|
if (!(this.customerLoginRefreshIdInFlight === params.customerId)) {
|
|
389
|
-
|
|
554
|
+
_context6.next = 7;
|
|
390
555
|
break;
|
|
391
556
|
}
|
|
392
|
-
|
|
557
|
+
_context6.next = 6;
|
|
393
558
|
return this.customerLoginRefreshInFlight;
|
|
394
559
|
case 6:
|
|
395
|
-
return
|
|
560
|
+
return _context6.abrupt("return");
|
|
396
561
|
case 7:
|
|
397
|
-
|
|
562
|
+
_context6.next = 9;
|
|
398
563
|
return this.customerLoginRefreshInFlight;
|
|
399
564
|
case 9:
|
|
400
565
|
this.customerLoginRefreshIdInFlight = params.customerId;
|
|
401
|
-
refreshTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
566
|
+
refreshTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
402
567
|
var _this3$otherParams;
|
|
403
|
-
return _regeneratorRuntime().wrap(function
|
|
404
|
-
while (1) switch (
|
|
568
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
569
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
405
570
|
case 0:
|
|
571
|
+
if (!_this3.store.holder) {
|
|
572
|
+
_context5.next = 3;
|
|
573
|
+
break;
|
|
574
|
+
}
|
|
575
|
+
_context5.next = 3;
|
|
576
|
+
return _this3.store.holder.refreshAllFormRecords({
|
|
577
|
+
customer_id: params.customerId,
|
|
578
|
+
useCache: false
|
|
579
|
+
});
|
|
580
|
+
case 3:
|
|
406
581
|
if (!_this3.store.quotation) {
|
|
407
|
-
|
|
582
|
+
_context5.next = 6;
|
|
408
583
|
break;
|
|
409
584
|
}
|
|
410
|
-
|
|
585
|
+
_context5.next = 6;
|
|
411
586
|
return _this3.store.quotation.loadQuotations({
|
|
412
587
|
channel: (_this3$otherParams = _this3.otherParams) === null || _this3$otherParams === void 0 ? void 0 : _this3$otherParams.channel
|
|
413
588
|
});
|
|
414
|
-
case
|
|
589
|
+
case 6:
|
|
415
590
|
_this3.recalculateOrderPricesFromQuotation();
|
|
416
|
-
|
|
591
|
+
_context5.next = 9;
|
|
417
592
|
return _this3.store.order.loadDiscountConfig({
|
|
418
593
|
customerId: params.customerId
|
|
419
594
|
});
|
|
420
|
-
case
|
|
421
|
-
|
|
595
|
+
case 9:
|
|
596
|
+
_context5.next = 11;
|
|
422
597
|
return _this3.store.order.recalculateSummary({
|
|
423
598
|
createIfMissing: true
|
|
424
599
|
});
|
|
425
|
-
case
|
|
600
|
+
case 11:
|
|
426
601
|
_this3.store.order.persistTempOrder();
|
|
427
|
-
|
|
602
|
+
_context5.next = 14;
|
|
428
603
|
return _this3.refreshItemRuleQuantityLimits();
|
|
429
|
-
case
|
|
430
|
-
|
|
604
|
+
case 14:
|
|
605
|
+
_context5.next = 16;
|
|
431
606
|
return _this3.refreshCartValidationPassed();
|
|
432
|
-
case
|
|
607
|
+
case 16:
|
|
433
608
|
case "end":
|
|
434
|
-
return
|
|
609
|
+
return _context5.stop();
|
|
435
610
|
}
|
|
436
|
-
},
|
|
611
|
+
}, _callee5);
|
|
437
612
|
}))();
|
|
438
613
|
this.customerLoginRefreshInFlight = refreshTask;
|
|
439
|
-
|
|
440
|
-
|
|
614
|
+
_context6.prev = 12;
|
|
615
|
+
_context6.next = 15;
|
|
441
616
|
return refreshTask;
|
|
442
617
|
case 15:
|
|
443
|
-
|
|
618
|
+
_context6.next = 20;
|
|
444
619
|
break;
|
|
445
620
|
case 17:
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
throw
|
|
621
|
+
_context6.prev = 17;
|
|
622
|
+
_context6.t0 = _context6["catch"](12);
|
|
623
|
+
throw _context6.t0;
|
|
449
624
|
case 20:
|
|
450
|
-
|
|
625
|
+
_context6.prev = 20;
|
|
451
626
|
if (this.customerLoginRefreshInFlight === refreshTask) {
|
|
452
627
|
this.customerLoginRefreshInFlight = null;
|
|
453
628
|
this.customerLoginRefreshIdInFlight = null;
|
|
454
629
|
}
|
|
455
|
-
return
|
|
630
|
+
return _context6.finish(20);
|
|
456
631
|
case 23:
|
|
457
632
|
case "end":
|
|
458
|
-
return
|
|
633
|
+
return _context6.stop();
|
|
459
634
|
}
|
|
460
|
-
},
|
|
635
|
+
}, _callee6, this, [[12, 17, 20, 23]]);
|
|
461
636
|
}));
|
|
462
|
-
function refreshOrderMarketingAfterLogin(
|
|
637
|
+
function refreshOrderMarketingAfterLogin(_x5) {
|
|
463
638
|
return _refreshOrderMarketingAfterLogin.apply(this, arguments);
|
|
464
639
|
}
|
|
465
640
|
return refreshOrderMarketingAfterLogin;
|
|
@@ -467,16 +642,21 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
467
642
|
}, {
|
|
468
643
|
key: "initialize",
|
|
469
644
|
value: function () {
|
|
470
|
-
var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
645
|
+
var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(core) {
|
|
471
646
|
var _options$otherParams,
|
|
472
647
|
_options$otherParams2,
|
|
473
648
|
_this$otherParams,
|
|
474
649
|
_this$otherParams2,
|
|
475
650
|
_this$otherParams3,
|
|
476
651
|
_this4 = this,
|
|
477
|
-
_this$
|
|
478
|
-
_this$
|
|
652
|
+
_this$otherParams6,
|
|
653
|
+
_this$otherParams7,
|
|
654
|
+
_this$otherParams8,
|
|
655
|
+
_this$otherParams9,
|
|
656
|
+
_this$otherParams10;
|
|
479
657
|
var options,
|
|
658
|
+
_this$otherParams4,
|
|
659
|
+
_this$otherParams5,
|
|
480
660
|
baseModules,
|
|
481
661
|
venueProductsModule,
|
|
482
662
|
addonProductsModule,
|
|
@@ -484,18 +664,21 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
484
664
|
scheduleModule,
|
|
485
665
|
quotationModule,
|
|
486
666
|
openDataModule,
|
|
667
|
+
holderCacheState,
|
|
668
|
+
sessionData,
|
|
669
|
+
_data$this$otherParam,
|
|
670
|
+
data,
|
|
671
|
+
holderModule,
|
|
487
672
|
_this$store$order,
|
|
488
673
|
_this$store$order2,
|
|
489
674
|
_this$store$quotation,
|
|
490
|
-
_this$
|
|
491
|
-
|
|
492
|
-
return _regeneratorRuntime().wrap(function
|
|
493
|
-
while (1) switch (
|
|
675
|
+
_this$otherParams11,
|
|
676
|
+
_args7 = arguments;
|
|
677
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
678
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
494
679
|
case 0:
|
|
495
|
-
options =
|
|
680
|
+
options = _args7.length > 1 && _args7[1] !== undefined ? _args7[1] : {};
|
|
496
681
|
this.logMethodStart('initialize');
|
|
497
|
-
this.core = core;
|
|
498
|
-
this.initializeOptions = options || {};
|
|
499
682
|
this.store = _objectSpread(_objectSpread({}, this.store), options.store);
|
|
500
683
|
this.store.entryContext = ((_options$otherParams = options.otherParams) === null || _options$otherParams === void 0 ? void 0 : _options$otherParams.entryContext) || this.store.entryContext;
|
|
501
684
|
this.store.status = 'initializing';
|
|
@@ -514,22 +697,19 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
514
697
|
passed: null,
|
|
515
698
|
failures: []
|
|
516
699
|
};
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
700
|
+
_context7.next = 19;
|
|
701
|
+
return _get(_getPrototypeOf(VenueBookingImpl.prototype), "initialize", this).call(this, core, options);
|
|
702
|
+
case 19:
|
|
703
|
+
if (this.store.scanOrderLogger) {
|
|
704
|
+
this.store.scanOrderLogger.setProvider(((_this$otherParams4 = this.otherParams) === null || _this$otherParams4 === void 0 ? void 0 : _this$otherParams4.loggerProvider) || 'feishu');
|
|
705
|
+
this.store.scanOrderLogger.setProviderConfig(((_this$otherParams5 = this.otherParams) === null || _this$otherParams5 === void 0 ? void 0 : _this$otherParams5.loggerConfig) || {
|
|
706
|
+
feishu: {
|
|
707
|
+
webhook: 'https://open.feishu.cn/open-apis/bot/v2/hook/8f069b14-9d39-4728-8f78-b56f393bfde8',
|
|
708
|
+
errorHook: 'https://open.feishu.cn/open-apis/bot/v2/hook/bdefae5e-f233-4705-8688-946887d9543d'
|
|
709
|
+
}
|
|
710
|
+
});
|
|
711
|
+
this.store.scanOrderLogger.setContext(this.getLoggerContext());
|
|
529
712
|
}
|
|
530
|
-
this.logMethodError('initialize', 'request plugin missing');
|
|
531
|
-
throw new Error('venueBooking解决方案需要 request 插件支持');
|
|
532
|
-
case 27:
|
|
533
713
|
// 注册基础模块(order, salesSummary, products, logger)
|
|
534
714
|
baseModules = ['scanOrderLogger', 'products', 'order', 'salesSummary'];
|
|
535
715
|
baseModules.forEach(function (step) {
|
|
@@ -542,10 +722,10 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
542
722
|
} : {};
|
|
543
723
|
var loggerProvider = ((_this4$otherParams = _this4.otherParams) === null || _this4$otherParams === void 0 ? void 0 : _this4$otherParams.loggerProvider) || 'feishu';
|
|
544
724
|
var loggerConfig = ((_this4$otherParams2 = _this4.otherParams) === null || _this4$otherParams2 === void 0 ? void 0 : _this4$otherParams2.loggerConfig) || {
|
|
545
|
-
feishu: {
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
}
|
|
725
|
+
// feishu: {
|
|
726
|
+
// webhook: 'https://open.feishu.cn/open-apis/bot/v2/hook/8f069b14-9d39-4728-8f78-b56f393bfde8',
|
|
727
|
+
// errorHook: 'https://open.feishu.cn/open-apis/bot/v2/hook/bdefae5e-f233-4705-8688-946887d9543d',
|
|
728
|
+
// },
|
|
549
729
|
};
|
|
550
730
|
_this4.core.registerModule(targetModule, {
|
|
551
731
|
initialState: initialState,
|
|
@@ -617,69 +797,87 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
617
797
|
this.core.registerModule(openDataModule, {
|
|
618
798
|
otherParams: _objectSpread(_objectSpread({}, this.otherParams), {}, {
|
|
619
799
|
fatherModule: this.name,
|
|
620
|
-
openCache: !!((_this$
|
|
621
|
-
cacheId: (_this$
|
|
800
|
+
openCache: !!((_this$otherParams6 = this.otherParams) !== null && _this$otherParams6 !== void 0 && _this$otherParams6.cacheId),
|
|
801
|
+
cacheId: (_this$otherParams7 = this.otherParams) === null || _this$otherParams7 === void 0 ? void 0 : _this$otherParams7.cacheId
|
|
622
802
|
})
|
|
623
803
|
});
|
|
624
|
-
if (this.
|
|
625
|
-
this.
|
|
804
|
+
if ((_this$otherParams8 = this.otherParams) !== null && _this$otherParams8 !== void 0 && _this$otherParams8.cacheId) {
|
|
805
|
+
sessionData = this.window.sessionStorage.getItem(this.name);
|
|
806
|
+
if (sessionData) {
|
|
807
|
+
try {
|
|
808
|
+
data = JSON.parse(sessionData);
|
|
809
|
+
holderCacheState = (_data$this$otherParam = data[this.otherParams.cacheId]) === null || _data$this$otherParam === void 0 ? void 0 : _data$this$otherParam["".concat(this.name, "_holder")];
|
|
810
|
+
} catch (_unused2) {
|
|
811
|
+
// ignore invalid session cache
|
|
812
|
+
}
|
|
813
|
+
}
|
|
626
814
|
}
|
|
815
|
+
holderModule = new HolderModule("".concat(this.name, "_holder"));
|
|
816
|
+
this.store.holder = holderModule;
|
|
817
|
+
this.core.registerModule(holderModule, {
|
|
818
|
+
initialState: holderCacheState,
|
|
819
|
+
otherParams: _objectSpread(_objectSpread({}, this.otherParams), {}, {
|
|
820
|
+
fatherModule: this.name,
|
|
821
|
+
openCache: !!((_this$otherParams9 = this.otherParams) !== null && _this$otherParams9 !== void 0 && _this$otherParams9.cacheId),
|
|
822
|
+
cacheId: (_this$otherParams10 = this.otherParams) === null || _this$otherParams10 === void 0 ? void 0 : _this$otherParams10.cacheId
|
|
823
|
+
})
|
|
824
|
+
});
|
|
627
825
|
this.registerCustomerLoginListeners();
|
|
628
826
|
console.log('[VenueBooking] 初始化开始');
|
|
629
|
-
|
|
630
|
-
|
|
827
|
+
_context7.prev = 46;
|
|
828
|
+
_context7.next = 49;
|
|
631
829
|
return (_this$store$order = this.store.order) === null || _this$store$order === void 0 ? void 0 : _this$store$order.recalculateSummary({
|
|
632
830
|
createIfMissing: false
|
|
633
831
|
});
|
|
634
|
-
case
|
|
832
|
+
case 49:
|
|
635
833
|
(_this$store$order2 = this.store.order) === null || _this$store$order2 === void 0 || _this$store$order2.persistTempOrder();
|
|
636
|
-
|
|
834
|
+
_context7.next = 52;
|
|
637
835
|
return this.loadRuntimeConfigs();
|
|
638
|
-
case
|
|
836
|
+
case 52:
|
|
639
837
|
if (!this.store.schedule) {
|
|
640
|
-
|
|
838
|
+
_context7.next = 57;
|
|
641
839
|
break;
|
|
642
840
|
}
|
|
643
|
-
|
|
841
|
+
_context7.next = 55;
|
|
644
842
|
return this.store.schedule.loadAllSchedule();
|
|
645
|
-
case
|
|
843
|
+
case 55:
|
|
646
844
|
this.injectScheduleResolverToQuotation();
|
|
647
845
|
(_this$store$quotation = this.store.quotation) === null || _this$store$quotation === void 0 || _this$store$quotation.loadQuotations({
|
|
648
|
-
channel: (_this$
|
|
846
|
+
channel: (_this$otherParams11 = this.otherParams) === null || _this$otherParams11 === void 0 ? void 0 : _this$otherParams11.channel
|
|
649
847
|
});
|
|
650
|
-
case
|
|
651
|
-
|
|
848
|
+
case 57:
|
|
849
|
+
_context7.next = 59;
|
|
652
850
|
return this.refreshItemRuleQuantityLimits();
|
|
653
|
-
case
|
|
851
|
+
case 59:
|
|
654
852
|
this.store.status = 'ready';
|
|
655
853
|
console.log('[VenueBooking] 初始化完成');
|
|
656
|
-
|
|
854
|
+
_context7.next = 63;
|
|
657
855
|
return this.core.effects.emit(VenueBookingHooks.onInited, {
|
|
658
856
|
status: this.store.status
|
|
659
857
|
});
|
|
660
|
-
case
|
|
858
|
+
case 63:
|
|
661
859
|
this.logMethodSuccess('initialize', {
|
|
662
860
|
status: this.store.status
|
|
663
861
|
});
|
|
664
|
-
|
|
862
|
+
_context7.next = 73;
|
|
665
863
|
break;
|
|
666
|
-
case
|
|
667
|
-
|
|
668
|
-
|
|
864
|
+
case 66:
|
|
865
|
+
_context7.prev = 66;
|
|
866
|
+
_context7.t0 = _context7["catch"](46);
|
|
669
867
|
this.store.status = 'error';
|
|
670
|
-
this.store.error =
|
|
671
|
-
console.error('[VenueBooking] 初始化失败',
|
|
672
|
-
this.logMethodError('initialize',
|
|
868
|
+
this.store.error = _context7.t0 instanceof Error ? _context7.t0.message : '初始化失败';
|
|
869
|
+
console.error('[VenueBooking] 初始化失败', _context7.t0);
|
|
870
|
+
this.logMethodError('initialize', _context7.t0, {
|
|
673
871
|
status: this.store.status
|
|
674
872
|
});
|
|
675
|
-
throw
|
|
676
|
-
case
|
|
873
|
+
throw _context7.t0;
|
|
874
|
+
case 73:
|
|
677
875
|
case "end":
|
|
678
|
-
return
|
|
876
|
+
return _context7.stop();
|
|
679
877
|
}
|
|
680
|
-
},
|
|
878
|
+
}, _callee7, this, [[46, 66]]);
|
|
681
879
|
}));
|
|
682
|
-
function initialize(
|
|
880
|
+
function initialize(_x6) {
|
|
683
881
|
return _initialize.apply(this, arguments);
|
|
684
882
|
}
|
|
685
883
|
return initialize;
|
|
@@ -687,22 +885,22 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
687
885
|
}, {
|
|
688
886
|
key: "destroy",
|
|
689
887
|
value: function () {
|
|
690
|
-
var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
691
|
-
return _regeneratorRuntime().wrap(function
|
|
692
|
-
while (1) switch (
|
|
888
|
+
var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
|
|
889
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
890
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
693
891
|
case 0:
|
|
694
892
|
this.logMethodStart('destroy');
|
|
695
893
|
this.clearLoginEffectListeners();
|
|
696
|
-
|
|
894
|
+
_context8.next = 4;
|
|
697
895
|
return this.core.effects.emit(VenueBookingHooks.onDestroy, {});
|
|
698
896
|
case 4:
|
|
699
897
|
console.log('[VenueBooking] 已销毁');
|
|
700
898
|
this.logMethodSuccess('destroy');
|
|
701
899
|
case 6:
|
|
702
900
|
case "end":
|
|
703
|
-
return
|
|
901
|
+
return _context8.stop();
|
|
704
902
|
}
|
|
705
|
-
},
|
|
903
|
+
}, _callee8, this);
|
|
706
904
|
}));
|
|
707
905
|
function destroy() {
|
|
708
906
|
return _destroy.apply(this, arguments);
|
|
@@ -712,32 +910,32 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
712
910
|
}, {
|
|
713
911
|
key: "retryInit",
|
|
714
912
|
value: function () {
|
|
715
|
-
var _retryInit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
716
|
-
return _regeneratorRuntime().wrap(function
|
|
717
|
-
while (1) switch (
|
|
913
|
+
var _retryInit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
|
|
914
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
915
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
718
916
|
case 0:
|
|
719
917
|
this.logMethodStart('retryInit');
|
|
720
918
|
console.log('[VenueBooking] retryInit 调用');
|
|
721
|
-
|
|
919
|
+
_context9.next = 4;
|
|
722
920
|
return this.core.effects.emit(VenueBookingHooks.onRetryInit, {});
|
|
723
921
|
case 4:
|
|
724
|
-
|
|
725
|
-
|
|
922
|
+
_context9.prev = 4;
|
|
923
|
+
_context9.next = 7;
|
|
726
924
|
return this.initialize(this.core, this.initializeOptions);
|
|
727
925
|
case 7:
|
|
728
926
|
this.logMethodSuccess('retryInit');
|
|
729
|
-
|
|
927
|
+
_context9.next = 14;
|
|
730
928
|
break;
|
|
731
929
|
case 10:
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
this.logMethodError('retryInit',
|
|
735
|
-
throw
|
|
930
|
+
_context9.prev = 10;
|
|
931
|
+
_context9.t0 = _context9["catch"](4);
|
|
932
|
+
this.logMethodError('retryInit', _context9.t0);
|
|
933
|
+
throw _context9.t0;
|
|
736
934
|
case 14:
|
|
737
935
|
case "end":
|
|
738
|
-
return
|
|
936
|
+
return _context9.stop();
|
|
739
937
|
}
|
|
740
|
-
},
|
|
938
|
+
}, _callee9, this, [[4, 10]]);
|
|
741
939
|
}));
|
|
742
940
|
function retryInit() {
|
|
743
941
|
return _retryInit.apply(this, arguments);
|
|
@@ -747,22 +945,22 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
747
945
|
}, {
|
|
748
946
|
key: "refresh",
|
|
749
947
|
value: function () {
|
|
750
|
-
var _refresh = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
751
|
-
return _regeneratorRuntime().wrap(function
|
|
752
|
-
while (1) switch (
|
|
948
|
+
var _refresh = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
|
|
949
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
950
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
753
951
|
case 0:
|
|
754
952
|
this.logMethodStart('refresh');
|
|
755
953
|
console.log('[VenueBooking] refresh 调用');
|
|
756
|
-
|
|
954
|
+
_context10.prev = 2;
|
|
757
955
|
this.store.status = 'initializing';
|
|
758
|
-
|
|
956
|
+
_context10.next = 6;
|
|
759
957
|
return this.loadRuntimeConfigs();
|
|
760
958
|
case 6:
|
|
761
|
-
|
|
959
|
+
_context10.next = 8;
|
|
762
960
|
return this.refreshItemRuleQuantityLimits();
|
|
763
961
|
case 8:
|
|
764
962
|
this.store.status = 'ready';
|
|
765
|
-
|
|
963
|
+
_context10.next = 11;
|
|
766
964
|
return this.core.effects.emit(VenueBookingHooks.onRefresh, {
|
|
767
965
|
status: this.store.status
|
|
768
966
|
});
|
|
@@ -770,18 +968,18 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
770
968
|
this.logMethodSuccess('refresh', {
|
|
771
969
|
status: this.store.status
|
|
772
970
|
});
|
|
773
|
-
|
|
971
|
+
_context10.next = 18;
|
|
774
972
|
break;
|
|
775
973
|
case 14:
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
this.logMethodError('refresh',
|
|
779
|
-
throw
|
|
974
|
+
_context10.prev = 14;
|
|
975
|
+
_context10.t0 = _context10["catch"](2);
|
|
976
|
+
this.logMethodError('refresh', _context10.t0);
|
|
977
|
+
throw _context10.t0;
|
|
780
978
|
case 18:
|
|
781
979
|
case "end":
|
|
782
|
-
return
|
|
980
|
+
return _context10.stop();
|
|
783
981
|
}
|
|
784
|
-
},
|
|
982
|
+
}, _callee10, this, [[2, 14]]);
|
|
785
983
|
}));
|
|
786
984
|
function refresh() {
|
|
787
985
|
return _refresh.apply(this, arguments);
|
|
@@ -822,26 +1020,26 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
822
1020
|
}, {
|
|
823
1021
|
key: "loadAllProducts",
|
|
824
1022
|
value: function () {
|
|
825
|
-
var _loadAllProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1023
|
+
var _loadAllProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
|
|
826
1024
|
var _this5 = this;
|
|
827
|
-
return _regeneratorRuntime().wrap(function
|
|
828
|
-
while (1) switch (
|
|
1025
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
1026
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
829
1027
|
case 0:
|
|
830
1028
|
if (!this.loadAllProductsInFlight) {
|
|
831
|
-
|
|
1029
|
+
_context11.next = 2;
|
|
832
1030
|
break;
|
|
833
1031
|
}
|
|
834
|
-
return
|
|
1032
|
+
return _context11.abrupt("return", this.loadAllProductsInFlight);
|
|
835
1033
|
case 2:
|
|
836
1034
|
this.loadAllProductsInFlight = this._doLoadAllProducts().finally(function () {
|
|
837
1035
|
_this5.loadAllProductsInFlight = null;
|
|
838
1036
|
});
|
|
839
|
-
return
|
|
1037
|
+
return _context11.abrupt("return", this.loadAllProductsInFlight);
|
|
840
1038
|
case 4:
|
|
841
1039
|
case "end":
|
|
842
|
-
return
|
|
1040
|
+
return _context11.stop();
|
|
843
1041
|
}
|
|
844
|
-
},
|
|
1042
|
+
}, _callee11, this);
|
|
845
1043
|
}));
|
|
846
1044
|
function loadAllProducts() {
|
|
847
1045
|
return _loadAllProducts.apply(this, arguments);
|
|
@@ -851,31 +1049,31 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
851
1049
|
}, {
|
|
852
1050
|
key: "_doLoadAllProducts",
|
|
853
1051
|
value: function () {
|
|
854
|
-
var _doLoadAllProducts2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
855
|
-
var _this$
|
|
856
|
-
return _regeneratorRuntime().wrap(function
|
|
857
|
-
while (1) switch (
|
|
1052
|
+
var _doLoadAllProducts2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
|
|
1053
|
+
var _this$otherParams12, _this$store$venueProd, associatedMenus, menuListIds, allProducts, list, venueList, addonList, venueStore, _this$store$order3, _this$store$order3$ge, products;
|
|
1054
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
1055
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
858
1056
|
case 0:
|
|
859
1057
|
this.logMethodStart('loadAllProducts');
|
|
860
|
-
|
|
1058
|
+
_context12.prev = 1;
|
|
861
1059
|
if (this.store.venueProducts) {
|
|
862
|
-
|
|
1060
|
+
_context12.next = 4;
|
|
863
1061
|
break;
|
|
864
1062
|
}
|
|
865
1063
|
throw new Error('venueProducts 模块未初始化');
|
|
866
1064
|
case 4:
|
|
867
1065
|
if (this.store.addonProducts) {
|
|
868
|
-
|
|
1066
|
+
_context12.next = 6;
|
|
869
1067
|
break;
|
|
870
1068
|
}
|
|
871
1069
|
throw new Error('addonProducts 模块未初始化');
|
|
872
1070
|
case 6:
|
|
873
|
-
|
|
1071
|
+
_context12.next = 8;
|
|
874
1072
|
return this.loadOpenDataConfig();
|
|
875
1073
|
case 8:
|
|
876
|
-
associatedMenus = ((_this$
|
|
1074
|
+
associatedMenus = ((_this$otherParams12 = this.otherParams) === null || _this$otherParams12 === void 0 || (_this$otherParams12 = _this$otherParams12.openData) === null || _this$otherParams12 === void 0 ? void 0 : _this$otherParams12['menu.associated_menus']) || [];
|
|
877
1075
|
if (associatedMenus.length) {
|
|
878
|
-
|
|
1076
|
+
_context12.next = 12;
|
|
879
1077
|
break;
|
|
880
1078
|
}
|
|
881
1079
|
this.logMethodError('loadAllProducts', new Error('未获取到餐牌配置(menu.associated_menus),请检查 OpenData 配置'));
|
|
@@ -884,7 +1082,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
884
1082
|
menuListIds = associatedMenus.map(function (n) {
|
|
885
1083
|
return Number(n.value);
|
|
886
1084
|
});
|
|
887
|
-
|
|
1085
|
+
_context12.next = 15;
|
|
888
1086
|
return this.store.venueProducts.loadProducts({
|
|
889
1087
|
menu_list_ids: menuListIds,
|
|
890
1088
|
cacheId: this.cacheId,
|
|
@@ -892,7 +1090,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
892
1090
|
schedule_datetime: dayjs().format('YYYY-MM-DD HH:mm:ss')
|
|
893
1091
|
});
|
|
894
1092
|
case 15:
|
|
895
|
-
allProducts =
|
|
1093
|
+
allProducts = _context12.sent;
|
|
896
1094
|
list = Array.isArray(allProducts) ? allProducts : [];
|
|
897
1095
|
venueList = list.filter(function (p) {
|
|
898
1096
|
return p.duration != null;
|
|
@@ -908,6 +1106,16 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
908
1106
|
}
|
|
909
1107
|
this.store.addonProducts.addProduct(addonList);
|
|
910
1108
|
this.resourceProductMap = buildResourceProductMap(venueList);
|
|
1109
|
+
|
|
1110
|
+
// 加载 holder 表单
|
|
1111
|
+
if (!this.store.order) {
|
|
1112
|
+
_context12.next = 27;
|
|
1113
|
+
break;
|
|
1114
|
+
}
|
|
1115
|
+
products = ((_this$store$order3 = this.store.order) === null || _this$store$order3 === void 0 || (_this$store$order3$ge = _this$store$order3.getOrderProducts) === null || _this$store$order3$ge === void 0 ? void 0 : _this$store$order3$ge.call(_this$store$order3)) || [];
|
|
1116
|
+
_context12.next = 27;
|
|
1117
|
+
return this.preloadHolderForms(products);
|
|
1118
|
+
case 27:
|
|
911
1119
|
this.productsLoaded = true;
|
|
912
1120
|
this.logMethodSuccess('loadAllProducts', {
|
|
913
1121
|
total: list.length,
|
|
@@ -915,20 +1123,20 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
915
1123
|
addonCount: addonList.length,
|
|
916
1124
|
resourceCount: this.resourceProductMap.size
|
|
917
1125
|
});
|
|
918
|
-
return
|
|
1126
|
+
return _context12.abrupt("return", {
|
|
919
1127
|
venueProducts: venueList,
|
|
920
1128
|
addonProducts: addonList
|
|
921
1129
|
});
|
|
922
|
-
case 28:
|
|
923
|
-
_context11.prev = 28;
|
|
924
|
-
_context11.t0 = _context11["catch"](1);
|
|
925
|
-
this.logMethodError('loadAllProducts', _context11.t0);
|
|
926
|
-
throw _context11.t0;
|
|
927
1130
|
case 32:
|
|
1131
|
+
_context12.prev = 32;
|
|
1132
|
+
_context12.t0 = _context12["catch"](1);
|
|
1133
|
+
this.logMethodError('loadAllProducts', _context12.t0);
|
|
1134
|
+
throw _context12.t0;
|
|
1135
|
+
case 36:
|
|
928
1136
|
case "end":
|
|
929
|
-
return
|
|
1137
|
+
return _context12.stop();
|
|
930
1138
|
}
|
|
931
|
-
},
|
|
1139
|
+
}, _callee12, this, [[1, 32]]);
|
|
932
1140
|
}));
|
|
933
1141
|
function _doLoadAllProducts() {
|
|
934
1142
|
return _doLoadAllProducts2.apply(this, arguments);
|
|
@@ -938,21 +1146,21 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
938
1146
|
}, {
|
|
939
1147
|
key: "loadVenueProducts",
|
|
940
1148
|
value: function () {
|
|
941
|
-
var _loadVenueProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1149
|
+
var _loadVenueProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
|
|
942
1150
|
var result;
|
|
943
|
-
return _regeneratorRuntime().wrap(function
|
|
944
|
-
while (1) switch (
|
|
1151
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
1152
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
945
1153
|
case 0:
|
|
946
|
-
|
|
1154
|
+
_context13.next = 2;
|
|
947
1155
|
return this.loadAllProducts();
|
|
948
1156
|
case 2:
|
|
949
|
-
result =
|
|
950
|
-
return
|
|
1157
|
+
result = _context13.sent;
|
|
1158
|
+
return _context13.abrupt("return", result.venueProducts);
|
|
951
1159
|
case 4:
|
|
952
1160
|
case "end":
|
|
953
|
-
return
|
|
1161
|
+
return _context13.stop();
|
|
954
1162
|
}
|
|
955
|
-
},
|
|
1163
|
+
}, _callee13, this);
|
|
956
1164
|
}));
|
|
957
1165
|
function loadVenueProducts() {
|
|
958
1166
|
return _loadVenueProducts.apply(this, arguments);
|
|
@@ -962,21 +1170,21 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
962
1170
|
}, {
|
|
963
1171
|
key: "loadAddonProducts",
|
|
964
1172
|
value: function () {
|
|
965
|
-
var _loadAddonProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1173
|
+
var _loadAddonProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
|
|
966
1174
|
var result;
|
|
967
|
-
return _regeneratorRuntime().wrap(function
|
|
968
|
-
while (1) switch (
|
|
1175
|
+
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
1176
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
969
1177
|
case 0:
|
|
970
|
-
|
|
1178
|
+
_context14.next = 2;
|
|
971
1179
|
return this.loadAllProducts();
|
|
972
1180
|
case 2:
|
|
973
|
-
result =
|
|
974
|
-
return
|
|
1181
|
+
result = _context14.sent;
|
|
1182
|
+
return _context14.abrupt("return", result.addonProducts);
|
|
975
1183
|
case 4:
|
|
976
1184
|
case "end":
|
|
977
|
-
return
|
|
1185
|
+
return _context14.stop();
|
|
978
1186
|
}
|
|
979
|
-
},
|
|
1187
|
+
}, _callee14, this);
|
|
980
1188
|
}));
|
|
981
1189
|
function loadAddonProducts() {
|
|
982
1190
|
return _loadAddonProducts.apply(this, arguments);
|
|
@@ -1000,38 +1208,38 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1000
1208
|
}, {
|
|
1001
1209
|
key: "loadQuotations",
|
|
1002
1210
|
value: function () {
|
|
1003
|
-
var _loadQuotations = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1004
|
-
return _regeneratorRuntime().wrap(function
|
|
1005
|
-
while (1) switch (
|
|
1211
|
+
var _loadQuotations = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(params) {
|
|
1212
|
+
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
1213
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
1006
1214
|
case 0:
|
|
1007
1215
|
this.logMethodStart('loadQuotations');
|
|
1008
|
-
|
|
1216
|
+
_context15.prev = 1;
|
|
1009
1217
|
if (this.store.quotation) {
|
|
1010
|
-
|
|
1218
|
+
_context15.next = 4;
|
|
1011
1219
|
break;
|
|
1012
1220
|
}
|
|
1013
1221
|
throw new Error('quotation 模块未初始化');
|
|
1014
1222
|
case 4:
|
|
1015
|
-
|
|
1223
|
+
_context15.next = 6;
|
|
1016
1224
|
return this.store.quotation.loadQuotations(params);
|
|
1017
1225
|
case 6:
|
|
1018
1226
|
this.logMethodSuccess('loadQuotations', {
|
|
1019
1227
|
count: this.store.quotation.getQuotationList().length
|
|
1020
1228
|
});
|
|
1021
|
-
|
|
1229
|
+
_context15.next = 13;
|
|
1022
1230
|
break;
|
|
1023
1231
|
case 9:
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
this.logMethodError('loadQuotations',
|
|
1027
|
-
throw
|
|
1232
|
+
_context15.prev = 9;
|
|
1233
|
+
_context15.t0 = _context15["catch"](1);
|
|
1234
|
+
this.logMethodError('loadQuotations', _context15.t0);
|
|
1235
|
+
throw _context15.t0;
|
|
1028
1236
|
case 13:
|
|
1029
1237
|
case "end":
|
|
1030
|
-
return
|
|
1238
|
+
return _context15.stop();
|
|
1031
1239
|
}
|
|
1032
|
-
},
|
|
1240
|
+
}, _callee15, this, [[1, 9]]);
|
|
1033
1241
|
}));
|
|
1034
|
-
function loadQuotations(
|
|
1242
|
+
function loadQuotations(_x7) {
|
|
1035
1243
|
return _loadQuotations.apply(this, arguments);
|
|
1036
1244
|
}
|
|
1037
1245
|
return loadQuotations;
|
|
@@ -1039,46 +1247,46 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1039
1247
|
}, {
|
|
1040
1248
|
key: "fetchResourceAvailability",
|
|
1041
1249
|
value: function () {
|
|
1042
|
-
var _fetchResourceAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1043
|
-
var venueProducts, resourceIds, config, crossDay, effectiveEndDate, res, rawData,
|
|
1044
|
-
return _regeneratorRuntime().wrap(function
|
|
1045
|
-
while (1) switch (
|
|
1250
|
+
var _fetchResourceAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(params) {
|
|
1251
|
+
var venueProducts, resourceIds, config, crossDay, effectiveEndDate, res, rawData, _iterator3, _step3, item, _i3, _rawData, _item, mappings, _iterator4, _step4, mapping;
|
|
1252
|
+
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
1253
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
1046
1254
|
case 0:
|
|
1047
1255
|
this.logMethodStart('fetchResourceAvailability', params);
|
|
1048
|
-
|
|
1256
|
+
_context16.prev = 1;
|
|
1049
1257
|
venueProducts = this.getVenueProducts();
|
|
1050
1258
|
if (venueProducts.length) {
|
|
1051
|
-
|
|
1259
|
+
_context16.next = 7;
|
|
1052
1260
|
break;
|
|
1053
1261
|
}
|
|
1054
1262
|
this.store.rawResourceData = [];
|
|
1055
1263
|
this.logMethodSuccess('fetchResourceAvailability', {
|
|
1056
1264
|
resourceCount: 0
|
|
1057
1265
|
});
|
|
1058
|
-
return
|
|
1266
|
+
return _context16.abrupt("return");
|
|
1059
1267
|
case 7:
|
|
1060
1268
|
resourceIds = extractResourceIds(venueProducts);
|
|
1061
1269
|
if (resourceIds.length) {
|
|
1062
|
-
|
|
1270
|
+
_context16.next = 12;
|
|
1063
1271
|
break;
|
|
1064
1272
|
}
|
|
1065
1273
|
this.store.rawResourceData = [];
|
|
1066
1274
|
this.logMethodSuccess('fetchResourceAvailability', {
|
|
1067
1275
|
resourceIds: []
|
|
1068
1276
|
});
|
|
1069
|
-
return
|
|
1277
|
+
return _context16.abrupt("return");
|
|
1070
1278
|
case 12:
|
|
1071
1279
|
// 跨天营业时,endDate 扩展一天以覆盖次日凌晨时段
|
|
1072
1280
|
config = this.store.slotConfig;
|
|
1073
1281
|
crossDay = isBusinessHoursCrossDay(config);
|
|
1074
1282
|
effectiveEndDate = crossDay ? dayjs(params.endDate).add(1, 'day').format('YYYY-MM-DD') : params.endDate;
|
|
1075
1283
|
if (this.store.date) {
|
|
1076
|
-
|
|
1284
|
+
_context16.next = 17;
|
|
1077
1285
|
break;
|
|
1078
1286
|
}
|
|
1079
1287
|
throw new Error('date 模块未初始化');
|
|
1080
1288
|
case 17:
|
|
1081
|
-
|
|
1289
|
+
_context16.next = 19;
|
|
1082
1290
|
return this.store.date.fetchResourceDates({
|
|
1083
1291
|
query: {
|
|
1084
1292
|
start_date: params.startDate,
|
|
@@ -1088,13 +1296,13 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1088
1296
|
useCache: false
|
|
1089
1297
|
});
|
|
1090
1298
|
case 19:
|
|
1091
|
-
res =
|
|
1299
|
+
res = _context16.sent;
|
|
1092
1300
|
rawData = [];
|
|
1093
1301
|
if (res !== null && res !== void 0 && res.data && Array.isArray(res.data)) {
|
|
1094
|
-
|
|
1302
|
+
_iterator3 = _createForOfIteratorHelper(res.data);
|
|
1095
1303
|
try {
|
|
1096
|
-
for (
|
|
1097
|
-
item =
|
|
1304
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
1305
|
+
item = _step3.value;
|
|
1098
1306
|
rawData.push(_objectSpread({
|
|
1099
1307
|
resourceId: item.id,
|
|
1100
1308
|
formId: item.form_id,
|
|
@@ -1102,41 +1310,41 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1102
1310
|
}, item));
|
|
1103
1311
|
}
|
|
1104
1312
|
} catch (err) {
|
|
1105
|
-
|
|
1313
|
+
_iterator3.e(err);
|
|
1106
1314
|
} finally {
|
|
1107
|
-
|
|
1315
|
+
_iterator3.f();
|
|
1108
1316
|
}
|
|
1109
1317
|
}
|
|
1110
1318
|
this.store.rawResourceData = rawData;
|
|
1111
1319
|
_i3 = 0, _rawData = rawData;
|
|
1112
1320
|
case 24:
|
|
1113
1321
|
if (!(_i3 < _rawData.length)) {
|
|
1114
|
-
|
|
1322
|
+
_context16.next = 34;
|
|
1115
1323
|
break;
|
|
1116
1324
|
}
|
|
1117
1325
|
_item = _rawData[_i3];
|
|
1118
1326
|
mappings = this.resourceProductMap.get(_item.resourceId);
|
|
1119
1327
|
if (mappings) {
|
|
1120
|
-
|
|
1328
|
+
_context16.next = 29;
|
|
1121
1329
|
break;
|
|
1122
1330
|
}
|
|
1123
|
-
return
|
|
1331
|
+
return _context16.abrupt("continue", 31);
|
|
1124
1332
|
case 29:
|
|
1125
|
-
|
|
1333
|
+
_iterator4 = _createForOfIteratorHelper(mappings);
|
|
1126
1334
|
try {
|
|
1127
|
-
for (
|
|
1128
|
-
mapping =
|
|
1335
|
+
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
1336
|
+
mapping = _step4.value;
|
|
1129
1337
|
if (_item.main_field) mapping.resourceName = _item.main_field;
|
|
1130
1338
|
if (_item.resource_form_id) mapping.formId = _item.resource_form_id;
|
|
1131
1339
|
}
|
|
1132
1340
|
} catch (err) {
|
|
1133
|
-
|
|
1341
|
+
_iterator4.e(err);
|
|
1134
1342
|
} finally {
|
|
1135
|
-
|
|
1343
|
+
_iterator4.f();
|
|
1136
1344
|
}
|
|
1137
1345
|
case 31:
|
|
1138
1346
|
_i3++;
|
|
1139
|
-
|
|
1347
|
+
_context16.next = 24;
|
|
1140
1348
|
break;
|
|
1141
1349
|
case 34:
|
|
1142
1350
|
this.logMethodSuccess('fetchResourceAvailability', {
|
|
@@ -1145,21 +1353,21 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1145
1353
|
return sum + r.times.length;
|
|
1146
1354
|
}, 0)
|
|
1147
1355
|
});
|
|
1148
|
-
|
|
1356
|
+
_context16.next = 42;
|
|
1149
1357
|
break;
|
|
1150
1358
|
case 37:
|
|
1151
|
-
|
|
1152
|
-
|
|
1359
|
+
_context16.prev = 37;
|
|
1360
|
+
_context16.t0 = _context16["catch"](1);
|
|
1153
1361
|
this.store.rawResourceData = [];
|
|
1154
|
-
this.logMethodError('fetchResourceAvailability',
|
|
1155
|
-
throw
|
|
1362
|
+
this.logMethodError('fetchResourceAvailability', _context16.t0);
|
|
1363
|
+
throw _context16.t0;
|
|
1156
1364
|
case 42:
|
|
1157
1365
|
case "end":
|
|
1158
|
-
return
|
|
1366
|
+
return _context16.stop();
|
|
1159
1367
|
}
|
|
1160
|
-
},
|
|
1368
|
+
}, _callee16, this, [[1, 37]]);
|
|
1161
1369
|
}));
|
|
1162
|
-
function fetchResourceAvailability(
|
|
1370
|
+
function fetchResourceAvailability(_x8) {
|
|
1163
1371
|
return _fetchResourceAvailability.apply(this, arguments);
|
|
1164
1372
|
}
|
|
1165
1373
|
return fetchResourceAvailability;
|
|
@@ -1191,18 +1399,18 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1191
1399
|
var timeRangeMap = calcMinTimeMaxTimeBySchedules(scheduleList, undefined, date);
|
|
1192
1400
|
var earliestStart = null;
|
|
1193
1401
|
var latestEnd = null;
|
|
1194
|
-
var
|
|
1195
|
-
|
|
1402
|
+
var _iterator5 = _createForOfIteratorHelper(scheduleList),
|
|
1403
|
+
_step5;
|
|
1196
1404
|
try {
|
|
1197
|
-
for (
|
|
1405
|
+
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
|
|
1198
1406
|
var _timeRangeMap$schedul;
|
|
1199
|
-
var schedule =
|
|
1407
|
+
var schedule = _step5.value;
|
|
1200
1408
|
var dateRangeList = (timeRangeMap === null || timeRangeMap === void 0 || (_timeRangeMap$schedul = timeRangeMap[schedule.id]) === null || _timeRangeMap$schedul === void 0 ? void 0 : _timeRangeMap$schedul.dateRangeFormat) || [];
|
|
1201
|
-
var
|
|
1202
|
-
|
|
1409
|
+
var _iterator6 = _createForOfIteratorHelper(dateRangeList),
|
|
1410
|
+
_step6;
|
|
1203
1411
|
try {
|
|
1204
|
-
for (
|
|
1205
|
-
var range =
|
|
1412
|
+
for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
|
|
1413
|
+
var range = _step6.value;
|
|
1206
1414
|
var start = dayjs(range === null || range === void 0 ? void 0 : range.start);
|
|
1207
1415
|
var end = dayjs(range === null || range === void 0 ? void 0 : range.end);
|
|
1208
1416
|
if (!start.isValid() || !end.isValid()) continue;
|
|
@@ -1214,15 +1422,15 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1214
1422
|
}
|
|
1215
1423
|
}
|
|
1216
1424
|
} catch (err) {
|
|
1217
|
-
|
|
1425
|
+
_iterator6.e(err);
|
|
1218
1426
|
} finally {
|
|
1219
|
-
|
|
1427
|
+
_iterator6.f();
|
|
1220
1428
|
}
|
|
1221
1429
|
}
|
|
1222
1430
|
} catch (err) {
|
|
1223
|
-
|
|
1431
|
+
_iterator5.e(err);
|
|
1224
1432
|
} finally {
|
|
1225
|
-
|
|
1433
|
+
_iterator5.f();
|
|
1226
1434
|
}
|
|
1227
1435
|
if (!earliestStart || !latestEnd) return nextSlotConfig;
|
|
1228
1436
|
return _objectSpread(_objectSpread({}, nextSlotConfig), {}, {
|
|
@@ -1292,20 +1500,20 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1292
1500
|
}, {
|
|
1293
1501
|
key: "toggleSlot",
|
|
1294
1502
|
value: function () {
|
|
1295
|
-
var _toggleSlot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1503
|
+
var _toggleSlot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(slot) {
|
|
1296
1504
|
var mappings, mapping, currentSlots, existIndex, nextSlots, products;
|
|
1297
|
-
return _regeneratorRuntime().wrap(function
|
|
1298
|
-
while (1) switch (
|
|
1505
|
+
return _regeneratorRuntime().wrap(function _callee17$(_context17) {
|
|
1506
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
1299
1507
|
case 0:
|
|
1300
1508
|
this.logMethodStart('toggleSlot', {
|
|
1301
1509
|
resourceId: slot.resourceId,
|
|
1302
1510
|
productId: slot.productId,
|
|
1303
1511
|
startTime: slot.startTime
|
|
1304
1512
|
});
|
|
1305
|
-
|
|
1513
|
+
_context17.prev = 1;
|
|
1306
1514
|
mappings = this.resourceProductMap.get(slot.resourceId);
|
|
1307
1515
|
if (!(!mappings || !mappings.length)) {
|
|
1308
|
-
|
|
1516
|
+
_context17.next = 5;
|
|
1309
1517
|
break;
|
|
1310
1518
|
}
|
|
1311
1519
|
throw new Error("\u672A\u627E\u5230\u8D44\u6E90 ".concat(slot.resourceId, " \u7684\u5546\u54C1\u6620\u5C04"));
|
|
@@ -1314,13 +1522,13 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1314
1522
|
return m.productId === slot.productId;
|
|
1315
1523
|
});
|
|
1316
1524
|
if (mapping) {
|
|
1317
|
-
|
|
1525
|
+
_context17.next = 8;
|
|
1318
1526
|
break;
|
|
1319
1527
|
}
|
|
1320
1528
|
throw new Error("\u8D44\u6E90 ".concat(slot.resourceId, " \u672A\u5173\u8054\u5546\u54C1 ").concat(slot.productId));
|
|
1321
1529
|
case 8:
|
|
1322
1530
|
if (this.store.order) {
|
|
1323
|
-
|
|
1531
|
+
_context17.next = 10;
|
|
1324
1532
|
break;
|
|
1325
1533
|
}
|
|
1326
1534
|
throw new Error('order 模块未初始化');
|
|
@@ -1336,14 +1544,14 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1336
1544
|
} else {
|
|
1337
1545
|
nextSlots = [].concat(_toConsumableArray(currentSlots), [slot]);
|
|
1338
1546
|
}
|
|
1339
|
-
|
|
1547
|
+
_context17.next = 15;
|
|
1340
1548
|
return this.reconcileOrderForResourceProduct(slot.resourceId, slot.productId, nextSlots);
|
|
1341
1549
|
case 15:
|
|
1342
1550
|
products = this.store.order.getOrderProducts();
|
|
1343
|
-
|
|
1551
|
+
_context17.next = 18;
|
|
1344
1552
|
return this.refreshItemRuleQuantityLimits();
|
|
1345
1553
|
case 18:
|
|
1346
|
-
|
|
1554
|
+
_context17.next = 20;
|
|
1347
1555
|
return this.refreshCartValidationPassed();
|
|
1348
1556
|
case 20:
|
|
1349
1557
|
this.logMethodSuccess('toggleSlot', {
|
|
@@ -1352,19 +1560,19 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1352
1560
|
productId: slot.productId,
|
|
1353
1561
|
slotCount: nextSlots.length
|
|
1354
1562
|
});
|
|
1355
|
-
return
|
|
1563
|
+
return _context17.abrupt("return", products);
|
|
1356
1564
|
case 24:
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
this.logMethodError('toggleSlot',
|
|
1360
|
-
throw
|
|
1565
|
+
_context17.prev = 24;
|
|
1566
|
+
_context17.t0 = _context17["catch"](1);
|
|
1567
|
+
this.logMethodError('toggleSlot', _context17.t0);
|
|
1568
|
+
throw _context17.t0;
|
|
1361
1569
|
case 28:
|
|
1362
1570
|
case "end":
|
|
1363
|
-
return
|
|
1571
|
+
return _context17.stop();
|
|
1364
1572
|
}
|
|
1365
|
-
},
|
|
1573
|
+
}, _callee17, this, [[1, 24]]);
|
|
1366
1574
|
}));
|
|
1367
|
-
function toggleSlot(
|
|
1575
|
+
function toggleSlot(_x9) {
|
|
1368
1576
|
return _toggleSlot.apply(this, arguments);
|
|
1369
1577
|
}
|
|
1370
1578
|
return toggleSlot;
|
|
@@ -1376,8 +1584,8 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1376
1584
|
}, {
|
|
1377
1585
|
key: "getSelectedSlotsForResource",
|
|
1378
1586
|
value: function getSelectedSlotsForResource(resourceId, productId) {
|
|
1379
|
-
var _this$store$
|
|
1380
|
-
var tempOrder = (_this$store$
|
|
1587
|
+
var _this$store$order4;
|
|
1588
|
+
var tempOrder = (_this$store$order4 = this.store.order) === null || _this$store$order4 === void 0 ? void 0 : _this$store$order4.getTempOrder();
|
|
1381
1589
|
if (!tempOrder) return [];
|
|
1382
1590
|
var venueProducts = tempOrder.products.filter(function (p) {
|
|
1383
1591
|
var _p$metadata, _p$metadata2;
|
|
@@ -1388,24 +1596,24 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1388
1596
|
});
|
|
1389
1597
|
var slotDuration = this.store.slotConfig.slotDurationMinutes;
|
|
1390
1598
|
var slots = [];
|
|
1391
|
-
var
|
|
1392
|
-
|
|
1599
|
+
var _iterator7 = _createForOfIteratorHelper(venueProducts),
|
|
1600
|
+
_step7;
|
|
1393
1601
|
try {
|
|
1394
1602
|
var _loop = function _loop() {
|
|
1395
|
-
var product =
|
|
1603
|
+
var product = _step7.value;
|
|
1396
1604
|
slots.push.apply(slots, _toConsumableArray(expandMergedSlotToIndividual(product, slotDuration).map(function (s) {
|
|
1397
1605
|
return _objectSpread(_objectSpread({}, s), {}, {
|
|
1398
1606
|
productId: Number(product.product_id)
|
|
1399
1607
|
});
|
|
1400
1608
|
})));
|
|
1401
1609
|
};
|
|
1402
|
-
for (
|
|
1610
|
+
for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
|
|
1403
1611
|
_loop();
|
|
1404
1612
|
}
|
|
1405
1613
|
} catch (err) {
|
|
1406
|
-
|
|
1614
|
+
_iterator7.e(err);
|
|
1407
1615
|
} finally {
|
|
1408
|
-
|
|
1616
|
+
_iterator7.f();
|
|
1409
1617
|
}
|
|
1410
1618
|
return slots.sort(function (a, b) {
|
|
1411
1619
|
return a.startTime.localeCompare(b.startTime);
|
|
@@ -1478,28 +1686,28 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1478
1686
|
|
|
1479
1687
|
// 规则 2:当前是组合资源,任一子资源被选 → 禁用
|
|
1480
1688
|
if (currentIsCombined) {
|
|
1481
|
-
var
|
|
1482
|
-
|
|
1689
|
+
var _iterator8 = _createForOfIteratorHelper(currentChildIds),
|
|
1690
|
+
_step8;
|
|
1483
1691
|
try {
|
|
1484
|
-
for (
|
|
1485
|
-
var childId =
|
|
1692
|
+
for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
|
|
1693
|
+
var childId = _step8.value;
|
|
1486
1694
|
if (getSelectedAt(childId).length > 0) return true;
|
|
1487
1695
|
}
|
|
1488
1696
|
} catch (err) {
|
|
1489
|
-
|
|
1697
|
+
_iterator8.e(err);
|
|
1490
1698
|
} finally {
|
|
1491
|
-
|
|
1699
|
+
_iterator8.f();
|
|
1492
1700
|
}
|
|
1493
1701
|
}
|
|
1494
1702
|
|
|
1495
1703
|
// 规则 3 & 4:扫描所有已选的 (resId),若是组合资源,检查其 children 是否包含当前 resourceId 或与当前 child 集合有交集
|
|
1496
|
-
var
|
|
1497
|
-
|
|
1704
|
+
var _iterator9 = _createForOfIteratorHelper(allSelected),
|
|
1705
|
+
_step9;
|
|
1498
1706
|
try {
|
|
1499
|
-
for (
|
|
1500
|
-
var
|
|
1501
|
-
selectedResId =
|
|
1502
|
-
slots =
|
|
1707
|
+
for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
|
|
1708
|
+
var _step9$value = _slicedToArray(_step9.value, 2),
|
|
1709
|
+
selectedResId = _step9$value[0],
|
|
1710
|
+
slots = _step9$value[1];
|
|
1503
1711
|
if (!slots.some(function (s) {
|
|
1504
1712
|
return s.startTime === startTime;
|
|
1505
1713
|
})) continue;
|
|
@@ -1525,9 +1733,9 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1525
1733
|
}
|
|
1526
1734
|
}
|
|
1527
1735
|
} catch (err) {
|
|
1528
|
-
|
|
1736
|
+
_iterator9.e(err);
|
|
1529
1737
|
} finally {
|
|
1530
|
-
|
|
1738
|
+
_iterator9.f();
|
|
1531
1739
|
}
|
|
1532
1740
|
return false;
|
|
1533
1741
|
}
|
|
@@ -1538,22 +1746,22 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1538
1746
|
}, {
|
|
1539
1747
|
key: "getAllSelectedSlots",
|
|
1540
1748
|
value: function getAllSelectedSlots() {
|
|
1541
|
-
var _this$store$
|
|
1749
|
+
var _this$store$order5;
|
|
1542
1750
|
var result = new Map();
|
|
1543
|
-
var tempOrder = (_this$store$
|
|
1751
|
+
var tempOrder = (_this$store$order5 = this.store.order) === null || _this$store$order5 === void 0 ? void 0 : _this$store$order5.getTempOrder();
|
|
1544
1752
|
if (!tempOrder) return result;
|
|
1545
1753
|
var venueProducts = tempOrder.products.filter(function (p) {
|
|
1546
1754
|
var _p$metadata3;
|
|
1547
1755
|
return (_p$metadata3 = p.metadata) === null || _p$metadata3 === void 0 ? void 0 : _p$metadata3.venue_booking;
|
|
1548
1756
|
});
|
|
1549
1757
|
var slotDuration = this.store.slotConfig.slotDurationMinutes;
|
|
1550
|
-
var
|
|
1551
|
-
|
|
1758
|
+
var _iterator10 = _createForOfIteratorHelper(venueProducts),
|
|
1759
|
+
_step10;
|
|
1552
1760
|
try {
|
|
1553
1761
|
var _loop2 = function _loop2() {
|
|
1554
|
-
var _product$
|
|
1555
|
-
var product =
|
|
1556
|
-
var resourceId = (_product$
|
|
1762
|
+
var _product$metadata2;
|
|
1763
|
+
var product = _step10.value;
|
|
1764
|
+
var resourceId = (_product$metadata2 = product.metadata) === null || _product$metadata2 === void 0 ? void 0 : _product$metadata2.resource_id;
|
|
1557
1765
|
if (resourceId == null) return 1; // continue
|
|
1558
1766
|
var productId = Number(product.product_id);
|
|
1559
1767
|
var existing = result.get(resourceId) || [];
|
|
@@ -1564,29 +1772,29 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1564
1772
|
})));
|
|
1565
1773
|
result.set(resourceId, existing);
|
|
1566
1774
|
};
|
|
1567
|
-
for (
|
|
1775
|
+
for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
|
|
1568
1776
|
if (_loop2()) continue;
|
|
1569
1777
|
}
|
|
1570
1778
|
} catch (err) {
|
|
1571
|
-
|
|
1779
|
+
_iterator10.e(err);
|
|
1572
1780
|
} finally {
|
|
1573
|
-
|
|
1781
|
+
_iterator10.f();
|
|
1574
1782
|
}
|
|
1575
|
-
var
|
|
1576
|
-
|
|
1783
|
+
var _iterator11 = _createForOfIteratorHelper(result),
|
|
1784
|
+
_step11;
|
|
1577
1785
|
try {
|
|
1578
|
-
for (
|
|
1579
|
-
var
|
|
1580
|
-
key =
|
|
1581
|
-
slots =
|
|
1786
|
+
for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) {
|
|
1787
|
+
var _step11$value = _slicedToArray(_step11.value, 2),
|
|
1788
|
+
key = _step11$value[0],
|
|
1789
|
+
slots = _step11$value[1];
|
|
1582
1790
|
result.set(key, slots.sort(function (a, b) {
|
|
1583
1791
|
return a.startTime.localeCompare(b.startTime);
|
|
1584
1792
|
}));
|
|
1585
1793
|
}
|
|
1586
1794
|
} catch (err) {
|
|
1587
|
-
|
|
1795
|
+
_iterator11.e(err);
|
|
1588
1796
|
} finally {
|
|
1589
|
-
|
|
1797
|
+
_iterator11.f();
|
|
1590
1798
|
}
|
|
1591
1799
|
return result;
|
|
1592
1800
|
}
|
|
@@ -1599,26 +1807,27 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1599
1807
|
}, {
|
|
1600
1808
|
key: "reconcileOrderForResourceProduct",
|
|
1601
1809
|
value: (function () {
|
|
1602
|
-
var _reconcileOrderForResourceProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1603
|
-
var
|
|
1604
|
-
|
|
1605
|
-
|
|
1810
|
+
var _reconcileOrderForResourceProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(resourceId, productId, slots) {
|
|
1811
|
+
var _this$store$order6, _this$store$order6$ge;
|
|
1812
|
+
var mappings, mapping, tempOrder, matchesCurrent, merged, rawResource, childRawResources, venueProduct, i, _rawResource$form_id, _venueProduct$is_char, group, identityKey, bookingUuid, startMoment, endMoment, duration, customDepositData, productTitle, resourceEntry, venueProductOrigin, normalizedVenueOrderProduct, venueOrderProduct, booking, products;
|
|
1813
|
+
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
1814
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
1606
1815
|
case 0:
|
|
1607
1816
|
mappings = this.resourceProductMap.get(resourceId);
|
|
1608
1817
|
if (!(!mappings || !mappings.length || !this.store.order)) {
|
|
1609
|
-
|
|
1818
|
+
_context18.next = 3;
|
|
1610
1819
|
break;
|
|
1611
1820
|
}
|
|
1612
|
-
return
|
|
1821
|
+
return _context18.abrupt("return");
|
|
1613
1822
|
case 3:
|
|
1614
1823
|
mapping = mappings.find(function (m) {
|
|
1615
1824
|
return m.productId === productId;
|
|
1616
1825
|
});
|
|
1617
1826
|
if (mapping) {
|
|
1618
|
-
|
|
1827
|
+
_context18.next = 6;
|
|
1619
1828
|
break;
|
|
1620
1829
|
}
|
|
1621
|
-
return
|
|
1830
|
+
return _context18.abrupt("return");
|
|
1622
1831
|
case 6:
|
|
1623
1832
|
tempOrder = this.store.order.ensureTempOrder();
|
|
1624
1833
|
matchesCurrent = function matchesCurrent(meta, pid) {
|
|
@@ -1636,17 +1845,17 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1636
1845
|
return Number(bookingProductId) !== Number(productId);
|
|
1637
1846
|
});
|
|
1638
1847
|
if (slots.length) {
|
|
1639
|
-
|
|
1848
|
+
_context18.next = 16;
|
|
1640
1849
|
break;
|
|
1641
1850
|
}
|
|
1642
1851
|
this.store.order.applyDiscount();
|
|
1643
|
-
|
|
1852
|
+
_context18.next = 14;
|
|
1644
1853
|
return this.store.order.recalculateSummary({
|
|
1645
1854
|
createIfMissing: true
|
|
1646
1855
|
});
|
|
1647
1856
|
case 14:
|
|
1648
1857
|
this.store.order.persistTempOrder();
|
|
1649
|
-
return
|
|
1858
|
+
return _context18.abrupt("return");
|
|
1650
1859
|
case 16:
|
|
1651
1860
|
merged = mergeConsecutiveSlots(slots);
|
|
1652
1861
|
rawResource = this.store.rawResourceData.find(function (r) {
|
|
@@ -1665,6 +1874,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1665
1874
|
endMoment = dayjs(group.endTime, 'YYYY-MM-DD HH:mm');
|
|
1666
1875
|
duration = endMoment.diff(startMoment, 'minute');
|
|
1667
1876
|
customDepositData = cloneCustomDepositData(venueProduct === null || venueProduct === void 0 ? void 0 : venueProduct.custom_deposit_data);
|
|
1877
|
+
productTitle = this.normalizeVenueProductTitle(venueProduct === null || venueProduct === void 0 ? void 0 : venueProduct.product_title) || this.normalizeVenueProductTitle(venueProduct === null || venueProduct === void 0 ? void 0 : venueProduct.title) || this.normalizeVenueProductTitle(mapping.productTitle);
|
|
1668
1878
|
resourceEntry = {
|
|
1669
1879
|
relation_type: 'form',
|
|
1670
1880
|
like_status: 'common',
|
|
@@ -1693,7 +1903,45 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1693
1903
|
};
|
|
1694
1904
|
});
|
|
1695
1905
|
}
|
|
1696
|
-
|
|
1906
|
+
venueProductOrigin = {
|
|
1907
|
+
name: mapping.productTitle,
|
|
1908
|
+
product_title: productTitle,
|
|
1909
|
+
cover: (venueProduct === null || venueProduct === void 0 ? void 0 : venueProduct.cover) || '',
|
|
1910
|
+
custom_deposit_data: customDepositData,
|
|
1911
|
+
id: 0,
|
|
1912
|
+
number: 1,
|
|
1913
|
+
registration_type: 'all',
|
|
1914
|
+
relation_products: [],
|
|
1915
|
+
is_all: false,
|
|
1916
|
+
product: {
|
|
1917
|
+
product_id: mapping.productId,
|
|
1918
|
+
product_variant_id: 0,
|
|
1919
|
+
num: 1,
|
|
1920
|
+
product_bundle: [],
|
|
1921
|
+
product_sku: {
|
|
1922
|
+
option: []
|
|
1923
|
+
},
|
|
1924
|
+
discount_list: [],
|
|
1925
|
+
custom_deposit_data: customDepositData,
|
|
1926
|
+
metadata: {}
|
|
1927
|
+
},
|
|
1928
|
+
sub_type: 'minutes',
|
|
1929
|
+
duration: duration,
|
|
1930
|
+
like_status: 'common',
|
|
1931
|
+
resources: [resourceEntry],
|
|
1932
|
+
schedule_id: 0,
|
|
1933
|
+
select_date: startMoment.format('YYYY-MM-DD'),
|
|
1934
|
+
start_date: startMoment.format('YYYY-MM-DD'),
|
|
1935
|
+
start_time: startMoment.format('HH:mm'),
|
|
1936
|
+
end_date: endMoment.format('YYYY-MM-DD'),
|
|
1937
|
+
end_time: endMoment.format('HH:mm'),
|
|
1938
|
+
metadata: {
|
|
1939
|
+
venue_booking: true,
|
|
1940
|
+
slot_count: group.slotCount
|
|
1941
|
+
},
|
|
1942
|
+
holder: null
|
|
1943
|
+
};
|
|
1944
|
+
normalizedVenueOrderProduct = normalizeOrderProduct({
|
|
1697
1945
|
product_id: mapping.productId,
|
|
1698
1946
|
product_variant_id: 0,
|
|
1699
1947
|
identity_key: identityKey,
|
|
@@ -1701,8 +1949,11 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1701
1949
|
selling_price: group.totalPrice,
|
|
1702
1950
|
original_price: group.totalPrice,
|
|
1703
1951
|
is_charge_tax: (_venueProduct$is_char = venueProduct === null || venueProduct === void 0 ? void 0 : venueProduct.is_charge_tax) !== null && _venueProduct$is_char !== void 0 ? _venueProduct$is_char : 0,
|
|
1704
|
-
metadata: {
|
|
1705
|
-
venue_booking: true
|
|
1952
|
+
metadata: _objectSpread(_objectSpread({
|
|
1953
|
+
venue_booking: true
|
|
1954
|
+
}, productTitle ? {
|
|
1955
|
+
product_title: productTitle
|
|
1956
|
+
} : {}), {}, {
|
|
1706
1957
|
resource_id: resourceId,
|
|
1707
1958
|
resource_form_id: mapping.formId,
|
|
1708
1959
|
resource_name: mapping.resourceName,
|
|
@@ -1715,45 +1966,14 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1715
1966
|
productId: mapping.productId,
|
|
1716
1967
|
quotation: this.store.quotation
|
|
1717
1968
|
})
|
|
1718
|
-
},
|
|
1719
|
-
_origin:
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
relation_products: [],
|
|
1727
|
-
is_all: false,
|
|
1728
|
-
product: {
|
|
1729
|
-
product_id: mapping.productId,
|
|
1730
|
-
product_variant_id: 0,
|
|
1731
|
-
num: 1,
|
|
1732
|
-
product_bundle: [],
|
|
1733
|
-
product_sku: {
|
|
1734
|
-
option: []
|
|
1735
|
-
},
|
|
1736
|
-
discount_list: [],
|
|
1737
|
-
custom_deposit_data: customDepositData,
|
|
1738
|
-
metadata: {}
|
|
1739
|
-
},
|
|
1740
|
-
sub_type: 'minutes',
|
|
1741
|
-
duration: duration,
|
|
1742
|
-
like_status: 'common',
|
|
1743
|
-
resources: [resourceEntry],
|
|
1744
|
-
schedule_id: 0,
|
|
1745
|
-
select_date: startMoment.format('YYYY-MM-DD'),
|
|
1746
|
-
start_date: startMoment.format('YYYY-MM-DD'),
|
|
1747
|
-
start_time: startMoment.format('HH:mm'),
|
|
1748
|
-
end_date: endMoment.format('YYYY-MM-DD'),
|
|
1749
|
-
end_time: endMoment.format('HH:mm'),
|
|
1750
|
-
metadata: {
|
|
1751
|
-
venue_booking: true,
|
|
1752
|
-
slot_count: group.slotCount
|
|
1753
|
-
},
|
|
1754
|
-
holder: null
|
|
1755
|
-
}
|
|
1756
|
-
}));
|
|
1969
|
+
}),
|
|
1970
|
+
_origin: venueProductOrigin
|
|
1971
|
+
});
|
|
1972
|
+
venueOrderProduct = productTitle ? _objectSpread(_objectSpread({}, normalizedVenueOrderProduct), {}, {
|
|
1973
|
+
product_title: productTitle
|
|
1974
|
+
}) : normalizedVenueOrderProduct;
|
|
1975
|
+
this.attachProductOriginToTempOrder(tempOrder, identityKey, venueProductOrigin);
|
|
1976
|
+
tempOrder.products.push(venueOrderProduct);
|
|
1757
1977
|
booking = buildVenueBookingEntry({
|
|
1758
1978
|
group: group,
|
|
1759
1979
|
resourceId: resourceId,
|
|
@@ -1765,20 +1985,26 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1765
1985
|
});
|
|
1766
1986
|
tempOrder.bookings.push(booking);
|
|
1767
1987
|
}
|
|
1988
|
+
|
|
1989
|
+
// 获取表单信息
|
|
1990
|
+
products = ((_this$store$order6 = this.store.order) === null || _this$store$order6 === void 0 || (_this$store$order6$ge = _this$store$order6.getOrderProducts) === null || _this$store$order6$ge === void 0 ? void 0 : _this$store$order6$ge.call(_this$store$order6)) || [];
|
|
1991
|
+
_context18.next = 25;
|
|
1992
|
+
return this.preloadHolderForms(products);
|
|
1993
|
+
case 25:
|
|
1768
1994
|
this.store.order.applyDiscount();
|
|
1769
|
-
|
|
1995
|
+
_context18.next = 28;
|
|
1770
1996
|
return this.store.order.recalculateSummary({
|
|
1771
1997
|
createIfMissing: true
|
|
1772
1998
|
});
|
|
1773
|
-
case
|
|
1999
|
+
case 28:
|
|
1774
2000
|
this.store.order.persistTempOrder();
|
|
1775
|
-
case
|
|
2001
|
+
case 29:
|
|
1776
2002
|
case "end":
|
|
1777
|
-
return
|
|
2003
|
+
return _context18.stop();
|
|
1778
2004
|
}
|
|
1779
|
-
},
|
|
2005
|
+
}, _callee18, this);
|
|
1780
2006
|
}));
|
|
1781
|
-
function reconcileOrderForResourceProduct(
|
|
2007
|
+
function reconcileOrderForResourceProduct(_x10, _x11, _x12) {
|
|
1782
2008
|
return _reconcileOrderForResourceProduct.apply(this, arguments);
|
|
1783
2009
|
}
|
|
1784
2010
|
return reconcileOrderForResourceProduct;
|
|
@@ -1793,23 +2019,23 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1793
2019
|
return undefined;
|
|
1794
2020
|
}
|
|
1795
2021
|
var children = [];
|
|
1796
|
-
var
|
|
1797
|
-
|
|
2022
|
+
var _iterator12 = _createForOfIteratorHelper(combined.resource_ids),
|
|
2023
|
+
_step12;
|
|
1798
2024
|
try {
|
|
1799
2025
|
var _loop3 = function _loop3() {
|
|
1800
|
-
var id =
|
|
2026
|
+
var id = _step12.value;
|
|
1801
2027
|
var child = _this8.store.rawResourceData.find(function (r) {
|
|
1802
2028
|
return String(r.resourceId) === String(id);
|
|
1803
2029
|
});
|
|
1804
2030
|
if (child) children.push(child);
|
|
1805
2031
|
};
|
|
1806
|
-
for (
|
|
2032
|
+
for (_iterator12.s(); !(_step12 = _iterator12.n()).done;) {
|
|
1807
2033
|
_loop3();
|
|
1808
2034
|
}
|
|
1809
2035
|
} catch (err) {
|
|
1810
|
-
|
|
2036
|
+
_iterator12.e(err);
|
|
1811
2037
|
} finally {
|
|
1812
|
-
|
|
2038
|
+
_iterator12.f();
|
|
1813
2039
|
}
|
|
1814
2040
|
return children.length ? children : undefined;
|
|
1815
2041
|
}
|
|
@@ -1831,35 +2057,35 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1831
2057
|
}, {
|
|
1832
2058
|
key: "loadSchedules",
|
|
1833
2059
|
value: function () {
|
|
1834
|
-
var _loadSchedules = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1835
|
-
return _regeneratorRuntime().wrap(function
|
|
1836
|
-
while (1) switch (
|
|
2060
|
+
var _loadSchedules = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19() {
|
|
2061
|
+
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
|
2062
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
1837
2063
|
case 0:
|
|
1838
2064
|
this.logMethodStart('loadSchedules');
|
|
1839
|
-
|
|
2065
|
+
_context19.prev = 1;
|
|
1840
2066
|
if (this.store.schedule) {
|
|
1841
|
-
|
|
2067
|
+
_context19.next = 4;
|
|
1842
2068
|
break;
|
|
1843
2069
|
}
|
|
1844
2070
|
throw new Error('schedule 模块未初始化');
|
|
1845
2071
|
case 4:
|
|
1846
|
-
|
|
2072
|
+
_context19.next = 6;
|
|
1847
2073
|
return this.store.schedule.loadAllSchedule();
|
|
1848
2074
|
case 6:
|
|
1849
2075
|
this.injectScheduleResolverToQuotation();
|
|
1850
2076
|
this.logMethodSuccess('loadSchedules');
|
|
1851
|
-
|
|
2077
|
+
_context19.next = 14;
|
|
1852
2078
|
break;
|
|
1853
2079
|
case 10:
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
this.logMethodError('loadSchedules',
|
|
1857
|
-
throw
|
|
2080
|
+
_context19.prev = 10;
|
|
2081
|
+
_context19.t0 = _context19["catch"](1);
|
|
2082
|
+
this.logMethodError('loadSchedules', _context19.t0);
|
|
2083
|
+
throw _context19.t0;
|
|
1858
2084
|
case 14:
|
|
1859
2085
|
case "end":
|
|
1860
|
-
return
|
|
2086
|
+
return _context19.stop();
|
|
1861
2087
|
}
|
|
1862
|
-
},
|
|
2088
|
+
}, _callee19, this, [[1, 10]]);
|
|
1863
2089
|
}));
|
|
1864
2090
|
function loadSchedules() {
|
|
1865
2091
|
return _loadSchedules.apply(this, arguments);
|
|
@@ -1887,15 +2113,16 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1887
2113
|
}, {
|
|
1888
2114
|
key: "getTempOrder",
|
|
1889
2115
|
value: function getTempOrder() {
|
|
1890
|
-
var _this$store$
|
|
1891
|
-
var result = ((_this$store$
|
|
2116
|
+
var _this$store$order7;
|
|
2117
|
+
var result = ((_this$store$order7 = this.store.order) === null || _this$store$order7 === void 0 ? void 0 : _this$store$order7.getTempOrder()) || null;
|
|
1892
2118
|
return result;
|
|
1893
2119
|
}
|
|
1894
2120
|
}, {
|
|
1895
2121
|
key: "updateTempOrderNote",
|
|
1896
2122
|
value: function updateTempOrderNote(note) {
|
|
2123
|
+
var sync = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
1897
2124
|
if (!this.store.order) throw new Error('order 模块未初始化');
|
|
1898
|
-
return this.store.order.updateTempOrderNote(note);
|
|
2125
|
+
return this.store.order.updateTempOrderNote(note, sync);
|
|
1899
2126
|
}
|
|
1900
2127
|
}, {
|
|
1901
2128
|
key: "updateTempOrderContactsInfo",
|
|
@@ -1904,23 +2131,23 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1904
2131
|
return this.store.order.updateTempOrderContactsInfo(contactsInfo);
|
|
1905
2132
|
}
|
|
1906
2133
|
}, {
|
|
1907
|
-
key: "
|
|
1908
|
-
value: function
|
|
2134
|
+
key: "ensureVenueTempOrder",
|
|
2135
|
+
value: function ensureVenueTempOrder() {
|
|
1909
2136
|
if (!this.store.order) throw new Error('order 模块未初始化');
|
|
1910
2137
|
return this.store.order.ensureTempOrder();
|
|
1911
2138
|
}
|
|
1912
2139
|
}, {
|
|
1913
2140
|
key: "onCustomerLogin",
|
|
1914
2141
|
value: function () {
|
|
1915
|
-
var _onCustomerLogin = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1916
|
-
return _regeneratorRuntime().wrap(function
|
|
1917
|
-
while (1) switch (
|
|
2142
|
+
var _onCustomerLogin = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(params) {
|
|
2143
|
+
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
|
2144
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
1918
2145
|
case 0:
|
|
1919
2146
|
this.logMethodStart('onCustomerLogin', {
|
|
1920
2147
|
customerId: params.customerId
|
|
1921
2148
|
});
|
|
1922
|
-
|
|
1923
|
-
|
|
2149
|
+
_context20.prev = 1;
|
|
2150
|
+
_context20.next = 4;
|
|
1924
2151
|
return this.refreshOrderMarketingAfterLogin({
|
|
1925
2152
|
customerId: params.customerId
|
|
1926
2153
|
});
|
|
@@ -1928,20 +2155,20 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1928
2155
|
this.logMethodSuccess('onCustomerLogin', {
|
|
1929
2156
|
customerId: params.customerId
|
|
1930
2157
|
});
|
|
1931
|
-
|
|
2158
|
+
_context20.next = 11;
|
|
1932
2159
|
break;
|
|
1933
2160
|
case 7:
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
this.logMethodError('onCustomerLogin',
|
|
1937
|
-
throw
|
|
2161
|
+
_context20.prev = 7;
|
|
2162
|
+
_context20.t0 = _context20["catch"](1);
|
|
2163
|
+
this.logMethodError('onCustomerLogin', _context20.t0);
|
|
2164
|
+
throw _context20.t0;
|
|
1938
2165
|
case 11:
|
|
1939
2166
|
case "end":
|
|
1940
|
-
return
|
|
2167
|
+
return _context20.stop();
|
|
1941
2168
|
}
|
|
1942
|
-
},
|
|
2169
|
+
}, _callee20, this, [[1, 7]]);
|
|
1943
2170
|
}));
|
|
1944
|
-
function onCustomerLogin(
|
|
2171
|
+
function onCustomerLogin(_x13) {
|
|
1945
2172
|
return _onCustomerLogin.apply(this, arguments);
|
|
1946
2173
|
}
|
|
1947
2174
|
return onCustomerLogin;
|
|
@@ -1955,13 +2182,13 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1955
2182
|
var tempOrder = this.store.order.getTempOrder();
|
|
1956
2183
|
if (!(tempOrder !== null && tempOrder !== void 0 && (_tempOrder$products = tempOrder.products) !== null && _tempOrder$products !== void 0 && _tempOrder$products.length)) return;
|
|
1957
2184
|
var now = dayjs().format('YYYY-MM-DD HH:mm:ss');
|
|
1958
|
-
var
|
|
1959
|
-
|
|
2185
|
+
var _iterator13 = _createForOfIteratorHelper(tempOrder.products),
|
|
2186
|
+
_step13;
|
|
1960
2187
|
try {
|
|
1961
2188
|
var _loop4 = function _loop4() {
|
|
1962
|
-
var _product$
|
|
1963
|
-
var product =
|
|
1964
|
-
if ((_product$
|
|
2189
|
+
var _product$metadata3;
|
|
2190
|
+
var product = _step13.value;
|
|
2191
|
+
if ((_product$metadata3 = product.metadata) !== null && _product$metadata3 !== void 0 && _product$metadata3.venue_booking) {
|
|
1965
2192
|
var mappings = _this10.resourceProductMap.get(product.metadata.resource_id);
|
|
1966
2193
|
if (!mappings || !mappings.length) return 0; // continue
|
|
1967
2194
|
var mapping = mappings.find(function (m) {
|
|
@@ -2003,43 +2230,43 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2003
2230
|
}
|
|
2004
2231
|
},
|
|
2005
2232
|
_ret;
|
|
2006
|
-
for (
|
|
2233
|
+
for (_iterator13.s(); !(_step13 = _iterator13.n()).done;) {
|
|
2007
2234
|
_ret = _loop4();
|
|
2008
2235
|
if (_ret === 0) continue;
|
|
2009
2236
|
}
|
|
2010
2237
|
} catch (err) {
|
|
2011
|
-
|
|
2238
|
+
_iterator13.e(err);
|
|
2012
2239
|
} finally {
|
|
2013
|
-
|
|
2240
|
+
_iterator13.f();
|
|
2014
2241
|
}
|
|
2015
2242
|
}
|
|
2016
2243
|
}, {
|
|
2017
2244
|
key: "scanCode",
|
|
2018
2245
|
value: function () {
|
|
2019
|
-
var _scanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2246
|
+
var _scanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(code, customerId) {
|
|
2020
2247
|
var result;
|
|
2021
|
-
return _regeneratorRuntime().wrap(function
|
|
2022
|
-
while (1) switch (
|
|
2248
|
+
return _regeneratorRuntime().wrap(function _callee21$(_context21) {
|
|
2249
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
2023
2250
|
case 0:
|
|
2024
2251
|
this.logMethodStart('scanCode', {
|
|
2025
2252
|
code: code
|
|
2026
2253
|
});
|
|
2027
|
-
|
|
2254
|
+
_context21.prev = 1;
|
|
2028
2255
|
if (this.store.order) {
|
|
2029
|
-
|
|
2256
|
+
_context21.next = 4;
|
|
2030
2257
|
break;
|
|
2031
2258
|
}
|
|
2032
2259
|
throw new Error('order 模块未初始化');
|
|
2033
2260
|
case 4:
|
|
2034
|
-
|
|
2261
|
+
_context21.next = 6;
|
|
2035
2262
|
return this.store.order.scanCode(code, customerId);
|
|
2036
2263
|
case 6:
|
|
2037
|
-
result =
|
|
2264
|
+
result = _context21.sent;
|
|
2038
2265
|
if (!result.isAvailable) {
|
|
2039
|
-
|
|
2266
|
+
_context21.next = 11;
|
|
2040
2267
|
break;
|
|
2041
2268
|
}
|
|
2042
|
-
|
|
2269
|
+
_context21.next = 10;
|
|
2043
2270
|
return this.store.order.recalculateSummary({
|
|
2044
2271
|
createIfMissing: true
|
|
2045
2272
|
});
|
|
@@ -2049,19 +2276,19 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2049
2276
|
this.logMethodSuccess('scanCode', {
|
|
2050
2277
|
isAvailable: result.isAvailable
|
|
2051
2278
|
});
|
|
2052
|
-
return
|
|
2279
|
+
return _context21.abrupt("return", result);
|
|
2053
2280
|
case 15:
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
this.logMethodError('scanCode',
|
|
2057
|
-
throw
|
|
2281
|
+
_context21.prev = 15;
|
|
2282
|
+
_context21.t0 = _context21["catch"](1);
|
|
2283
|
+
this.logMethodError('scanCode', _context21.t0);
|
|
2284
|
+
throw _context21.t0;
|
|
2058
2285
|
case 19:
|
|
2059
2286
|
case "end":
|
|
2060
|
-
return
|
|
2287
|
+
return _context21.stop();
|
|
2061
2288
|
}
|
|
2062
|
-
},
|
|
2289
|
+
}, _callee21, this, [[1, 15]]);
|
|
2063
2290
|
}));
|
|
2064
|
-
function scanCode(
|
|
2291
|
+
function scanCode(_x14, _x15) {
|
|
2065
2292
|
return _scanCode.apply(this, arguments);
|
|
2066
2293
|
}
|
|
2067
2294
|
return scanCode;
|
|
@@ -2077,15 +2304,15 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2077
2304
|
}, {
|
|
2078
2305
|
key: "setDiscountSelected",
|
|
2079
2306
|
value: (function () {
|
|
2080
|
-
var _setDiscountSelected = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2081
|
-
var _tempOrder$holder, _this$store$order$get, _this$store$order$get2, list, beforeTarget, updated, updatedTarget, tempOrder, orderStore, discountModule, rulesModule, holders, nextDiscountList, _tempOrder$holder2, result, beforeSelectedIds,
|
|
2082
|
-
return _regeneratorRuntime().wrap(function
|
|
2083
|
-
while (1) switch (
|
|
2307
|
+
var _setDiscountSelected = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(params) {
|
|
2308
|
+
var _tempOrder$holder, _this$store$order$get, _this$store$order$get2, list, beforeTarget, updated, updatedTarget, tempOrder, orderStore, discountModule, rulesModule, holders, nextDiscountList, _tempOrder$holder2, result, beforeSelectedIds, _iterator14, _step14, d, selectedResourceIds, _iterator15, _step15, _product$metadata$sou, _product$metadata4, _product$metadata5, _product$original_pri, product, origin, totalPerUnitDiscount, optionSum, sourcePrice, newSourceSellingPrice, newMainSellingPrice, afterApplyTarget, finalSummary, finalProduct, finalTarget;
|
|
2309
|
+
return _regeneratorRuntime().wrap(function _callee22$(_context22) {
|
|
2310
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
2084
2311
|
case 0:
|
|
2085
2312
|
this.logMethodStart('setDiscountSelected', params);
|
|
2086
|
-
|
|
2313
|
+
_context22.prev = 1;
|
|
2087
2314
|
if (this.store.order) {
|
|
2088
|
-
|
|
2315
|
+
_context22.next = 4;
|
|
2089
2316
|
break;
|
|
2090
2317
|
}
|
|
2091
2318
|
throw new Error('order 模块未初始化');
|
|
@@ -2111,7 +2338,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2111
2338
|
form_record_id: tempOrder.holder.form_record_id
|
|
2112
2339
|
}] : [];
|
|
2113
2340
|
nextDiscountList = updated;
|
|
2114
|
-
|
|
2341
|
+
_context22.next = 16;
|
|
2115
2342
|
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(updated);
|
|
2116
2343
|
case 16:
|
|
2117
2344
|
if (rulesModule) {
|
|
@@ -2138,18 +2365,18 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2138
2365
|
}).map(function (d) {
|
|
2139
2366
|
return d.id;
|
|
2140
2367
|
}));
|
|
2141
|
-
|
|
2368
|
+
_iterator14 = _createForOfIteratorHelper(nextDiscountList);
|
|
2142
2369
|
try {
|
|
2143
|
-
for (
|
|
2144
|
-
d =
|
|
2370
|
+
for (_iterator14.s(); !(_step14 = _iterator14.n()).done;) {
|
|
2371
|
+
d = _step14.value;
|
|
2145
2372
|
if (d.isSelected && !beforeSelectedIds.has(d.id)) {
|
|
2146
2373
|
d.isSelected = false;
|
|
2147
2374
|
}
|
|
2148
2375
|
}
|
|
2149
2376
|
} catch (err) {
|
|
2150
|
-
|
|
2377
|
+
_iterator14.e(err);
|
|
2151
2378
|
} finally {
|
|
2152
|
-
|
|
2379
|
+
_iterator14.f();
|
|
2153
2380
|
}
|
|
2154
2381
|
}
|
|
2155
2382
|
}
|
|
@@ -2162,28 +2389,22 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2162
2389
|
// 都以 original_price - Σ (当前选中 discount_list.amount) 重算 selling_price。
|
|
2163
2390
|
// 目的:避免 unselect 后 selling_price 残留、reselect 时把残留价带进下一轮 Rules 造成双折扣。
|
|
2164
2391
|
// 手动改价商品(_origin.isManualDiscount=true)不参与券流程归一化,保留手工价。
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2392
|
+
_iterator15 = _createForOfIteratorHelper(tempOrder.products);
|
|
2393
|
+
_context22.prev = 19;
|
|
2394
|
+
_iterator15.s();
|
|
2168
2395
|
case 21:
|
|
2169
|
-
if ((
|
|
2170
|
-
|
|
2171
|
-
break;
|
|
2172
|
-
}
|
|
2173
|
-
product = _step14.value;
|
|
2174
|
-
if (!((_origin = product._origin) !== null && _origin !== void 0 && _origin.isManualDiscount)) {
|
|
2175
|
-
_context21.next = 25;
|
|
2396
|
+
if ((_step15 = _iterator15.n()).done) {
|
|
2397
|
+
_context22.next = 36;
|
|
2176
2398
|
break;
|
|
2177
2399
|
}
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
if (!(
|
|
2181
|
-
|
|
2400
|
+
product = _step15.value;
|
|
2401
|
+
origin = this.readProductOriginFromTempOrder(tempOrder, product);
|
|
2402
|
+
if (!(origin !== null && origin !== void 0 && origin.isManualDiscount)) {
|
|
2403
|
+
_context22.next = 26;
|
|
2182
2404
|
break;
|
|
2183
2405
|
}
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
case 28:
|
|
2406
|
+
return _context22.abrupt("continue", 34);
|
|
2407
|
+
case 26:
|
|
2187
2408
|
// 1. 把 product.discount_list 和当前选中的 discount 对齐(剔除已取消的券)
|
|
2188
2409
|
product.discount_list = (product.discount_list || []).filter(function (pd) {
|
|
2189
2410
|
var _pd$discount$resource, _pd$discount;
|
|
@@ -2197,7 +2418,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2197
2418
|
return sum + (pd.amount || 0);
|
|
2198
2419
|
}, 0);
|
|
2199
2420
|
optionSum = sumOptionUnitPrice(getProductSkuOptions(product));
|
|
2200
|
-
sourcePrice = (_product$metadata$sou = (_product$
|
|
2421
|
+
sourcePrice = (_product$metadata$sou = (_product$metadata4 = product.metadata) === null || _product$metadata4 === void 0 ? void 0 : _product$metadata4.source_product_price) !== null && _product$metadata$sou !== void 0 ? _product$metadata$sou : ((_product$metadata5 = product.metadata) === null || _product$metadata5 === void 0 ? void 0 : _product$metadata5.main_product_original_price) != null ? new Decimal(Number(product.metadata.main_product_original_price) || 0).minus(optionSum).toFixed(2) : (_product$original_pri = product.original_price) !== null && _product$original_pri !== void 0 ? _product$original_pri : '0';
|
|
2201
2422
|
newSourceSellingPrice = new Decimal(Number(sourcePrice) || 0).minus(totalPerUnitDiscount).toDecimalPlaces(2).toString();
|
|
2202
2423
|
newMainSellingPrice = new Decimal(Number(newSourceSellingPrice) || 0).plus(optionSum).toDecimalPlaces(2).toFixed(2);
|
|
2203
2424
|
if (product.metadata) {
|
|
@@ -2208,36 +2429,36 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2208
2429
|
mainPrice: newMainSellingPrice,
|
|
2209
2430
|
bundle: product.product_bundle
|
|
2210
2431
|
});
|
|
2432
|
+
case 34:
|
|
2433
|
+
_context22.next = 21;
|
|
2434
|
+
break;
|
|
2211
2435
|
case 36:
|
|
2212
|
-
|
|
2436
|
+
_context22.next = 41;
|
|
2213
2437
|
break;
|
|
2214
2438
|
case 38:
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
_iterator14.f();
|
|
2224
|
-
return _context21.finish(43);
|
|
2225
|
-
case 46:
|
|
2439
|
+
_context22.prev = 38;
|
|
2440
|
+
_context22.t0 = _context22["catch"](19);
|
|
2441
|
+
_iterator15.e(_context22.t0);
|
|
2442
|
+
case 41:
|
|
2443
|
+
_context22.prev = 41;
|
|
2444
|
+
_iterator15.f();
|
|
2445
|
+
return _context22.finish(41);
|
|
2446
|
+
case 44:
|
|
2226
2447
|
OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
|
|
2227
|
-
|
|
2448
|
+
_context22.next = 47;
|
|
2228
2449
|
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
|
|
2229
|
-
case
|
|
2450
|
+
case 47:
|
|
2230
2451
|
tempOrder.discount_list = (nextDiscountList || []).filter(function (d) {
|
|
2231
2452
|
return d.isSelected;
|
|
2232
2453
|
});
|
|
2233
2454
|
afterApplyTarget = this.store.order.getDiscountList().find(function (d) {
|
|
2234
2455
|
return d.id === params.discountId;
|
|
2235
2456
|
}) || null;
|
|
2236
|
-
|
|
2457
|
+
_context22.next = 51;
|
|
2237
2458
|
return this.store.order.recalculateSummary({
|
|
2238
2459
|
createIfMissing: true
|
|
2239
2460
|
});
|
|
2240
|
-
case
|
|
2461
|
+
case 51:
|
|
2241
2462
|
this.store.order.persistTempOrder();
|
|
2242
2463
|
finalSummary = ((_this$store$order$get = this.store.order.getTempOrder()) === null || _this$store$order$get === void 0 ? void 0 : _this$store$order$get.summary) || null;
|
|
2243
2464
|
finalProduct = ((_this$store$order$get2 = this.store.order.getTempOrder()) === null || _this$store$order$get2 === void 0 || (_this$store$order$get2 = _this$store$order$get2.products) === null || _this$store$order$get2 === void 0 ? void 0 : _this$store$order$get2[0]) || null;
|
|
@@ -2245,19 +2466,19 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2245
2466
|
finalTarget = this.store.order.getDiscountList().find(function (d) {
|
|
2246
2467
|
return d.id === params.discountId;
|
|
2247
2468
|
}) || null;
|
|
2248
|
-
return
|
|
2249
|
-
case
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
this.logMethodError('setDiscountSelected',
|
|
2253
|
-
throw
|
|
2254
|
-
case
|
|
2469
|
+
return _context22.abrupt("return", this.store.order.getDiscountList());
|
|
2470
|
+
case 59:
|
|
2471
|
+
_context22.prev = 59;
|
|
2472
|
+
_context22.t1 = _context22["catch"](1);
|
|
2473
|
+
this.logMethodError('setDiscountSelected', _context22.t1);
|
|
2474
|
+
throw _context22.t1;
|
|
2475
|
+
case 63:
|
|
2255
2476
|
case "end":
|
|
2256
|
-
return
|
|
2477
|
+
return _context22.stop();
|
|
2257
2478
|
}
|
|
2258
|
-
},
|
|
2479
|
+
}, _callee22, this, [[1, 59], [19, 38, 41, 44]]);
|
|
2259
2480
|
}));
|
|
2260
|
-
function setDiscountSelected(
|
|
2481
|
+
function setDiscountSelected(_x16) {
|
|
2261
2482
|
return _setDiscountSelected.apply(this, arguments);
|
|
2262
2483
|
}
|
|
2263
2484
|
return setDiscountSelected;
|
|
@@ -2265,37 +2486,37 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2265
2486
|
}, {
|
|
2266
2487
|
key: "addNewOrder",
|
|
2267
2488
|
value: function () {
|
|
2268
|
-
var _addNewOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2489
|
+
var _addNewOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23() {
|
|
2269
2490
|
var tempOrder;
|
|
2270
|
-
return _regeneratorRuntime().wrap(function
|
|
2271
|
-
while (1) switch (
|
|
2491
|
+
return _regeneratorRuntime().wrap(function _callee23$(_context23) {
|
|
2492
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
2272
2493
|
case 0:
|
|
2273
2494
|
this.logMethodStart('addNewOrder');
|
|
2274
|
-
|
|
2495
|
+
_context23.prev = 1;
|
|
2275
2496
|
if (this.store.order) {
|
|
2276
|
-
|
|
2497
|
+
_context23.next = 4;
|
|
2277
2498
|
break;
|
|
2278
2499
|
}
|
|
2279
2500
|
throw new Error('order 模块未初始化');
|
|
2280
2501
|
case 4:
|
|
2281
|
-
|
|
2502
|
+
_context23.next = 6;
|
|
2282
2503
|
return this.store.order.addNewOrder();
|
|
2283
2504
|
case 6:
|
|
2284
|
-
tempOrder =
|
|
2505
|
+
tempOrder = _context23.sent;
|
|
2285
2506
|
this.logMethodSuccess('addNewOrder', {
|
|
2286
2507
|
productCount: tempOrder.products.length
|
|
2287
2508
|
});
|
|
2288
|
-
return
|
|
2509
|
+
return _context23.abrupt("return", tempOrder);
|
|
2289
2510
|
case 11:
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
this.logMethodError('addNewOrder',
|
|
2293
|
-
throw
|
|
2511
|
+
_context23.prev = 11;
|
|
2512
|
+
_context23.t0 = _context23["catch"](1);
|
|
2513
|
+
this.logMethodError('addNewOrder', _context23.t0);
|
|
2514
|
+
throw _context23.t0;
|
|
2294
2515
|
case 15:
|
|
2295
2516
|
case "end":
|
|
2296
|
-
return
|
|
2517
|
+
return _context23.stop();
|
|
2297
2518
|
}
|
|
2298
|
-
},
|
|
2519
|
+
}, _callee23, this, [[1, 11]]);
|
|
2299
2520
|
}));
|
|
2300
2521
|
function addNewOrder() {
|
|
2301
2522
|
return _addNewOrder.apply(this, arguments);
|
|
@@ -2312,37 +2533,37 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2312
2533
|
}, {
|
|
2313
2534
|
key: "getSummary",
|
|
2314
2535
|
value: function () {
|
|
2315
|
-
var _getSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2536
|
+
var _getSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
|
|
2316
2537
|
var summary;
|
|
2317
|
-
return _regeneratorRuntime().wrap(function
|
|
2318
|
-
while (1) switch (
|
|
2538
|
+
return _regeneratorRuntime().wrap(function _callee24$(_context24) {
|
|
2539
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
2319
2540
|
case 0:
|
|
2320
2541
|
this.logMethodStart('getSummary');
|
|
2321
|
-
|
|
2542
|
+
_context24.prev = 1;
|
|
2322
2543
|
if (this.store.order) {
|
|
2323
|
-
|
|
2544
|
+
_context24.next = 4;
|
|
2324
2545
|
break;
|
|
2325
2546
|
}
|
|
2326
2547
|
throw new Error('order 模块未初始化');
|
|
2327
2548
|
case 4:
|
|
2328
|
-
|
|
2549
|
+
_context24.next = 6;
|
|
2329
2550
|
return this.store.order.getOrderSummary();
|
|
2330
2551
|
case 6:
|
|
2331
|
-
summary =
|
|
2552
|
+
summary = _context24.sent;
|
|
2332
2553
|
this.logMethodSuccess('getSummary', {
|
|
2333
2554
|
totalAmount: summary.total_amount
|
|
2334
2555
|
});
|
|
2335
|
-
return
|
|
2556
|
+
return _context24.abrupt("return", summary);
|
|
2336
2557
|
case 11:
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
this.logMethodError('getSummary',
|
|
2340
|
-
throw
|
|
2558
|
+
_context24.prev = 11;
|
|
2559
|
+
_context24.t0 = _context24["catch"](1);
|
|
2560
|
+
this.logMethodError('getSummary', _context24.t0);
|
|
2561
|
+
throw _context24.t0;
|
|
2341
2562
|
case 15:
|
|
2342
2563
|
case "end":
|
|
2343
|
-
return
|
|
2564
|
+
return _context24.stop();
|
|
2344
2565
|
}
|
|
2345
|
-
},
|
|
2566
|
+
}, _callee24, this, [[1, 11]]);
|
|
2346
2567
|
}));
|
|
2347
2568
|
function getSummary() {
|
|
2348
2569
|
return _getSummary.apply(this, arguments);
|
|
@@ -2352,47 +2573,47 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2352
2573
|
}, {
|
|
2353
2574
|
key: "submitOrder",
|
|
2354
2575
|
value: function () {
|
|
2355
|
-
var _submitOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2356
|
-
var _this$
|
|
2357
|
-
return _regeneratorRuntime().wrap(function
|
|
2358
|
-
while (1) switch (
|
|
2576
|
+
var _submitOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
|
|
2577
|
+
var _this$otherParams13, _this$otherParams14, _this$otherParams15, _this$otherParams16, _tempOrder$products2, result, tempOrder;
|
|
2578
|
+
return _regeneratorRuntime().wrap(function _callee25$(_context25) {
|
|
2579
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
2359
2580
|
case 0:
|
|
2360
2581
|
this.logMethodStart('submitOrder');
|
|
2361
|
-
|
|
2362
|
-
|
|
2582
|
+
_context25.prev = 1;
|
|
2583
|
+
_context25.next = 4;
|
|
2363
2584
|
return this.validateBeforeSubmitByItemRule();
|
|
2364
2585
|
case 4:
|
|
2365
2586
|
if (this.store.order) {
|
|
2366
|
-
|
|
2587
|
+
_context25.next = 6;
|
|
2367
2588
|
break;
|
|
2368
2589
|
}
|
|
2369
2590
|
throw new Error('venueBooking解决方案需要 order 模块支持');
|
|
2370
2591
|
case 6:
|
|
2371
|
-
|
|
2592
|
+
_context25.next = 8;
|
|
2372
2593
|
return this.store.order.submitTempOrder({
|
|
2373
2594
|
cacheId: this.cacheId,
|
|
2374
|
-
platform: (_this$
|
|
2375
|
-
businessCode: (_this$
|
|
2376
|
-
channel: (_this$
|
|
2377
|
-
type: (_this$
|
|
2595
|
+
platform: (_this$otherParams13 = this.otherParams) === null || _this$otherParams13 === void 0 ? void 0 : _this$otherParams13.platform,
|
|
2596
|
+
businessCode: (_this$otherParams14 = this.otherParams) === null || _this$otherParams14 === void 0 ? void 0 : _this$otherParams14.businessCode,
|
|
2597
|
+
channel: (_this$otherParams15 = this.otherParams) === null || _this$otherParams15 === void 0 ? void 0 : _this$otherParams15.channel,
|
|
2598
|
+
type: (_this$otherParams16 = this.otherParams) === null || _this$otherParams16 === void 0 ? void 0 : _this$otherParams16.type
|
|
2378
2599
|
});
|
|
2379
2600
|
case 8:
|
|
2380
|
-
result =
|
|
2601
|
+
result = _context25.sent;
|
|
2381
2602
|
tempOrder = this.store.order.getTempOrder();
|
|
2382
2603
|
this.logMethodSuccess('submitOrder', {
|
|
2383
2604
|
productCount: (tempOrder === null || tempOrder === void 0 || (_tempOrder$products2 = tempOrder.products) === null || _tempOrder$products2 === void 0 ? void 0 : _tempOrder$products2.length) || 0
|
|
2384
2605
|
});
|
|
2385
|
-
return
|
|
2606
|
+
return _context25.abrupt("return", result);
|
|
2386
2607
|
case 14:
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
this.logMethodError('submitOrder',
|
|
2390
|
-
throw
|
|
2608
|
+
_context25.prev = 14;
|
|
2609
|
+
_context25.t0 = _context25["catch"](1);
|
|
2610
|
+
this.logMethodError('submitOrder', _context25.t0);
|
|
2611
|
+
throw _context25.t0;
|
|
2391
2612
|
case 18:
|
|
2392
2613
|
case "end":
|
|
2393
|
-
return
|
|
2614
|
+
return _context25.stop();
|
|
2394
2615
|
}
|
|
2395
|
-
},
|
|
2616
|
+
}, _callee25, this, [[1, 14]]);
|
|
2396
2617
|
}));
|
|
2397
2618
|
function submitOrder() {
|
|
2398
2619
|
return _submitOrder.apply(this, arguments);
|
|
@@ -2402,23 +2623,23 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2402
2623
|
}, {
|
|
2403
2624
|
key: "addProductToOrder",
|
|
2404
2625
|
value: function () {
|
|
2405
|
-
var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2406
|
-
var _product$
|
|
2407
|
-
return _regeneratorRuntime().wrap(function
|
|
2408
|
-
while (1) switch (
|
|
2626
|
+
var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(product) {
|
|
2627
|
+
var _product$metadata6, _product$product_vari2, quotationPrice, products;
|
|
2628
|
+
return _regeneratorRuntime().wrap(function _callee26$(_context26) {
|
|
2629
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
2409
2630
|
case 0:
|
|
2410
2631
|
this.logMethodStart('addProductToOrder', {
|
|
2411
2632
|
product_id: product.product_id,
|
|
2412
2633
|
product_variant_id: product.product_variant_id
|
|
2413
2634
|
});
|
|
2414
|
-
|
|
2635
|
+
_context26.prev = 1;
|
|
2415
2636
|
if (this.store.order) {
|
|
2416
|
-
|
|
2637
|
+
_context26.next = 4;
|
|
2417
2638
|
break;
|
|
2418
2639
|
}
|
|
2419
2640
|
throw new Error('order 模块未初始化');
|
|
2420
2641
|
case 4:
|
|
2421
|
-
if (!((_product$
|
|
2642
|
+
if (!((_product$metadata6 = product.metadata) !== null && _product$metadata6 !== void 0 && _product$metadata6.venue_booking) && this.store.quotation && product.product_id != null) {
|
|
2422
2643
|
quotationPrice = this.store.quotation.getPriceForProduct({
|
|
2423
2644
|
productId: product.product_id,
|
|
2424
2645
|
variantId: (_product$product_vari2 = product.product_variant_id) !== null && _product$product_vari2 !== void 0 ? _product$product_vari2 : undefined,
|
|
@@ -2431,32 +2652,32 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2431
2652
|
product.original_price = product.selling_price;
|
|
2432
2653
|
}
|
|
2433
2654
|
}
|
|
2434
|
-
|
|
2655
|
+
_context26.next = 7;
|
|
2435
2656
|
return this.store.order.addProductToOrder(product);
|
|
2436
2657
|
case 7:
|
|
2437
|
-
products =
|
|
2438
|
-
|
|
2658
|
+
products = _context26.sent;
|
|
2659
|
+
_context26.next = 10;
|
|
2439
2660
|
return this.refreshItemRuleQuantityLimits();
|
|
2440
2661
|
case 10:
|
|
2441
|
-
|
|
2662
|
+
_context26.next = 12;
|
|
2442
2663
|
return this.refreshCartValidationPassed();
|
|
2443
2664
|
case 12:
|
|
2444
2665
|
this.logMethodSuccess('addProductToOrder', {
|
|
2445
2666
|
productCount: products.length
|
|
2446
2667
|
});
|
|
2447
|
-
return
|
|
2668
|
+
return _context26.abrupt("return", products);
|
|
2448
2669
|
case 16:
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
this.logMethodError('addProductToOrder',
|
|
2452
|
-
throw
|
|
2670
|
+
_context26.prev = 16;
|
|
2671
|
+
_context26.t0 = _context26["catch"](1);
|
|
2672
|
+
this.logMethodError('addProductToOrder', _context26.t0);
|
|
2673
|
+
throw _context26.t0;
|
|
2453
2674
|
case 20:
|
|
2454
2675
|
case "end":
|
|
2455
|
-
return
|
|
2676
|
+
return _context26.stop();
|
|
2456
2677
|
}
|
|
2457
|
-
},
|
|
2678
|
+
}, _callee26, this, [[1, 16]]);
|
|
2458
2679
|
}));
|
|
2459
|
-
function addProductToOrder(
|
|
2680
|
+
function addProductToOrder(_x17) {
|
|
2460
2681
|
return _addProductToOrder.apply(this, arguments);
|
|
2461
2682
|
}
|
|
2462
2683
|
return addProductToOrder;
|
|
@@ -2464,48 +2685,48 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2464
2685
|
}, {
|
|
2465
2686
|
key: "updateOrderProduct",
|
|
2466
2687
|
value: function () {
|
|
2467
|
-
var _updateOrderProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2688
|
+
var _updateOrderProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(params) {
|
|
2468
2689
|
var products;
|
|
2469
|
-
return _regeneratorRuntime().wrap(function
|
|
2470
|
-
while (1) switch (
|
|
2690
|
+
return _regeneratorRuntime().wrap(function _callee27$(_context27) {
|
|
2691
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
2471
2692
|
case 0:
|
|
2472
2693
|
this.logMethodStart('updateOrderProduct', {
|
|
2473
2694
|
product_id: params.product_id,
|
|
2474
2695
|
product_variant_id: params.product_variant_id
|
|
2475
2696
|
});
|
|
2476
|
-
|
|
2697
|
+
_context27.prev = 1;
|
|
2477
2698
|
if (this.store.order) {
|
|
2478
|
-
|
|
2699
|
+
_context27.next = 4;
|
|
2479
2700
|
break;
|
|
2480
2701
|
}
|
|
2481
2702
|
throw new Error('order 模块未初始化');
|
|
2482
2703
|
case 4:
|
|
2483
|
-
|
|
2704
|
+
_context27.next = 6;
|
|
2484
2705
|
return this.store.order.updateOrderProduct(params);
|
|
2485
2706
|
case 6:
|
|
2486
|
-
products =
|
|
2487
|
-
|
|
2707
|
+
products = _context27.sent;
|
|
2708
|
+
_context27.next = 9;
|
|
2488
2709
|
return this.refreshItemRuleQuantityLimits();
|
|
2489
2710
|
case 9:
|
|
2490
|
-
|
|
2711
|
+
_context27.next = 11;
|
|
2491
2712
|
return this.refreshCartValidationPassed();
|
|
2492
2713
|
case 11:
|
|
2493
2714
|
this.logMethodSuccess('updateOrderProduct', {
|
|
2494
2715
|
productCount: products.length
|
|
2495
2716
|
});
|
|
2496
|
-
return
|
|
2717
|
+
return _context27.abrupt("return", products);
|
|
2497
2718
|
case 15:
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
this.logMethodError('updateOrderProduct',
|
|
2501
|
-
throw
|
|
2719
|
+
_context27.prev = 15;
|
|
2720
|
+
_context27.t0 = _context27["catch"](1);
|
|
2721
|
+
this.logMethodError('updateOrderProduct', _context27.t0);
|
|
2722
|
+
throw _context27.t0;
|
|
2502
2723
|
case 19:
|
|
2503
2724
|
case "end":
|
|
2504
|
-
return
|
|
2725
|
+
return _context27.stop();
|
|
2505
2726
|
}
|
|
2506
|
-
},
|
|
2727
|
+
}, _callee27, this, [[1, 15]]);
|
|
2507
2728
|
}));
|
|
2508
|
-
function updateOrderProduct(
|
|
2729
|
+
function updateOrderProduct(_x18) {
|
|
2509
2730
|
return _updateOrderProduct.apply(this, arguments);
|
|
2510
2731
|
}
|
|
2511
2732
|
return updateOrderProduct;
|
|
@@ -2513,66 +2734,66 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2513
2734
|
}, {
|
|
2514
2735
|
key: "removeProductFromOrder",
|
|
2515
2736
|
value: function () {
|
|
2516
|
-
var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2517
|
-
var _this$store$order$get3, _this$store$
|
|
2518
|
-
return _regeneratorRuntime().wrap(function
|
|
2519
|
-
while (1) switch (
|
|
2737
|
+
var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(identity) {
|
|
2738
|
+
var _this$store$order$get3, _this$store$order8, _this$store$order$ens, _this$store$order9, _tempOrder$bookings, tempOrder, products, _tempOrder$bookings2, _tempOrder$bookings3, venueProductUids, venueBookingUids, _iterator16, _step16, _product$metadata7, _product$metadata8, product, beforeBookingCount, _this$store$order$per, _this$store$order10;
|
|
2739
|
+
return _regeneratorRuntime().wrap(function _callee28$(_context28) {
|
|
2740
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
2520
2741
|
case 0:
|
|
2521
2742
|
this.logMethodStart('removeProductFromOrder', {
|
|
2522
2743
|
product_id: identity.product_id,
|
|
2523
2744
|
product_variant_id: identity.product_variant_id
|
|
2524
2745
|
});
|
|
2525
|
-
|
|
2746
|
+
_context28.prev = 1;
|
|
2526
2747
|
if (this.store.order) {
|
|
2527
|
-
|
|
2748
|
+
_context28.next = 4;
|
|
2528
2749
|
break;
|
|
2529
2750
|
}
|
|
2530
2751
|
throw new Error('order 模块未初始化');
|
|
2531
2752
|
case 4:
|
|
2532
|
-
tempOrder = ((_this$store$order$get3 = (_this$store$
|
|
2533
|
-
|
|
2753
|
+
tempOrder = ((_this$store$order$get3 = (_this$store$order8 = this.store.order).getTempOrder) === null || _this$store$order$get3 === void 0 ? void 0 : _this$store$order$get3.call(_this$store$order8)) || ((_this$store$order$ens = (_this$store$order9 = this.store.order).ensureTempOrder) === null || _this$store$order$ens === void 0 ? void 0 : _this$store$order$ens.call(_this$store$order9));
|
|
2754
|
+
_context28.next = 7;
|
|
2534
2755
|
return this.store.order.removeProductFromOrder(identity);
|
|
2535
2756
|
case 7:
|
|
2536
|
-
products =
|
|
2757
|
+
products = _context28.sent;
|
|
2537
2758
|
if (!(tempOrder !== null && tempOrder !== void 0 && (_tempOrder$bookings = tempOrder.bookings) !== null && _tempOrder$bookings !== void 0 && _tempOrder$bookings.length)) {
|
|
2538
|
-
|
|
2759
|
+
_context28.next = 33;
|
|
2539
2760
|
break;
|
|
2540
2761
|
}
|
|
2541
2762
|
venueProductUids = new Set();
|
|
2542
2763
|
venueBookingUids = new Set();
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2764
|
+
_iterator16 = _createForOfIteratorHelper(tempOrder.products || []);
|
|
2765
|
+
_context28.prev = 12;
|
|
2766
|
+
_iterator16.s();
|
|
2546
2767
|
case 14:
|
|
2547
|
-
if ((
|
|
2548
|
-
|
|
2768
|
+
if ((_step16 = _iterator16.n()).done) {
|
|
2769
|
+
_context28.next = 22;
|
|
2549
2770
|
break;
|
|
2550
2771
|
}
|
|
2551
|
-
product =
|
|
2552
|
-
if (product !== null && product !== void 0 && (_product$
|
|
2553
|
-
|
|
2772
|
+
product = _step16.value;
|
|
2773
|
+
if (product !== null && product !== void 0 && (_product$metadata7 = product.metadata) !== null && _product$metadata7 !== void 0 && _product$metadata7.venue_booking) {
|
|
2774
|
+
_context28.next = 18;
|
|
2554
2775
|
break;
|
|
2555
2776
|
}
|
|
2556
|
-
return
|
|
2777
|
+
return _context28.abrupt("continue", 20);
|
|
2557
2778
|
case 18:
|
|
2558
2779
|
if (product.identity_key) venueProductUids.add(String(product.identity_key));
|
|
2559
|
-
if ((_product$
|
|
2780
|
+
if ((_product$metadata8 = product.metadata) !== null && _product$metadata8 !== void 0 && _product$metadata8.booking_uid) {
|
|
2560
2781
|
venueBookingUids.add(String(product.metadata.booking_uid));
|
|
2561
2782
|
}
|
|
2562
2783
|
case 20:
|
|
2563
|
-
|
|
2784
|
+
_context28.next = 14;
|
|
2564
2785
|
break;
|
|
2565
2786
|
case 22:
|
|
2566
|
-
|
|
2787
|
+
_context28.next = 27;
|
|
2567
2788
|
break;
|
|
2568
2789
|
case 24:
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2790
|
+
_context28.prev = 24;
|
|
2791
|
+
_context28.t0 = _context28["catch"](12);
|
|
2792
|
+
_iterator16.e(_context28.t0);
|
|
2572
2793
|
case 27:
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
return
|
|
2794
|
+
_context28.prev = 27;
|
|
2795
|
+
_iterator16.f();
|
|
2796
|
+
return _context28.finish(27);
|
|
2576
2797
|
case 30:
|
|
2577
2798
|
beforeBookingCount = ((_tempOrder$bookings2 = tempOrder.bookings) === null || _tempOrder$bookings2 === void 0 ? void 0 : _tempOrder$bookings2.length) || 0;
|
|
2578
2799
|
tempOrder.bookings = (tempOrder.bookings || []).filter(function (booking) {
|
|
@@ -2586,31 +2807,31 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2586
2807
|
return true;
|
|
2587
2808
|
});
|
|
2588
2809
|
if ((((_tempOrder$bookings3 = tempOrder.bookings) === null || _tempOrder$bookings3 === void 0 ? void 0 : _tempOrder$bookings3.length) || 0) !== beforeBookingCount) {
|
|
2589
|
-
(_this$store$order$per = (_this$store$
|
|
2810
|
+
(_this$store$order$per = (_this$store$order10 = this.store.order).persistTempOrder) === null || _this$store$order$per === void 0 || _this$store$order$per.call(_this$store$order10);
|
|
2590
2811
|
}
|
|
2591
2812
|
case 33:
|
|
2592
|
-
|
|
2813
|
+
_context28.next = 35;
|
|
2593
2814
|
return this.refreshItemRuleQuantityLimits();
|
|
2594
2815
|
case 35:
|
|
2595
|
-
|
|
2816
|
+
_context28.next = 37;
|
|
2596
2817
|
return this.refreshCartValidationPassed();
|
|
2597
2818
|
case 37:
|
|
2598
2819
|
this.logMethodSuccess('removeProductFromOrder', {
|
|
2599
2820
|
productCount: products.length
|
|
2600
2821
|
});
|
|
2601
|
-
return
|
|
2822
|
+
return _context28.abrupt("return", products);
|
|
2602
2823
|
case 41:
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
this.logMethodError('removeProductFromOrder',
|
|
2606
|
-
throw
|
|
2824
|
+
_context28.prev = 41;
|
|
2825
|
+
_context28.t1 = _context28["catch"](1);
|
|
2826
|
+
this.logMethodError('removeProductFromOrder', _context28.t1);
|
|
2827
|
+
throw _context28.t1;
|
|
2607
2828
|
case 45:
|
|
2608
2829
|
case "end":
|
|
2609
|
-
return
|
|
2830
|
+
return _context28.stop();
|
|
2610
2831
|
}
|
|
2611
|
-
},
|
|
2832
|
+
}, _callee28, this, [[1, 41], [12, 24, 27, 30]]);
|
|
2612
2833
|
}));
|
|
2613
|
-
function removeProductFromOrder(
|
|
2834
|
+
function removeProductFromOrder(_x19) {
|
|
2614
2835
|
return _removeProductFromOrder.apply(this, arguments);
|
|
2615
2836
|
}
|
|
2616
2837
|
return removeProductFromOrder;
|
|
@@ -2618,27 +2839,27 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2618
2839
|
}, {
|
|
2619
2840
|
key: "getProductList",
|
|
2620
2841
|
value: function () {
|
|
2621
|
-
var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2842
|
+
var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29() {
|
|
2622
2843
|
var result;
|
|
2623
|
-
return _regeneratorRuntime().wrap(function
|
|
2624
|
-
while (1) switch (
|
|
2844
|
+
return _regeneratorRuntime().wrap(function _callee29$(_context29) {
|
|
2845
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
2625
2846
|
case 0:
|
|
2626
2847
|
if (!this.productsLoaded) {
|
|
2627
|
-
|
|
2848
|
+
_context29.next = 2;
|
|
2628
2849
|
break;
|
|
2629
2850
|
}
|
|
2630
|
-
return
|
|
2851
|
+
return _context29.abrupt("return", attachItemRuleLimitsToTopLevelProducts(this.getAddonProductsList(), this.store.itemRuleQuantityLimits || []));
|
|
2631
2852
|
case 2:
|
|
2632
|
-
|
|
2853
|
+
_context29.next = 4;
|
|
2633
2854
|
return this.loadAllProducts();
|
|
2634
2855
|
case 4:
|
|
2635
|
-
result =
|
|
2636
|
-
return
|
|
2856
|
+
result = _context29.sent;
|
|
2857
|
+
return _context29.abrupt("return", attachItemRuleLimitsToTopLevelProducts(result.addonProducts, this.store.itemRuleQuantityLimits || []));
|
|
2637
2858
|
case 6:
|
|
2638
2859
|
case "end":
|
|
2639
|
-
return
|
|
2860
|
+
return _context29.stop();
|
|
2640
2861
|
}
|
|
2641
|
-
},
|
|
2862
|
+
}, _callee29, this);
|
|
2642
2863
|
}));
|
|
2643
2864
|
function getProductList() {
|
|
2644
2865
|
return _getProductList.apply(this, arguments);
|
|
@@ -2648,13 +2869,13 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2648
2869
|
}, {
|
|
2649
2870
|
key: "loadOpenDataConfig",
|
|
2650
2871
|
value: function () {
|
|
2651
|
-
var _loadOpenDataConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2872
|
+
var _loadOpenDataConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30() {
|
|
2652
2873
|
var lastFetchedAt, cachedData, openDataConfig;
|
|
2653
|
-
return _regeneratorRuntime().wrap(function
|
|
2654
|
-
while (1) switch (
|
|
2874
|
+
return _regeneratorRuntime().wrap(function _callee30$(_context30) {
|
|
2875
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
2655
2876
|
case 0:
|
|
2656
2877
|
if (this.store.openData) {
|
|
2657
|
-
|
|
2878
|
+
_context30.next = 2;
|
|
2658
2879
|
break;
|
|
2659
2880
|
}
|
|
2660
2881
|
throw new Error('openData 模块未初始化');
|
|
@@ -2662,42 +2883,42 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2662
2883
|
lastFetchedAt = this.store.openData.getLastFetchedAt();
|
|
2663
2884
|
cachedData = this.store.openData.getOpenData();
|
|
2664
2885
|
if (!(cachedData && lastFetchedAt && Date.now() - lastFetchedAt < VenueBookingImpl.OPEN_DATA_CACHE_TTL)) {
|
|
2665
|
-
|
|
2886
|
+
_context30.next = 7;
|
|
2666
2887
|
break;
|
|
2667
2888
|
}
|
|
2668
2889
|
this.otherParams.openData = cachedData;
|
|
2669
|
-
return
|
|
2890
|
+
return _context30.abrupt("return", cachedData);
|
|
2670
2891
|
case 7:
|
|
2671
2892
|
if (!this.loadOpenDataConfigInFlight) {
|
|
2672
|
-
|
|
2893
|
+
_context30.next = 11;
|
|
2673
2894
|
break;
|
|
2674
2895
|
}
|
|
2675
|
-
|
|
2896
|
+
_context30.next = 10;
|
|
2676
2897
|
return this.loadOpenDataConfigInFlight;
|
|
2677
2898
|
case 10:
|
|
2678
|
-
return
|
|
2899
|
+
return _context30.abrupt("return", _context30.sent);
|
|
2679
2900
|
case 11:
|
|
2680
2901
|
this.loadOpenDataConfigInFlight = this.store.openData.fetchOpenData({
|
|
2681
2902
|
scope: 'board',
|
|
2682
2903
|
target: 'venue_booking+online_store',
|
|
2683
2904
|
section_code: [].concat(OPEN_DATA_SECTION_CODES)
|
|
2684
2905
|
});
|
|
2685
|
-
|
|
2686
|
-
|
|
2906
|
+
_context30.prev = 12;
|
|
2907
|
+
_context30.next = 15;
|
|
2687
2908
|
return this.loadOpenDataConfigInFlight;
|
|
2688
2909
|
case 15:
|
|
2689
|
-
openDataConfig =
|
|
2910
|
+
openDataConfig = _context30.sent;
|
|
2690
2911
|
this.otherParams.openData = openDataConfig;
|
|
2691
|
-
return
|
|
2912
|
+
return _context30.abrupt("return", openDataConfig);
|
|
2692
2913
|
case 18:
|
|
2693
|
-
|
|
2914
|
+
_context30.prev = 18;
|
|
2694
2915
|
this.loadOpenDataConfigInFlight = null;
|
|
2695
|
-
return
|
|
2916
|
+
return _context30.finish(18);
|
|
2696
2917
|
case 21:
|
|
2697
2918
|
case "end":
|
|
2698
|
-
return
|
|
2919
|
+
return _context30.stop();
|
|
2699
2920
|
}
|
|
2700
|
-
},
|
|
2921
|
+
}, _callee30, this, [[12,, 18, 21]]);
|
|
2701
2922
|
}));
|
|
2702
2923
|
function loadOpenDataConfig() {
|
|
2703
2924
|
return _loadOpenDataConfig.apply(this, arguments);
|
|
@@ -2707,29 +2928,29 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2707
2928
|
}, {
|
|
2708
2929
|
key: "loadRuntimeConfigs",
|
|
2709
2930
|
value: function () {
|
|
2710
|
-
var _loadRuntimeConfigs = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2931
|
+
var _loadRuntimeConfigs = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31() {
|
|
2711
2932
|
var itemRuleConfigs;
|
|
2712
|
-
return _regeneratorRuntime().wrap(function
|
|
2713
|
-
while (1) switch (
|
|
2933
|
+
return _regeneratorRuntime().wrap(function _callee31$(_context31) {
|
|
2934
|
+
while (1) switch (_context31.prev = _context31.next) {
|
|
2714
2935
|
case 0:
|
|
2715
|
-
|
|
2936
|
+
_context31.next = 2;
|
|
2716
2937
|
return this.loadOpenDataConfig();
|
|
2717
2938
|
case 2:
|
|
2718
|
-
|
|
2939
|
+
_context31.next = 4;
|
|
2719
2940
|
return this.ensureItemRuleConfigsLoaded();
|
|
2720
2941
|
case 4:
|
|
2721
|
-
itemRuleConfigs =
|
|
2942
|
+
itemRuleConfigs = _context31.sent;
|
|
2722
2943
|
this.logMethodSuccess('loadRuntimeConfigs', {
|
|
2723
2944
|
itemRuleCount: itemRuleConfigs.length
|
|
2724
2945
|
});
|
|
2725
|
-
return
|
|
2946
|
+
return _context31.abrupt("return", {
|
|
2726
2947
|
itemRuleConfigs: itemRuleConfigs
|
|
2727
2948
|
});
|
|
2728
2949
|
case 7:
|
|
2729
2950
|
case "end":
|
|
2730
|
-
return
|
|
2951
|
+
return _context31.stop();
|
|
2731
2952
|
}
|
|
2732
|
-
},
|
|
2953
|
+
}, _callee31, this);
|
|
2733
2954
|
}));
|
|
2734
2955
|
function loadRuntimeConfigs() {
|
|
2735
2956
|
return _loadRuntimeConfigs.apply(this, arguments);
|
|
@@ -2739,22 +2960,22 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2739
2960
|
}, {
|
|
2740
2961
|
key: "fetchItemRuleConfigsByModelIds",
|
|
2741
2962
|
value: function () {
|
|
2742
|
-
var _fetchItemRuleConfigsByModelIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2963
|
+
var _fetchItemRuleConfigsByModelIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(strategyModelIds) {
|
|
2743
2964
|
var result, configs;
|
|
2744
|
-
return _regeneratorRuntime().wrap(function
|
|
2745
|
-
while (1) switch (
|
|
2965
|
+
return _regeneratorRuntime().wrap(function _callee32$(_context32) {
|
|
2966
|
+
while (1) switch (_context32.prev = _context32.next) {
|
|
2746
2967
|
case 0:
|
|
2747
2968
|
this.logMethodStart('fetchItemRuleConfigsByModelIds', {
|
|
2748
2969
|
strategyModelIds: strategyModelIds
|
|
2749
2970
|
});
|
|
2750
2971
|
if (strategyModelIds.length) {
|
|
2751
|
-
|
|
2972
|
+
_context32.next = 3;
|
|
2752
2973
|
break;
|
|
2753
2974
|
}
|
|
2754
|
-
return
|
|
2975
|
+
return _context32.abrupt("return", []);
|
|
2755
2976
|
case 3:
|
|
2756
|
-
|
|
2757
|
-
|
|
2977
|
+
_context32.prev = 3;
|
|
2978
|
+
_context32.next = 6;
|
|
2758
2979
|
return this.request.get('/promotion', {
|
|
2759
2980
|
skip: 1,
|
|
2760
2981
|
num: 99,
|
|
@@ -2762,7 +2983,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2762
2983
|
ids: strategyModelIds
|
|
2763
2984
|
});
|
|
2764
2985
|
case 6:
|
|
2765
|
-
result =
|
|
2986
|
+
result = _context32.sent;
|
|
2766
2987
|
configs = [];
|
|
2767
2988
|
if (result.code === 200) {
|
|
2768
2989
|
configs = result.data.list.map(function (item) {
|
|
@@ -2773,21 +2994,21 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2773
2994
|
strategyModelIds: strategyModelIds,
|
|
2774
2995
|
strategyCount: configs.length
|
|
2775
2996
|
});
|
|
2776
|
-
return
|
|
2997
|
+
return _context32.abrupt("return", configs);
|
|
2777
2998
|
case 13:
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
this.logMethodError('fetchItemRuleConfigsByModelIds',
|
|
2999
|
+
_context32.prev = 13;
|
|
3000
|
+
_context32.t0 = _context32["catch"](3);
|
|
3001
|
+
this.logMethodError('fetchItemRuleConfigsByModelIds', _context32.t0, {
|
|
2781
3002
|
strategyModelIds: strategyModelIds
|
|
2782
3003
|
});
|
|
2783
|
-
return
|
|
3004
|
+
return _context32.abrupt("return", []);
|
|
2784
3005
|
case 17:
|
|
2785
3006
|
case "end":
|
|
2786
|
-
return
|
|
3007
|
+
return _context32.stop();
|
|
2787
3008
|
}
|
|
2788
|
-
},
|
|
3009
|
+
}, _callee32, this, [[3, 13]]);
|
|
2789
3010
|
}));
|
|
2790
|
-
function fetchItemRuleConfigsByModelIds(
|
|
3011
|
+
function fetchItemRuleConfigsByModelIds(_x20) {
|
|
2791
3012
|
return _fetchItemRuleConfigsByModelIds.apply(this, arguments);
|
|
2792
3013
|
}
|
|
2793
3014
|
return fetchItemRuleConfigsByModelIds;
|
|
@@ -2795,22 +3016,22 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2795
3016
|
}, {
|
|
2796
3017
|
key: "buildPrefillProductSourceMap",
|
|
2797
3018
|
value: function () {
|
|
2798
|
-
var _buildPrefillProductSourceMap = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3019
|
+
var _buildPrefillProductSourceMap = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33() {
|
|
2799
3020
|
var sourceMap, productList, visited, collectFromValue;
|
|
2800
|
-
return _regeneratorRuntime().wrap(function
|
|
2801
|
-
while (1) switch (
|
|
3021
|
+
return _regeneratorRuntime().wrap(function _callee33$(_context33) {
|
|
3022
|
+
while (1) switch (_context33.prev = _context33.next) {
|
|
2802
3023
|
case 0:
|
|
2803
3024
|
sourceMap = new Map();
|
|
2804
|
-
|
|
2805
|
-
|
|
3025
|
+
_context33.prev = 1;
|
|
3026
|
+
_context33.next = 4;
|
|
2806
3027
|
return this.getProductList();
|
|
2807
3028
|
case 4:
|
|
2808
|
-
productList =
|
|
3029
|
+
productList = _context33.sent;
|
|
2809
3030
|
if (Array.isArray(productList)) {
|
|
2810
|
-
|
|
3031
|
+
_context33.next = 7;
|
|
2811
3032
|
break;
|
|
2812
3033
|
}
|
|
2813
|
-
return
|
|
3034
|
+
return _context33.abrupt("return", sourceMap);
|
|
2814
3035
|
case 7:
|
|
2815
3036
|
visited = new Set();
|
|
2816
3037
|
collectFromValue = function collectFromValue(value) {
|
|
@@ -2819,17 +3040,17 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2819
3040
|
if (visited.has(value)) return;
|
|
2820
3041
|
visited.add(value);
|
|
2821
3042
|
if (Array.isArray(value)) {
|
|
2822
|
-
var
|
|
2823
|
-
|
|
3043
|
+
var _iterator17 = _createForOfIteratorHelper(value),
|
|
3044
|
+
_step17;
|
|
2824
3045
|
try {
|
|
2825
|
-
for (
|
|
2826
|
-
var item =
|
|
3046
|
+
for (_iterator17.s(); !(_step17 = _iterator17.n()).done;) {
|
|
3047
|
+
var item = _step17.value;
|
|
2827
3048
|
collectFromValue(item);
|
|
2828
3049
|
}
|
|
2829
3050
|
} catch (err) {
|
|
2830
|
-
|
|
3051
|
+
_iterator17.e(err);
|
|
2831
3052
|
} finally {
|
|
2832
|
-
|
|
3053
|
+
_iterator17.f();
|
|
2833
3054
|
}
|
|
2834
3055
|
return;
|
|
2835
3056
|
}
|
|
@@ -2837,8 +3058,8 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2837
3058
|
var rawProductId = (_node$product_id = node.product_id) !== null && _node$product_id !== void 0 ? _node$product_id : node.id;
|
|
2838
3059
|
var productId = Number(rawProductId);
|
|
2839
3060
|
if (Number.isFinite(productId) && productId > 0) {
|
|
2840
|
-
var
|
|
2841
|
-
var productVariantId = Number((
|
|
3061
|
+
var _ref5, _node$product_variant;
|
|
3062
|
+
var productVariantId = Number((_ref5 = (_node$product_variant = node.product_variant_id) !== null && _node$product_variant !== void 0 ? _node$product_variant : node.variant_id) !== null && _ref5 !== void 0 ? _ref5 : 0);
|
|
2842
3063
|
var normalizedVariantId = Number.isNaN(productVariantId) ? 0 : productVariantId;
|
|
2843
3064
|
var key = buildProductKey(productId, normalizedVariantId);
|
|
2844
3065
|
if (!sourceMap.has(key)) sourceMap.set(key, node);
|
|
@@ -2849,19 +3070,19 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2849
3070
|
}
|
|
2850
3071
|
};
|
|
2851
3072
|
collectFromValue(productList);
|
|
2852
|
-
|
|
3073
|
+
_context33.next = 15;
|
|
2853
3074
|
break;
|
|
2854
3075
|
case 12:
|
|
2855
|
-
|
|
2856
|
-
|
|
2857
|
-
this.logMethodError('buildPrefillProductSourceMap',
|
|
3076
|
+
_context33.prev = 12;
|
|
3077
|
+
_context33.t0 = _context33["catch"](1);
|
|
3078
|
+
this.logMethodError('buildPrefillProductSourceMap', _context33.t0);
|
|
2858
3079
|
case 15:
|
|
2859
|
-
return
|
|
3080
|
+
return _context33.abrupt("return", sourceMap);
|
|
2860
3081
|
case 16:
|
|
2861
3082
|
case "end":
|
|
2862
|
-
return
|
|
3083
|
+
return _context33.stop();
|
|
2863
3084
|
}
|
|
2864
|
-
},
|
|
3085
|
+
}, _callee33, this, [[1, 12]]);
|
|
2865
3086
|
}));
|
|
2866
3087
|
function buildPrefillProductSourceMap() {
|
|
2867
3088
|
return _buildPrefillProductSourceMap.apply(this, arguments);
|
|
@@ -2876,56 +3097,56 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2876
3097
|
}, {
|
|
2877
3098
|
key: "ensureItemRuleConfigsLoaded",
|
|
2878
3099
|
value: function () {
|
|
2879
|
-
var _ensureItemRuleConfigsLoaded = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3100
|
+
var _ensureItemRuleConfigsLoaded = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35() {
|
|
2880
3101
|
var _this11 = this;
|
|
2881
|
-
return _regeneratorRuntime().wrap(function
|
|
2882
|
-
while (1) switch (
|
|
3102
|
+
return _regeneratorRuntime().wrap(function _callee35$(_context35) {
|
|
3103
|
+
while (1) switch (_context35.prev = _context35.next) {
|
|
2883
3104
|
case 0:
|
|
2884
3105
|
if (!(this.itemRuleConfigs.length > 0)) {
|
|
2885
|
-
|
|
3106
|
+
_context35.next = 2;
|
|
2886
3107
|
break;
|
|
2887
3108
|
}
|
|
2888
|
-
return
|
|
3109
|
+
return _context35.abrupt("return", this.itemRuleConfigs);
|
|
2889
3110
|
case 2:
|
|
2890
3111
|
if (!this.itemRuleConfigsPromise) {
|
|
2891
|
-
|
|
3112
|
+
_context35.next = 4;
|
|
2892
3113
|
break;
|
|
2893
3114
|
}
|
|
2894
|
-
return
|
|
3115
|
+
return _context35.abrupt("return", this.itemRuleConfigsPromise);
|
|
2895
3116
|
case 4:
|
|
2896
|
-
this.itemRuleConfigsPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3117
|
+
this.itemRuleConfigsPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34() {
|
|
2897
3118
|
var runtimeConfig, staticConfigs;
|
|
2898
|
-
return _regeneratorRuntime().wrap(function
|
|
2899
|
-
while (1) switch (
|
|
3119
|
+
return _regeneratorRuntime().wrap(function _callee34$(_context34) {
|
|
3120
|
+
while (1) switch (_context34.prev = _context34.next) {
|
|
2900
3121
|
case 0:
|
|
2901
3122
|
runtimeConfig = _this11.getItemRuleRuntimeConfig();
|
|
2902
3123
|
staticConfigs = normalizeItemRuleStrategies(runtimeConfig.strategyConfigs);
|
|
2903
3124
|
if (!(staticConfigs.length > 0)) {
|
|
2904
|
-
|
|
3125
|
+
_context34.next = 6;
|
|
2905
3126
|
break;
|
|
2906
3127
|
}
|
|
2907
3128
|
_this11.itemRuleConfigs = staticConfigs;
|
|
2908
3129
|
_this11.itemRuleEvaluator.setStrategyConfigs(staticConfigs);
|
|
2909
|
-
return
|
|
3130
|
+
return _context34.abrupt("return", _this11.itemRuleConfigs);
|
|
2910
3131
|
case 6:
|
|
2911
3132
|
_this11.itemRuleConfigs = [];
|
|
2912
3133
|
_this11.itemRuleEvaluator.setStrategyConfigs([]);
|
|
2913
|
-
return
|
|
3134
|
+
return _context34.abrupt("return", _this11.itemRuleConfigs);
|
|
2914
3135
|
case 9:
|
|
2915
3136
|
case "end":
|
|
2916
|
-
return
|
|
3137
|
+
return _context34.stop();
|
|
2917
3138
|
}
|
|
2918
|
-
},
|
|
3139
|
+
}, _callee34);
|
|
2919
3140
|
}))();
|
|
2920
|
-
|
|
3141
|
+
_context35.next = 7;
|
|
2921
3142
|
return this.itemRuleConfigsPromise;
|
|
2922
3143
|
case 7:
|
|
2923
|
-
return
|
|
3144
|
+
return _context35.abrupt("return", _context35.sent);
|
|
2924
3145
|
case 8:
|
|
2925
3146
|
case "end":
|
|
2926
|
-
return
|
|
3147
|
+
return _context35.stop();
|
|
2927
3148
|
}
|
|
2928
|
-
},
|
|
3149
|
+
}, _callee35, this);
|
|
2929
3150
|
}));
|
|
2930
3151
|
function ensureItemRuleConfigsLoaded() {
|
|
2931
3152
|
return _ensureItemRuleConfigsLoaded.apply(this, arguments);
|
|
@@ -2935,25 +3156,25 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2935
3156
|
}, {
|
|
2936
3157
|
key: "refreshItemRuleQuantityLimits",
|
|
2937
3158
|
value: function () {
|
|
2938
|
-
var _refreshItemRuleQuantityLimits = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3159
|
+
var _refreshItemRuleQuantityLimits = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36() {
|
|
2939
3160
|
var strategyConfigs, businessData, limits;
|
|
2940
|
-
return _regeneratorRuntime().wrap(function
|
|
2941
|
-
while (1) switch (
|
|
3161
|
+
return _regeneratorRuntime().wrap(function _callee36$(_context36) {
|
|
3162
|
+
while (1) switch (_context36.prev = _context36.next) {
|
|
2942
3163
|
case 0:
|
|
2943
|
-
|
|
2944
|
-
|
|
3164
|
+
_context36.prev = 0;
|
|
3165
|
+
_context36.next = 3;
|
|
2945
3166
|
return this.ensureItemRuleConfigsLoaded();
|
|
2946
3167
|
case 3:
|
|
2947
|
-
strategyConfigs =
|
|
3168
|
+
strategyConfigs = _context36.sent;
|
|
2948
3169
|
if (strategyConfigs.length) {
|
|
2949
|
-
|
|
3170
|
+
_context36.next = 7;
|
|
2950
3171
|
break;
|
|
2951
3172
|
}
|
|
2952
3173
|
this.store.itemRuleQuantityLimits = [];
|
|
2953
|
-
return
|
|
3174
|
+
return _context36.abrupt("return", []);
|
|
2954
3175
|
case 7:
|
|
2955
3176
|
businessData = buildItemRuleBusinessData({
|
|
2956
|
-
tempOrder: this.
|
|
3177
|
+
tempOrder: this.ensureVenueTempOrder(),
|
|
2957
3178
|
runtimeConfig: this.getItemRuleRuntimeConfig(),
|
|
2958
3179
|
itemRuleConfigs: this.itemRuleConfigs
|
|
2959
3180
|
});
|
|
@@ -2962,18 +3183,18 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2962
3183
|
this.logMethodSuccess('refreshItemRuleQuantityLimits', {
|
|
2963
3184
|
limitCount: limits.length
|
|
2964
3185
|
});
|
|
2965
|
-
return
|
|
3186
|
+
return _context36.abrupt("return", limits);
|
|
2966
3187
|
case 14:
|
|
2967
|
-
|
|
2968
|
-
|
|
3188
|
+
_context36.prev = 14;
|
|
3189
|
+
_context36.t0 = _context36["catch"](0);
|
|
2969
3190
|
this.store.itemRuleQuantityLimits = [];
|
|
2970
|
-
this.logMethodError('refreshItemRuleQuantityLimits',
|
|
2971
|
-
return
|
|
3191
|
+
this.logMethodError('refreshItemRuleQuantityLimits', _context36.t0);
|
|
3192
|
+
return _context36.abrupt("return", []);
|
|
2972
3193
|
case 19:
|
|
2973
3194
|
case "end":
|
|
2974
|
-
return
|
|
3195
|
+
return _context36.stop();
|
|
2975
3196
|
}
|
|
2976
|
-
},
|
|
3197
|
+
}, _callee36, this, [[0, 14]]);
|
|
2977
3198
|
}));
|
|
2978
3199
|
function refreshItemRuleQuantityLimits() {
|
|
2979
3200
|
return _refreshItemRuleQuantityLimits.apply(this, arguments);
|
|
@@ -2983,75 +3204,75 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2983
3204
|
}, {
|
|
2984
3205
|
key: "applyPrefillByItemRule",
|
|
2985
3206
|
value: function () {
|
|
2986
|
-
var _applyPrefillByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2987
|
-
var strategyConfigs, businessData, prefillItems, productSourceMap, tempOrder, hasChanges,
|
|
2988
|
-
return _regeneratorRuntime().wrap(function
|
|
2989
|
-
while (1) switch (
|
|
3207
|
+
var _applyPrefillByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37() {
|
|
3208
|
+
var strategyConfigs, businessData, prefillItems, productSourceMap, tempOrder, hasChanges, _iterator18, _step18, _prefillItem$product_, prefillItem, productId, productVariantId, targetQuantity, sourceItem, productIndex, _sourceItem$price, _product$metadata9, sellingPrice, origin, product, productUid, targetProduct, previousOrigin, nextOrigin, existedQuantity, delta, nextProduct, _nextProduct$metadata, _productUid;
|
|
3209
|
+
return _regeneratorRuntime().wrap(function _callee37$(_context37) {
|
|
3210
|
+
while (1) switch (_context37.prev = _context37.next) {
|
|
2990
3211
|
case 0:
|
|
2991
3212
|
if (!this.itemRulePrefillApplied) {
|
|
2992
|
-
|
|
3213
|
+
_context37.next = 2;
|
|
2993
3214
|
break;
|
|
2994
3215
|
}
|
|
2995
|
-
return
|
|
3216
|
+
return _context37.abrupt("return");
|
|
2996
3217
|
case 2:
|
|
2997
3218
|
if (this.store.order) {
|
|
2998
|
-
|
|
3219
|
+
_context37.next = 4;
|
|
2999
3220
|
break;
|
|
3000
3221
|
}
|
|
3001
|
-
return
|
|
3222
|
+
return _context37.abrupt("return");
|
|
3002
3223
|
case 4:
|
|
3003
|
-
|
|
3224
|
+
_context37.next = 6;
|
|
3004
3225
|
return this.ensureItemRuleConfigsLoaded();
|
|
3005
3226
|
case 6:
|
|
3006
|
-
strategyConfigs =
|
|
3227
|
+
strategyConfigs = _context37.sent;
|
|
3007
3228
|
if (strategyConfigs.length) {
|
|
3008
|
-
|
|
3229
|
+
_context37.next = 9;
|
|
3009
3230
|
break;
|
|
3010
3231
|
}
|
|
3011
|
-
return
|
|
3232
|
+
return _context37.abrupt("return");
|
|
3012
3233
|
case 9:
|
|
3013
3234
|
businessData = buildItemRuleBusinessData({
|
|
3014
|
-
tempOrder: this.
|
|
3235
|
+
tempOrder: this.ensureVenueTempOrder(),
|
|
3015
3236
|
runtimeConfig: this.getItemRuleRuntimeConfig(),
|
|
3016
3237
|
itemRuleConfigs: this.itemRuleConfigs
|
|
3017
3238
|
});
|
|
3018
3239
|
prefillItems = this.itemRuleEvaluator.getPrefillItems(businessData);
|
|
3019
3240
|
if (prefillItems.length) {
|
|
3020
|
-
|
|
3241
|
+
_context37.next = 14;
|
|
3021
3242
|
break;
|
|
3022
3243
|
}
|
|
3023
3244
|
this.itemRulePrefillApplied = true;
|
|
3024
|
-
return
|
|
3245
|
+
return _context37.abrupt("return");
|
|
3025
3246
|
case 14:
|
|
3026
|
-
|
|
3247
|
+
_context37.next = 16;
|
|
3027
3248
|
return this.buildPrefillProductSourceMap();
|
|
3028
3249
|
case 16:
|
|
3029
|
-
productSourceMap =
|
|
3030
|
-
tempOrder = this.
|
|
3250
|
+
productSourceMap = _context37.sent;
|
|
3251
|
+
tempOrder = this.ensureVenueTempOrder();
|
|
3031
3252
|
hasChanges = false;
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3253
|
+
_iterator18 = _createForOfIteratorHelper(prefillItems);
|
|
3254
|
+
_context37.prev = 20;
|
|
3255
|
+
_iterator18.s();
|
|
3035
3256
|
case 22:
|
|
3036
|
-
if ((
|
|
3037
|
-
|
|
3257
|
+
if ((_step18 = _iterator18.n()).done) {
|
|
3258
|
+
_context37.next = 51;
|
|
3038
3259
|
break;
|
|
3039
3260
|
}
|
|
3040
|
-
prefillItem =
|
|
3261
|
+
prefillItem = _step18.value;
|
|
3041
3262
|
productId = Number(prefillItem.product_id);
|
|
3042
3263
|
productVariantId = Number((_prefillItem$product_ = prefillItem.product_variant_id) !== null && _prefillItem$product_ !== void 0 ? _prefillItem$product_ : 0);
|
|
3043
3264
|
targetQuantity = toNonNegativeInt(prefillItem.quantity);
|
|
3044
3265
|
if (!(!Number.isFinite(productId) || targetQuantity <= 0)) {
|
|
3045
|
-
|
|
3266
|
+
_context37.next = 29;
|
|
3046
3267
|
break;
|
|
3047
3268
|
}
|
|
3048
|
-
return
|
|
3269
|
+
return _context37.abrupt("continue", 49);
|
|
3049
3270
|
case 29:
|
|
3050
3271
|
if (!Number.isNaN(productVariantId)) {
|
|
3051
|
-
|
|
3272
|
+
_context37.next = 31;
|
|
3052
3273
|
break;
|
|
3053
3274
|
}
|
|
3054
|
-
return
|
|
3275
|
+
return _context37.abrupt("continue", 49);
|
|
3055
3276
|
case 31:
|
|
3056
3277
|
sourceItem = productSourceMap.get(buildProductKey(productId, productVariantId)) || productSourceMap.get(buildProductKey(productId, 0)) || null;
|
|
3057
3278
|
productIndex = getProductIdentityIndex(tempOrder.products, {
|
|
@@ -3059,11 +3280,15 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3059
3280
|
product_variant_id: productVariantId
|
|
3060
3281
|
});
|
|
3061
3282
|
if (!(productIndex === -1)) {
|
|
3062
|
-
|
|
3283
|
+
_context37.next = 42;
|
|
3063
3284
|
break;
|
|
3064
3285
|
}
|
|
3065
3286
|
sellingPrice = toPriceString((_sourceItem$price = sourceItem === null || sourceItem === void 0 ? void 0 : sourceItem.price) !== null && _sourceItem$price !== void 0 ? _sourceItem$price : sourceItem === null || sourceItem === void 0 ? void 0 : sourceItem.selling_price, '0.00');
|
|
3066
|
-
|
|
3287
|
+
origin = _objectSpread(_objectSpread({}, sourceItem || {}), {}, {
|
|
3288
|
+
item_rule_prefill: true,
|
|
3289
|
+
item_rule_id: prefillItem.ruleId
|
|
3290
|
+
});
|
|
3291
|
+
product = normalizeOrderProduct({
|
|
3067
3292
|
product_id: productId,
|
|
3068
3293
|
product_variant_id: productVariantId,
|
|
3069
3294
|
num: targetQuantity,
|
|
@@ -3073,15 +3298,17 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3073
3298
|
item_rule_prefill: true,
|
|
3074
3299
|
item_rule_id: prefillItem.ruleId
|
|
3075
3300
|
},
|
|
3076
|
-
_origin:
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
3301
|
+
_origin: origin
|
|
3302
|
+
});
|
|
3303
|
+
productUid = String(((_product$metadata9 = product.metadata) === null || _product$metadata9 === void 0 ? void 0 : _product$metadata9.unique_identification_number) || '');
|
|
3304
|
+
this.attachProductOriginToTempOrder(tempOrder, productUid, origin);
|
|
3305
|
+
tempOrder.products.push(product);
|
|
3081
3306
|
hasChanges = true;
|
|
3082
|
-
return
|
|
3083
|
-
case
|
|
3307
|
+
return _context37.abrupt("continue", 49);
|
|
3308
|
+
case 42:
|
|
3084
3309
|
targetProduct = tempOrder.products[productIndex];
|
|
3310
|
+
previousOrigin = this.readProductOriginFromTempOrder(tempOrder, targetProduct);
|
|
3311
|
+
nextOrigin = sourceItem ? _objectSpread(_objectSpread({}, previousOrigin || {}), sourceItem) : previousOrigin;
|
|
3085
3312
|
existedQuantity = toNonNegativeInt(targetProduct.num);
|
|
3086
3313
|
delta = targetQuantity - existedQuantity;
|
|
3087
3314
|
nextProduct = _objectSpread(_objectSpread(_objectSpread({}, targetProduct), delta > 0 ? {
|
|
@@ -3090,54 +3317,55 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3090
3317
|
metadata: _objectSpread(_objectSpread({}, targetProduct.metadata || {}), {}, {
|
|
3091
3318
|
item_rule_prefill: true,
|
|
3092
3319
|
item_rule_id: prefillItem.ruleId
|
|
3093
|
-
})
|
|
3094
|
-
_origin: sourceItem ? _objectSpread(_objectSpread({}, targetProduct._origin || {}), sourceItem) : targetProduct._origin
|
|
3320
|
+
})
|
|
3095
3321
|
});
|
|
3096
|
-
if (delta > 0 || Boolean(sourceItem && (!
|
|
3322
|
+
if (delta > 0 || Boolean(sourceItem && (!previousOrigin || (previousOrigin === null || previousOrigin === void 0 ? void 0 : previousOrigin.price) !== (sourceItem === null || sourceItem === void 0 ? void 0 : sourceItem.price)))) {
|
|
3323
|
+
_productUid = String(((_nextProduct$metadata = nextProduct.metadata) === null || _nextProduct$metadata === void 0 ? void 0 : _nextProduct$metadata.unique_identification_number) || '');
|
|
3324
|
+
this.attachProductOriginToTempOrder(tempOrder, _productUid, nextOrigin);
|
|
3097
3325
|
tempOrder.products[productIndex] = nextProduct;
|
|
3098
3326
|
hasChanges = true;
|
|
3099
3327
|
}
|
|
3100
|
-
case
|
|
3101
|
-
|
|
3328
|
+
case 49:
|
|
3329
|
+
_context37.next = 22;
|
|
3102
3330
|
break;
|
|
3103
|
-
case
|
|
3104
|
-
|
|
3331
|
+
case 51:
|
|
3332
|
+
_context37.next = 56;
|
|
3105
3333
|
break;
|
|
3106
|
-
case 47:
|
|
3107
|
-
_context36.prev = 47;
|
|
3108
|
-
_context36.t0 = _context36["catch"](20);
|
|
3109
|
-
_iterator17.e(_context36.t0);
|
|
3110
|
-
case 50:
|
|
3111
|
-
_context36.prev = 50;
|
|
3112
|
-
_iterator17.f();
|
|
3113
|
-
return _context36.finish(50);
|
|
3114
3334
|
case 53:
|
|
3335
|
+
_context37.prev = 53;
|
|
3336
|
+
_context37.t0 = _context37["catch"](20);
|
|
3337
|
+
_iterator18.e(_context37.t0);
|
|
3338
|
+
case 56:
|
|
3339
|
+
_context37.prev = 56;
|
|
3340
|
+
_iterator18.f();
|
|
3341
|
+
return _context37.finish(56);
|
|
3342
|
+
case 59:
|
|
3115
3343
|
if (!hasChanges) {
|
|
3116
|
-
|
|
3344
|
+
_context37.next = 64;
|
|
3117
3345
|
break;
|
|
3118
3346
|
}
|
|
3119
3347
|
// Prefill 属于 products CRUD 的一种形式:新增后让 Rules 重算,以支持自动应用可用优惠券。
|
|
3120
3348
|
this.store.order.applyDiscount();
|
|
3121
|
-
|
|
3349
|
+
_context37.next = 63;
|
|
3122
3350
|
return this.store.order.recalculateSummary({
|
|
3123
3351
|
createIfMissing: true
|
|
3124
3352
|
});
|
|
3125
|
-
case
|
|
3353
|
+
case 63:
|
|
3126
3354
|
this.store.order.persistTempOrder();
|
|
3127
|
-
case
|
|
3128
|
-
|
|
3355
|
+
case 64:
|
|
3356
|
+
_context37.next = 66;
|
|
3129
3357
|
return this.refreshItemRuleQuantityLimits();
|
|
3130
|
-
case
|
|
3358
|
+
case 66:
|
|
3131
3359
|
this.itemRulePrefillApplied = true;
|
|
3132
3360
|
this.logMethodSuccess('applyPrefillByItemRule', {
|
|
3133
3361
|
prefillCount: prefillItems.length,
|
|
3134
3362
|
hasChanges: hasChanges
|
|
3135
3363
|
});
|
|
3136
|
-
case
|
|
3364
|
+
case 68:
|
|
3137
3365
|
case "end":
|
|
3138
|
-
return
|
|
3366
|
+
return _context37.stop();
|
|
3139
3367
|
}
|
|
3140
|
-
},
|
|
3368
|
+
}, _callee37, this, [[20, 53, 56, 59]]);
|
|
3141
3369
|
}));
|
|
3142
3370
|
function applyPrefillByItemRule() {
|
|
3143
3371
|
return _applyPrefillByItemRule.apply(this, arguments);
|
|
@@ -3147,24 +3375,24 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3147
3375
|
}, {
|
|
3148
3376
|
key: "applyItemRulePrefill",
|
|
3149
3377
|
value: function () {
|
|
3150
|
-
var _applyItemRulePrefill = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3151
|
-
return _regeneratorRuntime().wrap(function
|
|
3152
|
-
while (1) switch (
|
|
3378
|
+
var _applyItemRulePrefill = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38() {
|
|
3379
|
+
return _regeneratorRuntime().wrap(function _callee38$(_context38) {
|
|
3380
|
+
while (1) switch (_context38.prev = _context38.next) {
|
|
3153
3381
|
case 0:
|
|
3154
3382
|
this.logMethodStart('applyItemRulePrefill');
|
|
3155
|
-
|
|
3383
|
+
_context38.next = 3;
|
|
3156
3384
|
return this.applyPrefillByItemRule();
|
|
3157
3385
|
case 3:
|
|
3158
|
-
|
|
3386
|
+
_context38.next = 5;
|
|
3159
3387
|
return this.refreshItemRuleQuantityLimits();
|
|
3160
3388
|
case 5:
|
|
3161
|
-
|
|
3389
|
+
_context38.next = 7;
|
|
3162
3390
|
return this.refreshCartValidationPassed();
|
|
3163
3391
|
case 7:
|
|
3164
3392
|
case "end":
|
|
3165
|
-
return
|
|
3393
|
+
return _context38.stop();
|
|
3166
3394
|
}
|
|
3167
|
-
},
|
|
3395
|
+
}, _callee38, this);
|
|
3168
3396
|
}));
|
|
3169
3397
|
function applyItemRulePrefill() {
|
|
3170
3398
|
return _applyItemRulePrefill.apply(this, arguments);
|
|
@@ -3174,35 +3402,35 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3174
3402
|
}, {
|
|
3175
3403
|
key: "evaluateCartValidationByItemRule",
|
|
3176
3404
|
value: function () {
|
|
3177
|
-
var _evaluateCartValidationByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3405
|
+
var _evaluateCartValidationByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39() {
|
|
3178
3406
|
var strategyConfigs, businessData;
|
|
3179
|
-
return _regeneratorRuntime().wrap(function
|
|
3180
|
-
while (1) switch (
|
|
3407
|
+
return _regeneratorRuntime().wrap(function _callee39$(_context39) {
|
|
3408
|
+
while (1) switch (_context39.prev = _context39.next) {
|
|
3181
3409
|
case 0:
|
|
3182
|
-
|
|
3410
|
+
_context39.next = 2;
|
|
3183
3411
|
return this.ensureItemRuleConfigsLoaded();
|
|
3184
3412
|
case 2:
|
|
3185
|
-
strategyConfigs =
|
|
3413
|
+
strategyConfigs = _context39.sent;
|
|
3186
3414
|
if (strategyConfigs.length) {
|
|
3187
|
-
|
|
3415
|
+
_context39.next = 5;
|
|
3188
3416
|
break;
|
|
3189
3417
|
}
|
|
3190
|
-
return
|
|
3418
|
+
return _context39.abrupt("return", {
|
|
3191
3419
|
passed: true,
|
|
3192
3420
|
failures: []
|
|
3193
3421
|
});
|
|
3194
3422
|
case 5:
|
|
3195
3423
|
businessData = buildItemRuleBusinessData({
|
|
3196
|
-
tempOrder: this.
|
|
3424
|
+
tempOrder: this.ensureVenueTempOrder(),
|
|
3197
3425
|
runtimeConfig: this.getItemRuleRuntimeConfig(),
|
|
3198
3426
|
itemRuleConfigs: this.itemRuleConfigs
|
|
3199
3427
|
});
|
|
3200
|
-
return
|
|
3428
|
+
return _context39.abrupt("return", this.itemRuleEvaluator.validateCart(businessData));
|
|
3201
3429
|
case 7:
|
|
3202
3430
|
case "end":
|
|
3203
|
-
return
|
|
3431
|
+
return _context39.stop();
|
|
3204
3432
|
}
|
|
3205
|
-
},
|
|
3433
|
+
}, _callee39, this);
|
|
3206
3434
|
}));
|
|
3207
3435
|
function evaluateCartValidationByItemRule() {
|
|
3208
3436
|
return _evaluateCartValidationByItemRule.apply(this, arguments);
|
|
@@ -3212,20 +3440,20 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3212
3440
|
}, {
|
|
3213
3441
|
key: "validateBeforeSubmitByItemRule",
|
|
3214
3442
|
value: function () {
|
|
3215
|
-
var _validateBeforeSubmitByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3443
|
+
var _validateBeforeSubmitByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40() {
|
|
3216
3444
|
var validationResult, firstFailure, errorMessage, error;
|
|
3217
|
-
return _regeneratorRuntime().wrap(function
|
|
3218
|
-
while (1) switch (
|
|
3445
|
+
return _regeneratorRuntime().wrap(function _callee40$(_context40) {
|
|
3446
|
+
while (1) switch (_context40.prev = _context40.next) {
|
|
3219
3447
|
case 0:
|
|
3220
|
-
|
|
3448
|
+
_context40.next = 2;
|
|
3221
3449
|
return this.evaluateCartValidationByItemRule();
|
|
3222
3450
|
case 2:
|
|
3223
|
-
validationResult =
|
|
3451
|
+
validationResult = _context40.sent;
|
|
3224
3452
|
if (!validationResult.passed) {
|
|
3225
|
-
|
|
3453
|
+
_context40.next = 5;
|
|
3226
3454
|
break;
|
|
3227
3455
|
}
|
|
3228
|
-
return
|
|
3456
|
+
return _context40.abrupt("return");
|
|
3229
3457
|
case 5:
|
|
3230
3458
|
firstFailure = validationResult.failures[0];
|
|
3231
3459
|
errorMessage = (firstFailure === null || firstFailure === void 0 ? void 0 : firstFailure.validationMessage) || '当前购物车未满足商品规则,请调整后再提交';
|
|
@@ -3234,9 +3462,9 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3234
3462
|
throw error;
|
|
3235
3463
|
case 10:
|
|
3236
3464
|
case "end":
|
|
3237
|
-
return
|
|
3465
|
+
return _context40.stop();
|
|
3238
3466
|
}
|
|
3239
|
-
},
|
|
3467
|
+
}, _callee40, this);
|
|
3240
3468
|
}));
|
|
3241
3469
|
function validateBeforeSubmitByItemRule() {
|
|
3242
3470
|
return _validateBeforeSubmitByItemRule.apply(this, arguments);
|
|
@@ -3246,10 +3474,10 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3246
3474
|
}, {
|
|
3247
3475
|
key: "refreshCartValidationPassed",
|
|
3248
3476
|
value: function () {
|
|
3249
|
-
var _refreshCartValidationPassed = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3477
|
+
var _refreshCartValidationPassed = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41() {
|
|
3250
3478
|
var previous, nextState, validationResult, changed;
|
|
3251
|
-
return _regeneratorRuntime().wrap(function
|
|
3252
|
-
while (1) switch (
|
|
3479
|
+
return _regeneratorRuntime().wrap(function _callee41$(_context41) {
|
|
3480
|
+
while (1) switch (_context41.prev = _context41.next) {
|
|
3253
3481
|
case 0:
|
|
3254
3482
|
previous = this.store.cartValidation || {
|
|
3255
3483
|
passed: null,
|
|
@@ -3259,20 +3487,20 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3259
3487
|
passed: null,
|
|
3260
3488
|
failures: []
|
|
3261
3489
|
};
|
|
3262
|
-
|
|
3263
|
-
|
|
3490
|
+
_context41.prev = 2;
|
|
3491
|
+
_context41.next = 5;
|
|
3264
3492
|
return this.evaluateCartValidationByItemRule();
|
|
3265
3493
|
case 5:
|
|
3266
|
-
validationResult =
|
|
3494
|
+
validationResult = _context41.sent;
|
|
3267
3495
|
nextState = {
|
|
3268
3496
|
passed: validationResult.passed,
|
|
3269
3497
|
failures: validationResult.failures || []
|
|
3270
3498
|
};
|
|
3271
|
-
|
|
3499
|
+
_context41.next = 12;
|
|
3272
3500
|
break;
|
|
3273
3501
|
case 9:
|
|
3274
|
-
|
|
3275
|
-
|
|
3502
|
+
_context41.prev = 9;
|
|
3503
|
+
_context41.t0 = _context41["catch"](2);
|
|
3276
3504
|
nextState = {
|
|
3277
3505
|
passed: false,
|
|
3278
3506
|
failures: []
|
|
@@ -3281,21 +3509,21 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3281
3509
|
this.store.cartValidation = nextState;
|
|
3282
3510
|
changed = previous.passed !== nextState.passed || previous.failures !== nextState.failures;
|
|
3283
3511
|
if (!changed) {
|
|
3284
|
-
|
|
3512
|
+
_context41.next = 17;
|
|
3285
3513
|
break;
|
|
3286
3514
|
}
|
|
3287
|
-
|
|
3515
|
+
_context41.next = 17;
|
|
3288
3516
|
return this.core.effects.emit(VenueBookingHooks.onCartValidationChanged, {
|
|
3289
3517
|
cartValidation: nextState,
|
|
3290
3518
|
cartValidationPassed: nextState.passed
|
|
3291
3519
|
});
|
|
3292
3520
|
case 17:
|
|
3293
|
-
return
|
|
3521
|
+
return _context41.abrupt("return", nextState.passed);
|
|
3294
3522
|
case 18:
|
|
3295
3523
|
case "end":
|
|
3296
|
-
return
|
|
3524
|
+
return _context41.stop();
|
|
3297
3525
|
}
|
|
3298
|
-
},
|
|
3526
|
+
}, _callee41, this, [[2, 9]]);
|
|
3299
3527
|
}));
|
|
3300
3528
|
function refreshCartValidationPassed() {
|
|
3301
3529
|
return _refreshCartValidationPassed.apply(this, arguments);
|
|
@@ -3305,14 +3533,14 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3305
3533
|
}, {
|
|
3306
3534
|
key: "setItemRuleRuntimeConfig",
|
|
3307
3535
|
value: function () {
|
|
3308
|
-
var _setItemRuleRuntimeConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3536
|
+
var _setItemRuleRuntimeConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42() {
|
|
3309
3537
|
var _this$itemRuleRuntime, _this$itemRuleRuntime2;
|
|
3310
3538
|
var config,
|
|
3311
|
-
|
|
3312
|
-
return _regeneratorRuntime().wrap(function
|
|
3313
|
-
while (1) switch (
|
|
3539
|
+
_args42 = arguments;
|
|
3540
|
+
return _regeneratorRuntime().wrap(function _callee42$(_context42) {
|
|
3541
|
+
while (1) switch (_context42.prev = _context42.next) {
|
|
3314
3542
|
case 0:
|
|
3315
|
-
config =
|
|
3543
|
+
config = _args42.length > 0 && _args42[0] !== undefined ? _args42[0] : {};
|
|
3316
3544
|
this.logMethodStart('setItemRuleRuntimeConfig');
|
|
3317
3545
|
this.itemRuleRuntimeConfig = _objectSpread(_objectSpread(_objectSpread({}, this.itemRuleRuntimeConfig), config), {}, {
|
|
3318
3546
|
pax: _objectSpread(_objectSpread({}, ((_this$itemRuleRuntime = this.itemRuleRuntimeConfig) === null || _this$itemRuleRuntime === void 0 ? void 0 : _this$itemRuleRuntime.pax) || {}), (config === null || config === void 0 ? void 0 : config.pax) || {}),
|
|
@@ -3324,10 +3552,10 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3324
3552
|
this.itemRuleEvaluator.setStrategyConfigs([]);
|
|
3325
3553
|
}
|
|
3326
3554
|
this.itemRulePrefillApplied = false;
|
|
3327
|
-
|
|
3555
|
+
_context42.next = 7;
|
|
3328
3556
|
return this.refreshItemRuleQuantityLimits();
|
|
3329
3557
|
case 7:
|
|
3330
|
-
|
|
3558
|
+
_context42.next = 9;
|
|
3331
3559
|
return this.refreshCartValidationPassed();
|
|
3332
3560
|
case 9:
|
|
3333
3561
|
this.logMethodSuccess('setItemRuleRuntimeConfig', {
|
|
@@ -3335,9 +3563,9 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3335
3563
|
});
|
|
3336
3564
|
case 10:
|
|
3337
3565
|
case "end":
|
|
3338
|
-
return
|
|
3566
|
+
return _context42.stop();
|
|
3339
3567
|
}
|
|
3340
|
-
},
|
|
3568
|
+
}, _callee42, this);
|
|
3341
3569
|
}));
|
|
3342
3570
|
function setItemRuleRuntimeConfig() {
|
|
3343
3571
|
return _setItemRuleRuntimeConfig.apply(this, arguments);
|
|
@@ -3364,23 +3592,23 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3364
3592
|
}, {
|
|
3365
3593
|
key: "readUIStateBucket",
|
|
3366
3594
|
value: function readUIStateBucket() {
|
|
3367
|
-
var _this$
|
|
3595
|
+
var _this$window2;
|
|
3368
3596
|
var key = this.getUIStateBucketKey();
|
|
3369
|
-
if (!key || !((_this$
|
|
3597
|
+
if (!key || !((_this$window2 = this.window) !== null && _this$window2 !== void 0 && _this$window2.sessionStorage)) return {};
|
|
3370
3598
|
try {
|
|
3371
3599
|
var raw = this.window.sessionStorage.getItem(key) || '{}';
|
|
3372
3600
|
var parsed = JSON.parse(raw);
|
|
3373
3601
|
return parsed && _typeof(parsed) === 'object' ? parsed : {};
|
|
3374
|
-
} catch (
|
|
3602
|
+
} catch (_unused4) {
|
|
3375
3603
|
return {};
|
|
3376
3604
|
}
|
|
3377
3605
|
}
|
|
3378
3606
|
}, {
|
|
3379
3607
|
key: "writeUIStateBucket",
|
|
3380
3608
|
value: function writeUIStateBucket(bucket) {
|
|
3381
|
-
var _this$
|
|
3609
|
+
var _this$window3;
|
|
3382
3610
|
var key = this.getUIStateBucketKey();
|
|
3383
|
-
if (!key || !((_this$
|
|
3611
|
+
if (!key || !((_this$window3 = this.window) !== null && _this$window3 !== void 0 && _this$window3.sessionStorage)) return;
|
|
3384
3612
|
this.window.sessionStorage.setItem(key, JSON.stringify(bucket));
|
|
3385
3613
|
}
|
|
3386
3614
|
}, {
|
|
@@ -3408,30 +3636,118 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3408
3636
|
this.writeUIStateBucket(bucket);
|
|
3409
3637
|
}
|
|
3410
3638
|
}
|
|
3639
|
+
}, {
|
|
3640
|
+
key: "setBookingHolder",
|
|
3641
|
+
value: function setBookingHolder(bookingUid, holder) {
|
|
3642
|
+
var _tempOrder$bookings4;
|
|
3643
|
+
if (!this.store.order) return;
|
|
3644
|
+
var tempOrder = this.store.order.ensureTempOrder();
|
|
3645
|
+
var booking = (_tempOrder$bookings4 = tempOrder.bookings) === null || _tempOrder$bookings4 === void 0 ? void 0 : _tempOrder$bookings4.find(function (b) {
|
|
3646
|
+
var _b$metadata4;
|
|
3647
|
+
return ((_b$metadata4 = b.metadata) === null || _b$metadata4 === void 0 ? void 0 : _b$metadata4.unique_identification_number) === bookingUid;
|
|
3648
|
+
});
|
|
3649
|
+
if (booking) {
|
|
3650
|
+
booking.holder = holder;
|
|
3651
|
+
}
|
|
3652
|
+
var _iterator19 = _createForOfIteratorHelper(tempOrder.products),
|
|
3653
|
+
_step19;
|
|
3654
|
+
try {
|
|
3655
|
+
for (_iterator19.s(); !(_step19 = _iterator19.n()).done;) {
|
|
3656
|
+
var _runtimeProduct$metad, _runtimeProduct$metad2, _runtimeProduct$_orig;
|
|
3657
|
+
var product = _step19.value;
|
|
3658
|
+
var runtimeProduct = product;
|
|
3659
|
+
var productBookingUid = (_runtimeProduct$metad = (_runtimeProduct$metad2 = runtimeProduct.metadata) === null || _runtimeProduct$metad2 === void 0 ? void 0 : _runtimeProduct$metad2.booking_uid) !== null && _runtimeProduct$metad !== void 0 ? _runtimeProduct$metad : (_runtimeProduct$_orig = runtimeProduct._origin) === null || _runtimeProduct$_orig === void 0 || (_runtimeProduct$_orig = _runtimeProduct$_orig.product) === null || _runtimeProduct$_orig === void 0 ? void 0 : _runtimeProduct$_orig.bookingUuid;
|
|
3660
|
+
if (String(productBookingUid) !== String(bookingUid)) continue;
|
|
3661
|
+
var origin = runtimeProduct._origin && _typeof(runtimeProduct._origin) === 'object' ? runtimeProduct._origin : {};
|
|
3662
|
+
origin.holder = holder;
|
|
3663
|
+
runtimeProduct._origin = origin;
|
|
3664
|
+
}
|
|
3665
|
+
} catch (err) {
|
|
3666
|
+
_iterator19.e(err);
|
|
3667
|
+
} finally {
|
|
3668
|
+
_iterator19.f();
|
|
3669
|
+
}
|
|
3670
|
+
this.store.order.notifyTempOrderChanged();
|
|
3671
|
+
}
|
|
3672
|
+
|
|
3673
|
+
/**
|
|
3674
|
+
* 获取 holder 表单 map
|
|
3675
|
+
*/
|
|
3676
|
+
}, {
|
|
3677
|
+
key: "getHolderFormMap",
|
|
3678
|
+
value: function getHolderFormMap() {
|
|
3679
|
+
if (!this.store.holder) throw new Error('[VenueBooking] holder 模块未初始化');
|
|
3680
|
+
return this.store.holder.getHolderFormMap();
|
|
3681
|
+
}
|
|
3682
|
+
|
|
3683
|
+
/**
|
|
3684
|
+
* UI 层触发:按当前 holderMap 批量刷新所有表单的 records
|
|
3685
|
+
*/
|
|
3686
|
+
}, {
|
|
3687
|
+
key: "refreshAllHolderFormRecords",
|
|
3688
|
+
value: (function () {
|
|
3689
|
+
var _refreshAllHolderFormRecords = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(params) {
|
|
3690
|
+
var _params$customer_id, _params$useCache;
|
|
3691
|
+
var customer_id;
|
|
3692
|
+
return _regeneratorRuntime().wrap(function _callee43$(_context43) {
|
|
3693
|
+
while (1) switch (_context43.prev = _context43.next) {
|
|
3694
|
+
case 0:
|
|
3695
|
+
if (this.store.holder) {
|
|
3696
|
+
_context43.next = 2;
|
|
3697
|
+
break;
|
|
3698
|
+
}
|
|
3699
|
+
throw new Error('[VenueBooking] holder 模块未初始化');
|
|
3700
|
+
case 2:
|
|
3701
|
+
customer_id = (_params$customer_id = params === null || params === void 0 ? void 0 : params.customer_id) !== null && _params$customer_id !== void 0 ? _params$customer_id : this.resolveHolderCustomerId();
|
|
3702
|
+
return _context43.abrupt("return", this.store.holder.refreshAllFormRecords(_objectSpread(_objectSpread({}, params), {}, {
|
|
3703
|
+
customer_id: customer_id,
|
|
3704
|
+
useCache: (_params$useCache = params === null || params === void 0 ? void 0 : params.useCache) !== null && _params$useCache !== void 0 ? _params$useCache : false
|
|
3705
|
+
})));
|
|
3706
|
+
case 4:
|
|
3707
|
+
case "end":
|
|
3708
|
+
return _context43.stop();
|
|
3709
|
+
}
|
|
3710
|
+
}, _callee43, this);
|
|
3711
|
+
}));
|
|
3712
|
+
function refreshAllHolderFormRecords(_x21) {
|
|
3713
|
+
return _refreshAllHolderFormRecords.apply(this, arguments);
|
|
3714
|
+
}
|
|
3715
|
+
return refreshAllHolderFormRecords;
|
|
3716
|
+
}()
|
|
3717
|
+
/**
|
|
3718
|
+
* 添加表单记录
|
|
3719
|
+
*/
|
|
3720
|
+
)
|
|
3721
|
+
}, {
|
|
3722
|
+
key: "appendFormRecord",
|
|
3723
|
+
value: function appendFormRecord(params) {
|
|
3724
|
+
if (!this.store.holder) throw new Error('[VenueBooking] holder 模块未初始化');
|
|
3725
|
+
return this.store.holder.appendFormRecord(params);
|
|
3726
|
+
}
|
|
3411
3727
|
|
|
3412
3728
|
// ─── OpenData 可用性 ───
|
|
3413
3729
|
}, {
|
|
3414
3730
|
key: "checkOpenDataAvailability",
|
|
3415
3731
|
value: function () {
|
|
3416
|
-
var _checkOpenDataAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3417
|
-
return _regeneratorRuntime().wrap(function
|
|
3418
|
-
while (1) switch (
|
|
3732
|
+
var _checkOpenDataAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44() {
|
|
3733
|
+
return _regeneratorRuntime().wrap(function _callee44$(_context44) {
|
|
3734
|
+
while (1) switch (_context44.prev = _context44.next) {
|
|
3419
3735
|
case 0:
|
|
3420
3736
|
if (this.store.openData) {
|
|
3421
|
-
|
|
3737
|
+
_context44.next = 2;
|
|
3422
3738
|
break;
|
|
3423
3739
|
}
|
|
3424
3740
|
throw new Error('openData 模块未初始化');
|
|
3425
3741
|
case 2:
|
|
3426
|
-
|
|
3742
|
+
_context44.next = 4;
|
|
3427
3743
|
return this.loadOpenDataConfig();
|
|
3428
3744
|
case 4:
|
|
3429
|
-
return
|
|
3745
|
+
return _context44.abrupt("return", this.store.openData.checkAvailability(this.store.schedule));
|
|
3430
3746
|
case 5:
|
|
3431
3747
|
case "end":
|
|
3432
|
-
return
|
|
3748
|
+
return _context44.stop();
|
|
3433
3749
|
}
|
|
3434
|
-
},
|
|
3750
|
+
}, _callee44, this);
|
|
3435
3751
|
}));
|
|
3436
3752
|
function checkOpenDataAvailability() {
|
|
3437
3753
|
return _checkOpenDataAvailability.apply(this, arguments);
|
|
@@ -3441,15 +3757,15 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3441
3757
|
}, {
|
|
3442
3758
|
key: "setOtherParams",
|
|
3443
3759
|
value: function () {
|
|
3444
|
-
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3445
|
-
var
|
|
3446
|
-
|
|
3760
|
+
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45(params) {
|
|
3761
|
+
var _ref7,
|
|
3762
|
+
_ref7$cover,
|
|
3447
3763
|
cover,
|
|
3448
|
-
|
|
3449
|
-
return _regeneratorRuntime().wrap(function
|
|
3450
|
-
while (1) switch (
|
|
3764
|
+
_args45 = arguments;
|
|
3765
|
+
return _regeneratorRuntime().wrap(function _callee45$(_context45) {
|
|
3766
|
+
while (1) switch (_context45.prev = _context45.next) {
|
|
3451
3767
|
case 0:
|
|
3452
|
-
|
|
3768
|
+
_ref7 = _args45.length > 1 && _args45[1] !== undefined ? _args45[1] : {}, _ref7$cover = _ref7.cover, cover = _ref7$cover === void 0 ? false : _ref7$cover;
|
|
3453
3769
|
if (cover) {
|
|
3454
3770
|
this.otherParams = params;
|
|
3455
3771
|
} else {
|
|
@@ -3457,17 +3773,17 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3457
3773
|
}
|
|
3458
3774
|
case 2:
|
|
3459
3775
|
case "end":
|
|
3460
|
-
return
|
|
3776
|
+
return _context45.stop();
|
|
3461
3777
|
}
|
|
3462
|
-
},
|
|
3778
|
+
}, _callee45, this);
|
|
3463
3779
|
}));
|
|
3464
|
-
function setOtherParams(
|
|
3780
|
+
function setOtherParams(_x22) {
|
|
3465
3781
|
return _setOtherParams.apply(this, arguments);
|
|
3466
3782
|
}
|
|
3467
3783
|
return setOtherParams;
|
|
3468
3784
|
}()
|
|
3469
3785
|
}]);
|
|
3470
3786
|
return VenueBookingImpl;
|
|
3471
|
-
}(
|
|
3787
|
+
}(BaseSalesImpl);
|
|
3472
3788
|
_defineProperty(VenueBookingImpl, "OPEN_DATA_CACHE_TTL", 5 * 60 * 1000);
|
|
3473
3789
|
_defineProperty(VenueBookingImpl, "UI_STATE_KEY_PREFIX", 'pisell.venueBooking.uiState:');
|