@pisell/private-materials 3.0.73 → 3.0.75

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 (93) 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 +15 -15
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +9 -9
  11. package/es/components/booking/addons/index.d.ts +1 -1
  12. package/es/components/booking/addons/model.d.ts +1 -2
  13. package/es/components/booking/components/drawer/index.d.ts +1 -0
  14. package/es/components/booking/components/drawer/index.js +5 -0
  15. package/es/components/booking/components/drawer/index.less +10 -3
  16. package/es/components/booking/components/footer/amount.js +47 -24
  17. package/es/components/booking/components/footer/index.js +5 -0
  18. package/es/components/booking/components/footer/utils.js +12 -0
  19. package/es/components/booking/forms/forms.d.ts +1 -1
  20. package/es/components/booking/forms/index.d.ts +1 -1
  21. package/es/components/booking/forms/model.d.ts +1 -2
  22. package/es/components/booking/index.d.ts +1 -1
  23. package/es/components/booking/info/index.d.ts +1 -1
  24. package/es/components/booking/info/model.d.ts +1 -2
  25. package/es/components/booking/info/service/actions/index.d.ts +6 -0
  26. package/es/components/booking/info/service/actions/index.js +73 -0
  27. package/es/components/booking/info/service/actions/index.less +9 -0
  28. package/es/components/booking/info/service/addTimeModal/index.d.ts +4 -0
  29. package/es/components/booking/info/service/addTimeModal/index.js +697 -0
  30. package/es/components/booking/info/service/addTimeModal/index.less +138 -0
  31. package/es/components/booking/info/service/addTimeModal/serve.d.ts +5 -0
  32. package/es/components/booking/info/service/addTimeModal/serve.js +50 -0
  33. package/es/components/booking/info/service/addTimeModal/utils.d.ts +31 -0
  34. package/es/components/booking/info/service/addTimeModal/utils.js +174 -0
  35. package/es/components/booking/info/service/index.js +2 -1
  36. package/es/components/booking/info/service/serviceItem/Sales/index.d.ts +0 -0
  37. package/es/components/booking/info/service/serviceItem/Sales/index.js +0 -0
  38. package/es/components/booking/info/service/serviceItem/Sales/index.less +0 -0
  39. package/es/components/booking/info/service/serviceItem/index.js +24 -2
  40. package/es/components/booking/info/service/serviceItem/index.less +28 -0
  41. package/es/components/booking/locales.d.ts +27 -0
  42. package/es/components/booking/locales.js +29 -2
  43. package/es/components/booking/model.d.ts +3 -2
  44. package/es/components/booking/notes/index.d.ts +1 -1
  45. package/es/components/booking/notes/model.d.ts +1 -2
  46. package/es/components/booking/payments/index.d.ts +1 -1
  47. package/es/components/booking/payments/model.d.ts +1 -2
  48. package/es/components/booking/utils.d.ts +12 -0
  49. package/es/components/booking/utils.js +91 -48
  50. package/es/components/schedules/index.d.ts +1 -1
  51. package/es/components/schedules/model.d.ts +1 -2
  52. package/lib/components/booking/addons/index.d.ts +1 -1
  53. package/lib/components/booking/addons/model.d.ts +1 -2
  54. package/lib/components/booking/components/drawer/index.d.ts +1 -0
  55. package/lib/components/booking/components/drawer/index.js +4 -0
  56. package/lib/components/booking/components/drawer/index.less +10 -3
  57. package/lib/components/booking/components/footer/amount.js +10 -0
  58. package/lib/components/booking/components/footer/index.js +5 -0
  59. package/lib/components/booking/components/footer/utils.js +12 -0
  60. package/lib/components/booking/forms/forms.d.ts +1 -1
  61. package/lib/components/booking/forms/index.d.ts +1 -1
  62. package/lib/components/booking/forms/model.d.ts +1 -2
  63. package/lib/components/booking/index.d.ts +1 -1
  64. package/lib/components/booking/info/index.d.ts +1 -1
  65. package/lib/components/booking/info/model.d.ts +1 -2
  66. package/lib/components/booking/info/service/actions/index.d.ts +6 -0
  67. package/lib/components/booking/info/service/actions/index.js +97 -0
  68. package/lib/components/booking/info/service/actions/index.less +9 -0
  69. package/lib/components/booking/info/service/addTimeModal/index.d.ts +4 -0
  70. package/lib/components/booking/info/service/addTimeModal/index.js +553 -0
  71. package/lib/components/booking/info/service/addTimeModal/index.less +138 -0
  72. package/lib/components/booking/info/service/addTimeModal/serve.d.ts +5 -0
  73. package/lib/components/booking/info/service/addTimeModal/serve.js +39 -0
  74. package/lib/components/booking/info/service/addTimeModal/utils.d.ts +31 -0
  75. package/lib/components/booking/info/service/addTimeModal/utils.js +155 -0
  76. package/lib/components/booking/info/service/index.js +2 -1
  77. package/lib/components/booking/info/service/serviceItem/Sales/index.d.ts +0 -0
  78. package/lib/components/booking/info/service/serviceItem/Sales/index.js +0 -0
  79. package/lib/components/booking/info/service/serviceItem/Sales/index.less +0 -0
  80. package/lib/components/booking/info/service/serviceItem/index.js +14 -1
  81. package/lib/components/booking/info/service/serviceItem/index.less +28 -0
  82. package/lib/components/booking/locales.d.ts +27 -0
  83. package/lib/components/booking/locales.js +29 -2
  84. package/lib/components/booking/model.d.ts +3 -2
  85. package/lib/components/booking/notes/index.d.ts +1 -1
  86. package/lib/components/booking/notes/model.d.ts +1 -2
  87. package/lib/components/booking/payments/index.d.ts +1 -1
  88. package/lib/components/booking/payments/model.d.ts +1 -2
  89. package/lib/components/booking/utils.d.ts +12 -0
  90. package/lib/components/booking/utils.js +82 -33
  91. package/lib/components/schedules/index.d.ts +1 -1
  92. package/lib/components/schedules/model.d.ts +1 -2
  93. package/package.json +3 -3
