@pisell/private-materials 3.0.119 → 3.0.121
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.
- package/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/index.js +1 -1
- package/build/lowcode/meta.js +1 -1
- package/build/lowcode/preview.js +8 -8
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +11 -11
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +10 -10
- package/es/components/booking/addons/index.d.ts +1 -1
- package/es/components/booking/components/TabProduct/productItem/index.d.ts +2 -2
- package/es/components/booking/components/TabProduct/productItem/index.js +8 -7
- package/es/components/booking/forms/index.d.ts +1 -1
- package/es/components/booking/index.d.ts +1 -1
- package/es/components/booking/info/header/index.d.ts +2 -2
- package/es/components/booking/info/header/index.js +436 -44
- package/es/components/booking/info/header/index.less +110 -1
- package/es/components/booking/info/service/addService/index.js +3 -1
- package/es/components/booking/info/service/editService/index.js +3 -1
- package/es/components/booking/locales.d.ts +63 -0
- package/es/components/booking/locales.js +78 -6
- package/es/components/booking/payments/index.d.ts +1 -1
- package/es/components/schedules/components/ScheduleList/RenderScheduleItem/index.d.ts +12 -0
- package/es/components/schedules/components/ScheduleList/RenderScheduleItem/index.js +40 -0
- package/es/components/schedules/components/ScheduleList/RenderScheduleItem/index.less +38 -0
- package/es/components/schedules/components/ScheduleList/index.d.ts +5 -4
- package/es/components/schedules/components/ScheduleList/index.js +53 -43
- package/es/components/schedules/hooks/useSchedulesDataSource.js +5 -3
- package/es/components/schedules/products/list/index.d.ts +2 -2
- package/es/components/schedules/products/list/index.js +8 -8
- package/es/components/schedules/schedules/AllSchedules/index.d.ts +3 -3
- package/es/components/schedules/schedules/AllSchedules/index.js +9 -6
- package/es/components/schedules/schedules/AllSchedules/index.less +11 -3
- package/es/components/schedules/schedules/serve.d.ts +7 -0
- package/es/components/schedules/schedules/serve.js +24 -3
- package/es/components/schedules/schedules/utils.d.ts +22 -0
- package/es/components/schedules/schedules/utils.js +143 -1
- package/es/components/schedules/type.d.ts +7 -0
- package/es/components/tabProduct/index.d.ts +3 -2
- package/es/components/tabProduct/index.js +27 -18
- package/es/components/tabProduct/tabs/index.d.ts +3 -3
- package/es/components/tabProduct/tabs/index.js +34 -21
- package/lib/components/booking/addons/index.d.ts +1 -1
- package/lib/components/booking/components/TabProduct/productItem/index.d.ts +2 -2
- package/lib/components/booking/components/TabProduct/productItem/index.js +2 -1
- package/lib/components/booking/forms/index.d.ts +1 -1
- package/lib/components/booking/index.d.ts +1 -1
- package/lib/components/booking/info/header/index.d.ts +2 -2
- package/lib/components/booking/info/header/index.js +212 -11
- package/lib/components/booking/info/header/index.less +110 -1
- package/lib/components/booking/info/service/addService/index.js +3 -1
- package/lib/components/booking/info/service/editService/index.js +3 -1
- package/lib/components/booking/locales.d.ts +63 -0
- package/lib/components/booking/locales.js +72 -6
- package/lib/components/booking/payments/index.d.ts +1 -1
- package/lib/components/schedules/components/ScheduleList/RenderScheduleItem/index.d.ts +12 -0
- package/lib/components/schedules/components/ScheduleList/RenderScheduleItem/index.js +77 -0
- package/lib/components/schedules/components/ScheduleList/RenderScheduleItem/index.less +38 -0
- package/lib/components/schedules/components/ScheduleList/index.d.ts +5 -4
- package/lib/components/schedules/components/ScheduleList/index.js +38 -31
- package/lib/components/schedules/hooks/useSchedulesDataSource.js +8 -2
- package/lib/components/schedules/products/list/index.d.ts +2 -2
- package/lib/components/schedules/schedules/AllSchedules/index.d.ts +3 -3
- package/lib/components/schedules/schedules/AllSchedules/index.js +3 -2
- package/lib/components/schedules/schedules/AllSchedules/index.less +11 -3
- package/lib/components/schedules/schedules/serve.d.ts +7 -0
- package/lib/components/schedules/schedules/serve.js +5 -2
- package/lib/components/schedules/schedules/utils.d.ts +22 -0
- package/lib/components/schedules/schedules/utils.js +98 -0
- package/lib/components/schedules/type.d.ts +7 -0
- package/lib/components/tabProduct/index.d.ts +3 -2
- package/lib/components/tabProduct/index.js +15 -6
- package/lib/components/tabProduct/tabs/index.d.ts +3 -3
- package/lib/components/tabProduct/tabs/index.js +10 -6
- package/package.json +4 -4
|
@@ -6,7 +6,7 @@ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefine
|
|
|
6
6
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
7
|
import { useEffect, useState } from "react";
|
|
8
8
|
import { useRequest } from "ahooks";
|
|
9
|
-
import {
|
|
9
|
+
import { postScheduleList } from "../schedules/serve";
|
|
10
10
|
var useSchedulesDataSource = function useSchedulesDataSource(params) {
|
|
11
11
|
var _ref = params || {},
|
|
12
12
|
scheduleIds = _ref.scheduleIds;
|
|
@@ -14,7 +14,7 @@ var useSchedulesDataSource = function useSchedulesDataSource(params) {
|
|
|
14
14
|
_useState2 = _slicedToArray(_useState, 2),
|
|
15
15
|
dataSource = _useState2[0],
|
|
16
16
|
setDataSource = _useState2[1];
|
|
17
|
-
var _useRequest = useRequest(
|
|
17
|
+
var _useRequest = useRequest(postScheduleList, {
|
|
18
18
|
manual: true,
|
|
19
19
|
onSuccess: function onSuccess(result, params) {
|
|
20
20
|
if (result.status) {
|
|
@@ -29,7 +29,9 @@ var useSchedulesDataSource = function useSchedulesDataSource(params) {
|
|
|
29
29
|
run({
|
|
30
30
|
ids: scheduleIds,
|
|
31
31
|
skip: 1,
|
|
32
|
-
num:
|
|
32
|
+
num: 500,
|
|
33
|
+
with: ['relation', 'timeSlot'],
|
|
34
|
+
with_count: ['relation', 'order']
|
|
33
35
|
});
|
|
34
36
|
}, [scheduleIds]);
|
|
35
37
|
return {
|
|
@@ -10,20 +10,20 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
10
10
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
11
11
|
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
12
12
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
13
|
-
import React, { useState, useMemo, useContext } from
|
|
13
|
+
import React, { useState, useMemo, useContext } from 'react';
|
|
14
14
|
import TabProduct from "../../../tabProduct";
|
|
15
15
|
import Search from "../../components/Search";
|
|
16
16
|
import { formatProductListByCategory } from "../utils";
|
|
17
17
|
import { Context } from "../../model";
|
|
18
18
|
import EmptyCom from "../../../booking/components/emptyBooking";
|
|
19
19
|
import ProductItem from "./ProductItem";
|
|
20
|
-
import { Skeleton } from
|
|
20
|
+
import { Skeleton } from 'antd';
|
|
21
21
|
import "./index.less";
|
|
22
|
-
import { locales } from
|
|
22
|
+
import { locales } from '@pisell/utils';
|
|
23
23
|
var ProductList = function ProductList(_ref) {
|
|
24
24
|
var loading = _ref.loading,
|
|
25
25
|
list = _ref.list;
|
|
26
|
-
var _useState = useState(
|
|
26
|
+
var _useState = useState(''),
|
|
27
27
|
_useState2 = _slicedToArray(_useState, 2),
|
|
28
28
|
search = _useState2[0],
|
|
29
29
|
setSearch = _useState2[1];
|
|
@@ -49,7 +49,7 @@ var ProductList = function ProductList(_ref) {
|
|
|
49
49
|
return isIncludes(item.title);
|
|
50
50
|
} : undefined);
|
|
51
51
|
}, [search, list, currentSelectDayDetail]);
|
|
52
|
-
console.log(
|
|
52
|
+
console.log('state.scheduleMap', renderList);
|
|
53
53
|
var searchChange = function searchChange(e) {
|
|
54
54
|
setSearch(e);
|
|
55
55
|
};
|
|
@@ -62,7 +62,7 @@ var ProductList = function ProductList(_ref) {
|
|
|
62
62
|
};
|
|
63
63
|
if (currentSelectDayDetail) {
|
|
64
64
|
newData = {
|
|
65
|
-
tabKey:
|
|
65
|
+
tabKey: 'schedules',
|
|
66
66
|
products: _objectSpread(_objectSpread({}, products), {}, {
|
|
67
67
|
currentProduct: item,
|
|
68
68
|
openProductDetailDrawer: !currentSelectDayDetail
|
|
@@ -70,13 +70,13 @@ var ProductList = function ProductList(_ref) {
|
|
|
70
70
|
};
|
|
71
71
|
}
|
|
72
72
|
dispatch({
|
|
73
|
-
type:
|
|
73
|
+
type: 'setState',
|
|
74
74
|
payload: newData
|
|
75
75
|
});
|
|
76
76
|
};
|
|
77
77
|
var empty = useMemo(function () {
|
|
78
78
|
return /*#__PURE__*/React.createElement(EmptyCom, {
|
|
79
|
-
description: locales.getText(
|
|
79
|
+
description: locales.getText('pisell2.text.products.no-products')
|
|
80
80
|
});
|
|
81
81
|
}, []);
|
|
82
82
|
var listDom = useMemo(function () {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { ScheduleItem } from
|
|
3
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ScheduleItem } from '../../type';
|
|
3
|
+
import './index.less';
|
|
4
4
|
declare type AllSchedulesPropsType = {
|
|
5
5
|
onOpenDetail?: (id?: number) => void;
|
|
6
6
|
dataSource: ScheduleItem[];
|
|
@@ -4,12 +4,12 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
4
4
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
5
5
|
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
6
6
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
-
import React, { useMemo, useState } from
|
|
8
|
-
import { Button } from
|
|
7
|
+
import React, { useMemo, useState } from 'react';
|
|
8
|
+
import { Button } from 'antd';
|
|
9
9
|
import Search from "../../components/Search";
|
|
10
10
|
import ScheduleList from "../../components/ScheduleList";
|
|
11
11
|
import "./index.less";
|
|
12
|
-
import { locales } from
|
|
12
|
+
import { locales } from '@pisell/utils';
|
|
13
13
|
/**
|
|
14
14
|
* 所有schedules列表
|
|
15
15
|
* @param props
|
|
@@ -19,7 +19,7 @@ var AllSchedules = function AllSchedules(props) {
|
|
|
19
19
|
var onOpenDetail = props.onOpenDetail,
|
|
20
20
|
dataSource = props.dataSource,
|
|
21
21
|
loading = props.loading;
|
|
22
|
-
var _useState = useState(
|
|
22
|
+
var _useState = useState(''),
|
|
23
23
|
_useState2 = _slicedToArray(_useState, 2),
|
|
24
24
|
search = _useState2[0],
|
|
25
25
|
setSearch = _useState2[1];
|
|
@@ -42,8 +42,11 @@ var AllSchedules = function AllSchedules(props) {
|
|
|
42
42
|
dataSource: showDataSource,
|
|
43
43
|
onItemClick: function onItemClick(item) {
|
|
44
44
|
return onOpenDetail === null || onOpenDetail === void 0 ? void 0 : onOpenDetail(item.id);
|
|
45
|
-
}
|
|
46
|
-
|
|
45
|
+
},
|
|
46
|
+
showTabs: true
|
|
47
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
48
|
+
className: "pisell-lowcode__schedules-module-add-button-wrap"
|
|
49
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
47
50
|
className: "pisell-lowcode__schedules-module-add-button",
|
|
48
51
|
onClick: function onClick() {
|
|
49
52
|
return onOpenDetail === null || onOpenDetail === void 0 ? void 0 : onOpenDetail();
|
|
@@ -2,13 +2,21 @@
|
|
|
2
2
|
height: 100%;
|
|
3
3
|
display: flex;
|
|
4
4
|
flex-direction: column;
|
|
5
|
+
overflow-y: auto;
|
|
6
|
+
padding: 0 32px;
|
|
5
7
|
.pisell-lowcode__schedules-module-header {
|
|
6
|
-
padding: 16px
|
|
8
|
+
padding: 16px 0 0;
|
|
7
9
|
}
|
|
8
10
|
.pisell-lowcode__schedules-module-content {
|
|
9
|
-
padding:
|
|
11
|
+
padding: 0;
|
|
10
12
|
flex: 1;
|
|
11
|
-
overflow:
|
|
13
|
+
overflow:initial;
|
|
14
|
+
}
|
|
15
|
+
.pisell-lowcode__schedules-module-add-button-wrap{
|
|
16
|
+
position: sticky;
|
|
17
|
+
bottom: 0;
|
|
18
|
+
z-index: 1;
|
|
19
|
+
background: #fff
|
|
12
20
|
}
|
|
13
21
|
.pisell-lowcode__schedules-module-add-button {
|
|
14
22
|
margin: 24px 32px;
|
|
@@ -4,6 +4,13 @@ export declare const getScheduleList: (params: {
|
|
|
4
4
|
num: number;
|
|
5
5
|
ids?: number[];
|
|
6
6
|
}) => Promise<ResponseListData<ScheduleItem[]>>;
|
|
7
|
+
export declare const postScheduleList: (params: {
|
|
8
|
+
skip: number;
|
|
9
|
+
num: number;
|
|
10
|
+
ids?: number[];
|
|
11
|
+
with?: Array<string>;
|
|
12
|
+
with_count?: Array<string>;
|
|
13
|
+
}) => Promise<ResponseListData<ScheduleItem[]>>;
|
|
7
14
|
export declare const deleteSchedule: (params: {
|
|
8
15
|
id: number;
|
|
9
16
|
}) => Promise<ResponseListData<ScheduleItem[]>>;
|
|
@@ -22,13 +22,15 @@ export var getScheduleList = /*#__PURE__*/function () {
|
|
|
22
22
|
return _ref.apply(this, arguments);
|
|
23
23
|
};
|
|
24
24
|
}();
|
|
25
|
-
|
|
25
|
+
|
|
26
|
+
// 获取日程接口
|
|
27
|
+
export var postScheduleList = /*#__PURE__*/function () {
|
|
26
28
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(params) {
|
|
27
29
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
28
30
|
while (1) switch (_context2.prev = _context2.next) {
|
|
29
31
|
case 0:
|
|
30
32
|
_context2.next = 2;
|
|
31
|
-
return request.getRequest().
|
|
33
|
+
return request.getRequest().post("/shop/schedule/v2", params);
|
|
32
34
|
case 2:
|
|
33
35
|
return _context2.abrupt("return", _context2.sent);
|
|
34
36
|
case 3:
|
|
@@ -37,7 +39,26 @@ export var deleteSchedule = /*#__PURE__*/function () {
|
|
|
37
39
|
}
|
|
38
40
|
}, _callee2);
|
|
39
41
|
}));
|
|
40
|
-
return function
|
|
42
|
+
return function postScheduleList(_x2) {
|
|
41
43
|
return _ref2.apply(this, arguments);
|
|
42
44
|
};
|
|
45
|
+
}();
|
|
46
|
+
export var deleteSchedule = /*#__PURE__*/function () {
|
|
47
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(params) {
|
|
48
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
49
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
50
|
+
case 0:
|
|
51
|
+
_context3.next = 2;
|
|
52
|
+
return request.getRequest().remove("/shop/schedule/".concat(params.id));
|
|
53
|
+
case 2:
|
|
54
|
+
return _context3.abrupt("return", _context3.sent);
|
|
55
|
+
case 3:
|
|
56
|
+
case "end":
|
|
57
|
+
return _context3.stop();
|
|
58
|
+
}
|
|
59
|
+
}, _callee3);
|
|
60
|
+
}));
|
|
61
|
+
return function deleteSchedule(_x3) {
|
|
62
|
+
return _ref3.apply(this, arguments);
|
|
63
|
+
};
|
|
43
64
|
}();
|
|
@@ -48,3 +48,25 @@ export declare const formatScheduleResult: (schedule: ScheduleItem) => {
|
|
|
48
48
|
export declare const calcScheduleDateRange: (schedule: ScheduleItem) => any[];
|
|
49
49
|
export declare const calcCalendarDataBySchedules: (schedules: ScheduleItem[]) => unknown[];
|
|
50
50
|
export declare const calcMinTimeMaxTimeBySchedules: (schedules: ScheduleItem[], scheduleAllMap: FormState["schedules"]["scheduleAllMap"], selectDate?: string) => {};
|
|
51
|
+
/**
|
|
52
|
+
* @title: 格式化日程数据
|
|
53
|
+
* @description:
|
|
54
|
+
* @param {Array} relation 资源列表
|
|
55
|
+
* @param {string} table_type 关联表类型
|
|
56
|
+
* @param {string} item_type 资源类型
|
|
57
|
+
* @param {boolean} isExcluded 是否排除
|
|
58
|
+
* @return {*}
|
|
59
|
+
* @Author: WangHan
|
|
60
|
+
* @Date: 2024-09-04 11:54
|
|
61
|
+
*/
|
|
62
|
+
export declare const formatScheduleData: (relation: Array<any>, table_type?: string, item_type?: string, isExcluded?: boolean) => any;
|
|
63
|
+
/**
|
|
64
|
+
* @title: 格式化日程为二维结构
|
|
65
|
+
* @description:
|
|
66
|
+
* @param {any} list
|
|
67
|
+
* @param {any} filterItem
|
|
68
|
+
* @return {*}
|
|
69
|
+
* @Author: WangHan
|
|
70
|
+
* @Date: 2024-07-29 19:28
|
|
71
|
+
*/
|
|
72
|
+
export declare const formatScheduleListByTabs: (list: any, filterItem?: any) => unknown[];
|
|
@@ -11,7 +11,7 @@ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symb
|
|
|
11
11
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
12
12
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
13
13
|
import dayjs from "dayjs";
|
|
14
|
-
import { isArr } from "@pisell/utils";
|
|
14
|
+
import { isArr, locales } from "@pisell/utils";
|
|
15
15
|
/**
|
|
16
16
|
* 根据日程配置生成日历数据
|
|
17
17
|
* @param values
|
|
@@ -655,4 +655,146 @@ export var calcMinTimeMaxTimeBySchedules = function calcMinTimeMaxTimeBySchedule
|
|
|
655
655
|
dateRangeFormat: dateRangeFormat
|
|
656
656
|
}));
|
|
657
657
|
}, {});
|
|
658
|
+
};
|
|
659
|
+
|
|
660
|
+
/**
|
|
661
|
+
* @title: 格式化日程数据
|
|
662
|
+
* @description:
|
|
663
|
+
* @param {Array} relation 资源列表
|
|
664
|
+
* @param {string} table_type 关联表类型
|
|
665
|
+
* @param {string} item_type 资源类型
|
|
666
|
+
* @param {boolean} isExcluded 是否排除
|
|
667
|
+
* @return {*}
|
|
668
|
+
* @Author: WangHan
|
|
669
|
+
* @Date: 2024-09-04 11:54
|
|
670
|
+
*/
|
|
671
|
+
export var formatScheduleData = function formatScheduleData(relation, table_type, item_type, isExcluded) {
|
|
672
|
+
var _relation = relation || [];
|
|
673
|
+
// 有关联表类型和资源类型并且排除
|
|
674
|
+
if (table_type && item_type && isExcluded) {
|
|
675
|
+
return _relation.find(function (item) {
|
|
676
|
+
return (item === null || item === void 0 ? void 0 : item.relation_table_type) === table_type && (item === null || item === void 0 ? void 0 : item.item_type) !== item_type;
|
|
677
|
+
});
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
// 有关联表类型和资源类型
|
|
681
|
+
if (table_type && item_type) {
|
|
682
|
+
return _relation.find(function (item) {
|
|
683
|
+
return (item === null || item === void 0 ? void 0 : item.relation_table_type) === table_type && (item === null || item === void 0 ? void 0 : item.item_type) === item_type;
|
|
684
|
+
});
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
// 有关联表类型
|
|
688
|
+
if (table_type) {
|
|
689
|
+
return _relation.some(function (item) {
|
|
690
|
+
return (item === null || item === void 0 ? void 0 : item.relation_table_type) === table_type;
|
|
691
|
+
});
|
|
692
|
+
}
|
|
693
|
+
|
|
694
|
+
// 有关联资源类型
|
|
695
|
+
if (item_type) {
|
|
696
|
+
return _relation.find(function (item) {
|
|
697
|
+
return (item === null || item === void 0 ? void 0 : item.item_type) === item_type;
|
|
698
|
+
});
|
|
699
|
+
}
|
|
700
|
+
};
|
|
701
|
+
|
|
702
|
+
/**
|
|
703
|
+
* @title: 格式化日程为二维结构
|
|
704
|
+
* @description:
|
|
705
|
+
* @param {any} list
|
|
706
|
+
* @param {any} filterItem
|
|
707
|
+
* @return {*}
|
|
708
|
+
* @Author: WangHan
|
|
709
|
+
* @Date: 2024-07-29 19:28
|
|
710
|
+
*/
|
|
711
|
+
export var formatScheduleListByTabs = function formatScheduleListByTabs(list, filterItem) {
|
|
712
|
+
var _list = list || [];
|
|
713
|
+
if (filterItem) {
|
|
714
|
+
_list = _list.filter(filterItem);
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
// 日程分类
|
|
718
|
+
var categoryObject = {
|
|
719
|
+
// 全部
|
|
720
|
+
all: {
|
|
721
|
+
id: 0,
|
|
722
|
+
name: locales.getText('pisell2.schedule.tab.all'),
|
|
723
|
+
products: _list
|
|
724
|
+
},
|
|
725
|
+
// 附加费
|
|
726
|
+
surcharge: {
|
|
727
|
+
id: 1,
|
|
728
|
+
name: locales.getText('pisell2.schedule.tab.surcharge'),
|
|
729
|
+
products: []
|
|
730
|
+
},
|
|
731
|
+
// 资源
|
|
732
|
+
resources: {
|
|
733
|
+
id: 2,
|
|
734
|
+
name: locales.getText('pisell2.schedule.tab.resources'),
|
|
735
|
+
products: []
|
|
736
|
+
},
|
|
737
|
+
// 商品
|
|
738
|
+
products: {
|
|
739
|
+
id: 3,
|
|
740
|
+
name: locales.getText('pisell2.schedule.tab.products'),
|
|
741
|
+
products: []
|
|
742
|
+
},
|
|
743
|
+
// 活动
|
|
744
|
+
events: {
|
|
745
|
+
id: 4,
|
|
746
|
+
name: locales.getText('pisell2.schedule.tab.events'),
|
|
747
|
+
products: []
|
|
748
|
+
},
|
|
749
|
+
// 报价单
|
|
750
|
+
quotation: {
|
|
751
|
+
id: 5,
|
|
752
|
+
name: locales.getText('pisell2.schedule.tab.quotation'),
|
|
753
|
+
products: []
|
|
754
|
+
},
|
|
755
|
+
// 营业时间
|
|
756
|
+
"open-hours": {
|
|
757
|
+
id: 6,
|
|
758
|
+
name: locales.getText('pisell2.schedule.tab.open-hours'),
|
|
759
|
+
products: []
|
|
760
|
+
}
|
|
761
|
+
};
|
|
762
|
+
for (var i = 0; i < _list.length; i++) {
|
|
763
|
+
var productItem = _list[i];
|
|
764
|
+
var _relation = productItem.relation || [];
|
|
765
|
+
|
|
766
|
+
// 附加费
|
|
767
|
+
if (formatScheduleData(_relation, 'custom_surcharge')) {
|
|
768
|
+
categoryObject.surcharge.products.push(productItem);
|
|
769
|
+
}
|
|
770
|
+
// 资源
|
|
771
|
+
if (formatScheduleData(_relation, 'form', 'opening_hours', true)) {
|
|
772
|
+
categoryObject.resources.products.push(productItem);
|
|
773
|
+
}
|
|
774
|
+
// 商品
|
|
775
|
+
if (formatScheduleData(_relation, 'product')) {
|
|
776
|
+
categoryObject.products.products.push(productItem);
|
|
777
|
+
}
|
|
778
|
+
// 活动
|
|
779
|
+
if (formatScheduleData(_relation, 'product', 'event_item')) {
|
|
780
|
+
categoryObject.events.products.push(productItem);
|
|
781
|
+
}
|
|
782
|
+
// 报价单
|
|
783
|
+
if (formatScheduleData(_relation, 'shelf', 'quotation')) {
|
|
784
|
+
categoryObject.quotation.products.push(productItem);
|
|
785
|
+
}
|
|
786
|
+
// 营业时间
|
|
787
|
+
if (formatScheduleData(_relation, '', 'opening_hours')) {
|
|
788
|
+
categoryObject['open-hours'].products.push(productItem);
|
|
789
|
+
}
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
// 子级没有数据则不显示该tab
|
|
793
|
+
Object.keys(categoryObject).forEach(function (cur) {
|
|
794
|
+
var _categoryObject$cur, _categoryObject$cur$p;
|
|
795
|
+
if ((categoryObject === null || categoryObject === void 0 ? void 0 : (_categoryObject$cur = categoryObject[cur]) === null || _categoryObject$cur === void 0 ? void 0 : (_categoryObject$cur$p = _categoryObject$cur.products) === null || _categoryObject$cur$p === void 0 ? void 0 : _categoryObject$cur$p.length) === 0) {
|
|
796
|
+
delete categoryObject[cur];
|
|
797
|
+
}
|
|
798
|
+
});
|
|
799
|
+
return Object.values(categoryObject);
|
|
658
800
|
};
|
|
@@ -57,6 +57,13 @@ export declare type ScheduleItem = {
|
|
|
57
57
|
/** 是否全天 */
|
|
58
58
|
is_all: 1 | 0;
|
|
59
59
|
[key: string]: any;
|
|
60
|
+
relation?: {
|
|
61
|
+
id: number;
|
|
62
|
+
item_id: number;
|
|
63
|
+
item_type: string;
|
|
64
|
+
relation_table_type: string;
|
|
65
|
+
schedule_id: number;
|
|
66
|
+
}[];
|
|
60
67
|
};
|
|
61
68
|
export declare type ScheduleFormOtherValue = {
|
|
62
69
|
/** 截止模式
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './index.less';
|
|
3
3
|
export interface TabProductProps {
|
|
4
4
|
list?: any[];
|
|
5
5
|
scrollDom?: string;
|
|
@@ -10,6 +10,7 @@ export interface TabProductProps {
|
|
|
10
10
|
listWrapClassName?: string;
|
|
11
11
|
warpClassName?: string;
|
|
12
12
|
stickyTop?: number;
|
|
13
|
+
name?: string | number;
|
|
13
14
|
}
|
|
14
15
|
declare const TabProduct: (props: TabProductProps) => React.JSX.Element;
|
|
15
16
|
export default TabProduct;
|
|
@@ -5,25 +5,27 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
5
5
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
6
6
|
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
7
7
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
8
|
-
import React, { useEffect, useState, useRef } from
|
|
8
|
+
import React, { useEffect, useState, useRef } from 'react';
|
|
9
9
|
import Tabs from "./tabs";
|
|
10
10
|
import Card from "./card";
|
|
11
|
-
import classNames from
|
|
11
|
+
import classNames from 'classnames';
|
|
12
12
|
import "./index.less";
|
|
13
13
|
var io = null;
|
|
14
|
+
var tabsHeight = 92;
|
|
14
15
|
var TabProduct = function TabProduct(props) {
|
|
15
16
|
var _props$list = props.list,
|
|
16
17
|
list = _props$list === void 0 ? [] : _props$list,
|
|
17
18
|
scrollDom = props.scrollDom,
|
|
18
19
|
_props$rowKey = props.rowKey,
|
|
19
|
-
rowKey = _props$rowKey === void 0 ?
|
|
20
|
+
rowKey = _props$rowKey === void 0 ? 'id' : _props$rowKey,
|
|
20
21
|
tabsWrapClassName = props.tabsWrapClassName,
|
|
21
22
|
categoryWrapClassName = props.categoryWrapClassName,
|
|
22
23
|
listWrapClassName = props.listWrapClassName,
|
|
23
24
|
renderItem = props.renderItem,
|
|
24
25
|
warpClassName = props.warpClassName,
|
|
25
26
|
_props$stickyTop = props.stickyTop,
|
|
26
|
-
stickyTop = _props$stickyTop === void 0 ? 0 : _props$stickyTop
|
|
27
|
+
stickyTop = _props$stickyTop === void 0 ? 0 : _props$stickyTop,
|
|
28
|
+
name = props.name;
|
|
27
29
|
var tabsRef = useRef();
|
|
28
30
|
var _useState = useState(1),
|
|
29
31
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -36,19 +38,25 @@ var TabProduct = function TabProduct(props) {
|
|
|
36
38
|
}
|
|
37
39
|
}, [list]);
|
|
38
40
|
var handleObserver = function handleObserver() {
|
|
41
|
+
var _document$querySelect;
|
|
42
|
+
var domHeight = scrollDom ? ((_document$querySelect = document.querySelector(scrollDom)) === null || _document$querySelect === void 0 ? void 0 : _document$querySelect.clientHeight) || window.innerHeight : window.innerHeight;
|
|
43
|
+
var marginTop = "-".concat(tabsHeight, "px");
|
|
44
|
+
var marginBottom = "-".concat(domHeight - tabsHeight - 10, "px");
|
|
39
45
|
io = new IntersectionObserver(function (entries) {
|
|
40
46
|
console.log(entries);
|
|
41
47
|
if (entries[0].isIntersecting) {
|
|
42
48
|
var _entries$, _entries$$target, _entries$$target$id, _tabsRef$current;
|
|
43
|
-
var _entries$0$target$id$ = (_entries$ = entries[0]) === null || _entries$ === void 0 ? void 0 : (_entries$$target = _entries$.target) === null || _entries$$target === void 0 ? void 0 : (_entries$$target$id = _entries$$target.id) === null || _entries$$target$id === void 0 ? void 0 : _entries$$target$id.split(
|
|
49
|
+
var _entries$0$target$id$ = (_entries$ = entries[0]) === null || _entries$ === void 0 ? void 0 : (_entries$$target = _entries$.target) === null || _entries$$target === void 0 ? void 0 : (_entries$$target$id = _entries$$target.id) === null || _entries$$target$id === void 0 ? void 0 : _entries$$target$id.split('-'),
|
|
44
50
|
_entries$0$target$id$2 = _slicedToArray(_entries$0$target$id$, 2),
|
|
45
|
-
|
|
51
|
+
_name = _entries$0$target$id$2[0],
|
|
46
52
|
id = _entries$0$target$id$2[1];
|
|
47
53
|
setCurrent(Number(id));
|
|
48
54
|
tabsRef === null || tabsRef === void 0 ? void 0 : (_tabsRef$current = tabsRef.current) === null || _tabsRef$current === void 0 ? void 0 : _tabsRef$current.scroll(id);
|
|
49
55
|
}
|
|
50
56
|
}, {
|
|
51
|
-
root: scrollDom ? document.querySelector(scrollDom) : null
|
|
57
|
+
root: scrollDom ? document.querySelector(scrollDom) : null,
|
|
58
|
+
rootMargin: "".concat(marginTop, " 0px ").concat(marginBottom)
|
|
59
|
+
// threshold: 0.5,
|
|
52
60
|
// rootMargin: ,
|
|
53
61
|
});
|
|
54
62
|
|
|
@@ -90,26 +98,27 @@ var TabProduct = function TabProduct(props) {
|
|
|
90
98
|
}
|
|
91
99
|
};
|
|
92
100
|
return /*#__PURE__*/React.createElement("div", {
|
|
93
|
-
className: classNames(
|
|
101
|
+
className: classNames('tab-product', warpClassName)
|
|
94
102
|
}, /*#__PURE__*/React.createElement("div", {
|
|
95
|
-
className:
|
|
103
|
+
className: 'tabs-wrap',
|
|
96
104
|
style: {
|
|
97
105
|
top: stickyTop
|
|
98
106
|
}
|
|
99
107
|
}, /*#__PURE__*/React.createElement(Card, {
|
|
100
|
-
className: classNames(
|
|
101
|
-
id: "product-category"
|
|
108
|
+
className: classNames('tabs', tabsWrapClassName),
|
|
109
|
+
id: "".concat(name || 'product', "-category")
|
|
102
110
|
}, /*#__PURE__*/React.createElement(Tabs, {
|
|
103
111
|
ref: tabsRef,
|
|
104
112
|
options: list,
|
|
105
113
|
rowKey: rowKey,
|
|
106
114
|
tab: current,
|
|
115
|
+
name: name,
|
|
107
116
|
onChange: function onChange(e) {
|
|
108
117
|
var _document, _document2;
|
|
109
|
-
var dom = (_document = document) === null || _document === void 0 ? void 0 : _document.querySelector(
|
|
110
|
-
var main = (_document2 = document) === null || _document2 === void 0 ? void 0 : _document2.querySelector(scrollDom ||
|
|
118
|
+
var dom = (_document = document) === null || _document === void 0 ? void 0 : _document.querySelector('#list-' + e);
|
|
119
|
+
var main = (_document2 = document) === null || _document2 === void 0 ? void 0 : _document2.querySelector(scrollDom || '');
|
|
111
120
|
if (dom && main) {
|
|
112
|
-
main.scrollTop = dom.offsetTop -
|
|
121
|
+
main.scrollTop = dom.offsetTop - 42;
|
|
113
122
|
}
|
|
114
123
|
handleUnObserver();
|
|
115
124
|
setCurrent(e);
|
|
@@ -118,16 +127,16 @@ var TabProduct = function TabProduct(props) {
|
|
|
118
127
|
}, 1000);
|
|
119
128
|
}
|
|
120
129
|
}))), /*#__PURE__*/React.createElement("div", {
|
|
121
|
-
className: classNames(
|
|
130
|
+
className: classNames('category-list', categoryWrapClassName)
|
|
122
131
|
}, list.map(function (d, i) {
|
|
123
132
|
return /*#__PURE__*/React.createElement("div", {
|
|
124
|
-
className:
|
|
133
|
+
className: 'category-item',
|
|
125
134
|
id: "list-".concat(d[rowKey]),
|
|
126
135
|
key: i
|
|
127
136
|
}, /*#__PURE__*/React.createElement("div", {
|
|
128
|
-
className:
|
|
137
|
+
className: 'category-title'
|
|
129
138
|
}, d.name), /*#__PURE__*/React.createElement("div", {
|
|
130
|
-
className: classNames(
|
|
139
|
+
className: classNames('product-list', listWrapClassName)
|
|
131
140
|
}, d.products.map(function (item, index) {
|
|
132
141
|
if (renderItem) {
|
|
133
142
|
return renderItem(item);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './index.less';
|
|
3
3
|
export interface Com<T> extends React.FC<T> {
|
|
4
4
|
}
|
|
5
5
|
export declare type RowKey = string | number;
|
|
@@ -7,7 +7,7 @@ export interface Option {
|
|
|
7
7
|
id: number | string;
|
|
8
8
|
name: React.ReactNode;
|
|
9
9
|
}
|
|
10
|
-
export interface TabsProps extends Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>,
|
|
10
|
+
export interface TabsProps extends Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, 'onChange'> {
|
|
11
11
|
renderTab: (item: any) => React.ReactNode;
|
|
12
12
|
rowKey: RowKey;
|
|
13
13
|
name: RowKey;
|