@pisell/private-materials 3.0.117 → 3.0.119

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 (70) 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 +11 -11
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +10 -10
  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/index.js +48 -13
  14. package/es/components/booking/components/footer/serve.d.ts +1 -0
  15. package/es/components/booking/components/footer/serve.js +21 -0
  16. package/es/components/booking/forms/forms.d.ts +1 -1
  17. package/es/components/booking/forms/index.d.ts +1 -1
  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/index.d.ts +1 -1
  21. package/es/components/booking/info/model.js +9 -7
  22. package/es/components/booking/info/service/addService/index.d.ts +3 -1
  23. package/es/components/booking/info/service/addService/index.js +11 -7
  24. package/es/components/booking/info/service/editService/index.d.ts +5 -2
  25. package/es/components/booking/info/service/editService/index.js +152 -65
  26. package/es/components/booking/info/service/editService/index.less +15 -5
  27. package/es/components/booking/info/service/index.js +15 -2
  28. package/es/components/booking/info/service/serviceList/index.d.ts +5 -3
  29. package/es/components/booking/info/service/serviceList/index.js +15 -11
  30. package/es/components/booking/info/utils.js +1 -1
  31. package/es/components/booking/locales.d.ts +21 -0
  32. package/es/components/booking/locales.js +55 -3
  33. package/es/components/booking/model.d.ts +4 -3
  34. package/es/components/booking/model.js +9 -9
  35. package/es/components/booking/notes/index.d.ts +1 -1
  36. package/es/components/booking/notes/model.d.ts +1 -2
  37. package/es/components/booking/payments/index.d.ts +1 -1
  38. package/es/components/booking/payments/model.d.ts +1 -2
  39. package/es/components/schedules/index.d.ts +1 -1
  40. package/es/components/schedules/model.d.ts +1 -2
  41. package/lib/components/booking/addons/index.d.ts +1 -1
  42. package/lib/components/booking/addons/model.d.ts +1 -2
  43. package/lib/components/booking/components/footer/index.js +23 -0
  44. package/lib/components/booking/components/footer/serve.d.ts +1 -0
  45. package/lib/components/booking/components/footer/serve.js +30 -0
  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/model.d.ts +1 -2
  49. package/lib/components/booking/index.d.ts +1 -1
  50. package/lib/components/booking/info/index.d.ts +1 -1
  51. package/lib/components/booking/info/model.js +9 -7
  52. package/lib/components/booking/info/service/addService/index.d.ts +3 -1
  53. package/lib/components/booking/info/service/addService/index.js +6 -3
  54. package/lib/components/booking/info/service/editService/index.d.ts +5 -2
  55. package/lib/components/booking/info/service/editService/index.js +104 -61
  56. package/lib/components/booking/info/service/editService/index.less +15 -5
  57. package/lib/components/booking/info/service/index.js +8 -1
  58. package/lib/components/booking/info/service/serviceList/index.d.ts +5 -3
  59. package/lib/components/booking/info/service/serviceList/index.js +2 -1
  60. package/lib/components/booking/info/utils.js +1 -1
  61. package/lib/components/booking/locales.d.ts +21 -0
  62. package/lib/components/booking/locales.js +68 -3
  63. package/lib/components/booking/model.d.ts +4 -3
  64. package/lib/components/booking/notes/index.d.ts +1 -1
  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/schedules/index.d.ts +1 -1
  69. package/lib/components/schedules/model.d.ts +1 -2
  70. package/package.json +4 -4
@@ -40,6 +40,7 @@ export interface FormState {
40
40
  cacheItem: any;
41
41
  edit: boolean;
42
42
  addTimeModal: boolean;
43
+ changeService: any;
43
44
  };
