@pisell/private-materials 3.0.119 → 3.0.121

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 (76) 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 +8 -8
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +11 -11
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +10 -10
  11. package/es/components/booking/addons/index.d.ts +1 -1
  12. package/es/components/booking/components/TabProduct/productItem/index.d.ts +2 -2
  13. package/es/components/booking/components/TabProduct/productItem/index.js +8 -7
  14. package/es/components/booking/forms/index.d.ts +1 -1
  15. package/es/components/booking/index.d.ts +1 -1
  16. package/es/components/booking/info/header/index.d.ts +2 -2
  17. package/es/components/booking/info/header/index.js +436 -44
  18. package/es/components/booking/info/header/index.less +110 -1
  19. package/es/components/booking/info/service/addService/index.js +3 -1
  20. package/es/components/booking/info/service/editService/index.js +3 -1
  21. package/es/components/booking/locales.d.ts +63 -0
  22. package/es/components/booking/locales.js +78 -6
  23. package/es/components/booking/payments/index.d.ts +1 -1
  24. package/es/components/schedules/components/ScheduleList/RenderScheduleItem/index.d.ts +12 -0
  25. package/es/components/schedules/components/ScheduleList/RenderScheduleItem/index.js +40 -0
  26. package/es/components/schedules/components/ScheduleList/RenderScheduleItem/index.less +38 -0
  27. package/es/components/schedules/components/ScheduleList/index.d.ts +5 -4
  28. package/es/components/schedules/components/ScheduleList/index.js +53 -43
  29. package/es/components/schedules/hooks/useSchedulesDataSource.js +5 -3
  30. package/es/components/schedules/products/list/index.d.ts +2 -2
  31. package/es/components/schedules/products/list/index.js +8 -8
  32. package/es/components/schedules/schedules/AllSchedules/index.d.ts +3 -3
  33. package/es/components/schedules/schedules/AllSchedules/index.js +9 -6
  34. package/es/components/schedules/schedules/AllSchedules/index.less +11 -3
  35. package/es/components/schedules/schedules/serve.d.ts +7 -0
  36. package/es/components/schedules/schedules/serve.js +24 -3
  37. package/es/components/schedules/schedules/utils.d.ts +22 -0
  38. package/es/components/schedules/schedules/utils.js +143 -1
  39. package/es/components/schedules/type.d.ts +7 -0
  40. package/es/components/tabProduct/index.d.ts +3 -2
  41. package/es/components/tabProduct/index.js +27 -18
  42. package/es/components/tabProduct/tabs/index.d.ts +3 -3
  43. package/es/components/tabProduct/tabs/index.js +34 -21
  44. package/lib/components/booking/addons/index.d.ts +1 -1
  45. package/lib/components/booking/components/TabProduct/productItem/index.d.ts +2 -2
  46. package/lib/components/booking/components/TabProduct/productItem/index.js +2 -1
  47. package/lib/components/booking/forms/index.d.ts +1 -1
  48. package/lib/components/booking/index.d.ts +1 -1
  49. package/lib/components/booking/info/header/index.d.ts +2 -2
  50. package/lib/components/booking/info/header/index.js +212 -11
  51. package/lib/components/booking/info/header/index.less +110 -1
  52. package/lib/components/booking/info/service/addService/index.js +3 -1
  53. package/lib/components/booking/info/service/editService/index.js +3 -1
  54. package/lib/components/booking/locales.d.ts +63 -0
  55. package/lib/components/booking/locales.js +72 -6
  56. package/lib/components/booking/payments/index.d.ts +1 -1
  57. package/lib/components/schedules/components/ScheduleList/RenderScheduleItem/index.d.ts +12 -0
  58. package/lib/components/schedules/components/ScheduleList/RenderScheduleItem/index.js +77 -0
  59. package/lib/components/schedules/components/ScheduleList/RenderScheduleItem/index.less +38 -0
  60. package/lib/components/schedules/components/ScheduleList/index.d.ts +5 -4
  61. package/lib/components/schedules/components/ScheduleList/index.js +38 -31
  62. package/lib/components/schedules/hooks/useSchedulesDataSource.js +8 -2
  63. package/lib/components/schedules/products/list/index.d.ts +2 -2
  64. package/lib/components/schedules/schedules/AllSchedules/index.d.ts +3 -3
  65. package/lib/components/schedules/schedules/AllSchedules/index.js +3 -2
  66. package/lib/components/schedules/schedules/AllSchedules/index.less +11 -3
  67. package/lib/components/schedules/schedules/serve.d.ts +7 -0
  68. package/lib/components/schedules/schedules/serve.js +5 -2
  69. package/lib/components/schedules/schedules/utils.d.ts +22 -0
  70. package/lib/components/schedules/schedules/utils.js +98 -0
  71. package/lib/components/schedules/type.d.ts +7 -0
  72. package/lib/components/tabProduct/index.d.ts +3 -2
  73. package/lib/components/tabProduct/index.js +15 -6
  74. package/lib/components/tabProduct/tabs/index.d.ts +3 -3
  75. package/lib/components/tabProduct/tabs/index.js +10 -6
  76. package/package.json +4 -4