@@ -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: (props: any) => any;
16
+ declare const Addons: (props: any) => JSX.Element;
17
17
  export default Addons;
@@ -1,6 +1,5 @@
1
- /// <reference types="react" />
2
1
  import { FormState } from "../model";
3
- export declare const Provider: (ComponentUi: any) => (props: any) => any, Context: import("react").Context<{
2
+ export declare const Provider: (ComponentUi: any) => (props: any) => JSX.Element, Context: import("react").Context<{
4
3
  state: FormState;
5
4
  } & {
6
5
  dispatch: (params: {
@@ -4,6 +4,7 @@ import "./index.less";
4
4
  export interface PisellDrawerProps extends DrawerProps {
5
5
  header?: React.ReactNode;
6
6
  titleNoWrap?: boolean;
7
+ hideScrollBar?: boolean;
7
8
  }
8
9
  /**
9
10
  * @title: 自定义抽屉
@@ -13,11 +13,16 @@ import classNames from "classnames";
13
13
  * @Date: 2024-01-30 16:51
14
14
  */
15
15
  var Drawer = function Drawer(props) {
16
+ var _props$hideScrollBar = props.hideScrollBar,
17
+ hideScrollBar = _props$hideScrollBar === void 0 ? true : _props$hideScrollBar;
16
18
  return /*#__PURE__*/React.createElement(OriginDrawer, _extends({
17
19
  width: "600px",
18
20
  closable: false,
19
21
  zIndex: 999
20
22
  }, props, {
23
+ className: classNames("pisell-lowcode__booking-drawer", props.className, {
24
+ "pisell-lowcode__booking-drawer-hide-scrollbar": hideScrollBar
25
+ }),
21
26
  title: false,
22
27
  bodyStyle: {
23
28
  padding: 0
@@ -28,12 +28,19 @@
28
28
  }
29
29
  }
30
30
 
31
- .pisell-lowcode-drawer-body {
32
- &::-webkit-scrollbar {
33
- display: block;
31
+
32
+ .pisell-lowcode__booking-drawer-hide-scrollbar {
33
+ &.pisell-lowcode-drawer-body {
34
+
35
+ &::-webkit-scrollbar {
36
+ display: none;
37
+ }
38
+
34
39
  }
35
40
  }
36
41
 
42
+
43
+
37
44
  .pisell-lowcode__booking-drawer-title-no-wrap {
38
45
  display: inline;
39
46
  }
@@ -9,6 +9,24 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
9
9
  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; }
10
10
  import { getDiscountTime, flexibleObj } from "../../utils";
11
11
  import { formatAmount } from '@pisell/utils';
12
+ var getRelationDetailsTotal = function getRelationDetailsTotal(relation_details) {
13
+ var total = 0;
14
+ var _iterator = _createForOfIteratorHelper(relation_details),
15
+ _step;
16
+ try {
17
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
18
+ var item = _step.value;
19
+ var number = item.product_quantity || item.num;
20
+ var price = item.payment_price || item.price;
21
+ total += Number(price) * Number(number);
22
+ }
23
+ } catch (err) {
24
+ _iterator.e(err);
25
+ } finally {
26
+ _iterator.f();
27
+ }
28
+ return total;
29
+ };
12
30
  /**
13
31
  * 总金额
14
32
  * @param state
@@ -20,30 +38,35 @@ var getProductAmount = function getProductAmount(state, isEdit) {
20
38
  if (isEdit) {
21
39
  // 计算总价 服务 和 附加商品
22
40
  if (state !== null && state !== void 0 && state.service || state !== null && state !== void 0 && state.addons) {
23
- var _iterator = _createForOfIteratorHelper(state === null || state === void 0 ? void 0 : state.service.value),
24
- _step;
41
+ var _iterator2 = _createForOfIteratorHelper(state === null || state === void 0 ? void 0 : state.service.value),
42
+ _step2;
25
43
  try {
26
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
27
- var item = _step.value;
44
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
45
+ var item = _step2.value;
46
+ // 预约商品
28
47
  price += Number(item._extend.total);
48
+
49
+ // 附加商品
50
+ price += getRelationDetailsTotal(item._extend.relation_details || []);
51
+ // price +=
29
52
  duration += flexibleObj.getValue(item._extend.duration);
30
53
  }
31
54
  } catch (err) {
32
- _iterator.e(err);
55
+ _iterator2.e(err);
33
56
  } finally {
34
- _iterator.f();
57
+ _iterator2.f();
35
58
  }
36
- var _iterator2 = _createForOfIteratorHelper(state.addons.value),
37
- _step2;
59
+ var _iterator3 = _createForOfIteratorHelper(state.addons.value),
60
+ _step3;
38
61
  try {
39
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
40
- var _item = _step2.value;
62
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
63
+ var _item = _step3.value;
41
64
  price += Number(_item._extend.total) * _item._extend.quantity;
42
65
  }
43
66
  } catch (err) {
44
- _iterator2.e(err);
67
+ _iterator3.e(err);
45
68
  } finally {
46
- _iterator2.f();
69
+ _iterator3.f();
47
70
  }
48
71
  }
49
72
  } else {
@@ -103,11 +126,11 @@ var getTax = function getTax(state, isEdit) {
103
126
  return Number((_state$bookingDetail2 = state.bookingDetail) === null || _state$bookingDetail2 === void 0 ? void 0 : _state$bookingDetail2.tax_fee);
104
127
  }
105
128
  if (state !== null && state !== void 0 && state.service || state !== null && state !== void 0 && state.addons) {
106
- var _iterator3 = _createForOfIteratorHelper(state === null || state === void 0 ? void 0 : state.service.value),
107
- _step3;
129
+ var _iterator4 = _createForOfIteratorHelper(state === null || state === void 0 ? void 0 : state.service.value),
130
+ _step4;
108
131
  try {
109
- for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
110
- var item = _step3.value;
132
+ for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
133
+ var item = _step4.value;
111
134
  price += getProductItemTax(_objectSpread(_objectSpread({}, item), {}, {
112
135
  total: getTotal(item),
113
136
  price: item._extend.price,
@@ -115,15 +138,15 @@ var getTax = function getTax(state, isEdit) {
115
138
  }), state.bookingDetail);
116
139
  }
117
140
  } catch (err) {
118
- _iterator3.e(err);
141
+ _iterator4.e(err);
119
142
  } finally {
120
- _iterator3.f();
143
+ _iterator4.f();
121
144
  }
122
- var _iterator4 = _createForOfIteratorHelper(state.addons.value),
123
- _step4;
145
+ var _iterator5 = _createForOfIteratorHelper(state.addons.value),
146
+ _step5;
124
147
  try {
125
- for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
126
- var _item2 = _step4.value;
148
+ for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
149
+ var _item2 = _step5.value;
127
150
  price += getProductItemTax(_objectSpread(_objectSpread({}, _item2), {}, {
128
151
  total: getTotal(_item2),
129
152
  price: _item2._extend.price,
@@ -131,9 +154,9 @@ var getTax = function getTax(state, isEdit) {
131
154
  }), state.bookingDetail);
132
155
  }
133
156
  } catch (err) {
134
- _iterator4.e(err);
157
+ _iterator5.e(err);
135
158
  } finally {
136
- _iterator4.f();
159
+ _iterator5.f();
137
160
  }
138
161
  }
139
162
  return price;
@@ -859,6 +859,11 @@ var Footer = function Footer(props) {
859
859
  }
860
860
  return _arr3;
861
861
  }
862
+ if (source === "addTime") {
863
+ var _arr4 = [];
864
+ _arr4 = _toConsumableArray(buttons);
865
+ return _arr4;
866
+ }
862
867
  return [];
863
868
  }, [buttons, total, isEdit, checkoutLoading, isDisabled, source, buttonMap, loading, isCheckout, state]);
864
869
 
@@ -80,6 +80,17 @@ var getSubType = function getSubType(item) {
80
80
  }
81
81
  return 'minutes';
82
82
  };
83
+ var formatRelationDetails = function formatRelationDetails(list) {
84
+ return (list || []).map(function (item) {
85
+ return {
86
+ num: item.product_quantity,
87
+ price: item.payment_price || 0,
88
+ product_id: item.product_id,
89
+ is_charge_tax: item.is_charge_tax,
90
+ order_detail_id: item.order_detail_id
91
+ };
92
+ });
93
+ };
83
94
 
84
95
  /**
85
96
  * @title: 预约商品信息
@@ -122,6 +133,7 @@ var formatBookings = function formatBookings(data) {
122
133
  "product_bundle": formatProductBundle((_item$_extend = item._extend) === null || _item$_extend === void 0 ? void 0 : (_item$_extend$other = _item$_extend.other) === null || _item$_extend$other === void 0 ? void 0 : _item$_extend$other.bundle),
123
134
  "bundle_edit": item._extend.bundle_edit
124
135
  },
136
+ "relation_products": formatRelationDetails(item._extend.relation_details),
125
137
  'id': item.booking_id || 0,
126
138
  "relation_id": item._extend.relation_id,
127
139
  "like_status": item._extend.like_status || 'common',
@@ -21,5 +21,5 @@ export interface InfoProps {
21
21
  * @Author: zhiwei.Wang
22
22
  * @Date: 2024-01-30 17:10
23
23
  */
24
- declare const Forms: (props: any) => any;
24
+ declare const Forms: (props: any) => JSX.Element;
25
25
  export default Forms;
@@ -5,5 +5,5 @@ export interface InfoProps {
5
5
  globalState: any;
6
6
  setGlobalState: any;
7
7
  }
8
- declare const Forms: (props: any) => any;
8
+ declare const Forms: (props: any) => JSX.Element;
9
9
  export default Forms;
@@ -1,6 +1,5 @@
1
- /// <reference types="react" />
2
1
  import { FormState } from "../model";
3
- export declare const Provider: (ComponentUi: any) => (props: any) => any, Context: import("react").Context<{
2
+ export declare const Provider: (ComponentUi: any) => (props: any) => JSX.Element, Context: import("react").Context<{
4
3
  state: FormState;
5
4
  } & {
6
5
  dispatch: (params: {
@@ -1,2 +1,2 @@
1
- declare const Booking: (props: any) => any;
1
+ declare const Booking: (props: any) => JSX.Element;
2
2
  export default Booking;
@@ -8,5 +8,5 @@ export interface InfoProps {
8
8
  slot: any;
9
9
  setState: any;
10
10
  }
11
- declare const Info: (props: any) => any;
11
+ declare const Info: (props: any) => JSX.Element;
12
12
  export default Info;
@@ -1,10 +1,9 @@
1
- /// <reference types="react" />
2
1
  import { FormState } from "../model";
3
2
  export declare const walkInData: {
4
3
  id: number;
5
4
  nickname: string;
6
5
  };
7
- export declare const Provider: (ComponentUi: any) => (props: any) => any, Context: import("react").Context<{
6
+ export declare const Provider: (ComponentUi: any) => (props: any) => JSX.Element, Context: import("react").Context<{
8
7
  state: FormState;
9
8
  } & {
10
9
  dispatch: (params: {
@@ -0,0 +1,6 @@
1
+ import React from "react";
2
+ import "./index.less";
3
+ declare const Actions: ({ currentService }: {
4
+ currentService: any;
5
+ }) => React.JSX.Element;
6
+ export default Actions;
@@ -0,0 +1,73 @@
1
+ import React, { useMemo, useContext } from "react";
2
+ import { Context } from "../../model";
3
+ import { Button } from "antd";
4
+ import { getIsEdit } from "../../../utils";
5
+ import { isUsableProduct } from "../addTimeModal/utils";
6
+ import "./index.less";
7
+ import { locales } from "@pisell/utils";
8
+ var Actions = function Actions(_ref) {
9
+ var _state$bookingConfig2, _state$bookingConfig3;
10
+ var currentService = _ref.currentService;
11
+ var _useContext = useContext(Context),
12
+ state = _useContext.state,
13
+ dispatch = _useContext.dispatch;
14
+ var appointment_card = useMemo(function () {
15
+ var _state$bookingConfig, _state$bookingConfig$, _state$bookingConfig$2;
16
+ return (state === null || state === void 0 ? void 0 : (_state$bookingConfig = state.bookingConfig) === null || _state$bookingConfig === void 0 ? void 0 : (_state$bookingConfig$ = _state$bookingConfig.config) === null || _state$bookingConfig$ === void 0 ? void 0 : (_state$bookingConfig$2 = _state$bookingConfig$.information_tab) === null || _state$bookingConfig$2 === void 0 ? void 0 : _state$bookingConfig$2.appointment_card) || {
17
+ quick_time: 1
18
+ };
19
+ }, [state === null || state === void 0 ? void 0 : (_state$bookingConfig2 = state.bookingConfig) === null || _state$bookingConfig2 === void 0 ? void 0 : (_state$bookingConfig3 = _state$bookingConfig2.config) === null || _state$bookingConfig3 === void 0 ? void 0 : _state$bookingConfig3.information_tab]);
20
+ var onAddTime = function onAddTime() {
21
+ dispatch({
22
+ type: "setService",
23
+ payload: {
24
+ addTimeModal: true,
25
+ cacheItem: currentService
26
+ }
27
+ });
28
+ };
29
+ var addTimeProducts = useMemo(function () {
30
+ return (state.addTimeProducts || []).some(function (item) {
31
+ return isUsableProduct(item.add_time, currentService);
32
+ });
33
+ }, [state.addTimeProducts, currentService]);
34
+ var showAddTimeButton = useMemo(function () {
35
+ // event预约不需要
36
+ if (state.renderType === "eventBooking") {
37
+ return false;
38
+ }
39
+
40
+ // 禁止编辑
41
+ if (state.disabledEdit) {
42
+ return false;
43
+ }
44
+
45
+ // 未开启加时
46
+ if (appointment_card.quick_time !== 1) {
47
+ return false;
48
+ }
49
+
50
+ // 如果在编辑态, 不展示加时
51
+ if (getIsEdit(state)) {
52
+ return false;
53
+ }
54
+
55
+ // 如果该服务没有符合的加时商品, 不展示加时
56
+ if (!addTimeProducts) {
57
+ return false;
58
+ }
59
+ return true;
60
+ }, [state, appointment_card.quick_time, addTimeProducts]);
61
+ return /*#__PURE__*/React.createElement("div", {
62
+ className: "actions-wrap"
63
+ }, showAddTimeButton && /*#__PURE__*/React.createElement(Button, {
64
+ className: "action-item",
65
+ size: "large",
66
+ onClick: function onClick(e) {
67
+ e.preventDefault();
68
+ e.stopPropagation();
69
+ onAddTime();
70
+ }
71
+ }, locales.getText("page.booking.text.add-time")));
72
+ };
73
+ export default Actions;
@@ -0,0 +1,9 @@
1
+ .actions-wrap {
2
+ display: flex;
3
+ align-items: center;
4
+ justify-content: center;
5
+
6
+ .action-item {
7
+ flex: 1;
8
+ }
9
+ }
@@ -0,0 +1,4 @@
1
+ import React from "react";
2
+ import "./index.less";
3
+ declare const AddTimeModal: () => React.JSX.Element;
4
+ export default AddTimeModal;