@pisell/private-materials 3.0.15 → 3.0.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/build/lowcode/assets-daily.json +11 -11
  2. package/build/lowcode/assets-dev.json +2 -2
  3. package/build/lowcode/assets-prod.json +11 -11
  4. package/build/lowcode/index.js +1 -1
  5. package/build/lowcode/meta.js +1 -1
  6. package/build/lowcode/preview.js +7 -7
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +9 -9
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +8 -8
  11. package/es/components/booking/addons/index.d.ts +1 -1
  12. package/es/components/booking/addons/index.js +148 -32
  13. package/es/components/booking/addons/model.d.ts +1 -2
  14. package/es/components/booking/components/TabProduct/selectProductItem/index.js +21 -8
  15. package/es/components/booking/components/TabProduct/selectProductItem/index.less +34 -27
  16. package/es/components/booking/components/TabProduct/tabs/index.less +4 -1
  17. package/es/components/booking/components/collapsibleList/index.d.ts +11 -0
  18. package/es/components/booking/components/collapsibleList/index.js +99 -0
  19. package/es/components/booking/components/collapsibleList/index.less +61 -0
  20. package/es/components/booking/components/collapsibleList/utils.d.ts +2 -0
  21. package/es/components/booking/components/collapsibleList/utils.js +21 -0
  22. package/es/components/booking/components/footer/amount.js +9 -10
  23. package/es/components/booking/components/footer/index.js +4 -1
  24. package/es/components/booking/components/footer/utils.d.ts +18 -0
  25. package/es/components/booking/components/footer/utils.js +76 -4
  26. package/es/components/booking/forms/forms.d.ts +1 -1
  27. package/es/components/booking/forms/index.d.ts +1 -1
  28. package/es/components/booking/forms/model.d.ts +1 -2
  29. package/es/components/booking/forms/single/index.js +16 -82
  30. package/es/components/booking/index.d.ts +1 -1
  31. package/es/components/booking/info/index.d.ts +1 -1
  32. package/es/components/booking/info/model.d.ts +1 -2
  33. package/es/components/booking/info/service/addService/index.js +141 -71
  34. package/es/components/booking/info/service/editService/index.js +49 -24
  35. package/es/components/booking/info/service/editService/index.less +21 -0
  36. package/es/components/booking/info/service/index.d.ts +2 -2
  37. package/es/components/booking/info/service/index.js +5 -129
  38. package/es/components/booking/info/service/index.less +0 -100
  39. package/es/components/booking/info/service/serve.d.ts +1 -0
  40. package/es/components/booking/info/service/serve.js +21 -0
  41. package/es/components/booking/info/service/serviceItem/index.d.ts +4 -0
  42. package/es/components/booking/info/service/serviceItem/index.js +63 -0
  43. package/es/components/booking/info/service/serviceItem/index.less +97 -0
  44. package/es/components/booking/info/service/serviceList/index.d.ts +4 -0
  45. package/es/components/booking/info/service/serviceList/index.js +105 -0
  46. package/es/components/booking/info/service/serviceList/index.less +0 -0
  47. package/es/components/booking/info/utils.d.ts +1 -0
  48. package/es/components/booking/info/utils.js +8 -0
  49. package/es/components/booking/model.d.ts +1 -2
  50. package/es/components/booking/notes/index.d.ts +1 -1
  51. package/es/components/booking/notes/model.d.ts +1 -2
  52. package/es/components/booking/payments/index.d.ts +1 -1
  53. package/es/components/booking/payments/model.d.ts +1 -2
  54. package/es/components/booking/utils.d.ts +16 -0
  55. package/es/components/booking/utils.js +37 -0
  56. package/es/components/productExtension/fields/SelectResourcesTable/index.js +2 -1
  57. package/es/components/productExtension/locales.js +5 -5
  58. package/es/components/schedules/index.d.ts +1 -1
  59. package/es/components/schedules/model.d.ts +1 -2
  60. package/lib/components/booking/addons/index.d.ts +1 -1
  61. package/lib/components/booking/addons/index.js +159 -35
  62. package/lib/components/booking/addons/model.d.ts +1 -2
  63. package/lib/components/booking/components/TabProduct/selectProductItem/index.js +33 -8
  64. package/lib/components/booking/components/TabProduct/selectProductItem/index.less +34 -27
  65. package/lib/components/booking/components/TabProduct/tabs/index.less +4 -1
  66. package/lib/components/booking/components/collapsibleList/index.d.ts +11 -0
  67. package/lib/components/booking/components/collapsibleList/index.js +94 -0
  68. package/lib/components/booking/components/collapsibleList/index.less +61 -0
  69. package/lib/components/booking/components/collapsibleList/utils.d.ts +2 -0
  70. package/lib/components/booking/components/collapsibleList/utils.js +46 -0
  71. package/lib/components/booking/components/footer/amount.js +9 -10
  72. package/lib/components/booking/components/footer/index.js +3 -0
  73. package/lib/components/booking/components/footer/utils.d.ts +18 -0
  74. package/lib/components/booking/components/footer/utils.js +46 -7
  75. package/lib/components/booking/forms/forms.d.ts +1 -1
  76. package/lib/components/booking/forms/index.d.ts +1 -1
  77. package/lib/components/booking/forms/model.d.ts +1 -2
  78. package/lib/components/booking/forms/single/index.js +12 -48
  79. package/lib/components/booking/index.d.ts +1 -1
  80. package/lib/components/booking/info/index.d.ts +1 -1
  81. package/lib/components/booking/info/model.d.ts +1 -2
  82. package/lib/components/booking/info/service/addService/index.js +68 -34
  83. package/lib/components/booking/info/service/editService/index.js +76 -56
  84. package/lib/components/booking/info/service/editService/index.less +21 -0
  85. package/lib/components/booking/info/service/index.d.ts +2 -2
  86. package/lib/components/booking/info/service/index.js +4 -112
  87. package/lib/components/booking/info/service/index.less +0 -100
  88. package/lib/components/booking/info/service/serve.d.ts +1 -0
  89. package/lib/components/booking/info/service/serve.js +30 -0
  90. package/lib/components/booking/info/service/serviceItem/index.d.ts +4 -0
  91. package/lib/components/booking/info/service/serviceItem/index.js +98 -0
  92. package/lib/components/booking/info/service/serviceItem/index.less +97 -0
  93. package/lib/components/booking/info/service/serviceList/index.d.ts +4 -0
  94. package/lib/components/booking/info/service/serviceList/index.js +129 -0
  95. package/lib/components/booking/info/service/serviceList/index.less +0 -0
  96. package/lib/components/booking/info/utils.d.ts +1 -0
  97. package/lib/components/booking/info/utils.js +35 -0
  98. package/lib/components/booking/model.d.ts +1 -2
  99. package/lib/components/booking/notes/index.d.ts +1 -1
  100. package/lib/components/booking/notes/model.d.ts +1 -2
  101. package/lib/components/booking/payments/index.d.ts +1 -1
  102. package/lib/components/booking/payments/model.d.ts +1 -2
  103. package/lib/components/booking/utils.d.ts +16 -0
  104. package/lib/components/booking/utils.js +29 -0
  105. package/lib/components/productExtension/fields/SelectResourcesTable/index.js +1 -1
  106. package/lib/components/productExtension/locales.js +5 -5
  107. package/lib/components/schedules/index.d.ts +1 -1
  108. package/lib/components/schedules/model.d.ts +1 -2
  109. package/package.json +3 -3