@@ -13,5 +13,5 @@ export interface InfoProps {
13
13
  setGlobalState: any;
14
14
  }
15
15
  export declare const formatProducts: (values: any) => any;
16
- declare const Addons: import("react").ForwardRefExoticComponent<Pick<any, string | number | symbol> & import("react").RefAttributes<unknown>>;
16
+ declare const Addons: any;
17
17
  export default Addons;
@@ -1,4 +1,4 @@
1
- import React from "react";
2
- import "./index.less";
1
+ import React from 'react';
2
+ import './index.less';
3
3
  declare const ProductItem: ({ item, onClick, amountSymbol, style, className, }: any) => React.JSX.Element;
4
4
  export default ProductItem;
@@ -1,6 +1,6 @@
1
- import React, { useMemo } from "react";
2
- import { formatAmount, image, locales } from "@pisell/utils";
3
- import classNames from "classnames";
1
+ import React, { useMemo } from 'react';
2
+ import { formatAmount, image, locales } from '@pisell/utils';
3
+ import classNames from 'classnames';
4
4
  import { getDiscountTime } from "../../../utils";
5
5
  import "./index.less";
6
6
  var ProductItem = function ProductItem(_ref) {
@@ -13,17 +13,18 @@ var ProductItem = function ProductItem(_ref) {
13
13
  if (item.is_track === 0) {
14
14
  return false;
15
15
  }
16
- return "".concat(item.stock_quantity, " ").concat(locales.getText("pisell2.text.stock"));
16
+ return "".concat(item.stock_quantity, " ").concat(locales.getText('pisell2.text.stock'));
17
17
  }, [item.stock_quantity, item.is_track]);
18
18
  return /*#__PURE__*/React.createElement("div", {
19
19
  style: style,
20
- className: classNames("server-product", className),
20
+ className: classNames('server-product', className),
21
21
  onClick: function onClick() {
22
- _onClick(item, "select");
22
+ _onClick(item, 'select');
23
23
  }
24
24
  }, item.cover ? /*#__PURE__*/React.createElement("img", {
25
25
  src: image.ali(item.cover, 100),
26
- className: "server-product-cover"
26
+ className: "server-product-cover",
27
+ loading: "lazy"
27
28
  // onClick={(e) => {
28
29
  // e.preventDefault();
29
30
  // e.stopPropagation();
@@ -5,5 +5,5 @@ export interface InfoProps {
5
5
  globalState: any;
6
6
  setGlobalState: any;
7
7
  }
8
- declare const Forms: import("react").ForwardRefExoticComponent<Pick<any, string | number | symbol> & import("react").RefAttributes<unknown>>;
8
+ declare const Forms: any;
9
9
  export default Forms;
@@ -1,2 +1,2 @@
1
- declare const Booking: import("react").ForwardRefExoticComponent<Pick<any, string | number | symbol> & import("react").RefAttributes<unknown>>;
1
+ declare const Booking: any;
2
2
  export default Booking;
@@ -1,4 +1,4 @@
1
- import React from "react";
2
- import "./index.less";
1
+ import React from 'react';
2
+ import './index.less';
3
3
  declare const header: ({ state, dispatch }: any) => React.JSX.Element;
4
4
  export default header;
@@ -1,45 +1,90 @@
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 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
+ 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
+ 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
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
6
+ 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); }
2
7
  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
8
  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
9
  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
- import React, { useMemo } from "react";
6
- import { Dropdown, message } from "antd";
7
- import { locales } from "@pisell/utils";
8
- import { DownOutlined } from "@ant-design/icons";
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; }
16
+ import React, { useState, useMemo } from 'react';
17
+ import { Dropdown, message, Modal, Button } from 'antd';
18
+ import { locales } from '@pisell/utils';
19
+ import { DownOutlined } from '@ant-design/icons';
20
+ import useEngineContext from "../../../../hooks/useEngineContext";
9
21
  import "./index.less";
