@pisell/private-materials 3.0.41 → 3.0.43

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 (71) 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 +3 -3
  7. package/build/lowcode/render/default/view.js +6 -6
  8. package/build/lowcode/view.js +4 -4
  9. package/es/components/booking/addons/index.d.ts +1 -1
  10. package/es/components/booking/addons/index.js +16 -1
  11. package/es/components/booking/addons/model.d.ts +1 -2
  12. package/es/components/booking/components/TabProduct/productItem/index.js +11 -3
  13. package/es/components/booking/components/customSelect/index.d.ts +1 -0
  14. package/es/components/booking/components/customSelect/index.js +12 -3
  15. package/es/components/booking/forms/forms.d.ts +1 -1
  16. package/es/components/booking/forms/index.d.ts +1 -1
  17. package/es/components/booking/forms/index.js +19 -12
  18. package/es/components/booking/forms/model.d.ts +1 -2
  19. package/es/components/booking/index.d.ts +1 -1
  20. package/es/components/booking/info/client/index.js +3 -0
  21. package/es/components/booking/info/index.d.ts +1 -1
  22. package/es/components/booking/info/index.js +13 -5
  23. package/es/components/booking/info/model.d.ts +1 -2
  24. package/es/components/booking/info/notes/index.d.ts +1 -1
  25. package/es/components/booking/info/notes/index.js +5 -4
  26. package/es/components/booking/info/pet/index.js +16 -34
  27. package/es/components/booking/info/service/addService/index.js +82 -21
  28. package/es/components/booking/info/service/editService/index.js +28 -18
  29. package/es/components/booking/locales.d.ts +3 -0
  30. package/es/components/booking/locales.js +9 -6
  31. package/es/components/booking/model.d.ts +5 -4
  32. package/es/components/booking/notes/index.d.ts +1 -1
  33. package/es/components/booking/notes/index.js +10 -8
  34. package/es/components/booking/notes/model.d.ts +1 -2
  35. package/es/components/booking/payments/index.d.ts +1 -1
  36. package/es/components/booking/payments/model.d.ts +1 -2
  37. package/es/components/booking/utils.js +3 -3
  38. package/es/components/schedules/index.d.ts +1 -1
  39. package/es/components/schedules/model.d.ts +1 -2
  40. package/lib/components/booking/addons/index.d.ts +1 -1
  41. package/lib/components/booking/addons/index.js +14 -0
  42. package/lib/components/booking/addons/model.d.ts +1 -2
  43. package/lib/components/booking/components/TabProduct/productItem/index.js +7 -1
  44. package/lib/components/booking/components/customSelect/index.d.ts +1 -0
  45. package/lib/components/booking/components/customSelect/index.js +11 -2
  46. package/lib/components/booking/forms/forms.d.ts +1 -1
  47. package/lib/components/booking/forms/index.d.ts +1 -1
  48. package/lib/components/booking/forms/index.js +10 -4
  49. package/lib/components/booking/forms/model.d.ts +1 -2
  50. package/lib/components/booking/index.d.ts +1 -1
  51. package/lib/components/booking/info/client/index.js +3 -0
  52. package/lib/components/booking/info/index.d.ts +1 -1
  53. package/lib/components/booking/info/index.js +4 -2
  54. package/lib/components/booking/info/model.d.ts +1 -2
  55. package/lib/components/booking/info/notes/index.d.ts +1 -1
  56. package/lib/components/booking/info/notes/index.js +2 -1
  57. package/lib/components/booking/info/pet/index.js +10 -9
  58. package/lib/components/booking/info/service/addService/index.js +28 -9
  59. package/lib/components/booking/info/service/editService/index.js +20 -8
  60. package/lib/components/booking/locales.d.ts +3 -0
  61. package/lib/components/booking/locales.js +9 -6
  62. package/lib/components/booking/model.d.ts +5 -4
  63. package/lib/components/booking/notes/index.d.ts +1 -1
  64. package/lib/components/booking/notes/index.js +3 -2
  65. package/lib/components/booking/notes/model.d.ts +1 -2
  66. package/lib/components/booking/payments/index.d.ts +1 -1
  67. package/lib/components/booking/payments/model.d.ts +1 -2
  68. package/lib/components/booking/utils.js +3 -3
  69. package/lib/components/schedules/index.d.ts +1 -1
  70. package/lib/components/schedules/model.d.ts +1 -2
  71. package/package.json +3 -3
@@ -17,21 +17,27 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
17
17
  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; }
18
18
  function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
19
19
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
20
- import React, { useContext, useEffect, useMemo, useState } from "react";
20
+ import React, { useContext, useEffect, useMemo, useState, useRef } from "react";
21
21
  import SearchLg from "@pisell/icon/es/SearchLg";
22
22
  import Drawer from "../../../components/drawer";
23
23
  import TabProduct from "../../../components/TabProduct";
24
24
  import { Context } from "../../model";
25
25
  import AddButton from "../../../components/addButton";
