@pisell/private-materials 6.3.111 → 6.3.112

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 (59) 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/meta.js +1 -1
  5. package/build/lowcode/render/default/view.js +1 -1
  6. package/build/lowcode/view.js +1 -1
  7. package/es/components/booking/addons/model.d.ts +10 -1
  8. package/es/components/booking/components/footer/utils.js +4 -4
  9. package/es/components/booking/forms/model.d.ts +10 -1
  10. package/es/components/booking/info/hooks/useInfoHolder.d.ts +0 -1
  11. package/es/components/booking/info/model.d.ts +10 -1
  12. package/es/components/booking/info/service/addService/utils.d.ts +1 -1
  13. package/es/components/booking/info2/service/addService/utils.d.ts +1 -1
  14. package/es/components/booking/info2/service/editService/index.js +36 -6
  15. package/es/components/booking/info2/service/editService/utils.d.ts +15 -0
  16. package/es/components/booking/info2/service/editService/utils.js +76 -0
  17. package/es/components/booking/model.d.ts +9 -1
  18. package/es/components/booking/notes/model.d.ts +10 -1
  19. package/es/components/booking/payments/model.d.ts +10 -1
  20. package/es/components/booking/utils.d.ts +2 -2
  21. package/es/components/eftposPay/amount.d.ts +1 -1
  22. package/es/components/eftposPay/device.d.ts +1 -1
  23. package/es/components/eftposPay/hooks.d.ts +1 -1
  24. package/es/components/eftposPay/store/index.d.ts +4 -4
  25. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/CallToBook/index.d.ts +0 -1
  26. package/es/components/pay/toC/PaymentMethods/StripePay/Stripe/Finish/index.d.ts +0 -1
  27. package/es/components/pay/toC/PaymentMethods/StripePay/Stripe/components/PageLoading/index.d.ts +0 -1
  28. package/es/components/pay/toC/model.d.ts +9 -1
  29. package/es/components/schedules/model.d.ts +9 -1
  30. package/es/plus/pisellSalesManagement/config/booking.d.ts +6 -6
  31. package/es/plus/walletEditor/components/ImageUpload/index.d.ts +1 -1
  32. package/es/pro/Selector/Selector.d.ts +1 -1
  33. package/lib/components/booking/addons/model.d.ts +10 -1
  34. package/lib/components/booking/components/footer/utils.js +2 -2
  35. package/lib/components/booking/forms/model.d.ts +10 -1
  36. package/lib/components/booking/info/hooks/useInfoHolder.d.ts +0 -1
  37. package/lib/components/booking/info/model.d.ts +10 -1
  38. package/lib/components/booking/info/service/addService/utils.d.ts +1 -1
  39. package/lib/components/booking/info2/service/addService/utils.d.ts +1 -1
  40. package/lib/components/booking/info2/service/editService/index.js +24 -1
  41. package/lib/components/booking/info2/service/editService/utils.d.ts +15 -0
  42. package/lib/components/booking/info2/service/editService/utils.js +38 -2
  43. package/lib/components/booking/model.d.ts +9 -1
  44. package/lib/components/booking/notes/model.d.ts +10 -1
  45. package/lib/components/booking/payments/model.d.ts +10 -1
  46. package/lib/components/booking/utils.d.ts +2 -2
  47. package/lib/components/eftposPay/amount.d.ts +1 -1
  48. package/lib/components/eftposPay/device.d.ts +1 -1
  49. package/lib/components/eftposPay/hooks.d.ts +1 -1
  50. package/lib/components/eftposPay/store/index.d.ts +4 -4
  51. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/CallToBook/index.d.ts +0 -1
  52. package/lib/components/pay/toC/PaymentMethods/StripePay/Stripe/Finish/index.d.ts +0 -1
  53. package/lib/components/pay/toC/PaymentMethods/StripePay/Stripe/components/PageLoading/index.d.ts +0 -1
  54. package/lib/components/pay/toC/model.d.ts +9 -1
  55. package/lib/components/schedules/model.d.ts +9 -1
  56. package/lib/plus/pisellSalesManagement/config/booking.d.ts +6 -6
  57. package/lib/plus/walletEditor/components/ImageUpload/index.d.ts +1 -1
  58. package/lib/pro/Selector/Selector.d.ts +1 -1
  59. package/package.json +3 -3
