@pisell/private-materials 3.0.15 → 3.0.17

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.
Files changed (109) hide show
  1. package/build/lowcode/assets-daily.json +11 -11
  2. package/build/lowcode/assets-dev.json +2 -2
  3. package/build/lowcode/assets-prod.json +11 -11
  4. package/build/lowcode/index.js +1 -1
  5. package/build/lowcode/meta.js +1 -1
  6. package/build/lowcode/preview.js +7 -7
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +9 -9
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +8 -8
  11. package/es/components/booking/addons/index.d.ts +1 -1
  12. package/es/components/booking/addons/index.js +148 -32
  13. package/es/components/booking/addons/model.d.ts +1 -2
  14. package/es/components/booking/components/TabProduct/selectProductItem/index.js +21 -8
  15. package/es/components/booking/components/TabProduct/selectProductItem/index.less +34 -27
  16. package/es/components/booking/components/TabProduct/tabs/index.less +4 -1
  17. package/es/components/booking/components/collapsibleList/index.d.ts +11 -0
  18. package/es/components/booking/components/collapsibleList/index.js +99 -0
  19. package/es/components/booking/components/collapsibleList/index.less +61 -0
  20. package/es/components/booking/components/collapsibleList/utils.d.ts +2 -0
  21. package/es/components/booking/components/collapsibleList/utils.js +21 -0
  22. package/es/components/booking/components/footer/amount.js +9 -10
  23. package/es/components/booking/components/footer/index.js +4 -1
  24. package/es/components/booking/components/footer/utils.d.ts +18 -0
  25. package/es/components/booking/components/footer/utils.js +76 -4
  26. package/es/components/booking/forms/forms.d.ts +1 -1
  27. package/es/components/booking/forms/index.d.ts +1 -1
  28. package/es/components/booking/forms/model.d.ts +1 -2
  29. package/es/components/booking/forms/single/index.js +16 -82
  30. package/es/components/booking/index.d.ts +1 -1
  31. package/es/components/booking/info/index.d.ts +1 -1
  32. package/es/components/booking/info/model.d.ts +1 -2
  33. package/es/components/booking/info/service/addService/index.js +141 -71
  34. package/es/components/booking/info/service/editService/index.js +49 -24
  35. package/es/components/booking/info/service/editService/index.less +21 -0
  36. package/es/components/booking/info/service/index.d.ts +2 -2
  37. package/es/components/booking/info/service/index.js +5 -129
  38. package/es/components/booking/info/service/index.less +0 -100
  39. package/es/components/booking/info/service/serve.d.ts +1 -0
  40. package/es/components/booking/info/service/serve.js +21 -0
  41. package/es/components/booking/info/service/serviceItem/index.d.ts +4 -0
  42. package/es/components/booking/info/service/serviceItem/index.js +63 -0
  43. package/es/components/booking/info/service/serviceItem/index.less +97 -0
  44. package/es/components/booking/info/service/serviceList/index.d.ts +4 -0
  45. package/es/components/booking/info/service/serviceList/index.js +105 -0
  46. package/es/components/booking/info/service/serviceList/index.less +0 -0
  47. package/es/components/booking/info/utils.d.ts +1 -0
  48. package/es/components/booking/info/utils.js +8 -0
  49. package/es/components/booking/model.d.ts +1 -2
  50. package/es/components/booking/notes/index.d.ts +1 -1
  51. package/es/components/booking/notes/model.d.ts +1 -2
  52. package/es/components/booking/payments/index.d.ts +1 -1
  53. package/es/components/booking/payments/model.d.ts +1 -2
  54. package/es/components/booking/utils.d.ts +16 -0
  55. package/es/components/booking/utils.js +37 -0
  56. package/es/components/productExtension/fields/SelectResourcesTable/index.js +2 -1
  57. package/es/components/productExtension/locales.js +5 -5
  58. package/es/components/schedules/index.d.ts +1 -1
  59. package/es/components/schedules/model.d.ts +1 -2
  60. package/lib/components/booking/addons/index.d.ts +1 -1
  61. package/lib/components/booking/addons/index.js +159 -35
  62. package/lib/components/booking/addons/model.d.ts +1 -2
  63. package/lib/components/booking/components/TabProduct/selectProductItem/index.js +33 -8
  64. package/lib/components/booking/components/TabProduct/selectProductItem/index.less +34 -27
  65. package/lib/components/booking/components/TabProduct/tabs/index.less +4 -1
  66. package/lib/components/booking/components/collapsibleList/index.d.ts +11 -0
  67. package/lib/components/booking/components/collapsibleList/index.js +94 -0
  68. package/lib/components/booking/components/collapsibleList/index.less +61 -0
  69. package/lib/components/booking/components/collapsibleList/utils.d.ts +2 -0
  70. package/lib/components/booking/components/collapsibleList/utils.js +46 -0
  71. package/lib/components/booking/components/footer/amount.js +9 -10
  72. package/lib/components/booking/components/footer/index.js +3 -0
  73. package/lib/components/booking/components/footer/utils.d.ts +18 -0
  74. package/lib/components/booking/components/footer/utils.js +46 -7
  75. package/lib/components/booking/forms/forms.d.ts +1 -1
  76. package/lib/components/booking/forms/index.d.ts +1 -1
  77. package/lib/components/booking/forms/model.d.ts +1 -2
  78. package/lib/components/booking/forms/single/index.js +12 -48
  79. package/lib/components/booking/index.d.ts +1 -1
  80. package/lib/components/booking/info/index.d.ts +1 -1
  81. package/lib/components/booking/info/model.d.ts +1 -2
  82. package/lib/components/booking/info/service/addService/index.js +68 -34
  83. package/lib/components/booking/info/service/editService/index.js +76 -56
  84. package/lib/components/booking/info/service/editService/index.less +21 -0
  85. package/lib/components/booking/info/service/index.d.ts +2 -2
  86. package/lib/components/booking/info/service/index.js +4 -112
  87. package/lib/components/booking/info/service/index.less +0 -100
  88. package/lib/components/booking/info/service/serve.d.ts +1 -0
  89. package/lib/components/booking/info/service/serve.js +30 -0
  90. package/lib/components/booking/info/service/serviceItem/index.d.ts +4 -0
  91. package/lib/components/booking/info/service/serviceItem/index.js +98 -0
  92. package/lib/components/booking/info/service/serviceItem/index.less +97 -0
  93. package/lib/components/booking/info/service/serviceList/index.d.ts +4 -0
  94. package/lib/components/booking/info/service/serviceList/index.js +129 -0
  95. package/lib/components/booking/info/service/serviceList/index.less +0 -0
  96. package/lib/components/booking/info/utils.d.ts +1 -0
  97. package/lib/components/booking/info/utils.js +35 -0
  98. package/lib/components/booking/model.d.ts +1 -2
  99. package/lib/components/booking/notes/index.d.ts +1 -1
  100. package/lib/components/booking/notes/model.d.ts +1 -2
  101. package/lib/components/booking/payments/index.d.ts +1 -1
  102. package/lib/components/booking/payments/model.d.ts +1 -2
  103. package/lib/components/booking/utils.d.ts +16 -0
  104. package/lib/components/booking/utils.js +29 -0
  105. package/lib/components/productExtension/fields/SelectResourcesTable/index.js +1 -1
  106. package/lib/components/productExtension/locales.js +5 -5
  107. package/lib/components/schedules/index.d.ts +1 -1
  108. package/lib/components/schedules/model.d.ts +1 -2
  109. package/package.json +3 -3