26
- import { Input } from "antd";
26
+ import { Input, Skeleton } from "antd";
27
27
  import "./index.less";
28
28
  import useEngineContext from "../../../../../hooks/useEngineContext";
29
29
  import { getProductDetail } from "../serve";
30
30
  import { getIsBundleOrCombination } from "../../utils";
31
- import { formatProductListByCategory, getProductTotalPrice, request } from "../../../utils";
31
+ import { formatProductListByCategory, getProductTotalPrice, request, getCacheParams, deleteCacheParams } from "../../../utils";
32
32
  import { locales, getUniqueId } from "@pisell/utils";
33
+ var getCacheResourceId = function getCacheResourceId() {
34
+ var serviceParams = getCacheParams();
35
+ var resId = Number(serviceParams === null || serviceParams === void 0 ? void 0 : serviceParams.resource_id);
36
+ console.log("resIdresIdresId", resId);
37
+ return resId;
38
+ };
33
39
  var Info = function Info() {
34
- var _state$service2;
40
+ var _state$service2, _state$service3, _state$service3$cache;
35
41
  var _useState = useState(""),
36
42
  _useState2 = _slicedToArray(_useState, 2),
37
43
  search = _useState2[0],
@@ -43,8 +49,18 @@ var Info = function Info() {
43
49
  _useState4 = _slicedToArray(_useState3, 2),
44
50
  loading = _useState4[0],
45
51
  setLoading = _useState4[1];
52
+ var searchRef = useRef();
46
53
  var context = useEngineContext();
47
54
  request.setRequest(context.appHelper.utils.request);
55
+
56
+ /**
57
+ * @title: 如果商品只有一个, 则自动设置默认商品
58
+ * @description:
59
+ * @param {any} list
60
+ * @return {*}
61
+ * @Author: zhiwei.Wang
62
+ * @Date: 2024-05-14 13:55
63
+ */
48
64
  var setDefaultService = /*#__PURE__*/function () {
49
65
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(list) {
50
66
  var _list, product, detail, isBundleOrCombination, _item;
@@ -129,24 +145,48 @@ var Info = function Info() {
129
145
  return _ref.apply(this, arguments);
130
146
  };
131
147
  }();
148
+
149
+ /**
150
+ * @title: 如果选择了资源, 则直接添加商品
151
+ * @description:
152
+ * @param {any} cacheItem
153
+ * @return {*}
154
+ * @Author: zhiwei.Wang
155
+ * @Date: 2024-05-14 14:02
156
+ */
157
+ var autoAddProduct = /*#__PURE__*/function () {
158
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(cacheItem) {
159
+ var resId, _cacheItem;
160
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
161
+ while (1) switch (_context2.prev = _context2.next) {
162
+ case 0:
163
+ resId = getCacheResourceId();
164
+ _cacheItem = _objectSpread({}, cacheItem);
165
+ deleteCacheParams();
166
+ case 3:
167
+ case "end":
168
+ return _context2.stop();
169
+ }
170
+ }, _callee2);
171
+ }));
172
+ return function autoAddProduct(_x3) {
173
+ return _ref2.apply(this, arguments);
174
+ };
175
+ }();
132
176
  var getServices = /*#__PURE__*/function () {
133
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
177
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
134
178
  var _state$eventOtherPara;
135
179
  var data;
136
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
137
- while (1) switch (_context2.prev = _context2.next) {
180
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
181
+ while (1) switch (_context3.prev = _context3.next) {
138
182
  case 0:
139
183
  setLoading(true);
140
- _context2.next = 3;
184
+ _context3.next = 3;
141
185
  return state.apis.getServices({
142
186
  skip: 1,
143
187
  num: 500,
144
188
  extension_type: state.renderType === "eventBooking" ? undefined : ["product_appointment", "appointment_ticket"],
145
189
  with: ["category"],
146
- // include_formula: "no",
147
- // include_bundle: "no",
148
- // include_option: "no",
149
- // include_variant: "no",
150
190
  ids: state.renderType === "eventBooking" ? (_state$eventOtherPara = state.eventOtherParams) === null || _state$eventOtherPara === void 0 ? void 0 : _state$eventOtherPara.productIds : undefined,
151
191
  open_quotation: 1,
152
192
  with_schedule: 1,
@@ -156,7 +196,7 @@ var Info = function Info() {
156
196
  }
157
197
  });
158
198
  case 3:
159
- data = _context2.sent;
199
+ data = _context3.sent;
160
200
  setLoading(false);
161
201
  setDefaultService(data === null || data === void 0 ? void 0 : data.list);
162
202
  dispatch({
@@ -167,12 +207,12 @@ var Info = function Info() {
167
207
  });
168
208
  case 7:
169
209
  case "end":
170
- return _context2.stop();
210
+ return _context3.stop();
171
211
  }
172
- }, _callee2);
212
+ }, _callee3);
173
213
  }));
174
214
  return function getServices() {
175
- return _ref2.apply(this, arguments);
215
+ return _ref3.apply(this, arguments);
176
216
  };
