@pisell/private-materials 3.0.201 → 3.0.202
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/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/index.js +1 -1
- package/build/lowcode/meta.js +1 -1
- package/build/lowcode/preview.js +142 -142
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +12 -27
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +18 -33
- package/es/components/booking/addons/model.d.ts +1 -1
- package/es/components/booking/components/footer/amount.js +5 -4
- package/es/components/booking/components/footer/utils.js +49 -29
- package/es/components/booking/forms/model.d.ts +1 -1
- package/es/components/booking/info/Provider.d.ts +0 -0
- package/es/components/booking/info/Provider.js +54 -0
- package/es/components/booking/info/clientVariant/vertical/index.js +93 -7
- package/es/components/booking/info/main.js +10 -9
- package/es/components/booking/info/pet/ChangePetModal/index.js +38 -23
- package/es/components/booking/info/service/addService/index.js +70 -99
- package/es/components/booking/info/service/addService/utils.d.ts +1 -0
- package/es/components/booking/info/service/addService/utils.js +55 -3
- package/es/components/booking/info/service/editService/BookingList/index.d.ts +5 -0
- package/es/components/booking/info/service/editService/BookingList/index.js +39 -0
- package/es/components/booking/info/service/editService/EditTabs/index.d.ts +3 -0
- package/es/components/booking/info/service/editService/EditTabs/index.js +35 -0
- package/es/components/booking/info/service/editService/index.js +234 -142
- package/es/components/booking/info/service/serve.d.ts +10 -0
- package/es/components/booking/info/service/serve.js +28 -0
- package/es/components/booking/info/service/serviceManager/distributeDiscount.d.ts +11 -0
- package/es/components/booking/info/service/serviceManager/distributeDiscount.js +55 -0
- package/es/components/booking/info/service/serviceManager/index.d.ts +20 -0
- package/es/components/booking/info/service/serviceManager/index.js +277 -0
- package/es/components/booking/info/service/serviceManager/utils.d.ts +0 -0
- package/es/components/booking/info/service/serviceManager/utils.js +0 -0
- package/es/components/booking/info/service2/Group/utils.d.ts +14 -0
- package/es/components/booking/info/service2/Group/utils.js +146 -0
- package/es/components/booking/info/service2/Lists.js +27 -33
- package/es/components/booking/info/service2/index.d.ts +4 -1
- package/es/components/booking/info/service2/index.js +5 -6
- package/es/components/booking/info/service2/status.js +1 -1
- package/es/components/booking/info/service2/utils.d.ts +95 -3
- package/es/components/booking/info/service2/utils.js +676 -52
- package/es/components/booking/info/utils.d.ts +11 -0
- package/es/components/booking/info/utils.js +24 -0
- package/es/components/booking/locales.d.ts +6 -0
- package/es/components/booking/locales.js +9 -3
- package/es/components/booking/model.d.ts +1 -0
- package/es/components/booking/notes/index.d.ts +1 -1
- package/es/components/booking/notes/model.d.ts +1 -1
- package/es/components/booking/payments/index.d.ts +1 -1
- package/es/components/booking/payments/model.d.ts +1 -1
- package/es/components/booking/utils.js +5 -4
- package/es/components/eftpos/hooks.d.ts +4 -4
- package/es/components/eftposPay/amount.d.ts +1 -1
- package/es/components/eftposPay/component/step/index.d.ts +6 -6
- package/es/components/eftposPay/component/step/step.d.ts +4 -4
- package/es/components/eftposPay/hooks.d.ts +1 -1
- package/es/components/eftposPay/store/index.d.ts +1 -1
- package/es/components/eftposPay/tyro/hooks.d.ts +2 -2
- package/es/components/eftposPay/windcave/helper.d.ts +1 -1
- package/es/components/schedules/index.d.ts +1 -1
- package/es/components/schedules/model.d.ts +1 -1
- package/es/components/shoppingCart/components/Cart/Product.js +11 -39
- package/es/components/shoppingCart/components/Render/index.js +8 -7
- package/es/components/shoppingCart/components/SelectHolderModal/index.js +12 -4
- package/es/components/shoppingCart/hooks/useClearCart.js +10 -5
- package/es/components/shoppingCart/type.d.ts +1 -1
- package/es/components/shoppingCart/utils.js +2 -5
- package/lib/components/booking/addons/model.d.ts +1 -1
- package/lib/components/booking/components/footer/amount.js +4 -3
- package/lib/components/booking/components/footer/utils.js +28 -28
- package/lib/components/booking/forms/model.d.ts +1 -1
- package/lib/components/booking/info/Provider.d.ts +0 -0
- package/lib/components/booking/info/Provider.js +0 -0
- package/lib/components/booking/info/clientVariant/vertical/index.js +51 -1
- package/lib/components/booking/info/main.js +6 -5
- package/lib/components/booking/info/pet/ChangePetModal/index.js +33 -23
- package/lib/components/booking/info/service/addService/index.js +50 -92
- package/lib/components/booking/info/service/addService/utils.d.ts +1 -0
- package/lib/components/booking/info/service/addService/utils.js +27 -0
- package/lib/components/booking/info/service/editService/BookingList/index.d.ts +5 -0
- package/lib/components/booking/info/service/editService/BookingList/index.js +55 -0
- package/lib/components/booking/info/service/editService/EditTabs/index.d.ts +3 -0
- package/lib/components/booking/info/service/editService/EditTabs/index.js +75 -0
- package/lib/components/booking/info/service/editService/index.js +309 -234
- package/lib/components/booking/info/service/serve.d.ts +10 -0
- package/lib/components/booking/info/service/serve.js +7 -2
- package/lib/components/booking/info/service/serviceManager/distributeDiscount.d.ts +11 -0
- package/lib/components/booking/info/service/serviceManager/distributeDiscount.js +70 -0
- package/lib/components/booking/info/service/serviceManager/index.d.ts +20 -0
- package/lib/components/booking/info/service/serviceManager/index.js +207 -0
- package/lib/components/booking/info/service/serviceManager/utils.d.ts +0 -0
- package/lib/components/booking/info/service/serviceManager/utils.js +0 -0
- package/lib/components/booking/info/service2/Group/utils.d.ts +14 -0
- package/lib/components/booking/info/service2/Group/utils.js +142 -0
- package/lib/components/booking/info/service2/Lists.js +14 -12
- package/lib/components/booking/info/service2/index.d.ts +4 -1
- package/lib/components/booking/info/service2/index.js +5 -5
- package/lib/components/booking/info/service2/status.js +1 -1
- package/lib/components/booking/info/service2/utils.d.ts +95 -3
- package/lib/components/booking/info/service2/utils.js +401 -48
- package/lib/components/booking/info/utils.d.ts +11 -0
- package/lib/components/booking/info/utils.js +35 -0
- package/lib/components/booking/locales.d.ts +6 -0
- package/lib/components/booking/locales.js +9 -3
- package/lib/components/booking/model.d.ts +1 -0
- package/lib/components/booking/notes/index.d.ts +1 -1
- package/lib/components/booking/notes/model.d.ts +1 -1
- package/lib/components/booking/payments/index.d.ts +1 -1
- package/lib/components/booking/payments/model.d.ts +1 -1
- package/lib/components/booking/utils.js +3 -4
- package/lib/components/eftpos/hooks.d.ts +4 -4
- package/lib/components/eftposPay/amount.d.ts +1 -1
- package/lib/components/eftposPay/component/step/index.d.ts +6 -6
- package/lib/components/eftposPay/component/step/step.d.ts +4 -4
- package/lib/components/eftposPay/hooks.d.ts +1 -1
- package/lib/components/eftposPay/store/index.d.ts +1 -1
- package/lib/components/eftposPay/tyro/hooks.d.ts +2 -2
- package/lib/components/eftposPay/windcave/helper.d.ts +1 -1
- package/lib/components/schedules/index.d.ts +1 -1
- package/lib/components/schedules/model.d.ts +1 -1
- package/lib/components/shoppingCart/components/Cart/Product.js +6 -22
- package/lib/components/shoppingCart/components/Render/index.js +6 -10
- package/lib/components/shoppingCart/components/SelectHolderModal/index.js +12 -4
- package/lib/components/shoppingCart/hooks/useClearCart.js +4 -9
- package/lib/components/shoppingCart/type.d.ts +1 -1
- package/lib/components/shoppingCart/utils.js +2 -8
- package/package.json +3 -3
|
@@ -1,19 +1,39 @@
|
|
|
1
1
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
3
|
+
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."); }
|
|
4
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
5
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
6
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
7
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
8
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
9
|
+
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(_e2) { throw _e2; }, 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(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
10
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
11
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
12
|
+
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); }
|
|
13
|
+
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; }
|
|
14
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
15
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
2
16
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3
17
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
18
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
19
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
6
20
|
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
7
21
|
import { getNoResource } from "../../mock";
|
|
8
|
-
import { getErrorList } from "../../utils";
|
|
22
|
+
import { getErrorList, getProductTotalPrice } from "../../utils";
|
|
9
23
|
import { locales } from "@pisell/utils";
|
|
10
24
|
import dayjs from 'dayjs';
|
|
11
25
|
import { appointmentTypes, openingTime } from "./status";
|
|
26
|
+
import { postMultiDay } from "../service/serve";
|
|
12
27
|
import localeTexts from "../../locales";
|
|
28
|
+
import { concatBookings, isGroupBooking, getProductByGroupId } from "./Group/utils";
|
|
13
29
|
locales.init(localeTexts, localStorage.getItem('umi_locale') || 'en');
|
|
14
|
-
export var formatActiveKey = function formatActiveKey(lists, platform) {
|
|
30
|
+
export var formatActiveKey = function formatActiveKey(lists, platform, isEdit) {
|
|
15
31
|
if (!(lists !== null && lists !== void 0 && lists.length)) return [];
|
|
16
32
|
|
|
33
|
+
// 编辑时,必须有两个holder, 避免闪动问题
|
|
34
|
+
if (lists.length === 1 && isEdit) {
|
|
35
|
+
return [];
|
|
36
|
+
}
|
|
17
37
|
// 管理端默认打开最后一个holder
|
|
18
38
|
if (platform === 'shop') {
|
|
19
39
|
var _lists2;
|
|
@@ -141,6 +161,9 @@ var getHolderName = function getHolderName(state, id) {
|
|
|
141
161
|
});
|
|
142
162
|
return resource === null || resource === void 0 ? void 0 : resource.main_field;
|
|
143
163
|
};
|
|
164
|
+
export var isBookingProduct = function isBookingProduct(extension_type) {
|
|
165
|
+
return appointmentTypes.includes(extension_type);
|
|
166
|
+
};
|
|
144
167
|
|
|
145
168
|
/**
|
|
146
169
|
* @title: 是否是预约商品
|
|
@@ -149,8 +172,157 @@ var getHolderName = function getHolderName(state, id) {
|
|
|
149
172
|
* @Author: WangHan
|
|
150
173
|
* @Date: 2024-12-06 11:24
|
|
151
174
|
*/
|
|
152
|
-
export var
|
|
153
|
-
return
|
|
175
|
+
export var isDayBookingProduct = function isDayBookingProduct(item, state) {
|
|
176
|
+
return isBookingProduct(item === null || item === void 0 ? void 0 : item.extension_type) && isDayBooking(state);
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* @title: 更新商品数据
|
|
181
|
+
* @description:
|
|
182
|
+
* @param {any} state
|
|
183
|
+
* @param {string} type
|
|
184
|
+
* @param {any} _id // 商品id
|
|
185
|
+
* @param {any} other
|
|
186
|
+
* @return {*}
|
|
187
|
+
* @Author: WangHan
|
|
188
|
+
* @Date: 2025-01-03 15:00
|
|
189
|
+
*/
|
|
190
|
+
export var updateServices = function updateServices(state, currentItem, type, other) {
|
|
191
|
+
var _state$service;
|
|
192
|
+
var products = (state === null || state === void 0 ? void 0 : (_state$service = state.service) === null || _state$service === void 0 ? void 0 : _state$service.value) || [];
|
|
193
|
+
// currentItem 可能是单个 也可能是数组
|
|
194
|
+
var isGroup = isGroupBooking(currentItem._id);
|
|
195
|
+
// 删除
|
|
196
|
+
if (type === 'delete') {
|
|
197
|
+
var _products;
|
|
198
|
+
var deleteIds = [];
|
|
199
|
+
if (isGroup) {
|
|
200
|
+
debugger;
|
|
201
|
+
// 删除分组
|
|
202
|
+
deleteIds = getProductByGroupId(currentItem._id, products);
|
|
203
|
+
} else {
|
|
204
|
+
// 删除单个
|
|
205
|
+
deleteIds = [currentItem._id];
|
|
206
|
+
}
|
|
207
|
+
products = (_products = products) === null || _products === void 0 ? void 0 : _products.filter(function (item) {
|
|
208
|
+
return !deleteIds.includes(item === null || item === void 0 ? void 0 : item._id);
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
// 删除购物车
|
|
213
|
+
if (type === 'delete_holders') {
|
|
214
|
+
var _products2;
|
|
215
|
+
products = (_products2 = products) === null || _products2 === void 0 ? void 0 : _products2.filter(function (item) {
|
|
216
|
+
var _item$_extend;
|
|
217
|
+
return (item === null || item === void 0 ? void 0 : (_item$_extend = item._extend) === null || _item$_extend === void 0 ? void 0 : _item$_extend.holder_id) !== other;
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
// 更新商品的holder_id
|
|
222
|
+
if (type === 'update_holders') {
|
|
223
|
+
var _products3;
|
|
224
|
+
products = (_products3 = products) === null || _products3 === void 0 ? void 0 : _products3.map(function (item) {
|
|
225
|
+
var ids = currentItem.map(function (d) {
|
|
226
|
+
return d._id;
|
|
227
|
+
});
|
|
228
|
+
if (ids !== null && ids !== void 0 && ids.includes(item === null || item === void 0 ? void 0 : item._id)) {
|
|
229
|
+
var _extend = item._extend || {};
|
|
230
|
+
// 数组的话则是批量更新
|
|
231
|
+
if (Array.isArray(other)) {
|
|
232
|
+
var _other$find;
|
|
233
|
+
_extend.holder_id = (_other$find = other.find(function (other) {
|
|
234
|
+
return (other === null || other === void 0 ? void 0 : other._id) === (item === null || item === void 0 ? void 0 : item._id);
|
|
235
|
+
})) === null || _other$find === void 0 ? void 0 : _other$find.holder_id;
|
|
236
|
+
} else {
|
|
237
|
+
_extend.holder_id = other;
|
|
238
|
+
}
|
|
239
|
+
return item;
|
|
240
|
+
}
|
|
241
|
+
return item;
|
|
242
|
+
});
|
|
243
|
+
} else {
|
|
244
|
+
var _products4;
|
|
245
|
+
// 更新数据
|
|
246
|
+
products = (_products4 = products) === null || _products4 === void 0 ? void 0 : _products4.map(function (item) {
|
|
247
|
+
var updateIds = [];
|
|
248
|
+
if (isGroup) {
|
|
249
|
+
// 更新分组
|
|
250
|
+
updateIds = getProductByGroupId(currentItem._id, products);
|
|
251
|
+
} else {
|
|
252
|
+
// 更新单个
|
|
253
|
+
updateIds = [currentItem._id];
|
|
254
|
+
}
|
|
255
|
+
if (updateIds.includes(item._id)) {
|
|
256
|
+
if (type === 'like') {
|
|
257
|
+
var _extend = item._extend || {};
|
|
258
|
+
_extend.like_status = other === null || other === void 0 ? void 0 : other.like_status;
|
|
259
|
+
} else {
|
|
260
|
+
item = _objectSpread(_objectSpread({}, item), other);
|
|
261
|
+
}
|
|
262
|
+
return item;
|
|
263
|
+
}
|
|
264
|
+
return item;
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
return products;
|
|
268
|
+
};
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* @title: 格式化套餐
|
|
272
|
+
* @description:
|
|
273
|
+
* @param {any} bundle
|
|
274
|
+
* @return {*}
|
|
275
|
+
* @Author: WangHan
|
|
276
|
+
* @Date: 2025-01-03 00:03
|
|
277
|
+
*/
|
|
278
|
+
var formatBundle = function formatBundle(bundle) {
|
|
279
|
+
if (!(bundle !== null && bundle !== void 0 && bundle.length)) return [];
|
|
280
|
+
return bundle.map(function (item) {
|
|
281
|
+
return {
|
|
282
|
+
id: item === null || item === void 0 ? void 0 : item.id,
|
|
283
|
+
title: item === null || item === void 0 ? void 0 : item.title,
|
|
284
|
+
num: item === null || item === void 0 ? void 0 : item.num,
|
|
285
|
+
price: item === null || item === void 0 ? void 0 : item.price,
|
|
286
|
+
total: item === null || item === void 0 ? void 0 : item.price,
|
|
287
|
+
price_type: item === null || item === void 0 ? void 0 : item.price_type,
|
|
288
|
+
bundle_sum_price: item === null || item === void 0 ? void 0 : item.bundle_sum_price,
|
|
289
|
+
bundle_sum_type: item === null || item === void 0 ? void 0 : item.bundle_sum_type,
|
|
290
|
+
options: formatOptions(item === null || item === void 0 ? void 0 : item.option)
|
|
291
|
+
};
|
|
292
|
+
});
|
|
293
|
+
};
|
|
294
|
+
|
|
295
|
+
/**
|
|
296
|
+
* @title: 格式化单规格
|
|
297
|
+
* @description:
|
|
298
|
+
* @param {any} options
|
|
299
|
+
* @return {*}
|
|
300
|
+
* @Author: WangHan
|
|
301
|
+
* @Date: 2025-01-02 23:58
|
|
302
|
+
*/
|
|
303
|
+
var formatOptions = function formatOptions(options) {
|
|
304
|
+
if (!(options !== null && options !== void 0 && options.length)) return [];
|
|
305
|
+
return options.map(function (item) {
|
|
306
|
+
return {
|
|
307
|
+
id: item === null || item === void 0 ? void 0 : item.id,
|
|
308
|
+
name: item === null || item === void 0 ? void 0 : item.name,
|
|
309
|
+
num: item === null || item === void 0 ? void 0 : item.num,
|
|
310
|
+
price: item === null || item === void 0 ? void 0 : item.price,
|
|
311
|
+
total: item === null || item === void 0 ? void 0 : item.price,
|
|
312
|
+
origin_total: item === null || item === void 0 ? void 0 : item.original_price
|
|
313
|
+
};
|
|
314
|
+
});
|
|
315
|
+
};
|
|
316
|
+
export var formItems = function formItems(items) {
|
|
317
|
+
return items.map(function (d) {
|
|
318
|
+
return _objectSpread(_objectSpread({}, d), {}, {
|
|
319
|
+
start_date: d._extend.start_date,
|
|
320
|
+
end_date: d._extend.end_date,
|
|
321
|
+
num: d === null || d === void 0 ? void 0 : d._extend.quantity,
|
|
322
|
+
total: d._extend.total,
|
|
323
|
+
origin_total: d._extend.origin_total
|
|
324
|
+
});
|
|
325
|
+
});
|
|
154
326
|
};
|
|
155
327
|
|
|
156
328
|
/**
|
|
@@ -162,44 +334,86 @@ export var isAppointment = function isAppointment(item, state) {
|
|
|
162
334
|
* @Date: 2024-11-29 17:36
|
|
163
335
|
*/
|
|
164
336
|
export var formatProducts = function formatProducts(lists, state) {
|
|
337
|
+
var isRenderGroup = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
165
338
|
if (!(lists !== null && lists !== void 0 && lists.length)) return [];
|
|
166
|
-
console.log(lists, '
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
339
|
+
console.log(lists, 'wh9879');
|
|
340
|
+
var normalList = [];
|
|
341
|
+
var groupList = [];
|
|
342
|
+
var formItem = function formItem(item) {
|
|
343
|
+
var _item$_extend2, _item$_extend3, _item$_extend3$other, _item$_extend4, _item$_extend4$other, _item$_extend6, _item$_extend7, _item$_extend8, _item$_extend9, _item$_extend10, _item$_extend10$other, _item$_extend11, _item$_extend12, _resourceItem, _item$_extend13, _item$_extend14, _item$_extend15, _item$_extend16;
|
|
344
|
+
var _isDayBookingProduct = isDayBookingProduct(item, state);
|
|
345
|
+
var clientTitle = getHolderName(state, item === null || item === void 0 ? void 0 : (_item$_extend2 = item._extend) === null || _item$_extend2 === void 0 ? void 0 : _item$_extend2.holder_id);
|
|
346
|
+
var options = formatOptions(item === null || item === void 0 ? void 0 : (_item$_extend3 = item._extend) === null || _item$_extend3 === void 0 ? void 0 : (_item$_extend3$other = _item$_extend3.other) === null || _item$_extend3$other === void 0 ? void 0 : _item$_extend3$other.option);
|
|
347
|
+
var bundle = formatBundle(item === null || item === void 0 ? void 0 : (_item$_extend4 = item._extend) === null || _item$_extend4 === void 0 ? void 0 : (_item$_extend4$other = _item$_extend4.other) === null || _item$_extend4$other === void 0 ? void 0 : _item$_extend4$other.bundle);
|
|
348
|
+
// 是否是普通商品
|
|
349
|
+
var isNormalProduct = !appointmentTypes.includes(item === null || item === void 0 ? void 0 : item.extension_type);
|
|
350
|
+
var resourceItem = {};
|
|
351
|
+
var errorMessage = '';
|
|
352
|
+
if (_isDayBookingProduct) {
|
|
353
|
+
var _item$_extend5;
|
|
354
|
+
resourceItem = getResourceItem(item === null || item === void 0 ? void 0 : (_item$_extend5 = item._extend) === null || _item$_extend5 === void 0 ? void 0 : _item$_extend5.resource, state);
|
|
355
|
+
errorMessage = getErrorMessage(item, resourceItem, isDayBooking(state));
|
|
356
|
+
}
|
|
357
|
+
return {
|
|
358
|
+
id: item === null || item === void 0 ? void 0 : item.id,
|
|
359
|
+
_id: item === null || item === void 0 ? void 0 : item._id,
|
|
360
|
+
name: item === null || item === void 0 ? void 0 : item.title,
|
|
361
|
+
price: item === null || item === void 0 ? void 0 : (_item$_extend6 = item._extend) === null || _item$_extend6 === void 0 ? void 0 : _item$_extend6.price,
|
|
362
|
+
total: item === null || item === void 0 ? void 0 : (_item$_extend7 = item._extend) === null || _item$_extend7 === void 0 ? void 0 : _item$_extend7.total,
|
|
363
|
+
origin_total: item === null || item === void 0 ? void 0 : (_item$_extend8 = item._extend) === null || _item$_extend8 === void 0 ? void 0 : _item$_extend8.origin_total,
|
|
364
|
+
num: item === null || item === void 0 ? void 0 : item._extend.quantity,
|
|
365
|
+
image: item === null || item === void 0 ? void 0 : item.cover,
|
|
366
|
+
isShowNote: true,
|
|
367
|
+
note: item === null || item === void 0 ? void 0 : item.note,
|
|
368
|
+
like_status: item === null || item === void 0 ? void 0 : (_item$_extend9 = item._extend) === null || _item$_extend9 === void 0 ? void 0 : _item$_extend9.like_status,
|
|
369
|
+
bundle: bundle,
|
|
370
|
+
options: options,
|
|
371
|
+
errorMessage: errorMessage,
|
|
372
|
+
product_option_string: item === null || item === void 0 ? void 0 : (_item$_extend10 = item._extend) === null || _item$_extend10 === void 0 ? void 0 : (_item$_extend10$other = _item$_extend10.other) === null || _item$_extend10$other === void 0 ? void 0 : _item$_extend10$other.product_option_string,
|
|
373
|
+
discount_reason: item === null || item === void 0 ? void 0 : (_item$_extend11 = item._extend) === null || _item$_extend11 === void 0 ? void 0 : _item$_extend11.discount_reason,
|
|
374
|
+
resource_id: isNormalProduct ? 0 : item === null || item === void 0 ? void 0 : (_item$_extend12 = item._extend) === null || _item$_extend12 === void 0 ? void 0 : _item$_extend12.resource,
|
|
375
|
+
relation_form_name: isNormalProduct ? '' : ((_resourceItem = resourceItem) === null || _resourceItem === void 0 ? void 0 : _resourceItem.labelText) || item.relation_form_name,
|
|
376
|
+
holder_title: clientTitle,
|
|
377
|
+
start_date: !isNormalProduct ? item === null || item === void 0 ? void 0 : (_item$_extend13 = item._extend) === null || _item$_extend13 === void 0 ? void 0 : _item$_extend13.start_date : '',
|
|
378
|
+
end_date: !isNormalProduct ? item === null || item === void 0 ? void 0 : (_item$_extend14 = item._extend) === null || _item$_extend14 === void 0 ? void 0 : _item$_extend14.end_date : '',
|
|
379
|
+
holder_id: (item === null || item === void 0 ? void 0 : (_item$_extend15 = item._extend) === null || _item$_extend15 === void 0 ? void 0 : _item$_extend15.holder_id) || 0,
|
|
380
|
+
isNormalProduct: isNormalProduct,
|
|
381
|
+
locale: state.locale,
|
|
382
|
+
symbol: state.amountSymbol,
|
|
383
|
+
items: formItems((item === null || item === void 0 ? void 0 : (_item$_extend16 = item._extend) === null || _item$_extend16 === void 0 ? void 0 : _item$_extend16.items) || []),
|
|
384
|
+
_origin: item
|
|
385
|
+
};
|
|
386
|
+
};
|
|
387
|
+
|
|
388
|
+
// 将商品分为组商品和非组商品
|
|
389
|
+
lists.forEach(function (item) {
|
|
390
|
+
var _item$_extend17;
|
|
391
|
+
if (!(item !== null && item !== void 0 && (_item$_extend17 = item._extend) !== null && _item$_extend17 !== void 0 && _item$_extend17.groupId)) {
|
|
392
|
+
normalList.push(formItem(item));
|
|
393
|
+
} else {
|
|
394
|
+
groupList.push(item);
|
|
395
|
+
}
|
|
396
|
+
});
|
|
397
|
+
|
|
398
|
+
// 根据item._extend.groupId 进行分组
|
|
399
|
+
var groups = groupList.reduce(function (prev, item) {
|
|
400
|
+
var _item$_extend18;
|
|
401
|
+
var groupId = item === null || item === void 0 ? void 0 : (_item$_extend18 = item._extend) === null || _item$_extend18 === void 0 ? void 0 : _item$_extend18.groupId;
|
|
402
|
+
if (!prev[groupId]) {
|
|
403
|
+
prev[groupId] = [];
|
|
404
|
+
}
|
|
405
|
+
prev[groupId].push(item);
|
|
406
|
+
return prev;
|
|
407
|
+
}, {});
|
|
408
|
+
if (isRenderGroup) {
|
|
409
|
+
return Object.values(groups).map(function (d) {
|
|
410
|
+
return formItem(concatBookings(d));
|
|
411
|
+
}).concat(normalList);
|
|
412
|
+
} else {
|
|
413
|
+
return lists === null || lists === void 0 ? void 0 : lists.map(function (item) {
|
|
414
|
+
return formItem(item);
|
|
201
415
|
});
|
|
202
|
-
}
|
|
416
|
+
}
|
|
203
417
|
};
|
|
204
418
|
|
|
205
419
|
/**
|
|
@@ -218,8 +432,6 @@ export var disabledDate = function disabledDate(current, position, currentDate)
|
|
|
218
432
|
return false;
|
|
219
433
|
}
|
|
220
434
|
if (position === 'end' && current.endOf('day') && currentDate) {
|
|
221
|
-
console.log(currentDate, current, position, 'currentDate');
|
|
222
|
-
|
|
223
435
|
// 结束日期最大 = 开始日期 + 8个月
|
|
224
436
|
var endDisabled = currentDate.add(8, 'months').format('YYYY-MM-DD');
|
|
225
437
|
return dayjs(endDisabled) < current.startOf('day') || current.startOf('day') <= currentDate;
|
|
@@ -321,9 +533,9 @@ export var initDate = function initDate() {
|
|
|
321
533
|
* @Date: 2024-12-12 15:47
|
|
322
534
|
*/
|
|
323
535
|
export var isHasDayAppointmentProduct = function isHasDayAppointmentProduct(state) {
|
|
324
|
-
var _state$bookingConfig2, _state$bookingConfig3, _state$bookingConfig4, _state$bookingConfig5, _state$
|
|
536
|
+
var _state$bookingConfig2, _state$bookingConfig3, _state$bookingConfig4, _state$bookingConfig5, _state$service2, _state$pet2, _state$pet2$value;
|
|
325
537
|
var form_id = (state === null || state === void 0 ? void 0 : (_state$bookingConfig2 = state.bookingConfig) === null || _state$bookingConfig2 === void 0 ? void 0 : (_state$bookingConfig3 = _state$bookingConfig2.config) === null || _state$bookingConfig3 === void 0 ? void 0 : (_state$bookingConfig4 = _state$bookingConfig3.basic) === null || _state$bookingConfig4 === void 0 ? void 0 : (_state$bookingConfig5 = _state$bookingConfig4.appointment_subject) === null || _state$bookingConfig5 === void 0 ? void 0 : _state$bookingConfig5.form_id) || 0;
|
|
326
|
-
var services = ((_state$
|
|
538
|
+
var services = ((_state$service2 = state.service) === null || _state$service2 === void 0 ? void 0 : _state$service2.value) || [];
|
|
327
539
|
var pets = ((_state$pet2 = state.pet) === null || _state$pet2 === void 0 ? void 0 : (_state$pet2$value = _state$pet2.value) === null || _state$pet2$value === void 0 ? void 0 : _state$pet2$value[form_id]) || [];
|
|
328
540
|
|
|
329
541
|
// 没有任何一个预约商品则提示
|
|
@@ -340,8 +552,8 @@ export var isHasDayAppointmentProduct = function isHasDayAppointmentProduct(stat
|
|
|
340
552
|
// 如果该购物车中没选择任何商品,则不需要验证,所以直接用1来填充
|
|
341
553
|
// services: !holderProducts?.length ? [1] : holderProducts?.filter((d: any) => appointmentTypes.includes(d.extension_type))
|
|
342
554
|
services: services.filter(function (item) {
|
|
343
|
-
var _item$
|
|
344
|
-
return ((_item$
|
|
555
|
+
var _item$_extend19;
|
|
556
|
+
return ((_item$_extend19 = item._extend) === null || _item$_extend19 === void 0 ? void 0 : _item$_extend19.holder_id) == d.form_record_id && appointmentTypes.includes(item.extension_type);
|
|
345
557
|
})
|
|
346
558
|
});
|
|
347
559
|
});
|
|
@@ -377,6 +589,38 @@ export var getDayProducts = function getDayProducts(holderId, lists, isTerminal)
|
|
|
377
589
|
return _lists;
|
|
378
590
|
};
|
|
379
591
|
|
|
592
|
+
/**
|
|
593
|
+
* @title: 格式化表单数据
|
|
594
|
+
* @description:
|
|
595
|
+
* @param {any} state
|
|
596
|
+
* @return {*}
|
|
597
|
+
* @Author: WangHan
|
|
598
|
+
* @Date: 2024-12-30 22:19
|
|
599
|
+
*/
|
|
600
|
+
export var getPets = function getPets(state) {
|
|
601
|
+
var _state$bookingConfig6, _state$bookingConfig7, _state$bookingConfig8, _state$bookingConfig9, _state$pet3, _state$pet3$value;
|
|
602
|
+
var form_id = (state === null || state === void 0 ? void 0 : (_state$bookingConfig6 = state.bookingConfig) === null || _state$bookingConfig6 === void 0 ? void 0 : (_state$bookingConfig7 = _state$bookingConfig6.config) === null || _state$bookingConfig7 === void 0 ? void 0 : (_state$bookingConfig8 = _state$bookingConfig7.basic) === null || _state$bookingConfig8 === void 0 ? void 0 : (_state$bookingConfig9 = _state$bookingConfig8.appointment_subject) === null || _state$bookingConfig9 === void 0 ? void 0 : _state$bookingConfig9.form_id) || 0;
|
|
603
|
+
var pets = (state === null || state === void 0 ? void 0 : (_state$pet3 = state.pet) === null || _state$pet3 === void 0 ? void 0 : (_state$pet3$value = _state$pet3.value) === null || _state$pet3$value === void 0 ? void 0 : _state$pet3$value[form_id]) || [];
|
|
604
|
+
return pets;
|
|
605
|
+
};
|
|
606
|
+
|
|
607
|
+
/**
|
|
608
|
+
* @title: 得出预约商品
|
|
609
|
+
* @description:
|
|
610
|
+
* @param {any} state
|
|
611
|
+
* @return {*}
|
|
612
|
+
* @Author: WangHan
|
|
613
|
+
* @Date: 2024-12-30 22:26
|
|
614
|
+
*/
|
|
615
|
+
export var getAppointmentService = function getAppointmentService(state) {
|
|
616
|
+
var _state$service3;
|
|
617
|
+
var services = ((_state$service3 = state.service) === null || _state$service3 === void 0 ? void 0 : _state$service3.value) || [];
|
|
618
|
+
var lists = services.filter(function (item) {
|
|
619
|
+
return appointmentTypes.includes(item.extension_type);
|
|
620
|
+
});
|
|
621
|
+
return lists;
|
|
622
|
+
};
|
|
623
|
+
|
|
380
624
|
/**
|
|
381
625
|
* @title: 判断是否打开删除宠物弹窗
|
|
382
626
|
* @description:
|
|
@@ -387,9 +631,9 @@ export var getDayProducts = function getDayProducts(holderId, lists, isTerminal)
|
|
|
387
631
|
* @Date: 2024-12-16 16:12
|
|
388
632
|
*/
|
|
389
633
|
export var isOpenDeletePet = function isOpenDeletePet(state, newVal) {
|
|
390
|
-
var _state$
|
|
391
|
-
var form_id = (state === null || state === void 0 ? void 0 : (_state$
|
|
392
|
-
var oldPets = (state === null || state === void 0 ? void 0 : (_state$
|
|
634
|
+
var _state$bookingConfig10, _state$bookingConfig11, _state$bookingConfig12, _state$bookingConfig13, _state$pet4, _state$pet4$value;
|
|
635
|
+
var form_id = (state === null || state === void 0 ? void 0 : (_state$bookingConfig10 = state.bookingConfig) === null || _state$bookingConfig10 === void 0 ? void 0 : (_state$bookingConfig11 = _state$bookingConfig10.config) === null || _state$bookingConfig11 === void 0 ? void 0 : (_state$bookingConfig12 = _state$bookingConfig11.basic) === null || _state$bookingConfig12 === void 0 ? void 0 : (_state$bookingConfig13 = _state$bookingConfig12.appointment_subject) === null || _state$bookingConfig13 === void 0 ? void 0 : _state$bookingConfig13.form_id) || 0;
|
|
636
|
+
var oldPets = (state === null || state === void 0 ? void 0 : (_state$pet4 = state.pet) === null || _state$pet4 === void 0 ? void 0 : (_state$pet4$value = _state$pet4.value) === null || _state$pet4$value === void 0 ? void 0 : _state$pet4$value[form_id]) || [];
|
|
393
637
|
var newPets = (newVal === null || newVal === void 0 ? void 0 : newVal[form_id]) || [];
|
|
394
638
|
|
|
395
639
|
// 被删除的表单
|
|
@@ -401,9 +645,9 @@ export var isOpenDeletePet = function isOpenDeletePet(state, newVal) {
|
|
|
401
645
|
|
|
402
646
|
// 被删除的表单中是否有预约商品
|
|
403
647
|
var servicePets = deletePets.map(function (item) {
|
|
404
|
-
var _state$
|
|
648
|
+
var _state$service4, _state$service4$value;
|
|
405
649
|
return _objectSpread(_objectSpread({}, item), {}, {
|
|
406
|
-
services: (_state$
|
|
650
|
+
services: (_state$service4 = state.service) === null || _state$service4 === void 0 ? void 0 : (_state$service4$value = _state$service4.value) === null || _state$service4$value === void 0 ? void 0 : _state$service4$value.filter(function (d) {
|
|
407
651
|
var _d$_extend2;
|
|
408
652
|
return ((_d$_extend2 = d._extend) === null || _d$_extend2 === void 0 ? void 0 : _d$_extend2.holder_id) == item.form_record_id;
|
|
409
653
|
})
|
|
@@ -415,7 +659,6 @@ export var isOpenDeletePet = function isOpenDeletePet(state, newVal) {
|
|
|
415
659
|
var _item$services;
|
|
416
660
|
return ((_item$services = item.services) === null || _item$services === void 0 ? void 0 : _item$services.length) > 0;
|
|
417
661
|
});
|
|
418
|
-
console.log(deletePets, (_state$service3 = state.service) === null || _state$service3 === void 0 ? void 0 : _state$service3.value, lists, 'wh98888888');
|
|
419
662
|
return {
|
|
420
663
|
ids: lists.map(function (item) {
|
|
421
664
|
return item.form_record_id;
|
|
@@ -435,4 +678,385 @@ export var isOpenDeletePet = function isOpenDeletePet(state, newVal) {
|
|
|
435
678
|
export var holderId = function holderId(state) {
|
|
436
679
|
var _state$activeCartId;
|
|
437
680
|
return Number((state === null || state === void 0 ? void 0 : (_state$activeCartId = state.activeCartId) === null || _state$activeCartId === void 0 ? void 0 : _state$activeCartId[0]) || 0);
|
|
681
|
+
};
|
|
682
|
+
|
|
683
|
+
/**
|
|
684
|
+
* @title: 计算总价
|
|
685
|
+
* @description:
|
|
686
|
+
* @param {any} data
|
|
687
|
+
* @return {*}
|
|
688
|
+
* @Author: WangHan
|
|
689
|
+
* @Date: 2024-12-31 15:18
|
|
690
|
+
*/
|
|
691
|
+
function calculateTotalPrice(data) {
|
|
692
|
+
var _price = data === null || data === void 0 ? void 0 : data.reduce(function (total, item) {
|
|
693
|
+
return total + ((item === null || item === void 0 ? void 0 : item.price) || (item === null || item === void 0 ? void 0 : item.add_price)) * item.num;
|
|
694
|
+
}, 0);
|
|
695
|
+
return parseFloat(_price);
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
/**
|
|
699
|
+
* @title: 更新单规格价格
|
|
700
|
+
* @description:
|
|
701
|
+
* @param {any} currentValue
|
|
702
|
+
* @param {any} single
|
|
703
|
+
* @return {*}
|
|
704
|
+
* @Author: WangHan
|
|
705
|
+
* @Date: 2024-12-31 15:18
|
|
706
|
+
*/
|
|
707
|
+
function updateSinglePrice(currentValue, single) {
|
|
708
|
+
var _single = [];
|
|
709
|
+
var _loop = function _loop() {
|
|
710
|
+
var item = currentValue[index];
|
|
711
|
+
var currentIndex = single.findIndex(function (_single) {
|
|
712
|
+
return _single.id === item.id;
|
|
713
|
+
});
|
|
714
|
+
if (currentIndex !== -1) {
|
|
715
|
+
item.add_price = single[currentIndex].add_price;
|
|
716
|
+
item.name = single[currentIndex].name;
|
|
717
|
+
_single.push(item);
|
|
718
|
+
}
|
|
719
|
+
};
|
|
720
|
+
for (var index = 0; index < currentValue.length; index++) {
|
|
721
|
+
_loop();
|
|
722
|
+
}
|
|
723
|
+
return _single;
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
/**
|
|
727
|
+
* @title: 更新套餐价格
|
|
728
|
+
* @description:
|
|
729
|
+
* @param {any} currentValue
|
|
730
|
+
* @param {any} param2
|
|
731
|
+
* @return {*}
|
|
732
|
+
* @Author: WangHan
|
|
733
|
+
* @Date: 2024-12-31 15:17
|
|
734
|
+
*/
|
|
735
|
+
function updateBundlePrice(currentValue, _ref2) {
|
|
736
|
+
var _ref3 = _slicedToArray(_ref2, 2),
|
|
737
|
+
bundle = _ref3[0],
|
|
738
|
+
single = _ref3[1];
|
|
739
|
+
var _bundle = [];
|
|
740
|
+
var _loop2 = function _loop2() {
|
|
741
|
+
var item = currentValue[index];
|
|
742
|
+
var currentIndex = bundle.findIndex(function (_bundle) {
|
|
743
|
+
return _bundle.id === item.id;
|
|
744
|
+
});
|
|
745
|
+
if (currentIndex !== -1 && bundle[currentIndex]) {
|
|
746
|
+
var _item$option;
|
|
747
|
+
// currentValue.splice(index, 1);
|
|
748
|
+
item.title = bundle[currentIndex].title;
|
|
749
|
+
item.price_type = bundle[currentIndex].price_type;
|
|
750
|
+
item._price = bundle[currentIndex].price;
|
|
751
|
+
var bundle_sum_price = parseFloat(bundle[currentIndex].price_type === 'markdown' ? bundle[currentIndex].price * -1 : bundle[currentIndex].price).toFixed(2);
|
|
752
|
+
item.price = bundle_sum_price;
|
|
753
|
+
item.bundle_sum_price = bundle_sum_price;
|
|
754
|
+
// 如果有单规格
|
|
755
|
+
if (item !== null && item !== void 0 && (_item$option = item.option) !== null && _item$option !== void 0 && _item$option.length) {
|
|
756
|
+
var _option = JSON.parse(JSON.stringify(item.option));
|
|
757
|
+
item.option = updateSinglePrice(_option, single);
|
|
758
|
+
var optionPrice = 0;
|
|
759
|
+
optionPrice = calculateTotalPrice(item.option);
|
|
760
|
+
var _bundle_sum_price = (parseFloat(bundle[currentIndex].price_type === 'markdown' ? bundle[currentIndex].price * -1 : bundle[currentIndex].price) + optionPrice).toFixed(2);
|
|
761
|
+
item.price = _bundle_sum_price;
|
|
762
|
+
item.bundle_sum_price = _bundle_sum_price;
|
|
763
|
+
}
|
|
764
|
+
_bundle.push(item);
|
|
765
|
+
}
|
|
766
|
+
};
|
|
767
|
+
for (var index = 0; index < currentValue.length; index++) {
|
|
768
|
+
_loop2();
|
|
769
|
+
}
|
|
770
|
+
return _bundle;
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
/**
|
|
774
|
+
* @title: 平铺套餐数据
|
|
775
|
+
* @description:
|
|
776
|
+
* @param {any} newPackageData
|
|
777
|
+
* @return {*}
|
|
778
|
+
* @Author: WangHan
|
|
779
|
+
* @Date: 2024-12-31 15:17
|
|
780
|
+
*/
|
|
781
|
+
function flatData(newPackageData) {
|
|
782
|
+
var bundle = [];
|
|
783
|
+
var single = [];
|
|
784
|
+
// 获取所有的套餐
|
|
785
|
+
var _iterator = _createForOfIteratorHelper(newPackageData),
|
|
786
|
+
_step;
|
|
787
|
+
try {
|
|
788
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
789
|
+
var _group$bundle_item;
|
|
790
|
+
var _group = _step.value;
|
|
791
|
+
if (_group !== null && _group !== void 0 && (_group$bundle_item = _group.bundle_item) !== null && _group$bundle_item !== void 0 && _group$bundle_item.length) {
|
|
792
|
+
var _iterator4 = _createForOfIteratorHelper(_group.bundle_item),
|
|
793
|
+
_step4;
|
|
794
|
+
try {
|
|
795
|
+
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
796
|
+
var _item = _step4.value;
|
|
797
|
+
bundle.push(_item);
|
|
798
|
+
}
|
|
799
|
+
} catch (err) {
|
|
800
|
+
_iterator4.e(err);
|
|
801
|
+
} finally {
|
|
802
|
+
_iterator4.f();
|
|
803
|
+
}
|
|
804
|
+
}
|
|
805
|
+
}
|
|
806
|
+
|
|
807
|
+
// 获取到所有的规格
|
|
808
|
+
} catch (err) {
|
|
809
|
+
_iterator.e(err);
|
|
810
|
+
} finally {
|
|
811
|
+
_iterator.f();
|
|
812
|
+
}
|
|
813
|
+
for (var _i2 = 0, _bundle2 = bundle; _i2 < _bundle2.length; _i2++) {
|
|
814
|
+
var _bundleItem$option_gr;
|
|
815
|
+
var bundleItem = _bundle2[_i2];
|
|
816
|
+
if (bundleItem !== null && bundleItem !== void 0 && (_bundleItem$option_gr = bundleItem.option_group) !== null && _bundleItem$option_gr !== void 0 && _bundleItem$option_gr.length) {
|
|
817
|
+
var _iterator2 = _createForOfIteratorHelper(bundleItem.option_group),
|
|
818
|
+
_step2;
|
|
819
|
+
try {
|
|
820
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
821
|
+
var _group$option_item;
|
|
822
|
+
var group = _step2.value;
|
|
823
|
+
if (group !== null && group !== void 0 && (_group$option_item = group.option_item) !== null && _group$option_item !== void 0 && _group$option_item.length) {
|
|
824
|
+
var _iterator3 = _createForOfIteratorHelper(group.option_item),
|
|
825
|
+
_step3;
|
|
826
|
+
try {
|
|
827
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
828
|
+
var item = _step3.value;
|
|
829
|
+
single.push(item);
|
|
830
|
+
}
|
|
831
|
+
} catch (err) {
|
|
832
|
+
_iterator3.e(err);
|
|
833
|
+
} finally {
|
|
834
|
+
_iterator3.f();
|
|
835
|
+
}
|
|
836
|
+
}
|
|
837
|
+
}
|
|
838
|
+
} catch (err) {
|
|
839
|
+
_iterator2.e(err);
|
|
840
|
+
} finally {
|
|
841
|
+
_iterator2.f();
|
|
842
|
+
}
|
|
843
|
+
}
|
|
844
|
+
}
|
|
845
|
+
return [bundle, single];
|
|
846
|
+
}
|
|
847
|
+
|
|
848
|
+
/**
|
|
849
|
+
* @title: 更新套餐的价格
|
|
850
|
+
* @description:
|
|
851
|
+
* @param {any} currentValue
|
|
852
|
+
* @param {any} newBundleData
|
|
853
|
+
* @return {*}
|
|
854
|
+
* @Author: WangHan
|
|
855
|
+
* @Date: 2024-12-31 15:16
|
|
856
|
+
*/
|
|
857
|
+
export function updateNormalBundlePrice(currentValue, newBundleData) {
|
|
858
|
+
var _currentValue = JSON.parse(JSON.stringify(currentValue));
|
|
859
|
+
var _flatData = flatData(newBundleData);
|
|
860
|
+
var newValue = updateBundlePrice(_currentValue, _flatData);
|
|
861
|
+
return newValue;
|
|
862
|
+
}
|
|
863
|
+
|
|
864
|
+
/**
|
|
865
|
+
* @title: 更新普通商品价格
|
|
866
|
+
* @description:
|
|
867
|
+
* @param {any} ids
|
|
868
|
+
* @param {any} state
|
|
869
|
+
* @return {*}
|
|
870
|
+
* @Author: WangHan
|
|
871
|
+
* @Date: 2024-12-31 15:15
|
|
872
|
+
*/
|
|
873
|
+
var normalServicePrice = /*#__PURE__*/function () {
|
|
874
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(ids, state) {
|
|
875
|
+
var _state$service5, _state$client, _state$client$value, _data$list;
|
|
876
|
+
var services, customerId, data, _lists;
|
|
877
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
878
|
+
while (1) switch (_context.prev = _context.next) {
|
|
879
|
+
case 0:
|
|
880
|
+
services = ((_state$service5 = state.service) === null || _state$service5 === void 0 ? void 0 : _state$service5.value) || [];
|
|
881
|
+
customerId = (state === null || state === void 0 ? void 0 : (_state$client = state.client) === null || _state$client === void 0 ? void 0 : (_state$client$value = _state$client.value) === null || _state$client$value === void 0 ? void 0 : _state$client$value.id) || 0;
|
|
882
|
+
_context.next = 4;
|
|
883
|
+
return state.apis.getServices({
|
|
884
|
+
skip: 1,
|
|
885
|
+
num: 500,
|
|
886
|
+
ids: ids,
|
|
887
|
+
customer_id: customerId,
|
|
888
|
+
open_quotation: 1,
|
|
889
|
+
open_bundle: 1,
|
|
890
|
+
with: ['bundleGroup.bundleItem', 'optionGroup.optionItem'],
|
|
891
|
+
_config: {
|
|
892
|
+
abort: true
|
|
893
|
+
}
|
|
894
|
+
});
|
|
895
|
+
case 4:
|
|
896
|
+
data = _context.sent;
|
|
897
|
+
if (data !== null && data !== void 0 && (_data$list = data.list) !== null && _data$list !== void 0 && _data$list.length) {
|
|
898
|
+
_context.next = 7;
|
|
899
|
+
break;
|
|
900
|
+
}
|
|
901
|
+
return _context.abrupt("return");
|
|
902
|
+
case 7:
|
|
903
|
+
_lists = services.map(function (item) {
|
|
904
|
+
var obj = _objectSpread({}, item);
|
|
905
|
+
if (!appointmentTypes.includes(obj.extension_type)) {
|
|
906
|
+
// 在商品列表中根据商品id找到对应的商品数据
|
|
907
|
+
var product = data.list.find(function (p) {
|
|
908
|
+
return p.id === (item === null || item === void 0 ? void 0 : item.product_id);
|
|
909
|
+
});
|
|
910
|
+
var _extend = (obj === null || obj === void 0 ? void 0 : obj._extend) || {};
|
|
911
|
+
var other = (_extend === null || _extend === void 0 ? void 0 : _extend.other) || {};
|
|
912
|
+
if (product) {
|
|
913
|
+
var _product$variant, _other$bundle, _product$bundle_group;
|
|
914
|
+
// 如果有多规格的话则更新价格为多规格的价格
|
|
915
|
+
if (product !== null && product !== void 0 && (_product$variant = product.variant) !== null && _product$variant !== void 0 && _product$variant.length && other !== null && other !== void 0 && other.product_variant_id) {
|
|
916
|
+
var _product$variant2;
|
|
917
|
+
var _variant = product === null || product === void 0 ? void 0 : (_product$variant2 = product.variant) === null || _product$variant2 === void 0 ? void 0 : _product$variant2.find(function (v) {
|
|
918
|
+
return v.id === (other === null || other === void 0 ? void 0 : other.product_variant_id);
|
|
919
|
+
});
|
|
920
|
+
obj._extend.price = Number(_variant === null || _variant === void 0 ? void 0 : _variant.price);
|
|
921
|
+
obj._extend.other.price = Number(_variant === null || _variant === void 0 ? void 0 : _variant.price);
|
|
922
|
+
} else {
|
|
923
|
+
obj._extend.price = Number(product === null || product === void 0 ? void 0 : product.price);
|
|
924
|
+
}
|
|
925
|
+
|
|
926
|
+
// 更新套餐的价格
|
|
927
|
+
if (other !== null && other !== void 0 && (_other$bundle = other.bundle) !== null && _other$bundle !== void 0 && _other$bundle.length && product !== null && product !== void 0 && (_product$bundle_group = product.bundle_group) !== null && _product$bundle_group !== void 0 && _product$bundle_group.length) {
|
|
928
|
+
var _bundle = updateNormalBundlePrice(other.bundle, product === null || product === void 0 ? void 0 : product.bundle_group);
|
|
929
|
+
obj._extend.other = _objectSpread(_objectSpread({}, other), {}, {
|
|
930
|
+
bundle: _bundle
|
|
931
|
+
});
|
|
932
|
+
}
|
|
933
|
+
|
|
934
|
+
// 更新总计
|
|
935
|
+
obj._extend.total = getProductTotalPrice(obj);
|
|
936
|
+
obj._extend.origin_total = getProductTotalPrice(obj);
|
|
937
|
+
}
|
|
938
|
+
}
|
|
939
|
+
return obj;
|
|
940
|
+
});
|
|
941
|
+
return _context.abrupt("return", _lists);
|
|
942
|
+
case 9:
|
|
943
|
+
case "end":
|
|
944
|
+
return _context.stop();
|
|
945
|
+
}
|
|
946
|
+
}, _callee);
|
|
947
|
+
}));
|
|
948
|
+
return function normalServicePrice(_x2, _x3) {
|
|
949
|
+
return _ref4.apply(this, arguments);
|
|
950
|
+
};
|
|
951
|
+
}();
|
|
952
|
+
|
|
953
|
+
/**
|
|
954
|
+
* @title: 更新预约商品报价单
|
|
955
|
+
* @description:
|
|
956
|
+
* @param {any} state
|
|
957
|
+
* @param {any} cacheItem
|
|
958
|
+
* @return {*}
|
|
959
|
+
* @Author: WangHan
|
|
960
|
+
* @Date: 2024-12-25 16:41
|
|
961
|
+
*/
|
|
962
|
+
export var updateAppointmentServicePrice = /*#__PURE__*/function () {
|
|
963
|
+
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(state, _ref5) {
|
|
964
|
+
var _state$service6, _state$service6$cache, _state$service6$cache2;
|
|
965
|
+
var start_date, end_date, product_id, defaultReturn, _state$client2, _state$client2$value, _state$service$cacheI, _res$data, _res$data2, format, customer_id, _product_id, multi_day_price, startDate, endDate, params, res, _prices;
|
|
966
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
967
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
968
|
+
case 0:
|
|
969
|
+
start_date = _ref5.start_date, end_date = _ref5.end_date, product_id = _ref5.product_id;
|
|
970
|
+
defaultReturn = {
|
|
971
|
+
multiDayPrices: [],
|
|
972
|
+
price: Number(state === null || state === void 0 ? void 0 : (_state$service6 = state.service) === null || _state$service6 === void 0 ? void 0 : (_state$service6$cache = _state$service6.cacheItem) === null || _state$service6$cache === void 0 ? void 0 : (_state$service6$cache2 = _state$service6$cache._extend) === null || _state$service6$cache2 === void 0 ? void 0 : _state$service6$cache2.price) || 0
|
|
973
|
+
};
|
|
974
|
+
_context2.prev = 2;
|
|
975
|
+
format = 'YYYY-MM-DD';
|
|
976
|
+
customer_id = (state === null || state === void 0 ? void 0 : (_state$client2 = state.client) === null || _state$client2 === void 0 ? void 0 : (_state$client2$value = _state$client2.value) === null || _state$client2$value === void 0 ? void 0 : _state$client2$value.id) || 1;
|
|
977
|
+
_product_id = product_id || ((_state$service$cacheI = state.service.cacheItem) === null || _state$service$cacheI === void 0 ? void 0 : _state$service$cacheI.product_id) || 0;
|
|
978
|
+
multi_day_price = null;
|
|
979
|
+
if (product_id) {
|
|
980
|
+
_context2.next = 9;
|
|
981
|
+
break;
|
|
982
|
+
}
|
|
983
|
+
return _context2.abrupt("return", defaultReturn);
|
|
984
|
+
case 9:
|
|
985
|
+
startDate = dayjs(start_date).format(format);
|
|
986
|
+
endDate = dayjs(end_date).subtract(1, 'days').format(format);
|
|
987
|
+
params = {
|
|
988
|
+
customer_id: customer_id,
|
|
989
|
+
multi_day: {
|
|
990
|
+
start: startDate,
|
|
991
|
+
end: endDate
|
|
992
|
+
}
|
|
993
|
+
};
|
|
994
|
+
_context2.next = 14;
|
|
995
|
+
return postMultiDay(_product_id, params);
|
|
996
|
+
case 14:
|
|
997
|
+
res = _context2.sent;
|
|
998
|
+
_prices = (res === null || res === void 0 ? void 0 : (_res$data = res.data) === null || _res$data === void 0 ? void 0 : _res$data.multi_day_price) || []; // 如果接口返回的有报价单,则分割商品数据
|
|
999
|
+
multi_day_price = _prices === null || _prices === void 0 ? void 0 : _prices.map(function (p) {
|
|
1000
|
+
var _p$multi_day, _p$multi_day2;
|
|
1001
|
+
var startDate = dayjs(p === null || p === void 0 ? void 0 : (_p$multi_day = p.multi_day) === null || _p$multi_day === void 0 ? void 0 : _p$multi_day.start);
|
|
1002
|
+
// 将返回的结束日期+1天,(前端计算得出的两个日期之间的天数是按照中间的间隔来计算的,而后端返回的报价单的日期是按照当天来计算的)
|
|
1003
|
+
var endDate = dayjs(p === null || p === void 0 ? void 0 : (_p$multi_day2 = p.multi_day) === null || _p$multi_day2 === void 0 ? void 0 : _p$multi_day2.end).add(1, 'day');
|
|
1004
|
+
var duration = (endDate === null || endDate === void 0 ? void 0 : endDate.diff(startDate, 'day')) || 1;
|
|
1005
|
+
return {
|
|
1006
|
+
total: Number(p === null || p === void 0 ? void 0 : p.price),
|
|
1007
|
+
origin_total: Number(p === null || p === void 0 ? void 0 : p.price),
|
|
1008
|
+
num: duration,
|
|
1009
|
+
quotation_id: (p === null || p === void 0 ? void 0 : p.quotation_id) || 0,
|
|
1010
|
+
start_date: startDate === null || startDate === void 0 ? void 0 : startDate.format(format),
|
|
1011
|
+
end_date: endDate === null || endDate === void 0 ? void 0 : endDate.format(format)
|
|
1012
|
+
};
|
|
1013
|
+
});
|
|
1014
|
+
return _context2.abrupt("return", {
|
|
1015
|
+
multiDayPrices: multi_day_price,
|
|
1016
|
+
price: Number(res === null || res === void 0 ? void 0 : (_res$data2 = res.data) === null || _res$data2 === void 0 ? void 0 : _res$data2.price) || 0
|
|
1017
|
+
});
|
|
1018
|
+
case 20:
|
|
1019
|
+
_context2.prev = 20;
|
|
1020
|
+
_context2.t0 = _context2["catch"](2);
|
|
1021
|
+
case 22:
|
|
1022
|
+
return _context2.abrupt("return", defaultReturn);
|
|
1023
|
+
case 23:
|
|
1024
|
+
case "end":
|
|
1025
|
+
return _context2.stop();
|
|
1026
|
+
}
|
|
1027
|
+
}, _callee2, null, [[2, 20]]);
|
|
1028
|
+
}));
|
|
1029
|
+
return function updateAppointmentServicePrice(_x4, _x5) {
|
|
1030
|
+
return _ref6.apply(this, arguments);
|
|
1031
|
+
};
|
|
1032
|
+
}();
|
|
1033
|
+
|
|
1034
|
+
/**
|
|
1035
|
+
* @title: 更新普通商品报价单价格
|
|
1036
|
+
* @description:
|
|
1037
|
+
* @param {any} state
|
|
1038
|
+
* @return {*}
|
|
1039
|
+
* @Author: WangHan
|
|
1040
|
+
* @Date: 2024-12-24 11:32
|
|
1041
|
+
*/
|
|
1042
|
+
export var updateServicePrice = function updateServicePrice(state) {
|
|
1043
|
+
var _state$service7, _newNormalIds;
|
|
1044
|
+
var services = ((_state$service7 = state.service) === null || _state$service7 === void 0 ? void 0 : _state$service7.value) || [];
|
|
1045
|
+
|
|
1046
|
+
// 普通商品
|
|
1047
|
+
var normalServices = services === null || services === void 0 ? void 0 : services.filter(function (item) {
|
|
1048
|
+
return !appointmentTypes.includes(item.extension_type);
|
|
1049
|
+
});
|
|
1050
|
+
|
|
1051
|
+
// 普通商品ids去重
|
|
1052
|
+
var newNormalIds = normalServices === null || normalServices === void 0 ? void 0 : normalServices.map(function (item) {
|
|
1053
|
+
return (item === null || item === void 0 ? void 0 : item.product_id) || (item === null || item === void 0 ? void 0 : item.id);
|
|
1054
|
+
});
|
|
1055
|
+
|
|
1056
|
+
// ids去重
|
|
1057
|
+
newNormalIds = _toConsumableArray(new Set(newNormalIds));
|
|
1058
|
+
if ((_newNormalIds = newNormalIds) !== null && _newNormalIds !== void 0 && _newNormalIds.length) {
|
|
1059
|
+
return normalServicePrice(newNormalIds, state);
|
|
1060
|
+
}
|
|
1061
|
+
return [];
|
|
438
1062
|
};
|