22
+ import classNames from 'classnames';
10
23
  var header = function header(_ref) {
11
- var _state$bookingDetail, _state$bookingDetail2, _state$bookingDetail3;
24
+ var _context$appHelper, _state$bookingDetail2, _state$service2, _state$bookingDetail4, _state$bookingDetail5, _state$bookingDetail6, _state$bookingDetail7, _state$bookingDetail8;
12
25
  var state = _ref.state,
13
26
  dispatch = _ref.dispatch;
27
+ var context = useEngineContext();
28
+ var _useState = useState({
29
+ open: false,
30
+ children: '',
31
+ footer: null,
32
+ title: /*#__PURE__*/React.createElement("div", {
33
+ className: "",
34
+ style: {
35
+ height: 14
36
+ }
37
+ })
38
+ }),
39
+ _useState2 = _slicedToArray(_useState, 2),
40
+ modalContent = _useState2[0],
41
+ setModalContent = _useState2[1];
42
+ var _context$appHelper$ut = (_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 ? void 0 : _context$appHelper.utils,
43
+ isTerminal = _context$appHelper$ut.isTerminal,
44
+ interaction = _context$appHelper$ut.interaction,
45
+ store = _context$appHelper$ut.store,
46
+ storage = _context$appHelper$ut.storage;
47
+
48
+ // 预约状态列表
14
49
  var statusList = [{
15
- label: locales.getText("pisell2.text.status.new"),
16
- key: "new",
17
- color: "#079455"
50
+ label: locales.getText('pisell2.text.status.new'),
51
+ key: 'new',
52
+ color: '#079455'
18
53
  }, {
19
- label: locales.getText("pisell2.text.status.confirmed"),
20
- key: "confirmed",
21
- color: "#7F56D9"
54
+ label: locales.getText('pisell2.text.status.confirmed'),
55
+ key: 'confirmed',
56
+ color: '#7F56D9'
22
57
  }, {
23
- label: locales.getText("pisell2.text.status.arrived"),
24
- key: "arrived",
25
- color: "#088AB2"
58
+ label: locales.getText('pisell2.text.status.arrived'),
59
+ key: 'arrived',
60
+ color: '#088AB2'
26
61
  }, {
27
- label: locales.getText("pisell2.text.status.started"),
28
- key: "started",
29
- color: "#155EEF"
62
+ label: locales.getText('pisell2.text.status.started'),
63
+ key: 'started',
64
+ color: '#155EEF'
30
65
  }, {
31
- label: locales.getText("pisell2.text.status.cancelled"),
32
- key: "cancelled",
33
- color: "#DC6803"
66
+ label: /*#__PURE__*/React.createElement("span", {
67
+ style: {
68
+ color: '#D92D20'
69
+ }
70
+ }, locales.getText('pisell2.text.status.cancelled')),
71
+ key: 'cancelled',
72
+ color: '#DC6803'
34
73
  }, {
35
- label: locales.getText("pisell2.text.status.no_show"),
36
- key: "no_show",
37
- color: "#D92D20"
74
+ label: /*#__PURE__*/React.createElement("span", {
75
+ style: {
76
+ color: '#D92D20'
77
+ }
78
+ }, locales.getText('pisell2.text.status.no_show')),
79
+ key: 'no_show',
80
+ color: '#D92D20'
38
81
  }, {
39
- label: locales.getText("pisell2.text.status.completed"),
40
- key: "completed",
41
- color: "#4A5578"
82
+ label: locales.getText('pisell2.text.status.completed'),
83
+ key: 'completed',
84
+ color: '#4A5578'
42
85
  }];
86
+
87
+ // 销售渠道
43
88
  var orderSalesChannel = {
44
89
  online_store: locales.getText('pisell2.text.order.sales.channel.online'),
45
90
  pos: locales.getText('pisell2.text.order.sales.channel.pos-terminal'),
@@ -47,6 +92,14 @@ var header = function header(_ref) {
47
92
  'table-order': locales.getText('pisell2.text.order.sales.channel.tableorder'),
48
93
  google_reserve: locales.getText('pisell2.text.order.sales.channel.reserve')
49
94
  };
95
+
96
+ /**
97
+ * @title: 预约状态字典
98
+ * @description:
99
+ * @return {*}
100
+ * @Author: zhiwei.Wang
101
+ * @Date: 2024-08-22 09:31
102
+ */
50
103
  var getStatusMap = function getStatusMap() {
51
104
  var obj = {};
52
105
  for (var i = 0; i < statusList.length; i++) {
@@ -55,65 +108,404 @@ var header = function header(_ref) {
55
108
  return obj;
56
109
  };
57
110
  var statusMps = getStatusMap();
58
- var items = statusList;
111
+ var items = useMemo(function () {
112
+ return statusList.filter(function (item) {
113
+ return item.key !== state.appointment_status;
114
+ });
115
+ }, [statusList]);
116
+
117
+ /**
118
+ * @title: 当前状态
119
+ * @description:
120
+ * @param {*} useMemo
121
+ * @return {*}
122
+ * @Author: zhiwei.Wang
123
+ * @Date: 2024-08-22 09:32
124
+ */
59
125
  var currentStatus = useMemo(function () {
60
126
  var status = state.appointment_status;
61
- return statusMps[status] || statusMps["new"];
127
+ return statusMps[status] || statusMps['new'];
62
128
  }, [state.appointment_status]);
63
- var onSelect = /*#__PURE__*/function () {
64
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(e) {
65
- var status, data;
129
+
130
+ /**
131
+ * @title: 设置预约状态
132
+ * @description:
133
+ * @param {string} status
134
+ * @return {*}
135
+ * @Author: zhiwei.Wang
136
+ * @Date: 2024-08-22 09:30
137
+ */
138
+ var setBookingStatus = /*#__PURE__*/function () {
139
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(status) {
140
+ var data;
66
141
  return _regeneratorRuntime().wrap(function _callee$(_context) {
67
142
  while (1) switch (_context.prev = _context.next) {
68
143
  case 0:
69
- status = e.key;
144
+ // 先更新本地
70
145
  dispatch({
71
- type: "setStatus",
146
+ type: 'setStatus',
72
147
  payload: status
73
148
  });
74
- _context.next = 4;
149
+
150
+ // 同步接口
151
+ _context.next = 3;
75
152
  return state.apis.editBookingStatus({
76
153
  appointment_status: status
77
154
  });
78
- case 4:
155
+ case 3:
79
156
  data = _context.sent;
80
- message.success(locales.getText("pisell1.text.edit-status-success"));
157
+ message.success(locales.getText('pisell1.text.edit-status-success'));
158
+
159
+ // 回调外部
81
160
  state === null || state === void 0 ? void 0 : state.callback({
82
161
  order_id: state.bookingId
83
162
  });
84
- case 7:
163
+ case 6:
85
164
  case "end":
86
165
  return _context.stop();
87
166
  }
88
167
  }, _callee);
89
168
  }));
90
- return function onSelect(_x) {
169
+ return function setBookingStatus(_x2) {
91
170
  return _ref2.apply(this, arguments);
92
171
  };
93
172
  }();
94
- return /*#__PURE__*/React.createElement("div", {
173
+
174
+ /**
175
+ * @title: 修改预约状态回调
176
+ * @description:
177
+ * @param {any} e
178
+ * @return {*}
179
+ * @Author: zhiwei.Wang
180
+ * @Date: 2024-08-22 09:30
181
+ */
182
+ var onSelect = /*#__PURE__*/function () {
183
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(e) {
184
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
185
+ while (1) switch (_context2.prev = _context2.next) {
186
+ case 0:
187
+ if (!(e.key === 'cancelled')) {
188
+ _context2.next = 3;
189
+ break;
190
+ }
191
+ handleCancel();
192
+ return _context2.abrupt("return");
193
+ case 3:
194
+ _context2.next = 5;
195
+ return setBookingStatus(e.key);
196
+ case 5:
197
+ case "end":
198
+ return _context2.stop();
199
+ }
200
+ }, _callee2);
201
+ }));
202
+ return function onSelect(_x3) {
203
+ return _ref3.apply(this, arguments);
204
+ };
205
+ }();
206
+ var setModalContentState = function setModalContentState(values) {
207
+ setModalContent(_objectSpread(_objectSpread({}, modalContent), values));
208
+ };
209
+
210
+ /**
211
+ * @title: 跳转到支付页面
212
+ * @description:
213
+ * @return {*}
214
+ * @Author: zhiwei.Wang
215
+ * @Date: 2024-08-22 09:32
216
+ */
217
+ var goCheckout = /*#__PURE__*/function () {
218
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
219
+ var _interaction$utils, _interaction$utils$po;
220
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
221
+ while (1) switch (_context3.prev = _context3.next) {
222
+ case 0:
223
+ if (!(isTerminal !== null && isTerminal !== void 0 && isTerminal())) {
224
+ _context3.next = 2;
225
+ break;
226
+ }
227
+ return _context3.abrupt("return", interaction === null || interaction === void 0 ? void 0 : (_interaction$utils = interaction.utils) === null || _interaction$utils === void 0 ? void 0 : (_interaction$utils$po = _interaction$utils.postMessageToApp) === null || _interaction$utils$po === void 0 ? void 0 : _interaction$utils$po.call(_interaction$utils, {
228
+ module: 'booking',
229
+ key: 'booking_checkout',
230
+ data: {
231
+ order_id: state.bookingId
232
+ }
233
+ }));
234
+ case 2:
235
+ // web中打开pisell1 checkout模块
236
+ state.action({
237
+ type: 'pisell1.handlePayment',
238
+ data: {
239
+ orderId: state.bookingId
240
+ },
241
+ callback: function callback() {
242
+ state === null || state === void 0 ? void 0 : state.callback();
243
+ }
244
+ });
245
+ case 3:
246
+ case "end":
247
+ return _context3.stop();
248
+ }
249
+ }, _callee3);
250
+ }));
251
+ return function goCheckout() {
252
+ return _ref4.apply(this, arguments);
253
+ };
254
+ }();
255
+
256
+ /**
257
+ * @title: 是否支付或者部分付款
258
+ * @description:
259
+ * @param {*} useMemo
260
+ * @return {*}
261
+ * @Author: zhiwei.Wang
262
+ * @Date: 2024-08-22 09:22
263
+ */
264
+ var isPaid = useMemo(function () {
265
+ return ['partially_paid', 'paid'].find(function (d) {
266
+ var _state$bookingDetail;
267
+ return d === ((_state$bookingDetail = state.bookingDetail) === null || _state$bookingDetail === void 0 ? void 0 : _state$bookingDetail.payment_status);
268
+ });
269
+ }, [(_state$bookingDetail2 = state.bookingDetail) === null || _state$bookingDetail2 === void 0 ? void 0 : _state$bookingDetail2.payment_status]);
270
+
271
+ /**
272
+ * @title: 是否包含票务商品
273
+ * @description:
274
+ * @param {*} useMemo
275
+ * @return {*}
276
+ * @Author: zhiwei.Wang
277
+ * @Date: 2024-08-22 09:25
278
+ */
279
+ var isTicket = useMemo(function () {
280
+ var _state$service;
281
+ return (((_state$service = state.service) === null || _state$service === void 0 ? void 0 : _state$service.value) || []).some(function (d) {
282
+ return ['appointment_ticket', 'product_package_ticket', 'ticket'].includes(d.extension_type);
283
+ });
284
+ }, [(_state$service2 = state.service) === null || _state$service2 === void 0 ? void 0 : _state$service2.value]);
285
+
286
+ /**
287
+ * @title: 是否存在待确认的支付
288
+ * @description:
289
+ * @param {*} useMemo
290
+ * @return {*}
291
+ * @Author: zhiwei.Wang
292
+ * @Date: 2024-08-22 09:32
293
+ */
294
+ var isPaymentProcessingPayments = useMemo(function () {
295
+ var _state$bookingDetail3;
296
+ // 根据订单详情内 待确认支付列表 的长度判断
297
+ return !!((_state$bookingDetail3 = state.bookingDetail) !== null && _state$bookingDetail3 !== void 0 && _state$bookingDetail3.payment_processing_payment_nums);
298
+ }, [(_state$bookingDetail4 = state.bookingDetail) === null || _state$bookingDetail4 === void 0 ? void 0 : (_state$bookingDetail5 = _state$bookingDetail4.payment_processing_payments) === null || _state$bookingDetail5 === void 0 ? void 0 : _state$bookingDetail5.length]);
299
+
300
+ /**
301
+ * @title: 取消预约
302
+ * @description:
303
+ * @return {*}
304
+ * @Author: zhiwei.Wang
305
+ * @Date: 2024-08-22 09:33
306
+ */
307
+ var handleCancel = function handleCancel() {
308
+ // 存在待确认的支付,则弹窗提示
309
+ if (isPaymentProcessingPayments) {
310
+ return showPaymentModal();
311
+ }
312
+
313
+ // 取消
314
+ return showCancelledModal();
315
+ };
316
+
317
+ /**
318
+ * @title: 退款
319
+ * @description:
320
+ * @return {*}
321
+ * @Author: zhiwei.Wang
322
+ * @Date: 2024-01-30 16:57
323
+ */
324
+ var handleRefund = function handleRefund() {
325
+ // terminal中打开原生refund模块
326
+ if (isTerminal !== null && isTerminal !== void 0 && isTerminal()) {
327
+ var _interaction$utils2, _interaction$utils2$p;
328
+ return interaction === null || interaction === void 0 ? void 0 : (_interaction$utils2 = interaction.utils) === null || _interaction$utils2 === void 0 ? void 0 : (_interaction$utils2$p = _interaction$utils2.postMessageToApp) === null || _interaction$utils2$p === void 0 ? void 0 : _interaction$utils2$p.call(_interaction$utils2, {
329
+ module: 'booking',
330
+ key: 'booking_refund',
331
+ data: {
332
+ order_id: state.bookingId
333
+ },
334
+ origin: '/booking'
335
+ });
336
+ }
337
+
338
+ // web中打开pisell1 refund模块
339
+ state.action({
340
+ type: 'pisell1.handleRefund',
341
+ data: {
342
+ orderId: state.bookingId
343
+ },
344
+ callback: function callback() {
345
+ state === null || state === void 0 ? void 0 : state.callback({
346
+ order_id: state.bookingId
347
+ });
348
+ }
349
+ });
350
+ };
351
+
352
+ /**
353
+ * @title: 显示去支付的弹窗
354
+ * @description:
355
+ * @return {*}
356
+ * @Author: zhiwei.Wang
357
+ * @Date: 2024-08-22 09:33
358
+ */
359
+ var showPaymentModal = function showPaymentModal() {
360
+ setModalContentState({
361
+ className: 'go-payments-modal-wrap',
362
+ open: true,
363
+ width: 480,
364
+ onCancel: function onCancel() {
365
+ setModalContentState({
366
+ open: false
367
+ });
368
+ },
369
+ children: /*#__PURE__*/React.createElement("div", {
370
+ className: "go-payments-modal-content"
371
+ }, /*#__PURE__*/React.createElement("div", {
372
+ className: "go-payments-modal-content-title"
373
+ }, locales.getText('page.booking.text.unconfirmed-payements')), /*#__PURE__*/React.createElement("div", {
374
+ className: "go-payments-modal-content-desc"
375
+ }, locales.getText('page.booking.text.unconfirmed-payements.msg')), /*#__PURE__*/React.createElement("div", {
376
+ className: "go-payments-footer"
377
+ }, /*#__PURE__*/React.createElement(Button, {
378
+ className: "go-payments-footer-btn",
379
+ size: "large",
380
+ onClick: function onClick() {
381
+ setModalContentState({
382
+ open: false
383
+ });
384
+ }
385
+ }, locales.getText('pisell2.text.status.cancelled')), /*#__PURE__*/React.createElement(Button, {
386
+ className: "go-payments-footer-btn",
387
+ type: "primary",
388
+ size: "large",
389
+ onClick: function onClick() {
390
+ goCheckout();
391
+ setModalContentState({
392
+ open: false
393
+ });
394
+ }
395
+ }, locales.getText('page.booking.text.go-to-payments')))),
396
+ footer: null
397
+ });
398
+ };
399
+
400
+ /**
401
+ * @title: 显示取消预约弹窗
402
+ * @description:
403
+ * @return {*}
404
+ * @Author: zhiwei.Wang
405
+ * @Date: 2024-08-22 09:34
406
+ */
407
+ var showCancelledModal = function showCancelledModal() {
408
+ var cancelBtn = /*#__PURE__*/React.createElement(Button, {
409
+ className: "go-payments-footer-btn",
410
+ size: "large",
411
+ type: "primary",
412
+ onClick: function onClick() {
413
+ setBookingStatus('cancelled');
414
+ setModalContentState({
415
+ open: false
416
+ });
417
+ }
418
+ }, locales.getText('page.booking.text.cancel-only'));
419
+ var refundBtn = /*#__PURE__*/React.createElement(Button, {
420
+ className: "go-payments-footer-btn",
421
+ size: "large",
422
+ danger: true,
423
+ ghost: true,
424
+ onClick: function onClick() {
425
+ handleRefund();
426
+ setModalContentState({
427
+ open: false
428
+ });
429
+ }
430
+ }, locales.getText('page.booking.text.refund'));
431
+ var okBtn = /*#__PURE__*/React.createElement(Button, {
432
+ className: "go-payments-footer-btn",
433
+ size: "large",
434
+ type: "primary",
435
+ onClick: function onClick() {
436
+ setBookingStatus('cancelled');
437
+ setModalContentState({
438
+ open: false
439
+ });
440
+ }
441
+ }, locales.getText('page.booking.text.confirm'));
442
+ var backBtn = /*#__PURE__*/React.createElement(Button, {
443
+ className: "go-payments-footer-btn",
444
+ size: "large",
445
+ onClick: function onClick() {
446
+ setModalContentState({
447
+ open: false
448
+ });
449
+ }
450
+ }, locales.getText('page.booking.text.go-back'));
451
+ setModalContentState({
452
+ className: 'go-payments-modal-wrap',
453
+ open: true,
454
+ width: 480,
455
+ onCancel: function onCancel() {
456
+ setModalContentState({
457
+ open: false
458
+ });
459
+ },
460
+ children: /*#__PURE__*/React.createElement("div", {
461
+ className: "go-payments-modal-content"
462
+ }, /*#__PURE__*/React.createElement("div", {
463
+ className: "cancelled-modal-content-title"
464
+ }, locales.getText('page.booking.text.cancel-booking')), /*#__PURE__*/React.createElement("div", {
465
+ className: "cancelled-modal-content-desc cancelled-modal-content-desc-red"
466
+ }, locales.getText('page.booking.text.cancel-booking.msg')), isTicket ? /*#__PURE__*/React.createElement("div", {
467
+ className: "cancelled-modal-content-desc"
468
+ }, locales.getText('page.booking.text.disabled-tickets')) : null, isPaid ? /*#__PURE__*/React.createElement("div", {
469
+ className: "cancelled-modal-content-list-wrap"
470
+ }, /*#__PURE__*/React.createElement("div", {
471
+ className: "cancelled-modal-content-list-title"
472
+ }, locales.getText('page.booking.text.paid.msg')(isPaid), ' ', locales.getText('page.booking.text.please-choose-an-option')), /*#__PURE__*/React.createElement("ul", {
473
+ className: "cancelled-modal-content-ul"
474
+ }, /*#__PURE__*/React.createElement("li", {
475
+ className: "cancelled-modal-content-li"
476
+ }, locales.getText('page.booking.text.please-choose-an-option-2')), /*#__PURE__*/React.createElement("li", {
477
+ className: "cancelled-modal-content-li"
478
+ }, locales.getText('page.booking.text.please-choose-an-option-1')))) : null, /*#__PURE__*/React.createElement("div", {
479
+ className: classNames('go-payments-footer', {
480
+ 'go-payments-footer-column': isPaid
481
+ })
482
+ }, isPaid ? /*#__PURE__*/React.createElement(React.Fragment, null, cancelBtn, refundBtn, backBtn) : /*#__PURE__*/React.createElement(React.Fragment, null, backBtn, okBtn))),
483
+ footer: null
484
+ });
485
+ };
486
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
95
487
  className: "booking-header",