177
217
  }();
178
218
  var handleSelectService = function handleSelectService() {
@@ -184,6 +224,12 @@ var Info = function Info() {
184
224
  addModal: true
185
225
  }
186
226
  });
227
+ if (!state.isTerminal) {
228
+ setTimeout(function () {
229
+ var _searchRef$current, _searchRef$current$fo;
230
+ (_searchRef$current = searchRef.current) === null || _searchRef$current === void 0 ? void 0 : (_searchRef$current$fo = _searchRef$current.focus) === null || _searchRef$current$fo === void 0 ? void 0 : _searchRef$current$fo.call(_searchRef$current);
231
+ }, 100);
232
+ }
187
233
  };
188
234
  var handleSelectProduct = function handleSelectProduct(item, type) {
189
235
  // 是否有单规格 组合规格 套餐, 如果没有不需要打开弹窗
@@ -227,11 +273,20 @@ var Info = function Info() {
227
273
  cacheItem.new = 0;
228
274
  }
229
275
  console.log("_total", cacheItem);
276
+
277
+ // 如果已经有资源id,则不跳转详情页, 直接返回
278
+ // if (getCacheResourceId()) {
279
+ // autoAddProduct(cacheItem);
280
+ // return;
281
+ // }
282
+ var resId = getCacheResourceId();
283
+ cacheItem.autoClose = !!resId;
230
284
  dispatch({
231
285
  type: "setService",
232
286
  payload: {
233
287
  editModal: true,
234
- cacheItem: cacheItem
288
+ cacheItem: cacheItem,
289
+ addModal: !cacheItem.autoClose
235
290
  }
236
291
  });
237
292
  }
@@ -251,10 +306,11 @@ var Info = function Info() {
251
306
  return state.service.value.length > 0;
252
307
  }, [state.service.value]);
253
308
  useEffect(function () {
254
- if (state.modalOpen) {
255
- // getServices();
309
+ // 如果弹窗打开,并且是创建, 则自动打开选择服务的弹窗
310
+ if (state.modalOpen && !state.bookingId) {
311
+ handleSelectService();
256
312
  }
257
- }, [state.modalOpen]);
313
+ }, [state.modalOpen, state.bookingId]);
258
314
  var showAddButton = useMemo(function () {
259
315
  return !state.disabledEdit && !state.channelDisabledEdit;
260
316
  }, [state.disabledEdit, state.channelDisabledEdit]);
@@ -283,7 +339,11 @@ var Info = function Info() {
283
339
  }
284
340
  });
285
341
  }, [state.renderType, showAddButton, isService, state.service.value, loading]);
