@pisell/pisellos 2.1.85 → 2.1.87
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/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/modules/Cart/types.d.ts +0 -2
- package/dist/modules/Cart/utils/cartProduct.js +0 -11
- package/dist/modules/Cart/utils/changePrice.js +6 -0
- package/dist/modules/Discount/index.d.ts +1 -0
- package/dist/modules/Discount/index.js +2 -1
- package/dist/modules/Discount/types.d.ts +0 -15
- package/dist/modules/Payment/index.d.ts +1 -2
- package/dist/modules/Payment/index.js +7 -10
- package/dist/modules/Payment/utils.js +0 -3
- package/dist/modules/Payment/walletpass.d.ts +0 -23
- package/dist/modules/Payment/walletpass.js +95 -191
- package/dist/modules/Rules/index.d.ts +2 -7
- package/dist/modules/Rules/index.js +19 -141
- package/dist/modules/Rules/types.d.ts +0 -1
- package/dist/modules/Schedule/getDateIsInSchedule.d.ts +32 -0
- package/dist/modules/Schedule/getDateIsInSchedule.js +747 -0
- package/dist/modules/Schedule/index.d.ts +1 -1
- package/dist/modules/Schedule/index.js +2 -0
- package/dist/modules/Summary/index.js +47 -5
- package/dist/modules/Summary/types.d.ts +0 -2
- package/dist/modules/Summary/utils.d.ts +1 -7
- package/dist/modules/Summary/utils.js +23 -33
- package/dist/plugins/window.d.ts +0 -2
- package/dist/solution/BookingByStep/index.d.ts +0 -1
- package/dist/solution/BookingByStep/index.js +84 -35
- package/dist/solution/Checkout/index.js +0 -2
- package/dist/solution/ShopDiscount/index.d.ts +0 -1
- package/dist/solution/ShopDiscount/index.js +3 -12
- package/dist/solution/ShopDiscount/types.d.ts +0 -1
- package/lib/index.d.ts +0 -1
- package/lib/index.js +1 -3
- package/lib/modules/Cart/types.d.ts +0 -2
- package/lib/modules/Cart/utils/cartProduct.js +0 -9
- package/lib/modules/Cart/utils/changePrice.js +5 -0
- package/lib/modules/Discount/index.d.ts +1 -0
- package/lib/modules/Discount/index.js +2 -1
- package/lib/modules/Discount/types.d.ts +0 -15
- package/lib/modules/Payment/index.d.ts +1 -2
- package/lib/modules/Payment/index.js +0 -1
- package/lib/modules/Payment/utils.js +0 -3
- package/lib/modules/Payment/walletpass.d.ts +0 -23
- package/lib/modules/Payment/walletpass.js +17 -94
- package/lib/modules/Rules/index.d.ts +2 -7
- package/lib/modules/Rules/index.js +149 -285
- package/lib/modules/Rules/types.d.ts +0 -1
- package/lib/modules/Schedule/getDateIsInSchedule.d.ts +32 -0
- package/lib/modules/Schedule/getDateIsInSchedule.js +451 -0
- package/lib/modules/Schedule/index.d.ts +1 -1
- package/lib/modules/Schedule/index.js +2 -0
- package/lib/modules/Summary/index.js +22 -9
- package/lib/modules/Summary/types.d.ts +0 -2
- package/lib/modules/Summary/utils.d.ts +1 -7
- package/lib/modules/Summary/utils.js +22 -28
- package/lib/plugins/window.d.ts +0 -2
- package/lib/solution/BookingByStep/index.d.ts +0 -1
- package/lib/solution/BookingByStep/index.js +34 -3
- package/lib/solution/Checkout/index.js +0 -2
- package/lib/solution/ShopDiscount/index.d.ts +0 -1
- package/lib/solution/ShopDiscount/index.js +2 -7
- package/lib/solution/ShopDiscount/types.d.ts +0 -1
- package/package.json +1 -1
- package/dist/model/index.d.ts +0 -1
- package/dist/model/index.js +0 -1
- package/dist/model/strategy/adapter/index.d.ts +0 -3
- package/dist/model/strategy/adapter/index.js +0 -4
- package/dist/model/strategy/adapter/type.d.ts +0 -28
- package/dist/model/strategy/adapter/type.js +0 -1
- package/dist/model/strategy/adapter/walletPass/evaluator.d.ts +0 -84
- package/dist/model/strategy/adapter/walletPass/evaluator.js +0 -497
- package/dist/model/strategy/adapter/walletPass/example.d.ts +0 -4
- package/dist/model/strategy/adapter/walletPass/example.js +0 -258
- package/dist/model/strategy/adapter/walletPass/index.d.ts +0 -32
- package/dist/model/strategy/adapter/walletPass/index.js +0 -182
- package/dist/model/strategy/adapter/walletPass/locales.d.ts +0 -1
- package/dist/model/strategy/adapter/walletPass/locales.js +0 -23
- package/dist/model/strategy/adapter/walletPass/type.d.ts +0 -168
- package/dist/model/strategy/adapter/walletPass/type.js +0 -1
- package/dist/model/strategy/adapter/walletPass/utils.d.ts +0 -76
- package/dist/model/strategy/adapter/walletPass/utils.js +0 -1043
- package/dist/model/strategy/index.d.ts +0 -94
- package/dist/model/strategy/index.js +0 -551
- package/dist/model/strategy/strategy-example.d.ts +0 -5
- package/dist/model/strategy/strategy-example.js +0 -331
- package/dist/model/strategy/type.d.ts +0 -228
- package/dist/model/strategy/type.js +0 -94
- package/lib/model/index.d.ts +0 -1
- package/lib/model/index.js +0 -23
- package/lib/model/strategy/adapter/index.d.ts +0 -3
- package/lib/model/strategy/adapter/index.js +0 -45
- package/lib/model/strategy/adapter/type.d.ts +0 -28
- package/lib/model/strategy/adapter/type.js +0 -17
- package/lib/model/strategy/adapter/walletPass/evaluator.d.ts +0 -84
- package/lib/model/strategy/adapter/walletPass/evaluator.js +0 -421
- package/lib/model/strategy/adapter/walletPass/example.d.ts +0 -4
- package/lib/model/strategy/adapter/walletPass/example.js +0 -207
- package/lib/model/strategy/adapter/walletPass/index.d.ts +0 -32
- package/lib/model/strategy/adapter/walletPass/index.js +0 -142
- package/lib/model/strategy/adapter/walletPass/locales.d.ts +0 -1
- package/lib/model/strategy/adapter/walletPass/locales.js +0 -51
- package/lib/model/strategy/adapter/walletPass/type.d.ts +0 -168
- package/lib/model/strategy/adapter/walletPass/type.js +0 -17
- package/lib/model/strategy/adapter/walletPass/utils.d.ts +0 -76
- package/lib/model/strategy/adapter/walletPass/utils.js +0 -704
- package/lib/model/strategy/index.d.ts +0 -94
- package/lib/model/strategy/index.js +0 -413
- package/lib/model/strategy/strategy-example.d.ts +0 -5
- package/lib/model/strategy/strategy-example.js +0 -318
- package/lib/model/strategy/type.d.ts +0 -228
- package/lib/model/strategy/type.js +0 -44
|
@@ -27,6 +27,7 @@ import isSameOrBefore from 'dayjs/plugin/isSameOrBefore';
|
|
|
27
27
|
import isSameOrAfter from 'dayjs/plugin/isSameOrAfter';
|
|
28
28
|
import { generateMonthDates, disableAllDates, disableDatesBeforeOneDay } from "../Date/utils";
|
|
29
29
|
import { calcScheduleDateRange } from "./utils";
|
|
30
|
+
import { getDateIsInSchedule } from "./getDateIsInSchedule";
|
|
30
31
|
dayjs.extend(isSameOrBefore);
|
|
31
32
|
dayjs.extend(isSameOrAfter);
|
|
32
33
|
export var ScheduleModule = /*#__PURE__*/function (_BaseModule) {
|
|
@@ -254,6 +255,7 @@ export var ScheduleModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
254
255
|
var _schedule$repeat_rule, _schedule$repeat_rule2;
|
|
255
256
|
var date = _ref2.date,
|
|
256
257
|
schedule = _ref2.schedule;
|
|
258
|
+
return getDateIsInSchedule(date, [schedule]);
|
|
257
259
|
if (schedule.start_time && schedule.end_time) {
|
|
258
260
|
var isBeforeStartTime = dayjs(date).isBefore(dayjs(schedule.start_time));
|
|
259
261
|
var isAfterEndTime = dayjs(date).isAfter(dayjs(schedule.end_time));
|
|
@@ -1,4 +1,7 @@
|
|
|
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; } } }; }
|
|
3
|
+
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
|
+
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; }
|
|
2
5
|
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; }
|
|
3
6
|
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); } }
|
|
4
7
|
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); }); }; }
|
|
@@ -86,7 +89,7 @@ export var SummaryModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
86
89
|
while (1) switch (_context2.prev = _context2.next) {
|
|
87
90
|
case 0:
|
|
88
91
|
_context2.next = 2;
|
|
89
|
-
return this.request.get('/order/custom-surcharge/available', {
|
|
92
|
+
return this.request.get('/order/custom-surcharge/available/v2', {
|
|
90
93
|
channel: 'online-store',
|
|
91
94
|
is_assemble_product_data: 1,
|
|
92
95
|
is_assemble_schedule_data: 1,
|
|
@@ -111,15 +114,34 @@ export var SummaryModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
111
114
|
value: function () {
|
|
112
115
|
var _getSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(cartItems) {
|
|
113
116
|
var _this$shopStore$get;
|
|
114
|
-
var shopInfo, summary;
|
|
117
|
+
var shopInfo, scheduleModule, needScheduleIds, scheduleList, scheduleById, _iterator, _step, item, summary;
|
|
115
118
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
116
119
|
while (1) switch (_context3.prev = _context3.next) {
|
|
117
120
|
case 0:
|
|
118
121
|
shopInfo = ((_this$shopStore$get = this.shopStore.get('core')) === null || _this$shopStore$get === void 0 || (_this$shopStore$get = _this$shopStore$get.core) === null || _this$shopStore$get === void 0 ? void 0 : _this$shopStore$get.shop) || {};
|
|
119
|
-
|
|
122
|
+
scheduleModule = this.core.getModule('appointmentBooking_schedule');
|
|
123
|
+
needScheduleIds = this.store.surchargeList.map(function (item) {
|
|
124
|
+
return item.available_schedule_ids;
|
|
125
|
+
}).flat();
|
|
126
|
+
scheduleList = scheduleModule === null || scheduleModule === void 0 ? void 0 : scheduleModule.getScheduleListByIds(needScheduleIds);
|
|
127
|
+
scheduleById = {};
|
|
128
|
+
if (Array.isArray(scheduleList)) {
|
|
129
|
+
_iterator = _createForOfIteratorHelper(scheduleList);
|
|
130
|
+
try {
|
|
131
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
132
|
+
item = _step.value;
|
|
133
|
+
scheduleById[item.id] = item;
|
|
134
|
+
}
|
|
135
|
+
} catch (err) {
|
|
136
|
+
_iterator.e(err);
|
|
137
|
+
} finally {
|
|
138
|
+
_iterator.f();
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
summary = calculatePriceDetails(shopInfo, cartItems, ScheduleModule === null || ScheduleModule === void 0 ? void 0 : ScheduleModule.isInScheduleByDate, this.store.surchargeList, scheduleById);
|
|
120
142
|
this.store.summary = summary;
|
|
121
143
|
return _context3.abrupt("return", this.store.summary);
|
|
122
|
-
case
|
|
144
|
+
case 9:
|
|
123
145
|
case "end":
|
|
124
146
|
return _context3.stop();
|
|
125
147
|
}
|
|
@@ -187,6 +209,26 @@ export var SummaryModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
187
209
|
key: "getSurchargeforUtils",
|
|
188
210
|
value: function getSurchargeforUtils(items) {
|
|
189
211
|
// const surchargeList = this.store.surchargeList;
|
|
212
|
+
var scheduleModule = this.core.getModule('appointmentBooking_schedule');
|
|
213
|
+
var needScheduleIds = this.store.surchargeList.map(function (item) {
|
|
214
|
+
return item.available_schedule_ids;
|
|
215
|
+
}).flat();
|
|
216
|
+
var scheduleList = scheduleModule === null || scheduleModule === void 0 ? void 0 : scheduleModule.getScheduleListByIds(needScheduleIds);
|
|
217
|
+
var scheduleById = {};
|
|
218
|
+
if (Array.isArray(scheduleList)) {
|
|
219
|
+
var _iterator2 = _createForOfIteratorHelper(scheduleList),
|
|
220
|
+
_step2;
|
|
221
|
+
try {
|
|
222
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
223
|
+
var item = _step2.value;
|
|
224
|
+
scheduleById[item.id] = item;
|
|
225
|
+
}
|
|
226
|
+
} catch (err) {
|
|
227
|
+
_iterator2.e(err);
|
|
228
|
+
} finally {
|
|
229
|
+
_iterator2.f();
|
|
230
|
+
}
|
|
231
|
+
}
|
|
190
232
|
var surchargeList = getSurcharge({
|
|
191
233
|
service: items,
|
|
192
234
|
addons: [],
|
|
@@ -196,7 +238,7 @@ export var SummaryModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
196
238
|
isEdit: false,
|
|
197
239
|
isInScheduleByDate: ScheduleModule.isInScheduleByDate,
|
|
198
240
|
surcharge_list: this.store.surchargeList,
|
|
199
|
-
scheduleById:
|
|
241
|
+
scheduleById: scheduleById
|
|
200
242
|
});
|
|
201
243
|
var surchargeAmount = new Decimal(getSurchargeAmount({
|
|
202
244
|
bookingDetail: null,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import Decimal from 'decimal.js';
|
|
2
2
|
import { CartItem } from '../Cart/types';
|
|
3
3
|
import { ISummaryState } from './types';
|
|
4
|
-
export declare const calculatePriceDetails: (shopInfo: any, items: CartItem[], isInScheduleByDate: any, surchargeList: any[]) => ISummaryState['summary'];
|
|
4
|
+
export declare const calculatePriceDetails: (shopInfo: any, items: CartItem[], isInScheduleByDate: any, surchargeList: any[], scheduleById: Record<string, any>) => ISummaryState['summary'];
|
|
5
5
|
/**
|
|
6
6
|
* 获取子商品折扣信息
|
|
7
7
|
* @param item
|
|
@@ -58,12 +58,6 @@ export declare const getTax: ({ service, addons, bookingDetail, bookingId }: {
|
|
|
58
58
|
* @returns 商品总价字符串,保留2位小数
|
|
59
59
|
*/
|
|
60
60
|
export declare const calculateSubtotal: (items: CartItem[]) => string;
|
|
61
|
-
/**
|
|
62
|
-
* 计算商品小计(不含其他费用 不包含折扣卡商品券抵扣金额)
|
|
63
|
-
* @param items - 购物车商品数组
|
|
64
|
-
* @returns 商品总价字符串,保留2位小数
|
|
65
|
-
*/
|
|
66
|
-
export declare const calculateOriginSubtotal: (items: CartItem[]) => string;
|
|
67
61
|
/**
|
|
68
62
|
* @title: 单个商品的税费
|
|
69
63
|
* @description:
|
|
@@ -16,9 +16,10 @@ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symb
|
|
|
16
16
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
17
17
|
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; }
|
|
18
18
|
import Decimal from 'decimal.js';
|
|
19
|
-
|
|
19
|
+
import { isNormalProduct } from "../Product/utils";
|
|
20
|
+
import dayjs from 'dayjs';
|
|
21
|
+
export var calculatePriceDetails = function calculatePriceDetails(shopInfo, items, isInScheduleByDate, surchargeList, scheduleById) {
|
|
20
22
|
var subtotal = new Decimal(calculateSubtotal(items));
|
|
21
|
-
var subOriginTotal = new Decimal(calculateOriginSubtotal(items));
|
|
22
23
|
var totalTaxFee = new Decimal(calculateTaxFee(shopInfo, items));
|
|
23
24
|
// 订单附加费列表
|
|
24
25
|
var surcharge = getSurcharge({
|
|
@@ -30,7 +31,7 @@ export var calculatePriceDetails = function calculatePriceDetails(shopInfo, item
|
|
|
30
31
|
isEdit: false,
|
|
31
32
|
isInScheduleByDate: isInScheduleByDate,
|
|
32
33
|
surcharge_list: surchargeList,
|
|
33
|
-
scheduleById:
|
|
34
|
+
scheduleById: scheduleById
|
|
34
35
|
});
|
|
35
36
|
// 订单附加费金额
|
|
36
37
|
var surchargeAmount = new Decimal(getSurchargeAmount({
|
|
@@ -57,15 +58,11 @@ export var calculatePriceDetails = function calculatePriceDetails(shopInfo, item
|
|
|
57
58
|
originTax = _getTax.originTax;
|
|
58
59
|
var total = shopInfo !== null && shopInfo !== void 0 && shopInfo.is_price_include_tax ? subtotal.plus(surchargeAmount) : subtotal.plus(tax).plus(surchargeAmount);
|
|
59
60
|
|
|
60
|
-
// 计算总价 不包含折扣卡商品券折扣信息价格
|
|
61
|
-
var originTotal = shopInfo !== null && shopInfo !== void 0 && shopInfo.is_price_include_tax ? subOriginTotal : subOriginTotal.plus(totalTaxFee);
|
|
62
|
-
|
|
63
61
|
// 计算定金
|
|
64
62
|
var deposit = calculateDeposit(items);
|
|
65
63
|
return {
|
|
66
64
|
subtotal: subtotal.toFixed(2),
|
|
67
65
|
total: total.toFixed(2),
|
|
68
|
-
originTotal: originTotal.toFixed(2),
|
|
69
66
|
taxTitle: shopInfo === null || shopInfo === void 0 ? void 0 : shopInfo.tax_title,
|
|
70
67
|
taxRate: shopInfo === null || shopInfo === void 0 ? void 0 : shopInfo.tax_rate,
|
|
71
68
|
totalTaxFee: tax,
|
|
@@ -575,22 +572,6 @@ export var calculateSubtotal = function calculateSubtotal(items) {
|
|
|
575
572
|
return subtotal.toFixed(2);
|
|
576
573
|
};
|
|
577
574
|
|
|
578
|
-
/**
|
|
579
|
-
* 计算商品小计(不含其他费用 不包含折扣卡商品券抵扣金额)
|
|
580
|
-
* @param items - 购物车商品数组
|
|
581
|
-
* @returns 商品总价字符串,保留2位小数
|
|
582
|
-
*/
|
|
583
|
-
export var calculateOriginSubtotal = function calculateOriginSubtotal(items) {
|
|
584
|
-
if (!(items !== null && items !== void 0 && items.length)) {
|
|
585
|
-
return '0.00';
|
|
586
|
-
}
|
|
587
|
-
var subtotal = items.reduce(function (sum, item) {
|
|
588
|
-
var cartItemTotalPrice = new Decimal(item.summaryOriginTotal || 0);
|
|
589
|
-
return sum.plus(cartItemTotalPrice);
|
|
590
|
-
}, new Decimal(0));
|
|
591
|
-
return subtotal.toFixed(2);
|
|
592
|
-
};
|
|
593
|
-
|
|
594
575
|
/**
|
|
595
576
|
* @title: 单个商品的税费
|
|
596
577
|
* @description:
|
|
@@ -736,12 +717,8 @@ var getMainProductTotal = function getMainProductTotal(item) {
|
|
|
736
717
|
var bundleItem = _step4.value;
|
|
737
718
|
if (getBundleItemIsMarkupOrDiscountPrice(bundleItem)) {
|
|
738
719
|
var _ref10, _bundleItem$bundle_se2;
|
|
739
|
-
//
|
|
740
|
-
var
|
|
741
|
-
// 子商品价格
|
|
742
|
-
var bundleItemPrice = new Decimal((_ref10 = (_bundleItem$bundle_se2 = bundleItem.bundle_selling_price) !== null && _bundleItem$bundle_se2 !== void 0 ? _bundleItem$bundle_se2 : bundleItem.price) !== null && _ref10 !== void 0 ? _ref10 : 0);
|
|
743
|
-
// todo: 套餐子商品后不需要处理 子商品价格 - 子商品折扣金额
|
|
744
|
-
var bundleItemTotal = bundleItemPrice.minus(discountAmount);
|
|
720
|
+
// IMPORTANT: 套餐子商品如果应用了 discount,bundle_selling_price和 price 其实都已经是折后价格了,不需要单独再减一次
|
|
721
|
+
var bundleItemTotal = new Decimal((_ref10 = (_bundleItem$bundle_se2 = bundleItem.bundle_selling_price) !== null && _bundleItem$bundle_se2 !== void 0 ? _bundleItem$bundle_se2 : bundleItem.price) !== null && _ref10 !== void 0 ? _ref10 : 0);
|
|
745
722
|
total = total.add(bundleItemTotal);
|
|
746
723
|
}
|
|
747
724
|
}
|
|
@@ -862,6 +839,7 @@ var isProductMatchSurchargeCondition = function isProductMatchSurchargeCondition
|
|
|
862
839
|
* @returns 附加费列表(仅返回金额 > 0 的项)
|
|
863
840
|
*/
|
|
864
841
|
export var getSurcharge = function getSurcharge(_ref11, options) {
|
|
842
|
+
var _service$filter;
|
|
865
843
|
var service = _ref11.service,
|
|
866
844
|
addons = _ref11.addons,
|
|
867
845
|
bookingDetail = _ref11.bookingDetail,
|
|
@@ -870,6 +848,16 @@ export var getSurcharge = function getSurcharge(_ref11, options) {
|
|
|
870
848
|
isInScheduleByDate = options.isInScheduleByDate,
|
|
871
849
|
surcharge_list = options.surcharge_list,
|
|
872
850
|
scheduleById = options.scheduleById;
|
|
851
|
+
// 在所有商品里试着找 start_date,如果没有则用当前时间
|
|
852
|
+
var firstAppointmentCartItem = (_service$filter = service.filter(function (n) {
|
|
853
|
+
return !isNormalProduct(n._productOrigin);
|
|
854
|
+
})) === null || _service$filter === void 0 ? void 0 : _service$filter[0];
|
|
855
|
+
var startDate = '';
|
|
856
|
+
if (firstAppointmentCartItem) {
|
|
857
|
+
startDate = firstAppointmentCartItem.start_date + ' ' + firstAppointmentCartItem.start_time + ':00';
|
|
858
|
+
} else {
|
|
859
|
+
startDate = dayjs().format('YYYY-MM-DD HH:mm:ss');
|
|
860
|
+
}
|
|
873
861
|
// 编辑状态, 且未修改商品时直接从详情取出
|
|
874
862
|
if (!isEdit && bookingId) {
|
|
875
863
|
if (Array.isArray(bookingDetail === null || bookingDetail === void 0 ? void 0 : bookingDetail.surcharge)) {
|
|
@@ -936,7 +924,7 @@ export var getSurcharge = function getSurcharge(_ref11, options) {
|
|
|
936
924
|
// 主商品符合附加费条件
|
|
937
925
|
if (isProductMatchSurchargeCondition({
|
|
938
926
|
isCustomItem: item.isCustomItem,
|
|
939
|
-
startDate:
|
|
927
|
+
startDate: startDate,
|
|
940
928
|
product_id: item.id
|
|
941
929
|
}, {
|
|
942
930
|
surchargeConfig: surchargeConfig,
|
|
@@ -970,7 +958,7 @@ export var getSurcharge = function getSurcharge(_ref11, options) {
|
|
|
970
958
|
// bundle商品是原价且符合附加费条件
|
|
971
959
|
if (getBundleItemIsOriginalPrice(bundleItem) && isProductMatchSurchargeCondition({
|
|
972
960
|
isCustomItem: false,
|
|
973
|
-
startDate:
|
|
961
|
+
startDate: startDate,
|
|
974
962
|
product_id: bundleItem._bundle_product_id
|
|
975
963
|
}, {
|
|
976
964
|
surchargeConfig: surchargeConfig,
|
|
@@ -1002,7 +990,7 @@ export var getSurcharge = function getSurcharge(_ref11, options) {
|
|
|
1002
990
|
var relationDetail = _step7.value;
|
|
1003
991
|
if (isProductMatchSurchargeCondition({
|
|
1004
992
|
isCustomItem: false,
|
|
1005
|
-
startDate:
|
|
993
|
+
startDate: startDate,
|
|
1006
994
|
product_id: relationDetail.product_id
|
|
1007
995
|
}, {
|
|
1008
996
|
surchargeConfig: surchargeConfig,
|
|
@@ -1039,7 +1027,9 @@ export var getSurcharge = function getSurcharge(_ref11, options) {
|
|
|
1039
1027
|
try {
|
|
1040
1028
|
for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
|
|
1041
1029
|
var _item = _step8.value;
|
|
1042
|
-
if (isProductMatchSurchargeCondition(_item, {
|
|
1030
|
+
if (isProductMatchSurchargeCondition(_objectSpread(_objectSpread({}, _item), {}, {
|
|
1031
|
+
startDate: startDate
|
|
1032
|
+
}), {
|
|
1043
1033
|
surchargeConfig: surchargeConfig,
|
|
1044
1034
|
scheduleById: scheduleById || {},
|
|
1045
1035
|
isInScheduleByDate: isInScheduleByDate
|
package/dist/plugins/window.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { WalletPassEvaluator } from '../model';
|
|
2
1
|
import { Plugin } from '../types';
|
|
3
2
|
/**
|
|
4
3
|
* WindowPlugin 接口定义
|
|
@@ -15,7 +14,6 @@ export interface WindowPlugin extends Plugin {
|
|
|
15
14
|
document: Partial<Document>;
|
|
16
15
|
history: History;
|
|
17
16
|
interaction?: any;
|
|
18
|
-
getWalletPassEvaluator?: () => WalletPassEvaluator;
|
|
19
17
|
}
|
|
20
18
|
/**
|
|
21
19
|
* 简单的 Storage 接口实现
|
|
@@ -144,7 +144,6 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
144
144
|
getSummary(): Promise<{
|
|
145
145
|
subtotal: string | number;
|
|
146
146
|
total: string | number;
|
|
147
|
-
originTotal: string | number;
|
|
148
147
|
taxTitle?: string | undefined;
|
|
149
148
|
totalTaxFee?: string | number | undefined;
|
|
150
149
|
isPriceIncludeTax?: 0 | 1 | undefined;
|
|
@@ -2552,14 +2552,63 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2552
2552
|
var targetResourceTimes = allResources === null || allResources === void 0 || (_allResources$find = allResources.find(function (n) {
|
|
2553
2553
|
return n.id === resource.id;
|
|
2554
2554
|
})) === null || _allResources$find === void 0 ? void 0 : _allResources$find.times;
|
|
2555
|
+
// 找到最晚的 end_at 还没用,因为可能存在资源工作时间是 10:00-19:00,但是资源的 times 里有 16:30-19:00 被 block 的情况
|
|
2556
|
+
// 所以还需要排除掉 block 时间
|
|
2557
|
+
function getEarliestBlockedStartTime(_ref11) {
|
|
2558
|
+
var _earliestBlockStart;
|
|
2559
|
+
var currentStartTime = _ref11.currentStartTime,
|
|
2560
|
+
times = _ref11.times;
|
|
2561
|
+
var currentStart = dayjs(currentStartTime);
|
|
2562
|
+
var earliestBlockStart;
|
|
2563
|
+
var _iterator3 = _createForOfIteratorHelper(times || []),
|
|
2564
|
+
_step3;
|
|
2565
|
+
try {
|
|
2566
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
2567
|
+
var time = _step3.value;
|
|
2568
|
+
var _iterator4 = _createForOfIteratorHelper(time.event_list || []),
|
|
2569
|
+
_step4;
|
|
2570
|
+
try {
|
|
2571
|
+
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
2572
|
+
var event = _step4.value;
|
|
2573
|
+
var eventStart = dayjs(event.start_at);
|
|
2574
|
+
var eventEnd = dayjs(event.end_at);
|
|
2575
|
+
if (eventStart.isBefore(currentStart) && eventEnd.isAfter(currentStart)) {
|
|
2576
|
+
return currentStart.format('YYYY-MM-DD HH:mm');
|
|
2577
|
+
}
|
|
2578
|
+
if (eventStart.isAfter(currentStart)) {
|
|
2579
|
+
if (!earliestBlockStart || eventStart.isBefore(earliestBlockStart)) {
|
|
2580
|
+
earliestBlockStart = eventStart;
|
|
2581
|
+
}
|
|
2582
|
+
}
|
|
2583
|
+
}
|
|
2584
|
+
} catch (err) {
|
|
2585
|
+
_iterator4.e(err);
|
|
2586
|
+
} finally {
|
|
2587
|
+
_iterator4.f();
|
|
2588
|
+
}
|
|
2589
|
+
}
|
|
2590
|
+
} catch (err) {
|
|
2591
|
+
_iterator3.e(err);
|
|
2592
|
+
} finally {
|
|
2593
|
+
_iterator3.f();
|
|
2594
|
+
}
|
|
2595
|
+
return (_earliestBlockStart = earliestBlockStart) === null || _earliestBlockStart === void 0 ? void 0 : _earliestBlockStart.format('YYYY-MM-DD HH:mm');
|
|
2596
|
+
}
|
|
2555
2597
|
var resourcesEndTime = targetResourceTimes.reduce(function (acc, curr) {
|
|
2556
2598
|
return dayjs(curr.end_at).isAfter(dayjs(acc.end_at)) ? curr : acc;
|
|
2557
2599
|
}, targetResourceTimes[0]);
|
|
2600
|
+
var earliestBlockedStartTime = getEarliestBlockedStartTime({
|
|
2601
|
+
currentStartTime: currentStartTime,
|
|
2602
|
+
times: targetResourceTimes
|
|
2603
|
+
});
|
|
2558
2604
|
|
|
2559
2605
|
// 将 operating_day_boundary 转换为与 resourcesEndTime.end_at 相同日期的完整日期时间
|
|
2560
2606
|
var resourceDate = dayjs(resourcesEndTime.end_at).format('YYYY-MM-DD');
|
|
2561
2607
|
var operatingBoundaryDateTime = "".concat(resourceDate, " ").concat(operating_day_boundary.type === 'start_time' ? '23:59' : operating_day_boundary.time);
|
|
2562
|
-
var
|
|
2608
|
+
var endTimeCandidates = [resourcesEndTime.end_at, operatingBoundaryDateTime].concat(_toConsumableArray(earliestBlockedStartTime ? [earliestBlockedStartTime] : []));
|
|
2609
|
+
var endTime = endTimeCandidates.reduce(function (earliest, value) {
|
|
2610
|
+
return dayjs(value).isBefore(dayjs(earliest)) ? value : earliest;
|
|
2611
|
+
}, endTimeCandidates[0]);
|
|
2563
2612
|
// 修复:如果 endTime 只是时间格式(如 "17:00"),需要加上日期
|
|
2564
2613
|
var formattedEndTime;
|
|
2565
2614
|
if (typeof endTime === 'string' && endTime.includes(':') && !endTime.includes(' ') && !endTime.includes('T')) {
|
|
@@ -2700,14 +2749,14 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2700
2749
|
// 通过商品和 schedule 来获取视频可用的时间片、时间片内资源可用的数据
|
|
2701
2750
|
}, {
|
|
2702
2751
|
key: "getTimeslotBySchedule",
|
|
2703
|
-
value: function getTimeslotBySchedule(
|
|
2752
|
+
value: function getTimeslotBySchedule(_ref12) {
|
|
2704
2753
|
var _this$store$currentPr2,
|
|
2705
2754
|
_targetProductData$pr,
|
|
2706
2755
|
_this15 = this;
|
|
2707
|
-
var date =
|
|
2708
|
-
scheduleIds =
|
|
2709
|
-
resources =
|
|
2710
|
-
product =
|
|
2756
|
+
var date = _ref12.date,
|
|
2757
|
+
scheduleIds = _ref12.scheduleIds,
|
|
2758
|
+
resources = _ref12.resources,
|
|
2759
|
+
product = _ref12.product;
|
|
2711
2760
|
var targetProduct = this.store.currentProduct;
|
|
2712
2761
|
// 如果外面传递了product 优先用外面的
|
|
2713
2762
|
var targetProductData = product || targetProduct;
|
|
@@ -3266,12 +3315,12 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3266
3315
|
// 检查资源类型(单个预约 vs 多个预约)
|
|
3267
3316
|
// 从商品配置中获取资源类型信息
|
|
3268
3317
|
var resourceTypeConfig = null;
|
|
3269
|
-
var
|
|
3270
|
-
|
|
3318
|
+
var _iterator5 = _createForOfIteratorHelper(items),
|
|
3319
|
+
_step5;
|
|
3271
3320
|
try {
|
|
3272
|
-
for (
|
|
3321
|
+
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
|
|
3273
3322
|
var _cartItem$_productOri12;
|
|
3274
|
-
var cartItem =
|
|
3323
|
+
var cartItem = _step5.value;
|
|
3275
3324
|
if ((_cartItem$_productOri12 = cartItem._productOrigin) !== null && _cartItem$_productOri12 !== void 0 && (_cartItem$_productOri12 = _cartItem$_productOri12.product_resource) !== null && _cartItem$_productOri12 !== void 0 && _cartItem$_productOri12.resources) {
|
|
3276
3325
|
resourceTypeConfig = cartItem._productOrigin.product_resource.resources.find(function (r) {
|
|
3277
3326
|
return r.code === resourceCode && r.status === 1;
|
|
@@ -3280,9 +3329,9 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3280
3329
|
}
|
|
3281
3330
|
}
|
|
3282
3331
|
} catch (err) {
|
|
3283
|
-
|
|
3332
|
+
_iterator5.e(err);
|
|
3284
3333
|
} finally {
|
|
3285
|
-
|
|
3334
|
+
_iterator5.f();
|
|
3286
3335
|
}
|
|
3287
3336
|
var isMultipleBooking = ((_resourceTypeConfig = resourceTypeConfig) === null || _resourceTypeConfig === void 0 ? void 0 : _resourceTypeConfig.type) === 'multiple';
|
|
3288
3337
|
var totalAvailable;
|
|
@@ -3485,17 +3534,17 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3485
3534
|
*/
|
|
3486
3535
|
}, {
|
|
3487
3536
|
key: "convertProductToCartItem",
|
|
3488
|
-
value: function convertProductToCartItem(
|
|
3489
|
-
var product =
|
|
3490
|
-
date =
|
|
3491
|
-
account =
|
|
3492
|
-
var
|
|
3493
|
-
bundle =
|
|
3494
|
-
options =
|
|
3495
|
-
origin =
|
|
3496
|
-
product_variant_id =
|
|
3497
|
-
|
|
3498
|
-
quantity =
|
|
3537
|
+
value: function convertProductToCartItem(_ref13) {
|
|
3538
|
+
var product = _ref13.product,
|
|
3539
|
+
date = _ref13.date,
|
|
3540
|
+
account = _ref13.account;
|
|
3541
|
+
var _ref14 = product || {},
|
|
3542
|
+
bundle = _ref14.bundle,
|
|
3543
|
+
options = _ref14.options,
|
|
3544
|
+
origin = _ref14.origin,
|
|
3545
|
+
product_variant_id = _ref14.product_variant_id,
|
|
3546
|
+
_ref14$quantity = _ref14.quantity,
|
|
3547
|
+
quantity = _ref14$quantity === void 0 ? 1 : _ref14$quantity;
|
|
3499
3548
|
|
|
3500
3549
|
// 处理商品数据,类似 addProductToCart 中的逻辑
|
|
3501
3550
|
var productData = _objectSpread(_objectSpread({}, origin), {}, {
|
|
@@ -3550,11 +3599,11 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3550
3599
|
}
|
|
3551
3600
|
}, {
|
|
3552
3601
|
key: "checkMaxDurationCapacityForDetailNums",
|
|
3553
|
-
value: function checkMaxDurationCapacityForDetailNums(
|
|
3602
|
+
value: function checkMaxDurationCapacityForDetailNums(_ref15) {
|
|
3554
3603
|
var _this17 = this;
|
|
3555
|
-
var product =
|
|
3556
|
-
date =
|
|
3557
|
-
account =
|
|
3604
|
+
var product = _ref15.product,
|
|
3605
|
+
date = _ref15.date,
|
|
3606
|
+
account = _ref15.account;
|
|
3558
3607
|
var cartItems = this.store.cart.getItems().filter(function (item) {
|
|
3559
3608
|
return !isNormalProduct(item._productOrigin);
|
|
3560
3609
|
});
|
|
@@ -3699,12 +3748,12 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3699
3748
|
// 检查资源类型(单个预约 vs 多个预约)
|
|
3700
3749
|
// 从商品配置中获取资源类型信息
|
|
3701
3750
|
var resourceTypeConfig = null;
|
|
3702
|
-
var
|
|
3703
|
-
|
|
3751
|
+
var _iterator6 = _createForOfIteratorHelper(items),
|
|
3752
|
+
_step6;
|
|
3704
3753
|
try {
|
|
3705
|
-
for (
|
|
3754
|
+
for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
|
|
3706
3755
|
var _cartItem$_productOri15;
|
|
3707
|
-
var cartItem =
|
|
3756
|
+
var cartItem = _step6.value;
|
|
3708
3757
|
if ((_cartItem$_productOri15 = cartItem._productOrigin) !== null && _cartItem$_productOri15 !== void 0 && (_cartItem$_productOri15 = _cartItem$_productOri15.product_resource) !== null && _cartItem$_productOri15 !== void 0 && _cartItem$_productOri15.resources) {
|
|
3709
3758
|
resourceTypeConfig = cartItem._productOrigin.product_resource.resources.find(function (r) {
|
|
3710
3759
|
return r.code === resourceCode && r.status === 1;
|
|
@@ -3713,9 +3762,9 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3713
3762
|
}
|
|
3714
3763
|
}
|
|
3715
3764
|
} catch (err) {
|
|
3716
|
-
|
|
3765
|
+
_iterator6.e(err);
|
|
3717
3766
|
} finally {
|
|
3718
|
-
|
|
3767
|
+
_iterator6.f();
|
|
3719
3768
|
}
|
|
3720
3769
|
var isMultipleBooking = ((_resourceTypeConfig2 = resourceTypeConfig) === null || _resourceTypeConfig2 === void 0 ? void 0 : _resourceTypeConfig2.type) === 'multiple';
|
|
3721
3770
|
var totalAvailable;
|
|
@@ -4086,12 +4135,12 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4086
4135
|
}, {
|
|
4087
4136
|
key: "getTimeslotsScheduleByDateRange",
|
|
4088
4137
|
value: (function () {
|
|
4089
|
-
var _getTimeslotsScheduleByDateRange = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(
|
|
4138
|
+
var _getTimeslotsScheduleByDateRange = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(_ref16) {
|
|
4090
4139
|
var startDate, endDate, scheduleIds, resources, dates, currentDate, end, results, _i5, _dates, date;
|
|
4091
4140
|
return _regeneratorRuntime().wrap(function _callee27$(_context28) {
|
|
4092
4141
|
while (1) switch (_context28.prev = _context28.next) {
|
|
4093
4142
|
case 0:
|
|
4094
|
-
startDate =
|
|
4143
|
+
startDate = _ref16.startDate, endDate = _ref16.endDate, scheduleIds = _ref16.scheduleIds, resources = _ref16.resources;
|
|
4095
4144
|
console.log('appoimentBooking-session-date-getTimeslotsScheduleByDateRange', {
|
|
4096
4145
|
startDate: startDate,
|
|
4097
4146
|
endDate: endDate,
|
|
@@ -403,7 +403,6 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
403
403
|
product_id: item.product_id,
|
|
404
404
|
product_variant_id: item.product_variant_id,
|
|
405
405
|
quantity: item.num,
|
|
406
|
-
is_price_include_tax: item.is_price_include_tax,
|
|
407
406
|
// 商品是否含税:1;0
|
|
408
407
|
is_charge_tax: (_item$is_charge_tax = item.is_charge_tax) !== null && _item$is_charge_tax !== void 0 ? _item$is_charge_tax : 0,
|
|
409
408
|
// 若商品不含税,计算得到的税费,单位(元)
|
|
@@ -428,7 +427,6 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
428
427
|
},
|
|
429
428
|
product_bundle: item.product_bundle.map(function (bundle) {
|
|
430
429
|
return {
|
|
431
|
-
is_price_include_tax: item.is_price_include_tax,
|
|
432
430
|
bundle_id: bundle.bundle_id,
|
|
433
431
|
bundle_product_id: bundle.bundle_product_id,
|
|
434
432
|
bundle_variant_id: bundle.bundle_variant_id,
|
|
@@ -22,7 +22,6 @@ export declare class ShopDiscountImpl extends BaseModule implements Module {
|
|
|
22
22
|
getCurrentBookingTime(): string | null;
|
|
23
23
|
private filterDiscountListByBookingTime;
|
|
24
24
|
setCustomer(customer: Customer): Promise<void>;
|
|
25
|
-
setOriginTotalAmount(amount: number): void;
|
|
26
25
|
setHolders(holders: {
|
|
27
26
|
form_record_id: number;
|
|
28
27
|
}[]): void;
|
|
@@ -56,7 +56,6 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
56
56
|
originalDiscountList: [],
|
|
57
57
|
currentBookingTime: "",
|
|
58
58
|
filteredDiscountList: [],
|
|
59
|
-
orderTotalAmount: 0,
|
|
60
59
|
bookingSubject: undefined
|
|
61
60
|
};
|
|
62
61
|
return _this;
|
|
@@ -289,14 +288,7 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
289
288
|
return _setCustomer.apply(this, arguments);
|
|
290
289
|
}
|
|
291
290
|
return setCustomer;
|
|
292
|
-
}()
|
|
293
|
-
}, {
|
|
294
|
-
key: "setOriginTotalAmount",
|
|
295
|
-
value: function setOriginTotalAmount(amount) {
|
|
296
|
-
this.store.orderTotalAmount = amount;
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
// 设置holders
|
|
291
|
+
}() // 设置holders
|
|
300
292
|
}, {
|
|
301
293
|
key: "setHolders",
|
|
302
294
|
value: function setHolders(holders) {
|
|
@@ -325,7 +317,6 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
325
317
|
productList: productList,
|
|
326
318
|
discountList: this.getDiscountList(),
|
|
327
319
|
holders: this.store.holders || [],
|
|
328
|
-
orderTotalAmount: this.store.orderTotalAmount || 0,
|
|
329
320
|
isFormSubject: ((_this$store$bookingSu = this.store.bookingSubject) === null || _this$store$bookingSu === void 0 ? void 0 : _this$store$bookingSu.type) === 'form'
|
|
330
321
|
}, options) || {
|
|
331
322
|
productList: productList,
|
|
@@ -467,7 +458,6 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
467
458
|
oldDiscountList: this.getDiscountList(),
|
|
468
459
|
newDiscountList: withScanList,
|
|
469
460
|
holders: this.store.holders || [],
|
|
470
|
-
orderTotalAmount: this.store.orderTotalAmount || 0,
|
|
471
461
|
isFormSubject: ((_this$store$bookingSu2 = this.store.bookingSubject) === null || _this$store$bookingSu2 === void 0 ? void 0 : _this$store$bookingSu2.type) === 'form'
|
|
472
462
|
}) || {
|
|
473
463
|
isAvailable: false,
|
|
@@ -755,7 +745,8 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
755
745
|
action: 'create',
|
|
756
746
|
with_good_pass: 1,
|
|
757
747
|
with_discount_card: 1,
|
|
758
|
-
with_wallet_pass_holder: 1
|
|
748
|
+
with_wallet_pass_holder: 1,
|
|
749
|
+
request_timezone: Intl.DateTimeFormat().resolvedOptions().timeZone
|
|
759
750
|
});
|
|
760
751
|
case 4:
|
|
761
752
|
goodPassList = _context9.sent;
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -38,7 +38,6 @@ __reExport(src_exports, require("./types"), module.exports);
|
|
|
38
38
|
__reExport(src_exports, require("./modules"), module.exports);
|
|
39
39
|
__reExport(src_exports, require("./plugins"), module.exports);
|
|
40
40
|
__reExport(src_exports, require("./solution"), module.exports);
|
|
41
|
-
__reExport(src_exports, require("./model"), module.exports);
|
|
42
41
|
var import_core = require("./core");
|
|
43
42
|
var import_core2 = __toESM(require("./core"));
|
|
44
43
|
var src_default = import_core2.default;
|
|
@@ -48,6 +47,5 @@ var src_default = import_core2.default;
|
|
|
48
47
|
...require("./types"),
|
|
49
48
|
...require("./modules"),
|
|
50
49
|
...require("./plugins"),
|
|
51
|
-
...require("./solution")
|
|
52
|
-
...require("./model")
|
|
50
|
+
...require("./solution")
|
|
53
51
|
});
|