@pisell/private-materials 3.0.72 → 3.0.74

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 (89) 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/footer/amount.js +47 -24
  14. package/es/components/booking/components/footer/index.js +5 -0
  15. package/es/components/booking/components/footer/utils.js +22 -1
  16. package/es/components/booking/deposit/index.js +10 -1
  17. package/es/components/booking/forms/forms.d.ts +1 -1
  18. package/es/components/booking/forms/index.d.ts +1 -1
  19. package/es/components/booking/forms/model.d.ts +1 -2
  20. package/es/components/booking/index.d.ts +1 -1
  21. package/es/components/booking/info/index.d.ts +1 -1
  22. package/es/components/booking/info/model.d.ts +1 -2
  23. package/es/components/booking/info/service/actions/index.d.ts +6 -0
  24. package/es/components/booking/info/service/actions/index.js +73 -0
  25. package/es/components/booking/info/service/actions/index.less +9 -0
  26. package/es/components/booking/info/service/addTimeModal/index.d.ts +4 -0
  27. package/es/components/booking/info/service/addTimeModal/index.js +658 -0
  28. package/es/components/booking/info/service/addTimeModal/index.less +133 -0
  29. package/es/components/booking/info/service/addTimeModal/serve.d.ts +5 -0
  30. package/es/components/booking/info/service/addTimeModal/serve.js +50 -0
  31. package/es/components/booking/info/service/addTimeModal/utils.d.ts +12 -0
  32. package/es/components/booking/info/service/addTimeModal/utils.js +96 -0
  33. package/es/components/booking/info/service/index.js +2 -1
  34. package/es/components/booking/info/service/serviceItem/Sales/index.d.ts +0 -0
  35. package/es/components/booking/info/service/serviceItem/Sales/index.js +0 -0
  36. package/es/components/booking/info/service/serviceItem/Sales/index.less +0 -0
  37. package/es/components/booking/info/service/serviceItem/index.js +24 -2
  38. package/es/components/booking/info/service/serviceItem/index.less +28 -0
  39. package/es/components/booking/locales.d.ts +24 -0
  40. package/es/components/booking/locales.js +26 -2
  41. package/es/components/booking/model.d.ts +3 -2
  42. package/es/components/booking/notes/index.d.ts +1 -1
  43. package/es/components/booking/notes/model.d.ts +1 -2
  44. package/es/components/booking/payments/index.d.ts +1 -1
  45. package/es/components/booking/payments/model.d.ts +1 -2
  46. package/es/components/booking/utils.d.ts +12 -0
  47. package/es/components/booking/utils.js +91 -48
  48. package/es/components/schedules/index.d.ts +1 -1
  49. package/es/components/schedules/model.d.ts +1 -2
  50. package/lib/components/booking/addons/index.d.ts +1 -1
  51. package/lib/components/booking/addons/model.d.ts +1 -2
  52. package/lib/components/booking/components/footer/amount.js +10 -0
  53. package/lib/components/booking/components/footer/index.js +5 -0
  54. package/lib/components/booking/components/footer/utils.js +21 -1
  55. package/lib/components/booking/deposit/index.js +3 -1
  56. package/lib/components/booking/forms/forms.d.ts +1 -1
  57. package/lib/components/booking/forms/index.d.ts +1 -1
  58. package/lib/components/booking/forms/model.d.ts +1 -2
  59. package/lib/components/booking/index.d.ts +1 -1
  60. package/lib/components/booking/info/index.d.ts +1 -1
  61. package/lib/components/booking/info/model.d.ts +1 -2
  62. package/lib/components/booking/info/service/actions/index.d.ts +6 -0
  63. package/lib/components/booking/info/service/actions/index.js +97 -0
  64. package/lib/components/booking/info/service/actions/index.less +9 -0
  65. package/lib/components/booking/info/service/addTimeModal/index.d.ts +4 -0
  66. package/lib/components/booking/info/service/addTimeModal/index.js +566 -0
  67. package/lib/components/booking/info/service/addTimeModal/index.less +133 -0
  68. package/lib/components/booking/info/service/addTimeModal/serve.d.ts +5 -0
  69. package/lib/components/booking/info/service/addTimeModal/serve.js +39 -0
  70. package/lib/components/booking/info/service/addTimeModal/utils.d.ts +12 -0
  71. package/lib/components/booking/info/service/addTimeModal/utils.js +129 -0
  72. package/lib/components/booking/info/service/index.js +2 -1
  73. package/lib/components/booking/info/service/serviceItem/Sales/index.d.ts +0 -0
  74. package/lib/components/booking/info/service/serviceItem/Sales/index.js +0 -0
  75. package/lib/components/booking/info/service/serviceItem/Sales/index.less +0 -0
  76. package/lib/components/booking/info/service/serviceItem/index.js +14 -1
  77. package/lib/components/booking/info/service/serviceItem/index.less +28 -0
  78. package/lib/components/booking/locales.d.ts +24 -0
  79. package/lib/components/booking/locales.js +26 -2
  80. package/lib/components/booking/model.d.ts +3 -2
  81. package/lib/components/booking/notes/index.d.ts +1 -1
  82. package/lib/components/booking/notes/model.d.ts +1 -2
  83. package/lib/components/booking/payments/index.d.ts +1 -1
  84. package/lib/components/booking/payments/model.d.ts +1 -2
  85. package/lib/components/booking/utils.d.ts +12 -0
  86. package/lib/components/booking/utils.js +82 -33
  87. package/lib/components/schedules/index.d.ts +1 -1
  88. package/lib/components/schedules/model.d.ts +1 -2
  89. package/package.json +2 -2
