@pisell/pisellos 0.0.10 → 0.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/modules/Account/index.d.ts +4 -2
- package/dist/modules/Account/index.js +23 -36
- package/dist/modules/Account/types.d.ts +1 -0
- package/dist/modules/AccountList/index.d.ts +2 -0
- package/dist/modules/AccountList/index.js +34 -11
- package/dist/modules/Cart/index.d.ts +17 -11
- package/dist/modules/Cart/index.js +179 -121
- package/dist/modules/Cart/types.d.ts +98 -9
- package/dist/modules/Cart/types.js +8 -0
- package/dist/modules/Cart/utils.d.ts +114 -0
- package/dist/modules/Cart/utils.js +345 -0
- package/dist/modules/Date/index.d.ts +11 -12
- package/dist/modules/Date/index.js +104 -60
- package/dist/modules/Date/types.d.ts +51 -20
- package/dist/modules/Date/types.js +2 -5
- package/dist/modules/Date/utils.d.ts +35 -0
- package/dist/modules/Date/utils.js +211 -0
- package/dist/modules/Discount/index.d.ts +26 -0
- package/dist/modules/Discount/index.js +234 -0
- package/dist/modules/Discount/types.d.ts +66 -0
- package/dist/modules/Discount/types.js +5 -0
- package/dist/modules/Order/index.d.ts +16 -12
- package/dist/modules/Order/index.js +38 -166
- package/dist/modules/Order/types.d.ts +18 -41
- package/dist/modules/Order/types.js +0 -14
- package/dist/modules/Payment/index.d.ts +0 -2
- package/dist/modules/Payment/index.js +45 -76
- package/dist/modules/Payment/types.d.ts +0 -2
- package/dist/modules/Payment/types.js +2 -0
- package/dist/modules/Product/types.d.ts +48 -1
- package/dist/modules/ProductList/index.d.ts +1 -0
- package/dist/modules/ProductList/index.js +21 -1
- package/dist/modules/ProductList/types.d.ts +1 -0
- package/dist/modules/Resource/types.d.ts +6 -2
- package/dist/modules/Rules/index.d.ts +32 -0
- package/dist/modules/Rules/index.js +423 -0
- package/dist/modules/Rules/types.d.ts +46 -0
- package/dist/modules/Rules/types.js +5 -0
- package/dist/modules/Summary/index.d.ts +13 -0
- package/dist/modules/Summary/index.js +80 -0
- package/dist/modules/Summary/types.d.ts +13 -0
- package/dist/modules/Summary/types.js +1 -0
- package/dist/modules/Summary/utils.d.ts +19 -0
- package/dist/modules/Summary/utils.js +56 -0
- package/dist/plugins/index.d.ts +3 -2
- package/dist/plugins/index.js +2 -1
- package/dist/plugins/request.d.ts +4 -3
- package/dist/plugins/request.js +30 -30
- package/dist/plugins/shopStore.d.ts +4 -0
- package/dist/plugins/shopStore.js +1 -0
- package/dist/solution/BookingByStep/index.d.ts +73 -12
- package/dist/solution/BookingByStep/index.js +635 -99
- package/dist/solution/BookingByStep/types.d.ts +2 -0
- package/dist/solution/BookingByStep/types.js +11 -8
- package/dist/solution/BookingByStep/utils/products.d.ts +11 -0
- package/dist/solution/BookingByStep/utils/products.js +47 -0
- package/dist/solution/BookingByStep/utils/resources.d.ts +59 -10
- package/dist/solution/BookingByStep/utils/resources.js +144 -79
- package/dist/solution/ShopDiscount/index.d.ts +50 -0
- package/dist/solution/ShopDiscount/index.js +546 -0
- package/dist/solution/ShopDiscount/types.d.ts +24 -0
- package/dist/solution/ShopDiscount/types.js +10 -0
- package/dist/solution/ShopDiscount/utils.d.ts +1 -0
- package/dist/solution/ShopDiscount/utils.js +7 -0
- package/dist/solution/index.d.ts +1 -0
- package/dist/solution/index.js +2 -1
- package/lib/modules/Account/index.d.ts +4 -2
- package/lib/modules/Account/index.js +14 -3
- package/lib/modules/Account/types.d.ts +1 -0
- package/lib/modules/AccountList/index.d.ts +2 -0
- package/lib/modules/AccountList/index.js +17 -0
- package/lib/modules/Cart/index.d.ts +17 -11
- package/lib/modules/Cart/index.js +72 -21
- package/lib/modules/Cart/types.d.ts +98 -9
- package/lib/modules/Cart/utils.d.ts +114 -0
- package/lib/modules/Cart/utils.js +320 -0
- package/lib/modules/Date/index.d.ts +11 -12
- package/lib/modules/Date/index.js +50 -31
- package/lib/modules/Date/types.d.ts +51 -20
- package/lib/modules/Date/types.js +0 -4
- package/lib/modules/Date/utils.d.ts +35 -0
- package/lib/modules/Date/utils.js +167 -0
- package/lib/modules/Discount/index.d.ts +26 -0
- package/lib/modules/Discount/index.js +118 -0
- package/lib/modules/Discount/types.d.ts +66 -0
- package/lib/modules/Discount/types.js +33 -0
- package/lib/modules/Order/index.d.ts +16 -12
- package/lib/modules/Order/index.js +23 -51
- package/lib/modules/Order/types.d.ts +18 -41
- package/lib/modules/Payment/index.d.ts +0 -2
- package/lib/modules/Payment/index.js +6 -17
- package/lib/modules/Payment/types.d.ts +0 -2
- package/lib/modules/Product/types.d.ts +48 -1
- package/lib/modules/ProductList/index.d.ts +1 -0
- package/lib/modules/ProductList/index.js +4 -0
- package/lib/modules/ProductList/types.d.ts +1 -0
- package/lib/modules/Resource/types.d.ts +6 -2
- package/lib/modules/Rules/index.d.ts +32 -0
- package/lib/modules/Rules/index.js +283 -0
- package/lib/modules/Rules/types.d.ts +46 -0
- package/lib/modules/Rules/types.js +33 -0
- package/lib/modules/Summary/index.d.ts +13 -0
- package/lib/modules/Summary/index.js +49 -0
- package/lib/modules/Summary/types.d.ts +13 -0
- package/lib/modules/Summary/types.js +17 -0
- package/lib/modules/Summary/utils.d.ts +19 -0
- package/lib/modules/Summary/utils.js +79 -0
- package/lib/plugins/index.d.ts +3 -2
- package/lib/plugins/index.js +3 -1
- package/lib/plugins/request.d.ts +4 -3
- package/lib/plugins/request.js +4 -20
- package/lib/plugins/shopStore.d.ts +4 -0
- package/lib/plugins/shopStore.js +17 -0
- package/lib/solution/BookingByStep/index.d.ts +73 -12
- package/lib/solution/BookingByStep/index.js +451 -24
- package/lib/solution/BookingByStep/types.d.ts +2 -0
- package/lib/solution/BookingByStep/types.js +3 -0
- package/lib/solution/BookingByStep/utils/products.d.ts +11 -0
- package/lib/solution/BookingByStep/utils/products.js +60 -0
- package/lib/solution/BookingByStep/utils/resources.d.ts +59 -10
- package/lib/solution/BookingByStep/utils/resources.js +106 -49
- package/lib/solution/ShopDiscount/index.d.ts +50 -0
- package/lib/solution/ShopDiscount/index.js +321 -0
- package/lib/solution/ShopDiscount/types.d.ts +24 -0
- package/lib/solution/ShopDiscount/types.js +38 -0
- package/lib/solution/ShopDiscount/utils.d.ts +1 -0
- package/lib/solution/ShopDiscount/utils.js +32 -0
- package/lib/solution/index.d.ts +1 -0
- package/lib/solution/index.js +3 -1
- package/package.json +4 -4
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
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); }
|
|
2
|
-
function
|
|
3
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
2
|
+
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; } } }; }
|
|
4
3
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
5
4
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
6
5
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
7
6
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
8
7
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
9
8
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
9
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
10
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
10
11
|
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; }
|
|
11
12
|
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); } }
|
|
12
13
|
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); }); }; }
|
|
@@ -25,6 +26,11 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
|
25
26
|
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); }
|
|
26
27
|
import { BaseModule } from "../../modules/BaseModule";
|
|
27
28
|
import { BookingByStepHooks, createModule } from "./types";
|
|
29
|
+
import { getAvailableProductResources } from "./utils/products";
|
|
30
|
+
import { getResourcesByProduct, getTimeSlicesByResource, getTimeSlicesByResources, getIsUsableByTimeItem } from "./utils/resources";
|
|
31
|
+
import dayjs from "dayjs";
|
|
32
|
+
import { getResourcesMap } from "../../modules/Resource/utils";
|
|
33
|
+
import { cloneDeep } from "lodash-es";
|
|
28
34
|
export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
29
35
|
_inherits(BookingByStepImpl, _BaseModule);
|
|
30
36
|
var _super = _createSuper(BookingByStepImpl);
|
|
@@ -40,6 +46,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
40
46
|
_defineProperty(_assertThisInitialized(_this), "isSolution", true);
|
|
41
47
|
_defineProperty(_assertThisInitialized(_this), "request", void 0);
|
|
42
48
|
_defineProperty(_assertThisInitialized(_this), "window", void 0);
|
|
49
|
+
_defineProperty(_assertThisInitialized(_this), "shopStore", void 0);
|
|
43
50
|
_defineProperty(_assertThisInitialized(_this), "store", void 0);
|
|
44
51
|
_defineProperty(_assertThisInitialized(_this), "otherParams", {});
|
|
45
52
|
return _this;
|
|
@@ -60,13 +67,14 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
60
67
|
// 获取依赖的插件
|
|
61
68
|
this.request = core.getPlugin("request");
|
|
62
69
|
this.window = core.getPlugin("window");
|
|
70
|
+
this.shopStore = core.getPlugin("shopStore");
|
|
63
71
|
if (this.request) {
|
|
64
|
-
_context.next =
|
|
72
|
+
_context.next = 9;
|
|
65
73
|
break;
|
|
66
74
|
}
|
|
67
75
|
throw new Error("bookingByStep解决方案需要 request 插件支持");
|
|
68
|
-
case
|
|
69
|
-
moduleArr = ["cart", "step", "products", "guests", "date", "accountList", "order", "payment"];
|
|
76
|
+
case 9:
|
|
77
|
+
moduleArr = ["cart", "summary", "step", "products", "guests", "date", "accountList", "order", "payment"];
|
|
70
78
|
moduleArr.forEach(function (step) {
|
|
71
79
|
var targetModule = createModule(step, _this2.name);
|
|
72
80
|
if (targetModule) {
|
|
@@ -77,7 +85,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
77
85
|
}
|
|
78
86
|
});
|
|
79
87
|
this.core.effects.emit(BookingByStepHooks.onInited, {});
|
|
80
|
-
case
|
|
88
|
+
case 12:
|
|
81
89
|
case "end":
|
|
82
90
|
return _context.stop();
|
|
83
91
|
}
|
|
@@ -101,11 +109,33 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
101
109
|
step: this.store.step.getCurrentStep()
|
|
102
110
|
};
|
|
103
111
|
}
|
|
112
|
+
|
|
113
|
+
// step: 下一个
|
|
104
114
|
}, {
|
|
105
115
|
key: "next",
|
|
106
116
|
value: function next() {
|
|
107
117
|
this.store.step.nextStep();
|
|
108
118
|
}
|
|
119
|
+
// step: 上一个
|
|
120
|
+
}, {
|
|
121
|
+
key: "back",
|
|
122
|
+
value: function back() {
|
|
123
|
+
this.store.step.prevStep();
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// 跳转到指定步骤
|
|
127
|
+
}, {
|
|
128
|
+
key: "gotoStep",
|
|
129
|
+
value: function gotoStep(index) {
|
|
130
|
+
this.store.step.gotoStep(index);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// 获取所有step
|
|
134
|
+
}, {
|
|
135
|
+
key: "getStepList",
|
|
136
|
+
value: function getStepList() {
|
|
137
|
+
return this.store.step.getStepList();
|
|
138
|
+
}
|
|
109
139
|
|
|
110
140
|
// 获取购物车里 temp.xxx的方法
|
|
111
141
|
}, {
|
|
@@ -131,26 +161,28 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
131
161
|
key: "loadProducts",
|
|
132
162
|
value: function () {
|
|
133
163
|
var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_ref) {
|
|
134
|
-
var category_ids, product_ids, productsData;
|
|
164
|
+
var _ref$category_ids, category_ids, _ref$product_ids, product_ids, _ref$collection, collection, productsData;
|
|
135
165
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
136
166
|
while (1) switch (_context3.prev = _context3.next) {
|
|
137
167
|
case 0:
|
|
138
|
-
category_ids = _ref.category_ids, product_ids = _ref.product_ids;
|
|
168
|
+
_ref$category_ids = _ref.category_ids, category_ids = _ref$category_ids === void 0 ? [] : _ref$category_ids, _ref$product_ids = _ref.product_ids, product_ids = _ref$product_ids === void 0 ? [] : _ref$product_ids, _ref$collection = _ref.collection, collection = _ref$collection === void 0 ? [] : _ref$collection;
|
|
139
169
|
_context3.next = 3;
|
|
140
170
|
return this.request.post("/product/query", {
|
|
141
171
|
open_quotation: 1,
|
|
142
172
|
open_bundle: 1,
|
|
143
|
-
extension_type: [
|
|
173
|
+
extension_type: ["product_appointment", "appointment_ticket"],
|
|
144
174
|
status: "published",
|
|
145
175
|
num: 500,
|
|
146
176
|
skip: 1,
|
|
147
177
|
category_ids: category_ids,
|
|
148
|
-
ids: product_ids
|
|
178
|
+
ids: product_ids,
|
|
179
|
+
collection: collection
|
|
149
180
|
});
|
|
150
181
|
case 3:
|
|
151
182
|
productsData = _context3.sent;
|
|
152
183
|
this.store.products.addProduct(productsData.data.list);
|
|
153
|
-
|
|
184
|
+
return _context3.abrupt("return", productsData.data.list);
|
|
185
|
+
case 6:
|
|
154
186
|
case "end":
|
|
155
187
|
return _context3.stop();
|
|
156
188
|
}
|
|
@@ -160,50 +192,43 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
160
192
|
return _loadProducts.apply(this, arguments);
|
|
161
193
|
}
|
|
162
194
|
return loadProducts;
|
|
163
|
-
}()
|
|
195
|
+
}()
|
|
164
196
|
}, {
|
|
165
|
-
key: "
|
|
197
|
+
key: "storeProduct",
|
|
166
198
|
value: function () {
|
|
167
|
-
var
|
|
168
|
-
var _ref2,
|
|
169
|
-
_ref2$cover,
|
|
170
|
-
cover,
|
|
171
|
-
currentProducts,
|
|
172
|
-
_args4 = arguments;
|
|
199
|
+
var _storeProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(productData) {
|
|
200
|
+
var activeAccount, _ref2, bundle, options, origin, product_variant_id, product;
|
|
173
201
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
174
202
|
while (1) switch (_context4.prev = _context4.next) {
|
|
175
203
|
case 0:
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
}
|
|
181
|
-
this.store.cart.storeTemp("products", productData);
|
|
182
|
-
_context4.next = 12;
|
|
183
|
-
break;
|
|
184
|
-
case 5:
|
|
185
|
-
_context4.next = 7;
|
|
186
|
-
return this.store.cart.getTemp("products");
|
|
187
|
-
case 7:
|
|
188
|
-
_context4.t0 = _context4.sent;
|
|
189
|
-
if (_context4.t0) {
|
|
190
|
-
_context4.next = 10;
|
|
204
|
+
// 往购物车加商品数据的时候,默认用当前 activeAccount 填充到 product 的 account 里面
|
|
205
|
+
activeAccount = this.getActiveAccount();
|
|
206
|
+
if (activeAccount) {
|
|
207
|
+
_context4.next = 3;
|
|
191
208
|
break;
|
|
192
209
|
}
|
|
193
|
-
|
|
194
|
-
case
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
210
|
+
throw new Error("没有找到当前账户");
|
|
211
|
+
case 3:
|
|
212
|
+
_ref2 = productData || {}, bundle = _ref2.bundle, options = _ref2.options, origin = _ref2.origin, product_variant_id = _ref2.product_variant_id;
|
|
213
|
+
product = _objectSpread(_objectSpread({}, origin), {}, {
|
|
214
|
+
product_variant_id: product_variant_id
|
|
215
|
+
});
|
|
216
|
+
this.store.cart.addItem({
|
|
217
|
+
account: activeAccount,
|
|
218
|
+
product: product,
|
|
219
|
+
bundle: bundle,
|
|
220
|
+
options: options
|
|
221
|
+
});
|
|
222
|
+
case 6:
|
|
198
223
|
case "end":
|
|
199
224
|
return _context4.stop();
|
|
200
225
|
}
|
|
201
226
|
}, _callee4, this);
|
|
202
227
|
}));
|
|
203
|
-
function
|
|
204
|
-
return
|
|
228
|
+
function storeProduct(_x5) {
|
|
229
|
+
return _storeProduct.apply(this, arguments);
|
|
205
230
|
}
|
|
206
|
-
return
|
|
231
|
+
return storeProduct;
|
|
207
232
|
}() // 添加账户或者 guest
|
|
208
233
|
}, {
|
|
209
234
|
key: "addAccount",
|
|
@@ -231,11 +256,15 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
231
256
|
key: "getAccounts",
|
|
232
257
|
value: function () {
|
|
233
258
|
var _getAccounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
259
|
+
var accounts;
|
|
234
260
|
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
235
261
|
while (1) switch (_context6.prev = _context6.next) {
|
|
236
262
|
case 0:
|
|
237
|
-
|
|
238
|
-
|
|
263
|
+
accounts = this.store.accountList.getAccounts();
|
|
264
|
+
return _context6.abrupt("return", accounts.map(function (account) {
|
|
265
|
+
return account.getAccount();
|
|
266
|
+
}));
|
|
267
|
+
case 2:
|
|
239
268
|
case "end":
|
|
240
269
|
return _context6.stop();
|
|
241
270
|
}
|
|
@@ -245,7 +274,35 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
245
274
|
return _getAccounts.apply(this, arguments);
|
|
246
275
|
}
|
|
247
276
|
return getAccounts;
|
|
248
|
-
}()
|
|
277
|
+
}()
|
|
278
|
+
}, {
|
|
279
|
+
key: "checkHasLoginAccount",
|
|
280
|
+
value: function checkHasLoginAccount() {
|
|
281
|
+
var accounts = this.store.accountList.getAccounts();
|
|
282
|
+
return accounts.some(function (account) {
|
|
283
|
+
return account.getLoginStatus();
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
}, {
|
|
287
|
+
key: "setActiveAccount",
|
|
288
|
+
value: function setActiveAccount(id) {
|
|
289
|
+
this.store.accountList.setActiveAccount(id);
|
|
290
|
+
}
|
|
291
|
+
}, {
|
|
292
|
+
key: "getActiveAccount",
|
|
293
|
+
value: function getActiveAccount() {
|
|
294
|
+
var activeAccount = this.store.accountList.getActiveAccount();
|
|
295
|
+
return activeAccount ? activeAccount.getAccount() : null;
|
|
296
|
+
}
|
|
297
|
+
}, {
|
|
298
|
+
key: "removeAccount",
|
|
299
|
+
value: function removeAccount(id) {
|
|
300
|
+
this.store.accountList.removeAccount(id);
|
|
301
|
+
// 还需要把对应账号的商品给她删了
|
|
302
|
+
this.clearCartByAccount(id);
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
// 设置日期范围,注入到日期模块中
|
|
249
306
|
}, {
|
|
250
307
|
key: "setDateRange",
|
|
251
308
|
value: function () {
|
|
@@ -253,10 +310,12 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
253
310
|
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
254
311
|
while (1) switch (_context7.prev = _context7.next) {
|
|
255
312
|
case 0:
|
|
313
|
+
this.store.date.setDateRange(dateRange);
|
|
314
|
+
case 1:
|
|
256
315
|
case "end":
|
|
257
316
|
return _context7.stop();
|
|
258
317
|
}
|
|
259
|
-
}, _callee7);
|
|
318
|
+
}, _callee7, this);
|
|
260
319
|
}));
|
|
261
320
|
function setDateRange(_x7) {
|
|
262
321
|
return _setDateRange.apply(this, arguments);
|
|
@@ -270,7 +329,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
270
329
|
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
271
330
|
while (1) switch (_context8.prev = _context8.next) {
|
|
272
331
|
case 0:
|
|
273
|
-
return _context8.abrupt("return",
|
|
332
|
+
return _context8.abrupt("return", "2024-01-01");
|
|
274
333
|
case 1:
|
|
275
334
|
case "end":
|
|
276
335
|
return _context8.stop();
|
|
@@ -281,109 +340,172 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
281
340
|
return _getRangeDate.apply(this, arguments);
|
|
282
341
|
}
|
|
283
342
|
return getRangeDate;
|
|
284
|
-
}()
|
|
343
|
+
}()
|
|
285
344
|
}, {
|
|
286
|
-
key: "
|
|
345
|
+
key: "getCart",
|
|
287
346
|
value: function () {
|
|
288
|
-
var
|
|
289
|
-
var products;
|
|
347
|
+
var _getCart = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
|
|
290
348
|
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
291
349
|
while (1) switch (_context9.prev = _context9.next) {
|
|
292
350
|
case 0:
|
|
293
|
-
_context9.
|
|
294
|
-
|
|
295
|
-
case 2:
|
|
296
|
-
products = _context9.sent;
|
|
297
|
-
console.log(products);
|
|
298
|
-
case 4:
|
|
351
|
+
return _context9.abrupt("return", this.store.cart.getItems());
|
|
352
|
+
case 1:
|
|
299
353
|
case "end":
|
|
300
354
|
return _context9.stop();
|
|
301
355
|
}
|
|
302
356
|
}, _callee9, this);
|
|
303
357
|
}));
|
|
304
|
-
function
|
|
305
|
-
return
|
|
358
|
+
function getCart() {
|
|
359
|
+
return _getCart.apply(this, arguments);
|
|
306
360
|
}
|
|
307
|
-
return
|
|
308
|
-
}() //
|
|
361
|
+
return getCart;
|
|
362
|
+
}() // 获取商品/服务的可用日期
|
|
309
363
|
}, {
|
|
310
|
-
key: "
|
|
364
|
+
key: "getAvailableDate",
|
|
311
365
|
value: function () {
|
|
312
|
-
var
|
|
366
|
+
var _getAvailableDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
|
|
367
|
+
var _this$otherParams, _this$otherParams2;
|
|
368
|
+
var params,
|
|
369
|
+
products,
|
|
370
|
+
startDate,
|
|
371
|
+
endDate,
|
|
372
|
+
tempProducts,
|
|
373
|
+
tempStartDate,
|
|
374
|
+
tempEndDate,
|
|
375
|
+
_ref3,
|
|
376
|
+
resourceIds,
|
|
377
|
+
rules,
|
|
378
|
+
resourcesMap,
|
|
379
|
+
res,
|
|
380
|
+
_args10 = arguments;
|
|
313
381
|
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
314
382
|
while (1) switch (_context10.prev = _context10.next) {
|
|
315
383
|
case 0:
|
|
384
|
+
params = _args10.length > 0 && _args10[0] !== undefined ? _args10[0] : {};
|
|
385
|
+
// 开始日期如果小于今天,直接以今天当做开始日期
|
|
386
|
+
products = params.products, startDate = params.startDate, endDate = params.endDate;
|
|
387
|
+
tempProducts = products || this.store.cart.getItems().map(function (p) {
|
|
388
|
+
return p._productOrigin;
|
|
389
|
+
});
|
|
390
|
+
tempStartDate = startDate || ((_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 || (_this$otherParams = _this$otherParams.dateRange) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams[0]);
|
|
391
|
+
tempEndDate = endDate || ((_this$otherParams2 = this.otherParams) === null || _this$otherParams2 === void 0 || (_this$otherParams2 = _this$otherParams2.dateRange) === null || _this$otherParams2 === void 0 ? void 0 : _this$otherParams2[1]);
|
|
392
|
+
if (tempProducts.length) {
|
|
393
|
+
_context10.next = 7;
|
|
394
|
+
break;
|
|
395
|
+
}
|
|
396
|
+
return _context10.abrupt("return", []);
|
|
397
|
+
case 7:
|
|
398
|
+
// 在这里需要把能收集到的数据都收集上来,拼装好给 date 模块去查询
|
|
399
|
+
_ref3 = getAvailableProductResources(tempProducts) || {}, resourceIds = _ref3.resourceIds, rules = _ref3.rules, resourcesMap = _ref3.resourcesMap;
|
|
400
|
+
console.log("resourceIds", tempProducts);
|
|
401
|
+
this.otherParams.currentResourcesMap = resourcesMap;
|
|
402
|
+
_context10.next = 12;
|
|
403
|
+
return this.store.date.getMonthDates({
|
|
404
|
+
query: {
|
|
405
|
+
start_date: tempStartDate,
|
|
406
|
+
end_date: tempEndDate,
|
|
407
|
+
resource_ids: resourceIds
|
|
408
|
+
},
|
|
409
|
+
rules: rules
|
|
410
|
+
});
|
|
411
|
+
case 12:
|
|
412
|
+
res = _context10.sent;
|
|
413
|
+
return _context10.abrupt("return", res);
|
|
414
|
+
case 14:
|
|
316
415
|
case "end":
|
|
317
416
|
return _context10.stop();
|
|
318
417
|
}
|
|
319
|
-
}, _callee10);
|
|
418
|
+
}, _callee10, this);
|
|
320
419
|
}));
|
|
321
|
-
function
|
|
322
|
-
return
|
|
420
|
+
function getAvailableDate() {
|
|
421
|
+
return _getAvailableDate.apply(this, arguments);
|
|
323
422
|
}
|
|
324
|
-
return
|
|
325
|
-
}()
|
|
423
|
+
return getAvailableDate;
|
|
424
|
+
}()
|
|
425
|
+
/**
|
|
426
|
+
* 获取购物车汇总信息
|
|
427
|
+
*/
|
|
326
428
|
}, {
|
|
327
|
-
key: "
|
|
328
|
-
value: function () {
|
|
329
|
-
var
|
|
429
|
+
key: "getSummary",
|
|
430
|
+
value: (function () {
|
|
431
|
+
var _getSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
|
|
432
|
+
var cartItems, summary;
|
|
330
433
|
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
331
434
|
while (1) switch (_context11.prev = _context11.next) {
|
|
332
435
|
case 0:
|
|
333
|
-
|
|
334
|
-
|
|
436
|
+
cartItems = this.store.cart.getItems();
|
|
437
|
+
_context11.next = 3;
|
|
438
|
+
return this.store.summary.getSummary(cartItems);
|
|
439
|
+
case 3:
|
|
440
|
+
summary = _context11.sent;
|
|
441
|
+
return _context11.abrupt("return", summary);
|
|
442
|
+
case 5:
|
|
335
443
|
case "end":
|
|
336
444
|
return _context11.stop();
|
|
337
445
|
}
|
|
338
446
|
}, _callee11, this);
|
|
339
447
|
}));
|
|
340
|
-
function
|
|
341
|
-
return
|
|
448
|
+
function getSummary() {
|
|
449
|
+
return _getSummary.apply(this, arguments);
|
|
342
450
|
}
|
|
343
|
-
return
|
|
344
|
-
}() //
|
|
451
|
+
return getSummary;
|
|
452
|
+
}() // 获取可选择的商品、服务列表
|
|
453
|
+
)
|
|
345
454
|
}, {
|
|
346
|
-
key: "
|
|
455
|
+
key: "getProducts",
|
|
347
456
|
value: function () {
|
|
348
|
-
var
|
|
457
|
+
var _getProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
|
|
349
458
|
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
350
459
|
while (1) switch (_context12.prev = _context12.next) {
|
|
351
460
|
case 0:
|
|
352
|
-
this.store.
|
|
461
|
+
return _context12.abrupt("return", this.store.products.getProducts());
|
|
353
462
|
case 1:
|
|
354
463
|
case "end":
|
|
355
464
|
return _context12.stop();
|
|
356
465
|
}
|
|
357
466
|
}, _callee12, this);
|
|
358
467
|
}));
|
|
359
|
-
function
|
|
360
|
-
return
|
|
468
|
+
function getProducts() {
|
|
469
|
+
return _getProducts.apply(this, arguments);
|
|
361
470
|
}
|
|
362
|
-
return
|
|
471
|
+
return getProducts;
|
|
363
472
|
}() // 如果用户登录
|
|
364
473
|
}, {
|
|
365
474
|
key: "setLoginAccount",
|
|
366
475
|
value: function () {
|
|
367
|
-
var _setLoginAccount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(
|
|
368
|
-
var
|
|
476
|
+
var _setLoginAccount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(accountId, accountInfo) {
|
|
477
|
+
var _this4 = this;
|
|
478
|
+
var account, cartItems;
|
|
369
479
|
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
370
480
|
while (1) switch (_context13.prev = _context13.next) {
|
|
371
481
|
case 0:
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
482
|
+
account = this.store.accountList.getAccount(accountId);
|
|
483
|
+
if (!account) {
|
|
484
|
+
_context13.next = 7;
|
|
485
|
+
break;
|
|
486
|
+
}
|
|
487
|
+
account.setAccountInfo(accountInfo);
|
|
488
|
+
// 然后去购物车,把原先关联了 holder_id 为 accountId 的商品,替换为 holder_id = accountInfo.id
|
|
489
|
+
cartItems = this.store.cart.getItems();
|
|
490
|
+
cartItems.forEach(function (item) {
|
|
491
|
+
if (item.holder_id === accountId) {
|
|
492
|
+
_this4.store.cart.updateItem({
|
|
493
|
+
_id: item._id,
|
|
494
|
+
account: accountInfo
|
|
495
|
+
});
|
|
496
|
+
}
|
|
378
497
|
});
|
|
379
|
-
|
|
380
|
-
|
|
498
|
+
_context13.next = 8;
|
|
499
|
+
break;
|
|
500
|
+
case 7:
|
|
501
|
+
throw new Error("\u6CA1\u6709\u627E\u5230".concat(accountId, "\u8D26\u6237"));
|
|
502
|
+
case 8:
|
|
381
503
|
case "end":
|
|
382
504
|
return _context13.stop();
|
|
383
505
|
}
|
|
384
506
|
}, _callee13, this);
|
|
385
507
|
}));
|
|
386
|
-
function setLoginAccount(_x9) {
|
|
508
|
+
function setLoginAccount(_x8, _x9) {
|
|
387
509
|
return _setLoginAccount.apply(this, arguments);
|
|
388
510
|
}
|
|
389
511
|
return setLoginAccount;
|
|
@@ -409,13 +531,30 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
409
531
|
key: "submitOrder",
|
|
410
532
|
value: function () {
|
|
411
533
|
var _submitOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
|
|
534
|
+
var cartItems;
|
|
412
535
|
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
413
536
|
while (1) switch (_context15.prev = _context15.next) {
|
|
414
537
|
case 0:
|
|
538
|
+
cartItems = this.store.cart.getItems(); // 先整个临时的逻辑,把购物车里所有商品的资源给他格式化一下
|
|
539
|
+
cartItems.forEach(function (item) {
|
|
540
|
+
item._origin.resources = item._origin.resources.map(function (n) {
|
|
541
|
+
var newResourcesItem = cloneDeep(n);
|
|
542
|
+
delete newResourcesItem.id;
|
|
543
|
+
delete newResourcesItem.main_field;
|
|
544
|
+
delete newResourcesItem.resourceType;
|
|
545
|
+
return _objectSpread({}, newResourcesItem);
|
|
546
|
+
});
|
|
547
|
+
});
|
|
548
|
+
return _context15.abrupt("return", this.store.order.commitOrder({
|
|
549
|
+
query: {
|
|
550
|
+
cartItems: cartItems
|
|
551
|
+
}
|
|
552
|
+
}));
|
|
553
|
+
case 3:
|
|
415
554
|
case "end":
|
|
416
555
|
return _context15.stop();
|
|
417
556
|
}
|
|
418
|
-
}, _callee15);
|
|
557
|
+
}, _callee15, this);
|
|
419
558
|
}));
|
|
420
559
|
function submitOrder() {
|
|
421
560
|
return _submitOrder.apply(this, arguments);
|
|
@@ -460,14 +599,14 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
460
599
|
key: "setOtherParams",
|
|
461
600
|
value: function () {
|
|
462
601
|
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(params) {
|
|
463
|
-
var
|
|
464
|
-
|
|
602
|
+
var _ref4,
|
|
603
|
+
_ref4$cover,
|
|
465
604
|
cover,
|
|
466
605
|
_args18 = arguments;
|
|
467
606
|
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
468
607
|
while (1) switch (_context18.prev = _context18.next) {
|
|
469
608
|
case 0:
|
|
470
|
-
|
|
609
|
+
_ref4 = _args18.length > 1 && _args18[1] !== undefined ? _args18[1] : {}, _ref4$cover = _ref4.cover, cover = _ref4$cover === void 0 ? false : _ref4$cover;
|
|
471
610
|
if (cover) {
|
|
472
611
|
this.otherParams = params;
|
|
473
612
|
} else {
|
|
@@ -502,7 +641,404 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
502
641
|
return _getOtherParams.apply(this, arguments);
|
|
503
642
|
}
|
|
504
643
|
return getOtherParams;
|
|
505
|
-
}()
|
|
644
|
+
}() // 更新购物车
|
|
645
|
+
}, {
|
|
646
|
+
key: "updateCart",
|
|
647
|
+
value: function updateCart(params) {
|
|
648
|
+
this.store.cart.updateItem(params);
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
// 删除购物车里某个商品
|
|
652
|
+
}, {
|
|
653
|
+
key: "deleteCart",
|
|
654
|
+
value: function deleteCart(product_id) {}
|
|
655
|
+
|
|
656
|
+
// 清空购物车
|
|
657
|
+
}, {
|
|
658
|
+
key: "clearCart",
|
|
659
|
+
value: function clearCart() {
|
|
660
|
+
this.store.cart.clear();
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
// 基于账户清空购物车
|
|
664
|
+
}, {
|
|
665
|
+
key: "clearCartByAccount",
|
|
666
|
+
value: function clearCartByAccount(account_id) {
|
|
667
|
+
this.store.cart.clearCartByAccount(account_id);
|
|
668
|
+
}
|
|
669
|
+
}, {
|
|
670
|
+
key: "destory",
|
|
671
|
+
value: function destory() {
|
|
672
|
+
var _this$store$cart, _this$store$step, _this$store$products, _this$store$guests, _this$store$date, _this$store$accountLi;
|
|
673
|
+
(_this$store$cart = this.store.cart) === null || _this$store$cart === void 0 || _this$store$cart.destory();
|
|
674
|
+
(_this$store$step = this.store.step) === null || _this$store$step === void 0 || _this$store$step.destory();
|
|
675
|
+
(_this$store$products = this.store.products) === null || _this$store$products === void 0 || _this$store$products.destory();
|
|
676
|
+
(_this$store$guests = this.store.guests) === null || _this$store$guests === void 0 || _this$store$guests.destory();
|
|
677
|
+
(_this$store$date = this.store.date) === null || _this$store$date === void 0 || _this$store$date.destory();
|
|
678
|
+
(_this$store$accountLi = this.store.accountList) === null || _this$store$accountLi === void 0 || _this$store$accountLi.destory();
|
|
679
|
+
this.core.effects.offByModuleDestroy(this.name);
|
|
680
|
+
this.core.unregisterModule(this);
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
// 获取当前购物车内所有关联的资源列表,拼装数据格式
|
|
684
|
+
}, {
|
|
685
|
+
key: "getResourcesList",
|
|
686
|
+
value: function getResourcesList() {
|
|
687
|
+
var dateRange = this.store.date.getDateRange();
|
|
688
|
+
var resources = [];
|
|
689
|
+
dateRange.forEach(function (n) {
|
|
690
|
+
if (n.resource) resources.push.apply(resources, _toConsumableArray(n.resource));
|
|
691
|
+
});
|
|
692
|
+
var resourcesMap = getResourcesMap(resources);
|
|
693
|
+
var cartItems = this.store.cart.getItems();
|
|
694
|
+
var arr = [];
|
|
695
|
+
cartItems.forEach(function (cartItem) {
|
|
696
|
+
var productResources = getResourcesByProduct(resourcesMap, cartItem, cartItems);
|
|
697
|
+
arr.push({
|
|
698
|
+
id: cartItem.id,
|
|
699
|
+
// 这里返回的是购物车 id ,后面提交的时候要用的,用这个 id 绑定资源和时间
|
|
700
|
+
_id: cartItem._id,
|
|
701
|
+
// 这里返回的是购物车 id ,后面提交的时候要用的,用这个 id 绑定资源和时间
|
|
702
|
+
product: cartItem._productOrigin,
|
|
703
|
+
resources: productResources,
|
|
704
|
+
holder_id: cartItem.holder_id,
|
|
705
|
+
holder_name: cartItem.holder_title
|
|
706
|
+
});
|
|
707
|
+
});
|
|
708
|
+
return arr;
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
// 通过资源列表和指定的资源 id,获取指定资源的时间切片
|
|
712
|
+
}, {
|
|
713
|
+
key: "getResourceTimeSlot",
|
|
714
|
+
value: function getResourceTimeSlot(_ref5) {
|
|
715
|
+
var product = _ref5.product,
|
|
716
|
+
resources = _ref5.resources,
|
|
717
|
+
currentResourceId = _ref5.currentResourceId;
|
|
718
|
+
var dateRange = this.store.date.getDateRange();
|
|
719
|
+
var timeSlots = getTimeSlicesByResource({
|
|
720
|
+
resource: resources.find(function (n) {
|
|
721
|
+
return n.id === currentResourceId;
|
|
722
|
+
}),
|
|
723
|
+
duration: product.duration.value,
|
|
724
|
+
split: 10,
|
|
725
|
+
currentDate: dateRange[0].date
|
|
726
|
+
});
|
|
727
|
+
return timeSlots;
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
// 自动分派可用的资源-单种资源类型
|
|
731
|
+
}, {
|
|
732
|
+
key: "autoSelectResource",
|
|
733
|
+
value: function autoSelectResource(_ref6) {
|
|
734
|
+
var resourceProductData = _ref6.resourceProductData,
|
|
735
|
+
resources = _ref6.resources,
|
|
736
|
+
timeSlots = _ref6.timeSlots;
|
|
737
|
+
var dateRange = this.store.date.getDateRange();
|
|
738
|
+
if (timeSlots) {
|
|
739
|
+
// 如果 start_time 存在,则直接根据 start_time 算出商品总共需要的时长,然后根据时长去匹配资源
|
|
740
|
+
var duration = resourceProductData.product.duration.value;
|
|
741
|
+
var start_time = timeSlots.start_at.format("YYYY-MM-DD HH:mm");
|
|
742
|
+
var end_time = dayjs("".concat(dateRange[0].date, " ").concat(start_time)).add(duration, resourceProductData.product.duration.type).format("HH:mm");
|
|
743
|
+
// 根据 start_time 和 end_time 去匹配资源
|
|
744
|
+
var targetResource = null;
|
|
745
|
+
var _iterator = _createForOfIteratorHelper(resources),
|
|
746
|
+
_step;
|
|
747
|
+
try {
|
|
748
|
+
var _loop = function _loop() {
|
|
749
|
+
var n = _step.value;
|
|
750
|
+
var canUseTime = n.times.find(function (item) {
|
|
751
|
+
return getIsUsableByTimeItem({
|
|
752
|
+
timeSlice: item,
|
|
753
|
+
time: {
|
|
754
|
+
start_time: start_time,
|
|
755
|
+
end_time: end_time
|
|
756
|
+
},
|
|
757
|
+
resource: n,
|
|
758
|
+
currentCount: 1
|
|
759
|
+
});
|
|
760
|
+
});
|
|
761
|
+
if (canUseTime) {
|
|
762
|
+
targetResource = n;
|
|
763
|
+
return 1; // break
|
|
764
|
+
}
|
|
765
|
+
};
|
|
766
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
767
|
+
if (_loop()) break;
|
|
768
|
+
}
|
|
769
|
+
} catch (err) {
|
|
770
|
+
_iterator.e(err);
|
|
771
|
+
} finally {
|
|
772
|
+
_iterator.f();
|
|
773
|
+
}
|
|
774
|
+
return {
|
|
775
|
+
selectedResource: targetResource
|
|
776
|
+
};
|
|
777
|
+
} else {
|
|
778
|
+
// 如果没有传递 timeSlots,证明是第一个资源,则直接拿商品的 duration,到资源列表里找一个公共可用的
|
|
779
|
+
var _duration = resourceProductData.product.duration.value;
|
|
780
|
+
var resourcesMap = getResourcesMap(resources);
|
|
781
|
+
var resourceIds = resources.map(function (n) {
|
|
782
|
+
return n.id;
|
|
783
|
+
});
|
|
784
|
+
var _timeSlots = getTimeSlicesByResources({
|
|
785
|
+
resourceIds: resourceIds,
|
|
786
|
+
resourcesMap: resourcesMap,
|
|
787
|
+
duration: _duration,
|
|
788
|
+
currentDate: dateRange[0].date,
|
|
789
|
+
split: 10
|
|
790
|
+
});
|
|
791
|
+
// 如果timeSlots返回了 空数组,代表没有可用的资源了
|
|
792
|
+
if (!_timeSlots) {
|
|
793
|
+
return; // 给一个提示?
|
|
794
|
+
}
|
|
795
|
+
return {
|
|
796
|
+
timeSlots: _timeSlots,
|
|
797
|
+
selectedResource: resources[0]
|
|
798
|
+
};
|
|
799
|
+
}
|
|
800
|
+
}
|
|
801
|
+
|
|
802
|
+
// 自动分派可用资源-pro 版,ui 传递某个账号,自动给某个账号下所有商品分配第一种资源
|
|
803
|
+
}, {
|
|
804
|
+
key: "autoSelectAccountResources",
|
|
805
|
+
value: function autoSelectAccountResources(_ref7) {
|
|
806
|
+
var _accountCartItems$;
|
|
807
|
+
var holder_id = _ref7.holder_id,
|
|
808
|
+
resources_code = _ref7.resources_code,
|
|
809
|
+
timeSlots = _ref7.timeSlots;
|
|
810
|
+
var dateRange = this.store.date.getDateRange();
|
|
811
|
+
var cartItems = this.store.cart.getItems();
|
|
812
|
+
// 取到账号下所有的商品,然后根据商品的 duration 和资源列表,获取所有可用的资源
|
|
813
|
+
var accountCartItems = cartItems.filter(function (n) {
|
|
814
|
+
return n.holder_id === holder_id;
|
|
815
|
+
});
|
|
816
|
+
// duration=所有商品时间的集合
|
|
817
|
+
var duration = accountCartItems.reduce(function (acc, n) {
|
|
818
|
+
return acc + n._productOrigin.duration.value;
|
|
819
|
+
}, 0);
|
|
820
|
+
// 正常来说,能进这个业务的所有商品的 duration 类型都是一样的,所以这里取第一个商品的 duration 类型
|
|
821
|
+
var durationType = (accountCartItems === null || accountCartItems === void 0 || (_accountCartItems$ = accountCartItems[0]) === null || _accountCartItems$ === void 0 ? void 0 : _accountCartItems$._productOrigin.duration.type) || "minutes";
|
|
822
|
+
// 取出账号下所对应类型的所有的可用资源
|
|
823
|
+
var resources = [];
|
|
824
|
+
accountCartItems.forEach(function (item) {
|
|
825
|
+
var _item$_productOrigin$;
|
|
826
|
+
(_item$_productOrigin$ = item._productOrigin.product_resource) === null || _item$_productOrigin$ === void 0 || (_item$_productOrigin$ = _item$_productOrigin$.resources) === null || _item$_productOrigin$ === void 0 || _item$_productOrigin$.forEach(function (n) {
|
|
827
|
+
if (n.code === resources_code) {
|
|
828
|
+
resources.push.apply(resources, _toConsumableArray(n.renderList || []));
|
|
829
|
+
}
|
|
830
|
+
});
|
|
831
|
+
});
|
|
832
|
+
|
|
833
|
+
// 如果有选择时间了,则代表不是第一种资源了,则需要根据开始时间去匹配
|
|
834
|
+
if (timeSlots) {
|
|
835
|
+
var start_time = timeSlots.start_at.format("YYYY-MM-DD HH:mm");
|
|
836
|
+
var end_time = dayjs("".concat(dateRange[0].date, " ").concat(start_time)).add(duration, durationType).format("HH:mm");
|
|
837
|
+
// 根据 start_time 和 end_time 去匹配资源
|
|
838
|
+
var targetResource = null;
|
|
839
|
+
var _iterator2 = _createForOfIteratorHelper(resources),
|
|
840
|
+
_step2;
|
|
841
|
+
try {
|
|
842
|
+
var _loop2 = function _loop2() {
|
|
843
|
+
var n = _step2.value;
|
|
844
|
+
var canUseTime = n.times.find(function (item) {
|
|
845
|
+
return getIsUsableByTimeItem({
|
|
846
|
+
timeSlice: item,
|
|
847
|
+
time: {
|
|
848
|
+
start_time: start_time,
|
|
849
|
+
end_time: end_time
|
|
850
|
+
},
|
|
851
|
+
resource: n,
|
|
852
|
+
currentCount: 1
|
|
853
|
+
});
|
|
854
|
+
});
|
|
855
|
+
if (canUseTime) {
|
|
856
|
+
targetResource = n;
|
|
857
|
+
return 1; // break
|
|
858
|
+
}
|
|
859
|
+
};
|
|
860
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
861
|
+
if (_loop2()) break;
|
|
862
|
+
}
|
|
863
|
+
} catch (err) {
|
|
864
|
+
_iterator2.e(err);
|
|
865
|
+
} finally {
|
|
866
|
+
_iterator2.f();
|
|
867
|
+
}
|
|
868
|
+
return {
|
|
869
|
+
selectedResource: targetResource
|
|
870
|
+
};
|
|
871
|
+
} else {
|
|
872
|
+
var resourcesMap = getResourcesMap(resources);
|
|
873
|
+
var resourceIds = resources.map(function (n) {
|
|
874
|
+
return n.id;
|
|
875
|
+
});
|
|
876
|
+
var _timeSlots2 = getTimeSlicesByResources({
|
|
877
|
+
resourceIds: resourceIds,
|
|
878
|
+
resourcesMap: resourcesMap,
|
|
879
|
+
duration: duration,
|
|
880
|
+
currentDate: dateRange[0].date,
|
|
881
|
+
split: 10
|
|
882
|
+
});
|
|
883
|
+
// 如果timeSlots返回了 空数组,代表没有可用的资源了
|
|
884
|
+
if (!_timeSlots2) {
|
|
885
|
+
return; // 给一个提示?
|
|
886
|
+
}
|
|
887
|
+
return {
|
|
888
|
+
timeSlots: _timeSlots2,
|
|
889
|
+
selectedResource: resources[0]
|
|
890
|
+
};
|
|
891
|
+
}
|
|
892
|
+
}
|
|
893
|
+
|
|
894
|
+
// 给所有购物车里的商品先分配一个资源
|
|
895
|
+
}, {
|
|
896
|
+
key: "autoSelectAllProductResources",
|
|
897
|
+
value: function autoSelectAllProductResources(resources_code, timeSlots) {
|
|
898
|
+
var _this5 = this;
|
|
899
|
+
var dateRange = this.store.date.getDateRange();
|
|
900
|
+
var resources = [];
|
|
901
|
+
dateRange.forEach(function (n) {
|
|
902
|
+
if (n.resource) resources.push.apply(resources, _toConsumableArray(n.resource));
|
|
903
|
+
});
|
|
904
|
+
var resourcesMap = getResourcesMap(resources);
|
|
905
|
+
// 一个账号一个账号处理
|
|
906
|
+
var errorList = [];
|
|
907
|
+
this.store.accountList.getAccounts().forEach(function (account) {
|
|
908
|
+
var cartItems = _this5.store.cart.getCartByAccount(account.getId());
|
|
909
|
+
// 这里必须每次循环重新读,避免前一次循环操作了购物车,导致数据变更
|
|
910
|
+
var allCartItems = _this5.store.cart.getItems();
|
|
911
|
+
cartItems.forEach(function (item) {
|
|
912
|
+
if (timeSlots) {
|
|
913
|
+
// 如果传递了 timeSlots,代表是第二种资源,则直接拿 timeSlots 去匹配
|
|
914
|
+
var res = _this5.autoSelectAccountResources({
|
|
915
|
+
holder_id: item.holder_id,
|
|
916
|
+
resources_code: resources_code,
|
|
917
|
+
timeSlots: timeSlots
|
|
918
|
+
});
|
|
919
|
+
if (res !== null && res !== void 0 && res.selectedResource) {
|
|
920
|
+
console.log(_this5.store.cart.getItems());
|
|
921
|
+
_this5.store.cart.updateItem({
|
|
922
|
+
_id: item._id,
|
|
923
|
+
resources: [].concat(_toConsumableArray(item._origin.resources || []), [res.selectedResource])
|
|
924
|
+
});
|
|
925
|
+
console.log(_this5.store.cart.getItems());
|
|
926
|
+
} else {
|
|
927
|
+
// 如果没有可用的技师了,推到错误列表里让 UI 去提示
|
|
928
|
+
errorList.push(item._id);
|
|
929
|
+
}
|
|
930
|
+
} else {
|
|
931
|
+
var _productResources$fin;
|
|
932
|
+
// 如果没有传递 timeSlots,代表是第一种资源,则直接拿商品的 duration,到资源列表里找一个公共可用的
|
|
933
|
+
var productResources = getResourcesByProduct(resourcesMap, item, allCartItems);
|
|
934
|
+
// 自动选择 productResources 中对应 resources_code 的资源
|
|
935
|
+
var targetRenderList = (_productResources$fin = productResources.find(function (n) {
|
|
936
|
+
return n.code === resources_code;
|
|
937
|
+
})) === null || _productResources$fin === void 0 ? void 0 : _productResources$fin.renderList;
|
|
938
|
+
if (targetRenderList && targetRenderList.length > 0) {
|
|
939
|
+
_this5.store.cart.updateItem({
|
|
940
|
+
_id: item._id,
|
|
941
|
+
resources: [].concat(_toConsumableArray(item._origin.resources || []), [targetRenderList[0]])
|
|
942
|
+
});
|
|
943
|
+
} else {
|
|
944
|
+
// 如果没有可用的技师了,推到错误列表里让 UI 去提示
|
|
945
|
+
errorList.push(item._id);
|
|
946
|
+
}
|
|
947
|
+
}
|
|
948
|
+
});
|
|
949
|
+
});
|
|
950
|
+
return {
|
|
951
|
+
errorList: errorList
|
|
952
|
+
};
|
|
953
|
+
}
|
|
954
|
+
// 从购物车中获取已经分配好第一步资源的所有时间片
|
|
955
|
+
}, {
|
|
956
|
+
key: "getTimeSlotByAllResources",
|
|
957
|
+
value: function getTimeSlotByAllResources(resources_code) {
|
|
958
|
+
var _this6 = this;
|
|
959
|
+
var dateRange = this.store.date.getDateRange();
|
|
960
|
+
// 取出购物车中所有一已选择的第一步资源
|
|
961
|
+
var resources = [];
|
|
962
|
+
var cartItems = this.store.cart.getItems();
|
|
963
|
+
var resourceIds = [];
|
|
964
|
+
cartItems.forEach(function (item) {
|
|
965
|
+
var _item$_productOrigin$2, _item$_origin$resourc;
|
|
966
|
+
(_item$_productOrigin$2 = item._productOrigin.product_resource) === null || _item$_productOrigin$2 === void 0 || (_item$_productOrigin$2 = _item$_productOrigin$2.resources) === null || _item$_productOrigin$2 === void 0 || _item$_productOrigin$2.forEach(function (n) {
|
|
967
|
+
if (n.code === resources_code) {
|
|
968
|
+
resources.push.apply(resources, _toConsumableArray(n.renderList || []));
|
|
969
|
+
}
|
|
970
|
+
});
|
|
971
|
+
(_item$_origin$resourc = item._origin.resources) === null || _item$_origin$resourc === void 0 || _item$_origin$resourc.forEach(function (n) {
|
|
972
|
+
resourceIds.push(n.relation_id);
|
|
973
|
+
});
|
|
974
|
+
});
|
|
975
|
+
var resourcesMap = getResourcesMap(resources);
|
|
976
|
+
var duration = 0;
|
|
977
|
+
// duration = 不同账号的最长时间
|
|
978
|
+
this.store.accountList.getAccounts().forEach(function (account) {
|
|
979
|
+
var accountDuration = 0;
|
|
980
|
+
var cartItems = _this6.store.cart.getCartByAccount(account.getId());
|
|
981
|
+
cartItems.forEach(function (item) {
|
|
982
|
+
accountDuration += item._productOrigin.duration.value;
|
|
983
|
+
});
|
|
984
|
+
if (accountDuration > duration) {
|
|
985
|
+
duration = accountDuration;
|
|
986
|
+
}
|
|
987
|
+
});
|
|
988
|
+
var timeSlots = getTimeSlicesByResources({
|
|
989
|
+
resourceIds: resourceIds,
|
|
990
|
+
resourcesMap: resourcesMap,
|
|
991
|
+
duration: duration,
|
|
992
|
+
currentDate: dateRange[0].date,
|
|
993
|
+
split: 10
|
|
994
|
+
});
|
|
995
|
+
return timeSlots;
|
|
996
|
+
}
|
|
997
|
+
|
|
998
|
+
// 提交时间切片,绑定到对应购物车的商品上,更新购物车
|
|
999
|
+
// submitTimeSlot({
|
|
1000
|
+
// resourceProductData,
|
|
1001
|
+
// selectedResources,
|
|
1002
|
+
// timeSlots,
|
|
1003
|
+
// }: {
|
|
1004
|
+
// resourceProductData: any;
|
|
1005
|
+
// selectedResources: any[];
|
|
1006
|
+
// timeSlots: TimeSliceItem;
|
|
1007
|
+
// }) {
|
|
1008
|
+
// const newResources = cloneDeep(selectedResources);
|
|
1009
|
+
// newResources.forEach((n) => {
|
|
1010
|
+
// n.startTime = timeSlots.start_at.format("YYYY-MM-DD HH:mm");
|
|
1011
|
+
// n.endTime = dayjs(n.startTime)
|
|
1012
|
+
// .add(
|
|
1013
|
+
// resourceProductData.product.duration.value,
|
|
1014
|
+
// resourceProductData.product.duration.type
|
|
1015
|
+
// )
|
|
1016
|
+
// .format("YYYY-MM-DD HH:mm");
|
|
1017
|
+
// delete n.times;
|
|
1018
|
+
// });
|
|
1019
|
+
// this.store.cart.updateItem({
|
|
1020
|
+
// _id: resourceProductData._id,
|
|
1021
|
+
// resources: newResources,
|
|
1022
|
+
// });
|
|
1023
|
+
// }
|
|
1024
|
+
}, {
|
|
1025
|
+
key: "submitTimeSlot",
|
|
1026
|
+
value: function submitTimeSlot(timeSlots) {
|
|
1027
|
+
var _this7 = this;
|
|
1028
|
+
var cartItems = this.store.cart.getItems();
|
|
1029
|
+
cartItems.forEach(function (item) {
|
|
1030
|
+
var newResources = cloneDeep(item._origin.resources);
|
|
1031
|
+
newResources.forEach(function (n) {
|
|
1032
|
+
n.startTime = timeSlots.start_at.format("YYYY-MM-DD HH:mm");
|
|
1033
|
+
n.endTime = dayjs(n.startTime).add(item._productOrigin.duration.value, item._productOrigin.duration.type).format("YYYY-MM-DD HH:mm");
|
|
1034
|
+
delete n.times;
|
|
1035
|
+
});
|
|
1036
|
+
_this7.store.cart.updateItem({
|
|
1037
|
+
_id: item._id,
|
|
1038
|
+
resources: newResources
|
|
1039
|
+
});
|
|
1040
|
+
});
|
|
1041
|
+
}
|
|
506
1042
|
}]);
|
|
507
1043
|
return BookingByStepImpl;
|
|
508
1044
|
}(BaseModule);
|