44
45
  pet: {
45
46
  showModal: boolean;
@@ -73,7 +74,7 @@ export interface FormState {
73
74
  bookingId: string | number;
74
75
  bookingDetail: any;
75
76
  channelDisabledEdit: boolean;
76
- renderType?: "eventBooking";
77
+ renderType?: 'eventBooking';
77
78
  modalOpen?: boolean;
78
79
  isTerminal?: boolean;
79
80
  isFranchisee?: boolean;
@@ -81,7 +82,7 @@ export interface FormState {
81
82
  eventOtherParams?: {
82
83
  relation_id: number;
83
84
  number: number;
84
- registration_type: "single" | "all" | "extra_include";
85
+ registration_type: 'single' | 'all' | 'extra_include';
85
86
  start_date: string;
86
87
  start_time: string;
87
88
  end_date: string;
@@ -96,7 +97,7 @@ export declare const walkInData: {
96
97
  id: number;
97
98
  nickname: string;
98
99
  };
99
- export declare const Provider: (ComponentUi: any) => (props: any) => any, Context: import("react").Context<{
100
+ export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
100
101
  state: FormState;
101
102
  } & {
102
103
  dispatch: (params: {
@@ -4,8 +4,8 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
4
4
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
5
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
6
6
  function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
7
- import { miniRedux } from "@pisell/utils";
8
- import dayjs from "dayjs";
7
+ import { miniRedux } from '@pisell/utils';
8
+ import dayjs from 'dayjs';
9
9
  var apis = {
10
10
  getClients: function getClients() {
11
11
  return [];
@@ -31,10 +31,10 @@ var apis = {
31
31
  };
32
32
  export var walkInData = {
33
33
  id: 0,
34
- nickname: "Select a customer"
34
+ nickname: 'Select a customer'
35
35
  };
36
36
  var defaultState = {
37
- amountSymbol: "$",
37
+ amountSymbol: '$',
38
38
  apis: apis,
39
39
  client: {
40
40
  showModal: false,
@@ -70,19 +70,19 @@ var defaultState = {
70
70
  forms: []
71
71
  },
72
72
  notes: {
73
- orderNote: "",
73
+ orderNote: '',
74
74
  internalNotes: []
75
75
  },
76
76
  setGlobalState: function setGlobalState() {},
77
77
  bookingConfig: {
78
78
  basic: {
79
79
  service_time: {
80
- unit: "minute",
80
+ unit: 'minute',
81
81
  value: 3
82
82
  },
83
- appointment_mode: "multiple_appointments_mode",
83
+ appointment_mode: 'multiple_appointments_mode',
84
84
  appointment_subject: {
85
- type: "form",
85
+ type: 'form',
86
86
  form_id: 247,
87
87
  form_record_id: 246
88
88
  }
@@ -95,7 +95,7 @@ var defaultState = {
95
95
  bookingId: 0
96
96
  };
97
97
  var _miniRedux = miniRedux({
98
- namespace: "state",
98
+ namespace: 'state',
99
99
  state: defaultState,
100
100
  reducers: {
101
101
  setState: function setState(state, payload) {
@@ -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;
@@ -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: {
@@ -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: any;
16
+ declare const Addons: import("react").ForwardRefExoticComponent<Pick<any, string | number | symbol> & import("react").RefAttributes<unknown>>;
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: {
@@ -45,6 +45,7 @@ var import_FooterMenus = __toESM(require("./FooterMenus"));
45
45
  var import_index = require("./index.less");
46
46
  var import_useEngineContext = __toESM(require("../../../../hooks/useEngineContext"));
47
47
  var import_icons = require("@ant-design/icons");
48
+ var import_serve = require("./serve");
48
49
  var Footer = (props) => {
49
50
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
50
51
  const { state, buttons, dispatch, source } = props;
@@ -240,6 +241,28 @@ var Footer = (props) => {
240
241
  let callbackData = null;
241
242
  let values = (0, import_utils2.formatValues)({ ...state, ...saveOtherValue });
242
243
  const api = state.bookingId ? editApi : createApi;
244
+ if (!state.bookingId && state.renderType === "eventBooking") {
245
+ const { data } = await (0, import_serve.eventBookingCheck)(values);
246
+ if (data.list.length) {
247
+ const confirmed = await modal.confirm({
248
+ icon: null,
249
+ title: import_utils.locales.getText(
250
+ "page.event.booking.text.duplicate-enrollment"
251
+ ),
252
+ content: import_utils.locales.getText("page.event.booking.text.duplicate-enrollment-content")({
253
+ customerName: data.customer_name,
254
+ title: data.title,
255
+ list: data.list
256
+ }),
257
+ width: 480,
258
+ okText: import_utils.locales.getText("page.event.booking.text.duplicate-enrollment-confirm")
259
+ });
260
+ if (!confirmed) {
261
+ _setLoading(false);
262
+ return;
263
+ }
264
+ }
265
+ }
243
266
  if (addonsEdit) {
244
267
  await handleSaveAddons();
245
268
  }
@@ -0,0 +1 @@
1
+ export declare const eventBookingCheck: (params: any) => Promise<any>;
@@ -0,0 +1,30 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/components/booking/components/footer/serve.ts
20
+ var serve_exports = {};
21
+ __export(serve_exports, {
22
+ eventBookingCheck: () => eventBookingCheck
23
+ });
24
+ module.exports = __toCommonJS(serve_exports);
25
+ var import_utils = require("../../utils");
26
+ var eventBookingCheck = async (params) => import_utils.request.getRequest().post(`/shop/eventbookingv2/order/check`, params);
27
+ // Annotate the CommonJS export names for ESM import in node:
28
+ 0 && (module.exports = {
29
+ eventBookingCheck
30
+ });
@@ -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: any;
8
+ declare const Forms: import("react").ForwardRefExoticComponent<Pick<any, string | number | symbol> & import("react").RefAttributes<unknown>>;
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: any;
1
+ declare const Booking: import("react").ForwardRefExoticComponent<Pick<any, string | number | symbol> & import("react").RefAttributes<unknown>>;
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: any;
12
12
  export default Info;
@@ -34,13 +34,7 @@ var defaultState = {};
34
34
  var { Provider, Context } = (0, import_utils.miniRedux)({
35
35
  namespace: "state",
36
36
  state: defaultState,
37
- reducers: {
38
- setStateFn(state, payload) {
39
- return { ...state, ...payload };
40
- },
41
- setState(state, payload) {
42
- return { ...state, ...payload };
43
- },
37
+ effects: {
44
38
  setClient(state, payload) {
45
39
  state.setGlobalState({ client: { ...state.client, ...payload } });
46
40
  },
@@ -83,6 +77,14 @@ var { Provider, Context } = (0, import_utils.miniRedux)({
83
77
  }
84
78
  state.setGlobalState(_val);
85
79
  }
80
+ },
81
+ reducers: {
82
+ setStateFn(state, payload) {
83
+ return { ...state, ...payload };
84
+ },
85
+ setState(state, payload) {
86
+ return { ...state, ...payload };
87
+ }
86
88
  }
87
89
  });
88
90
  // Annotate the CommonJS export names for ESM import in node:
@@ -1,4 +1,6 @@
1
1
  import React from 'react';
2
2
  import './index.less';
3
- declare const Info: () => React.JSX.Element;
3
+ declare const Info: ({ onEdit }: {
4
+ onEdit: any;
5
+ }) => React.JSX.Element;
4
6
  export default Info;
@@ -63,7 +63,7 @@ var shopList = [
63
63
  6848,
64
64
  6305
65
65
  ];
66
- var Info = () => {
66
+ var Info = ({ onEdit }) => {
67
67
  var _a, _b, _c, _d;
68
68
  const [search, setSearch] = (0, import_react.useState)("");
69
69
  const { state, dispatch } = (0, import_react.useContext)(import_model.Context);
@@ -220,9 +220,11 @@ var Info = () => {
220
220
  payload: {
221
221
  editModal: true,
222
222
  cacheItem,
223
- addModal: !cacheItem.autoClose
223
+ addModal: !cacheItem.autoClose,
224
+ changeService: false
224
225
  }
225
226
  });
227
+ onEdit == null ? void 0 : onEdit(cacheItem);
226
228
  }
227
229
  });
228
230
  };
@@ -305,7 +307,8 @@ var Info = () => {
305
307
  dispatch({
306
308
  type: "setService",
307
309
  payload: {
308
- addModal: false
310
+ addModal: false,
311
+ changeService: false
309
312
  }
310
313
  });
311
314
  },
@@ -1,4 +1,7 @@
1
1
  import React from 'react';
2
2
  import './index.less';
3
- declare const Info: () => React.JSX.Element;
4
- export default Info;
3
+ export interface EditServiceRef {
4
+ init: (cacheItem?: any) => void;
5
+ }
6
+ declare const _default: React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<unknown>>;
7
+ export default _default;
@@ -48,8 +48,8 @@ var import_like = __toESM(require("../like"));
48
48
  var import_mock = require("../../../mock");
49
49
  var import_utils4 = require("../addService/utils");
50
50
  var submitLock = false;
51
- var Info = () => {
52
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w;
51
+ var Info = (_, ref) => {
52
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A;
53
53
  const [form] = import_antd.Form.useForm();
54
54
  const useTotal = import_antd.Form.useWatch("total", form);
55
55
  const useLikeStatus = import_antd.Form.useWatch("like_status", form);
@@ -59,13 +59,13 @@ var Info = () => {
59
59
  const [resourceLoading, setResourceLoading] = (0, import_react.useState)(false);
60
60
  const { state, dispatch } = (0, import_react.useContext)(import_model.Context);
61
61
  const [selectOpen, setSelectOpen] = (0, import_react.useState)();
62
- const getCurrentCacheItem = () => {
62
+ const getCurrentCacheItem = (_cacheItem) => {
63
63
  let values = form.getFieldsValue();
64
- let _cacheItem = state.service.cacheItem;
64
+ let _item = _cacheItem || state.service.cacheItem;
65
65
  return {
66
- ..._cacheItem,
66
+ ..._item,
67
67
  _extend: {
68
- ..._cacheItem == null ? void 0 : _cacheItem._extend,
68
+ ..._item == null ? void 0 : _item._extend,
69
69
  ...values
70
70
  }
71
71
  };
@@ -118,12 +118,11 @@ var Info = () => {
118
118
  }
119
119
  }, [useDuration, flexibleOption]);
120
120
  const getResources = async (cacheItem) => {
121
- var _a2;
122
121
  console.log("getResources2");
123
122
  try {
124
123
  let _list = state.service.resourcesOrigin || [];
125
- let autoClose = (_a2 = state.service.cacheItem) == null ? void 0 : _a2.autoClose;
126
124
  const _cacheItem = cacheItem || getCurrentCacheItem();
125
+ let autoClose = _cacheItem == null ? void 0 : _cacheItem.autoClose;
127
126
  if (!_cacheItem._extend) {
128
127
  return;
129
128
  }
@@ -199,6 +198,7 @@ var Info = () => {
199
198
  };
200
199
  const getDiscount = () => {
201
200
  var _a2;
201
+ console.log("折扣内", state.service.cacheItem);
202
202
  let oPrice = Number(((_a2 = state.service.cacheItem) == null ? void 0 : _a2._extend.origin_total) || 0);
203
203
  let cPrice = Number(useTotal || 0);
204
204
  let discount = "";
@@ -260,21 +260,17 @@ var Info = () => {
260
260
  addModal: false,
261
261
  value: _list,
262
262
  edit: true,
263
- cacheItem: null
263
+ cacheItem: null,
264
+ changeService: false
264
265
  }
265
266
  });
266
267
  };
267
- const setEditData = (0, import_ahooks.useMemoizedFn)(() => {
268
- if (state.service.editModal) {
269
- let cacheItem = state.service.cacheItem;
270
- let values = cacheItem._extend;
271
- form.setFieldsValue(values);
272
- if (state.renderType !== "eventBooking") {
273
- getResources();
274
- }
275
- } else {
276
- setSelectOpen(void 0);
277
- form.resetFields();
268
+ const setEditData = (0, import_ahooks.useMemoizedFn)((_cacheItem) => {
269
+ let cacheItem = _cacheItem || state.service.cacheItem;
270
+ let values = cacheItem._extend;
271
+ form.setFieldsValue(values);
272
+ if (state.renderType !== "eventBooking") {
273
+ getResources(_cacheItem);
278
274
  }
279
275
  });
280
276
  const isReason = (0, import_react.useMemo)(() => {
@@ -282,7 +278,7 @@ var Info = () => {
282
278
  let oPrice = Number(((_a2 = state.service.cacheItem) == null ? void 0 : _a2._extend.origin_total) || 0);
283
279
  let cPrice = Number(useTotal || 0);
284
280
  return cPrice !== oPrice;
285
- }, [useTotal, state.service.cacheItem]);
281
+ }, [useTotal, (_e = (_d = state.service.cacheItem) == null ? void 0 : _d._extend) == null ? void 0 : _e.origin_total]);
286
282
  const errorList = (0, import_react.useMemo)(() => {
287
283
  return (0, import_utils3.getErrorList)(currentResource, getCurrentCacheItem());
288
284
  }, [currentResource, useDuration, useStartTime]);
@@ -298,24 +294,23 @@ var Info = () => {
298
294
  useDuration,
299
295
  state.renderType,
300
296
  state.service.resourcesOrigin,
301
- (_d = state.service.cacheItem) == null ? void 0 : _d.autoClose
297
+ (_f = state.service.cacheItem) == null ? void 0 : _f.autoClose
302
298
  ]);
303
299
  (0, import_react.useEffect)(() => {
304
- setEditData();
305
- }, [state.service.editModal, setEditData]);
300
+ }, [state.service.editModal]);
306
301
  (0, import_react.useEffect)(() => {
307
302
  getErrorMsg();
308
303
  }, [useResource, useStartTime, useDuration]);
309
304
  (0, import_react.useEffect)(() => {
310
305
  getDiscount();
311
- }, [useTotal, state.service.cacheItem]);
306
+ }, [useTotal, (_h = (_g = state.service.cacheItem) == null ? void 0 : _g._extend) == null ? void 0 : _h.origin_total]);
312
307
  const isDiscount = (0, import_react.useMemo)(() => {
313
308
  var _a2, _b2, _c2;
314
309
  if (!((_a2 = state.service) == null ? void 0 : _a2.cacheItem)) {
315
310
  return false;
316
311
  }
317
312
  return useTotal != ((_c2 = (_b2 = state.service) == null ? void 0 : _b2.cacheItem) == null ? void 0 : _c2._extend.origin_total);
318
- }, [useTotal, (_f = (_e = state.service) == null ? void 0 : _e.cacheItem) == null ? void 0 : _f._extend.origin_total]);
313
+ }, [useTotal, (_j = (_i = state.service) == null ? void 0 : _i.cacheItem) == null ? void 0 : _j._extend.origin_total]);
319
314
  (0, import_react.useEffect)(() => {
320
315
  if (useResource === 0) {
321
316
  handleLikeResource("common");
@@ -324,7 +319,7 @@ var Info = () => {
324
319
  const bundles = (0, import_react.useMemo)(() => {
325
320
  var _a2, _b2, _c2, _d2;
326
321
  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) || [];
327
- }, [(_j = (_i = (_h = (_g = state.service) == null ? void 0 : _g.cacheItem) == null ? void 0 : _h._extend) == null ? void 0 : _i.other) == null ? void 0 : _j.bundle]);
322
+ }, [(_n = (_m = (_l = (_k = state.service) == null ? void 0 : _k.cacheItem) == null ? void 0 : _l._extend) == null ? void 0 : _m.other) == null ? void 0 : _n.bundle]);
328
323
  const getResourcesData = async () => {
329
324
  setResourceLoading(true);
330
325
  try {
@@ -350,51 +345,99 @@ var Info = () => {
350
345
  (0, import_react.useEffect)(() => {
351
346
  getResourcesData();
352
347
  }, [state.date.value]);
353
- const SelectTime = (_k = window.BaseMaterials) == null ? void 0 : _k.SelectTime;
348
+ const handleEdit = (e) => {
349
+ const item = state.service.cacheItem;
350
+ let values = form.getFieldsValue();
351
+ state.action({
352
+ type: "pisell1.handleOpenProductModal",
353
+ data: {
354
+ id: item.id,
355
+ date: state.date.value.format("YYYY-MM-DD"),
356
+ showConfig: {
357
+ option: false,
358
+ session: false,
359
+ variant: false,
360
+ package: true
361
+ },
362
+ value: item._extend.other
363
+ },
364
+ callback: (e2) => {
365
+ let cacheItem = {
366
+ ...item,
367
+ product_id: item.id,
368
+ _id: item == null ? void 0 : item._id,
369
+ _key: e2.key,
370
+ _extend: {
371
+ ...item._extend,
372
+ // 将当前表单的值覆盖进去
373
+ ...values,
374
+ // 覆盖选择的规格和套餐
375
+ other: JSON.parse(JSON.stringify(e2))
376
+ },
377
+ new: 0
378
+ };
379
+ let _total = (0, import_utils3.getProductTotalPrice)(cacheItem);
380
+ cacheItem._extend.total = _total;
381
+ cacheItem._extend.origin_total = _total;
382
+ dispatch({
383
+ type: "setService",
384
+ payload: {
385
+ cacheItem
386
+ }
387
+ });
388
+ form.setFieldsValue({
389
+ total: _total
390
+ });
391
+ }
392
+ });
393
+ };
394
+ const handleChange = (e) => {
395
+ if (state.channelDisabledEdit) {
396
+ return;
397
+ }
398
+ dispatch({
399
+ type: "setService",
400
+ payload: {
401
+ addModal: true,
402
+ editModal: true,
403
+ //用于控制 添加商品 和 编辑服务弹窗的上下层级
404
+ changeService: true
405
+ }
406
+ });
407
+ };
408
+ (0, import_react.useImperativeHandle)(ref, () => {
409
+ return {
410
+ init: setEditData
411
+ };
412
+ });
413
+ console.log("state.service.value", state.service.value);
414
+ const SelectTime = (_o = window.BaseMaterials) == null ? void 0 : _o.SelectTime;
354
415
  return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(
355
416
  import_drawer.default,
356
417
  {
357
- zIndex: 1e3,
418
+ zIndex: state.service.changeService ? 999 : 1e3,
358
419
  forceRender: true,
359
- open: state.service.editModal && !((_l = state.service.cacheItem) == null ? void 0 : _l.autoClose),
420
+ open: state.service.editModal && !((_p = state.service.cacheItem) == null ? void 0 : _p.autoClose),
360
421
  title: import_utils.locales.getText("pisell2.text.edit-service"),
361
422
  onClose: () => {
362
423
  dispatch({
363
424
  type: "setService",
364
425
  payload: {
365
426
  editModal: false,
366
- cacheItem: null
427
+ cacheItem: null,
428
+ changeService: false
367
429
  }
368
430
  });
369
431
  }
370
432
  },
371
- /* @__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(
372
- "div",
433
+ /* @__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("div", { className: "current-service-info" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "current-service-info-name-wrap" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "current-service-info-name" }, ((_s = (_r = (_q = state.service) == null ? void 0 : _q.cacheItem) == null ? void 0 : _r._extend) == null ? void 0 : _s.product_name) || "-"), /* @__PURE__ */ import_react.default.createElement(import_antd.Button, { onClick: handleEdit }, import_utils.locales.getText("pisell2.text.edit")), /* @__PURE__ */ import_react.default.createElement(import_antd.Button, { onClick: handleChange }, import_utils.locales.getText("pisell2.text.change"))), /* @__PURE__ */ import_react.default.createElement(
434
+ import_collapsibleList.default,
373
435
  {
374
- className: "current-service-info",
375
- onClick: () => {
376
- if (state.channelDisabledEdit) {
377
- return;
378
- }
379
- dispatch({
380
- type: "setService",
381
- payload: {
382
- addModal: true,
383
- editModal: false
384
- }
385
- });
386
- }
387
- },
388
- /* @__PURE__ */ import_react.default.createElement("div", { className: "current-service-info-name" }, ((_o = (_n = (_m = state.service) == null ? void 0 : _m.cacheItem) == null ? void 0 : _n._extend) == null ? void 0 : _o.product_name) || "-"),
389
- /* @__PURE__ */ import_react.default.createElement(
390
- import_collapsibleList.default,
391
- {
392
- style: { marginTop: bundles.length ? "8px" : 0 },
393
- list: bundles,
394
- renderItem: (item) => (0, import_utils2.renderBundles)(item, state.amountSymbol)
395
- }
396
- )
397
- ))), /* @__PURE__ */ import_react.default.createElement(import_antd.Col, { span: 12 }, /* @__PURE__ */ import_react.default.createElement(
436
+ style: { marginTop: bundles.length ? "8px" : 0 },
437
+ list: bundles,
438
+ renderItem: (item) => (0, import_utils2.renderBundles)(item, state.amountSymbol)
439
+ }
440
+ )))), /* @__PURE__ */ import_react.default.createElement(import_antd.Col, { span: 12 }, /* @__PURE__ */ import_react.default.createElement(
398
441
  import_antd.Form.Item,
399
442
  {
400
443
  label: import_utils.locales.getText("pisell2.text.price"),
@@ -410,8 +453,8 @@ var Info = () => {
410
453
  precision: 2,
411
454
  style: { width: "100%" },
412
455
  min: 0,
413
- max: ((_q = (_p = state.service.cacheItem) == null ? void 0 : _p._extend) == null ? void 0 : _q.origin_total) || 0,
414
- placeholder: ((_s = (_r = state.service.cacheItem) == null ? void 0 : _r._extend) == null ? void 0 : _s.origin_total) || "0"
456
+ max: ((_u = (_t = state.service.cacheItem) == null ? void 0 : _t._extend) == null ? void 0 : _u.origin_total) || 0,
457
+ placeholder: ((_w = (_v = state.service.cacheItem) == null ? void 0 : _v._extend) == null ? void 0 : _w.origin_total) || "0"
415
458
  }
416
459
  )
417
460
  )), /* @__PURE__ */ import_react.default.createElement(import_antd.Col, { span: 12 }, /* @__PURE__ */ import_react.default.createElement(
@@ -451,7 +494,7 @@ var Info = () => {
451
494
  SelectTime ? /* @__PURE__ */ import_react.default.createElement(
452
495
  SelectTime,
453
496
  {
454
- slice: (_w = (_v = (_u = (_t = state.bookingConfig) == null ? void 0 : _t.config) == null ? void 0 : _u.basic) == null ? void 0 : _v.service_time) == null ? void 0 : _w.value,
497
+ slice: (_A = (_z = (_y = (_x = state.bookingConfig) == null ? void 0 : _x.config) == null ? void 0 : _y.basic) == null ? void 0 : _z.service_time) == null ? void 0 : _A.value,
455
498
  timePickerProps: {
456
499
  style: { width: "100%" }
457
500
  },
@@ -551,4 +594,4 @@ var Info = () => {
551
594
  )))
552
595
  ));
553
596
  };
554
- var editService_default = Info;
597
+ var editService_default = (0, import_react.forwardRef)(Info);