@pisell/private-materials 3.0.199 → 3.0.201
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 +142 -142
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +10 -10
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +10 -10
- package/es/components/booking/addons/model.d.ts +1 -1
- package/es/components/booking/components/customSelect/index.d.ts +1 -0
- package/es/components/booking/components/customSelect/index.js +6 -2
- package/es/components/booking/components/footer/AppointmentProductModal/index.d.ts +3 -0
- package/es/components/booking/components/footer/AppointmentProductModal/index.js +38 -0
- package/es/components/booking/components/footer/AppointmentProductModal/index.less +0 -0
- package/es/components/booking/components/footer/amount.js +45 -22
- package/es/components/booking/components/footer/index.js +84 -40
- package/es/components/booking/components/footer/utils.js +243 -32
- package/es/components/booking/info/addServiceVariant/index.js +8 -1
- package/es/components/booking/info/clientVariant/vertical/SelectDrawer.d.ts +1 -0
- package/es/components/booking/info/clientVariant/vertical/SelectDrawer.js +14 -13
- package/es/components/booking/info/clientVariant/vertical/index.js +33 -4
- package/es/components/booking/info/dateRange/index.d.ts +5 -0
- package/es/components/booking/info/dateRange/index.js +98 -0
- package/es/components/booking/info/dateRange/index.less +21 -0
- package/es/components/booking/info/main.js +20 -8
- package/es/components/booking/info/model.js +3 -0
- package/es/components/booking/info/pet/ChangePetModal/index.d.ts +4 -0
- package/es/components/booking/info/pet/ChangePetModal/index.js +119 -0
- package/es/components/booking/info/pet/ChangePetModal/index.less +4 -0
- package/es/components/booking/info/pet/index.js +54 -5
- package/es/components/booking/info/service/addService/index.js +142 -22
- package/es/components/booking/info/service/addService/index.less +13 -3
- package/es/components/booking/info/service/addService/utils.d.ts +11 -2
- package/es/components/booking/info/service/addService/utils.js +49 -24
- package/es/components/booking/info/service/editService/index.js +255 -44
- package/es/components/booking/info/service/editService/index.less +18 -13
- package/es/components/booking/info/service2/Lists.d.ts +3 -0
- package/es/components/booking/info/service2/Lists.js +158 -0
- package/es/components/booking/info/service2/hooks/useSelectPet.d.ts +6 -0
- package/es/components/booking/info/service2/hooks/useSelectPet.js +54 -0
- package/es/components/booking/info/service2/index.d.ts +3 -0
- package/es/components/booking/info/service2/index.js +58 -0
- package/es/components/booking/info/service2/status.d.ts +31 -0
- package/es/components/booking/info/service2/status.js +78 -0
- package/es/components/booking/info/service2/utils.d.ts +145 -0
- package/es/components/booking/info/service2/utils.js +438 -0
- package/es/components/booking/info/utils.d.ts +9 -0
- package/es/components/booking/info/utils.js +13 -0
- package/es/components/booking/locales.d.ts +60 -0
- package/es/components/booking/locales.js +75 -3
- package/es/components/booking/materiels/holder/index.d.ts +7 -0
- package/es/components/booking/materiels/holder/index.js +51 -0
- package/es/components/booking/model.d.ts +4 -1
- package/es/components/booking/model.js +4 -2
- package/es/components/booking/payments/index.d.ts +1 -1
- package/es/components/booking/utils.d.ts +12 -3
- package/es/components/booking/utils.js +139 -23
- package/es/components/eftpos/form/index.js +6 -12
- package/es/components/eftpos/group/index.d.ts +2 -1
- package/es/components/eftpos/group/index.js +2 -1
- package/es/components/eftpos/index.js +2 -2
- package/es/components/eftposPay/helper.d.ts +0 -1
- package/es/components/eftposPay/helper.js +0 -14
- package/es/components/eftposPay/tyro/index.js +20 -51
- package/es/components/shoppingCart/Provider.d.ts +3 -0
- package/es/components/shoppingCart/Provider.js +86 -0
- package/es/components/shoppingCart/components/Cart/Product.d.ts +4 -0
- package/es/components/shoppingCart/components/Cart/Product.js +96 -0
- package/es/components/shoppingCart/components/Cart/index.d.ts +4 -0
- package/es/components/shoppingCart/components/Cart/index.js +72 -0
- package/es/components/shoppingCart/components/Cart/index.less +68 -0
- package/es/components/shoppingCart/components/Empty/index.d.ts +4 -0
- package/es/components/shoppingCart/components/Empty/index.js +14 -0
- package/es/components/shoppingCart/components/Empty/index.less +19 -0
- package/es/components/shoppingCart/components/Render/index.d.ts +4 -0
- package/es/components/shoppingCart/components/Render/index.js +68 -0
- package/es/components/shoppingCart/components/Render/index.less +2 -0
- package/es/components/shoppingCart/components/SelectHolderModal/index.d.ts +4 -0
- package/es/components/shoppingCart/components/SelectHolderModal/index.js +124 -0
- package/es/components/shoppingCart/components/SelectHolderModal/index.less +32 -0
- package/es/components/shoppingCart/hooks/useAddService.d.ts +3 -0
- package/es/components/shoppingCart/hooks/useAddService.js +23 -0
- package/es/components/shoppingCart/hooks/useClearCart.d.ts +3 -0
- package/es/components/shoppingCart/hooks/useClearCart.js +54 -0
- package/es/components/shoppingCart/hooks/useContext.d.ts +1 -0
- package/es/components/shoppingCart/hooks/useContext.js +5 -0
- package/es/components/shoppingCart/index.d.ts +4 -0
- package/es/components/shoppingCart/index.js +24 -0
- package/es/components/shoppingCart/locales.d.ts +33 -0
- package/es/components/shoppingCart/locales.js +38 -0
- package/es/components/shoppingCart/mock.d.ts +40 -0
- package/es/components/shoppingCart/mock.js +40 -0
- package/es/components/shoppingCart/status.d.ts +2 -0
- package/es/components/shoppingCart/status.js +22 -0
- package/es/components/shoppingCart/type.d.ts +39 -0
- package/es/components/shoppingCart/type.js +1 -0
- package/es/components/shoppingCart/utils.d.ts +63 -0
- package/es/components/shoppingCart/utils.js +119 -0
- package/es/index.d.ts +1 -0
- package/es/index.js +2 -1
- package/lib/components/booking/addons/model.d.ts +1 -1
- package/lib/components/booking/components/customSelect/index.d.ts +1 -0
- package/lib/components/booking/components/customSelect/index.js +6 -2
- package/lib/components/booking/components/footer/AppointmentProductModal/index.d.ts +3 -0
- package/lib/components/booking/components/footer/AppointmentProductModal/index.js +60 -0
- package/lib/components/booking/components/footer/AppointmentProductModal/index.less +0 -0
- package/lib/components/booking/components/footer/amount.js +26 -8
- package/lib/components/booking/components/footer/index.js +25 -4
- package/lib/components/booking/components/footer/utils.js +157 -31
- package/lib/components/booking/info/addServiceVariant/index.js +5 -0
- package/lib/components/booking/info/clientVariant/vertical/SelectDrawer.d.ts +1 -0
- package/lib/components/booking/info/clientVariant/vertical/SelectDrawer.js +8 -7
- package/lib/components/booking/info/clientVariant/vertical/index.js +36 -10
- package/lib/components/booking/info/dateRange/index.d.ts +5 -0
- package/lib/components/booking/info/dateRange/index.js +111 -0
- package/lib/components/booking/info/dateRange/index.less +21 -0
- package/lib/components/booking/info/main.js +11 -4
- package/lib/components/booking/info/model.js +3 -0
- package/lib/components/booking/info/pet/ChangePetModal/index.d.ts +4 -0
- package/lib/components/booking/info/pet/ChangePetModal/index.js +111 -0
- package/lib/components/booking/info/pet/ChangePetModal/index.less +4 -0
- package/lib/components/booking/info/pet/index.js +61 -25
- package/lib/components/booking/info/service/addService/index.js +107 -34
- package/lib/components/booking/info/service/addService/index.less +13 -3
- package/lib/components/booking/info/service/addService/utils.d.ts +11 -2
- package/lib/components/booking/info/service/addService/utils.js +31 -10
- package/lib/components/booking/info/service/editService/index.js +293 -125
- package/lib/components/booking/info/service/editService/index.less +18 -13
- package/lib/components/booking/info/service2/Lists.d.ts +3 -0
- package/lib/components/booking/info/service2/Lists.js +113 -0
- package/lib/components/booking/info/service2/hooks/useSelectPet.d.ts +6 -0
- package/lib/components/booking/info/service2/hooks/useSelectPet.js +50 -0
- package/lib/components/booking/info/service2/index.d.ts +3 -0
- package/lib/components/booking/info/service2/index.js +75 -0
- package/lib/components/booking/info/service2/status.d.ts +31 -0
- package/lib/components/booking/info/service2/status.js +81 -0
- package/lib/components/booking/info/service2/utils.d.ts +145 -0
- package/lib/components/booking/info/service2/utils.js +322 -0
- package/lib/components/booking/info/utils.d.ts +9 -0
- package/lib/components/booking/info/utils.js +6 -0
- package/lib/components/booking/locales.d.ts +60 -0
- package/lib/components/booking/locales.js +63 -3
- package/lib/components/booking/materiels/holder/index.d.ts +7 -0
- package/lib/components/booking/materiels/holder/index.js +65 -0
- package/lib/components/booking/model.d.ts +4 -1
- package/lib/components/booking/model.js +4 -2
- package/lib/components/booking/payments/index.d.ts +1 -1
- package/lib/components/booking/utils.d.ts +12 -3
- package/lib/components/booking/utils.js +87 -15
- package/lib/components/eftpos/form/index.js +6 -12
- package/lib/components/eftpos/group/index.d.ts +2 -1
- package/lib/components/eftpos/group/index.js +1 -0
- package/lib/components/eftpos/index.js +2 -2
- package/lib/components/eftposPay/helper.d.ts +0 -1
- package/lib/components/eftposPay/helper.js +0 -21
- package/lib/components/eftposPay/tyro/index.js +7 -36
- package/lib/components/shoppingCart/Provider.d.ts +3 -0
- package/lib/components/shoppingCart/Provider.js +110 -0
- package/lib/components/shoppingCart/components/Cart/Product.d.ts +4 -0
- package/lib/components/shoppingCart/components/Cart/Product.js +89 -0
- package/lib/components/shoppingCart/components/Cart/index.d.ts +4 -0
- package/lib/components/shoppingCart/components/Cart/index.js +77 -0
- package/lib/components/shoppingCart/components/Cart/index.less +68 -0
- package/lib/components/shoppingCart/components/Empty/index.d.ts +4 -0
- package/lib/components/shoppingCart/components/Empty/index.js +43 -0
- package/lib/components/shoppingCart/components/Empty/index.less +19 -0
- package/lib/components/shoppingCart/components/Render/index.d.ts +4 -0
- package/lib/components/shoppingCart/components/Render/index.js +79 -0
- package/lib/components/shoppingCart/components/Render/index.less +2 -0
- package/lib/components/shoppingCart/components/SelectHolderModal/index.d.ts +4 -0
- package/lib/components/shoppingCart/components/SelectHolderModal/index.js +116 -0
- package/lib/components/shoppingCart/components/SelectHolderModal/index.less +32 -0
- package/lib/components/shoppingCart/hooks/useAddService.d.ts +3 -0
- package/lib/components/shoppingCart/hooks/useAddService.js +55 -0
- package/lib/components/shoppingCart/hooks/useClearCart.d.ts +3 -0
- package/lib/components/shoppingCart/hooks/useClearCart.js +71 -0
- package/lib/components/shoppingCart/hooks/useContext.d.ts +1 -0
- package/lib/components/shoppingCart/hooks/useContext.js +31 -0
- package/lib/components/shoppingCart/index.d.ts +4 -0
- package/lib/components/shoppingCart/index.js +60 -0
- package/lib/components/shoppingCart/locales.d.ts +33 -0
- package/lib/components/shoppingCart/locales.js +56 -0
- package/lib/components/shoppingCart/mock.d.ts +40 -0
- package/lib/components/shoppingCart/mock.js +76 -0
- package/lib/components/shoppingCart/status.d.ts +2 -0
- package/lib/components/shoppingCart/status.js +60 -0
- package/lib/components/shoppingCart/type.d.ts +39 -0
- package/lib/components/shoppingCart/type.js +17 -0
- package/lib/components/shoppingCart/utils.d.ts +63 -0
- package/lib/components/shoppingCart/utils.js +92 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +3 -0
- package/lowcode/shopping-cart/meta.ts +98 -0
- package/package.json +4 -4
- package/es/components/eftpos/receipt/index.d.ts +0 -24
- package/es/components/eftpos/receipt/index.js +0 -96
- package/lib/components/eftpos/receipt/index.d.ts +0 -24
- package/lib/components/eftpos/receipt/index.js +0 -88
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var _excluded = ["direction", "options"],
|
|
2
2
|
_excluded2 = ["label", "value"],
|
|
3
|
-
_excluded3 = ["direction", "options"],
|
|
3
|
+
_excluded3 = ["direction", "options", "component"],
|
|
4
4
|
_excluded4 = ["label", "value"];
|
|
5
5
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
6
6
|
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); }
|
|
@@ -38,6 +38,7 @@ export var CheckboxGroup = function CheckboxGroup(_ref) {
|
|
|
38
38
|
export var RadioGroup = function RadioGroup(_ref2) {
|
|
39
39
|
var direction = _ref2.direction,
|
|
40
40
|
options = _ref2.options,
|
|
41
|
+
component = _ref2.component,
|
|
41
42
|
props = _objectWithoutProperties(_ref2, _excluded3);
|
|
42
43
|
if (direction === 'vertical') {
|
|
43
44
|
return /*#__PURE__*/React.createElement(Radio.Group, props, /*#__PURE__*/React.createElement(Space, {
|
|
@@ -24,8 +24,8 @@ import Drawer from "../booking/components/drawer";
|
|
|
24
24
|
import Log from "./log";
|
|
25
25
|
import localeTexts from "./locales";
|
|
26
26
|
import { usePairTerminalo } from "./hooks";
|
|
27
|
-
import
|
|
28
|
-
import
|
|
27
|
+
import ApiKeyIcon from "./icon/apiKey";
|
|
28
|
+
import DeviceIcon from "./icon/device";
|
|
29
29
|
import { Eftpos, getCommByFields, DeviceEnum, getDefaultValue } from "./const";
|
|
30
30
|
import "./index.less";
|
|
31
31
|
locales.init(localeTexts, localStorage.getItem('umi_locale') || 'en');
|
|
@@ -216,18 +216,4 @@ export function getPayAmonunt(_ref, formatAmount) {
|
|
|
216
216
|
surRateMoney: "".concat(surRateMoney),
|
|
217
217
|
totalUnit: formatAmount(total)
|
|
218
218
|
};
|
|
219
|
-
}
|
|
220
|
-
export function getBrowserVersion() {
|
|
221
|
-
var Sys = {};
|
|
222
|
-
var ua = navigator.userAgent.toLowerCase();
|
|
223
|
-
var s;
|
|
224
|
-
(s = ua.match(/rv:([\d.]+)\) like gecko/)) ? Sys.ie = s[1] : (s = ua.match(/msie ([\d\.]+)/)) ? Sys.ie = s[1] : (s = ua.match(/edge\/([\d\.]+)/)) ? Sys.edge = s[1] : (s = ua.match(/firefox\/([\d\.]+)/)) ? Sys.firefox = s[1] : (s = ua.match(/(?:opera|opr).([\d\.]+)/)) ? Sys.opera = s[1] : (s = ua.match(/chrome\/([\d\.]+)/)) ? Sys.chrome = s[1] : (s = ua.match(/version\/([\d\.]+).*safari/)) ? Sys.safari = s[1] : 0;
|
|
225
|
-
// 根据关系进行判断
|
|
226
|
-
if (Sys.ie) return 'IE: ' + Sys.ie;
|
|
227
|
-
if (Sys.edge) return 'EDGE: ' + Sys.edge;
|
|
228
|
-
if (Sys.firefox) return 'Firefox: ' + Sys.firefox;
|
|
229
|
-
if (Sys.chrome) return 'Chrome: ' + Sys.chrome;
|
|
230
|
-
if (Sys.opera) return 'Opera: ' + Sys.opera;
|
|
231
|
-
if (Sys.safari) return 'Safari: ' + Sys.safari;
|
|
232
|
-
return 'Unkonwn';
|
|
233
219
|
}
|
|
@@ -21,7 +21,7 @@ import { Button } from 'antd';
|
|
|
21
21
|
import { useDispatch, useContextData, updateState, updateCustom, updateComponent } from "../store";
|
|
22
22
|
import { ModeEnum, ClientEnum } from "../const";
|
|
23
23
|
import { Decimal } from 'decimal.js';
|
|
24
|
-
import { getUuid, getPayParams
|
|
24
|
+
import { getUuid, getPayParams } from "../helper";
|
|
25
25
|
import Step from "../component/step/step";
|
|
26
26
|
import { useStoreRef } from "../hooks";
|
|
27
27
|
var Minute = 1000 * 60;
|
|
@@ -68,22 +68,6 @@ export default (function (_ref) {
|
|
|
68
68
|
var requestIdRef = useRef((custom === null || custom === void 0 ? void 0 : custom.requestId) || '');
|
|
69
69
|
var unloadRef = useRef(false);
|
|
70
70
|
var clearRef = useRef();
|
|
71
|
-
var isPrint = function isPrint(key) {
|
|
72
|
-
var _deviceRef$current, _deviceRef$current$se, _deviceRef$current2, _deviceRef$current2$s;
|
|
73
|
-
if ((_deviceRef$current = deviceRef.current) !== null && _deviceRef$current !== void 0 && (_deviceRef$current$se = _deviceRef$current.setting) !== null && _deviceRef$current$se !== void 0 && _deviceRef$current$se.receipts) {
|
|
74
|
-
return false;
|
|
75
|
-
}
|
|
76
|
-
var receiptList = (_deviceRef$current2 = deviceRef.current) === null || _deviceRef$current2 === void 0 ? void 0 : (_deviceRef$current2$s = _deviceRef$current2.setting) === null || _deviceRef$current2$s === void 0 ? void 0 : _deviceRef$current2$s.receiptList;
|
|
77
|
-
if (!Array.isArray(receiptList)) {
|
|
78
|
-
return true;
|
|
79
|
-
}
|
|
80
|
-
if (Array.isArray(receiptList) && receiptList.some(function (item) {
|
|
81
|
-
return item === key;
|
|
82
|
-
})) {
|
|
83
|
-
return true;
|
|
84
|
-
}
|
|
85
|
-
return false;
|
|
86
|
-
};
|
|
87
71
|
useEffect(function () {
|
|
88
72
|
listRef.current = (custom === null || custom === void 0 ? void 0 : custom.list) || [];
|
|
89
73
|
}, [custom === null || custom === void 0 ? void 0 : custom.list]);
|
|
@@ -133,7 +117,7 @@ export default (function (_ref) {
|
|
|
133
117
|
* @Date: 2024-08-19 11:32
|
|
134
118
|
*/
|
|
135
119
|
var refundOrder = function refundOrder() {
|
|
136
|
-
var _deviceRef$
|
|
120
|
+
var _deviceRef$current, _deviceRef$current$se, _deviceRef$current2;
|
|
137
121
|
var iClient = iClientRef.current;
|
|
138
122
|
if (!iClient) {
|
|
139
123
|
return;
|
|
@@ -151,16 +135,12 @@ export default (function (_ref) {
|
|
|
151
135
|
}));
|
|
152
136
|
requestParams.current = {
|
|
153
137
|
amount: new Decimal(amountRef.current || 0).mul(100).toFixed(0, Decimal.ROUND_HALF_UP),
|
|
154
|
-
// 打印小票 true
|
|
155
|
-
integratedReceipt: !((_deviceRef$
|
|
138
|
+
// 打印小票 true 打印到系统上 false 打印到pos机上
|
|
139
|
+
integratedReceipt: !((_deviceRef$current = deviceRef.current) !== null && _deviceRef$current !== void 0 && (_deviceRef$current$se = _deviceRef$current.setting) !== null && _deviceRef$current$se !== void 0 && _deviceRef$current$se.receipts),
|
|
156
140
|
integrationKey: integrationKey,
|
|
157
141
|
transactionId: numRef.current,
|
|
158
142
|
mid: mid,
|
|
159
|
-
tid: tid
|
|
160
|
-
device: JSON.stringify(deviceRef.current),
|
|
161
|
-
isPrintMerchant: isPrint('merchant'),
|
|
162
|
-
isPrintCustomer: isPrint('customer'),
|
|
163
|
-
browserVersion: getBrowserVersion()
|
|
143
|
+
tid: tid
|
|
164
144
|
};
|
|
165
145
|
dispatch(updateCustom({
|
|
166
146
|
requestParams: requestParams.current
|
|
@@ -171,7 +151,7 @@ export default (function (_ref) {
|
|
|
171
151
|
api.addTransaction({
|
|
172
152
|
order_id: orderIdRef.current,
|
|
173
153
|
number: numRef.current,
|
|
174
|
-
card_reader_id: (_deviceRef$
|
|
154
|
+
card_reader_id: (_deviceRef$current2 = deviceRef.current) === null || _deviceRef$current2 === void 0 ? void 0 : _deviceRef$current2.id,
|
|
175
155
|
card_reader_type: eftpos,
|
|
176
156
|
amount: requestParams.current.amount,
|
|
177
157
|
action: modeRef.current === ModeEnum.FullPay ? ModeEnum.Pay : modeRef.current,
|
|
@@ -203,7 +183,7 @@ export default (function (_ref) {
|
|
|
203
183
|
* @Date: 2024-08-19 11:33
|
|
204
184
|
*/
|
|
205
185
|
var payOrder = function payOrder() {
|
|
206
|
-
var _deviceRef$
|
|
186
|
+
var _deviceRef$current3, _deviceRef$current3$s, _payRef$current, _deviceRef$current4, _deviceRef$current4$s, _deviceRef$current5, _deviceRef$current5$s, _deviceRef$current6;
|
|
207
187
|
var iClient = iClientRef.current;
|
|
208
188
|
if (!iClient) {
|
|
209
189
|
return;
|
|
@@ -219,22 +199,18 @@ export default (function (_ref) {
|
|
|
219
199
|
dispatch(updateState({
|
|
220
200
|
number: numRef.current
|
|
221
201
|
}));
|
|
222
|
-
console.log('deviceRef.current?.settings?.useOriginSurcharge = ', (_deviceRef$
|
|
202
|
+
console.log('deviceRef.current?.settings?.useOriginSurcharge = ', (_deviceRef$current3 = deviceRef.current) === null || _deviceRef$current3 === void 0 ? void 0 : (_deviceRef$current3$s = _deviceRef$current3.setting) === null || _deviceRef$current3$s === void 0 ? void 0 : _deviceRef$current3$s.useOriginSurcharge);
|
|
223
203
|
// (deviceRef.current?.setting as { receipts?: boolean })
|
|
224
204
|
requestParams.current = {
|
|
225
205
|
amount: new Decimal((_payRef$current = payRef.current) === null || _payRef$current === void 0 ? void 0 : _payRef$current.total).mul(100).toFixed(0, Decimal.ROUND_HALF_UP),
|
|
226
206
|
// 手续费 true tyro 手续费, false 系统手续费
|
|
227
|
-
enableSurcharge: ((_deviceRef$
|
|
207
|
+
enableSurcharge: ((_deviceRef$current4 = deviceRef.current) === null || _deviceRef$current4 === void 0 ? void 0 : (_deviceRef$current4$s = _deviceRef$current4.setting) === null || _deviceRef$current4$s === void 0 ? void 0 : _deviceRef$current4$s.useOriginSurcharge) || false,
|
|
228
208
|
// 打印小票 true 打印到系统上 false 打印到pos机上
|
|
229
|
-
integratedReceipt: !((_deviceRef$
|
|
209
|
+
integratedReceipt: !((_deviceRef$current5 = deviceRef.current) !== null && _deviceRef$current5 !== void 0 && (_deviceRef$current5$s = _deviceRef$current5.setting) !== null && _deviceRef$current5$s !== void 0 && _deviceRef$current5$s.receipts),
|
|
230
210
|
integrationKey: integrationKey,
|
|
231
211
|
transactionId: numRef.current,
|
|
232
212
|
mid: mid,
|
|
233
|
-
tid: tid
|
|
234
|
-
device: JSON.stringify(deviceRef.current),
|
|
235
|
-
isPrintMerchant: isPrint('merchant'),
|
|
236
|
-
isPrintCustomer: isPrint('customer'),
|
|
237
|
-
browserVersion: getBrowserVersion()
|
|
213
|
+
tid: tid
|
|
238
214
|
};
|
|
239
215
|
dispatch(updateCustom({
|
|
240
216
|
requestParams: requestParams.current
|
|
@@ -245,7 +221,7 @@ export default (function (_ref) {
|
|
|
245
221
|
api.addTransaction({
|
|
246
222
|
order_id: orderIdRef.current,
|
|
247
223
|
number: numRef.current,
|
|
248
|
-
card_reader_id: (_deviceRef$
|
|
224
|
+
card_reader_id: (_deviceRef$current6 = deviceRef.current) === null || _deviceRef$current6 === void 0 ? void 0 : _deviceRef$current6.id,
|
|
249
225
|
card_reader_type: eftpos,
|
|
250
226
|
amount: requestParams.current.amount,
|
|
251
227
|
action: modeRef.current === ModeEnum.FullPay ? ModeEnum.Pay : modeRef.current,
|
|
@@ -308,17 +284,11 @@ export default (function (_ref) {
|
|
|
308
284
|
var receipt = [merchantReceipt].filter(function (item) {
|
|
309
285
|
return typeof item === 'string';
|
|
310
286
|
}).filter(Boolean);
|
|
287
|
+
onChange('print', receipt);
|
|
311
288
|
merchantReceiptRef.current = {
|
|
312
289
|
signatureRequired: signatureRequired,
|
|
313
290
|
merchantReceipt: merchantReceipt
|
|
314
291
|
};
|
|
315
|
-
if (signatureRequired) {
|
|
316
|
-
onChange('print', receipt);
|
|
317
|
-
return;
|
|
318
|
-
}
|
|
319
|
-
if (isPrint('merchant')) {
|
|
320
|
-
onChange('print', receipt);
|
|
321
|
-
}
|
|
322
292
|
};
|
|
323
293
|
|
|
324
294
|
/**
|
|
@@ -403,7 +373,7 @@ export default (function (_ref) {
|
|
|
403
373
|
* @Date: 2024-08-19 11:35
|
|
404
374
|
*/
|
|
405
375
|
var transactionCompleteCallbackImpl = function transactionCompleteCallbackImpl(response) {
|
|
406
|
-
var _deviceRef$
|
|
376
|
+
var _deviceRef$current7;
|
|
407
377
|
setStatus(-1);
|
|
408
378
|
setManually(false);
|
|
409
379
|
console.log('Response = ' + JSON.stringify(response), ', Request = ', JSON.stringify(requestParams.current));
|
|
@@ -415,7 +385,7 @@ export default (function (_ref) {
|
|
|
415
385
|
api.editTransaction(requestIdRef.current, {
|
|
416
386
|
order_id: orderIdRef.current,
|
|
417
387
|
number: numRef.current,
|
|
418
|
-
card_reader_id: (_deviceRef$
|
|
388
|
+
card_reader_id: (_deviceRef$current7 = deviceRef.current) === null || _deviceRef$current7 === void 0 ? void 0 : _deviceRef$current7.id,
|
|
419
389
|
card_reader_type: eftpos,
|
|
420
390
|
amount: requestParams.current.amount,
|
|
421
391
|
action: modeRef.current === ModeEnum.FullPay ? ModeEnum.Pay : modeRef.current,
|
|
@@ -443,6 +413,7 @@ export default (function (_ref) {
|
|
|
443
413
|
card_reader_surcharge: response.surchargeAmount || 0
|
|
444
414
|
}));
|
|
445
415
|
clearRef.current = setTimeout(function () {
|
|
416
|
+
var _deviceRef$current8;
|
|
446
417
|
var params = getPayParams({
|
|
447
418
|
mode: modeRef.current,
|
|
448
419
|
amount: amountRef.current,
|
|
@@ -455,17 +426,15 @@ export default (function (_ref) {
|
|
|
455
426
|
}
|
|
456
427
|
}, 'success');
|
|
457
428
|
onChange('success', _objectSpread(_objectSpread({}, params), {}, {
|
|
458
|
-
receipt:
|
|
429
|
+
receipt: (_deviceRef$current8 = deviceRef.current) !== null && _deviceRef$current8 !== void 0 && _deviceRef$current8.setting.receipts ? [] : receipt
|
|
459
430
|
}));
|
|
460
431
|
}, 1000);
|
|
461
432
|
return;
|
|
462
433
|
} else {
|
|
463
|
-
var _deviceRef$
|
|
464
|
-
var current = (_deviceRef$
|
|
434
|
+
var _deviceRef$current9;
|
|
435
|
+
var current = (_deviceRef$current9 = deviceRef.current) !== null && _deviceRef$current9 !== void 0 && _deviceRef$current9.setting.receipts ? [] : receipt;
|
|
465
436
|
if (current.length > 0) {
|
|
466
|
-
|
|
467
|
-
onChange('print', receipt);
|
|
468
|
-
}
|
|
437
|
+
onChange('print', current);
|
|
469
438
|
}
|
|
470
439
|
}
|
|
471
440
|
if (response.result === 'UNKNOWN') {
|
|
@@ -0,0 +1,86 @@
|
|
|
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 _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
3
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure 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 _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
|
+
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
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
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, { useState, createContext, useEffect } from 'react';
|
|
14
|
+
import { defaultData } from "./status";
|
|
15
|
+
import { formatState } from "./utils";
|
|
16
|
+
export var CartContext = /*#__PURE__*/createContext({});
|
|
17
|
+
export var CartProvider = function CartProvider(_ref) {
|
|
18
|
+
var children = _ref.children,
|
|
19
|
+
props = _ref.props,
|
|
20
|
+
onCard = _ref.onCard,
|
|
21
|
+
onChange = _ref.onChange,
|
|
22
|
+
onAddProduct = _ref.onAddProduct,
|
|
23
|
+
onActiveKey = _ref.onActiveKey;
|
|
24
|
+
var defaultState = _objectSpread(_objectSpread({}, defaultData), props);
|
|
25
|
+
var _useState = useState(defaultState),
|
|
26
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
27
|
+
state = _useState2[0],
|
|
28
|
+
setState = _useState2[1];
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* @title: 更新数据
|
|
32
|
+
* @description:
|
|
33
|
+
* @param {any} newState
|
|
34
|
+
* @return {*}
|
|
35
|
+
* @Author: WangHan
|
|
36
|
+
* @Date: 2024-11-28 14:44
|
|
37
|
+
*/
|
|
38
|
+
var updateState = function updateState(newState) {
|
|
39
|
+
console.log(newState, 'wh_new');
|
|
40
|
+
setState(function (prevState) {
|
|
41
|
+
return _objectSpread(_objectSpread({}, prevState), newState);
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* @title: 更新配置
|
|
47
|
+
* @description:
|
|
48
|
+
* @return {*}
|
|
49
|
+
* @Author: WangHan
|
|
50
|
+
* @Date: 2024-11-28 18:40
|
|
51
|
+
*/
|
|
52
|
+
useEffect(function () {
|
|
53
|
+
// 对象中是否存在开启分组参数,没有则默认true
|
|
54
|
+
var _isOpenGroup = props === null || props === void 0 ? void 0 : props.hasOwnProperty('isOpenGroup');
|
|
55
|
+
var newState = {};
|
|
56
|
+
if (props !== null && props !== void 0 && props.platform) {
|
|
57
|
+
newState['platform'] = props === null || props === void 0 ? void 0 : props.platform;
|
|
58
|
+
}
|
|
59
|
+
if (_isOpenGroup) {
|
|
60
|
+
newState['isOpenGroup'] = props === null || props === void 0 ? void 0 : props.isOpenGroup;
|
|
61
|
+
}
|
|
62
|
+
if (props !== null && props !== void 0 && props.emptyText) {
|
|
63
|
+
newState['emptyText'] = props === null || props === void 0 ? void 0 : props.emptyText;
|
|
64
|
+
}
|
|
65
|
+
if (props !== null && props !== void 0 && props.productParams) {
|
|
66
|
+
newState = _objectSpread(_objectSpread({}, newState), props === null || props === void 0 ? void 0 : props.productParams);
|
|
67
|
+
}
|
|
68
|
+
if (props !== null && props !== void 0 && props.collapseParams) {
|
|
69
|
+
newState['collapseParams'] = props === null || props === void 0 ? void 0 : props.collapseParams;
|
|
70
|
+
}
|
|
71
|
+
var params = _objectSpread(_objectSpread({}, defaultState), newState);
|
|
72
|
+
var result = _objectSpread(_objectSpread({}, params), formatState(params));
|
|
73
|
+
console.log(result, params, 'result');
|
|
74
|
+
setState(result);
|
|
75
|
+
}, [props === null || props === void 0 ? void 0 : props.platform, props === null || props === void 0 ? void 0 : props.isOpenGroup, props === null || props === void 0 ? void 0 : props.emptyText, props === null || props === void 0 ? void 0 : props.productParams, props === null || props === void 0 ? void 0 : props.collapseParams]);
|
|
76
|
+
return /*#__PURE__*/React.createElement(CartContext.Provider, {
|
|
77
|
+
value: {
|
|
78
|
+
state: state,
|
|
79
|
+
updateState: updateState,
|
|
80
|
+
onCard: onCard,
|
|
81
|
+
onChange: onChange,
|
|
82
|
+
onAddProduct: onAddProduct,
|
|
83
|
+
onActiveKey: onActiveKey
|
|
84
|
+
}
|
|
85
|
+
}, children);
|
|
86
|
+
};
|
|
@@ -0,0 +1,96 @@
|
|
|
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 _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
3
|
+
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; }
|
|
4
|
+
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; }
|
|
5
|
+
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; }
|
|
6
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
7
|
+
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); }
|
|
8
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
9
|
+
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."); }
|
|
10
|
+
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); }
|
|
11
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
12
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
13
|
+
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; }
|
|
14
|
+
import React, { useMemo } from 'react';
|
|
15
|
+
import { ProductCard } from '@pisell/materials';
|
|
16
|
+
import useClearCart from "../../hooks/useClearCart";
|
|
17
|
+
import { updateProduct } from "../../utils";
|
|
18
|
+
import { useContext } from "../../hooks/useContext";
|
|
19
|
+
import useAddService from "../../hooks/useAddService";
|
|
20
|
+
var Product = function Product(props) {
|
|
21
|
+
var id = props.id,
|
|
22
|
+
lists = props.lists;
|
|
23
|
+
var _useContext = useContext(),
|
|
24
|
+
state = _useContext.state,
|
|
25
|
+
updateState = _useContext.updateState,
|
|
26
|
+
_onAction = _useContext.onAction,
|
|
27
|
+
onChange = _useContext.onChange,
|
|
28
|
+
_onCard = _useContext.onCard;
|
|
29
|
+
var disabledEdit = state.disabledEdit,
|
|
30
|
+
isShowPackageNote = state.isShowPackageNote,
|
|
31
|
+
isShowNote = state.isShowNote,
|
|
32
|
+
hideAddBtn = state.hideAddBtn;
|
|
33
|
+
var clearCart = useClearCart(id);
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* @title: 更新商品数据
|
|
37
|
+
* @description:
|
|
38
|
+
* @param {any} item
|
|
39
|
+
* @return {*}
|
|
40
|
+
* @Author: WangHan
|
|
41
|
+
* @Date: 2024-11-28 22:02
|
|
42
|
+
*/
|
|
43
|
+
var handleChange = function handleChange(item, type) {
|
|
44
|
+
if (disabledEdit) return;
|
|
45
|
+
var products = _toConsumableArray(state.products);
|
|
46
|
+
|
|
47
|
+
// 删除商品
|
|
48
|
+
if (type === 'delete') {
|
|
49
|
+
products = products.filter(function (product) {
|
|
50
|
+
return product._id !== item._id;
|
|
51
|
+
});
|
|
52
|
+
} else {
|
|
53
|
+
products = products.map(function (product) {
|
|
54
|
+
if (product._id === item._id) {
|
|
55
|
+
return _objectSpread(_objectSpread({}, product), item);
|
|
56
|
+
}
|
|
57
|
+
return product;
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// 更新state
|
|
62
|
+
updateState(updateProduct(state, products));
|
|
63
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(products);
|
|
64
|
+
};
|
|
65
|
+
var productParams = useMemo(function () {
|
|
66
|
+
return {
|
|
67
|
+
isShowNote: isShowNote,
|
|
68
|
+
isShowPackageNote: isShowPackageNote,
|
|
69
|
+
disabledEdit: disabledEdit
|
|
70
|
+
};
|
|
71
|
+
}, [isShowNote, isShowPackageNote, disabledEdit]);
|
|
72
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
73
|
+
className: "pisell-lowcode__shopping-cart-content"
|
|
74
|
+
}, clearCart, lists === null || lists === void 0 ? void 0 : lists.map(function (item) {
|
|
75
|
+
return /*#__PURE__*/React.createElement(ProductCard, _extends({
|
|
76
|
+
key: item._id,
|
|
77
|
+
dataSource: item,
|
|
78
|
+
onAction: function onAction(e) {
|
|
79
|
+
return _onAction === null || _onAction === void 0 ? void 0 : _onAction(e);
|
|
80
|
+
},
|
|
81
|
+
onDelete: function onDelete(e) {
|
|
82
|
+
return handleChange(e, 'delete');
|
|
83
|
+
},
|
|
84
|
+
onNote: function onNote(e) {
|
|
85
|
+
return handleChange(e);
|
|
86
|
+
},
|
|
87
|
+
onLike: function onLike(e) {
|
|
88
|
+
return handleChange(e);
|
|
89
|
+
},
|
|
90
|
+
onCard: function onCard(e) {
|
|
91
|
+
return _onCard === null || _onCard === void 0 ? void 0 : _onCard(e);
|
|
92
|
+
}
|
|
93
|
+
}, productParams));
|
|
94
|
+
}), !hideAddBtn ? useAddService(id, 'more') : null);
|
|
95
|
+
};
|
|
96
|
+
export default Product;
|
|
@@ -0,0 +1,72 @@
|
|
|
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 _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
3
|
+
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; }
|
|
4
|
+
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; }
|
|
5
|
+
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; }
|
|
6
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
7
|
+
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); }
|
|
8
|
+
import React, { useMemo } from 'react';
|
|
9
|
+
import classNames from 'classnames';
|
|
10
|
+
import { Collapse } from '@pisell/materials';
|
|
11
|
+
import { locales } from '@pisell/utils';
|
|
12
|
+
import Empty from "../Empty";
|
|
13
|
+
import localeTexts from "../../locales";
|
|
14
|
+
import { useContext } from "../../hooks/useContext";
|
|
15
|
+
import Product from "./Product";
|
|
16
|
+
locales.init(localeTexts, localStorage.getItem('umi_locale') || 'en');
|
|
17
|
+
import "./index.less";
|
|
18
|
+
var Cart = function Cart() {
|
|
19
|
+
var _useContext = useContext(),
|
|
20
|
+
state = _useContext.state,
|
|
21
|
+
updateState = _useContext.updateState,
|
|
22
|
+
onActiveKey = _useContext.onActiveKey;
|
|
23
|
+
var platform = state.platform,
|
|
24
|
+
carts = state.carts,
|
|
25
|
+
isProductList = state.isProductList,
|
|
26
|
+
collapseParams = state.collapseParams;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* @title: 折叠面板
|
|
30
|
+
* @description:
|
|
31
|
+
* @param {*} useMemo
|
|
32
|
+
* @return {*}
|
|
33
|
+
* @Author: WangHan
|
|
34
|
+
* @Date: 2024-11-27 15:01
|
|
35
|
+
*/
|
|
36
|
+
var cartsMap = useMemo(function () {
|
|
37
|
+
return carts === null || carts === void 0 ? void 0 : carts.map(function (item) {
|
|
38
|
+
var _item$products, _item$products2;
|
|
39
|
+
return _objectSpread(_objectSpread({}, item), {}, {
|
|
40
|
+
label: /*#__PURE__*/React.createElement("div", {
|
|
41
|
+
className: "pisell-lowcode__shopping-cart-label"
|
|
42
|
+
}, "".concat(item === null || item === void 0 ? void 0 : item.label, " ").concat(locales.getText('pisell2.text.shopping-cart.item')(item === null || item === void 0 ? void 0 : (_item$products = item.products) === null || _item$products === void 0 ? void 0 : _item$products.length))),
|
|
43
|
+
children: (item === null || item === void 0 ? void 0 : (_item$products2 = item.products) === null || _item$products2 === void 0 ? void 0 : _item$products2.length) > 0 ? /*#__PURE__*/React.createElement(Product, {
|
|
44
|
+
id: item === null || item === void 0 ? void 0 : item.key,
|
|
45
|
+
lists: item === null || item === void 0 ? void 0 : item.products
|
|
46
|
+
}) : /*#__PURE__*/React.createElement(Empty, {
|
|
47
|
+
id: item === null || item === void 0 ? void 0 : item.key
|
|
48
|
+
}),
|
|
49
|
+
showArrow: platform === 'shop'
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
}, [carts, platform]);
|
|
53
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
54
|
+
className: classNames('pisell-lowcode__shopping-cart')
|
|
55
|
+
}, isProductList ? /*#__PURE__*/React.createElement(Product, {
|
|
56
|
+
id: undefined,
|
|
57
|
+
lists: state === null || state === void 0 ? void 0 : state.products
|
|
58
|
+
}) : /*#__PURE__*/React.createElement(Collapse, _extends({
|
|
59
|
+
items: cartsMap,
|
|
60
|
+
showHeader: true,
|
|
61
|
+
panelBackground: "#ffffff",
|
|
62
|
+
collapsible: platform !== 'shop' ? 'disabled' : '-',
|
|
63
|
+
accordion: platform === 'shop',
|
|
64
|
+
onChange: function onChange(key) {
|
|
65
|
+
updateState({
|
|
66
|
+
activeKey: key
|
|
67
|
+
});
|
|
68
|
+
onActiveKey(key);
|
|
69
|
+
}
|
|
70
|
+
}, collapseParams)));
|
|
71
|
+
};
|
|
72
|
+
export default Cart;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
.pisell-lowcode__shopping-cart {
|
|
2
|
+
.pisell-lowcode-collapse-content-box {
|
|
3
|
+
padding: 0 0 16px !important;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.pisell-lowcode-collapse-item {
|
|
7
|
+
.pisell-lowcode-collapse-header {
|
|
8
|
+
padding: 20px 0 !important;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
&:first-child {
|
|
12
|
+
.pisell-lowcode-collapse-header {
|
|
13
|
+
padding: 0 0 20px !important;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.pisell-lowcode__shopping-cart-content {
|
|
19
|
+
display: flex;
|
|
20
|
+
flex-direction: column;
|
|
21
|
+
gap: 16px;
|
|
22
|
+
|
|
23
|
+
.pisell-lowcode-product-card {
|
|
24
|
+
margin-bottom: 0;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.pisell-lowcode__shopping-cart-label {
|
|
29
|
+
color: var(--Base-Black, #000);
|
|
30
|
+
font-size: 16px;
|
|
31
|
+
font-style: normal;
|
|
32
|
+
font-weight: 600;
|
|
33
|
+
line-height: 24px;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.pisell-lowcode__shopping-cart-clear-btn {
|
|
37
|
+
cursor: pointer;
|
|
38
|
+
color: var(--Blue-700, #175cd3);
|
|
39
|
+
font-weight: 600;
|
|
40
|
+
line-height: 24px; /* 150% */
|
|
41
|
+
display: flex;
|
|
42
|
+
align-items: center;
|
|
43
|
+
.anticon {
|
|
44
|
+
font-size: 18px;
|
|
45
|
+
margin-right: 6px;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.pisell-lowcode__shopping-cart-clear-btn-empty {
|
|
50
|
+
margin-top: 12px;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.pisell-lowcode__shopping-cart-add-service {
|
|
54
|
+
color: var(--Blue-700, #175cd3);
|
|
55
|
+
font-size: 16px;
|
|
56
|
+
font-style: normal;
|
|
57
|
+
font-weight: 400;
|
|
58
|
+
line-height: 24px;
|
|
59
|
+
display: flex;
|
|
60
|
+
align-items: center;
|
|
61
|
+
gap: 8px;
|
|
62
|
+
cursor: pointer;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.pisell-lowcode__shopping-cart-add-service-products {
|
|
66
|
+
align-items: start;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { useContext } from "../../hooks/useContext";
|
|
2
|
+
import useAddService from "../../hooks/useAddService";
|
|
3
|
+
import "./index.less";
|
|
4
|
+
var Empty = function Empty(props) {
|
|
5
|
+
var _useContext = useContext(),
|
|
6
|
+
state = _useContext.state;
|
|
7
|
+
var emptyText = state.emptyText,
|
|
8
|
+
holders = state.holders,
|
|
9
|
+
hideAddBtn = state.hideAddBtn;
|
|
10
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
11
|
+
className: 'pisell-lowcode__shopping-cart-empty'
|
|
12
|
+
}, emptyText, !hideAddBtn ? useAddService(props === null || props === void 0 ? void 0 : props.id) : null);
|
|
13
|
+
};
|
|
14
|
+
export default Empty;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
.pisell-lowcode__shopping-cart-empty {
|
|
2
|
+
color: var(--Gray-500, #667085);
|
|
3
|
+
font-size: 16px;
|
|
4
|
+
font-style: normal;
|
|
5
|
+
font-weight: 400;
|
|
6
|
+
line-height: 24px;
|
|
7
|
+
display: flex;
|
|
8
|
+
flex-direction: column;
|
|
9
|
+
align-items: center;
|
|
10
|
+
justify-content: center;
|
|
11
|
+
// height: 380px;
|
|
12
|
+
height: 40px;
|
|
13
|
+
margin: 16px 20px 20px;
|
|
14
|
+
gap: 10px;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.pisell-lowcode__shopping-cart-empty-multiple {
|
|
18
|
+
height: 40px;
|
|
19
|
+
}
|