@@ -1,7 +1,5 @@
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
2
  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; }
3
- 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
- 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); }); }; }
5
3
  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; }
6
4
  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; }
7
5
  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; }
@@ -11,6 +9,8 @@ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableTo
11
9
  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."); }
12
10
  function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
13
11
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
12
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
13
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
14
14
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
15
15
  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."); }
16
16
  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); }
@@ -25,7 +25,10 @@ import { Context } from "../../model";
25
25
  import AddButton from "../../../components/addButton";
26
26
  import { Input } from "antd";
27
27
  import "./index.less";
28
- import { formatProductListByCategory } from "../../../utils";
28
+ import useEngineContext from "../../../../../hooks/useEngineContext";
29
+ import { getProductDetail } from "../serve";
30
+ import { getIsBundleOrCombination } from "../../utils";
31
+ import { formatProductListByCategory, getProductTotalPrice, request } from "../../../utils";
29
32
  import { locales, getUniqueId } from "@pisell/utils";
30
33
  var Info = function Info() {
31
34
  var _state$service2;
@@ -36,52 +39,96 @@ var Info = function Info() {
36
39
  var _useContext = useContext(Context),
37
40
  state = _useContext.state,
38
41
  dispatch = _useContext.dispatch;
39
- var setDefaultService = function setDefaultService(list) {
40
- if (state.renderType !== "eventBooking") {
41
- return;
42
- }
43
- if (state.bookingId) {
44
- return;
45
- }
46
- if (list.length !== 1) {
47
- return;
48
- }
49
- var _list = _toConsumableArray(state.service.value);
50
- if (_list.length !== 0) {
51
- return;
52
- }
53
- var product = list[0];
54
- var _item = _objectSpread(_objectSpread({}, product), {}, {
55
- product_id: product.id,
56
- _id: getUniqueId(),
57
- _extend: {
58
- start_date: state.date.value,
59
- startDate: state.date.value,
60
- endDate: state.date.value,
61
- start_time: "00:00:00",
62
- duration: 10,
63
- quantity: 1,
64
- price: product.price,
65
- product_name: product.title
66
- }
67
- });
68
- _list.push(_item);
69
- dispatch({
70
- type: "setService",
71
- payload: {
72
- value: _list,
73
- edit: true
74
- }
75
- });
76
- };
42
+ var context = useEngineContext();
43
+ request.setRequest(context.appHelper.utils.request);
44
+ var setDefaultService = /*#__PURE__*/function () {
45
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(list) {
46
+ var _list, product, detail, isBundleOrCombination, _item;
47
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
48
+ while (1) switch (_context.prev = _context.next) {
49
+ case 0:
50
+ if (!(state.renderType !== "eventBooking")) {
51
+ _context.next = 2;
52
+ break;
53
+ }
54
+ return _context.abrupt("return");
55
+ case 2:
56
+ if (!state.bookingId) {
57
+ _context.next = 4;
58
+ break;
59
+ }
60
+ return _context.abrupt("return");
61
+ case 4:
62
+ if (!(list.length !== 1)) {
63
+ _context.next = 6;
64
+ break;
65
+ }
66
+ return _context.abrupt("return");
67
+ case 6:
68
+ _list = _toConsumableArray(state.service.value);
69
+ if (!(_list.length !== 0)) {
70
+ _context.next = 9;
71
+ break;
72
+ }
73
+ return _context.abrupt("return");
74
+ case 9:
75
+ product = list[0];
76
+ _context.next = 12;
77
+ return getProductDetail(product.id, {
78
+ schedule_date: state.date.value.format("YYYY-MM-DD")
79
+ });
80
+ case 12:
81
+ detail = _context.sent;
82
+ // 商品是套餐或单规格多规格
83
+ isBundleOrCombination = getIsBundleOrCombination(detail.data); // 套餐商品单规格多规格不设置默认
84
+ if (!isBundleOrCombination) {
85
+ _context.next = 16;
86
+ break;
87
+ }
88
+ return _context.abrupt("return");
89
+ case 16:
90
+ _item = _objectSpread(_objectSpread({}, product), {}, {
91
+ product_id: product.id,
92
+ _id: getUniqueId(),
93
+ _extend: {
94
+ start_date: state.date.value,
95
+ startDate: state.date.value,
96
+ endDate: state.date.value,
97
+ start_time: "00:00:00",
98
+ duration: 10,
99
+ quantity: 1,
100
+ price: product.price,
101
+ total: product.price,
102
+ origin_total: product.price,
103
+ product_name: product.title
104
+ }
105
+ });
106
+ _list.push(_item);
107
+ dispatch({
108
+ type: "setService",
109
+ payload: {
110
+ value: _list,
111
+ edit: true
112
+ }
113
+ });
114
+ case 19:
115
+ case "end":
116
+ return _context.stop();
117
+ }
118
+ }, _callee);
119
+ }));
120
+ return function setDefaultService(_x2) {
121
+ return _ref.apply(this, arguments);
122
+ };
123
+ }();
77
124
  var getServices = /*#__PURE__*/function () {
78
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
125
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
79
126
  var _state$eventOtherPara;
80
127
  var data;
81
- return _regeneratorRuntime().wrap(function _callee$(_context) {
82
- while (1) switch (_context.prev = _context.next) {
128
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
129
+ while (1) switch (_context2.prev = _context2.next) {
83
130
  case 0:
84
- _context.next = 2;
131
+ _context2.next = 2;
85
132
  return state.apis.getServices({
86
133
  skip: 1,
87
134
  num: 500,
@@ -93,10 +140,10 @@ var Info = function Info() {
93
140
  // include_variant: "no",
94
141
  ids: state.renderType === "eventBooking" ? (_state$eventOtherPara = state.eventOtherParams) === null || _state$eventOtherPara === void 0 ? void 0 : _state$eventOtherPara.productIds : undefined,
95
142
  open_quotation: 1,
96
- with_schedule: 0
143
+ with_schedule: 1
97
144
  });
98
145
  case 2:
99
- data = _context.sent;
146
+ data = _context2.sent;
100
147
  setDefaultService(data === null || data === void 0 ? void 0 : data.list);
101
148
  dispatch({
102
149
  type: "setService",
@@ -106,12 +153,12 @@ var Info = function Info() {
106
153
  });
107
154
  case 5:
108
155
  case "end":
109
- return _context.stop();
156
+ return _context2.stop();
110
157
  }
111
- }, _callee);
158
+ }, _callee2);
112
159
  }));