286
- return /*#__PURE__*/React.createElement(React.Fragment, null, addButton, /*#__PURE__*/React.createElement(Drawer, {
342
+ return /*#__PURE__*/React.createElement(React.Fragment, null, ((_state$service3 = state.service) === null || _state$service3 === void 0 ? void 0 : (_state$service3$cache = _state$service3.cacheItem) === null || _state$service3$cache === void 0 ? void 0 : _state$service3$cache.autoClose) && /*#__PURE__*/React.createElement(Skeleton, {
343
+ loading: true,
344
+ active: true,
345
+ round: true
346
+ }), addButton, /*#__PURE__*/React.createElement(Drawer, {
287
347
  open: state.service.addModal,
288
348
  title: locales.getText("pisell2.text.select-service"),
289
349
  rootClassName: "booking-server-wrap",
@@ -298,6 +358,7 @@ var Info = function Info() {
298
358
  header: /*#__PURE__*/React.createElement("div", {
299
359
  className: "pisell-lowcode__booking-service-header"
300
360
  }, /*#__PURE__*/React.createElement(Input, {
361
+ ref: searchRef,
301
362
  prefix: /*#__PURE__*/React.createElement(SearchLg, null),
302
363
  style: {
303
364
  marginTop: 16,
@@ -35,7 +35,7 @@ import { sliceDayIntoFiveMinutes, formatResource, getErrorList, getServiceTimes,
35
35
  import Like from "../like";
36
36
  import { getNoResource } from "../../../mock";
37
37
  var Info = function Info() {
38
- var _state$bookingConfig2, _state$bookingConfig3, _state$bookingConfig4, _state$service3, _state$service3$cache, _state$service5, _state$service5$cache, _state$service5$cache2, _state$service5$cache3, _state$service6, _state$service6$cache, _state$service6$cache2, _state$service$cacheI4, _state$service$cacheI5, _state$service$cacheI6, _state$service$cacheI7;
38
+ var _state$bookingConfig2, _state$bookingConfig3, _state$bookingConfig4, _state$service3, _state$service3$cache, _state$service5, _state$service5$cache, _state$service5$cache2, _state$service5$cache3, _state$service$cacheI5, _state$service6, _state$service6$cache, _state$service6$cache2, _state$service$cacheI6, _state$service$cacheI7, _state$service$cacheI8, _state$service$cacheI9;
39
39
  var _Form$useForm = Form.useForm(),
40
40
  _Form$useForm2 = _slicedToArray(_Form$useForm, 1),
41
41
  form = _Form$useForm2[0];
@@ -252,7 +252,7 @@ var Info = function Info() {
252
252
  } else {
253
253
  // 如果只有一个资源,并且当前未选择, 则默认选中
254
254
  _useResource = 0;
255
- if (_list.length === 2) {
255
+ if (_list.length === 2 && useResource !== 0) {
256
256
  _useResource = _list[1].form_record_id;
257
257
  }
258
258
  form.setFieldsValue({
@@ -265,18 +265,25 @@ var Info = function Info() {
265
265
  resources: _list
266
266
  }
267
267
  });
268
- _context.next = 17;
268
+ setTimeout(function () {
269
+ var _state$service$cacheI;
270
+ // 当选中资源 或者 列表只有无资源的时候 那么直接返回
271
+ if ((_state$service$cacheI = state.service.cacheItem) !== null && _state$service$cacheI !== void 0 && _state$service$cacheI.autoClose || _list.length === 1 && useResource === 0) {
272
+ form.submit();
273
+ }
274
+ }, 200);
275
+ _context.next = 18;
269
276
  break;
270
- case 15:
271
- _context.prev = 15;
277
+ case 16:
278
+ _context.prev = 16;
272
279
  _context.t0 = _context["catch"](0);
273
- case 17:
274
- setResourceLoading(false);
275
280
  case 18:
281
+ setResourceLoading(false);
282
+ case 19:
276
283
  case "end":
277
284
  return _context.stop();
278
285
  }
279
- }, _callee, null, [[0, 15]]);
286
+ }, _callee, null, [[0, 16]]);
280
287
  }));
281
288
  return function getResources(_x2) {
282
289
  return _ref.apply(this, arguments);
@@ -291,12 +298,12 @@ var Info = function Info() {
291
298
  * @Date: 2024-01-09 13:59
292
299
  */
293
300
  var handleDeleteProduct = function handleDeleteProduct() {
294
- var _state$service$cacheI;
301
+ var _state$service$cacheI2;
295
302
  if (state.channelDisabledEdit) {
296
303
  return;
297
304
  }
298
305
  var _list = _toConsumableArray(state.service.value);
299
- var _id = (_state$service$cacheI = state.service.cacheItem) === null || _state$service$cacheI === void 0 ? void 0 : _state$service$cacheI._id;
306
+ var _id = (_state$service$cacheI2 = state.service.cacheItem) === null || _state$service$cacheI2 === void 0 ? void 0 : _state$service$cacheI2._id;
300
307
  _list = _list.filter(function (d) {
301
308
  return d._id !== _id;
302
309
  });
@@ -377,8 +384,8 @@ var Info = function Info() {
377
384
  * @Date: 2024-01-09 14:03
378
385
  */
379
386
  var getDiscount = function getDiscount() {
380
- var _state$service$cacheI2;
381
- var oPrice = Number(((_state$service$cacheI2 = state.service.cacheItem) === null || _state$service$cacheI2 === void 0 ? void 0 : _state$service$cacheI2._extend.origin_total) || 0);
387
+ var _state$service$cacheI3;
388
+ var oPrice = Number(((_state$service$cacheI3 = state.service.cacheItem) === null || _state$service$cacheI3 === void 0 ? void 0 : _state$service$cacheI3._extend.origin_total) || 0);
382
389
  var cPrice = Number(useTotal || 0);
383
390
  var discount = "";
384
391
  // 原价 = 现价 为无折扣
@@ -410,6 +417,7 @@ var Info = function Info() {
410
417
  var _currentResource$_ext2;
411
418
  var _list = _toConsumableArray(state.service.value);
412
419
  var _item = _objectSpread(_objectSpread({}, state.service.cacheItem), {}, {
420
+ autoClose: false,
413
421
  errorList: errorList
414
422
  });
415
423
  var _extend = _objectSpread(_objectSpread({}, _item._extend), values);
@@ -460,7 +468,8 @@ var Info = function Info() {
460
468
  var setEditData = useMemoizedFn(function () {
461
469
  if (state.service.editModal) {
462
470
  var cacheItem = state.service.cacheItem;
463
- form.setFieldsValue(getServerItemExtend(state, cacheItem, timeObj));
471
+ var values = getServerItemExtend(state, cacheItem, timeObj);
472
+ form.setFieldsValue(values);
464
473
  if (state.renderType !== "eventBooking") {
465
474
  // 获取资源列表
466
475
  getResources();
@@ -479,8 +488,8 @@ var Info = function Info() {
479
488
  * @Date: 2024-01-09 14:06
480
489
  */
481
490
  var isReason = useMemo(function () {
482
- var _state$service$cacheI3;
483
- var oPrice = Number(((_state$service$cacheI3 = state.service.cacheItem) === null || _state$service$cacheI3 === void 0 ? void 0 : _state$service$cacheI3._extend.origin_total) || 0);
491
+ var _state$service$cacheI4;
492
+ var oPrice = Number(((_state$service$cacheI4 = state.service.cacheItem) === null || _state$service$cacheI4 === void 0 ? void 0 : _state$service$cacheI4._extend.origin_total) || 0);
484
493
  var cPrice = Number(useTotal || 0);
485
494
  // 原价 !== 现价
486
495
  return cPrice !== oPrice;
@@ -565,7 +574,8 @@ var Info = function Info() {
565
574
  }, [(_state$service5 = state.service) === null || _state$service5 === void 0 ? void 0 : (_state$service5$cache = _state$service5.cacheItem) === null || _state$service5$cache === void 0 ? void 0 : (_state$service5$cache2 = _state$service5$cache._extend) === null || _state$service5$cache2 === void 0 ? void 0 : (_state$service5$cache3 = _state$service5$cache2.other) === null || _state$service5$cache3 === void 0 ? void 0 : _state$service5$cache3.bundle]);
566
575
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Drawer, {
567
576
  zIndex: 1000,
568
- open: state.service.editModal,
577
+ forceRender: true,
578
+ open: state.service.editModal && !((_state$service$cacheI5 = state.service.cacheItem) !== null && _state$service$cacheI5 !== void 0 && _state$service$cacheI5.autoClose),
569
579
  title: locales.getText("pisell2.text.edit-service"),
570
580
  onClose: function onClose() {
571
581
  dispatch({
@@ -632,8 +642,8 @@ var Info = function Info() {
632
642
  width: "100%"
633
643
  },
634
644
  min: 0,
635
- max: ((_state$service$cacheI4 = state.service.cacheItem) === null || _state$service$cacheI4 === void 0 ? void 0 : (_state$service$cacheI5 = _state$service$cacheI4._extend) === null || _state$service$cacheI5 === void 0 ? void 0 : _state$service$cacheI5.origin_total) || 0,
636
- placeholder: ((_state$service$cacheI6 = state.service.cacheItem) === null || _state$service$cacheI6 === void 0 ? void 0 : (_state$service$cacheI7 = _state$service$cacheI6._extend) === null || _state$service$cacheI7 === void 0 ? void 0 : _state$service$cacheI7.origin_total) || "0"
645
+ max: ((_state$service$cacheI6 = state.service.cacheItem) === null || _state$service$cacheI6 === void 0 ? void 0 : (_state$service$cacheI7 = _state$service$cacheI6._extend) === null || _state$service$cacheI7 === void 0 ? void 0 : _state$service$cacheI7.origin_total) || 0,
646
+ placeholder: ((_state$service$cacheI8 = state.service.cacheItem) === null || _state$service$cacheI8 === void 0 ? void 0 : (_state$service$cacheI9 = _state$service$cacheI8._extend) === null || _state$service$cacheI9 === void 0 ? void 0 : _state$service$cacheI9.origin_total) || "0"
637
647
  }))), /*#__PURE__*/React.createElement(Col, {
638
648
  span: 12
639
649
  }, /*#__PURE__*/React.createElement(Form.Item, {
@@ -141,6 +141,7 @@ declare const _default: {
141
141
  'pisell2.text.deposit-delete-message-title': string;
142
142
  'pisell2.text.deposit-delete-message': string;
143
143
  'pisell2.text.deposit-paid': string;
144
+ "pisell2.text.stock": string;
144
145
  };
145
146
  'zh-CN': {
146
147
  'pisell2.text.refunded-amount': string;
@@ -284,6 +285,7 @@ declare const _default: {
284
285
  'pisell2.text.deposit-delete-message-title': string;
285
286
  'pisell2.text.deposit-delete-message': string;
286
287
  'pisell2.text.deposit-paid': string;
288
+ "pisell2.text.stock": string;
287
289
  };
288
290
  'zh-HK': {
289
291
  'pisell2.text.refunded-amount': string;
@@ -427,6 +429,7 @@ declare const _default: {
427
429
  'pisell2.text.deposit-delete-message-title': string;
428
430
  'pisell2.text.deposit-delete-message': string;
429
431
  'pisell2.text.deposit-paid': string;
432
+ "pisell2.text.stock": string;
430
433
  };
431
434
  };
432
435
  export default _default;
@@ -1,7 +1,7 @@
1
1
  export default {
2
2
  "en": {
3
3
  'pisell2.text.select-addons': "Select addons",
4
- 'pisell2.text.addons': "Addons",
4
+ 'pisell2.text.addons': "Sales",
5
5
  'pisell2.text.search': 'Search',
6
6
  'pisell2.text.view': 'View',
7
7
  'pisell2.text.edit': 'Edit',
@@ -155,7 +155,8 @@ export default {
155
155
  'pisell2.text.deposit-delete': "Delete deposit",
156
156
  'pisell2.text.deposit-delete-message-title': "Prompt",
157
157
  'pisell2.text.deposit-delete-message': "It cannot be restored after deletion. Please confirm the operation.",
158
- 'pisell2.text.deposit-paid': "Deposit paid"
158
+ 'pisell2.text.deposit-paid': "Deposit paid",
159
+ "pisell2.text.stock": "Stock"
159
160
  },
160
161
  'zh-CN': {
161
162
  'pisell2.text.refunded-amount': '已退金额',
@@ -163,7 +164,7 @@ export default {
163
164
  'pisell2.text.amount-paid-on-order': '订单已付金额',
164
165
  'pisell2.text.please-select-the-customer-first': '请先选择客户',
165
166
  'pisell2.text.change': "更改",
166
- 'pisell2.text.addons': "附加商品",
167
+ 'pisell2.text.addons': "销售",
167
168
  'pisell2.text.select-addons': "选择附加商品",
168
169
  'pisell2.text.search': '搜索',
169
170
  'pisell2.text.view': '查看',
@@ -318,7 +319,8 @@ export default {
318
319
  'pisell2.text.deposit-delete': "删除定金",
319
320
  'pisell2.text.deposit-delete-message-title': "提示",
320
321
  'pisell2.text.deposit-delete-message': "删除后不可恢复,请确认操作",
321
- 'pisell2.text.deposit-paid': "已付定金"
322
+ 'pisell2.text.deposit-paid': "已付定金",
323
+ "pisell2.text.stock": "库存"
322
324
  },
323
325
  'zh-HK': {
324
326
  'pisell2.text.refunded-amount': '已退金額',
@@ -326,7 +328,7 @@ export default {
326
328
  'pisell2.text.amount-paid-on-order': '訂單已付金額',
327
329
  'pisell2.text.please-select-the-customer-first': '請先選擇客戶',
328
330
  'pisell2.text.change': '更改',
329
- 'pisell2.text.addons': "附加商品",
331
+ 'pisell2.text.addons': "销售",
330
332
  'pisell2.text.select-addons': "選擇附加商品",
331
333
  'pisell2.text.search': '搜索',
332
334
  'pisell2.text.view': '查看',
@@ -481,6 +483,7 @@ export default {
481
483
  'pisell2.text.deposit-delete': "刪除定金",
482
484
  'pisell2.text.deposit-delete-message-title': "提示",
483
485
  'pisell2.text.deposit-delete-message': "刪除後不可恢復,請確認操作",
484
- 'pisell2.text.deposit-paid': "已付定金"
486
+ 'pisell2.text.deposit-paid': "已付定金",
487
+ "pisell2.text.stock": "庫存"
485
488
  }
486
489
  };
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export interface FormState {
3
2
  amountSymbol: string;
4
3
  apis: {
@@ -71,11 +70,13 @@ export interface FormState {
71
70
  bookingId: string | number;
72
71
  bookingDetail: any;
73
72
  channelDisabledEdit: boolean;
74
- renderType?: 'eventBooking';
73
+ renderType?: "eventBooking";
74
+ modalOpen?: boolean;
75
+ isTerminal?: boolean;
75
76
  eventOtherParams?: {
76
77
  relation_id: number;
77
78
  number: number;
78
- registration_type: 'single' | 'all' | 'extra_include';
79
+ registration_type: "single" | "all" | "extra_include";
79
80
  start_date: string;
80
81
  start_time: string;
81
82
  end_date: string;
@@ -87,7 +88,7 @@ export declare const walkInData: {
87
88
  id: number;
88
89
  nickname: string;
89
90
  };
90
- export declare const Provider: (ComponentUi: any) => (props: any) => any, Context: import("react").Context<{
91
+ export declare const Provider: (ComponentUi: any) => (props: any) => JSX.Element, Context: import("react").Context<{
91
92
  state: FormState;
92
93
  } & {
93
94
  dispatch: (params: {
@@ -4,5 +4,5 @@ export interface InfoProps {
4
4
  globalState: any;
5
5
  setGlobalState: any;
6
6
  }
7
- declare const Notes: (props: any) => any;
7
+ declare const Notes: (props: any) => JSX.Element;
8
8
  export default Notes;
@@ -25,7 +25,7 @@ import EmptyBooking from "../components/emptyBooking";
25
25
  import "./index.less";
26
26
  import { locales } from "@pisell/utils";
27
27
  var Notes = Provider(function (props) {
28
- var _modal$state4, _modal$state4$notes, _modal$state5, _modal$state$bookingD3, _modal$state$bookingD4;
28
+ var _modal$state5, _modal$state5$notes, _modal$state6, _modal$state$bookingD3, _modal$state$bookingD4;
29
29
  var globalState = props.globalState;
30
30
  var modal = useContext(Context);
31
31
  var _useState = useState(false),
@@ -82,12 +82,14 @@ var Notes = Provider(function (props) {
82
82
  });
83
83
  }, [globalState]);
84
84
  var noteChange = function noteChange(_ref2) {
85
+ var _modal$state, _modal$state$refreshD;
85
86
  var note = _ref2.note,
86
87
  status = _ref2.status,
87
88
  noteType = _ref2.noteType;
89
+ (_modal$state = modal.state) === null || _modal$state === void 0 ? void 0 : (_modal$state$refreshD = _modal$state.refreshData) === null || _modal$state$refreshD === void 0 ? void 0 : _modal$state$refreshD.call(_modal$state, {});
88
90
  if (noteType === "internal") {
89
- var _modal$state;
90
- var _list = _toConsumableArray((_modal$state = modal.state) === null || _modal$state === void 0 ? void 0 : _modal$state.notes.internalNotes);
91
+ var _modal$state2;
92
+ var _list = _toConsumableArray((_modal$state2 = modal.state) === null || _modal$state2 === void 0 ? void 0 : _modal$state2.notes.internalNotes);
91
93
  if (status == "add") {
92
94
  _list.push(note);
93
95
  }
@@ -131,15 +133,15 @@ var Notes = Provider(function (props) {
131
133
  }];
132
134
  }, [modal.state.bookingDetail]);
133
135
  var orderNote = useMemo(function () {
134
- var _modal$state2, _modal$state2$notes, _modal$state3, _modal$state3$notes;
135
- if (!((_modal$state2 = modal.state) !== null && _modal$state2 !== void 0 && (_modal$state2$notes = _modal$state2.notes) !== null && _modal$state2$notes !== void 0 && _modal$state2$notes.orderNote)) {
136
+ var _modal$state3, _modal$state3$notes, _modal$state4, _modal$state4$notes;
137
+ if (!((_modal$state3 = modal.state) !== null && _modal$state3 !== void 0 && (_modal$state3$notes = _modal$state3.notes) !== null && _modal$state3$notes !== void 0 && _modal$state3$notes.orderNote)) {
136
138
  return [];
137
139
  }
138
140
  return [{
139
141
  id: 0,
140
- content: ((_modal$state3 = modal.state) === null || _modal$state3 === void 0 ? void 0 : (_modal$state3$notes = _modal$state3.notes) === null || _modal$state3$notes === void 0 ? void 0 : _modal$state3$notes.orderNote) || ""
142
+ content: ((_modal$state4 = modal.state) === null || _modal$state4 === void 0 ? void 0 : (_modal$state4$notes = _modal$state4.notes) === null || _modal$state4$notes === void 0 ? void 0 : _modal$state4$notes.orderNote) || ""
141
143
  }];
142
- }, [(_modal$state4 = modal.state) === null || _modal$state4 === void 0 ? void 0 : (_modal$state4$notes = _modal$state4.notes) === null || _modal$state4$notes === void 0 ? void 0 : _modal$state4$notes.orderNote]);
144
+ }, [(_modal$state5 = modal.state) === null || _modal$state5 === void 0 ? void 0 : (_modal$state5$notes = _modal$state5.notes) === null || _modal$state5$notes === void 0 ? void 0 : _modal$state5$notes.orderNote]);
143
145
  return /*#__PURE__*/React.createElement(React.Fragment, null, !!modal.state.setGlobalState && /*#__PURE__*/React.createElement(TabPane, {
144
146
  header: locales.getText("pisell2.text.notes")
145
147
  }, !globalState.bookingId ? /*#__PURE__*/React.createElement(EmptyBooking, null) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(NoteBlock, {
@@ -172,7 +174,7 @@ var Notes = Provider(function (props) {
172
174
  title: "".concat(locales.getText("pisell2.text.status.internal-notes"), ":"),
173
175
  describe: locales.getText("pisell2.text.status.visible-only-to-your-team-members"),
174
176
  placeholder: locales.getText("pisell2.text.add-internal-notes"),
175
- notes: ((_modal$state5 = modal.state) === null || _modal$state5 === void 0 ? void 0 : _modal$state5.notes.internalNotes) || [],
177
+ notes: ((_modal$state6 = modal.state) === null || _modal$state6 === void 0 ? void 0 : _modal$state6.notes.internalNotes) || [],
176
178
  isEdit: true,
177
179
  apis: modal.state.apis,
178
180
  bookingId: (_modal$state$bookingD3 = modal.state.bookingDetail) === null || _modal$state$bookingD3 === void 0 ? void 0 : (_modal$state$bookingD4 = _modal$state$bookingD3.bookings) === null || _modal$state$bookingD4 === void 0 ? void 0 : _modal$state$bookingD4.id,
@@ -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: {
@@ -5,5 +5,5 @@ export interface InfoProps {
5
5
  globalState: any;
6
6
  setGlobalState: any;
7
7
  }
8
- declare const Payments: (props: any) => any;
8
+ declare const Payments: (props: any) => JSX.Element;
9
9
  export default Payments;
@@ -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: {
@@ -564,9 +564,9 @@ export var getServerItemExtend = function getServerItemExtend(state, cacheItem,
564
564
  findNextSliceProps.date = dayjs(str).format('HH:mm');
565
565
  }
566
566
  // 选中资源
567
- var resourceId = serviceParams.resource_id;
568
- if (resourceId) {
569
- _extend.resource = Number(resourceId);
567
+ var resourceId = Number(serviceParams.resource_id);
568
+ if (resourceId || resourceId === 0) {
569
+ _extend.resource = resourceId;
570
570
  }
571
571
  }
572
572
  console.log("_extend", findNextSliceProps);
@@ -1,3 +1,3 @@
1
1
  import "./index.less";
2
- declare const Schedules: (props: any) => any;
2
+ declare const Schedules: (props: any) => JSX.Element;
3
3
  export default Schedules;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { CalendarDataItem, ScheduleItem } from "./type";
3
2
  import dayjs from "dayjs";
4
3
  export interface FormState {
@@ -69,7 +68,7 @@ export interface FormState {
69
68
  };
70
69
  setGlobalState: Function | null;
71
70
  }
72
- export declare const Provider: (ComponentUi: any) => (props: any) => any, Context: import("react").Context<{
71
+ export declare const Provider: (ComponentUi: any) => (props: any) => JSX.Element, Context: import("react").Context<{
73
72
  state: FormState;
74
73
  } & {
75
74
  dispatch: (params: {
@@ -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;
@@ -125,6 +125,7 @@ var Addons = (0, import_model.Provider)((props) => {
125
125
  const [loading, setLoading] = (0, import_react.useState)(false);
126
126
  const [listLoading, setListLoading] = (0, import_react.useState)(false);
127
127
  const [search, setSearch] = (0, import_react.useState)("");
128
+ const searchRef = (0, import_react.useRef)();
128
129
  const context = (0, import_useEngineContext.default)();
129
130
  const { isTerminal, interaction } = ((_a = context.appHelper) == null ? void 0 : _a.utils) || {};
130
131
  (0, import_react.useEffect)(() => {
@@ -319,6 +320,12 @@ var Addons = (0, import_model.Provider)((props) => {
319
320
  showModal: true
320
321
  }
321
322
  });
323
+ if (!state.isTerminal) {
324
+ setTimeout(() => {
325
+ var _a3, _b3;
326
+ (_b3 = (_a3 = searchRef.current) == null ? void 0 : _a3.focus) == null ? void 0 : _b3.call(_a3);
327
+ }, 100);
328
+ }
322
329
  };
323
330
  const _footer = (0, import_react.useMemo)(() => {
324
331
  if (state.disabledEdit) {
@@ -348,6 +355,12 @@ var Addons = (0, import_model.Provider)((props) => {
348
355
  return /* @__PURE__ */ import_react.default.createElement(import_footer.default, { state, buttons: _footer, source: "addons" });
349
356
  }, [state, _footer]);
350
357
  const editProductDetail = (item) => {
358
+ if (state.disabledEdit) {
359
+ return;
360
+ }
361
+ if (state.channelDisabledEdit) {
362
+ return;
363
+ }
351
364
  state.action({
352
365
  type: "pisell1.handleOpenProductModal",
353
366
  data: {
@@ -433,6 +446,7 @@ var Addons = (0, import_model.Provider)((props) => {
433
446
  header: /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-service-header" }, /* @__PURE__ */ import_react.default.createElement(
434
447
  import_antd.Input,
435
448
  {
449
+ ref: searchRef,
436
450
  prefix: /* @__PURE__ */ import_react.default.createElement(import_SearchLg.default, null),
437
451
  style: { marginTop: 16, height: 44 },
438
452
  placeholder: import_utils3.locales.getText("pisell2.text.search"),
@@ -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: {
@@ -44,6 +44,12 @@ var ProductItem = ({
44
44
  style,
45
45
  className
46
46
  }) => {
47
+ const stockText = (0, import_react.useMemo)(() => {
48
+ if (item.is_track === 0) {
49
+ return false;
50
+ }
51
+ return `${item.stock_quantity} ${import_utils.locales.getText("pisell2.text.stock")}`;
52
+ }, [item.stock_quantity, item.is_track]);
47
53
  return /* @__PURE__ */ import_react.default.createElement(
48
54
  "div",
49
55
  {
@@ -66,7 +72,7 @@ var ProductItem = ({
66
72
  className: "server-product-title"
67
73
  },
68
74
  item.title
69
- ), /* @__PURE__ */ import_react.default.createElement("div", { className: "server-product-time" }, (0, import_utils2.getDiscountTime)(item.service_times)), /* @__PURE__ */ import_react.default.createElement("div", { className: "server-product-price" }, (0, import_utils.formatAmount)(item.price, 2, amountSymbol)))
75
+ ), /* @__PURE__ */ import_react.default.createElement("div", { className: "server-product-time" }, (0, import_utils2.getDiscountTime)(item.service_times)), stockText && /* @__PURE__ */ import_react.default.createElement("div", { className: "server-product-time" }, stockText), /* @__PURE__ */ import_react.default.createElement("div", { className: "server-product-price" }, (0, import_utils.formatAmount)(item.price, 2, amountSymbol)))
70
76
  );
71
77
  };
72
78
  var productItem_default = ProductItem;