@pisell/private-materials 6.6.30 → 6.6.32

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.
@@ -404,11 +404,12 @@ var ActionButtons = function ActionButtons(_ref) {
404
404
 
405
405
  // 处理价格调整完成
406
406
  var handlePriceAdjustConfirm = function handlePriceAdjustConfirm(discountAmount) {
407
+ var normalizedDiscountAmount = new Decimal(discountAmount || 0).toDecimalPlaces(2, Decimal.ROUND_DOWN).toString();
407
408
  // 更新 shop_discount 到 state 根级别(存储为字符串)
408
409
  dispatch({
409
410
  type: 'setState',
410
411
  payload: {
411
- shop_discount: discountAmount
412
+ shop_discount: normalizedDiscountAmount
412
413
  }
413
414
  });
414
415
  setShowPriceAdjustModal(false);
@@ -975,7 +975,7 @@ var Footer = function Footer(props) {
975
975
  return _context6.abrupt("return");
976
976
  case 42:
977
977
  // 如果是保存,检查是否需要支付定金
978
- if (type === 'save') {
978
+ if (type === 'save' && !state.bookingId) {
979
979
  isNeedDeposit = checkout.checkIsNeedDepositAsync(values.bookings, values.relation_products);
980
980
  if (isNeedDeposit !== null && isNeedDeposit !== void 0 && isNeedDeposit.hasDeposit) {
981
981
  values.is_deposit = 1;
@@ -6,7 +6,7 @@ export declare const getDurationProps: ({ cacheItem, useStartTime, currentResour
6
6
  type: string;
7
7
  value: number;
8
8
  };
9
- locale: string;
9
+ locale: any;
10
10
  slice: any;
11
11
  selectProps: {
12
12
  size: string;
@@ -7,7 +7,7 @@ export declare const getDurationProps: ({ cacheItem, useStartTime, currentResour
7
7
  type: string;
8
8
  value: number;
9
9
  };
10
- locale: string;
10
+ locale: any;
11
11
  slice: any;
12
12
  selectProps: {
13
13
  size: string;
@@ -818,7 +818,7 @@ export var getProductTotalPrice = function getProductTotalPrice(item) {
818
818
  return accumulator.add(currentPrice.mul(currentNum));
819
819
  }, price);
820
820
  }
821
- return price.toNumber();
821
+ return price.toDecimalPlaces(2, Decimal.ROUND_HALF_UP).toNumber();
822
822
  };
823
823
  /**
824
824
  * @title: 判断 duration
@@ -1068,16 +1068,18 @@ var PaymentContent = /*#__PURE__*/forwardRef(function (_ref, ref) {
1068
1068
  // 手动折扣相关处理函数
1069
1069
  var handlePriceAdjustConfirm = /*#__PURE__*/function () {
1070
1070
  var _ref14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(discountAmount) {
1071
+ var normalizedDiscountAmount;
1071
1072
  return _regeneratorRuntime().wrap(function _callee11$(_context11) {
1072
1073
  while (1) switch (_context11.prev = _context11.next) {
1073
1074
  case 0:
1074
1075
  try {
1075
1076
  if (checkoutModule && orderInfo !== null && orderInfo !== void 0 && orderInfo.totalAmount) {
1077
+ normalizedDiscountAmount = new Decimal(discountAmount || 0).toDecimalPlaces(2, Decimal.ROUND_DOWN).toString();
1076
1078
  if (dispatch) {
1077
1079
  dispatch({
1078
1080
  type: 'setState',
1079
1081
  payload: {
1080
- shop_discount: discountAmount
1082
+ shop_discount: normalizedDiscountAmount
1081
1083
  }
1082
1084
  });
1083
1085
  }
@@ -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<"stripe" | "payo" | "tyro" | "windcave" | "linkly" | "huifu">;
22
+ readonly eftposRef: React.MutableRefObject<"stripe" | "tyro" | "windcave" | "payo" | "linkly" | "huifu">;
23
23
  readonly clientRef: React.MutableRefObject<ClientEnum>;
24
24
  readonly dataRef: React.MutableRefObject<import("./store").State>;
25
25
  };
@@ -301,8 +301,8 @@ export declare const backUpFree: (payload: Partial<State>) => {
301
301
  amount?: string | number | undefined;
302
302
  mode?: "pay" | "refund" | "fullPay" | "query" | undefined;
303
303
  order_id?: string | number | undefined;
304
- eftpos?: "stripe" | "payo" | "tyro" | "windcave" | "linkly" | "huifu" | undefined;
305
- action?: "pay" | "amount" | "deviceList" | undefined;
304
+ eftpos?: "stripe" | "tyro" | "windcave" | "payo" | "linkly" | "huifu" | undefined;
305
+ action?: "amount" | "pay" | "deviceList" | undefined;
306
306
  key?: number | undefined;
307
307
  step?: number | undefined;
308
308
  title?: string | undefined;
@@ -328,10 +328,11 @@ var ActionButtons = ({
328
328
  }
329
329
  }, [(_g = state.service) == null ? void 0 : _g.value, (_h = state.addons) == null ? void 0 : _h.value]);
330
330
  const handlePriceAdjustConfirm = (discountAmount) => {
331
+ const normalizedDiscountAmount = new import_decimal.default(discountAmount || 0).toDecimalPlaces(2, import_decimal.default.ROUND_DOWN).toString();
331
332
  dispatch({
332
333
  type: "setState",
333
334
  payload: {
334
- shop_discount: discountAmount
335
+ shop_discount: normalizedDiscountAmount
335
336
  }
336
337
  });
337
338
  setShowPriceAdjustModal(false);
@@ -675,7 +675,7 @@ var Footer = (props) => {
675
675
  }
676
676
  return;
677
677
  }
678
- if (type === "save") {
678
+ if (type === "save" && !state.bookingId) {
679
679
  const isNeedDeposit = checkout.checkIsNeedDepositAsync(values.bookings, values.relation_products);
680
680
  if (isNeedDeposit == null ? void 0 : isNeedDeposit.hasDeposit) {
681
681
  values.is_deposit = 1;
@@ -6,7 +6,7 @@ export declare const getDurationProps: ({ cacheItem, useStartTime, currentResour
6
6
  type: string;
7
7
  value: number;
8
8
  };
9
- locale: string;
9
+ locale: any;
10
10
  slice: any;
11
11
  selectProps: {
12
12
  size: string;
@@ -7,7 +7,7 @@ export declare const getDurationProps: ({ cacheItem, useStartTime, currentResour
7
7
  type: string;
8
8
  value: number;
9
9
  };
10
- locale: string;
10
+ locale: any;
11
11
  slice: any;
12
12
  selectProps: {
13
13
  size: string;
@@ -655,7 +655,7 @@ var getProductTotalPrice = (item) => {
655
655
  return accumulator.add(currentPrice.mul(currentNum));
656
656
  }, price);
657
657
  }
658
- return price.toNumber();
658
+ return price.toDecimalPlaces(2, import_decimal.default.ROUND_HALF_UP).toNumber();
659
659
  };
660
660
  var getDuration = (duration) => {
661
661
  if (typeof duration === "number") {
@@ -756,11 +756,12 @@ var PaymentContent = (0, import_react.forwardRef)(
756
756
  const handlePriceAdjustConfirm = async (discountAmount) => {
757
757
  try {
758
758
  if (checkoutModule && (orderInfo == null ? void 0 : orderInfo.totalAmount)) {
759
+ const normalizedDiscountAmount = new import_decimal.default(discountAmount || 0).toDecimalPlaces(2, import_decimal.default.ROUND_DOWN).toString();
759
760
  if (dispatch) {
760
761
  dispatch({
761
762
  type: "setState",
762
763
  payload: {
763
- shop_discount: discountAmount
764
+ shop_discount: normalizedDiscountAmount
764
765
  }
765
766
  });
766
767
  }
@@ -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<"stripe" | "payo" | "tyro" | "windcave" | "linkly" | "huifu">;
22
+ readonly eftposRef: React.MutableRefObject<"stripe" | "tyro" | "windcave" | "payo" | "linkly" | "huifu">;
23
23
  readonly clientRef: React.MutableRefObject<ClientEnum>;
24
24
  readonly dataRef: React.MutableRefObject<import("./store").State>;
25
25
  };
@@ -301,8 +301,8 @@ export declare const backUpFree: (payload: Partial<State>) => {
301
301
  amount?: string | number | undefined;
302
302
  mode?: "pay" | "refund" | "fullPay" | "query" | undefined;
303
303
  order_id?: string | number | undefined;
304
- eftpos?: "stripe" | "payo" | "tyro" | "windcave" | "linkly" | "huifu" | undefined;
305
- action?: "pay" | "amount" | "deviceList" | undefined;
304
+ eftpos?: "stripe" | "tyro" | "windcave" | "payo" | "linkly" | "huifu" | undefined;
305
+ action?: "amount" | "pay" | "deviceList" | undefined;
306
306
  key?: number | undefined;
307
307
  step?: number | undefined;
308
308
  title?: string | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pisell/private-materials",
3
- "version": "6.6.30",
3
+ "version": "6.6.32",
4
4
  "main": "./lib/index.js",
5
5
  "module": "./es/index.js",
6
6
  "types": "./lib/index.d.ts",
@@ -61,10 +61,10 @@
61
61
  "styled-components": "^6.0.0-rc.3",
62
62
  "@react-spring/web": "^9.6.1",
63
63
  "@use-gesture/react": "^10.3.1",
64
- "@pisell/materials": "6.6.11",
65
- "@pisell/icon": "0.0.11",
66
64
  "@pisell/utils": "3.0.2",
67
- "@pisell/date-picker": "3.0.7"
65
+ "@pisell/materials": "6.6.11",
66
+ "@pisell/date-picker": "3.0.7",
67
+ "@pisell/icon": "0.0.11"
68
68
  },
69
69
  "peerDependencies": {
70
70
  "react": "^18.0.0",