@pisell/private-materials 3.3.83 → 3.3.85

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.
@@ -71,7 +71,7 @@ var Header = function Header() {
71
71
  var handleBack = /*#__PURE__*/function () {
72
72
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
73
73
  var _currentStep$step4;
74
- var key, types, _carts$, type, form_key, booking_form, prevStepData, currentStepData, _key;
74
+ var key, types, form_key, booking_form, prevStepData, currentStepData, _key;
75
75
  return _regeneratorRuntime().wrap(function _callee$(_context) {
76
76
  while (1) switch (_context.prev = _context.next) {
77
77
  case 0:
@@ -91,19 +91,13 @@ var Header = function Header() {
91
91
  }
92
92
 
93
93
  // 3. 清空商品
94
- if (!(key === 'select-service')) {
95
- _context.next = 10;
96
- break;
97
- }
98
- appointmentBooking.clearCart();
99
- _context.next = 8;
100
- return checkProductType(carts === null || carts === void 0 || (_carts$ = carts[0]) === null || _carts$ === void 0 ? void 0 : _carts$.id);
101
- case 8:
102
- type = _context.sent;
103
- if (type === 'duration') {
104
- appointmentBooking.deleteCartItemInfo('time');
94
+ if (key === 'select-service') {
95
+ appointmentBooking.clearCart();
96
+ if (appointmentBooking.isCartHasDurationProduct()) {
97
+ appointmentBooking.deleteCartItemInfo('time');
98
+ }
105
99
  }
106
- case 10:
100
+
107
101
  // 4. 清理本地状态
108
102
  if (key === 'select-time') {
109
103
  setTimes([]);
@@ -165,7 +159,7 @@ var Header = function Header() {
165
159
  // isSkip: false,
166
160
  // });
167
161
  // }
168
- case 18:
162
+ case 13:
169
163
  case "end":
170
164
  return _context.stop();
171
165
  }
@@ -101,7 +101,7 @@ var Services = /*#__PURE__*/forwardRef(function (props, ref) {
101
101
  },
102
102
  callback: function () {
103
103
  var _callback = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(data) {
104
- var product, session, startDate, endDate, _data$origin, resources, activeStatus, index, description;
104
+ var product, session, startDate, endDate, _data$origin, resources, activeStatus, index, stepList, hasResourceStep, description;
105
105
  return _regeneratorRuntime().wrap(function _callee$(_context) {
106
106
  while (1) switch (_context.prev = _context.next) {
107
107
  case 0:
@@ -169,7 +169,7 @@ var Services = /*#__PURE__*/forwardRef(function (props, ref) {
169
169
  return _context.abrupt("return", Toast(locales.getText('pisell2.appointment.no.available.service')));
170
170
  case 24:
171
171
  appointmentBooking.storeProduct(product);
172
- // duration 类型的商品,要获取一下资源
172
+ // duration 类型的商品,要获取一下资源,在先选日期的 duration 步骤里目前只能通过这个动作拉取
173
173
  if (!(type === 'duration')) {
174
174
  _context.next = 28;
175
175
  break;
@@ -180,13 +180,19 @@ var Services = /*#__PURE__*/forwardRef(function (props, ref) {
180
180
  // 先选择日期流程
181
181
  if (isDateSelectedFirst) {
182
182
  index = (currentStep === null || currentStep === void 0 ? void 0 : currentStep.index) + 2; //先选择日期流程:如果商品类型是duration的商品,则需要增加选择时间步骤
183
- if (type === 'duration') {
184
- description = locales.getText('pisell2.appointment.select.time');
185
- appointmentBooking.addStep({
186
- index: index,
187
- key: 'select-time',
188
- description: description
189
- }, 'select-resource');
183
+ if (type === 'duration' || appointmentBooking.isCartHasDurationProduct()) {
184
+ stepList = appointmentBooking.getStepList();
185
+ hasResourceStep = stepList === null || stepList === void 0 ? void 0 : stepList.find(function (item) {
186
+ return (item === null || item === void 0 ? void 0 : item.key) === "select-resource";
187
+ });
188
+ if (hasResourceStep) {
189
+ description = locales.getText('pisell2.appointment.select.time');
190
+ appointmentBooking.addStep({
191
+ index: index,
192
+ key: 'select-time',
193
+ description: description
194
+ }, 'select-resource');
195
+ }
190
196
  } else {
191
197
  removeStep('select-time');
192
198
  }
@@ -244,4 +244,4 @@ export declare const updateAppointmentServicePrice: (state: any, { start_date, e
244
244
  * @Author: WangHan
245
245
  * @Date: 2024-12-24 11:32
246
246
  */
247
- export declare const updateServicePrice: (state: any) => Promise<any> | never[];
247
+ export declare const updateServicePrice: (state: any) => never[] | Promise<any>;
@@ -165,10 +165,10 @@ export declare const getProductTotalPrice: (item: any) => number;
165
165
  export declare const getDuration: (duration: number | {
166
166
  type: string;
167
167
  value: number;
168
- }) => number | "flexible" | {
168
+ }) => number | {
169
169
  type: string;
170
170
  value: number;
171
- };
171
+ } | "flexible";
172
172
  export declare const isWalkIn: (customer_id?: number | string) => boolean;
173
173
  export declare const getIsEdit: (state: any) => boolean;
174
174
  export {};
@@ -74,7 +74,7 @@ var Header = () => {
74
74
  return ((_c = currentStep == null ? void 0 : currentStep.step) == null ? void 0 : _c.description) || "";
75
75
  }, [(_a = currentStep == null ? void 0 : currentStep.step) == null ? void 0 : _a.key, currentSelectedResources]);
76
76
  const handleBack = async () => {
77
- var _a2, _b;
77
+ var _a2;
78
78
  const key = (_a2 = currentStep == null ? void 0 : currentStep.step) == null ? void 0 : _a2.key;
79
79
  const types = {
80
80
  "select-time": "time",
@@ -89,8 +89,7 @@ var Header = () => {
89
89
  }
90
90
  if (key === "select-service") {
91
91
  appointmentBooking.clearCart();
92
- const type = await checkProductType((_b = carts == null ? void 0 : carts[0]) == null ? void 0 : _b.id);
93
- if (type === "duration") {
92
+ if (appointmentBooking.isCartHasDurationProduct()) {
94
93
  appointmentBooking.deleteCartItemInfo("time");
95
94
  }
96
95
  }
@@ -134,14 +134,20 @@ var Services = (0, import_react.forwardRef)((props, ref) => {
134
134
  }
135
135
  if (isDateSelectedFirst) {
136
136
  const index = (currentStep == null ? void 0 : currentStep.index) + 2;
137
- if (type === "duration") {
138
- const description = import_utils.locales.getText(
139
- "pisell2.appointment.select.time"
140
- );
141
- appointmentBooking.addStep(
142
- { index, key: "select-time", description },
143
- "select-resource"
137
+ if (type === "duration" || appointmentBooking.isCartHasDurationProduct()) {
138
+ const stepList = appointmentBooking.getStepList();
139
+ const hasResourceStep = stepList == null ? void 0 : stepList.find(
140
+ (item2) => (item2 == null ? void 0 : item2.key) === "select-resource"
144
141
  );
142
+ if (hasResourceStep) {
143
+ const description = import_utils.locales.getText(
144
+ "pisell2.appointment.select.time"
145
+ );
146
+ appointmentBooking.addStep(
147
+ { index, key: "select-time", description },
148
+ "select-resource"
149
+ );
150
+ }
145
151
  } else {
146
152
  removeStep("select-time");
147
153
  }
@@ -244,4 +244,4 @@ export declare const updateAppointmentServicePrice: (state: any, { start_date, e
244
244
  * @Author: WangHan
245
245
  * @Date: 2024-12-24 11:32
246
246
  */
247
- export declare const updateServicePrice: (state: any) => Promise<any> | never[];
247
+ export declare const updateServicePrice: (state: any) => never[] | Promise<any>;
@@ -165,10 +165,10 @@ export declare const getProductTotalPrice: (item: any) => number;
165
165
  export declare const getDuration: (duration: number | {
166
166
  type: string;
167
167
  value: number;
168
- }) => number | "flexible" | {
168
+ }) => number | {
169
169
  type: string;
170
170
  value: number;
171
- };
171
+ } | "flexible";
172
172
  export declare const isWalkIn: (customer_id?: number | string) => boolean;
173
173
  export declare const getIsEdit: (state: any) => boolean;
174
174
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pisell/private-materials",
3
- "version": "3.3.83",
3
+ "version": "3.3.85",
4
4
  "main": "./lib/index.js",
5
5
  "module": "./es/index.js",
6
6
  "types": "./lib/index.d.ts",
@@ -61,8 +61,8 @@
61
61
  "decimal.js": "^10.4.3",
62
62
  "@pisell/utils": "1.0.42",
63
63
  "@pisell/materials": "3.3.30",
64
- "@pisell/date-picker": "3.0.2",
65
- "@pisell/icon": "0.0.11"
64
+ "@pisell/icon": "0.0.11",
65
+ "@pisell/date-picker": "3.0.2"
66
66
  },
67
67
  "peerDependencies": {
68
68
  "react": "^18.0.0",
@@ -1,3 +0,0 @@
1
- import './index.less';
2
- declare const Header: () => JSX.Element;
3
- export default Header;
@@ -1,3 +0,0 @@
1
- import './index.less';
2
- declare const Header: () => JSX.Element;
3
- export default Header;