@@ -40,13 +40,18 @@ var import_model = require("../../model");
40
40
  var import_addButton = __toESM(require("../../../components/addButton"));
41
41
  var import_antd = require("antd");
42
42
  var import_index = require("./index.less");
43
- var import_utils = require("../../../utils");
44
- var import_utils2 = require("@pisell/utils");
43
+ var import_useEngineContext = __toESM(require("../../../../../hooks/useEngineContext"));
44
+ var import_serve = require("../serve");
45
+ var import_utils = require("../../utils");
46
+ var import_utils2 = require("../../../utils");
47
+ var import_utils3 = require("@pisell/utils");
45
48
  var Info = () => {
46
49
  var _a;
47
50
  const [search, setSearch] = (0, import_react.useState)("");
48
51
  const { state, dispatch } = (0, import_react.useContext)(import_model.Context);
49
- const setDefaultService = (list) => {
52
+ const context = (0, import_useEngineContext.default)();
53
+ import_utils2.request.setRequest(context.appHelper.utils.request);
54
+ const setDefaultService = async (list) => {
50
55
  if (state.renderType !== "eventBooking") {
51
56
  return;
52
57
  }
@@ -61,10 +66,16 @@ var Info = () => {
61
66
  return;
62
67
  }
63
68
  let product = list[0];
69
+ const detail = await (0, import_serve.getProductDetail)(product.id, {
70
+ schedule_date: state.date.value.format("YYYY-MM-DD")
71
+ });
72
+ const isBundleOrCombination = (0, import_utils.getIsBundleOrCombination)(detail.data);
73
+ if (isBundleOrCombination)
74
+ return;
64
75
  let _item = {
65
76
  ...product,
66
77
  product_id: product.id,
67
- _id: (0, import_utils2.getUniqueId)(),
78
+ _id: (0, import_utils3.getUniqueId)(),
68
79
  _extend: {
69
80
  start_date: state.date.value,
70
81
  startDate: state.date.value,
@@ -73,6 +84,8 @@ var Info = () => {
73
84
  duration: 10,
74
85
  quantity: 1,
75
86
  price: product.price,
87
+ total: product.price,
88
+ origin_total: product.price,
76
89
  product_name: product.title
77
90
  }
78
91
  };
@@ -98,7 +111,7 @@ var Info = () => {
98
111
  // include_variant: "no",
99
112
  ids: state.renderType === "eventBooking" ? (_a2 = state.eventOtherParams) == null ? void 0 : _a2.productIds : void 0,
100
113
  open_quotation: 1,
101
- with_schedule: 0
114
+ with_schedule: 1
102
115
  });
103
116
  setDefaultService(data == null ? void 0 : data.list);
104
117
  dispatch({
@@ -118,29 +131,50 @@ var Info = () => {
118
131
  });
119
132
  };
120
133
  const handleSelectProduct = (item) => {
121
- var _a2;
122
- const _isEdit = !!state.service.cacheItem;
123
- let _item = {
124
- ...item,
125
- product_id: item.id,
126
- _id: (0, import_utils2.getUniqueId)(),
127
- _extend: {
128
- start_date: state.date.value,
129
- quantity: 1,
130
- price: item.price,
131
- product_name: item.title
134
+ state.action({
135
+ type: "pisell1.handleOpenProductModal",
136
+ data: {
137
+ id: item.id,
138
+ date: state.date.value.format("YYYY-MM-DD"),
139
+ showConfig: {
140
+ option: false,
141
+ session: false,
142
+ variant: false,
143
+ package: true
144
+ }
132
145
  },
133
- new: 1
134
- };
135
- if (_isEdit) {
136
- _item._id = (_a2 = state.service.cacheItem) == null ? void 0 : _a2._id;
137
- _item.new = 0;
138
- }
139
- dispatch({
140
- type: "setService",
141
- payload: {
142
- editModal: true,
143
- cacheItem: _item
146
+ callback: (e) => {
147
+ var _a2;
148
+ let cacheItem = {
149
+ ...item,
150
+ product_id: item.id,
151
+ _id: (0, import_utils3.getUniqueId)(),
152
+ _key: e.key,
153
+ _extend: {
154
+ start_date: state.date.value,
155
+ quantity: 1,
156
+ price: item.price,
157
+ product_name: item.title,
158
+ other: e
159
+ },
160
+ new: 1
161
+ };
162
+ let _total = (0, import_utils2.getProductTotalPrice)(cacheItem);
163
+ console.log("_total", e);
164
+ cacheItem._extend.total = _total;
165
+ cacheItem._extend.origin_total = _total;
166
+ const _isEdit = !!state.service.cacheItem;
167
+ if (_isEdit) {
168
+ cacheItem._id = (_a2 = state.service.cacheItem) == null ? void 0 : _a2._id;
169
+ cacheItem.new = 0;
170
+ }
171
+ dispatch({
172
+ type: "setService",
173
+ payload: {
174
+ editModal: true,
175
+ cacheItem
176
+ }
177
+ });
144
178
  }
145
179
  });
146
180
  };
@@ -150,7 +184,7 @@ var Info = () => {
150
184
  const isIncludes = (str) => {
151
185
  return str.toLowerCase().indexOf(search.toLowerCase()) !== -1;
152
186
  };
153
- return (0, import_utils.formatProductListByCategory)(
187
+ return (0, import_utils2.formatProductListByCategory)(
154
188
  _list,
155
189
  search ? (item) => isIncludes(item.title) : void 0
156
190
  );
@@ -175,8 +209,8 @@ var Info = () => {
175
209
  import_addButton.default,
176
210
  {
177
211
  showSub: false,
178
- title: import_utils2.locales.getText("pisell2.text.add-a-service"),
179
- subTitle: import_utils2.locales.getText("pisell2.text.add-another-service"),
212
+ title: import_utils3.locales.getText("pisell2.text.add-a-service"),
213
+ subTitle: import_utils3.locales.getText("pisell2.text.add-another-service"),
180
214
  onClick: handleSelectService
181
215
  }
182
216
  );
@@ -185,8 +219,8 @@ var Info = () => {
185
219
  import_addButton.default,
186
220
  {
187
221
  showSub: isService,
188
- title: import_utils2.locales.getText("pisell2.text.add-a-service"),
189
- subTitle: import_utils2.locales.getText("pisell2.text.add-another-service"),
222
+ title: import_utils3.locales.getText("pisell2.text.add-a-service"),
223
+ subTitle: import_utils3.locales.getText("pisell2.text.add-another-service"),
190
224
  onClick: handleSelectService
191
225
  }
192
226
  ) : /* @__PURE__ */ import_react.default.createElement("div", { style: { height: 20 } });
@@ -195,7 +229,7 @@ var Info = () => {
195
229
  import_drawer.default,
196
230
  {
197
231
  open: state.service.addModal,
198
- title: import_utils2.locales.getText("pisell2.text.select-service"),
232
+ title: import_utils3.locales.getText("pisell2.text.select-service"),
199
233
  rootClassName: "booking-server-wrap",
200
234
  onClose: () => {
201
235
  dispatch({
@@ -210,7 +244,7 @@ var Info = () => {
210
244
  {
211
245
  prefix: /* @__PURE__ */ import_react.default.createElement(import_SearchLg.default, null),
212
246
  style: { marginTop: 16, height: 44 },
213
- placeholder: import_utils2.locales.getText("pisell2.text.search"),
247
+ placeholder: import_utils3.locales.getText("pisell2.text.search"),
214
248
  allowClear: true,
215
249
  value: search,
216
250
  onChange: (e) => {
@@ -41,15 +41,17 @@ var import_utils = require("@pisell/utils");
41
41
  var import_duration = __toESM(require("../../../materiels/duration"));
42
42
  var import_antd = require("antd");
43
43
  var import_index = require("./index.less");
44
+ var import_collapsibleList = __toESM(require("../../../components/collapsibleList"));
45
+ var import_utils2 = require("../../../components/collapsibleList/utils");
44
46
  var import_dayjs = __toESM(require("dayjs"));
45
47
  var import_ahooks = require("ahooks");
46
- var import_utils2 = require("../../../utils");
48
+ var import_utils3 = require("../../../utils");
47
49
  var import_like = __toESM(require("../like"));
48
50
  var import_mock = require("../../../mock");
49
51
  var Info = () => {
50
- var _a, _b, _c, _d, _e, _f, _g;
52
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
51
53
  const [form] = import_antd.Form.useForm();
52
- const usePrice = import_antd.Form.useWatch("price", form);
54
+ const useTotal = import_antd.Form.useWatch("total", form);
53
55
  const useLikeStatus = import_antd.Form.useWatch("like_status", form);
54
56
  const useResource = import_antd.Form.useWatch("resource", form);
55
57
  const useStartTime = import_antd.Form.useWatch("start_time", form);
@@ -80,7 +82,7 @@ var Info = () => {
80
82
  (0, import_dayjs.default)(_cacheItem._extend.start_date).format("YYYY-MM-DD ") + (useStartTime || "00:00")
81
83
  ),
82
84
  usableTime: (_a2 = currentResource == null ? void 0 : currentResource._extend) == null ? void 0 : _a2.usableTime,
83
- duration: (0, import_utils2.getDuration)(_cacheItem == null ? void 0 : _cacheItem.duration),
85
+ duration: (0, import_utils3.getDuration)(_cacheItem == null ? void 0 : _cacheItem.duration),
84
86
  locale: import_utils.locales.locale,
85
87
  slice: (_d2 = (_c2 = (_b2 = state.bookingConfig) == null ? void 0 : _b2.config) == null ? void 0 : _c2.basic) == null ? void 0 : _d2.service_time,
86
88
  selectProps: { size: "large" }
@@ -96,7 +98,7 @@ var Info = () => {
96
98
  var _a2, _b2;
97
99
  let _duration = durationProps.duration;
98
100
  if (_duration === "flexible") {
99
- let endDate = (0, import_utils2.getEndDate)(
101
+ let endDate = (0, import_utils3.getEndDate)(
100
102
  durationProps.startDate,
101
103
  _duration,
102
104
  ((_a2 = durationProps.usableTime) == null ? void 0 : _a2.end_at) ? (0, import_dayjs.default)((_b2 = durationProps.usableTime) == null ? void 0 : _b2.end_at) : null
@@ -104,14 +106,14 @@ var Info = () => {
104
106
  let timeValue = endDate.diff(durationProps.startDate, "minute");
105
107
  return {
106
108
  label: import_utils.locales.getText("pisell2.text.flexible"),
107
- value: import_utils2.flexibleObj.create(timeValue)
109
+ value: import_utils3.flexibleObj.create(timeValue)
108
110
  };
109
111
  }
110
112
  return null;
111
113
  }, [durationProps, import_utils.locales.locale]);
112
114
  const timeObj = (0, import_react.useMemo)(() => {
113
115
  var _a2, _b2, _c2;
114
- let obj = (0, import_utils2.sliceDayIntoFiveMinutes)(
116
+ let obj = (0, import_utils3.sliceDayIntoFiveMinutes)(
115
117
  (_c2 = (_b2 = (_a2 = state.bookingConfig) == null ? void 0 : _a2.config) == null ? void 0 : _b2.basic) == null ? void 0 : _c2.service_time,
116
118
  import_utils.locales.locale
117
119
  );
@@ -121,7 +123,7 @@ var Info = () => {
121
123
  }
122
124
  if (useDuration && !durationSlicesBasedOnTime.some((d) => d.value === useDuration)) {
123
125
  durationSlicesBasedOnTime.unshift({
124
- label: (0, import_utils2.getDiscountTime)(useDuration),
126
+ label: (0, import_utils3.getDiscountTime)(useDuration),
125
127
  value: useDuration,
126
128
  //@ts-ignore
127
129
  disabled: true
@@ -145,36 +147,39 @@ var Info = () => {
145
147
  }
146
148
  }, [useDuration, flexibleOption]);
147
149
  const getResources = async (cacheItem) => {
148
- setResourceLoading(true);
149
- let data = await state.apis.getResources({
150
- skip: 1,
151
- num: 1e3,
152
- with_date_times: state.date.value.format("YYYY-MM-DD"),
153
- codes: ["resources", "therapist", "table"],
154
- _config: { abort: true }
155
- });
156
- let _list = [(0, import_mock.getNoResource)()].concat((data == null ? void 0 : data.list) || []);
157
- const _cacheItem = cacheItem || getCurrentCacheItem();
158
- if (!_cacheItem._extend) {
159
- return;
160
- }
161
- _list = _list.map(
162
- (d) => (0, import_utils2.formatResource)(d, _cacheItem, (item) => {
163
- return /* @__PURE__ */ import_react.default.createElement("div", { className: "resource-option" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "like-wrap" }), item.labelText, !item.usable && /* @__PURE__ */ import_react.default.createElement(import_AlertTriangle.default, { className: "resource-option-alert-icon" }));
164
- })
165
- );
166
- _list = _list.sort((a, b) => b.usable ? 1 : -1);
167
- if (useResource && !_list.find((d) => d.form_record_id === useResource)) {
168
- form.setFieldsValue({
169
- resource: 0
150
+ try {
151
+ setResourceLoading(true);
152
+ let data = await state.apis.getResources({
153
+ skip: 1,
154
+ num: 1e3,
155
+ with_date_times: state.date.value.format("YYYY-MM-DD"),
156
+ codes: ["resources", "therapist", "table"],
157
+ _config: { abort: true }
170
158
  });
171
- }
172
- dispatch({
173
- type: "setService",
174
- payload: {
175
- resources: _list
159
+ let _list = [(0, import_mock.getNoResource)()].concat((data == null ? void 0 : data.list) || []);
160
+ const _cacheItem = cacheItem || getCurrentCacheItem();
161
+ if (!_cacheItem._extend) {
162
+ return;
176
163
  }
177
- });
164
+ _list = _list.map(
165
+ (d) => (0, import_utils3.formatResource)(d, _cacheItem, (item) => {
166
+ return /* @__PURE__ */ import_react.default.createElement("div", { className: "resource-option" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "like-wrap" }), item.labelText, !item.usable && /* @__PURE__ */ import_react.default.createElement(import_AlertTriangle.default, { className: "resource-option-alert-icon" }));
167
+ })
168
+ );
169
+ _list = _list.sort((a, b) => b.usable ? 1 : -1);
170
+ if (useResource && !_list.find((d) => d.form_record_id === useResource)) {
171
+ form.setFieldsValue({
172
+ resource: 0
173
+ });
174
+ }
175
+ dispatch({
176
+ type: "setService",
177
+ payload: {
178
+ resources: _list
179
+ }
180
+ });
181
+ } catch (err) {
182
+ }
178
183
  setResourceLoading(false);
179
184
  };
180
185
  const handleDeleteProduct = () => {
@@ -224,8 +229,8 @@ var Info = () => {
224
229
  };
225
230
  const getDiscount = () => {
226
231
  var _a2;
227
- let oPrice = Number(((_a2 = state.service.cacheItem) == null ? void 0 : _a2.price) || 0);
228
- let cPrice = Number(usePrice || 0);
232
+ let oPrice = Number(((_a2 = state.service.cacheItem) == null ? void 0 : _a2._extend.origin_total) || 0);
233
+ let cPrice = Number(useTotal || 0);
229
234
  let discount = "";
230
235
  if (cPrice === oPrice) {
231
236
  discount = import_utils.locales.getText("pisell2.text.status.no-discount");
@@ -247,13 +252,16 @@ var Info = () => {
247
252
  ..._item._extend,
248
253
  ...values
249
254
  };
250
- const { startDate, endDate } = (0, import_utils2.getServiceTimes)({ _extend });
255
+ const { startDate, endDate } = (0, import_utils3.getServiceTimes)({ _extend });
251
256
  _extend.startDate = startDate;
252
257
  _extend.endDate = endDate;
253
258
  const { relation_type, item_id, schedule_id } = ((_a2 = currentResource == null ? void 0 : currentResource._extend) == null ? void 0 : _a2.usableTime) || {};
254
259
  _extend.relation_type = relation_type || "form";
255
260
  _extend.relation_id = item_id || (currentResource == null ? void 0 : currentResource.form_record_id) || 0;
256
261
  _extend.schedule_id = schedule_id || 0;
262
+ if (_extend.bundle_edit !== void 0) {
263
+ _extend.bundle_edit = 1;
264
+ }
257
265
  _item._extend = _extend;
258
266
  if ((_b2 = state.service.cacheItem) == null ? void 0 : _b2.new) {
259
267
  _list.push(_item);
@@ -261,7 +269,7 @@ var Info = () => {
261
269
  let _id = _item == null ? void 0 : _item._id;
262
270
  _list = _list.map((d) => d._id === _id ? { ..._item, new: 0 } : d);
263
271
  }
264
- (0, import_utils2.deleteCacheParams)();
272
+ (0, import_utils3.deleteCacheParams)();
265
273
  dispatch({
266
274
  type: "setService",
267
275
  payload: {
@@ -276,7 +284,7 @@ var Info = () => {
276
284
  const setEditData = (0, import_ahooks.useMemoizedFn)(() => {
277
285
  if (state.service.editModal) {
278
286
  let cacheItem = state.service.cacheItem;
279
- form.setFieldsValue((0, import_utils2.getServerItemExtend)(state, cacheItem, timeObj));
287
+ form.setFieldsValue((0, import_utils3.getServerItemExtend)(state, cacheItem, timeObj));
280
288
  if (state.renderType !== "eventBooking") {
281
289
  getResources();
282
290
  }
@@ -286,12 +294,12 @@ var Info = () => {
286
294
  });
287
295
  const isReason = (0, import_react.useMemo)(() => {
288
296
  var _a2;
289
- let oPrice = Number(((_a2 = state.service.cacheItem) == null ? void 0 : _a2.price) || 0);
290
- let cPrice = Number(usePrice || 0);
297
+ let oPrice = Number(((_a2 = state.service.cacheItem) == null ? void 0 : _a2._extend.origin_total) || 0);
298
+ let cPrice = Number(useTotal || 0);
291
299
  return cPrice !== oPrice;
292
- }, [usePrice, state.service.cacheItem]);
300
+ }, [useTotal, state.service.cacheItem]);
293
301
  const errorList = (0, import_react.useMemo)(() => {
294
- return (0, import_utils2.getErrorList)(currentResource, getCurrentCacheItem());
302
+ return (0, import_utils3.getErrorList)(currentResource, getCurrentCacheItem());
295
303
  }, [currentResource, useDuration, useStartTime]);
296
304
  (0, import_ahooks.useUpdateEffect)(() => {
297
305
  if (useStartTime && useDuration && state.renderType !== "eventBooking") {
@@ -306,19 +314,23 @@ var Info = () => {
306
314
  }, [useResource, useStartTime, useDuration]);
307
315
  (0, import_react.useEffect)(() => {
308
316
  getDiscount();
309
- }, [usePrice, state.service.cacheItem]);
317
+ }, [useTotal, state.service.cacheItem]);
310
318
  const isDiscount = (0, import_react.useMemo)(() => {
311
319
  var _a2, _b2, _c2;
312
320
  if (!((_a2 = state.service) == null ? void 0 : _a2.cacheItem)) {
313
321
  return false;
314
322
  }
315
- return usePrice != ((_c2 = (_b2 = state.service) == null ? void 0 : _b2.cacheItem) == null ? void 0 : _c2.price);
316
- }, [usePrice, (_e = (_d = state.service) == null ? void 0 : _d.cacheItem) == null ? void 0 : _e.price]);
323
+ return useTotal != ((_c2 = (_b2 = state.service) == null ? void 0 : _b2.cacheItem) == null ? void 0 : _c2._extend.origin_total);
324
+ }, [useTotal, (_e = (_d = state.service) == null ? void 0 : _d.cacheItem) == null ? void 0 : _e._extend.origin_total]);
317
325
  (0, import_react.useEffect)(() => {
318
326
  if (useResource === 0) {
319
327
  handleLikeResource("common");
320
328
  }
321
329
  }, [useResource]);
330
+ const bundles = (0, import_react.useMemo)(() => {
331
+ var _a2, _b2, _c2, _d2;
332
+ return ((_d2 = (_c2 = (_b2 = (_a2 = state.service) == null ? void 0 : _a2.cacheItem) == null ? void 0 : _b2._extend) == null ? void 0 : _c2.other) == null ? void 0 : _d2.bundle) || [];
333
+ }, [(_f = state.service) == null ? void 0 : _f.cacheItem]);
322
334
  return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(
323
335
  import_drawer.default,
324
336
  {
@@ -336,10 +348,9 @@ var Info = () => {
336
348
  }
337
349
  },
338
350
  /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-service-body-edit" }, /* @__PURE__ */ import_react.default.createElement(import_antd.Form, { layout: "vertical", form, onFinish }, /* @__PURE__ */ import_react.default.createElement(import_antd.Row, { style: { width: "100%" }, gutter: [16, 0] }, /* @__PURE__ */ import_react.default.createElement(import_antd.Col, { span: 24 }, /* @__PURE__ */ import_react.default.createElement(import_antd.Form.Item, { name: "product_name" }, /* @__PURE__ */ import_react.default.createElement(
339
- import_antd.Select,
351
+ "div",
340
352
  {
341
- size: "large",
342
- open: false,
353
+ className: "current-service-info",
343
354
  onClick: () => {
344
355
  if (state.channelDisabledEdit) {
345
356
  return;
@@ -352,12 +363,21 @@ var Info = () => {
352
363
  }
353
364
  });
354
365
  }
355
- }
366
+ },
367
+ /* @__PURE__ */ import_react.default.createElement("div", { className: "current-service-info-name" }, ((_i = (_h = (_g = state.service) == null ? void 0 : _g.cacheItem) == null ? void 0 : _h._extend) == null ? void 0 : _i.product_name) || "-"),
368
+ /* @__PURE__ */ import_react.default.createElement(
369
+ import_collapsibleList.default,
370
+ {
371
+ style: { marginTop: bundles.length ? "8px" : 0 },
372
+ list: bundles,
373
+ renderItem: (item) => (0, import_utils2.renderBundles)(item, state.amountSymbol)
374
+ }
375
+ )
356
376
  ))), /* @__PURE__ */ import_react.default.createElement(import_antd.Col, { span: 12 }, /* @__PURE__ */ import_react.default.createElement(
357
377
  import_antd.Form.Item,
358
378
  {
359
379
  label: import_utils.locales.getText("pisell2.text.price"),
360
- name: "price",
380
+ name: "total",
361
381
  rules: [{ required: true }]
362
382
  },
363
383
  /* @__PURE__ */ import_react.default.createElement(
@@ -369,8 +389,8 @@ var Info = () => {
369
389
  precision: 2,
370
390
  style: { width: "100%" },
371
391
  min: 0,
372
- max: ((_f = state.service.cacheItem) == null ? void 0 : _f.price) || 0,
373
- placeholder: ((_g = state.service.cacheItem) == null ? void 0 : _g.price) || "0"
392
+ max: ((_k = (_j = state.service.cacheItem) == null ? void 0 : _j._extend) == null ? void 0 : _k.origin_total) || 0,
393
+ placeholder: ((_m = (_l = state.service.cacheItem) == null ? void 0 : _l._extend) == null ? void 0 : _m.origin_total) || "0"
374
394
  }
375
395
  )
376
396
  )), /* @__PURE__ */ import_react.default.createElement(import_antd.Col, { span: 12 }, /* @__PURE__ */ import_react.default.createElement(
@@ -388,7 +408,7 @@ var Info = () => {
388
408
  allowClear: isDiscount,
389
409
  onChange: (e) => {
390
410
  form.setFieldsValue({
391
- price: state.service.cacheItem.price
411
+ total: state.service.cacheItem._extend.origin_total
392
412
  });
393
413
  }
394
414
  }
@@ -84,4 +84,25 @@
84
84
  .like-resource {}
85
85
  }
86
86
 
87
+ }
88
+
89
+ .current-service-info {
90
+ min-height: 40px;
91
+ cursor: pointer;
92
+ background-color: #ffffff;
93
+ border: 1px solid #D0D5DD;
94
+ border-radius: 10px;
95
+ transition: all 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);
96
+ overflow: hidden;
97
+ padding: 11px;
98
+
99
+ .current-service-info-name {
100
+ font-size: 16px;
101
+ color: #101828;
102
+ font-weight: 650;
103
+ }
104
+
105
+ &:hover {
106
+ border-color: #7f56d9;
107
+ }
87
108
  }
@@ -1,4 +1,4 @@
1
1
  import React from "react";
2
2
  import "./index.less";
3
- declare const Info: () => React.JSX.Element;
4
- export default Info;
3
+ declare const Service: () => React.JSX.Element;
4
+ export default Service;
@@ -33,122 +33,14 @@ __export(service_exports, {
33
33
  });
34
34
  module.exports = __toCommonJS(service_exports);
35
35
  var import_react = __toESM(require("react"));
36
- var import_model = require("../model");
37
- var import_utils = require("@pisell/utils");
38
36
  var import_addService = __toESM(require("./addService"));
39
37
  var import_editService = __toESM(require("./editService"));
40
- var import_antd = require("antd");
41
38
  var import_index = require("./index.less");
42
- var import_mock = require("../../mock");
43
- var import_utils2 = require("../../utils");
44
- var import_like = __toESM(require("./like"));
45
- var Info = () => {
46
- const { state, dispatch } = (0, import_react.useContext)(import_model.Context);
47
- const errorTypes = {
48
- product: import_utils.locales.getText("pisell2.text.status.service-error-1"),
49
- time: import_utils.locales.getText("pisell2.text.status.service-error-2"),
50
- maxLimit: import_utils.locales.getText("pisell2.text.status.service-error-3")
51
- };
52
- const handleEditService = (item) => {
53
- if (state.disabledEdit) {
54
- return;
55
- }
56
- dispatch({
57
- type: "setService",
58
- payload: {
59
- editModal: true,
60
- cacheItem: { ...item, new: 0 }
61
- }
62
- });
63
- };
64
- const getResourceItem = (0, import_react.useCallback)(
65
- (id) => {
66
- if (id === 0) {
67
- return (0, import_mock.getNoResource)();
68
- }
69
- return state.service.resources.find((d) => d.form_record_id === id);
70
- },
71
- [state.service.resources]
72
- );
73
- const getErrorMessage = (0, import_react.useCallback)((service, resourceItem) => {
74
- const errorList = (0, import_utils2.getErrorList)(resourceItem, service);
75
- let errorMessage = "";
76
- if (!service.id) {
77
- return errorList[0].label;
78
- }
79
- if (errorList.length) {
80
- if (errorList.length > 1) {
81
- errorMessage = `${errorList.length} ${import_utils.locales.getText(
82
- "pisell2.text.warnings"
83
- )}`;
84
- } else {
85
- errorMessage = (resourceItem == null ? void 0 : resourceItem.labelText) + " " + errorTypes[errorList[0].type];
86
- }
87
- }
88
- return errorMessage;
89
- }, []);
90
- const handleLike = (status, item) => {
91
- if (state.disabledEdit) {
92
- return;
93
- }
94
- let _list = [...state.service.value];
95
- let _id = item == null ? void 0 : item._id;
96
- _list = _list.map(
97
- (d) => d._id === _id ? {
98
- ...d,
99
- _extend: {
100
- ...d._extend,
101
- like_status: status
102
- }
103
- } : d
104
- );
105
- dispatch({
106
- type: "setService",
107
- payload: {
108
- value: _list,
109
- edit: true
110
- }
111
- });
112
- };
39
+ var import_serviceList = __toESM(require("./serviceList"));
40
+ var Service = () => {
113
41
  (0, import_react.useEffect)(() => {
114
42
  document.body.id = "body";
115
43
  }, []);
116
- return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-service-wrap" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "" }, state.service.value.map((d) => {
117
- var _a, _b, _c, _d, _e;
118
- const resourceItem = getResourceItem((_a = d._extend) == null ? void 0 : _a.resource);
119
- let errorMessage = getErrorMessage(d, resourceItem);
120
- let resourceName = (resourceItem == null ? void 0 : resourceItem.labelText) || d.relation_form_name;
121
- return /* @__PURE__ */ import_react.default.createElement(
122
- "div",
123
- {
124
- key: d._id,
125
- className: "pisell-lowcode__booking-service-item",
126
- onClick: () => {
127
- handleEditService(d);
128
- }
129
- },
130
- d.id ? /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-service-item-title" }, d.title) : null,
131
- d._extend ? /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, state.renderType !== "eventBooking" && /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-service-item-date" }, (0, import_utils2.getServiceTime)(d, state.date.value)), /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-service-item-technician" }, d._extend.resource ? /* @__PURE__ */ import_react.default.createElement(
132
- import_like.default,
133
- {
134
- style: { marginRight: 4 },
135
- status: d._extend.like_status,
136
- onChange: (e) => {
137
- handleLike(e, d);
138
- }
139
- }
140
- ) : null, resourceName)) : null,
141
- d.id ? /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-service-item-price-wrap" }, /* @__PURE__ */ import_react.default.createElement("span", { className: "pisell-lowcode__booking-service-item-price" }, (0, import_utils.formatAmount)((_b = d._extend) == null ? void 0 : _b.price, 2, state.amountSymbol)), Number((_c = d._extend) == null ? void 0 : _c.price) != Number(d.price) ? /* @__PURE__ */ import_react.default.createElement("span", { className: "pisell-lowcode__booking-service-item-original-price" }, (0, import_utils.formatAmount)(d.price, 2, state.amountSymbol)) : null), ((_d = d._extend) == null ? void 0 : _d.discount_reason) ? /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-service-item-discount-reason" }, /* @__PURE__ */ import_react.default.createElement("span", null, import_utils.locales.getText("pisell2.text.discount-reason"), ":"), " ", (_e = d._extend) == null ? void 0 : _e.discount_reason) : null) : null,
142
- errorMessage ? /* @__PURE__ */ import_react.default.createElement(
143
- import_antd.Alert,
144
- {
145
- message: errorMessage,
146
- type: "warning",
147
- showIcon: true,
148
- className: "pisell-lowcode__booking-service-item-error"
149
- }
150
- ) : null
151
- );
152
- })), /* @__PURE__ */ import_react.default.createElement(import_addService.default, null)), /* @__PURE__ */ import_react.default.createElement(import_editService.default, null));
44
+ return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-service-wrap" }, /* @__PURE__ */ import_react.default.createElement(import_serviceList.default, null), /* @__PURE__ */ import_react.default.createElement(import_addService.default, null)), /* @__PURE__ */ import_react.default.createElement(import_editService.default, null));
153
45
  };
154
- var service_default = Info;
46
+ var service_default = Service;