@pisell/private-materials 3.0.108 → 3.0.109

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.
@@ -32,7 +32,7 @@ import { getProductExtend } from "./utils";
32
32
  import { formatProductListByCategory, getProductTotalPrice, request } from "../../../utils";
33
33
  import { locales, getUniqueId } from '@pisell/utils';
34
34
  import { useUpdateEffect } from 'ahooks';
35
- var shopList = [2886, 4422, 5538, 6930, 6814, 6813, 6812, 6087, 6303, 6080, 6978, 7386, 6848];
35
+ var shopList = [2886, 4422, 5538, 6930, 6814, 6813, 6812, 6087, 6303, 6080, 6978, 7386, 6848, 6305];
36
36
  var Info = function Info() {
37
37
  var _state$service3, _state$service5, _state$service6, _state$service6$cache;
38
38
  var _useState = useState(''),
@@ -1,5 +1,23 @@
1
1
  export declare const getIsBundleOrCombination: (productDetail: any) => boolean;
2
2
  export declare const uniqueByField: (arr: any[], field: string) => any[];
3
3
  export declare const moveItemToFront: (arr: any[], targetId: string | number) => any[];
4
+ /**
5
+ * @title: 判断两个时间是否在同一个时间段内
6
+ * @description:
7
+ * @param {number} time1 开始时间
8
+ * @param {number} time2 结束时间
9
+ * @param {number} interval 时间间隔
10
+ * @return {*}
11
+ * @Author: zhiwei.Wang
12
+ * @Date: 2024-08-13 19:37
13
+ */
4
14
  export declare const isInterval: (time1: number, time2: number, interval?: number) => boolean;
15
+ /**
16
+ * @title: 根据时间间隔格式化服务列表
17
+ * @description: 防止短时间内添加多个相同服务, 如果两个服务的时间间隔小于1秒,则合并为一个服务
18
+ * @param {any} list 服务列表
19
+ * @return {*}
20
+ * @Author: zhiwei.Wang
21
+ * @Date: 2024-08-13 19:36
22
+ */
5
23
  export declare const formatServiceListByTime: (list: any[]) => any[];
@@ -35,18 +35,42 @@ export var moveItemToFront = function moveItemToFront(arr, targetId) {
35
35
  }
36
36
  return arr;
37
37
  };
38
+
39
+ /**
40
+ * @title: 判断两个时间是否在同一个时间段内
41
+ * @description:
42
+ * @param {number} time1 开始时间
43
+ * @param {number} time2 结束时间
44
+ * @param {number} interval 时间间隔
45
+ * @return {*}
46
+ * @Author: zhiwei.Wang
47
+ * @Date: 2024-08-13 19:37
48
+ */
38
49
  export var isInterval = function isInterval(time1, time2) {
39
50
  var interval = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1000;
40
51
  return time2 - time1 < interval;
41
52
  };
53
+
54
+ /**
55
+ * @title: 根据时间间隔格式化服务列表
56
+ * @description: 防止短时间内添加多个相同服务, 如果两个服务的时间间隔小于1秒,则合并为一个服务
57
+ * @param {any} list 服务列表
58
+ * @return {*}
59
+ * @Author: zhiwei.Wang
60
+ * @Date: 2024-08-13 19:36
61
+ */
42
62
  export var formatServiceListByTime = function formatServiceListByTime(list) {
43
63
  try {
44
64
  var _list = _toConsumableArray(list);
45
65
  var length = _list.length;
66
+
67
+ // 如果只有一个服务,则直接返回
46
68
  if (length > 1) {
47
69
  var _list2, _list3;
48
70
  var start = (_list2 = _list[length - 2]) === null || _list2 === void 0 ? void 0 : _list2._time;
49
71
  var end = (_list3 = _list[length - 1]) === null || _list3 === void 0 ? void 0 : _list3._time;
72
+
73
+ // 如果两个服务都有time 并且在同一个时间段内,则合并为一个服务
50
74
  if (start && end && isInterval(start, end)) {
51
75
  _list.pop();
52
76
  return _list;
@@ -60,7 +60,8 @@ var shopList = [
60
60
  6080,
61
61
  6978,
62
62
  7386,
63
- 6848
63
+ 6848,
64
+ 6305
64
65
  ];
65
66
  var Info = () => {
66
67
  var _a, _b, _c, _d;
@@ -1,5 +1,23 @@
1
1
  export declare const getIsBundleOrCombination: (productDetail: any) => boolean;
2
2
  export declare const uniqueByField: (arr: any[], field: string) => any[];
3
3
  export declare const moveItemToFront: (arr: any[], targetId: string | number) => any[];
4
+ /**
5
+ * @title: 判断两个时间是否在同一个时间段内
6
+ * @description:
7
+ * @param {number} time1 开始时间
8
+ * @param {number} time2 结束时间
9
+ * @param {number} interval 时间间隔
10
+ * @return {*}
11
+ * @Author: zhiwei.Wang
12
+ * @Date: 2024-08-13 19:37
13
+ */
4
14
  export declare const isInterval: (time1: number, time2: number, interval?: number) => boolean;
15
+ /**
16
+ * @title: 根据时间间隔格式化服务列表
17
+ * @description: 防止短时间内添加多个相同服务, 如果两个服务的时间间隔小于1秒,则合并为一个服务
18
+ * @param {any} list 服务列表
19
+ * @return {*}
20
+ * @Author: zhiwei.Wang
21
+ * @Date: 2024-08-13 19:36
22
+ */
5
23
  export declare const formatServiceListByTime: (list: any[]) => any[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pisell/private-materials",
3
- "version": "3.0.108",
3
+ "version": "3.0.109",
4
4
  "main": "./lib/index.js",
5
5
  "module": "./es/index.js",
6
6
  "types": "./lib/index.d.ts",
@@ -59,9 +59,9 @@
59
59
  "react-infinite-scroll-component": "^6.1.0",
60
60
  "rc-virtual-list": "^3.11.3",
61
61
  "decimal.js": "^10.4.3",
62
- "@pisell/utils": "1.0.27",
62
+ "@pisell/icon": "0.0.11",
63
63
  "@pisell/date-picker": "1.0.91",
64
- "@pisell/icon": "0.0.11"
64
+ "@pisell/utils": "1.0.27"
65
65
  },
66
66
  "peerDependencies": {
67
67
  "react": "^18.0.0",