96
488
  style: {
97
489
  backgroundColor: currentStatus.color
98
490
  }
99
491
  }, /*#__PURE__*/React.createElement("div", {
100
492
  className: "booking-order-sales-channel"
101
- }, orderSalesChannel[(_state$bookingDetail = state.bookingDetail) === null || _state$bookingDetail === void 0 ? void 0 : _state$bookingDetail.order_sales_channel] || ""), /*#__PURE__*/React.createElement("div", {
493
+ }, orderSalesChannel[(_state$bookingDetail6 = state.bookingDetail) === null || _state$bookingDetail6 === void 0 ? void 0 : _state$bookingDetail6.order_sales_channel] || ''), /*#__PURE__*/React.createElement("div", {
102
494
  className: "booking-header-line-2"
103
495
  }, /*#__PURE__*/React.createElement("div", {
104
496
  className: "booking-header-left"
105
- }, locales.getText("pisell2.text.status.booking_id"), ":", " ", ((_state$bookingDetail2 = state.bookingDetail) === null || _state$bookingDetail2 === void 0 ? void 0 : (_state$bookingDetail3 = _state$bookingDetail2.bookings) === null || _state$bookingDetail3 === void 0 ? void 0 : _state$bookingDetail3.booking_id) || "-"), /*#__PURE__*/React.createElement("div", {
497
+ }, locales.getText('pisell2.text.status.booking_id'), ":", ' ', ((_state$bookingDetail7 = state.bookingDetail) === null || _state$bookingDetail7 === void 0 ? void 0 : (_state$bookingDetail8 = _state$bookingDetail7.bookings) === null || _state$bookingDetail8 === void 0 ? void 0 : _state$bookingDetail8.booking_id) || '-'), /*#__PURE__*/React.createElement("div", {
106
498
  className: "booking-header-right"
107
499
  }, /*#__PURE__*/React.createElement(Dropdown, {
108
500
  menu: {
109
501
  items: items,
110
502
  onClick: onSelect
111
503
  },
112
- disabled: state.appointment_status === "cancelled"
504
+ disabled: state.appointment_status === 'cancelled'
113
505
  }, /*#__PURE__*/React.createElement("div", {
114
506
  className: "booking-header-right-status"
115
- }, currentStatus.label, state.appointment_status !== "cancelled" ? /*#__PURE__*/React.createElement(DownOutlined, {
507
+ }, currentStatus.label, state.appointment_status !== 'cancelled' ? /*#__PURE__*/React.createElement(DownOutlined, {
116
508
  className: "booking-header-right-status-icon"
117
- }) : null)))));
509
+ }) : null))))), /*#__PURE__*/React.createElement(Modal, modalContent));
118
510
  };
119
511
  export default header;