@@ -52,6 +52,8 @@ var import_materials = require("@pisell/materials");
52
52
  var import_utils5 = require("../../../info/utils");
53
53
  var import_utils6 = require("../../../info/service2/utils");
54
54
  var import_utils7 = require("../../../../ticketBooking/utils");
55
+ var import_decimal = require("decimal.js");
56
+ var import_utils8 = require("./utils");
55
57
  var submitLock = false;
56
58
  var Info = (_, ref) => {
57
59
  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, _B, _C, _D, _E, _F, _G, _H, _I;
@@ -165,7 +167,7 @@ var Info = (_, ref) => {
165
167
  form.setFieldsValue({ discount });
166
168
  };
167
169
  const onFinish = (values) => {
168
- var _a2, _b2;
170
+ var _a2, _b2, _c2, _d2, _e2;
169
171
  let isSuccess = (_a2 = resourcesRef.current) == null ? void 0 : _a2.check();
170
172
  if (isShowTimeAndResource && !isSuccess) {
171
173
  return;
@@ -193,6 +195,23 @@ var Info = (_, ref) => {
193
195
  const { startDate, endDate } = (0, import_utils3.getServiceTimes)({ _extend });
194
196
  _extend.startDate = startDate;
195
197
  _extend.endDate = endDate;
198
+ if (isChangeTotal.current) {
199
+ const discountRatio = new import_decimal.Decimal(values.total).div(_item._extend.origin_total);
200
+ const bundles2 = ((_c2 = _extend == null ? void 0 : _extend.other) == null ? void 0 : _c2.bundle) || [];
201
+ let childProductsTotal = new import_decimal.Decimal(0);
202
+ if (bundles2.length > 0) {
203
+ bundles2.forEach((bundle) => {
204
+ const discountedPrice = new import_decimal.Decimal(bundle.original_price).mul(discountRatio).toDecimalPlaces(2, import_decimal.Decimal.ROUND_HALF_UP);
205
+ bundle.bundle_selling_price = discountedPrice.toNumber();
206
+ childProductsTotal = childProductsTotal.add(
207
+ discountedPrice.mul(bundle.quantity)
208
+ );
209
+ });
210
+ }
211
+ const mainProductTotal = new import_decimal.Decimal(values.total).sub(childProductsTotal);
212
+ const mainProductQuantity = ((_d2 = _extend.other) == null ? void 0 : _d2.quantity) || _extend.quantity || 1;
213
+ _extend.main_product_selling_price = mainProductTotal.div(mainProductQuantity).toNumber();
214
+ }
196
215
  if (_extend.bundle_edit !== void 0) {
197
216
  _extend.bundle_edit = 1;
198
217
  }
@@ -200,6 +219,10 @@ var Info = (_, ref) => {
200
219
  _item._time = (/* @__PURE__ */ new Date()).getTime();
201
220
  _item._serviceKey = (0, import_utils7.genServiceKey)(_item);
202
221
  let _id = _item == null ? void 0 : _item._id;
222
+ _item = (0, import_utils8.setProductPrice)(_item, {
223
+ newTotal: values.total,
224
+ origin_total: (_e2 = _item._extend) == null ? void 0 : _e2.origin_total
225
+ });
203
226
  if (!_list.some((d) => d._id === _id)) {
204
227
  const detail = (0, import_utils7.addService)(_list, _item, state);
205
228
  _list = detail.list;
@@ -11,3 +11,18 @@ export declare const getAutoAllocationStorage: (id: string | number) => any;
11
11
  export declare const setAutoAllocationStorage: (data: {
12
12
  [key: string]: boolean;
13
13
  }) => void;
14
+ /**
15
+ * 手动折扣后给商品价格和子商品价格重新计算
16
+ *
17
+ * 计算逻辑:
18
+ * 1. 子商品(bundle + option)按折扣比例计算,直接截取两位小数(不四舍五入)
19
+ * 2. 主商品价格 = newTotal - 所有子商品价格总和(确保总价精确等于 newTotal)
20
+ *
21
+ * @param cacheItem - 缓存的商品项
22
+ * @param newTotal - 折扣后的新总价
23
+ * @param origin_total - 原始总价
24
+ */
25
+ export declare const setProductPrice: (cacheItem: any, { newTotal, origin_total }: {
26
+ newTotal: number;
27
+ origin_total: number;
28
+ }) => any;
@@ -20,10 +20,14 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  var utils_exports = {};
21
21
  __export(utils_exports, {
22
22
  getAutoAllocationStorage: () => getAutoAllocationStorage,
23
- setAutoAllocationStorage: () => setAutoAllocationStorage
23
+ setAutoAllocationStorage: () => setAutoAllocationStorage,
24
+ setProductPrice: () => setProductPrice
24
25
  });
25
26
  module.exports = __toCommonJS(utils_exports);
26
27
  var import_utils = require("@pisell/utils");
28
+ var import_utils2 = require("../addService/utils");
29
+ var import_decimal = require("decimal.js");
30
+ var import_utils3 = require("@pisell/utils");
27
31
  var getAutoAllocationStorage = (id) => {
28
32
  const value = localStorage.getItem("resource-auto-allocation");
29
33
  if (value) {
@@ -41,8 +45,40 @@ var setAutoAllocationStorage = (data) => {
41
45
  localStorage.setItem("resource-auto-allocation", JSON.stringify({ ...data }));
42
46
  }
43
47
  };
48
+ var setProductPrice = (cacheItem, { newTotal, origin_total }) => {
49
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
50
+ if (((_a = cacheItem == null ? void 0 : cacheItem.discount_list) == null ? void 0 : _a.length) && ((cacheItem == null ? void 0 : cacheItem.discount_list) || []).some((item) => ["good_pass", "discount_card", "product_discount_card"].includes(
51
+ item.type
52
+ ))) {
53
+ return cacheItem;
54
+ }
55
+ if (cacheItem.discount_amount) {
56
+ return cacheItem;
57
+ }
58
+ const discountRatio = new import_decimal.Decimal(newTotal).div(new import_decimal.Decimal(origin_total));
59
+ let subTotal = new import_decimal.Decimal(0);
60
+ if (((_b = cacheItem._extend.other) == null ? void 0 : _b.bundle) && (0, import_utils3.isArr)((_c = cacheItem._extend.other) == null ? void 0 : _c.bundle)) {
61
+ (_e = (_d = cacheItem._extend.other) == null ? void 0 : _d.bundle) == null ? void 0 : _e.forEach((bundle) => {
62
+ const newPrice = new import_decimal.Decimal(bundle.original_price || bundle.price).mul(discountRatio).toDecimalPlaces(2, import_decimal.Decimal.ROUND_DOWN).toNumber();
63
+ const quantity = bundle.num ?? bundle.quantity ?? 1;
64
+ subTotal = subTotal.add(new import_decimal.Decimal(newPrice).mul(quantity));
65
+ bundle.price = newPrice;
66
+ });
67
+ }
68
+ if (((_f = cacheItem._extend.other) == null ? void 0 : _f.option) && (0, import_utils3.isArr)((_g = cacheItem._extend.other) == null ? void 0 : _g.option)) {
69
+ (_i = (_h = cacheItem._extend.other) == null ? void 0 : _h.option) == null ? void 0 : _i.forEach((option) => {
70
+ const newPrice = new import_decimal.Decimal(option.price).mul(discountRatio).toDecimalPlaces(2, import_decimal.Decimal.ROUND_DOWN).toNumber();
71
+ const quantity = option.num ?? option.quantity ?? 1;
72
+ subTotal = subTotal.add(new import_decimal.Decimal(newPrice).mul(quantity));
73
+ option.price = newPrice;
74
+ });
75
+ }
76
+ cacheItem._extend.price = new import_decimal.Decimal(newTotal).sub(subTotal).toNumber();
77
+ return cacheItem;
78
+ };
44
79
  // Annotate the CommonJS export names for ESM import in node:
45
80
  0 && (module.exports = {
46
81
  getAutoAllocationStorage,
47
- setAutoAllocationStorage
82
+ setAutoAllocationStorage,
83
+ setProductPrice
48
84
  });
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export interface FormState {
2
3
  amountSymbol: string;
3
4
  apis: {
@@ -109,4 +110,11 @@ export declare const walkInData: {
109
110
  id: number;
110
111
  nickname: string;
111
112
  };
112
- export declare const Provider: any, Context: any;
113
+ export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
114
+ state: FormState;
115
+ } & {
116
+ dispatch: (params: {
117
+ type: string;
118
+ payload: any;
119
+ }) => void;
120
+ }>;
@@ -1 +1,10 @@
1
- export declare const Provider: any, Context: any;
1
+ /// <reference types="react" />
2
+ import { FormState } from "../model";
3
+ export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
4
+ state: FormState;
5
+ } & {
6
+ dispatch: (params: {
7
+ type: string;
8
+ payload: any;
9
+ }) => void;
10
+ }>;
@@ -1 +1,10 @@
1
- export declare const Provider: any, Context: any;
1
+ /// <reference types="react" />
2
+ import { FormState } from "../model";
3
+ export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
4
+ state: FormState;
5
+ } & {
6
+ dispatch: (params: {
7
+ type: string;
8
+ payload: any;
9
+ }) => void;
10
+ }>;
@@ -166,10 +166,10 @@ export declare const getProductTotalPrice: (item: any) => number;
166
166
  export declare const getDuration: (duration: number | {
167
167
  type: string;
168
168
  value: number;
169
- }) => number | {
169
+ }) => number | "flexible" | {
170
170
  type: string;
171
171
  value: number;
172
- } | "flexible";
172
+ };
173
173
  export declare const isWalkIn: (customer_id?: number | string) => boolean;
174
174
  export declare const getIsEdit: (state: any) => boolean;
175
175
  export {};
@@ -9,7 +9,7 @@ import { PosProps } from './const';
9
9
  */
10
10
  declare const _default: ({ className, onChange, onClose, formatAmount, isMobile, net, client }: {
11
11
  className?: string | undefined;
12
- onChange?: ((status: "success" | "page" | "fail" | "print" | "mark_tx_processed", params?: string | {
12
+ onChange?: ((status: "success" | "page" | "print" | "fail" | "mark_tx_processed", params?: string | {
13
13
  [keys: string]: unknown;
14
14
  } | undefined, other?: any) => void) | undefined;
15
15
  onClose: () => void;
@@ -11,7 +11,7 @@ import './device.less';
11
11
  declare const _default: ({ api, onChange, onClose, className, device_number, isMobile, net, client, formatAmount, }: {
12
12
  api: PayProps['api'];
13
13
  className?: string | undefined;
14
- onChange?: ((status: "success" | "page" | "fail" | "print" | "mark_tx_processed", params?: string | {
14
+ onChange?: ((status: "success" | "page" | "print" | "fail" | "mark_tx_processed", params?: string | {
15
15
  [keys: string]: unknown;
16
16
  } | undefined, other?: any) => void) | undefined;
17
17
  onClose: () => void;
@@ -19,7 +19,7 @@ export declare const useStoreRef: <T extends {
19
19
  readonly netRef: React.MutableRefObject<boolean | undefined>;
20
20
  readonly symbolRef: React.MutableRefObject<string>;
21
21
  readonly amountRef: React.MutableRefObject<string | number>;
22
- readonly eftposRef: React.MutableRefObject<"payo" | "tyro" | "windcave" | "stripe" | "linkly">;
22
+ readonly eftposRef: React.MutableRefObject<"stripe" | "payo" | "tyro" | "windcave" | "linkly">;
23
23
  readonly clientRef: React.MutableRefObject<ClientEnum>;
24
24
  readonly dataRef: React.MutableRefObject<import("./store").State>;
25
25
  };
@@ -197,7 +197,7 @@ export declare const updateComponent: (component: string, render?: boolean) => {
197
197
  } | {
198
198
  readonly type: "step";
199
199
  readonly render: boolean;
200
- readonly component?: undefined;
200
+ component?: undefined;
201
201
  };
202
202
  };
203
203
  /**
@@ -297,10 +297,10 @@ export declare const backUpFree: (payload: Partial<State>) => {
297
297
  name?: string | undefined;
298
298
  symbol?: string | undefined;
299
299
  amount?: string | number | undefined;
300
- mode?: "pay" | "fullPay" | "refund" | "query" | undefined;
300
+ mode?: "refund" | "pay" | "fullPay" | "query" | undefined;
301
301
  order_id?: string | number | undefined;
302
- eftpos?: "payo" | "tyro" | "windcave" | "stripe" | "linkly" | undefined;
303
- action?: "pay" | "amount" | "deviceList" | undefined;
302
+ eftpos?: "stripe" | "payo" | "tyro" | "windcave" | "linkly" | undefined;
303
+ action?: "amount" | "pay" | "deviceList" | undefined;
304
304
  key?: number | undefined;
305
305
  step?: number | undefined;
306
306
  title?: string | undefined;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  declare type CallToBookProps = {
3
2
  show: boolean;
4
3
  type: string;
@@ -1,3 +1,2 @@
1
- /// <reference types="react" />
2
1
  declare const StripePayment: () => import("react").JSX.Element;
3
2
  export default StripePayment;
@@ -1,3 +1,2 @@
1
- /// <reference types="react" />
2
1
  declare const PageLoading: () => import("react").JSX.Element;
3
2
  export default PageLoading;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export interface FormState {
2
3
  platform: 'pc' | 'h5' | '' | undefined;
3
4
  order: any;
@@ -29,4 +30,11 @@ export interface PayGroup {
29
30
  _order: any;
30
31
  front_order_uuid?: string;
31
32
  }
32
- export declare const Provider: any, Context: any;
33
+ export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
34
+ state: FormState;
35
+ } & {
36
+ dispatch: (params: {
37
+ type: string;
38
+ payload: any;
39
+ }) => void;
40
+ }>;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { CalendarDataItem, ScheduleItem } from "./type";
2
3
  import dayjs from "dayjs";
3
4
  export interface FormState {
@@ -68,4 +69,11 @@ export interface FormState {
68
69
  };
69
70
  setGlobalState: Function | null;
70
71
  }
71
- export declare const Provider: any, Context: any;
72
+ export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
73
+ state: FormState;
74
+ } & {
75
+ dispatch: (params: {
76
+ type: string;
77
+ payload: any;
78
+ }) => void;
79
+ }>;
@@ -20,7 +20,7 @@ export declare const getFilterButtonList: () => ({
20
20
  }[];
21
21
  minInputNumberProps?: undefined;
22
22
  maxInputNumberProps?: undefined;
23
- readonly component?: undefined;
23
+ component?: undefined;
24
24
  isSearchServer?: undefined;
25
25
  showSearch?: undefined;
26
26
  showTime?: undefined;
@@ -46,7 +46,7 @@ export declare const getFilterButtonList: () => ({
46
46
  mode?: undefined;
47
47
  maxTagCount?: undefined;
48
48
  options?: undefined;
49
- readonly component?: undefined;
49
+ component?: undefined;
50
50
  isSearchServer?: undefined;
51
51
  showSearch?: undefined;
52
52
  showTime?: undefined;
@@ -91,7 +91,7 @@ export declare const getFilterButtonList: () => ({
91
91
  options: () => Promise<any>;
92
92
  minInputNumberProps?: undefined;
93
93
  maxInputNumberProps?: undefined;
94
- readonly component?: undefined;
94
+ component?: undefined;
95
95
  isSearchServer?: undefined;
96
96
  showSearch?: undefined;
97
97
  showTime?: undefined;
@@ -111,7 +111,7 @@ export declare const getFilterButtonList: () => ({
111
111
  options?: undefined;
112
112
  minInputNumberProps?: undefined;
113
113
  maxInputNumberProps?: undefined;
114
- readonly component?: undefined;
114
+ component?: undefined;
115
115
  isSearchServer?: undefined;
116
116
  showSearch?: undefined;
117
117
  showTime?: undefined;
@@ -133,7 +133,7 @@ export declare const getFilterButtonList: () => ({
133
133
  maxTagCount?: undefined;
134
134
  minInputNumberProps?: undefined;
135
135
  maxInputNumberProps?: undefined;
136
- readonly component?: undefined;
136
+ component?: undefined;
137
137
  showTime?: undefined;
138
138
  };
139
139
  sort?: undefined;
@@ -152,7 +152,7 @@ export declare const getFilterButtonList: () => ({
152
152
  options?: undefined;
153
153
  minInputNumberProps?: undefined;
154
154
  maxInputNumberProps?: undefined;
155
- readonly component?: undefined;
155
+ component?: undefined;
156
156
  isSearchServer?: undefined;
157
157
  showSearch?: undefined;
158
158
  };
@@ -3,6 +3,6 @@ export interface ImageUploadProps {
3
3
  value?: string;
4
4
  onChange?: (val: string) => void;
5
5
  }
6
- export declare const getBaseTime: (size: number) => 1000 | 2000 | 4000 | 8000;
6
+ export declare const getBaseTime: (size: number) => 2000 | 1000 | 4000 | 8000;
7
7
  declare const ImageUpload: React.FC<ImageUploadProps>;
8
8
  export default ImageUpload;
@@ -3,7 +3,7 @@ import { ItemLayout, ItemProps, PresetConfig, SelectorProps, SelectorVariant } f
3
3
  import './selector.less';
4
4
  export declare const SelectorContext: React.Context<{
5
5
  disabled?: boolean | undefined;
6
- mode?: "single" | "multiple" | undefined;
6
+ mode?: "multiple" | "single" | undefined;
7
7
  itemLayout?: ItemLayout | undefined;
8
8
  valueType?: "object" | "primitive" | undefined;
9
9
  variant?: SelectorVariant | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pisell/private-materials",
3
- "version": "6.3.111",
3
+ "version": "6.3.112",
4
4
  "main": "./lib/index.js",
5
5
  "module": "./es/index.js",
6
6
  "types": "./lib/index.d.ts",
@@ -76,10 +76,10 @@
76
76
  "react-infinite-scroll-component": "^6.1.0",
77
77
  "react-resizable": "^3.0.5",
78
78
  "styled-components": "^6.0.0-rc.3",
79
+ "@pisell/utils": "3.0.5",
79
80
  "@pisell/date-picker": "3.0.8",
80
- "@pisell/materials": "6.3.27",
81
81
  "@pisell/icon": "0.0.11",
82
- "@pisell/utils": "3.0.5"
82
+ "@pisell/materials": "6.3.27"
83
83
  },
84
84
  "peerDependencies": {
85
85
  "react": "^18.0.0",