@@ -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: {
@@ -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
 
@@ -71,6 +71,26 @@ export var formatProductBundle = function formatProductBundle(bundle) {
71
71
  };
72
72
  });
73
73
  };
74
+ var getSubType = function getSubType(item) {
75
+ var _item$duration;
76
+ var _type = (_item$duration = item.duration) === null || _item$duration === void 0 ? void 0 : _item$duration.type;
77
+ // 目前不支持跨天
78
+ if (_type && _type !== 'days') {
79
+ return _type;
80
+ }
81
+ return 'minutes';
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
+ };
74
94
 
75
95
  /**
76
96
  * @title: 预约商品信息
@@ -113,6 +133,7 @@ var formatBookings = function formatBookings(data) {
113
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),
114
134
  "bundle_edit": item._extend.bundle_edit
115
135
  },
136
+ "relation_products": formatRelationDetails(item._extend.relation_details),
116
137
  'id': item.booking_id || 0,
117
138
  "relation_id": item._extend.relation_id,
118
139
  "like_status": item._extend.like_status || 'common',
@@ -120,7 +141,7 @@ var formatBookings = function formatBookings(data) {
120
141
  "is_all": false,
121
142
  "schedule_id": item._extend.schedule_id,
122
143
  "end_time": end_time,
123
- "sub_type": 'days',
144
+ "sub_type": getSubType(item),
124
145
  "select_date": start_date,
125
146
  "start_time": start_time,
126
147
  "end_date": end_date,
@@ -46,7 +46,8 @@ var Deposit = function Deposit(props) {
46
46
  bookingId = globalState.bookingId,
47
47
  amountSymbol = globalState.amountSymbol,
48
48
  generatePaymentLink = globalState.generatePaymentLink,
49
- locale = globalState.locale;
49
+ locale = globalState.locale,
50
+ callback = globalState.callback;
50
51
  var sendEmail = function sendEmail(id) {
51
52
  action({
52
53
  type: 'pisell1.sendPayLinkEmail',
@@ -77,6 +78,10 @@ var Deposit = function Deposit(props) {
77
78
  deposit_amount: 0
78
79
  })
79
80
  });
81
+ callback === null || callback === void 0 ? void 0 : callback({
82
+ order_id: bookingId,
83
+ afterCloseUpdate: true
84
+ });
80
85
  });
81
86
  }
82
87
  });
@@ -130,6 +135,10 @@ var Deposit = function Deposit(props) {
130
135
  deposit_amount: amount
131
136
  })
132
137
  });
138
+ callback === null || callback === void 0 ? void 0 : callback({
139
+ order_id: bookingId,
140
+ afterCloseUpdate: true
141
+ });
133
142
  });
134
143
  };
135
144
  var handleGoOrderDetail = function handleGoOrderDetail() {
@@ -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.relation_product, 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;