@pisell/private-materials 3.2.17 → 3.2.19
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 +8 -8
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +7 -7
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +7 -7
- package/es/components/appointmentBooking/components/{Provider/Cart → Cart}/ContinueButton/index.js +19 -10
- package/es/components/appointmentBooking/components/{Provider/Cart → Cart}/Item/Total.js +10 -20
- package/es/components/appointmentBooking/components/Cart/Item/index.js +73 -0
- package/es/components/appointmentBooking/components/Content/index.js +29 -15
- package/es/components/appointmentBooking/components/Date/index.js +77 -12
- package/es/components/appointmentBooking/components/Date/index.less +1 -0
- package/es/components/appointmentBooking/components/Footer/index.js +3 -3
- package/es/components/appointmentBooking/components/Guest/index.d.ts +3 -0
- package/es/components/appointmentBooking/components/{Provider/Information → Guest}/index.js +50 -59
- package/es/components/appointmentBooking/components/Header/index.js +6 -4
- package/es/components/appointmentBooking/components/Resource/index.d.ts +1 -1
- package/es/components/appointmentBooking/components/Resource/index.js +62 -29
- package/es/components/appointmentBooking/components/Resource/index.less +6 -0
- package/es/components/appointmentBooking/components/Services/index.js +25 -135
- package/es/components/appointmentBooking/components/TimeSlicing/index.d.ts +1 -1
- package/es/components/appointmentBooking/components/TimeSlicing/index.js +57 -755
- package/es/components/appointmentBooking/context.d.ts +23 -0
- package/es/components/appointmentBooking/context.js +71 -0
- package/es/components/appointmentBooking/hooks.d.ts +6 -8
- package/es/components/appointmentBooking/hooks.js +119 -62
- package/es/components/appointmentBooking/index.js +2 -3
- package/es/components/appointmentBooking/locales.d.ts +12 -0
- package/es/components/appointmentBooking/locales.js +21 -3
- package/es/components/appointmentBooking/utils.d.ts +12 -0
- package/es/components/appointmentBooking/utils.js +70 -0
- package/lib/components/appointmentBooking/components/{Provider/Cart → Cart}/ContinueButton/index.js +18 -16
- package/lib/components/appointmentBooking/components/{Provider/Cart → Cart}/Item/Total.js +7 -11
- package/lib/components/appointmentBooking/components/{Provider/Cart → Cart}/Item/index.js +22 -21
- package/lib/components/appointmentBooking/components/{Provider/Cart → Cart}/index.js +1 -1
- package/lib/components/appointmentBooking/components/Content/index.js +26 -14
- package/lib/components/appointmentBooking/components/Date/index.js +53 -16
- package/lib/components/appointmentBooking/components/Date/index.less +1 -0
- package/lib/components/appointmentBooking/components/Footer/index.js +3 -3
- package/lib/components/appointmentBooking/components/Guest/index.d.ts +3 -0
- package/lib/components/appointmentBooking/components/{Provider/Information → Guest}/index.js +43 -52
- package/lib/components/appointmentBooking/components/Header/index.js +2 -3
- package/lib/components/appointmentBooking/components/Resource/index.d.ts +1 -1
- package/lib/components/appointmentBooking/components/Resource/index.js +55 -41
- package/lib/components/appointmentBooking/components/Resource/index.less +6 -0
- package/lib/components/appointmentBooking/components/Services/index.js +15 -155
- package/lib/components/appointmentBooking/components/TimeSlicing/index.d.ts +1 -1
- package/lib/components/appointmentBooking/components/TimeSlicing/index.js +27 -940
- package/lib/components/appointmentBooking/context.d.ts +23 -0
- package/lib/components/appointmentBooking/context.js +85 -0
- package/lib/components/appointmentBooking/hooks.d.ts +6 -8
- package/lib/components/appointmentBooking/hooks.js +44 -20
- package/lib/components/appointmentBooking/index.js +2 -5
- package/lib/components/appointmentBooking/locales.d.ts +12 -0
- package/lib/components/appointmentBooking/locales.js +15 -3
- package/lib/components/appointmentBooking/utils.d.ts +12 -0
- package/lib/components/appointmentBooking/utils.js +62 -2
- package/package.json +2 -2
- package/es/components/appointmentBooking/components/Information/index.d.ts +0 -3
- package/es/components/appointmentBooking/components/Information/index.js +0 -178
- package/es/components/appointmentBooking/components/Provider/Cart/Item/index.d.ts +0 -3
- package/es/components/appointmentBooking/components/Provider/Cart/Item/index.js +0 -68
- package/es/components/appointmentBooking/components/Provider/Content/index.d.ts +0 -3
- package/es/components/appointmentBooking/components/Provider/Content/index.js +0 -64
- package/es/components/appointmentBooking/components/Provider/Content/index.less +0 -31
- package/es/components/appointmentBooking/components/Provider/EmptyHolderModal/index.d.ts +0 -3
- package/es/components/appointmentBooking/components/Provider/EmptyHolderModal/index.js +0 -34
- package/es/components/appointmentBooking/components/Provider/EmptyHolderModal/index.less +0 -17
- package/es/components/appointmentBooking/components/Provider/Event/index.d.ts +0 -3
- package/es/components/appointmentBooking/components/Provider/Event/index.js +0 -93
- package/es/components/appointmentBooking/components/Provider/Event/index.less +0 -20
- package/es/components/appointmentBooking/components/Provider/Information/index.d.ts +0 -3
- package/es/components/appointmentBooking/components/Provider/InformationOptionsModal/index.d.ts +0 -3
- package/es/components/appointmentBooking/components/Provider/InformationOptionsModal/index.js +0 -34
- package/es/components/appointmentBooking/components/Provider/InformationOptionsModal/index.less +0 -27
- package/es/components/appointmentBooking/components/Provider/OrderProductModal/index.d.ts +0 -3
- package/es/components/appointmentBooking/components/Provider/OrderProductModal/index.js +0 -27
- package/es/components/appointmentBooking/components/Provider/OrderProductModal/index.less +0 -32
- package/es/components/appointmentBooking/components/Provider/RemoveOptionConfirmModal.d.ts +0 -2
- package/es/components/appointmentBooking/components/Provider/RemoveOptionConfirmModal.js +0 -31
- package/es/components/appointmentBooking/components/Provider/Resource/index.d.ts +0 -3
- package/es/components/appointmentBooking/components/Provider/Resource/index.js +0 -79
- package/es/components/appointmentBooking/components/Provider/Resource/index.less +0 -46
- package/es/components/appointmentBooking/components/Provider/SelectHolderModal.d.ts +0 -2
- package/es/components/appointmentBooking/components/Provider/SelectHolderModal.js +0 -90
- package/es/components/appointmentBooking/components/Provider/SelectProduct/index.d.ts +0 -4
- package/es/components/appointmentBooking/components/Provider/SelectProduct/index.js +0 -77
- package/es/components/appointmentBooking/components/Provider/SelectProduct/index.less +0 -131
- package/es/components/booking/info/service2/utils.d.ts +0 -240
- package/es/components/eventBooking/components/Provider/Cart/Item/index.d.ts +0 -3
- package/es/components/eventBooking/components/Provider/Information/index.d.ts +0 -3
- package/lib/components/appointmentBooking/components/Information/index.d.ts +0 -3
- package/lib/components/appointmentBooking/components/Information/index.js +0 -151
- package/lib/components/appointmentBooking/components/Information/index.less +0 -92
- package/lib/components/appointmentBooking/components/Provider/Cart/Item/index.d.ts +0 -3
- package/lib/components/appointmentBooking/components/Provider/Content/index.d.ts +0 -3
- package/lib/components/appointmentBooking/components/Provider/Content/index.js +0 -90
- package/lib/components/appointmentBooking/components/Provider/Content/index.less +0 -31
- package/lib/components/appointmentBooking/components/Provider/EmptyHolderModal/index.d.ts +0 -3
- package/lib/components/appointmentBooking/components/Provider/EmptyHolderModal/index.js +0 -60
- package/lib/components/appointmentBooking/components/Provider/EmptyHolderModal/index.less +0 -17
- package/lib/components/appointmentBooking/components/Provider/Event/index.d.ts +0 -3
- package/lib/components/appointmentBooking/components/Provider/Event/index.js +0 -100
- package/lib/components/appointmentBooking/components/Provider/Event/index.less +0 -20
- package/lib/components/appointmentBooking/components/Provider/Information/index.d.ts +0 -3
- package/lib/components/appointmentBooking/components/Provider/Information/index.less +0 -92
- package/lib/components/appointmentBooking/components/Provider/InformationOptionsModal/index.d.ts +0 -3
- package/lib/components/appointmentBooking/components/Provider/InformationOptionsModal/index.js +0 -67
- package/lib/components/appointmentBooking/components/Provider/InformationOptionsModal/index.less +0 -27
- package/lib/components/appointmentBooking/components/Provider/OrderProductModal/index.d.ts +0 -3
- package/lib/components/appointmentBooking/components/Provider/OrderProductModal/index.js +0 -57
- package/lib/components/appointmentBooking/components/Provider/OrderProductModal/index.less +0 -32
- package/lib/components/appointmentBooking/components/Provider/RemoveOptionConfirmModal.d.ts +0 -2
- package/lib/components/appointmentBooking/components/Provider/RemoveOptionConfirmModal.js +0 -62
- package/lib/components/appointmentBooking/components/Provider/Resource/index.d.ts +0 -3
- package/lib/components/appointmentBooking/components/Provider/Resource/index.js +0 -90
- package/lib/components/appointmentBooking/components/Provider/Resource/index.less +0 -46
- package/lib/components/appointmentBooking/components/Provider/SelectHolderModal.d.ts +0 -2
- package/lib/components/appointmentBooking/components/Provider/SelectHolderModal.js +0 -97
- package/lib/components/appointmentBooking/components/Provider/SelectProduct/index.d.ts +0 -4
- package/lib/components/appointmentBooking/components/Provider/SelectProduct/index.js +0 -69
- package/lib/components/appointmentBooking/components/Provider/SelectProduct/index.less +0 -131
- package/lib/components/booking/info/service2/utils.d.ts +0 -240
- package/lib/components/eventBooking/components/Provider/Cart/Item/index.d.ts +0 -3
- package/lib/components/eventBooking/components/Provider/Information/index.d.ts +0 -3
- /package/es/components/appointmentBooking/components/{Provider/Cart → Cart}/ContinueButton/index.d.ts +0 -0
- /package/es/components/appointmentBooking/components/{Provider/Cart → Cart}/ContinueButton/index.less +0 -0
- /package/es/components/appointmentBooking/components/{Provider/Cart → Cart}/Item/Total.d.ts +0 -0
- /package/es/components/appointmentBooking/components/{Provider/Cart → Cart}/Item/index.less +0 -0
- /package/es/components/appointmentBooking/components/{Provider/Cart → Cart}/index.d.ts +0 -0
- /package/es/components/appointmentBooking/components/{Provider/Cart → Cart}/index.js +0 -0
- /package/es/components/appointmentBooking/components/{Provider/Cart → Cart}/index.less +0 -0
- /package/es/components/appointmentBooking/components/{Information → Guest}/index.less +0 -0
- /package/lib/components/appointmentBooking/components/{Provider/Cart → Cart}/ContinueButton/index.d.ts +0 -0
- /package/lib/components/appointmentBooking/components/{Provider/Cart → Cart}/ContinueButton/index.less +0 -0
- /package/lib/components/appointmentBooking/components/{Provider/Cart → Cart}/Item/Total.d.ts +0 -0
- /package/lib/components/appointmentBooking/components/{Provider/Cart → Cart}/Item/index.less +0 -0
- /package/lib/components/appointmentBooking/components/{Provider/Cart → Cart}/index.d.ts +0 -0
- /package/lib/components/appointmentBooking/components/{Provider/Cart → Cart}/index.less +0 -0
- /package/{es/components/appointmentBooking/components/Provider/Information → lib/components/appointmentBooking/components/Guest}/index.less +0 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
interface AppointmentBookingContextType {
|
|
3
|
+
appointmentBooking: any;
|
|
4
|
+
times: any[];
|
|
5
|
+
resources: any[];
|
|
6
|
+
setTimes: (times: any[]) => void;
|
|
7
|
+
setResources: (lists: any[]) => void;
|
|
8
|
+
products: any[];
|
|
9
|
+
carts: any[];
|
|
10
|
+
summary: any;
|
|
11
|
+
setProducts: (val: any[]) => void;
|
|
12
|
+
setCarts: (val: any[]) => void;
|
|
13
|
+
setSummary: (val: any) => void;
|
|
14
|
+
currentStep: any;
|
|
15
|
+
isLastStep?: boolean;
|
|
16
|
+
setIsLastStep: (val: boolean) => void;
|
|
17
|
+
setCurrentStep: (val: any) => void;
|
|
18
|
+
}
|
|
19
|
+
export declare const AppointmentBookingProvider: ({ children, }: {
|
|
20
|
+
children: ReactNode;
|
|
21
|
+
}) => JSX.Element;
|
|
22
|
+
export declare const useAppointmentBookingContext: () => AppointmentBookingContextType;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
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."); }
|
|
3
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
4
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
5
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
6
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
+
import React, { createContext, useContext, useState } from 'react';
|
|
8
|
+
import { useAppointmentBooking } from "./hooks";
|
|
9
|
+
var AppointmentBookingContext = /*#__PURE__*/createContext(undefined);
|
|
10
|
+
export var AppointmentBookingProvider = function AppointmentBookingProvider(_ref) {
|
|
11
|
+
var children = _ref.children;
|
|
12
|
+
var appointmentBooking = useAppointmentBooking();
|
|
13
|
+
// 商品列表
|
|
14
|
+
var _useState = useState([]),
|
|
15
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
16
|
+
products = _useState2[0],
|
|
17
|
+
setProducts = _useState2[1];
|
|
18
|
+
// 总计计算
|
|
19
|
+
var _useState3 = useState({}),
|
|
20
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
21
|
+
summary = _useState4[0],
|
|
22
|
+
setSummary = _useState4[1];
|
|
23
|
+
var _useState5 = useState([]),
|
|
24
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
25
|
+
times = _useState6[0],
|
|
26
|
+
setTimes = _useState6[1];
|
|
27
|
+
var _useState7 = useState([]),
|
|
28
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
29
|
+
resources = _useState8[0],
|
|
30
|
+
setResources = _useState8[1];
|
|
31
|
+
var _useState9 = useState(appointmentBooking.getCurrentStep()),
|
|
32
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
33
|
+
currentStep = _useState10[0],
|
|
34
|
+
setCurrentStep = _useState10[1];
|
|
35
|
+
var _useState11 = useState(false),
|
|
36
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
37
|
+
isLastStep = _useState12[0],
|
|
38
|
+
setIsLastStep = _useState12[1];
|
|
39
|
+
var _useState13 = useState([]),
|
|
40
|
+
_useState14 = _slicedToArray(_useState13, 2),
|
|
41
|
+
carts = _useState14[0],
|
|
42
|
+
setCarts = _useState14[1];
|
|
43
|
+
console.log(3234234, times, resources);
|
|
44
|
+
var value = {
|
|
45
|
+
appointmentBooking: appointmentBooking,
|
|
46
|
+
times: times,
|
|
47
|
+
resources: resources,
|
|
48
|
+
products: products,
|
|
49
|
+
summary: summary,
|
|
50
|
+
currentStep: currentStep,
|
|
51
|
+
isLastStep: isLastStep,
|
|
52
|
+
carts: carts,
|
|
53
|
+
setTimes: setTimes,
|
|
54
|
+
setResources: setResources,
|
|
55
|
+
setProducts: setProducts,
|
|
56
|
+
setSummary: setSummary,
|
|
57
|
+
setCurrentStep: setCurrentStep,
|
|
58
|
+
setIsLastStep: setIsLastStep,
|
|
59
|
+
setCarts: setCarts
|
|
60
|
+
};
|
|
61
|
+
return /*#__PURE__*/React.createElement(AppointmentBookingContext.Provider, {
|
|
62
|
+
value: value
|
|
63
|
+
}, children);
|
|
64
|
+
};
|
|
65
|
+
export var useAppointmentBookingContext = function useAppointmentBookingContext() {
|
|
66
|
+
var context = useContext(AppointmentBookingContext);
|
|
67
|
+
if (context === undefined) {
|
|
68
|
+
throw new Error('useAppointmentBookingContext must be used within a AppointmentBookingProvider');
|
|
69
|
+
}
|
|
70
|
+
return context;
|
|
71
|
+
};
|
|
@@ -1,14 +1,8 @@
|
|
|
1
1
|
export declare const useAppointmentBooking: () => any;
|
|
2
|
-
export declare const useAppointmentBookingStep: () =>
|
|
3
|
-
|
|
4
|
-
isLastStep: any;
|
|
5
|
-
};
|
|
6
|
-
export declare const useAppointmentBookingProduct: () => {
|
|
7
|
-
products: any;
|
|
8
|
-
};
|
|
2
|
+
export declare const useAppointmentBookingStep: () => void;
|
|
3
|
+
export declare const useAppointmentBookingProduct: () => void;
|
|
9
4
|
export declare const useAppointmentBookingCart: () => {
|
|
10
5
|
cart: any;
|
|
11
|
-
products: any;
|
|
12
6
|
};
|
|
13
7
|
export declare const useAppointmentBookingLogin: () => {
|
|
14
8
|
isLogin: boolean;
|
|
@@ -23,3 +17,7 @@ export declare const useAppointmentBookingAccount: () => {
|
|
|
23
17
|
};
|
|
24
18
|
accountLists: any;
|
|
25
19
|
};
|
|
20
|
+
export declare const useAppointmentBookingResource: () => {
|
|
21
|
+
getResourceTimeSlot: (params: any) => Promise<void>;
|
|
22
|
+
getResourceList: () => Promise<void>;
|
|
23
|
+
};
|
|
@@ -1,17 +1,24 @@
|
|
|
1
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
-
function
|
|
3
|
-
function
|
|
4
|
-
function
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
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(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
5
7
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
6
8
|
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."); }
|
|
7
9
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
8
10
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
9
11
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
10
12
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
13
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
14
|
+
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); } }
|
|
15
|
+
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); }); }; }
|
|
11
16
|
import { usePisellOS } from "../../hooks/useEngineContext";
|
|
12
17
|
import useEngineContext from "../../hooks/useEngineContext";
|
|
13
18
|
import { getUniqueId } from "@pisell/utils";
|
|
19
|
+
import { sortResources } from "./utils";
|
|
14
20
|
import { useState, useEffect } from 'react';
|
|
21
|
+
import { useAppointmentBookingContext } from "./context";
|
|
15
22
|
export var useAppointmentBooking = function useAppointmentBooking() {
|
|
16
23
|
var pisellOS = usePisellOS();
|
|
17
24
|
return pisellOS.getModule('appointmentBooking');
|
|
@@ -19,27 +26,29 @@ export var useAppointmentBooking = function useAppointmentBooking() {
|
|
|
19
26
|
export var useAppointmentBookingStep = function useAppointmentBookingStep() {
|
|
20
27
|
var _appointmentBooking$s;
|
|
21
28
|
var pisellOS = usePisellOS();
|
|
22
|
-
var
|
|
29
|
+
var _useAppointmentBookin = useAppointmentBookingContext(),
|
|
30
|
+
appointmentBooking = _useAppointmentBookin.appointmentBooking,
|
|
31
|
+
setCurrentStep = _useAppointmentBookin.setCurrentStep,
|
|
32
|
+
setIsLastStep = _useAppointmentBookin.setIsLastStep;
|
|
33
|
+
// const appointmentBooking = useAppointmentBooking();
|
|
23
34
|
var stepList = (appointmentBooking === null || appointmentBooking === void 0 || (_appointmentBooking$s = appointmentBooking.store) === null || _appointmentBooking$s === void 0 || (_appointmentBooking$s = _appointmentBooking$s.step) === null || _appointmentBooking$s === void 0 || (_appointmentBooking$s = _appointmentBooking$s.store) === null || _appointmentBooking$s === void 0 ? void 0 : _appointmentBooking$s.stepList) || [];
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
var _useState3 = useState(false),
|
|
29
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
30
|
-
isLastStep = _useState4[0],
|
|
31
|
-
setIsLastStep = _useState4[1];
|
|
35
|
+
|
|
36
|
+
// const [currentStep, setCurrentStep] = useState<any>(appointmentBooking.getCurrentStep());
|
|
37
|
+
// const [isLastStep, setIsLastStep] = useState<any>(false)
|
|
38
|
+
|
|
32
39
|
useEffect(function () {
|
|
33
40
|
pisellOS.effects.on('appointmentBooking_step:changed', /*#__PURE__*/function () {
|
|
34
41
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(res) {
|
|
42
|
+
var _currentStep;
|
|
35
43
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
36
44
|
while (1) switch (_context.prev = _context.next) {
|
|
37
45
|
case 0:
|
|
38
|
-
console.log('appointmentBooking_step:changed', res);
|
|
39
46
|
if (res.path === 'currentStep') {
|
|
40
|
-
|
|
47
|
+
_currentStep = appointmentBooking.getCurrentStep();
|
|
48
|
+
setCurrentStep(_currentStep);
|
|
49
|
+
setIsLastStep((_currentStep === null || _currentStep === void 0 ? void 0 : _currentStep.index) === stepList.length - 1);
|
|
41
50
|
}
|
|
42
|
-
case
|
|
51
|
+
case 1:
|
|
43
52
|
case "end":
|
|
44
53
|
return _context.stop();
|
|
45
54
|
}
|
|
@@ -50,60 +59,48 @@ export var useAppointmentBookingStep = function useAppointmentBookingStep() {
|
|
|
50
59
|
};
|
|
51
60
|
}());
|
|
52
61
|
}, []);
|
|
53
|
-
useEffect(function () {
|
|
54
|
-
setIsLastStep((currentStep === null || currentStep === void 0 ? void 0 : currentStep.index) === stepList.length - 1);
|
|
55
|
-
}, [currentStep === null || currentStep === void 0 ? void 0 : currentStep.index]);
|
|
56
|
-
return {
|
|
57
|
-
currentStep: currentStep,
|
|
58
|
-
isLastStep: isLastStep
|
|
59
|
-
};
|
|
60
62
|
};
|
|
61
63
|
export var useAppointmentBookingProduct = function useAppointmentBookingProduct() {
|
|
62
|
-
var
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
setProducts = _useState6[1];
|
|
64
|
+
var _useAppointmentBookin2 = useAppointmentBookingContext(),
|
|
65
|
+
appointmentBooking = _useAppointmentBookin2.appointmentBooking,
|
|
66
|
+
setProducts = _useAppointmentBookin2.setProducts;
|
|
67
|
+
// const [products, setProducts] = useState<any>([]);
|
|
67
68
|
var productModuleParams = appointmentBooking.otherParams.productModuleParams;
|
|
68
69
|
useEffect(function () {
|
|
69
70
|
appointmentBooking.loadProducts(productModuleParams).then(function (res) {
|
|
71
|
+
console.log(res, 'loadProductsloadProducts');
|
|
70
72
|
setProducts(res || []);
|
|
71
73
|
});
|
|
72
74
|
}, []);
|
|
73
|
-
return {
|
|
74
|
-
products: products
|
|
75
|
-
};
|
|
76
75
|
};
|
|
77
76
|
export var useAppointmentBookingCart = function useAppointmentBookingCart() {
|
|
78
77
|
var _appointmentBooking$s2;
|
|
79
78
|
var pisellOS = usePisellOS();
|
|
80
|
-
var
|
|
79
|
+
var _useAppointmentBookin3 = useAppointmentBookingContext(),
|
|
80
|
+
appointmentBooking = _useAppointmentBookin3.appointmentBooking,
|
|
81
|
+
setCarts = _useAppointmentBookin3.setCarts,
|
|
82
|
+
setSummary = _useAppointmentBookin3.setSummary;
|
|
81
83
|
var cart = appointmentBooking === null || appointmentBooking === void 0 || (_appointmentBooking$s2 = appointmentBooking.store) === null || _appointmentBooking$s2 === void 0 || (_appointmentBooking$s2 = _appointmentBooking$s2.cart) === null || _appointmentBooking$s2 === void 0 ? void 0 : _appointmentBooking$s2.store;
|
|
82
|
-
|
|
83
|
-
// 商品列表
|
|
84
|
-
var _useState7 = useState([]),
|
|
85
|
-
_useState8 = _slicedToArray(_useState7, 2),
|
|
86
|
-
products = _useState8[0],
|
|
87
|
-
setProducts = _useState8[1];
|
|
88
|
-
// 选中的当前holder
|
|
89
|
-
var _useState9 = useState([]),
|
|
90
|
-
_useState10 = _slicedToArray(_useState9, 2),
|
|
91
|
-
selectedHolderIds = _useState10[0],
|
|
92
|
-
setSelectedHolderIds = _useState10[1];
|
|
93
|
-
// 账户列表
|
|
94
|
-
var _useState11 = useState([]),
|
|
95
|
-
_useState12 = _slicedToArray(_useState11, 2),
|
|
96
|
-
holders = _useState12[0],
|
|
97
|
-
setHolders = _useState12[1];
|
|
98
|
-
console.log(appointmentBooking, cart, 'appointmentBooking3333555');
|
|
99
84
|
useEffect(function () {
|
|
85
|
+
var _appointmentBooking$g;
|
|
100
86
|
pisellOS.effects.on('appointmentBooking_cart:changed', /*#__PURE__*/function () {
|
|
101
87
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(res) {
|
|
88
|
+
var carts, summary;
|
|
102
89
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
103
90
|
while (1) switch (_context2.prev = _context2.next) {
|
|
104
91
|
case 0:
|
|
105
|
-
|
|
106
|
-
|
|
92
|
+
_context2.next = 2;
|
|
93
|
+
return appointmentBooking.getCart();
|
|
94
|
+
case 2:
|
|
95
|
+
carts = _context2.sent;
|
|
96
|
+
setCarts(carts || []);
|
|
97
|
+
_context2.next = 6;
|
|
98
|
+
return appointmentBooking.getSummary();
|
|
99
|
+
case 6:
|
|
100
|
+
summary = _context2.sent;
|
|
101
|
+
setSummary(summary || {});
|
|
102
|
+
console.log(carts, summary, 'appointmentBooking_cart:changed');
|
|
103
|
+
case 9:
|
|
107
104
|
case "end":
|
|
108
105
|
return _context2.stop();
|
|
109
106
|
}
|
|
@@ -113,10 +110,12 @@ export var useAppointmentBookingCart = function useAppointmentBookingCart() {
|
|
|
113
110
|
return _ref2.apply(this, arguments);
|
|
114
111
|
};
|
|
115
112
|
}());
|
|
113
|
+
appointmentBooking === null || appointmentBooking === void 0 || (_appointmentBooking$g = appointmentBooking.getCart) === null || _appointmentBooking$g === void 0 || _appointmentBooking$g.call(appointmentBooking).then(function (data) {
|
|
114
|
+
setCarts(data || []);
|
|
115
|
+
});
|
|
116
116
|
}, []);
|
|
117
117
|
return {
|
|
118
|
-
cart: cart
|
|
119
|
-
products: products
|
|
118
|
+
cart: cart
|
|
120
119
|
};
|
|
121
120
|
};
|
|
122
121
|
export var useAppointmentBookingLogin = function useAppointmentBookingLogin() {
|
|
@@ -144,10 +143,10 @@ export var useAppointmentBookingAccount = function useAppointmentBookingAccount(
|
|
|
144
143
|
var context = useEngineContext();
|
|
145
144
|
var utils = context.appHelper.utils || {};
|
|
146
145
|
var appointmentBooking = useAppointmentBooking();
|
|
147
|
-
var
|
|
148
|
-
|
|
149
|
-
accountLists =
|
|
150
|
-
setAccountLists =
|
|
146
|
+
var _useState = useState([]),
|
|
147
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
148
|
+
accountLists = _useState2[0],
|
|
149
|
+
setAccountLists = _useState2[1];
|
|
151
150
|
var userInfo = (_utils$getStore$getSt = utils.getStore().getState()) === null || _utils$getStore$getSt === void 0 || (_utils$getStore$getSt = _utils$getStore$getSt.global) === null || _utils$getStore$getSt === void 0 ? void 0 : _utils$getStore$getSt.userInfo;
|
|
152
151
|
var localUserInfo = JSON.parse(utils.storage.get('customer') || '{}');
|
|
153
152
|
userInfo = (_userInfo = userInfo) !== null && _userInfo !== void 0 && _userInfo.id ? userInfo : localUserInfo;
|
|
@@ -158,10 +157,6 @@ export var useAppointmentBookingAccount = function useAppointmentBookingAccount(
|
|
|
158
157
|
username: currentUserName
|
|
159
158
|
};
|
|
160
159
|
useEffect(function () {
|
|
161
|
-
// appointmentBooking.getAccounts().then((res: any) => {
|
|
162
|
-
|
|
163
|
-
// setAccountLists(res || [])
|
|
164
|
-
// })
|
|
165
160
|
pisellOS.effects.on('appointmentBooking_accountList:changed', /*#__PURE__*/function () {
|
|
166
161
|
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(res) {
|
|
167
162
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
@@ -169,9 +164,8 @@ export var useAppointmentBookingAccount = function useAppointmentBookingAccount(
|
|
|
169
164
|
case 0:
|
|
170
165
|
if (res.path === 'accounts') {
|
|
171
166
|
appointmentBooking.getAccounts().then(function (data) {
|
|
172
|
-
|
|
167
|
+
setAccountLists(data || []);
|
|
173
168
|
});
|
|
174
|
-
// setCurrentStep(appointmentBooking.getCurrentStep());
|
|
175
169
|
}
|
|
176
170
|
case 1:
|
|
177
171
|
case "end":
|
|
@@ -183,9 +177,72 @@ export var useAppointmentBookingAccount = function useAppointmentBookingAccount(
|
|
|
183
177
|
return _ref4.apply(this, arguments);
|
|
184
178
|
};
|
|
185
179
|
}());
|
|
180
|
+
appointmentBooking.getAccounts().then(function (data) {
|
|
181
|
+
setAccountLists(data || []);
|
|
182
|
+
});
|
|
186
183
|
}, []);
|
|
187
184
|
return {
|
|
188
185
|
currentUser: currentUser,
|
|
189
186
|
accountLists: accountLists
|
|
190
187
|
};
|
|
188
|
+
};
|
|
189
|
+
export var useAppointmentBookingResource = function useAppointmentBookingResource() {
|
|
190
|
+
var _useAppointmentBookin4 = useAppointmentBookingContext(),
|
|
191
|
+
appointmentBooking = _useAppointmentBookin4.appointmentBooking,
|
|
192
|
+
setResources = _useAppointmentBookin4.setResources,
|
|
193
|
+
setTimes = _useAppointmentBookin4.setTimes;
|
|
194
|
+
var _ref5 = (appointmentBooking === null || appointmentBooking === void 0 ? void 0 : appointmentBooking.otherParams) || {},
|
|
195
|
+
resourceSort = _ref5.resourceSort;
|
|
196
|
+
|
|
197
|
+
// 设置时间切片
|
|
198
|
+
var getResourceTimeSlot = /*#__PURE__*/function () {
|
|
199
|
+
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(params) {
|
|
200
|
+
var data;
|
|
201
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
202
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
203
|
+
case 0:
|
|
204
|
+
_context4.next = 2;
|
|
205
|
+
return appointmentBooking.getResourceTimeSlot(params);
|
|
206
|
+
case 2:
|
|
207
|
+
data = _context4.sent;
|
|
208
|
+
setTimes(data || []);
|
|
209
|
+
case 4:
|
|
210
|
+
case "end":
|
|
211
|
+
return _context4.stop();
|
|
212
|
+
}
|
|
213
|
+
}, _callee4);
|
|
214
|
+
}));
|
|
215
|
+
return function getResourceTimeSlot(_x4) {
|
|
216
|
+
return _ref6.apply(this, arguments);
|
|
217
|
+
};
|
|
218
|
+
}();
|
|
219
|
+
|
|
220
|
+
// 设置资源列表
|
|
221
|
+
var getResourceList = /*#__PURE__*/function () {
|
|
222
|
+
var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
223
|
+
var resources;
|
|
224
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
225
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
226
|
+
case 0:
|
|
227
|
+
resources = appointmentBooking.getResourcesList();
|
|
228
|
+
resources = resources.map(function (item) {
|
|
229
|
+
return _objectSpread(_objectSpread({}, item), {}, {
|
|
230
|
+
resources: sortResources((item === null || item === void 0 ? void 0 : item.resources) || [], resourceSort)
|
|
231
|
+
});
|
|
232
|
+
});
|
|
233
|
+
setResources(resources || []);
|
|
234
|
+
case 3:
|
|
235
|
+
case "end":
|
|
236
|
+
return _context5.stop();
|
|
237
|
+
}
|
|
238
|
+
}, _callee5);
|
|
239
|
+
}));
|
|
240
|
+
return function getResourceList() {
|
|
241
|
+
return _ref7.apply(this, arguments);
|
|
242
|
+
};
|
|
243
|
+
}();
|
|
244
|
+
return {
|
|
245
|
+
getResourceTimeSlot: getResourceTimeSlot,
|
|
246
|
+
getResourceList: getResourceList
|
|
247
|
+
};
|
|
191
248
|
};
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import React, { useEffect } from 'react';
|
|
2
|
-
import Header from "./components/Header";
|
|
3
|
-
import Footer from "./components/Footer";
|
|
4
2
|
import Content from "./components/Content";
|
|
5
3
|
import { isMobile, locales } from '@pisell/utils';
|
|
6
4
|
import useEngineContext from "../../hooks/useEngineContext";
|
|
7
5
|
import "./index.less";
|
|
8
6
|
import localeTexts from "./locales";
|
|
7
|
+
import { AppointmentBookingProvider } from "./context";
|
|
9
8
|
import { useAppointmentBooking, useAppointmentBookingAccount } from "./hooks";
|
|
10
9
|
var AppointmentBooking = function AppointmentBooking() {
|
|
11
10
|
var _utils$storage;
|
|
@@ -20,6 +19,6 @@ var AppointmentBooking = function AppointmentBooking() {
|
|
|
20
19
|
}, []);
|
|
21
20
|
return /*#__PURE__*/React.createElement("div", {
|
|
22
21
|
className: "parallel-booking-wrap ".concat(isMobile() ? 'parallel-booking-mobile-wrap' : '')
|
|
23
|
-
}, /*#__PURE__*/React.createElement(
|
|
22
|
+
}, /*#__PURE__*/React.createElement(AppointmentBookingProvider, null, /*#__PURE__*/React.createElement(Content, null)));
|
|
24
23
|
};
|
|
25
24
|
export default AppointmentBooking;
|
|
@@ -70,6 +70,10 @@ declare const _default: {
|
|
|
70
70
|
'pisell2.event.capacity.limit.reached.title': string;
|
|
71
71
|
'pisell2.event.capacity.limit.reached.tip': string;
|
|
72
72
|
'pisell2.appointment.booking.empty.service': string;
|
|
73
|
+
'pisell2.appointment.service.title': (val: number) => string;
|
|
74
|
+
'pisell2.appointment.add.guest': string;
|
|
75
|
+
'pisell2.appointment.edit.service': string;
|
|
76
|
+
'pisell2.appointment.remove.guest': string;
|
|
73
77
|
};
|
|
74
78
|
'zh-CN': {
|
|
75
79
|
'pisell2.event.calendar.limit.unavailable': string;
|
|
@@ -142,6 +146,10 @@ declare const _default: {
|
|
|
142
146
|
'pisell2.event.capacity.limit.reached.title': string;
|
|
143
147
|
'pisell2.event.capacity.limit.reached.tip': string;
|
|
144
148
|
'pisell2.appointment.booking.empty.service': string;
|
|
149
|
+
'pisell2.appointment.service.title': (val: number) => string;
|
|
150
|
+
'pisell2.appointment.add.guest': string;
|
|
151
|
+
'pisell2.appointment.edit.service': string;
|
|
152
|
+
'pisell2.appointment.remove.guest': string;
|
|
145
153
|
};
|
|
146
154
|
'zh-HK': {
|
|
147
155
|
'pisell2.event.calendar.limit.unavailable': string;
|
|
@@ -214,6 +222,10 @@ declare const _default: {
|
|
|
214
222
|
'pisell2.event.capacity.limit.reached.title': string;
|
|
215
223
|
'pisell2.event.capacity.limit.reached.tip': string;
|
|
216
224
|
'pisell2.appointment.booking.empty.service': string;
|
|
225
|
+
'pisell2.appointment.service.title': (val: number) => string;
|
|
226
|
+
'pisell2.appointment.add.guest': string;
|
|
227
|
+
'pisell2.appointment.edit.service': string;
|
|
228
|
+
'pisell2.appointment.remove.guest': string;
|
|
217
229
|
};
|
|
218
230
|
};
|
|
219
231
|
export default _default;
|
|
@@ -81,7 +81,13 @@ export default {
|
|
|
81
81
|
'pisell2.event.event.full.ok': 'Ok',
|
|
82
82
|
'pisell2.event.capacity.limit.reached.title': 'Capacity limit reached',
|
|
83
83
|
'pisell2.event.capacity.limit.reached.tip': 'One or more events in your cart are no longer available due to full capacity. Please remove unavailable events from your cart to complete checkout.',
|
|
84
|
-
'pisell2.appointment.booking.empty.service': 'No service'
|
|
84
|
+
'pisell2.appointment.booking.empty.service': 'No service',
|
|
85
|
+
'pisell2.appointment.service.title': function pisell2AppointmentServiceTitle(val) {
|
|
86
|
+
return "".concat(val, " ").concat(val > 1 ? 'services' : 'service');
|
|
87
|
+
},
|
|
88
|
+
'pisell2.appointment.add.guest': "Add guest",
|
|
89
|
+
'pisell2.appointment.edit.service': "Edit services",
|
|
90
|
+
'pisell2.appointment.remove.guest': "Remove guest"
|
|
85
91
|
},
|
|
86
92
|
'zh-CN': {
|
|
87
93
|
'pisell2.event.calendar.limit.unavailable': "不可预约",
|
|
@@ -165,7 +171,13 @@ export default {
|
|
|
165
171
|
'pisell2.event.event.full.ok': '好的',
|
|
166
172
|
'pisell2.event.capacity.limit.reached.title': '活动名额已满',
|
|
167
173
|
'pisell2.event.capacity.limit.reached.tip': '购物车中有一个或多个活动已达预约上限,请将已满额的活动从购物车中移除后再完成结算。',
|
|
168
|
-
'pisell2.appointment.booking.empty.service': '暂无服务'
|
|
174
|
+
'pisell2.appointment.booking.empty.service': '暂无服务',
|
|
175
|
+
'pisell2.appointment.service.title': function pisell2AppointmentServiceTitle(val) {
|
|
176
|
+
return "".concat(val, "\u4E2A\u670D\u52A1");
|
|
177
|
+
},
|
|
178
|
+
'pisell2.appointment.add.guest': "添加预约人",
|
|
179
|
+
'pisell2.appointment.edit.service': "编辑服务",
|
|
180
|
+
'pisell2.appointment.remove.guest': "移除预约人"
|
|
169
181
|
},
|
|
170
182
|
'zh-HK': {
|
|
171
183
|
'pisell2.event.calendar.limit.unavailable': "不可預約",
|
|
@@ -249,6 +261,12 @@ export default {
|
|
|
249
261
|
'pisell2.event.event.full.ok': '好的',
|
|
250
262
|
'pisell2.event.capacity.limit.reached.title': '活動名額已滿',
|
|
251
263
|
'pisell2.event.capacity.limit.reached.tip': '購物車中有一個或多個活動已達預約上限,請將已滿額的活動從購物車中移除後再完成結算。',
|
|
252
|
-
'pisell2.appointment.booking.empty.service': '暫無服務'
|
|
264
|
+
'pisell2.appointment.booking.empty.service': '暫無服務',
|
|
265
|
+
'pisell2.appointment.service.title': function pisell2AppointmentServiceTitle(val) {
|
|
266
|
+
return "".concat(val, "\u4E2A\u670D\u52D9");
|
|
267
|
+
},
|
|
268
|
+
'pisell2.appointment.add.guest': "添加預約人",
|
|
269
|
+
'pisell2.appointment.edit.service': "編輯服務",
|
|
270
|
+
'pisell2.appointment.remove.guest': "移除預約人"
|
|
253
271
|
}
|
|
254
272
|
};
|
|
@@ -43,3 +43,15 @@ export declare const formatMonthDisplay: (dateString: string) => string;
|
|
|
43
43
|
* @Date: 2025-02-11 13:39
|
|
44
44
|
*/
|
|
45
45
|
export declare const resourceTitle: (data: any) => any;
|
|
46
|
+
export declare const formatHolder: (data: any[]) => any[];
|
|
47
|
+
export declare const formatGuest: (data: any[], products: any) => any[];
|
|
48
|
+
/**
|
|
49
|
+
* @title: 对资源进行排序
|
|
50
|
+
* @description:
|
|
51
|
+
* @param {any} currentResourcesMap
|
|
52
|
+
* @param {any} resourceSort
|
|
53
|
+
* @return {*}
|
|
54
|
+
* @Author: WangHan
|
|
55
|
+
* @Date: 2025-04-14 11:16
|
|
56
|
+
*/
|
|
57
|
+
export declare const sortResources: (resources: any[], resourceSort: any[]) => any[] | undefined;
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
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(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
1
7
|
import dayjs from 'dayjs';
|
|
2
8
|
import useEngineContext from "../../hooks/useEngineContext";
|
|
3
9
|
|
|
@@ -96,4 +102,68 @@ export var resourceTitle = function resourceTitle(data) {
|
|
|
96
102
|
var title = (form === null || form === void 0 || (_form$setting = form.setting) === null || _form$setting === void 0 ? void 0 : _form$setting.title) || (form === null || form === void 0 ? void 0 : form.title);
|
|
97
103
|
var translation = context === null || context === void 0 || (_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 || (_context$appHelper = _context$appHelper.utils) === null || _context$appHelper === void 0 ? void 0 : _context$appHelper.translation;
|
|
98
104
|
return (_translation = translation(title)) === null || _translation === void 0 ? void 0 : _translation.toLowerCase();
|
|
105
|
+
};
|
|
106
|
+
export var formatHolder = function formatHolder(data) {
|
|
107
|
+
return data === null || data === void 0 ? void 0 : data.map(function (d) {
|
|
108
|
+
return _objectSpread(_objectSpread({}, d), {}, {
|
|
109
|
+
key: d === null || d === void 0 ? void 0 : d.id,
|
|
110
|
+
label: d === null || d === void 0 ? void 0 : d.username,
|
|
111
|
+
name: d === null || d === void 0 ? void 0 : d.username
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
};
|
|
115
|
+
export var formatGuest = function formatGuest(data, products) {
|
|
116
|
+
return data === null || data === void 0 ? void 0 : data.map(function (d) {
|
|
117
|
+
var children = products.filter(function (p) {
|
|
118
|
+
return (p === null || p === void 0 ? void 0 : p.holder_id) === (d === null || d === void 0 ? void 0 : d.id);
|
|
119
|
+
}).map(function (p) {
|
|
120
|
+
return {
|
|
121
|
+
name: p === null || p === void 0 ? void 0 : p.name
|
|
122
|
+
};
|
|
123
|
+
});
|
|
124
|
+
return _objectSpread(_objectSpread({}, d), {}, {
|
|
125
|
+
key: d === null || d === void 0 ? void 0 : d.id,
|
|
126
|
+
name: d === null || d === void 0 ? void 0 : d.username,
|
|
127
|
+
children: children || []
|
|
128
|
+
});
|
|
129
|
+
});
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* @title: 对资源进行排序
|
|
134
|
+
* @description:
|
|
135
|
+
* @param {any} currentResourcesMap
|
|
136
|
+
* @param {any} resourceSort
|
|
137
|
+
* @return {*}
|
|
138
|
+
* @Author: WangHan
|
|
139
|
+
* @Date: 2025-04-14 11:16
|
|
140
|
+
*/
|
|
141
|
+
export var sortResources = function sortResources(resources, resourceSort) {
|
|
142
|
+
try {
|
|
143
|
+
var sortedResources = resources.sort(function (a, b) {
|
|
144
|
+
var aIndex = resourceSort.indexOf(a.code);
|
|
145
|
+
var bIndex = resourceSort.indexOf(b.code);
|
|
146
|
+
return aIndex - bIndex;
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
// 格式化资源数据列表
|
|
150
|
+
sortedResources = sortedResources.map(function (resource) {
|
|
151
|
+
var _resource$renderList;
|
|
152
|
+
var renderList = resource === null || resource === void 0 || (_resource$renderList = resource.renderList) === null || _resource$renderList === void 0 ? void 0 : _resource$renderList.map(function (d) {
|
|
153
|
+
var _d$cover;
|
|
154
|
+
return _objectSpread(_objectSpread({}, d), {}, {
|
|
155
|
+
image: d === null || d === void 0 || (_d$cover = d.cover) === null || _d$cover === void 0 || (_d$cover = _d$cover[0]) === null || _d$cover === void 0 ? void 0 : _d$cover.url,
|
|
156
|
+
title: d === null || d === void 0 ? void 0 : d.main_field,
|
|
157
|
+
subtitle: d === null || d === void 0 ? void 0 : d.sub_field
|
|
158
|
+
});
|
|
159
|
+
});
|
|
160
|
+
return _objectSpread(_objectSpread({}, resource), {}, {
|
|
161
|
+
renderList: renderList
|
|
162
|
+
});
|
|
163
|
+
});
|
|
164
|
+
console.log(sortedResources, 'sortedResources');
|
|
165
|
+
return sortedResources || [];
|
|
166
|
+
} catch (error) {
|
|
167
|
+
console.log(error, 'wh2222');
|
|
168
|
+
}
|
|
99
169
|
};
|