113
160
  return function getServices() {
114
- return _ref.apply(this, arguments);
161
+ return _ref2.apply(this, arguments);
115
162
  };
116
163
  }();
117
164
  var handleSelectService = function handleSelectService() {
@@ -124,28 +171,51 @@ var Info = function Info() {
124
171
  });
125
172
  };
126
173
  var handleSelectProduct = function handleSelectProduct(item) {
127
- var _isEdit = !!state.service.cacheItem;
128
- var _item = _objectSpread(_objectSpread({}, item), {}, {
129
- product_id: item.id,
130
- _id: getUniqueId(),
131
- _extend: {
132
- start_date: state.date.value,
133
- quantity: 1,
134
- price: item.price,
135
- product_name: item.title
174
+ state.action({
175
+ type: "pisell1.handleOpenProductModal",
176
+ data: {
177
+ id: item.id,
178
+ date: state.date.value.format("YYYY-MM-DD"),
179
+ showConfig: {
180
+ option: false,
181
+ session: false,
182
+ variant: false,
183
+ package: true
184
+ }
136
185
  },
137
- new: 1
138
- });
139
- if (_isEdit) {
140
- var _state$service$cacheI;
141
- _item._id = (_state$service$cacheI = state.service.cacheItem) === null || _state$service$cacheI === void 0 ? void 0 : _state$service$cacheI._id;
142
- _item.new = 0;
143
- }
144
- dispatch({
145
- type: "setService",
146
- payload: {
147
- editModal: true,
148
- cacheItem: _item
186
+ callback: function callback(e) {
187
+ var cacheItem = _objectSpread(_objectSpread({}, item), {}, {
188
+ product_id: item.id,
189
+ _id: getUniqueId(),
190
+ _key: e.key,
191
+ _extend: {
192
+ start_date: state.date.value,
193
+ quantity: 1,
194
+ price: item.price,
195
+ product_name: item.title,
196
+ other: e
197
+ },
198
+ new: 1
199
+ });
200
+ var _total = getProductTotalPrice(cacheItem);
201
+ console.log("_total", e);
202
+ // 用于折扣 可修改
203
+ cacheItem._extend.total = _total;
204
+ // 用于储存原价
205
+ cacheItem._extend.origin_total = _total;
206
+ var _isEdit = !!state.service.cacheItem;
207
+ if (_isEdit) {
208
+ var _state$service$cacheI;
209
+ cacheItem._id = (_state$service$cacheI = state.service.cacheItem) === null || _state$service$cacheI === void 0 ? void 0 : _state$service$cacheI._id;
210
+ cacheItem.new = 0;
211
+ }
212
+ dispatch({
213
+ type: "setService",
214
+ payload: {
215
+ editModal: true,
216
+ cacheItem: cacheItem
217
+ }
218
+ });
149
219
  }
150
220
  });
151
221
  };
@@ -27,17 +27,19 @@ import { formatAmount, locales } from "@pisell/utils";
27
27
  import Duration from "../../../materiels/duration";
28
28
  import { Input, Button, Select, Row, Col, Form, Alert, InputNumber } from "antd";
29
29
  import "./index.less";
30
+ import CollapsibleList from "../../../components/collapsibleList";
31
+ import { renderBundles } from "../../../components/collapsibleList/utils";
30
32
  import dayjs from "dayjs";
31
33
  import { useUpdateEffect, useMemoizedFn } from "ahooks";
32
34
  import { sliceDayIntoFiveMinutes, formatResource, getErrorList, getServiceTimes, getServerItemExtend, deleteCacheParams, getEndDate, flexibleObj, getDuration, getDiscountTime } from "../../../utils";
33
35
  import Like from "../like";
34
36
  import { getNoResource } from "../../../mock";
35
37
  var Info = function Info() {
36
- var _state$bookingConfig2, _state$bookingConfig3, _state$bookingConfig4, _state$service3, _state$service3$cache, _state$service$cacheI5, _state$service$cacheI6;
38
+ var _state$bookingConfig2, _state$bookingConfig3, _state$bookingConfig4, _state$service3, _state$service3$cache, _state$service5, _state$service6, _state$service6$cache, _state$service6$cache2, _state$service$cacheI5, _state$service$cacheI6, _state$service$cacheI7, _state$service$cacheI8;
37
39
  var _Form$useForm = Form.useForm(),
38
40
  _Form$useForm2 = _slicedToArray(_Form$useForm, 1),
39
41
  form = _Form$useForm2[0];
40
- var usePrice = Form.useWatch("price", form);
42
+ var useTotal = Form.useWatch("total", form);
41
43
  var useLikeStatus = Form.useWatch("like_status", form);
42
44
  var useResource = Form.useWatch("resource", form);
43
45
  var useStartTime = Form.useWatch("start_time", form);
@@ -182,8 +184,9 @@ var Info = function Info() {
182
184
  return _regeneratorRuntime().wrap(function _callee$(_context) {
183
185
  while (1) switch (_context.prev = _context.next) {
184
186
  case 0:
187
+ _context.prev = 0;
185
188
  setResourceLoading(true);
186
- _context.next = 3;
189
+ _context.next = 4;
187
190
  return state.apis.getResources({
188
191
  skip: 1,
189
192
  num: 1000,
@@ -193,17 +196,17 @@ var Info = function Info() {
193
196
  abort: true
194
197
  }
195
198
  });
196
- case 3:
199
+ case 4:
197
200
  data = _context.sent;
198
201
  // 合并无资源
199
202
  _list = [getNoResource()].concat((data === null || data === void 0 ? void 0 : data.list) || []);
200
203
  _cacheItem = cacheItem || getCurrentCacheItem();
201
204
  if (_cacheItem._extend) {
202
- _context.next = 8;
205
+ _context.next = 9;
203
206
  break;
204
207
  }
205
208
  return _context.abrupt("return");
206
- case 8:
209
+ case 9:
207
210
  // 格式化, 添加自定义参数
208
211
  _list = _list.map(function (d) {
209
212
  return formatResource(d, _cacheItem, function (item) {
@@ -235,12 +238,18 @@ var Info = function Info() {
235
238
  resources: _list
236
239
  }
237
240
  });
241
+ _context.next = 17;
242
+ break;
243
+ case 15:
244
+ _context.prev = 15;
245
+ _context.t0 = _context["catch"](0);
246
+ case 17:
238
247
  setResourceLoading(false);
239
- case 13:
248
+ case 18:
240
249
  case "end":
241
250
  return _context.stop();
242
251
  }
243
- }, _callee);
252
+ }, _callee, null, [[0, 15]]);
244
253
  }));
245
254
  return function getResources(_x2) {
246
255
  return _ref.apply(this, arguments);
@@ -342,8 +351,8 @@ var Info = function Info() {
342
351
  */
343
352
  var getDiscount = function getDiscount() {
344
353
  var _state$service$cacheI2;
345
- var oPrice = Number(((_state$service$cacheI2 = state.service.cacheItem) === null || _state$service$cacheI2 === void 0 ? void 0 : _state$service$cacheI2.price) || 0);
346
- var cPrice = Number(usePrice || 0);
354
+ var oPrice = Number(((_state$service$cacheI2 = state.service.cacheItem) === null || _state$service$cacheI2 === void 0 ? void 0 : _state$service$cacheI2._extend.origin_total) || 0);
355
+ var cPrice = Number(useTotal || 0);
347
356
  var discount = "";
348
357
  // 原价 = 现价 为无折扣
349
358
  if (cPrice === oPrice) {
@@ -391,6 +400,9 @@ var Info = function Info() {
391
400
  _extend.relation_type = relation_type || "form";
392
401
  _extend.relation_id = item_id || (currentResource === null || currentResource === void 0 ? void 0 : currentResource.form_record_id) || 0;
393
402
  _extend.schedule_id = schedule_id || 0;
403
+ if (_extend.bundle_edit !== undefined) {
404
+ _extend.bundle_edit = 1;
405
+ }
394
406
  _item._extend = _extend;
395
407
 
396
408
  // 判断是新增还是编辑
@@ -439,11 +451,11 @@ var Info = function Info() {
439
451
  */
440
452
  var isReason = useMemo(function () {
441
453
  var _state$service$cacheI4;
442
- var oPrice = Number(((_state$service$cacheI4 = state.service.cacheItem) === null || _state$service$cacheI4 === void 0 ? void 0 : _state$service$cacheI4.price) || 0);
443
- var cPrice = Number(usePrice || 0);
454
+ var oPrice = Number(((_state$service$cacheI4 = state.service.cacheItem) === null || _state$service$cacheI4 === void 0 ? void 0 : _state$service$cacheI4._extend.origin_total) || 0);
455
+ var cPrice = Number(useTotal || 0);
444
456
  // 原价 !== 现价
445
457
  return cPrice !== oPrice;
446
- }, [usePrice, state.service.cacheItem]);
458
+ }, [useTotal, state.service.cacheItem]);
447
459
 
448
460
  /**
449
461
  * @title: 错误信息列表
@@ -501,7 +513,7 @@ var Info = function Info() {
501
513
  */
502
514
  useEffect(function () {
503
515
  getDiscount();
504
- }, [usePrice, state.service.cacheItem]);
516
+ }, [useTotal, state.service.cacheItem]);
505
517
 
506
518
  // useEffect(() => {
507
519
  // handleLikeResource("common");
@@ -511,13 +523,17 @@ var Info = function Info() {
511
523
  if (!((_state$service = state.service) !== null && _state$service !== void 0 && _state$service.cacheItem)) {
512
524
  return false;
513
525
  }
514
- return usePrice != ((_state$service2 = state.service) === null || _state$service2 === void 0 ? void 0 : (_state$service2$cache = _state$service2.cacheItem) === null || _state$service2$cache === void 0 ? void 0 : _state$service2$cache.price);
515
- }, [usePrice, (_state$service3 = state.service) === null || _state$service3 === void 0 ? void 0 : (_state$service3$cache = _state$service3.cacheItem) === null || _state$service3$cache === void 0 ? void 0 : _state$service3$cache.price]);
526
+ return useTotal != ((_state$service2 = state.service) === null || _state$service2 === void 0 ? void 0 : (_state$service2$cache = _state$service2.cacheItem) === null || _state$service2$cache === void 0 ? void 0 : _state$service2$cache._extend.origin_total);
527
+ }, [useTotal, (_state$service3 = state.service) === null || _state$service3 === void 0 ? void 0 : (_state$service3$cache = _state$service3.cacheItem) === null || _state$service3$cache === void 0 ? void 0 : _state$service3$cache._extend.origin_total]);
516
528
  useEffect(function () {
517
529
  if (useResource === 0) {
518
530
  handleLikeResource("common");
519
531
  }
520
532
  }, [useResource]);
533
+ var bundles = useMemo(function () {
534
+ var _state$service4, _state$service4$cache, _state$service4$cache2, _state$service4$cache3;
535
+ return ((_state$service4 = state.service) === null || _state$service4 === void 0 ? void 0 : (_state$service4$cache = _state$service4.cacheItem) === null || _state$service4$cache === void 0 ? void 0 : (_state$service4$cache2 = _state$service4$cache._extend) === null || _state$service4$cache2 === void 0 ? void 0 : (_state$service4$cache3 = _state$service4$cache2.other) === null || _state$service4$cache3 === void 0 ? void 0 : _state$service4$cache3.bundle) || [];
536
+ }, [(_state$service5 = state.service) === null || _state$service5 === void 0 ? void 0 : _state$service5.cacheItem]);
521
537
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Drawer, {
522
538
  zIndex: 1000,
523
539
  open: state.service.editModal,
@@ -546,9 +562,8 @@ var Info = function Info() {
546
562
  span: 24
547
563
  }, /*#__PURE__*/React.createElement(Form.Item, {
548
564
  name: "product_name"
549
- }, /*#__PURE__*/React.createElement(Select, {
550
- size: "large",
551
- open: false,
565
+ }, /*#__PURE__*/React.createElement("div", {
566
+ className: "current-service-info",
552
567
  onClick: function onClick() {
553
568
  if (state.channelDisabledEdit) {
554
569
  return;
@@ -561,11 +576,21 @@ var Info = function Info() {
561
576
  }
562
577
  });
563
578
  }
564
- }))), /*#__PURE__*/React.createElement(Col, {
579
+ }, /*#__PURE__*/React.createElement("div", {
580
+ className: "current-service-info-name"
581
+ }, ((_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.product_name) || "-"), /*#__PURE__*/React.createElement(CollapsibleList, {
582
+ style: {
583
+ marginTop: bundles.length ? "8px" : 0
584
+ },
585
+ list: bundles,
586
+ renderItem: function renderItem(item) {
587
+ return renderBundles(item, state.amountSymbol);
588
+ }
589
+ })))), /*#__PURE__*/React.createElement(Col, {
565
590
  span: 12
566
591
  }, /*#__PURE__*/React.createElement(Form.Item, {
567
592
  label: locales.getText("pisell2.text.price"),
568
- name: "price",
593
+ name: "total",
569
594
  rules: [{
570
595
  required: true
571
596
  }]
@@ -578,8 +603,8 @@ var Info = function Info() {
578
603
  width: "100%"
579
604
  },
580
605
  min: 0,
581
- max: ((_state$service$cacheI5 = state.service.cacheItem) === null || _state$service$cacheI5 === void 0 ? void 0 : _state$service$cacheI5.price) || 0,
582
- placeholder: ((_state$service$cacheI6 = state.service.cacheItem) === null || _state$service$cacheI6 === void 0 ? void 0 : _state$service$cacheI6.price) || "0"
606
+ max: ((_state$service$cacheI5 = state.service.cacheItem) === null || _state$service$cacheI5 === void 0 ? void 0 : (_state$service$cacheI6 = _state$service$cacheI5._extend) === null || _state$service$cacheI6 === void 0 ? void 0 : _state$service$cacheI6.origin_total) || 0,
607
+ placeholder: ((_state$service$cacheI7 = state.service.cacheItem) === null || _state$service$cacheI7 === void 0 ? void 0 : (_state$service$cacheI8 = _state$service$cacheI7._extend) === null || _state$service$cacheI8 === void 0 ? void 0 : _state$service$cacheI8.origin_total) || "0"
583
608
  }))), /*#__PURE__*/React.createElement(Col, {
584
609
  span: 12
585
610
  }, /*#__PURE__*/React.createElement(Form.Item, {
@@ -592,7 +617,7 @@ var Info = function Info() {
592
617
  allowClear: isDiscount,
593
618
  onChange: function onChange(e) {
594
619
  form.setFieldsValue({
595
- price: state.service.cacheItem.price
620
+ total: state.service.cacheItem._extend.origin_total
596
621
  });
597
622
  }
598
623
  }))), isReason ? /*#__PURE__*/React.createElement(Col, {
@@ -84,4 +84,25 @@
84
84
  .like-resource {}
85
85
  }
86
86
 
87
+ }
88
+
89
+ .current-service-info {
90
+ min-height: 40px;
91
+ cursor: pointer;
92
+ background-color: #ffffff;
93
+ border: 1px solid #D0D5DD;
94
+ border-radius: 10px;
95
+ transition: all 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);
96
+ overflow: hidden;
97
+ padding: 11px;
98
+
99
+ .current-service-info-name {
100
+ font-size: 16px;
101
+ color: #101828;
102
+ font-weight: 650;
103
+ }
104
+
105
+ &:hover {
106
+ border-color: #7f56d9;
107
+ }
87
108
  }
@@ -1,4 +1,4 @@
1
1
  import React from "react";
2
2
  import "./index.less";
3
- declare const Info: () => React.JSX.Element;
4
- export default Info;
3
+ declare const Service: () => React.JSX.Element;
4
+ export default Service;