@pisell/private-materials 3.0.16 → 3.0.18
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 +7 -7
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +9 -9
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +8 -8
- package/es/components/booking/addons/index.js +148 -32
- package/es/components/booking/components/TabProduct/selectProductItem/index.js +21 -8
- package/es/components/booking/components/TabProduct/selectProductItem/index.less +34 -27
- package/es/components/booking/components/collapsibleList/index.d.ts +11 -0
- package/es/components/booking/components/collapsibleList/index.js +99 -0
- package/es/components/booking/components/collapsibleList/index.less +61 -0
- package/es/components/booking/components/collapsibleList/utils.d.ts +2 -0
- package/es/components/booking/components/collapsibleList/utils.js +21 -0
- package/es/components/booking/components/footer/amount.js +9 -10
- package/es/components/booking/components/footer/utils.d.ts +18 -0
- package/es/components/booking/components/footer/utils.js +76 -4
- package/es/components/booking/forms/single/index.js +16 -82
- package/es/components/booking/info/service/addService/index.js +47 -24
- package/es/components/booking/info/service/editService/index.js +49 -24
- package/es/components/booking/info/service/editService/index.less +21 -0
- package/es/components/booking/info/service/index.d.ts +2 -2
- package/es/components/booking/info/service/index.js +5 -129
- package/es/components/booking/info/service/index.less +0 -97
- package/es/components/booking/info/service/serviceItem/index.d.ts +4 -0
- package/es/components/booking/info/service/serviceItem/index.js +63 -0
- package/es/components/booking/info/service/serviceItem/index.less +97 -0
- package/es/components/booking/info/service/serviceList/index.d.ts +4 -0
- package/es/components/booking/info/service/serviceList/index.js +105 -0
- package/es/components/booking/info/service/serviceList/index.less +0 -0
- package/es/components/booking/utils.d.ts +1 -0
- package/es/components/booking/utils.js +15 -0
- package/lib/components/booking/addons/index.js +159 -35
- package/lib/components/booking/components/TabProduct/selectProductItem/index.js +33 -8
- package/lib/components/booking/components/TabProduct/selectProductItem/index.less +34 -27
- package/lib/components/booking/components/collapsibleList/index.d.ts +11 -0
- package/lib/components/booking/components/collapsibleList/index.js +94 -0
- package/lib/components/booking/components/collapsibleList/index.less +61 -0
- package/lib/components/booking/components/collapsibleList/utils.d.ts +2 -0
- package/lib/components/booking/components/collapsibleList/utils.js +46 -0
- package/lib/components/booking/components/footer/amount.js +9 -10
- package/lib/components/booking/components/footer/utils.d.ts +18 -0
- package/lib/components/booking/components/footer/utils.js +46 -7
- package/lib/components/booking/forms/single/index.js +12 -48
- package/lib/components/booking/info/service/addService/index.js +57 -36
- package/lib/components/booking/info/service/editService/index.js +76 -56
- package/lib/components/booking/info/service/editService/index.less +21 -0
- package/lib/components/booking/info/service/index.d.ts +2 -2
- package/lib/components/booking/info/service/index.js +4 -112
- package/lib/components/booking/info/service/index.less +0 -97
- package/lib/components/booking/info/service/serviceItem/index.d.ts +4 -0
- package/lib/components/booking/info/service/serviceItem/index.js +98 -0
- package/lib/components/booking/info/service/serviceItem/index.less +97 -0
- package/lib/components/booking/info/service/serviceList/index.d.ts +4 -0
- package/lib/components/booking/info/service/serviceList/index.js +129 -0
- package/lib/components/booking/info/service/serviceList/index.less +0 -0
- package/lib/components/booking/utils.d.ts +1 -0
- package/lib/components/booking/utils.js +15 -0
- package/package.json +2 -2
|
@@ -1,138 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
3
|
-
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
5
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
6
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
7
|
-
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; }
|
|
8
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
9
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
10
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
11
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
12
|
-
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
13
|
-
import React, { useCallback, useContext, useEffect } from "react";
|
|
14
|
-
import { Context } from "../model";
|
|
15
|
-
import { formatAmount, locales } from "@pisell/utils";
|
|
1
|
+
import React, { useEffect } from "react";
|
|
16
2
|
import AddService from "./addService";
|
|
17
3
|
import EditService from "./editService";
|
|
18
|
-
import { Alert } from "antd";
|
|
19
4
|
import "./index.less";
|
|
20
|
-
import
|
|
21
|
-
|
|
22
|
-
import Like from "./like";
|
|
23
|
-
var Info = function Info() {
|
|
24
|
-
var _useContext = useContext(Context),
|
|
25
|
-
state = _useContext.state,
|
|
26
|
-
dispatch = _useContext.dispatch;
|
|
27
|
-
var errorTypes = {
|
|
28
|
-
product: locales.getText("pisell2.text.status.service-error-1"),
|
|
29
|
-
time: locales.getText("pisell2.text.status.service-error-2"),
|
|
30
|
-
maxLimit: locales.getText("pisell2.text.status.service-error-3")
|
|
31
|
-
};
|
|
32
|
-
var handleEditService = function handleEditService(item) {
|
|
33
|
-
if (state.disabledEdit) {
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
dispatch({
|
|
37
|
-
type: "setService",
|
|
38
|
-
payload: {
|
|
39
|
-
editModal: true,
|
|
40
|
-
cacheItem: _objectSpread(_objectSpread({}, item), {}, {
|
|
41
|
-
new: 0
|
|
42
|
-
})
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
};
|
|
46
|
-
var getResourceItem = useCallback(function (id) {
|
|
47
|
-
if (id === 0) {
|
|
48
|
-
return getNoResource();
|
|
49
|
-
}
|
|
50
|
-
return state.service.resources.find(function (d) {
|
|
51
|
-
return d.form_record_id === id;
|
|
52
|
-
});
|
|
53
|
-
}, [state.service.resources]);
|
|
54
|
-
var getErrorMessage = useCallback(function (service, resourceItem) {
|
|
55
|
-
var errorList = getErrorList(resourceItem, service);
|
|
56
|
-
var errorMessage = "";
|
|
57
|
-
if (!service.id) {
|
|
58
|
-
return errorList[0].label;
|
|
59
|
-
}
|
|
60
|
-
if (errorList.length) {
|
|
61
|
-
if (errorList.length > 1) {
|
|
62
|
-
errorMessage = "".concat(errorList.length, " ").concat(locales.getText("pisell2.text.warnings"));
|
|
63
|
-
} else {
|
|
64
|
-
errorMessage = (resourceItem === null || resourceItem === void 0 ? void 0 : resourceItem.labelText) + " " + errorTypes[errorList[0].type];
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
return errorMessage;
|
|
68
|
-
}, []);
|
|
69
|
-
var handleLike = function handleLike(status, item) {
|
|
70
|
-
if (state.disabledEdit) {
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
var _list = _toConsumableArray(state.service.value);
|
|
74
|
-
var _id = item === null || item === void 0 ? void 0 : item._id;
|
|
75
|
-
_list = _list.map(function (d) {
|
|
76
|
-
return d._id === _id ? _objectSpread(_objectSpread({}, d), {}, {
|
|
77
|
-
_extend: _objectSpread(_objectSpread({}, d._extend), {}, {
|
|
78
|
-
like_status: status
|
|
79
|
-
})
|
|
80
|
-
}) : d;
|
|
81
|
-
});
|
|
82
|
-
dispatch({
|
|
83
|
-
type: "setService",
|
|
84
|
-
payload: {
|
|
85
|
-
value: _list,
|
|
86
|
-
edit: true
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
|
-
};
|
|
5
|
+
import ServiceList from "./serviceList";
|
|
6
|
+
var Service = function Service() {
|
|
90
7
|
useEffect(function () {
|
|
91
8
|
document.body.id = "body";
|
|
92
9
|
}, []);
|
|
93
10
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
94
11
|
className: "pisell-lowcode__booking-service-wrap"
|
|
95
|
-
}, /*#__PURE__*/React.createElement(
|
|
96
|
-
className: ""
|
|
97
|
-
}, state.service.value.map(function (d) {
|
|
98
|
-
var _d$_extend, _d$_extend2, _d$_extend3, _d$_extend4, _d$_extend5;
|
|
99
|
-
var resourceItem = getResourceItem((_d$_extend = d._extend) === null || _d$_extend === void 0 ? void 0 : _d$_extend.resource);
|
|
100
|
-
var errorMessage = getErrorMessage(d, resourceItem);
|
|
101
|
-
var resourceName = (resourceItem === null || resourceItem === void 0 ? void 0 : resourceItem.labelText) || d.relation_form_name;
|
|
102
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
103
|
-
key: d._id,
|
|
104
|
-
className: "pisell-lowcode__booking-service-item",
|
|
105
|
-
onClick: function onClick() {
|
|
106
|
-
handleEditService(d);
|
|
107
|
-
}
|
|
108
|
-
}, d.id ? /*#__PURE__*/React.createElement("div", {
|
|
109
|
-
className: "pisell-lowcode__booking-service-item-title"
|
|
110
|
-
}, d.title) : null, d._extend ? /*#__PURE__*/React.createElement(React.Fragment, null, state.renderType !== 'eventBooking' && /*#__PURE__*/React.createElement("div", {
|
|
111
|
-
className: "pisell-lowcode__booking-service-item-date"
|
|
112
|
-
}, getServiceTime(d, state.date.value)), /*#__PURE__*/React.createElement("div", {
|
|
113
|
-
className: "pisell-lowcode__booking-service-item-technician"
|
|
114
|
-
}, d._extend.resource ? /*#__PURE__*/React.createElement(Like, {
|
|
115
|
-
style: {
|
|
116
|
-
marginRight: 4
|
|
117
|
-
},
|
|
118
|
-
status: d._extend.like_status,
|
|
119
|
-
onChange: function onChange(e) {
|
|
120
|
-
handleLike(e, d);
|
|
121
|
-
}
|
|
122
|
-
}) : null, resourceName)) : null, d.id ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
123
|
-
className: "pisell-lowcode__booking-service-item-price-wrap"
|
|
124
|
-
}, /*#__PURE__*/React.createElement("span", {
|
|
125
|
-
className: "pisell-lowcode__booking-service-item-price"
|
|
126
|
-
}, formatAmount((_d$_extend2 = d._extend) === null || _d$_extend2 === void 0 ? void 0 : _d$_extend2.price, 2, state.amountSymbol)), Number((_d$_extend3 = d._extend) === null || _d$_extend3 === void 0 ? void 0 : _d$_extend3.price) != Number(d.price) ? /*#__PURE__*/React.createElement("span", {
|
|
127
|
-
className: "pisell-lowcode__booking-service-item-original-price"
|
|
128
|
-
}, formatAmount(d.price, 2, state.amountSymbol)) : null), (_d$_extend4 = d._extend) !== null && _d$_extend4 !== void 0 && _d$_extend4.discount_reason ? /*#__PURE__*/React.createElement("div", {
|
|
129
|
-
className: "pisell-lowcode__booking-service-item-discount-reason"
|
|
130
|
-
}, /*#__PURE__*/React.createElement("span", null, locales.getText("pisell2.text.discount-reason"), ":"), " ", (_d$_extend5 = d._extend) === null || _d$_extend5 === void 0 ? void 0 : _d$_extend5.discount_reason) : null) : null, errorMessage ? /*#__PURE__*/React.createElement(Alert, {
|
|
131
|
-
message: errorMessage,
|
|
132
|
-
type: "warning",
|
|
133
|
-
showIcon: true,
|
|
134
|
-
className: "pisell-lowcode__booking-service-item-error"
|
|
135
|
-
}) : null);
|
|
136
|
-
})), /*#__PURE__*/React.createElement(AddService, null)), /*#__PURE__*/React.createElement(EditService, null));
|
|
12
|
+
}, /*#__PURE__*/React.createElement(ServiceList, null), /*#__PURE__*/React.createElement(AddService, null)), /*#__PURE__*/React.createElement(EditService, null));
|
|
137
13
|
};
|
|
138
|
-
export default
|
|
14
|
+
export default Service;
|
|
@@ -1,100 +1,3 @@
|
|
|
1
1
|
.pisell-lowcode__booking-service-wrap {
|
|
2
2
|
margin-top: 16px;
|
|
3
|
-
}
|
|
4
|
-
.pisell-lowcode__booking-service-item {
|
|
5
|
-
width: 100%;
|
|
6
|
-
border-radius: 8px;
|
|
7
|
-
border: 1px solid #D5D7DA;
|
|
8
|
-
margin-bottom: 16px;
|
|
9
|
-
position: relative;
|
|
10
|
-
overflow: hidden;
|
|
11
|
-
padding: 16px 20px;
|
|
12
|
-
display: flex;
|
|
13
|
-
flex-direction: column;
|
|
14
|
-
justify-content: center;
|
|
15
|
-
gap: 4px;
|
|
16
|
-
cursor: pointer;
|
|
17
|
-
background-color: #fff;
|
|
18
|
-
|
|
19
|
-
&:last-child {
|
|
20
|
-
margin-bottom: 0;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
&::before {
|
|
24
|
-
content: '';
|
|
25
|
-
position: absolute;
|
|
26
|
-
left: 0;
|
|
27
|
-
top: 0;
|
|
28
|
-
width: 6px;
|
|
29
|
-
height: 100%;
|
|
30
|
-
background: #80BCFE;
|
|
31
|
-
z-index: 2;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
.pisell-lowcode__booking-service-item-title {
|
|
35
|
-
color: var(--gray-900, #101828);
|
|
36
|
-
|
|
37
|
-
font-size: 16px;
|
|
38
|
-
font-style: normal;
|
|
39
|
-
font-weight: 600;
|
|
40
|
-
line-height: 24px;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
.pisell-lowcode__booking-service-item-date {
|
|
44
|
-
color: var(--gray-500, #667085);
|
|
45
|
-
|
|
46
|
-
font-size: 14px;
|
|
47
|
-
font-style: normal;
|
|
48
|
-
font-weight: 400;
|
|
49
|
-
line-height: 20px;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
.pisell-lowcode__booking-service-item-technician {
|
|
53
|
-
color: var(--gray-500, #667085);
|
|
54
|
-
|
|
55
|
-
font-size: 14px;
|
|
56
|
-
font-style: normal;
|
|
57
|
-
font-weight: 400;
|
|
58
|
-
line-height: 20px;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
.pisell-lowcode__booking-service-item-price-wrap {
|
|
62
|
-
.pisell-lowcode__booking-service-item-price {
|
|
63
|
-
color: var(--gray-500, #667085);
|
|
64
|
-
|
|
65
|
-
font-size: 14px;
|
|
66
|
-
font-style: normal;
|
|
67
|
-
font-weight: 400;
|
|
68
|
-
line-height: 20px;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
.pisell-lowcode__booking-service-item-original-price {
|
|
72
|
-
color: var(--gray-500, #667085);
|
|
73
|
-
|
|
74
|
-
font-size: 14px;
|
|
75
|
-
font-style: normal;
|
|
76
|
-
font-weight: 400;
|
|
77
|
-
line-height: 20px;
|
|
78
|
-
margin-left: 8px;
|
|
79
|
-
text-decoration: line-through;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
.pisell-lowcode__booking-service-item-discount-reason {
|
|
86
|
-
color: var(--gray-500, #667085);
|
|
87
|
-
|
|
88
|
-
font-size: 14px;
|
|
89
|
-
font-style: normal;
|
|
90
|
-
font-weight: 400;
|
|
91
|
-
line-height: 20px;
|
|
92
|
-
white-space: break-spaces;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
.pisell-lowcode__booking-service-item-error {
|
|
96
|
-
border: none;
|
|
97
|
-
margin: 0 -20px -16px;
|
|
98
|
-
border-radius: 0 0 8px 8px;
|
|
99
|
-
}
|
|
100
3
|
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import React, { useMemo } from "react";
|
|
2
|
+
import Like from "../like";
|
|
3
|
+
import { getServiceTime } from "../../../utils";
|
|
4
|
+
import { formatAmount, locales } from "@pisell/utils";
|
|
5
|
+
import CollapsibleList from "../../../components/collapsibleList";
|
|
6
|
+
import { renderBundles } from "../../../components/collapsibleList/utils";
|
|
7
|
+
import { Alert } from "antd";
|
|
8
|
+
import "./index.less";
|
|
9
|
+
var ServiceItem = function ServiceItem(_ref) {
|
|
10
|
+
var _d$_extend3, _d$_extend4, _d$_extend5, _d$_extend5$other, _d$_extend6, _d$_extend6$other, _d$_extend7, _d$_extend8, _d$_extend9;
|
|
11
|
+
var d = _ref.d,
|
|
12
|
+
handleEditService = _ref.handleEditService,
|
|
13
|
+
state = _ref.state,
|
|
14
|
+
handleLike = _ref.handleLike,
|
|
15
|
+
resourceItem = _ref.resourceItem,
|
|
16
|
+
errorMessage = _ref.errorMessage;
|
|
17
|
+
var resourceName = (resourceItem === null || resourceItem === void 0 ? void 0 : resourceItem.labelText) || d.relation_form_name;
|
|
18
|
+
var isDiscount = useMemo(function () {
|
|
19
|
+
var _d$_extend, _d$_extend2;
|
|
20
|
+
return Number((_d$_extend = d._extend) === null || _d$_extend === void 0 ? void 0 : _d$_extend.total) != Number((_d$_extend2 = d._extend) === null || _d$_extend2 === void 0 ? void 0 : _d$_extend2.origin_total);
|
|
21
|
+
}, [(_d$_extend3 = d._extend) === null || _d$_extend3 === void 0 ? void 0 : _d$_extend3.total, (_d$_extend4 = d._extend) === null || _d$_extend4 === void 0 ? void 0 : _d$_extend4.origin_total]);
|
|
22
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
23
|
+
key: d._id,
|
|
24
|
+
className: "pisell-lowcode__booking-service-item",
|
|
25
|
+
onClick: function onClick() {
|
|
26
|
+
handleEditService(d);
|
|
27
|
+
}
|
|
28
|
+
}, d.id ? /*#__PURE__*/React.createElement("div", {
|
|
29
|
+
className: "pisell-lowcode__booking-service-item-title"
|
|
30
|
+
}, d.title) : null, d._extend ? /*#__PURE__*/React.createElement(React.Fragment, null, state.renderType !== "eventBooking" && /*#__PURE__*/React.createElement("div", {
|
|
31
|
+
className: "pisell-lowcode__booking-service-item-date"
|
|
32
|
+
}, getServiceTime(d, state.date.value)), /*#__PURE__*/React.createElement("div", {
|
|
33
|
+
className: "pisell-lowcode__booking-service-item-technician"
|
|
34
|
+
}, d._extend.resource ? /*#__PURE__*/React.createElement(Like, {
|
|
35
|
+
style: {
|
|
36
|
+
marginRight: 4
|
|
37
|
+
},
|
|
38
|
+
status: d._extend.like_status,
|
|
39
|
+
onChange: function onChange(e) {
|
|
40
|
+
handleLike(e, d);
|
|
41
|
+
}
|
|
42
|
+
}) : null, resourceName)) : null, (((_d$_extend5 = d._extend) === null || _d$_extend5 === void 0 ? void 0 : (_d$_extend5$other = _d$_extend5.other) === null || _d$_extend5$other === void 0 ? void 0 : _d$_extend5$other.bundle) || []).length ? /*#__PURE__*/React.createElement(CollapsibleList, {
|
|
43
|
+
border: true,
|
|
44
|
+
list: ((_d$_extend6 = d._extend) === null || _d$_extend6 === void 0 ? void 0 : (_d$_extend6$other = _d$_extend6.other) === null || _d$_extend6$other === void 0 ? void 0 : _d$_extend6$other.bundle) || [],
|
|
45
|
+
renderItem: function renderItem(item) {
|
|
46
|
+
return renderBundles(item, state.amountSymbol);
|
|
47
|
+
}
|
|
48
|
+
}) : null, d.id ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
49
|
+
className: "pisell-lowcode__booking-service-item-price-wrap"
|
|
50
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
51
|
+
className: "pisell-lowcode__booking-service-item-price"
|
|
52
|
+
}, formatAmount((_d$_extend7 = d._extend) === null || _d$_extend7 === void 0 ? void 0 : _d$_extend7.total, 2, state.amountSymbol)), isDiscount ? /*#__PURE__*/React.createElement("span", {
|
|
53
|
+
className: "pisell-lowcode__booking-service-item-original-price"
|
|
54
|
+
}, formatAmount(d._extend.origin_total, 2, state.amountSymbol)) : null)) : null, isDiscount && (_d$_extend8 = d._extend) !== null && _d$_extend8 !== void 0 && _d$_extend8.discount_reason ? /*#__PURE__*/React.createElement("div", {
|
|
55
|
+
className: "pisell-lowcode__booking-service-item-discount-reason"
|
|
56
|
+
}, /*#__PURE__*/React.createElement("span", null, locales.getText("pisell2.text.discount-reason"), ":"), " ", (_d$_extend9 = d._extend) === null || _d$_extend9 === void 0 ? void 0 : _d$_extend9.discount_reason) : null, errorMessage ? /*#__PURE__*/React.createElement(Alert, {
|
|
57
|
+
message: errorMessage,
|
|
58
|
+
type: "warning",
|
|
59
|
+
showIcon: true,
|
|
60
|
+
className: "pisell-lowcode__booking-service-item-error"
|
|
61
|
+
}) : null);
|
|
62
|
+
};
|
|
63
|
+
export default ServiceItem;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
.pisell-lowcode__booking-service-item {
|
|
2
|
+
width: 100%;
|
|
3
|
+
border-radius: 8px;
|
|
4
|
+
border: 1px solid #D5D7DA;
|
|
5
|
+
margin-bottom: 16px;
|
|
6
|
+
position: relative;
|
|
7
|
+
overflow: hidden;
|
|
8
|
+
padding: 16px 20px;
|
|
9
|
+
display: flex;
|
|
10
|
+
flex-direction: column;
|
|
11
|
+
justify-content: center;
|
|
12
|
+
gap: 4px;
|
|
13
|
+
cursor: pointer;
|
|
14
|
+
background-color: #fff;
|
|
15
|
+
|
|
16
|
+
&:last-child {
|
|
17
|
+
margin-bottom: 0;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
&::before {
|
|
21
|
+
content: '';
|
|
22
|
+
position: absolute;
|
|
23
|
+
left: 0;
|
|
24
|
+
top: 0;
|
|
25
|
+
width: 6px;
|
|
26
|
+
height: 100%;
|
|
27
|
+
background: #80BCFE;
|
|
28
|
+
z-index: 2;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.pisell-lowcode__booking-service-item-title {
|
|
32
|
+
color: var(--gray-900, #101828);
|
|
33
|
+
|
|
34
|
+
font-size: 16px;
|
|
35
|
+
font-style: normal;
|
|
36
|
+
font-weight: 600;
|
|
37
|
+
line-height: 24px;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.pisell-lowcode__booking-service-item-date {
|
|
41
|
+
color: var(--gray-500, #667085);
|
|
42
|
+
|
|
43
|
+
font-size: 14px;
|
|
44
|
+
font-style: normal;
|
|
45
|
+
font-weight: 400;
|
|
46
|
+
line-height: 20px;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.pisell-lowcode__booking-service-item-technician {
|
|
50
|
+
color: var(--gray-500, #667085);
|
|
51
|
+
|
|
52
|
+
font-size: 14px;
|
|
53
|
+
font-style: normal;
|
|
54
|
+
font-weight: 400;
|
|
55
|
+
line-height: 20px;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.pisell-lowcode__booking-service-item-price-wrap {
|
|
59
|
+
.pisell-lowcode__booking-service-item-price {
|
|
60
|
+
color: var(--gray-500, #667085);
|
|
61
|
+
|
|
62
|
+
font-size: 14px;
|
|
63
|
+
font-style: normal;
|
|
64
|
+
font-weight: 400;
|
|
65
|
+
line-height: 20px;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.pisell-lowcode__booking-service-item-original-price {
|
|
69
|
+
color: var(--gray-500, #667085);
|
|
70
|
+
|
|
71
|
+
font-size: 14px;
|
|
72
|
+
font-style: normal;
|
|
73
|
+
font-weight: 400;
|
|
74
|
+
line-height: 20px;
|
|
75
|
+
margin-left: 8px;
|
|
76
|
+
text-decoration: line-through;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.pisell-lowcode__booking-service-item-discount-reason {
|
|
83
|
+
color: var(--gray-500, #667085);
|
|
84
|
+
|
|
85
|
+
font-size: 14px;
|
|
86
|
+
font-style: normal;
|
|
87
|
+
font-weight: 400;
|
|
88
|
+
line-height: 20px;
|
|
89
|
+
white-space: break-spaces;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.pisell-lowcode__booking-service-item-error {
|
|
93
|
+
border: none;
|
|
94
|
+
margin: 0 -20px -16px;
|
|
95
|
+
border-radius: 0 0 8px 8px;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
3
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
5
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
6
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
7
|
+
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; }
|
|
8
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
9
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
10
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
11
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
12
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
13
|
+
import React, { useCallback, useContext } from "react";
|
|
14
|
+
import { locales } from "@pisell/utils";
|
|
15
|
+
import "./index.less";
|
|
16
|
+
import { Context } from "../../model";
|
|
17
|
+
import { getNoResource } from "../../../mock";
|
|
18
|
+
import { getErrorList } from "../../../utils";
|
|
19
|
+
import ServiceItem from "../serviceItem";
|
|
20
|
+
var ServiceList = function ServiceList() {
|
|
21
|
+
var _useContext = useContext(Context),
|
|
22
|
+
state = _useContext.state,
|
|
23
|
+
dispatch = _useContext.dispatch;
|
|
24
|
+
var errorTypes = {
|
|
25
|
+
product: locales.getText("pisell2.text.status.service-error-1"),
|
|
26
|
+
time: locales.getText("pisell2.text.status.service-error-2"),
|
|
27
|
+
maxLimit: locales.getText("pisell2.text.status.service-error-3")
|
|
28
|
+
};
|
|
29
|
+
var handleEditService = function handleEditService(item) {
|
|
30
|
+
if (state.disabledEdit) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
dispatch({
|
|
34
|
+
type: "setService",
|
|
35
|
+
payload: {
|
|
36
|
+
editModal: true,
|
|
37
|
+
cacheItem: _objectSpread(_objectSpread({}, item), {}, {
|
|
38
|
+
new: 0
|
|
39
|
+
})
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
var getResourceItem = useCallback(function (id) {
|
|
44
|
+
if (id === 0) {
|
|
45
|
+
return getNoResource();
|
|
46
|
+
}
|
|
47
|
+
return state.service.resources.find(function (d) {
|
|
48
|
+
return d.form_record_id === id;
|
|
49
|
+
});
|
|
50
|
+
}, [state.service.resources]);
|
|
51
|
+
var getErrorMessage = useCallback(function (service, resourceItem) {
|
|
52
|
+
var errorList = getErrorList(resourceItem, service);
|
|
53
|
+
var errorMessage = "";
|
|
54
|
+
if (!service.id) {
|
|
55
|
+
return errorList[0].label;
|
|
56
|
+
}
|
|
57
|
+
if (errorList.length) {
|
|
58
|
+
if (errorList.length > 1) {
|
|
59
|
+
errorMessage = "".concat(errorList.length, " ").concat(locales.getText("pisell2.text.warnings"));
|
|
60
|
+
} else {
|
|
61
|
+
errorMessage = (resourceItem === null || resourceItem === void 0 ? void 0 : resourceItem.labelText) + " " + errorTypes[errorList[0].type];
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return errorMessage;
|
|
65
|
+
}, []);
|
|
66
|
+
var handleLike = function handleLike(status, item) {
|
|
67
|
+
if (state.disabledEdit) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
var _list = _toConsumableArray(state.service.value);
|
|
71
|
+
var _id = item === null || item === void 0 ? void 0 : item._id;
|
|
72
|
+
_list = _list.map(function (d) {
|
|
73
|
+
return d._id === _id ? _objectSpread(_objectSpread({}, d), {}, {
|
|
74
|
+
_extend: _objectSpread(_objectSpread({}, d._extend), {}, {
|
|
75
|
+
like_status: status
|
|
76
|
+
})
|
|
77
|
+
}) : d;
|
|
78
|
+
});
|
|
79
|
+
dispatch({
|
|
80
|
+
type: "setService",
|
|
81
|
+
payload: {
|
|
82
|
+
value: _list,
|
|
83
|
+
edit: true
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
};
|
|
87
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
88
|
+
className: ""
|
|
89
|
+
}, state.service.value.map(function (d) {
|
|
90
|
+
var _d$_extend;
|
|
91
|
+
var resourceItem = getResourceItem((_d$_extend = d._extend) === null || _d$_extend === void 0 ? void 0 : _d$_extend.resource);
|
|
92
|
+
var errorMessage = getErrorMessage(d, resourceItem);
|
|
93
|
+
return /*#__PURE__*/React.createElement(ServiceItem, {
|
|
94
|
+
key: d._id,
|
|
95
|
+
getResourceItem: getResourceItem,
|
|
96
|
+
errorMessage: errorMessage,
|
|
97
|
+
resourceItem: resourceItem,
|
|
98
|
+
d: d,
|
|
99
|
+
handleEditService: handleEditService,
|
|
100
|
+
state: state,
|
|
101
|
+
handleLike: handleLike
|
|
102
|
+
});
|
|
103
|
+
}));
|
|
104
|
+
};
|
|
105
|
+
export default ServiceList;
|
|
File without changes
|
|
@@ -93,6 +93,7 @@ export declare const deleteCacheParams: () => void;
|
|
|
93
93
|
* @Date: 2024-01-26 14:09
|
|
94
94
|
*/
|
|
95
95
|
export declare const getServerItemExtend: (state: any, cacheItem: any, timeObj: any) => any;
|
|
96
|
+
export declare const getProductTotalPrice: (item: any) => number;
|
|
96
97
|
/**
|
|
97
98
|
* @title: 判断 duration
|
|
98
99
|
* @description: 用于处理不同格式的duration
|
|
@@ -520,6 +520,21 @@ export var getServerItemExtend = function getServerItemExtend(state, cacheItem,
|
|
|
520
520
|
return _extend;
|
|
521
521
|
};
|
|
522
522
|
|
|
523
|
+
// 商品价格: (商品价格 + (套餐价格 + 单规格价格 * 单规格数量) * 套餐数量) * 商品数量
|
|
524
|
+
export var getProductTotalPrice = function getProductTotalPrice(item) {
|
|
525
|
+
var _item$_extend;
|
|
526
|
+
var price = 0;
|
|
527
|
+
price += Number(item._extend.price);
|
|
528
|
+
var other = (_item$_extend = item._extend) === null || _item$_extend === void 0 ? void 0 : _item$_extend.other;
|
|
529
|
+
if (other !== null && other !== void 0 && other.bundle) {
|
|
530
|
+
// bundle
|
|
531
|
+
price = other === null || other === void 0 ? void 0 : other.bundle.reduce(function (accumulator, currentValue) {
|
|
532
|
+
return accumulator + Number(currentValue.price) * Number(currentValue.num);
|
|
533
|
+
}, price);
|
|
534
|
+
}
|
|
535
|
+
price = price;
|
|
536
|
+
return price;
|
|
537
|
+
};
|
|
523
538
|
/**
|
|
524
539
|
* @title: 判断 duration
|
|
525
540
|
* @description: 用于处理不同格式的duration
|