@pisell/pisellos 3.0.34 → 3.0.36
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/Cart/index.js +20 -34
- package/dist/modules/Cart/utils/cartAccount.d.ts +21 -0
- package/dist/modules/Cart/utils/cartAccount.js +52 -0
- package/dist/modules/Cart/utils/cartDate.d.ts +31 -0
- package/dist/modules/Cart/utils/cartDate.js +55 -0
- package/dist/modules/Cart/utils/cartDiscount.d.ts +19 -0
- package/dist/modules/Cart/utils/cartDiscount.js +35 -0
- package/dist/modules/Cart/utils/cartNote.d.ts +19 -0
- package/dist/modules/Cart/utils/cartNote.js +29 -0
- package/dist/modules/Cart/utils/cartProduct.d.ts +107 -0
- package/dist/modules/Cart/{utils.js → utils/cartProduct.js} +77 -416
- package/dist/modules/Cart/utils/cartRelationForms.d.ts +26 -0
- package/dist/modules/Cart/utils/cartRelationForms.js +29 -0
- package/dist/modules/Cart/utils/cartResource.d.ts +21 -0
- package/dist/modules/Cart/utils/cartResource.js +102 -0
- package/dist/modules/Cart/utils/index.d.ts +34 -0
- package/dist/modules/Cart/utils/index.js +63 -0
- package/dist/modules/Order/index.js +10 -4
- package/dist/modules/Product/types.d.ts +4 -0
- package/dist/modules/Product/utils.d.ts +17 -0
- package/dist/modules/Product/utils.js +41 -0
- package/dist/modules/Schedule/index.d.ts +2 -0
- package/dist/modules/Schedule/index.js +10 -0
- package/dist/modules/Schedule/types.d.ts +1 -0
- package/dist/solution/BookingByStep/index.d.ts +10 -4
- package/dist/solution/BookingByStep/index.js +267 -122
- package/lib/modules/Cart/index.js +16 -24
- package/lib/modules/Cart/utils/cartAccount.d.ts +21 -0
- package/lib/modules/Cart/utils/cartAccount.js +65 -0
- package/lib/modules/Cart/utils/cartDate.d.ts +31 -0
- package/lib/modules/Cart/utils/cartDate.js +75 -0
- package/lib/modules/Cart/utils/cartDiscount.d.ts +19 -0
- package/lib/modules/Cart/utils/cartDiscount.js +52 -0
- package/lib/modules/Cart/utils/cartNote.d.ts +19 -0
- package/lib/modules/Cart/utils/cartNote.js +46 -0
- package/lib/modules/Cart/utils/cartProduct.d.ts +107 -0
- package/lib/modules/Cart/{utils.js → utils/cartProduct.js} +78 -328
- package/lib/modules/Cart/utils/cartRelationForms.d.ts +26 -0
- package/lib/modules/Cart/utils/cartRelationForms.js +48 -0
- package/lib/modules/Cart/utils/cartResource.d.ts +21 -0
- package/lib/modules/Cart/utils/cartResource.js +124 -0
- package/lib/modules/Cart/utils/index.d.ts +34 -0
- package/lib/modules/Cart/utils/index.js +91 -0
- package/lib/modules/Order/index.js +7 -3
- package/lib/modules/Product/types.d.ts +4 -0
- package/lib/modules/Product/utils.d.ts +17 -0
- package/lib/modules/Product/utils.js +46 -0
- package/lib/modules/Schedule/index.d.ts +2 -0
- package/lib/modules/Schedule/index.js +6 -0
- package/lib/modules/Schedule/types.d.ts +1 -0
- package/lib/solution/BookingByStep/index.d.ts +10 -4
- package/lib/solution/BookingByStep/index.js +156 -75
- package/package.json +1 -1
- package/dist/modules/Cart/utils.d.ts +0 -257
- package/lib/modules/Cart/utils.d.ts +0 -257
|
@@ -1,10 +1,10 @@
|
|
|
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 _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; } } }; }
|
|
2
3
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
3
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."); }
|
|
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); }
|
|
4
6
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
5
7
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
6
|
-
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; } } }; }
|
|
7
|
-
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); }
|
|
8
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
9
|
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; }
|
|
10
10
|
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; }
|
|
@@ -37,6 +37,7 @@ import { getResourcesMap } from "../../modules/Resource/utils";
|
|
|
37
37
|
import { cloneDeep } from 'lodash-es';
|
|
38
38
|
import { calcCalendarDataByScheduleResult, calcMinTimeMaxTimeBySchedules, getAllSortedDateRanges } from "../../modules/Schedule/utils";
|
|
39
39
|
import { disableAllDates, disableDatesBeforeOneDay, generateMonthDates, handleAvailableDateByResource } from "../../modules/Date/utils";
|
|
40
|
+
import { areAllNormalProducts, isNormalProduct } from "../../modules/Product/utils";
|
|
40
41
|
import { calculateResourceAvailableTime, findFastestAvailableResource } from "./utils/timeslots";
|
|
41
42
|
export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
42
43
|
_inherits(BookingByStepImpl, _BaseModule);
|
|
@@ -208,24 +209,23 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
208
209
|
key: "loadProducts",
|
|
209
210
|
value: function () {
|
|
210
211
|
var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref) {
|
|
211
|
-
var
|
|
212
|
-
var _ref$category_ids, category_ids, _ref$product_ids, product_ids, _ref$collection, collection, _ref$schedule_ids, schedule_ids, schedule_date, schedule_ids_data, userPlugin, customer_id, _userPlugin$get, productsData;
|
|
212
|
+
var _ref$category_ids, category_ids, _ref$product_ids, product_ids, _ref$collection, collection, userPlugin, customer_id, _userPlugin$get, productsData;
|
|
213
213
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
214
214
|
while (1) switch (_context2.prev = _context2.next) {
|
|
215
215
|
case 0:
|
|
216
|
-
_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
|
|
217
|
-
// 如果 schedule_ids 为空,则需要尝试从 schedule 模块里获取
|
|
218
|
-
if (!
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
}
|
|
216
|
+
_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;
|
|
217
|
+
// // 如果 schedule_ids 为空,则需要尝试从 schedule 模块里获取
|
|
218
|
+
// if (!schedule_ids?.length) {
|
|
219
|
+
// const schedule_ids_data = this.store.schedule
|
|
220
|
+
// .getScheduleListByIds(schedule_ids)
|
|
221
|
+
// .map((n) => n.id);
|
|
222
|
+
// if (schedule_ids_data.length) {
|
|
223
|
+
// schedule_ids = schedule_ids_data;
|
|
224
|
+
// } else if (schedule_date) {
|
|
225
|
+
// // 后端说如果 schedule_ids 如果为空,需要给[0]
|
|
226
|
+
// schedule_ids = [0];
|
|
227
|
+
// }
|
|
228
|
+
// }
|
|
229
229
|
userPlugin = this.core.getPlugin('user');
|
|
230
230
|
customer_id = undefined;
|
|
231
231
|
try {
|
|
@@ -234,11 +234,11 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
234
234
|
console.error(error);
|
|
235
235
|
}
|
|
236
236
|
// 如果没传schedule_date,则从
|
|
237
|
-
_context2.next =
|
|
237
|
+
_context2.next = 6;
|
|
238
238
|
return this.request.post("/product/query", {
|
|
239
239
|
open_quotation: 1,
|
|
240
240
|
open_bundle: 0,
|
|
241
|
-
|
|
241
|
+
exclude_extension_type: ['product_party', 'product_event', 'product_series_event', 'product_package_ticket', 'ticket', 'event_item'],
|
|
242
242
|
with: ['category', 'collection', 'resourceRelation'],
|
|
243
243
|
status: 'published',
|
|
244
244
|
num: 500,
|
|
@@ -247,17 +247,17 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
247
247
|
category_ids: category_ids,
|
|
248
248
|
ids: product_ids,
|
|
249
249
|
collection: collection,
|
|
250
|
-
front_end_cache_id: this.cacheId
|
|
251
|
-
client_schedule_ids: schedule_ids,
|
|
252
|
-
|
|
250
|
+
front_end_cache_id: this.cacheId
|
|
251
|
+
// client_schedule_ids: schedule_ids,
|
|
252
|
+
// schedule_date,
|
|
253
253
|
}, {
|
|
254
254
|
useCache: true
|
|
255
255
|
});
|
|
256
|
-
case
|
|
256
|
+
case 6:
|
|
257
257
|
productsData = _context2.sent;
|
|
258
258
|
this.store.products.addProduct(productsData.data.list);
|
|
259
259
|
return _context2.abrupt("return", productsData.data.list);
|
|
260
|
-
case
|
|
260
|
+
case 9:
|
|
261
261
|
case "end":
|
|
262
262
|
return _context2.stop();
|
|
263
263
|
}
|
|
@@ -273,11 +273,11 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
273
273
|
value: function () {
|
|
274
274
|
var _loadProductByScheduleDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_ref2) {
|
|
275
275
|
var _product_ids;
|
|
276
|
-
var date, product_ids, _ref2$category_ids, category_ids, scheduleList,
|
|
276
|
+
var date, _ref2$product_ids, product_ids, _ref2$category_ids, category_ids, scheduleList, _schedule$product_ids, schedule, otherProductsIds, allProductIds;
|
|
277
277
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
278
278
|
while (1) switch (_context3.prev = _context3.next) {
|
|
279
279
|
case 0:
|
|
280
|
-
date = _ref2.date, product_ids = _ref2.product_ids, _ref2$category_ids = _ref2.category_ids, category_ids = _ref2$category_ids === void 0 ? [] : _ref2$category_ids;
|
|
280
|
+
date = _ref2.date, _ref2$product_ids = _ref2.product_ids, product_ids = _ref2$product_ids === void 0 ? [] : _ref2$product_ids, _ref2$category_ids = _ref2.category_ids, category_ids = _ref2$category_ids === void 0 ? [] : _ref2$category_ids;
|
|
281
281
|
scheduleList = this.store.schedule.getAvailabilityScheduleDateList(); // 缓存下这次选择的结果,如果是先选日期再选 duration 类商品,后面用得到
|
|
282
282
|
this.setDateRange([{
|
|
283
283
|
date: date,
|
|
@@ -290,13 +290,12 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
290
290
|
week: '',
|
|
291
291
|
weekNum: 0
|
|
292
292
|
}]);
|
|
293
|
-
scheduleIds = scheduleList
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
}); // 如果外面没传 product_ids,尝试从对应 schedule 里拿 product_ids
|
|
293
|
+
// const scheduleIds = scheduleList
|
|
294
|
+
// .filter((n) => n.date === date)
|
|
295
|
+
// .flatMap((n) => n.schedule_id)
|
|
296
|
+
// .filter((n) => n !== null && n !== undefined);
|
|
297
|
+
|
|
298
|
+
// 如果外面没传 product_ids,尝试从对应 schedule 里拿 product_ids
|
|
300
299
|
if (!((_product_ids = product_ids) !== null && _product_ids !== void 0 && _product_ids.length)) {
|
|
301
300
|
schedule = scheduleList.find(function (n) {
|
|
302
301
|
return n.date === date;
|
|
@@ -305,16 +304,21 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
305
304
|
product_ids = schedule.product_ids;
|
|
306
305
|
}
|
|
307
306
|
}
|
|
308
|
-
|
|
307
|
+
// 尝试去拿schedule 里的 other_product_ids 和 product_ids 拼在一起去重
|
|
308
|
+
otherProductsIds = this.store.schedule.getOtherProductsIds() || [];
|
|
309
|
+
allProductIds = [].concat(_toConsumableArray(product_ids), _toConsumableArray(otherProductsIds)).filter(function (n, index, self) {
|
|
310
|
+
return self.indexOf(n) === index;
|
|
311
|
+
});
|
|
312
|
+
_context3.next = 8;
|
|
309
313
|
return this.loadProducts({
|
|
310
|
-
schedule_ids: scheduleIds,
|
|
311
|
-
product_ids:
|
|
312
|
-
category_ids: category_ids
|
|
313
|
-
schedule_date: date
|
|
314
|
+
// schedule_ids: scheduleIds,
|
|
315
|
+
product_ids: allProductIds,
|
|
316
|
+
category_ids: category_ids
|
|
317
|
+
// schedule_date: date,
|
|
314
318
|
});
|
|
315
|
-
case 7:
|
|
316
|
-
return _context3.abrupt("return", _context3.sent);
|
|
317
319
|
case 8:
|
|
320
|
+
return _context3.abrupt("return", _context3.sent);
|
|
321
|
+
case 9:
|
|
318
322
|
case "end":
|
|
319
323
|
return _context3.stop();
|
|
320
324
|
}
|
|
@@ -472,7 +476,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
472
476
|
key: "loadScheduleAvailableDate",
|
|
473
477
|
value: function () {
|
|
474
478
|
var _loadScheduleAvailableDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(_ref3) {
|
|
475
|
-
var _res$data$date_list;
|
|
479
|
+
var _res$data$date_list, _res$data$other_produ, _res$data$other_produ2;
|
|
476
480
|
var startDate, endDate, custom_page_id, channel, dates, res;
|
|
477
481
|
return _regeneratorRuntime().wrap(function _callee6$(_context7) {
|
|
478
482
|
while (1) switch (_context7.prev = _context7.next) {
|
|
@@ -493,7 +497,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
493
497
|
return _context7.abrupt("return", dates);
|
|
494
498
|
case 6:
|
|
495
499
|
_context7.next = 8;
|
|
496
|
-
return this.request.get("/schedule/product/availability", {
|
|
500
|
+
return this.request.get("/schedule/product/availability/v2", {
|
|
497
501
|
start_date: startDate,
|
|
498
502
|
end_date: endDate,
|
|
499
503
|
custom_page_id: custom_page_id,
|
|
@@ -502,24 +506,32 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
502
506
|
case 8:
|
|
503
507
|
res = _context7.sent;
|
|
504
508
|
this.store.schedule.setAvailabilityScheduleDateList(res.data.date_list);
|
|
509
|
+
this.store.schedule.setOtherProductsIds(res.data.other_product_ids || []);
|
|
505
510
|
// 如果没有schedule或者结束日期在今天之前,则所有日期均不可用
|
|
506
|
-
if (!(!((_res$data$date_list = res.data.date_list) !== null && _res$data$date_list !== void 0 && _res$data$date_list.length) || dayjs(endDate).isBefore(dayjs(), 'day'))) {
|
|
507
|
-
_context7.next =
|
|
511
|
+
if (!(!((_res$data$date_list = res.data.date_list) !== null && _res$data$date_list !== void 0 && _res$data$date_list.length) && !((_res$data$other_produ = res.data.other_product_ids) !== null && _res$data$other_produ !== void 0 && _res$data$other_produ.length) || dayjs(endDate).isBefore(dayjs(), 'day'))) {
|
|
512
|
+
_context7.next = 13;
|
|
508
513
|
break;
|
|
509
514
|
}
|
|
510
515
|
return _context7.abrupt("return", dates);
|
|
511
|
-
case
|
|
512
|
-
res.data.
|
|
513
|
-
|
|
514
|
-
|
|
516
|
+
case 13:
|
|
517
|
+
if ((_res$data$other_produ2 = res.data.other_product_ids) !== null && _res$data$other_produ2 !== void 0 && _res$data$other_produ2.length) {
|
|
518
|
+
// 如果后端有返回 other_product_ids ,意味着有 duration 商品,则今天以及今天以后的日期均可用
|
|
519
|
+
dates.forEach(function (n) {
|
|
520
|
+
n.status = 'available';
|
|
515
521
|
});
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
522
|
+
} else {
|
|
523
|
+
res.data.date_list.forEach(function (n) {
|
|
524
|
+
var index = dates.findIndex(function (m) {
|
|
525
|
+
return m.date === n.date;
|
|
526
|
+
});
|
|
527
|
+
if (index !== -1) {
|
|
528
|
+
dates[index].status = 'available';
|
|
529
|
+
}
|
|
530
|
+
});
|
|
531
|
+
}
|
|
520
532
|
dates = disableDatesBeforeOneDay(dates);
|
|
521
533
|
return _context7.abrupt("return", dates);
|
|
522
|
-
case
|
|
534
|
+
case 16:
|
|
523
535
|
case "end":
|
|
524
536
|
return _context7.stop();
|
|
525
537
|
}
|
|
@@ -534,26 +546,48 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
534
546
|
key: "storeProduct",
|
|
535
547
|
value: function () {
|
|
536
548
|
var _storeProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(productData) {
|
|
537
|
-
var activeAccount, _ref4, bundle, options, origin, product_variant_id, product, addCartItem;
|
|
549
|
+
var activeAccount, _ref4, bundle, options, origin, product_variant_id, _ref4$quantity, quantity, rowKey, cartItems, targetCartItem, product, addCartItem;
|
|
538
550
|
return _regeneratorRuntime().wrap(function _callee7$(_context8) {
|
|
539
551
|
while (1) switch (_context8.prev = _context8.next) {
|
|
540
552
|
case 0:
|
|
541
553
|
// 往购物车加商品数据的时候,默认用当前 activeAccount 填充到 product 的 account 里面
|
|
542
554
|
activeAccount = this.getActiveAccount();
|
|
543
|
-
_ref4 = productData || {}, bundle = _ref4.bundle, options = _ref4.options, origin = _ref4.origin, product_variant_id = _ref4.product_variant_id;
|
|
555
|
+
_ref4 = productData || {}, bundle = _ref4.bundle, options = _ref4.options, origin = _ref4.origin, product_variant_id = _ref4.product_variant_id, _ref4$quantity = _ref4.quantity, quantity = _ref4$quantity === void 0 ? 1 : _ref4$quantity, rowKey = _ref4.rowKey; // 检查购物车里是否已经存在 rowKey相同的数据,如果是则更新数量
|
|
556
|
+
cartItems = this.store.cart.getItems();
|
|
557
|
+
if (!rowKey) {
|
|
558
|
+
_context8.next = 8;
|
|
559
|
+
break;
|
|
560
|
+
}
|
|
561
|
+
targetCartItem = cartItems.find(function (n) {
|
|
562
|
+
var _n$_productOrigin;
|
|
563
|
+
return ((_n$_productOrigin = n._productOrigin) === null || _n$_productOrigin === void 0 ? void 0 : _n$_productOrigin.rowKey) === rowKey;
|
|
564
|
+
});
|
|
565
|
+
if (!(targetCartItem && isNormalProduct(targetCartItem._productOrigin))) {
|
|
566
|
+
_context8.next = 8;
|
|
567
|
+
break;
|
|
568
|
+
}
|
|
569
|
+
this.store.cart.updateItem({
|
|
570
|
+
_id: targetCartItem._id,
|
|
571
|
+
product: _objectSpread({}, targetCartItem._productOrigin),
|
|
572
|
+
quantity: (targetCartItem.num || 1) + quantity
|
|
573
|
+
});
|
|
574
|
+
return _context8.abrupt("return");
|
|
575
|
+
case 8:
|
|
544
576
|
product = _objectSpread(_objectSpread({}, origin), {}, {
|
|
545
|
-
product_variant_id: product_variant_id
|
|
577
|
+
product_variant_id: product_variant_id,
|
|
578
|
+
rowKey: rowKey
|
|
546
579
|
});
|
|
547
580
|
addCartItem = {
|
|
548
581
|
product: product,
|
|
549
582
|
bundle: bundle,
|
|
550
|
-
options: options
|
|
583
|
+
options: options,
|
|
584
|
+
quantity: quantity
|
|
551
585
|
};
|
|
552
586
|
if (activeAccount) {
|
|
553
587
|
addCartItem.account = activeAccount;
|
|
554
588
|
}
|
|
555
589
|
this.store.cart.addItem(addCartItem);
|
|
556
|
-
case
|
|
590
|
+
case 12:
|
|
557
591
|
case "end":
|
|
558
592
|
return _context8.stop();
|
|
559
593
|
}
|
|
@@ -724,7 +758,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
724
758
|
key: "fetchHolderAccountsAsync",
|
|
725
759
|
value: (function () {
|
|
726
760
|
var _fetchHolderAccountsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(params) {
|
|
727
|
-
var cartItems, _this$store$date$getD, date,
|
|
761
|
+
var cartItems, _this$store$date$getD, date, normalProductCartItem;
|
|
728
762
|
return _regeneratorRuntime().wrap(function _callee11$(_context12) {
|
|
729
763
|
while (1) switch (_context12.prev = _context12.next) {
|
|
730
764
|
case 0:
|
|
@@ -733,7 +767,11 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
733
767
|
date = (_this$store$date$getD = this.store.date.getDateRange()) === null || _this$store$date$getD === void 0 || (_this$store$date$getD = _this$store$date$getD[0]) === null || _this$store$date$getD === void 0 ? void 0 : _this$store$date$getD.date;
|
|
734
768
|
if (!date) {
|
|
735
769
|
// 如果没有日期,则应该是 session 类先选商品的流程,直接从购物车里拿 start_date
|
|
736
|
-
|
|
770
|
+
// 不能从购物车里第一个找时间,而是找到购物车里第一个有 start_date 的时间
|
|
771
|
+
normalProductCartItem = cartItems.find(function (n) {
|
|
772
|
+
return !isNormalProduct(n._productOrigin);
|
|
773
|
+
});
|
|
774
|
+
date = (normalProductCartItem === null || normalProductCartItem === void 0 ? void 0 : normalProductCartItem.start_date) || '';
|
|
737
775
|
}
|
|
738
776
|
this.updateQuotationPriceAndCart(date);
|
|
739
777
|
}
|
|
@@ -968,7 +1006,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
968
1006
|
value: function () {
|
|
969
1007
|
var _setLoginAccount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(accountId, accountInfo) {
|
|
970
1008
|
var _this5 = this;
|
|
971
|
-
var account, stateAccountId, cartItems, _this$store$date$getD2, date,
|
|
1009
|
+
var account, stateAccountId, cartItems, _this$store$date$getD2, date, normalProductCartItem;
|
|
972
1010
|
return _regeneratorRuntime().wrap(function _callee18$(_context19) {
|
|
973
1011
|
while (1) switch (_context19.prev = _context19.next) {
|
|
974
1012
|
case 0:
|
|
@@ -995,7 +1033,11 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
995
1033
|
date = (_this$store$date$getD2 = this.store.date.getDateRange()) === null || _this$store$date$getD2 === void 0 || (_this$store$date$getD2 = _this$store$date$getD2[0]) === null || _this$store$date$getD2 === void 0 ? void 0 : _this$store$date$getD2.date;
|
|
996
1034
|
if (!date) {
|
|
997
1035
|
// 如果没有日期,则应该是 session 类先选商品的流程,直接从购物车里拿 start_date
|
|
998
|
-
|
|
1036
|
+
// 不能从购物车里第一个找时间,而是找到购物车里第一个有 start_date 的时间
|
|
1037
|
+
normalProductCartItem = cartItems.find(function (n) {
|
|
1038
|
+
return !isNormalProduct(n._productOrigin);
|
|
1039
|
+
});
|
|
1040
|
+
date = (normalProductCartItem === null || normalProductCartItem === void 0 ? void 0 : normalProductCartItem.start_date) || '';
|
|
999
1041
|
}
|
|
1000
1042
|
this.updateQuotationPriceAndCart(date);
|
|
1001
1043
|
}
|
|
@@ -1104,14 +1146,19 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1104
1146
|
item._origin.number = currentCapacity;
|
|
1105
1147
|
}
|
|
1106
1148
|
});
|
|
1107
|
-
type = this.otherParams.isRetailTemplate ? 'virtual' : 'appointment_booking';
|
|
1149
|
+
type = this.otherParams.isRetailTemplate ? 'virtual' : 'appointment_booking'; // 如果购物车里全都是普通商品,type 也应该为 virtual
|
|
1150
|
+
if (areAllNormalProducts(newCartItems.map(function (n) {
|
|
1151
|
+
return n._productOrigin;
|
|
1152
|
+
}))) {
|
|
1153
|
+
type = 'virtual';
|
|
1154
|
+
}
|
|
1108
1155
|
return _context22.abrupt("return", this.store.order.submitOrder({
|
|
1109
1156
|
query: {
|
|
1110
1157
|
cartItems: newCartItems,
|
|
1111
1158
|
type: type
|
|
1112
1159
|
}
|
|
1113
1160
|
}));
|
|
1114
|
-
case
|
|
1161
|
+
case 6:
|
|
1115
1162
|
case "end":
|
|
1116
1163
|
return _context22.stop();
|
|
1117
1164
|
}
|
|
@@ -1383,7 +1430,10 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1383
1430
|
key: "checkCartItems",
|
|
1384
1431
|
value: function checkCartItems(type) {
|
|
1385
1432
|
var _this8 = this;
|
|
1386
|
-
|
|
1433
|
+
// 预约流程中普通商品无需检测这些东西
|
|
1434
|
+
var cartItems = this.store.cart.getItems().filter(function (n) {
|
|
1435
|
+
return !isNormalProduct(n._productOrigin);
|
|
1436
|
+
});
|
|
1387
1437
|
var errorCartItemIds = [];
|
|
1388
1438
|
cartItems.forEach(function (cartItem) {
|
|
1389
1439
|
var result = _this8.store.cart.checkCartItemByType(cartItem, type);
|
|
@@ -1426,7 +1476,9 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1426
1476
|
});
|
|
1427
1477
|
}
|
|
1428
1478
|
var resourcesMap = getResourcesMap(cloneDeep(resources));
|
|
1429
|
-
var cartItems = this.store.cart.getItems()
|
|
1479
|
+
var cartItems = this.store.cart.getItems().filter(function (n) {
|
|
1480
|
+
return !isNormalProduct(n._productOrigin);
|
|
1481
|
+
});
|
|
1430
1482
|
var arr = [];
|
|
1431
1483
|
cartItems.forEach(function (cartItem) {
|
|
1432
1484
|
var _cartItem$_productOri, _cartItem$_productOri2;
|
|
@@ -1551,7 +1603,9 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1551
1603
|
});
|
|
1552
1604
|
}
|
|
1553
1605
|
var resourcesMap = getResourcesMap(cloneDeep(resources));
|
|
1554
|
-
var cartItems = this.store.cart.getItems()
|
|
1606
|
+
var cartItems = this.store.cart.getItems().filter(function (n) {
|
|
1607
|
+
return !isNormalProduct(n._productOrigin);
|
|
1608
|
+
});
|
|
1555
1609
|
var arr = [];
|
|
1556
1610
|
cartItems.forEach(function (cartItem) {
|
|
1557
1611
|
var _cartItem$_productOri5, _cartItem$_productOri6;
|
|
@@ -1665,7 +1719,9 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1665
1719
|
key: "getResourcesListByCartItem",
|
|
1666
1720
|
value: function getResourcesListByCartItem(id) {
|
|
1667
1721
|
var _targetCartItem$_prod2, _targetCartItem$_prod3;
|
|
1668
|
-
var cartItems =
|
|
1722
|
+
var cartItems = this.store.cart.getItems().filter(function (n) {
|
|
1723
|
+
return !isNormalProduct(n._productOrigin);
|
|
1724
|
+
});
|
|
1669
1725
|
var dateRange = this.store.date.getDateRange();
|
|
1670
1726
|
var resources = [];
|
|
1671
1727
|
dateRange.forEach(function (n) {
|
|
@@ -1744,6 +1800,9 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1744
1800
|
timeSlots = _ref8.timeSlots,
|
|
1745
1801
|
countMap = _ref8.countMap,
|
|
1746
1802
|
capacity = _ref8.capacity;
|
|
1803
|
+
if (isNormalProduct(cartItem._productOrigin)) {
|
|
1804
|
+
return {};
|
|
1805
|
+
}
|
|
1747
1806
|
var dateRange = this.store.date.getDateRange();
|
|
1748
1807
|
var cartItems = cloneDeep(this.store.cart.getItems());
|
|
1749
1808
|
// 取到账号下所有的商品,然后根据商品的 duration 和资源列表,获取所有可用的资源
|
|
@@ -1756,8 +1815,8 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1756
1815
|
}
|
|
1757
1816
|
// duration=所有商品时间的集合
|
|
1758
1817
|
var duration = accountCartItems.reduce(function (acc, n) {
|
|
1759
|
-
var _n$_productOrigin$dur, _n$
|
|
1760
|
-
return acc + ((_n$_productOrigin$dur = (_n$
|
|
1818
|
+
var _n$_productOrigin$dur, _n$_productOrigin2;
|
|
1819
|
+
return acc + ((_n$_productOrigin$dur = (_n$_productOrigin2 = n._productOrigin) === null || _n$_productOrigin2 === void 0 || (_n$_productOrigin2 = _n$_productOrigin2.duration) === null || _n$_productOrigin2 === void 0 ? void 0 : _n$_productOrigin2.value) !== null && _n$_productOrigin$dur !== void 0 ? _n$_productOrigin$dur : 0);
|
|
1761
1820
|
}, 0);
|
|
1762
1821
|
// 正常来说,能进这个业务的所有商品的 duration 类型都是一样的,所以这里取第一个商品的 duration 类型
|
|
1763
1822
|
// let durationType = accountCartItems[0]?._productOrigin?.duration?.type ?? "minutes";
|
|
@@ -1957,9 +2016,8 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1957
2016
|
var currentResourceConfig = (_item$_productOrigin4 = item._productOrigin) === null || _item$_productOrigin4 === void 0 || (_item$_productOrigin4 = _item$_productOrigin4.product_resource) === null || _item$_productOrigin4 === void 0 || (_item$_productOrigin4 = _item$_productOrigin4.resources) === null || _item$_productOrigin4 === void 0 ? void 0 : _item$_productOrigin4.find(function (n) {
|
|
1958
2017
|
return n.code === resources_code;
|
|
1959
2018
|
});
|
|
1960
|
-
var resourceBookingType = (currentResourceConfig === null || currentResourceConfig === void 0 ? void 0 : currentResourceConfig.type) || 'single';
|
|
1961
2019
|
// 只有 duration 类商品需要这个操作
|
|
1962
|
-
if (index !== 0 && recordTimeSlots &&
|
|
2020
|
+
if (index !== 0 && recordTimeSlots && (currentResourceConfig === null || currentResourceConfig === void 0 ? void 0 : currentResourceConfig.type) === 'single' && (_item$_productOrigin5 = item._productOrigin) !== null && _item$_productOrigin5 !== void 0 && _item$_productOrigin5.duration) {
|
|
1963
2021
|
var _item$_productOrigin$, _item$_productOrigin6, _ref9, _item$_productOrigin7, _item$_productOrigin$2, _item$_productOrigin8, _ref10, _item$_productOrigin9;
|
|
1964
2022
|
var start_at = dayjs(recordTimeSlots.end_time).add((_item$_productOrigin$ = (_item$_productOrigin6 = item._productOrigin) === null || _item$_productOrigin6 === void 0 || (_item$_productOrigin6 = _item$_productOrigin6.duration) === null || _item$_productOrigin6 === void 0 ? void 0 : _item$_productOrigin6.value) !== null && _item$_productOrigin$ !== void 0 ? _item$_productOrigin$ : 0, (_ref9 = (_item$_productOrigin7 = item._productOrigin) === null || _item$_productOrigin7 === void 0 || (_item$_productOrigin7 = _item$_productOrigin7.duration) === null || _item$_productOrigin7 === void 0 ? void 0 : _item$_productOrigin7.type) !== null && _ref9 !== void 0 ? _ref9 : 'minutes');
|
|
1965
2023
|
var end_at = start_at.add((_item$_productOrigin$2 = (_item$_productOrigin8 = item._productOrigin) === null || _item$_productOrigin8 === void 0 || (_item$_productOrigin8 = _item$_productOrigin8.duration) === null || _item$_productOrigin8 === void 0 ? void 0 : _item$_productOrigin8.value) !== null && _item$_productOrigin$2 !== void 0 ? _item$_productOrigin$2 : 0, (_ref10 = (_item$_productOrigin9 = item._productOrigin) === null || _item$_productOrigin9 === void 0 || (_item$_productOrigin9 = _item$_productOrigin9.duration) === null || _item$_productOrigin9 === void 0 ? void 0 : _item$_productOrigin9.type) !== null && _ref10 !== void 0 ? _ref10 : 'minutes');
|
|
@@ -2089,7 +2147,9 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2089
2147
|
}
|
|
2090
2148
|
});
|
|
2091
2149
|
};
|
|
2092
|
-
var cartItems =
|
|
2150
|
+
var cartItems = this.store.cart.getItems().filter(function (n) {
|
|
2151
|
+
return !isNormalProduct(n._productOrigin);
|
|
2152
|
+
});
|
|
2093
2153
|
|
|
2094
2154
|
// 如果购物车里没有 holderid数据,证明不按 holder 类流程预约走,给所有购物车一次性分派即可,不做账号下资源互斥逻辑
|
|
2095
2155
|
if (cartItems !== null && cartItems !== void 0 && cartItems[0].holder_id) {
|
|
@@ -2110,12 +2170,14 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2110
2170
|
value: function getTimeSlotByAllResources(resources_code) {
|
|
2111
2171
|
var _dateRange,
|
|
2112
2172
|
_this10 = this,
|
|
2113
|
-
_cartItems
|
|
2114
|
-
_cartItems$
|
|
2173
|
+
_cartItems$,
|
|
2174
|
+
_cartItems$2;
|
|
2115
2175
|
var dateRange = this.store.date.getDateRange();
|
|
2116
2176
|
// 取出购物车中所有一已选择的第一步资源
|
|
2117
2177
|
var resources = [];
|
|
2118
|
-
var cartItems =
|
|
2178
|
+
var cartItems = this.store.cart.getItems().filter(function (n) {
|
|
2179
|
+
return !isNormalProduct(n._productOrigin);
|
|
2180
|
+
});
|
|
2119
2181
|
// if (cartItems?.[0].start_date) return [];
|
|
2120
2182
|
var resourceIds = [];
|
|
2121
2183
|
var resourcesTypeId = undefined;
|
|
@@ -2194,18 +2256,18 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2194
2256
|
}
|
|
2195
2257
|
// 如果 cartItem 上既没有时间,也没有资源,认为外部属于异常调用,直接丢一个空数组出去
|
|
2196
2258
|
// 同时 session 类商品的流程也不应该调用这个方法
|
|
2197
|
-
if (!(cartItems !== null && cartItems !== void 0 && (_cartItems$
|
|
2259
|
+
if (!(cartItems !== null && cartItems !== void 0 && (_cartItems$ = cartItems[0]) !== null && _cartItems$ !== void 0 && _cartItems$.start_date) && !(cartItems !== null && cartItems !== void 0 && (_cartItems$2 = cartItems[0]) !== null && _cartItems$2 !== void 0 && _cartItems$2.resource_id) || !(cartItems !== null && cartItems !== void 0 && cartItems[0].duration)) {
|
|
2198
2260
|
return [];
|
|
2199
2261
|
}
|
|
2200
2262
|
if (cartItems !== null && cartItems !== void 0 && cartItems[0].start_date && !dateRange) {
|
|
2201
|
-
var _cartItems$
|
|
2263
|
+
var _cartItems$3, _cartItems$4;
|
|
2202
2264
|
dateRange = [{
|
|
2203
2265
|
date: cartItems === null || cartItems === void 0 ? void 0 : cartItems[0].start_date,
|
|
2204
2266
|
status: 'available',
|
|
2205
2267
|
week: '',
|
|
2206
2268
|
weekNum: 0
|
|
2207
2269
|
}, {
|
|
2208
|
-
date: (cartItems === null || cartItems === void 0 || (_cartItems$
|
|
2270
|
+
date: (cartItems === null || cartItems === void 0 || (_cartItems$3 = cartItems[0]) === null || _cartItems$3 === void 0 ? void 0 : _cartItems$3.end_date) || (cartItems === null || cartItems === void 0 || (_cartItems$4 = cartItems[0]) === null || _cartItems$4 === void 0 ? void 0 : _cartItems$4.start_date) || '',
|
|
2209
2271
|
status: 'available',
|
|
2210
2272
|
week: '',
|
|
2211
2273
|
weekNum: 0
|
|
@@ -2230,7 +2292,9 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2230
2292
|
value: function submitTimeSlot(timeSlots) {
|
|
2231
2293
|
var _this11 = this;
|
|
2232
2294
|
// 以账号为维度处理数据。购物车里每一项的 startTime应该是前一个商品的 endTime,如果是第一个商品则用 timeSlots.start_at
|
|
2233
|
-
var cartItems =
|
|
2295
|
+
var cartItems = this.store.cart.getItems().filter(function (n) {
|
|
2296
|
+
return !isNormalProduct(n._productOrigin);
|
|
2297
|
+
});
|
|
2234
2298
|
|
|
2235
2299
|
// 按账号分组
|
|
2236
2300
|
var itemsByAccount = cartItems.reduce(function (acc, item) {
|
|
@@ -2338,7 +2402,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2338
2402
|
}, {
|
|
2339
2403
|
key: "getTimeslotBySchedule",
|
|
2340
2404
|
value: function getTimeslotBySchedule(_ref12) {
|
|
2341
|
-
var _this$store$currentPr2;
|
|
2405
|
+
var _this$store$currentPr2, _targetProductData$pr;
|
|
2342
2406
|
var date = _ref12.date,
|
|
2343
2407
|
scheduleIds = _ref12.scheduleIds,
|
|
2344
2408
|
resources = _ref12.resources,
|
|
@@ -2377,11 +2441,17 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2377
2441
|
return 0;
|
|
2378
2442
|
});
|
|
2379
2443
|
|
|
2444
|
+
// 找到当前商品下第一个启用的资源id
|
|
2445
|
+
var firstEnabledResourceId = targetProductData === null || targetProductData === void 0 || (_targetProductData$pr = targetProductData.product_resource) === null || _targetProductData$pr === void 0 || (_targetProductData$pr = _targetProductData$pr.resources) === null || _targetProductData$pr === void 0 || (_targetProductData$pr = _targetProductData$pr.find(function (n) {
|
|
2446
|
+
return n.status === 1;
|
|
2447
|
+
})) === null || _targetProductData$pr === void 0 ? void 0 : _targetProductData$pr.id;
|
|
2448
|
+
|
|
2380
2449
|
// 计算每个日程切片下日程可用的资源的容量总和
|
|
2381
2450
|
var formatScheduleTimeSlots = scheduleTimeSlots.map(function (item) {
|
|
2382
2451
|
// 用来计算资源的可使用情况,针对单个schedule 时间片
|
|
2383
2452
|
var resourcesUseableMap = {};
|
|
2384
2453
|
var count = 0;
|
|
2454
|
+
var bookingLeft = 0;
|
|
2385
2455
|
// 遍历所有资源
|
|
2386
2456
|
allProductResources === null || allProductResources === void 0 || allProductResources.forEach(function (m) {
|
|
2387
2457
|
// 遍历所有资源的上工时间片
|
|
@@ -2423,8 +2493,15 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2423
2493
|
// 在已经选定时间的情况下,只要canUseTime如果有一个 false 那就不可用
|
|
2424
2494
|
if (!currentResourcesTimeSlotCanUsedArr.some(function (n) {
|
|
2425
2495
|
return n === false;
|
|
2426
|
-
})
|
|
2427
|
-
|
|
2496
|
+
})
|
|
2497
|
+
// 只统计第一种资源的容量和 left
|
|
2498
|
+
&& m.form_id === firstEnabledResourceId) {
|
|
2499
|
+
if (currentResourcesCount >= count) {
|
|
2500
|
+
count = currentResourcesCount;
|
|
2501
|
+
}
|
|
2502
|
+
if (!m.onlyComputed) {
|
|
2503
|
+
bookingLeft += 1;
|
|
2504
|
+
}
|
|
2428
2505
|
}
|
|
2429
2506
|
});
|
|
2430
2507
|
var startDayJs = dayjs(item.start);
|
|
@@ -2434,7 +2511,8 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2434
2511
|
end_time: endDayJs.format('HH:mm'),
|
|
2435
2512
|
start_at: startDayJs,
|
|
2436
2513
|
end_at: endDayJs,
|
|
2437
|
-
count: count
|
|
2514
|
+
count: count,
|
|
2515
|
+
left: bookingLeft
|
|
2438
2516
|
};
|
|
2439
2517
|
});
|
|
2440
2518
|
return formatScheduleTimeSlots;
|
|
@@ -2450,7 +2528,10 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2450
2528
|
bundle = _ref14.bundle,
|
|
2451
2529
|
options = _ref14.options,
|
|
2452
2530
|
origin = _ref14.origin,
|
|
2453
|
-
product_variant_id = _ref14.product_variant_id
|
|
2531
|
+
product_variant_id = _ref14.product_variant_id,
|
|
2532
|
+
rowKey = _ref14.rowKey,
|
|
2533
|
+
_ref14$quantity = _ref14.quantity,
|
|
2534
|
+
quantity = _ref14$quantity === void 0 ? 1 : _ref14$quantity;
|
|
2454
2535
|
var productData = _objectSpread(_objectSpread({}, origin), {}, {
|
|
2455
2536
|
product_variant_id: product_variant_id
|
|
2456
2537
|
});
|
|
@@ -2460,17 +2541,36 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2460
2541
|
account = activeAccount;
|
|
2461
2542
|
}
|
|
2462
2543
|
}
|
|
2544
|
+
if (rowKey) {
|
|
2545
|
+
var cartItems = this.store.cart.getItems();
|
|
2546
|
+
var targetCartItem = cartItems.find(function (n) {
|
|
2547
|
+
var _n$_productOrigin3;
|
|
2548
|
+
return ((_n$_productOrigin3 = n._productOrigin) === null || _n$_productOrigin3 === void 0 ? void 0 : _n$_productOrigin3.rowKey) === rowKey;
|
|
2549
|
+
});
|
|
2550
|
+
if (targetCartItem && isNormalProduct(targetCartItem._productOrigin)) {
|
|
2551
|
+
this.store.cart.updateItem({
|
|
2552
|
+
_id: targetCartItem._id,
|
|
2553
|
+
product: _objectSpread(_objectSpread({}, targetCartItem._productOrigin), {}, {
|
|
2554
|
+
quantity: (targetCartItem.num || 1) + quantity
|
|
2555
|
+
})
|
|
2556
|
+
});
|
|
2557
|
+
return;
|
|
2558
|
+
}
|
|
2559
|
+
}
|
|
2463
2560
|
this.store.cart.addItem({
|
|
2464
2561
|
product: productData,
|
|
2465
2562
|
date: date,
|
|
2466
2563
|
account: account,
|
|
2467
2564
|
bundle: bundle,
|
|
2468
|
-
options: options
|
|
2565
|
+
options: options,
|
|
2566
|
+
quantity: quantity
|
|
2469
2567
|
});
|
|
2470
2568
|
// 检测,有传递 date,检查购物车里其他商品的 date 是否在同一天,如果不在,清空那些不在同一天的商品
|
|
2471
2569
|
if (date) {
|
|
2472
|
-
var
|
|
2473
|
-
|
|
2570
|
+
var _cartItems = this.store.cart.getItems().filter(function (n) {
|
|
2571
|
+
return !isNormalProduct(n._productOrigin);
|
|
2572
|
+
});
|
|
2573
|
+
var cartItemsByDate = _cartItems.filter(function (n) {
|
|
2474
2574
|
return !dayjs(n.start_date).isSame(dayjs(date.startTime), 'day');
|
|
2475
2575
|
});
|
|
2476
2576
|
if (cartItemsByDate.length) {
|
|
@@ -2554,7 +2654,9 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2554
2654
|
});
|
|
2555
2655
|
}
|
|
2556
2656
|
var resourcesMap = getResourcesMap(cloneDeep(resources));
|
|
2557
|
-
var cartItems = this.store.cart.getItems()
|
|
2657
|
+
var cartItems = this.store.cart.getItems().filter(function (n) {
|
|
2658
|
+
return !isNormalProduct(n._productOrigin);
|
|
2659
|
+
});
|
|
2558
2660
|
var cartItem = cartItems.find(function (item) {
|
|
2559
2661
|
return item._id === cartItemId;
|
|
2560
2662
|
});
|
|
@@ -2785,7 +2887,6 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2785
2887
|
var _getAvailableDateForSessionOptimize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30() {
|
|
2786
2888
|
var _this$store$currentPr3, _this$store$currentPr4, _this$store$currentPr5, _tempProducts, _this$store$currentPr6;
|
|
2787
2889
|
var params,
|
|
2788
|
-
cache,
|
|
2789
2890
|
startDate,
|
|
2790
2891
|
endDate,
|
|
2791
2892
|
tempProducts,
|
|
@@ -2793,6 +2894,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2793
2894
|
filteredSchedule,
|
|
2794
2895
|
tempResourceIds,
|
|
2795
2896
|
res,
|
|
2897
|
+
cache,
|
|
2796
2898
|
dates,
|
|
2797
2899
|
currentDate,
|
|
2798
2900
|
firstAvailableDate,
|
|
@@ -2805,21 +2907,6 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2805
2907
|
while (1) switch (_context32.prev = _context32.next) {
|
|
2806
2908
|
case 0:
|
|
2807
2909
|
params = _args32.length > 0 && _args32[0] !== undefined ? _args32[0] : {};
|
|
2808
|
-
// 先去读缓存结果,因为正常 UI 调用的是 7 天,而下面我会直接计算 30 天(最少也是 14 天),所以先去读缓存结果,如果缓存结果存在,则直接返回
|
|
2809
|
-
cache = (_this$store$currentPr3 = this.store.currentProduct) === null || _this$store$currentPr3 === void 0 ? void 0 : _this$store$currentPr3.getOtherParams()['timeSlotBySchedule'];
|
|
2810
|
-
if (!cache) {
|
|
2811
|
-
_context32.next = 5;
|
|
2812
|
-
break;
|
|
2813
|
-
}
|
|
2814
|
-
if (!(dayjs(params.startDate).isSameOrAfter(dayjs(cache.startDate), 'day') && dayjs(params.endDate).isSameOrBefore(dayjs(cache.endDate), 'day'))) {
|
|
2815
|
-
_context32.next = 5;
|
|
2816
|
-
break;
|
|
2817
|
-
}
|
|
2818
|
-
return _context32.abrupt("return", {
|
|
2819
|
-
dateList: cache.dateList,
|
|
2820
|
-
firstAvailableDate: cache.firstAvailableDate
|
|
2821
|
-
});
|
|
2822
|
-
case 5:
|
|
2823
2910
|
// 开始日期如果小于今天,直接以今天当做开始日期
|
|
2824
2911
|
startDate = params.startDate, endDate = params.endDate; // 前端传递的 startDate,可能是今天之前的,如果 startDate 小于今天 且 endDate 小于或等于今天,需要把 startDate 置为今天
|
|
2825
2912
|
if (dayjs(startDate).isBefore(dayjs(), 'day') && (dayjs(endDate).isAfter(dayjs(), 'day') || dayjs(endDate).isSame(dayjs(), 'day'))) {
|
|
@@ -2828,11 +2915,11 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2828
2915
|
// 不管前端传什么 endDate 默认查一个月的,以今天为开始日期。用于找到一个月内最近可用的日期
|
|
2829
2916
|
endDate = dayjs().add(1, 'month').format('YYYY-MM-DD');
|
|
2830
2917
|
// 如果当前打开了某个的商品详情弹窗,则应该默认用这个商品
|
|
2831
|
-
tempProducts = (_this$store$
|
|
2832
|
-
schedule = (_this$store$
|
|
2918
|
+
tempProducts = (_this$store$currentPr3 = this.store.currentProduct) === null || _this$store$currentPr3 === void 0 ? void 0 : _this$store$currentPr3.getData();
|
|
2919
|
+
schedule = (_this$store$currentPr4 = this.store.currentProduct) === null || _this$store$currentPr4 === void 0 ? void 0 : _this$store$currentPr4.getOtherParams()['schedule'];
|
|
2833
2920
|
filteredSchedule = filterScheduleByDateRange(schedule, startDate || '', endDate || ''); // 1.后端返回的数据,确定资源在每一天的可用和使用情况
|
|
2834
2921
|
tempResourceIds = getResourcesIdsByProduct(tempProducts);
|
|
2835
|
-
_context32.next =
|
|
2922
|
+
_context32.next = 10;
|
|
2836
2923
|
return this.store.date.fetchResourceDates({
|
|
2837
2924
|
query: {
|
|
2838
2925
|
start_date: startDate || '',
|
|
@@ -2840,8 +2927,25 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2840
2927
|
resource_ids: tempResourceIds
|
|
2841
2928
|
}
|
|
2842
2929
|
});
|
|
2843
|
-
case
|
|
2930
|
+
case 10:
|
|
2844
2931
|
res = _context32.sent;
|
|
2932
|
+
// 先去读缓存结果,因为正常 UI 调用的是 7 天,而下面我会直接计算 30 天(最少也是 14 天),所以先去读缓存结果,如果缓存结果存在,则直接返回
|
|
2933
|
+
// TODO 优化关于为什么要放在接口后,因为在获取时间切片的时候还需要读一次接口数据,其实可以直接从这个结果里拿了,需要优化
|
|
2934
|
+
cache = (_this$store$currentPr5 = this.store.currentProduct) === null || _this$store$currentPr5 === void 0 ? void 0 : _this$store$currentPr5.getOtherParams()['timeSlotBySchedule'];
|
|
2935
|
+
if (!cache) {
|
|
2936
|
+
_context32.next = 16;
|
|
2937
|
+
break;
|
|
2938
|
+
}
|
|
2939
|
+
if (!(dayjs(params.startDate).isSameOrAfter(dayjs(cache.startDate), 'day') && dayjs(params.endDate).isSameOrBefore(dayjs(cache.endDate), 'day'))) {
|
|
2940
|
+
_context32.next = 16;
|
|
2941
|
+
break;
|
|
2942
|
+
}
|
|
2943
|
+
this.store.date.setDateList(cache.dateList);
|
|
2944
|
+
return _context32.abrupt("return", {
|
|
2945
|
+
dateList: cache.dateList,
|
|
2946
|
+
firstAvailableDate: cache.firstAvailableDate
|
|
2947
|
+
});
|
|
2948
|
+
case 16:
|
|
2845
2949
|
// 2. 商品 schedule 数据,确定日程在每一天的时间片
|
|
2846
2950
|
// 3. 把后端返回的和 schedule 的数据进行合并,确定每一天的可用和使用情况
|
|
2847
2951
|
dates = [];
|
|
@@ -2850,7 +2954,16 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2850
2954
|
openResources = ((_tempProducts = tempProducts) === null || _tempProducts === void 0 || (_tempProducts = _tempProducts.product_resource) === null || _tempProducts === void 0 || (_tempProducts = _tempProducts.resources) === null || _tempProducts === void 0 ? void 0 : _tempProducts.filter(function (m) {
|
|
2851
2955
|
return m.status === 1;
|
|
2852
2956
|
})) || []; // res.data 返回的一定是启用商品的资源列表,不需要再过滤了
|
|
2853
|
-
allProductResources = sortCombinedResources(res.data);
|
|
2957
|
+
allProductResources = sortCombinedResources(res.data); // allProductResources 需要根据商品里的资源的单个预约多个预约补充resourceType
|
|
2958
|
+
allProductResources.forEach(function (m) {
|
|
2959
|
+
var _tempProducts2;
|
|
2960
|
+
var resource = (_tempProducts2 = tempProducts) === null || _tempProducts2 === void 0 || (_tempProducts2 = _tempProducts2.product_resource) === null || _tempProducts2 === void 0 || (_tempProducts2 = _tempProducts2.resources) === null || _tempProducts2 === void 0 ? void 0 : _tempProducts2.find(function (n) {
|
|
2961
|
+
return n.id === m.form_id;
|
|
2962
|
+
});
|
|
2963
|
+
if (resource) {
|
|
2964
|
+
m.resourceType = resource.type;
|
|
2965
|
+
}
|
|
2966
|
+
});
|
|
2854
2967
|
targetSchedules = this.store.schedule.getScheduleListByIds(tempProducts['schedule.ids']);
|
|
2855
2968
|
_loop3 = /*#__PURE__*/_regeneratorRuntime().mark(function _loop3() {
|
|
2856
2969
|
var currentDateStr, status, _checkSessionProductL, latestStartDate, earliestEndDate, scheduleByDate, minTimeMaxTime, scheduleTimeSlots, timesSlotCanUse;
|
|
@@ -2907,7 +3020,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2907
3020
|
return;
|
|
2908
3021
|
}
|
|
2909
3022
|
var targetCanUseTimes = mTimes.some(function (childTiem) {
|
|
2910
|
-
var
|
|
3023
|
+
var _tempProducts3;
|
|
2911
3024
|
// 挨个去匹配某个工作时间段结合当前日程时间,资源能不能用,有多少容量能用
|
|
2912
3025
|
var res = getIsUsableByTimeItem({
|
|
2913
3026
|
timeSlice: {
|
|
@@ -2920,7 +3033,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2920
3033
|
resource: m,
|
|
2921
3034
|
currentCount: 1,
|
|
2922
3035
|
resourcesUseableMap: resourcesUseableMap,
|
|
2923
|
-
cut_off_time: (
|
|
3036
|
+
cut_off_time: (_tempProducts3 = tempProducts) === null || _tempProducts3 === void 0 ? void 0 : _tempProducts3.cut_off_time
|
|
2924
3037
|
});
|
|
2925
3038
|
if ((resourcesUseableMap === null || resourcesUseableMap === void 0 ? void 0 : resourcesUseableMap[m.id]) !== false && res.reason !== 'capacityOnly') {
|
|
2926
3039
|
resourcesUseableMap[m.id] = res.usable;
|
|
@@ -2959,22 +3072,22 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2959
3072
|
}
|
|
2960
3073
|
}, _loop3);
|
|
2961
3074
|
});
|
|
2962
|
-
case
|
|
3075
|
+
case 24:
|
|
2963
3076
|
if (!(dayjs(currentDate).isBefore(dayjs(endDate), 'day') || dayjs(currentDate).isSame(dayjs(endDate), 'day'))) {
|
|
2964
|
-
_context32.next =
|
|
3077
|
+
_context32.next = 30;
|
|
2965
3078
|
break;
|
|
2966
3079
|
}
|
|
2967
|
-
return _context32.delegateYield(_loop3(), "t0",
|
|
2968
|
-
case
|
|
3080
|
+
return _context32.delegateYield(_loop3(), "t0", 26);
|
|
3081
|
+
case 26:
|
|
2969
3082
|
if (!_context32.t0) {
|
|
2970
|
-
_context32.next =
|
|
3083
|
+
_context32.next = 28;
|
|
2971
3084
|
break;
|
|
2972
3085
|
}
|
|
2973
|
-
return _context32.abrupt("break",
|
|
2974
|
-
case 26:
|
|
2975
|
-
_context32.next = 22;
|
|
2976
|
-
break;
|
|
3086
|
+
return _context32.abrupt("break", 30);
|
|
2977
3087
|
case 28:
|
|
3088
|
+
_context32.next = 24;
|
|
3089
|
+
break;
|
|
3090
|
+
case 30:
|
|
2978
3091
|
// 最终把资源数据也加到日期内
|
|
2979
3092
|
dates = handleAvailableDateByResource(res.data, dates);
|
|
2980
3093
|
this.store.date.setDateList(dates);
|
|
@@ -2990,7 +3103,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2990
3103
|
dateList: dates,
|
|
2991
3104
|
firstAvailableDate: firstAvailableDate
|
|
2992
3105
|
});
|
|
2993
|
-
case
|
|
3106
|
+
case 34:
|
|
2994
3107
|
case "end":
|
|
2995
3108
|
return _context32.stop();
|
|
2996
3109
|
}
|
|
@@ -3001,6 +3114,38 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3001
3114
|
}
|
|
3002
3115
|
return getAvailableDateForSessionOptimize;
|
|
3003
3116
|
}()
|
|
3117
|
+
}, {
|
|
3118
|
+
key: "isCartAllNormalProducts",
|
|
3119
|
+
value: function isCartAllNormalProducts() {
|
|
3120
|
+
var cartItems = this.store.cart.getItems().filter(function (n) {
|
|
3121
|
+
return !isNormalProduct(n._productOrigin);
|
|
3122
|
+
});
|
|
3123
|
+
return !cartItems.length;
|
|
3124
|
+
}
|
|
3125
|
+
}, {
|
|
3126
|
+
key: "isCartHasDurationProduct",
|
|
3127
|
+
value: function isCartHasDurationProduct() {
|
|
3128
|
+
var cartItems = this.store.cart.getItems().filter(function (n) {
|
|
3129
|
+
return !isNormalProduct(n._productOrigin);
|
|
3130
|
+
});
|
|
3131
|
+
return cartItems.some(function (n) {
|
|
3132
|
+
var _n$_productOrigin4;
|
|
3133
|
+
return (_n$_productOrigin4 = n._productOrigin) === null || _n$_productOrigin4 === void 0 ? void 0 : _n$_productOrigin4.duration;
|
|
3134
|
+
});
|
|
3135
|
+
}
|
|
3136
|
+
}, {
|
|
3137
|
+
key: "isTargetNormalProduct",
|
|
3138
|
+
value: function isTargetNormalProduct(product) {
|
|
3139
|
+
return isNormalProduct(product);
|
|
3140
|
+
}
|
|
3141
|
+
}, {
|
|
3142
|
+
key: "isTargetCartIdNormalProduct",
|
|
3143
|
+
value: function isTargetCartIdNormalProduct(id) {
|
|
3144
|
+
var cartItem = this.store.cart.getItems().find(function (n) {
|
|
3145
|
+
return n._id === id;
|
|
3146
|
+
});
|
|
3147
|
+
return cartItem && isNormalProduct(cartItem._productOrigin);
|
|
3148
|
+
}
|
|
3004
3149
|
}]);
|
|
3005
3150
|
return BookingByStepImpl;
|
|
3006
3151
|
}(BaseModule);
|